зеркало из https://github.com/mozilla/fxa.git
Merge pull request #17350 from mozilla/FXA-10220
feat(settings): Update account preferences help link, add Glean click event
This commit is contained in:
Коммит
f3e9e0b899
|
@ -11,7 +11,7 @@ export abstract class SettingsLayout extends BaseLayout {
|
|||
}
|
||||
|
||||
get helpLink() {
|
||||
return this.page.getByTestId('header-sumo-link');
|
||||
return this.page.getByRole('link', { name: 'Help' });
|
||||
}
|
||||
|
||||
get bentoDropDownMenu() {
|
||||
|
|
|
@ -7,25 +7,25 @@ import { screen } from '@testing-library/react';
|
|||
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
|
||||
import HeaderLockup from '.';
|
||||
import { createMockSettingsIntegration } from '../mocks';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
import GleanMetrics from '../../../lib/glean';
|
||||
|
||||
// TODO: functional test for `data-testid="header-menu"` to be visible in
|
||||
// mobile & tablet but hidden at desktop
|
||||
jest.mock('../../../lib/glean', () => ({
|
||||
__esModule: true,
|
||||
default: {
|
||||
accountPref: {
|
||||
help: jest.fn(),
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
describe('HeaderLockup', () => {
|
||||
it('renders as expected', () => {
|
||||
renderWithLocalizationProvider(
|
||||
<HeaderLockup integration={createMockSettingsIntegration()} />
|
||||
);
|
||||
const headerHelp = screen.getByTestId('header-help');
|
||||
const headerMenu = screen.getByTestId('header-menu');
|
||||
|
||||
expect(screen.getByTestId('header-sumo-link')).toHaveAttribute(
|
||||
'href',
|
||||
'https://support.mozilla.org'
|
||||
);
|
||||
expect(headerHelp).toBeInTheDocument();
|
||||
expect(headerHelp).toHaveAttribute('title', 'Help');
|
||||
|
||||
expect(
|
||||
screen.getByTestId('drop-down-bento-menu-toggle')
|
||||
).toBeInTheDocument();
|
||||
|
@ -34,9 +34,21 @@ describe('HeaderLockup', () => {
|
|||
expect(headerMenu).toBeInTheDocument();
|
||||
expect(headerMenu).toHaveAttribute('title', 'Site navigation menu');
|
||||
|
||||
expect(screen.getByRole('link', { name: 'Help' })).toHaveAttribute(
|
||||
'href',
|
||||
'https://support.mozilla.org/products/mozilla-account'
|
||||
);
|
||||
expect(screen.getByTestId('back-to-top')).toHaveAttribute(
|
||||
'title',
|
||||
'Back to top'
|
||||
);
|
||||
});
|
||||
|
||||
it('emits Glean event on help link click', async () => {
|
||||
renderWithLocalizationProvider(
|
||||
<HeaderLockup integration={createMockSettingsIntegration()} />
|
||||
);
|
||||
await userEvent.click(screen.getByRole('link', { name: 'Help' }));
|
||||
expect(GleanMetrics.accountPref.help).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,6 +14,7 @@ import { ReactComponent as Menu } from './menu.svg';
|
|||
import { ReactComponent as Close } from './close.svg';
|
||||
import { SettingsIntegration } from '../interfaces';
|
||||
import Sidebar from '../Sidebar';
|
||||
import GleanMetrics from '../../../lib/glean';
|
||||
|
||||
export const HeaderLockup = ({
|
||||
integration,
|
||||
|
@ -27,6 +28,10 @@ export const HeaderLockup = ({
|
|||
? l10n.getString('header-menu-open', null, 'Close menu')
|
||||
: l10n.getString('header-menu-closed', null, 'Site navigation menu');
|
||||
|
||||
const handleHelpLinkClick = () => {
|
||||
GleanMetrics.accountPref.help();
|
||||
};
|
||||
|
||||
const left = (
|
||||
<>
|
||||
<button
|
||||
|
@ -69,17 +74,16 @@ export const HeaderLockup = ({
|
|||
const right = (
|
||||
<>
|
||||
<LinkExternal
|
||||
href="https://support.mozilla.org"
|
||||
href="https://support.mozilla.org/products/mozilla-account"
|
||||
title={localizedHelpText}
|
||||
data-testid="header-sumo-link"
|
||||
className="inline-block relative p-2 -m-2 z-[1] rounded hover:bg-grey-100"
|
||||
onClick={handleHelpLinkClick}
|
||||
>
|
||||
<Help
|
||||
aria-label={localizedHelpText}
|
||||
title={localizedHelpText}
|
||||
role="img"
|
||||
className="w-5 text-violet-900"
|
||||
data-testid="header-help"
|
||||
/>
|
||||
</LinkExternal>
|
||||
<BentoMenu />
|
||||
|
|
|
@ -429,6 +429,9 @@ const recordEventMetric = (
|
|||
case 'account_pref_secondary_email_submit':
|
||||
accountPref.secondaryEmailSubmit.record();
|
||||
break;
|
||||
case 'account_pref_help':
|
||||
accountPref.help.record();
|
||||
break;
|
||||
case 'delete_account_settings_submit':
|
||||
deleteAccount.settingsSubmit.record();
|
||||
break;
|
||||
|
|
|
@ -2114,6 +2114,23 @@ account_pref:
|
|||
reason:
|
||||
description: If reason is "create_password", the user was taken to the create password page, set a password, and then confirmed the account unlinking.
|
||||
type: string
|
||||
help:
|
||||
type: event
|
||||
description: |
|
||||
User clicked the question mark icon "Help" link in the account settings page header
|
||||
send_in_pings:
|
||||
- events
|
||||
notification_emails:
|
||||
- vzare@mozilla.com
|
||||
- fxa-staff@mozilla.com
|
||||
bugs:
|
||||
- https://mozilla-hub.atlassian.net/browse/FXA-10220
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1830504
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1844121
|
||||
expires: never
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
|
||||
delete_account:
|
||||
settings_submit:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import StringMetricType from '@mozilla/glean/private/metrics/string';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
@ -165,6 +165,23 @@ export const googleUnlinkSubmitConfirm = new EventMetricType<{
|
|||
['reason']
|
||||
);
|
||||
|
||||
/**
|
||||
* User clicked the question mark icon "Help" link in the account settings page
|
||||
* header
|
||||
*
|
||||
* Generated from `account_pref.help`.
|
||||
*/
|
||||
export const help = new EventMetricType(
|
||||
{
|
||||
category: 'account_pref',
|
||||
name: 'help',
|
||||
sendInPings: ['events'],
|
||||
lifetime: 'ping',
|
||||
disabled: false,
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
/**
|
||||
* Click on "Create" or "Change" button on account settings page to add a recovery
|
||||
* key to the account
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import BooleanMetricType from '@mozilla/glean/private/metrics/boolean';
|
||||
import StringMetricType from '@mozilla/glean/private/metrics/string';
|
||||
import BooleanMetricType from '@mozilla/glean/private/metrics/boolean';
|
||||
|
||||
/**
|
||||
* The name of the event
|
||||
|
|
|
@ -171,6 +171,7 @@ export const eventsMap = {
|
|||
appleUnlinkSubmitConfirm: 'account_pref_apple_unlink_submit_confirm',
|
||||
displayNameSubmit: 'account_pref_display_name_submit',
|
||||
secondaryEmailSubmit: 'account_pref_secondary_email_submit',
|
||||
help: 'account_pref_help',
|
||||
},
|
||||
|
||||
deleteAccount: {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import PingType from '@mozilla/glean/private/ping';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import StringMetricType from '@mozilla/glean/private/metrics/string';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import StringMetricType from '@mozilla/glean/private/metrics/string';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import LabeledMetricType from '@mozilla/glean/private/metrics/labeled';
|
||||
import BooleanMetricType from '@mozilla/glean/private/metrics/boolean';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import LabeledMetricType from '@mozilla/glean/private/metrics/labeled';
|
||||
import BooleanMetricType from '@mozilla/glean/private/metrics/boolean';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// AUTOGENERATED BY glean_parser v14.3.0. DO NOT EDIT. DO NOT COMMIT.
|
||||
// AUTOGENERATED BY glean_parser v14.5.1. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import StringMetricType from '@mozilla/glean/private/metrics/string';
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче