Skip to content

Commit 45ce445

Browse files
committed
task(): remove 3rd-party auth deeplink functionality
1 parent 745da87 commit 45ce445

22 files changed

Lines changed: 38 additions & 293 deletions

File tree

packages/fxa-settings/src/components/ThirdPartyAuth/__snapshots__/index.test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ exports[`ThirdPartyAuthComponent buttons match snapshot: apple 1`] = `
44
<button
55
aria-label="Continue with Apple"
66
class="w-[60px] h-[60px] p-4 flex items-center justify-center rounded-full border focus-visible-default outline-offset-2
7-
bg-black border-transparent
8-
"
7+
bg-black border-transparent
8+
"
99
type="submit"
1010
>
1111
<svg
@@ -20,8 +20,8 @@ exports[`ThirdPartyAuthComponent buttons match snapshot: google 1`] = `
2020
<button
2121
aria-label="Continue with Google"
2222
class="w-[60px] h-[60px] p-4 flex items-center justify-center rounded-full border focus-visible-default outline-offset-2
23-
bg-[#F9F4F4] border-[#747775] border-[1px]
24-
"
23+
bg-[#F9F4F4] border-[#747775] border-[1px]
24+
"
2525
type="submit"
2626
>
2727
<svg

packages/fxa-settings/src/components/ThirdPartyAuth/index.test.tsx

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -143,36 +143,6 @@ describe('ThirdPartyAuthComponent', () => {
143143
expect(onContinueWithApple).not.toHaveBeenCalled();
144144
});
145145

146-
it('should deeplink directly to google auth, if deeplink=`googleLogin`', async () => {
147-
renderWith({
148-
enabled: true,
149-
showSeparator: false,
150-
deeplink: 'googleLogin',
151-
view: 'index',
152-
});
153-
154-
expect(
155-
(await screen.findByTestId('google-signin-form-state')).getAttribute(
156-
'value'
157-
)
158-
).not.toEqual('');
159-
});
160-
161-
it('should deeplink directly to apple auth, if deeplink=`appleLogin`', async () => {
162-
renderWith({
163-
enabled: true,
164-
showSeparator: false,
165-
deeplink: 'appleLogin',
166-
view: 'index',
167-
});
168-
169-
expect(
170-
(await screen.findByTestId('apple-signin-form-state')).getAttribute(
171-
'value'
172-
)
173-
).not.toEqual('');
174-
});
175-
176146
it('hides separator', async () => {
177147
renderWith({
178148
enabled: true,

packages/fxa-settings/src/components/ThirdPartyAuth/index.tsx

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export type ThirdPartyAuthProps = {
2020
onContinueWithApple?: FormEventHandler<HTMLFormElement>;
2121
showSeparator?: boolean;
2222
viewName?: string;
23-
deeplink?: string;
2423
flowQueryParams?: QueryParams;
2524
separatorType?: 'or' | 'signInWith';
2625
};
@@ -35,7 +34,6 @@ const ThirdPartyAuth = ({
3534
onContinueWithApple,
3635
showSeparator = true,
3736
viewName = 'unknown',
38-
deeplink,
3937
flowQueryParams,
4038
separatorType = 'or',
4139
}: ThirdPartyAuthProps) => {
@@ -91,7 +89,6 @@ const ThirdPartyAuth = ({
9189
<GoogleLogo className="w-full h-auto" />
9290
</>
9391
),
94-
deeplink,
9592
}}
9693
/>
9794
<ThirdPartySignInForm
@@ -111,7 +108,6 @@ const ThirdPartyAuth = ({
111108
<AppleLogo className="w-full h-auto" />
112109
</>
113110
),
114-
deeplink,
115111
}}
116112
/>
117113
</div>
@@ -139,7 +135,6 @@ const ThirdPartySignInForm = ({
139135
buttonText,
140136
onSubmit,
141137
viewName,
142-
deeplink,
143138
flowQueryParams,
144139
}: {
145140
party: 'google' | 'apple';
@@ -155,14 +150,12 @@ const ThirdPartySignInForm = ({
155150
buttonText: ReactElement;
156151
onSubmit?: FormEventHandler<HTMLFormElement>;
157152
viewName?: string;
158-
deeplink?: string;
159153
flowQueryParams?: QueryParams;
160154
}) => {
161155
const { logViewEventOnce } = useMetrics();
162156
const { l10n } = useLocalization();
163157
const stateRef = useRef<HTMLInputElement>(null);
164158
const formRef = useRef<HTMLFormElement>(null);
165-
const isDeeplinking = deeplink !== undefined;
166159

167160
const getLoginAriaLabel = () => {
168161
const labels = {
@@ -201,12 +194,6 @@ const ThirdPartySignInForm = ({
201194
case 'apple-signup':
202195
GleanMetrics.thirdPartyAuth.startAppleAuthFromReg();
203196
break;
204-
case 'google-deeplink':
205-
GleanMetrics.thirdPartyAuth.googleDeeplink();
206-
break;
207-
case 'apple-deeplink':
208-
GleanMetrics.thirdPartyAuth.appleDeeplink();
209-
break;
210197
}
211198

212199
// wait for all the Glean events to be sent before the page unloads
@@ -221,19 +208,6 @@ const ThirdPartySignInForm = ({
221208
onSubmit = () => true;
222209
}
223210

224-
useEffect(() => {
225-
if (deeplink && formRef.current) {
226-
// Only deeplink if this is the correct button
227-
if (
228-
(deeplink === 'googleLogin' && party === 'google') ||
229-
(deeplink === 'appleLogin' && party === 'apple')
230-
) {
231-
onClick();
232-
formRef.current.submit();
233-
}
234-
}
235-
}, [deeplink, onClick, party]);
236-
237211
return (
238212
<form
239213
action={authorizationEndpoint}
@@ -258,22 +232,20 @@ const ThirdPartySignInForm = ({
258232
<input type="hidden" name="response_mode" value={responseMode} />
259233
)}
260234

261-
{!isDeeplinking ? (
262-
<button
263-
type="submit"
264-
className={`w-[60px] h-[60px] p-4 flex items-center justify-center rounded-full border focus-visible-default outline-offset-2
265-
${
266-
party === 'google'
267-
? 'bg-[#F9F4F4] border-[#747775] border-[1px]'
268-
: 'bg-black border-transparent'
269-
}
270-
`}
271-
onClick={onClick}
272-
aria-label={getLoginAriaLabel()}
273-
>
274-
{buttonText}
275-
</button>
276-
) : null}
235+
<button
236+
type="submit"
237+
className={`w-[60px] h-[60px] p-4 flex items-center justify-center rounded-full border focus-visible-default outline-offset-2
238+
${
239+
party === 'google'
240+
? 'bg-[#F9F4F4] border-[#747775] border-[1px]'
241+
: 'bg-black border-transparent'
242+
}
243+
`}
244+
onClick={onClick}
245+
aria-label={getLoginAriaLabel()}
246+
>
247+
{buttonText}
248+
</button>
277249
</form>
278250
);
279251
};
@@ -302,7 +274,6 @@ function getState(flowQueryParams: QueryParams | undefined) {
302274

303275
// Remove unwanted keys
304276
const filteredParams = deleteParams(new URLSearchParams(combinedParams), [
305-
'deeplink',
306277
'email',
307278
'emailStatusChecked',
308279
'forceExperiment',

packages/fxa-settings/src/lib/glean/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,6 @@ const recordEventMetric = (
427427
case 'third_party_auth_apple_login_start':
428428
thirdPartyAuth.appleLoginStart.record();
429429
break;
430-
case 'third_party_auth_apple_deeplink':
431-
thirdPartyAuth.appleDeeplink.record();
432-
break;
433-
case 'third_party_auth_google_deeplink':
434-
thirdPartyAuth.googleDeeplink.record();
435-
break;
436430
case 'cad_firefox_notnow_submit':
437431
cadFirefox.notnowSubmit.record();
438432
break;

packages/fxa-settings/src/models/pages/index/query-params.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
import { IsEmail, IsIn, IsOptional, Validate } from 'class-validator';
5+
import { IsEmail, IsOptional, Validate } from 'class-validator';
66
import {
77
bind,
88
KeyTransforms,
@@ -20,9 +20,4 @@ export class IndexQueryParams extends ModelDataProvider {
2020
@Validate(IsEmailOrEmpty, {})
2121
@bind(KeyTransforms.snakeCase)
2222
loginHint: string | undefined;
23-
24-
@IsOptional()
25-
@IsIn(['googleLogin', 'appleLogin'])
26-
@bind()
27-
deeplink: string | undefined;
2823
}

packages/fxa-settings/src/models/pages/signin/query-params.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
MaxLength,
1212
Matches,
1313
Validate,
14-
IsIn,
1514
} from 'class-validator';
1615
import {
1716
bind,
@@ -51,9 +50,4 @@ export class SigninQueryParams extends ModelDataProvider {
5150
@Validate(IsFxaRedirectToUrl, {})
5251
@bind(T.snakeCase)
5352
redirectTo: string | undefined = undefined;
54-
55-
@IsOptional()
56-
@IsIn(['googleLogin', 'appleLogin'])
57-
@bind(T.snakeCase)
58-
deeplink!: string;
5953
}

packages/fxa-settings/src/models/pages/signup/query-params.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
import { IsBoolean, IsEmail, IsIn, IsOptional } from 'class-validator';
6-
import { bind, KeyTransforms as T, ModelDataProvider } from '../../../lib/model-data';
5+
import { IsBoolean, IsEmail, IsOptional } from 'class-validator';
6+
import { bind, ModelDataProvider } from '../../../lib/model-data';
77

88
export class SignupQueryParams extends ModelDataProvider {
99
// 'email' will be optional once the index page is converted to React
@@ -20,9 +20,4 @@ export class SignupQueryParams extends ModelDataProvider {
2020
@IsBoolean()
2121
@bind()
2222
emailStatusChecked: boolean = false;
23-
24-
@IsOptional()
25-
@IsIn(['googleLogin', 'appleLogin'])
26-
@bind(T.snakeCase)
27-
deeplink!: string;
2823
}

packages/fxa-settings/src/pages/Index/container.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ const IndexContainer = ({
315315
}, [ftlMsgResolver, deleteAccountSuccess]);
316316

317317
const initialPrefill = prefillEmail || suggestedEmail;
318-
const deeplink = queryParamModel.deeplink;
319318
const isMobile = isMobileDevice();
320319

321320
const cmsInfo = integration.getCmsInfo();
@@ -339,7 +338,6 @@ const IndexContainer = ({
339338
errorBannerMessage,
340339
successBannerMessage,
341340
tooltipErrorMessage,
342-
deeplink,
343341
flowQueryParams,
344342
isMobile,
345343
useFxAStatusResult,

packages/fxa-settings/src/pages/Index/index.test.tsx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,9 @@
55
import React from 'react';
66
import { screen, waitFor } from '@testing-library/react';
77
import { userEvent } from '@testing-library/user-event';
8-
import {
9-
createMockIndexOAuthIntegration,
10-
createMockIndexOAuthNativeIntegration,
11-
Subject,
12-
} from './mocks';
8+
import { createMockIndexOAuthNativeIntegration, Subject } from './mocks';
139
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
1410
import { MozServices } from '../../lib/types';
15-
import { MONITOR_CLIENTIDS } from '../../models/integrations/client-matching';
1611
import GleanMetrics from '../../lib/glean';
1712
import { MOCK_CMS_INFO } from '../mocks';
1813

@@ -219,29 +214,6 @@ describe('Index page', () => {
219214
).not.toBeInTheDocument();
220215
});
221216

222-
// This is wrapped so that the HTMLFormElement.submit can be mocked
223-
// without affecting other tests.
224-
describe('deep linking', () => {
225-
beforeEach(() => {
226-
HTMLFormElement.prototype.submit = jest.fn();
227-
});
228-
afterEach(() => {
229-
jest.resetAllMocks();
230-
});
231-
it('does not render when deeplinking third party auth', () => {
232-
renderWithLocalizationProvider(
233-
<Subject
234-
integration={createMockIndexOAuthIntegration({
235-
clientId: MONITOR_CLIENTIDS[0],
236-
})}
237-
deeplink="appleLogin"
238-
/>
239-
);
240-
241-
thirdPartyAuthNotRendered();
242-
});
243-
});
244-
245217
describe('glean metrics', () => {
246218
it('emits emailFirst.view on initial render', () => {
247219
const viewSpy = jest.spyOn(GleanMetrics.emailFirst, 'view');

packages/fxa-settings/src/pages/Index/index.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export const Index = ({
2828
setErrorBannerMessage,
2929
setSuccessBannerMessage,
3030
setTooltipErrorMessage,
31-
deeplink,
3231
flowQueryParams,
3332
isMobile,
3433
useFxAStatusResult,
@@ -43,8 +42,6 @@ export const Index = ({
4342

4443
const emailEngageEventEmitted = useRef(false);
4544

46-
const isDeeplinking = !!deeplink;
47-
4845
useEffect(() => {
4946
GleanMetrics.emailFirst.view();
5047
}, []);
@@ -82,18 +79,6 @@ export const Index = ({
8279
},
8380
});
8481

85-
if (isDeeplinking) {
86-
// To avoid flickering, we just render third party auth when deeplinking
87-
return (
88-
<ThirdPartyAuth
89-
showSeparator={false}
90-
viewName="deeplink"
91-
deeplink={deeplink}
92-
flowQueryParams={flowQueryParams}
93-
/>
94-
);
95-
}
96-
9782
const cmsInfo = integration.getCmsInfo();
9883
const title = cmsInfo?.EmailFirstPage?.pageTitle;
9984
const splitLayout = cmsInfo?.EmailFirstPage?.splitLayout;

0 commit comments

Comments
 (0)