зеркало из https://github.com/mozilla/fxa.git
Merge pull request #17211 from mozilla/FXA-10039
feat(glean): Add account_pref_recovery_key_submit event
This commit is contained in:
Коммит
91f73407e3
|
@ -79,6 +79,7 @@ type UnitRowProps = {
|
|||
prefixDataTestId?: string;
|
||||
disabled?: boolean;
|
||||
disabledReason?: string;
|
||||
ctaOnClickAction?: () => void;
|
||||
};
|
||||
|
||||
export const UnitRow = ({
|
||||
|
@ -104,6 +105,7 @@ export const UnitRow = ({
|
|||
prefixDataTestId = '',
|
||||
disabled = false,
|
||||
disabledReason = '',
|
||||
ctaOnClickAction,
|
||||
}: UnitRowProps & RouteComponentProps) => {
|
||||
const { l10n } = useLocalization();
|
||||
const localizedCtaAdd = l10n.getString(
|
||||
|
@ -179,6 +181,7 @@ export const UnitRow = ({
|
|||
className="cta-neutral cta-base cta-base-p transition-standard me-1"
|
||||
data-testid={formatDataTestId('unit-row-route')}
|
||||
to={`${route}${location.search}`}
|
||||
onClick={ctaOnClickAction}
|
||||
>
|
||||
{ctaText}
|
||||
</Link>
|
||||
|
|
|
@ -12,6 +12,7 @@ import VerifiedSessionGuard from '../VerifiedSessionGuard';
|
|||
import { ButtonIconTrash } from '../ButtonIcon';
|
||||
import { HomePath } from '../../../constants';
|
||||
import { FtlMsg } from 'fxa-react/lib/utils';
|
||||
import GleanMetrics from '../../../lib/glean';
|
||||
|
||||
export const UnitRowRecoveryKey = () => {
|
||||
const account = useAccount();
|
||||
|
@ -96,6 +97,9 @@ export const UnitRowRecoveryKey = () => {
|
|||
/>
|
||||
)
|
||||
}
|
||||
ctaOnClickAction={() => {
|
||||
GleanMetrics.accountPref.recoveryKeySubmit();
|
||||
}}
|
||||
>
|
||||
<FtlMsg id="rk-content-explain">
|
||||
<p className="text-sm mt-3">
|
||||
|
|
|
@ -11,6 +11,7 @@ import * as pings from 'fxa-shared/metrics/glean/web/pings';
|
|||
import * as event from 'fxa-shared/metrics/glean/web/event';
|
||||
import * as reg from 'fxa-shared/metrics/glean/web/reg';
|
||||
import * as login from 'fxa-shared/metrics/glean/web/login';
|
||||
import * as accountPref from 'fxa-shared/metrics/glean/web/accountPref';
|
||||
import { userIdSha256 } from 'fxa-shared/metrics/glean/web/account';
|
||||
import {
|
||||
oauthClientId,
|
||||
|
@ -24,7 +25,6 @@ import {
|
|||
import * as utm from 'fxa-shared/metrics/glean/web/utm';
|
||||
|
||||
import { Config } from '../config';
|
||||
import { FlowQueryParams } from '../..';
|
||||
import { WebIntegration, useAccount } from '../../models';
|
||||
import { MetricsFlow } from '../metrics-flow';
|
||||
|
||||
|
@ -554,6 +554,20 @@ describe('lib/glean', () => {
|
|||
sinon.assert.calledOnce(spy);
|
||||
});
|
||||
});
|
||||
|
||||
describe('accountPref', () => {
|
||||
it('submits a ping with the account_pref_recovery_key_submit event name', async () => {
|
||||
GleanMetrics.accountPref.recoveryKeySubmit();
|
||||
const spy = sandbox.spy(accountPref.recoveryKeySubmit, 'record');
|
||||
await GleanMetrics.isDone();
|
||||
sinon.assert.calledOnce(setEventNameStub);
|
||||
sinon.assert.calledWith(
|
||||
setEventNameStub,
|
||||
'account_pref_recovery_key_submit'
|
||||
);
|
||||
sinon.assert.calledOnce(spy);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('toggle enabled state', () => {
|
||||
|
|
|
@ -25,6 +25,7 @@ import * as cadFirefox from 'fxa-shared/metrics/glean/web/cadFirefox';
|
|||
import * as cadApproveDevice from 'fxa-shared/metrics/glean/web/cadApproveDevice';
|
||||
import * as cadMobilePair from 'fxa-shared/metrics/glean/web/cadMobilePair';
|
||||
import * as cadMobilePairUseApp from 'fxa-shared/metrics/glean/web/cadMobilePairUseApp';
|
||||
import * as accountPref from 'fxa-shared/metrics/glean/web/accountPref';
|
||||
import { userIdSha256 } from 'fxa-shared/metrics/glean/web/account';
|
||||
import {
|
||||
oauthClientId,
|
||||
|
@ -350,6 +351,8 @@ const recordEventMetric = (
|
|||
case 'cad_mobile_pair_use_app_view':
|
||||
cadMobilePairUseApp.view.record();
|
||||
break;
|
||||
case 'account_pref_recovery_key_submit':
|
||||
accountPref.recoveryKeySubmit.record();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1806,3 +1806,22 @@ third_party_auth_set_password:
|
|||
expires: never
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
|
||||
account_pref:
|
||||
recovery_key_submit:
|
||||
type: event
|
||||
description: |
|
||||
Click on "Create" or "Change" button on account settings page to add a recovery key to the account
|
||||
send_in_pings:
|
||||
- events
|
||||
notification_emails:
|
||||
- vzare@mozilla.com
|
||||
- fxa-staff@mozilla.com
|
||||
bugs:
|
||||
- https://mozilla-hub.atlassian.net/browse/FXA-10039
|
||||
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
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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.1.2. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
/**
|
||||
* Click on "Create" or "Change" button on account settings page to add a recovery
|
||||
* key to the account
|
||||
*
|
||||
* Generated from `account_pref.recovery_key_submit`.
|
||||
*/
|
||||
export const recoveryKeySubmit = new EventMetricType(
|
||||
{
|
||||
category: 'account_pref',
|
||||
name: 'recovery_key_submit',
|
||||
sendInPings: ['events'],
|
||||
lifetime: 'ping',
|
||||
disabled: false,
|
||||
},
|
||||
[]
|
||||
);
|
|
@ -0,0 +1,40 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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.1.2. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
/**
|
||||
* User clicked "Download Firefox" on the "Switch to Firefox" page after trying to
|
||||
* access the pair flow
|
||||
*
|
||||
* Generated from `cad_redirect_desktop.download`.
|
||||
*/
|
||||
export const download = new EventMetricType(
|
||||
{
|
||||
category: 'cad_redirect_desktop',
|
||||
name: 'download',
|
||||
sendInPings: ['events'],
|
||||
lifetime: 'ping',
|
||||
disabled: false,
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
/**
|
||||
* User viewed the "Switch to Firefox" page after trying to access the pair flow
|
||||
*
|
||||
* Generated from `cad_redirect_desktop.view`.
|
||||
*/
|
||||
export const view = new EventMetricType(
|
||||
{
|
||||
category: 'cad_redirect_desktop',
|
||||
name: 'view',
|
||||
sendInPings: ['events'],
|
||||
lifetime: 'ping',
|
||||
disabled: false,
|
||||
},
|
||||
[]
|
||||
);
|
|
@ -2,6 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
import { recoveryKeySubmit } from './accountPref';
|
||||
|
||||
export type GleanMetricsConfig = {
|
||||
enabled: boolean;
|
||||
applicationId: string;
|
||||
|
@ -143,4 +145,8 @@ export const eventsMap = {
|
|||
cadFireFox: {
|
||||
notnowSubmit: 'cad_firefox_notnow_submit',
|
||||
},
|
||||
|
||||
accountPref: {
|
||||
recoveryKeySubmit: 'account_pref_recovery_key_submit',
|
||||
},
|
||||
} as const;
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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.1.2. DO NOT EDIT. DO NOT COMMIT.
|
||||
|
||||
import EventMetricType from '@mozilla/glean/private/metrics/event';
|
||||
|
||||
/**
|
||||
* User clicked Apple Signin link from an RP hosted site and is taken
|
||||
* directly to Apple authentication flow, bypassing Mozilla Accounts email
|
||||
* first page.
|
||||
*
|
||||
* Generated from `third_party_auth.apple_deeplink`.
|
||||
*/
|
||||
export const appleDeeplink = new EventMetricType(
|
||||
{
|
||||
category: 'third_party_auth',
|
||||
name: 'apple_deeplink',
|
||||
sendInPings: ['events'],
|
||||
lifetime: 'ping',
|
||||
disabled: false,
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
/**
|
||||
* User clicked Google Signin link from an RP hosted site and is taken
|
||||
* directly to Google authentication flow, bypassing Mozilla Accounts email
|
||||
* first page.
|
||||
*
|
||||
* Generated from `third_party_auth.google_deeplink`.
|
||||
*/
|
||||
export const googleDeeplink = new EventMetricType(
|
||||
{
|
||||
category: 'third_party_auth',
|
||||
name: 'google_deeplink',
|
||||
sendInPings: ['events'],
|
||||
lifetime: 'ping',
|
||||
disabled: false,
|
||||
},
|
||||
[]
|
||||
);
|
Загрузка…
Ссылка в новой задаче