Skip to content

Commit a0ef56c

Browse files
committed
fix(metrics): pass more metrics context params during 3rd-party verify
1 parent 8bacb97 commit a0ef56c

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

packages/fxa-settings/src/pages/PostVerify/ThirdPartyAuthCallback/index.test.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,22 +148,33 @@ describe('ThirdPartyAuthCallback component', () => {
148148
finishOAuthFlowHandler: mockFinishOAuthFlowHandler,
149149
});
150150

151-
renderWith();
151+
renderWith({
152+
flowQueryParams: {
153+
flowId: 'bbbb',
154+
flowBeginTime: 1734112296874,
155+
},
156+
integration: {
157+
...mockThirdPartyAuthCallbackIntegration(),
158+
getFxAParams: () =>
159+
'?flowId=aaaa&flowBeginTime=1734112296000&utm_campaign=testo',
160+
} as ModelsModule.ThirdPartyAuthCallbackIntegration,
161+
});
152162

153163
await waitFor(() => {
154164
expect(mockVerifyAccountThirdParty).toHaveBeenCalledWith(
155165
'code',
156166
'provider',
157167
undefined,
158168
{
169+
utmCampaign: 'testo',
159170
flowId: 'aaaa',
160171
flowBeginTime: 1734112296000,
161172
}
162173
);
163174
});
164175

165176
expect(hardNavigateSpy).toBeCalledWith(
166-
'/post_verify/third_party_auth/callback?flowId=aaaa&flowBeginTime=1734112296000'
177+
'/post_verify/third_party_auth/callback?flowId=aaaa&flowBeginTime=1734112296000&utm_campaign=testo'
167178
);
168179
});
169180

packages/fxa-settings/src/pages/PostVerify/ThirdPartyAuthCallback/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ const ThirdPartyAuthCallback = ({
140140
originalService,
141141
queryParamsToMetricsContext({
142142
...((flowQueryParams as Record<string, string>) || {}),
143+
...Object.fromEntries(params.entries()),
143144
// Important be sure to overwrite current flowQueryParams with provided fxa parameters.
144145
// If we don't do this, we will lose metrics.
145146
flowId,

0 commit comments

Comments
 (0)