Skip to content

Commit 533a110

Browse files
feat: add new strapi customization for user expectation on the final authentication screens
Because: * we want to customize "Firefox will try sending you back to use an email mask after you sign in." because we need something similar for smart window This commit: * adds additionalAccessibilityInfo (name suggested by Ross) to cmsInfo.shared Closes FXA-12638
1 parent 981c599 commit 533a110

29 files changed

Lines changed: 151 additions & 159 deletions

File tree

libs/shared/cms/src/__generated__/gql.ts

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/shared/cms/src/__generated__/graphql.ts

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/shared/cms/src/lib/queries/relying-party/factories.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export const RelyingPartyResultFactory = (
9292
Enum_Componentaccountsshared_Headlinefontsize.Large,
9393
]),
9494
headlineTextColor: faker.color.rgb(),
95+
additionalAccessibilityInfo: faker.string.sample(),
9596
},
9697
NewDeviceLoginEmail: {
9798
logoUrl: faker.internet.url(),

libs/shared/cms/src/lib/queries/relying-party/query.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const relyingPartyQuery = graphql(`
3737
favicon
3838
headlineFontSize
3939
headlineTextColor
40+
additionalAccessibilityInfo
4041
}
4142
EmailFirstPage {
4243
logoUrl

libs/shared/cms/src/lib/queries/relying-party/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface Shared {
4242
favicon: string | null;
4343
headlineFontSize: Enum_Componentaccountsshared_Headlinefontsize | null;
4444
headlineTextColor: string | null;
45+
additionalAccessibilityInfo: string | null;
4546
}
4647

4748
export interface FeatureFlags {

packages/fxa-settings/src/models/integrations/relier-interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export interface SharedRelierCmsInfo {
7575
favicon?: string | undefined;
7676
headlineFontSize?: HeadlineFontSize | null;
7777
headlineTextColor?: string | null;
78+
additionalAccessibilityInfo?: string | undefined;
7879
}
7980

8081
export interface FeatureFlagsRelierCmsInfo {

packages/fxa-settings/src/pages/ResetPassword/CompleteResetPassword/container.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,7 @@ const CompleteResetPasswordContainer = ({
371371
recoveryKeyExists,
372372
estimatedSyncDeviceCount,
373373
}}
374-
isFirefoxClientServiceRelay={integration.isFirefoxClientServiceRelay()}
375-
integrationIsSync={integration.isSync()}
374+
integration={integration}
376375
locationState={location.state as CompleteResetPasswordLocationState}
377376
/>
378377
);

packages/fxa-settings/src/pages/ResetPassword/CompleteResetPassword/index.stories.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import React from 'react';
66
import { Meta } from '@storybook/react';
77
import { withLocalization } from 'fxa-react/lib/storybooks';
8-
import { Subject } from './mocks';
8+
import { createMockWebIntegration, Subject } from './mocks';
99
import CompleteResetPassword from '.';
10+
import { MOCK_CMS_INFO } from '../../mocks';
1011

1112
export default {
1213
title: 'Pages/ResetPassword/CompleteResetPassword',
@@ -18,11 +19,11 @@ export const NoSync = () => (
1819
<Subject recoveryKeyExists={true} estimatedSyncDeviceCount={0} />
1920
);
2021

21-
export const OAuthDesktopServiceRelay = () => (
22+
export const WithCmsAdditionalAccessibilityInfo = () => (
2223
<Subject
23-
isFirefoxClientServiceRelay={true}
2424
estimatedSyncDeviceCount={0}
2525
recoveryKeyExists={false}
26+
integration={createMockWebIntegration({ cmsInfo: MOCK_CMS_INFO })}
2627
/>
2728
);
2829

packages/fxa-settings/src/pages/ResetPassword/CompleteResetPassword/index.test.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
6-
import { Subject } from './mocks';
6+
import { createMockWebIntegration, Subject } from './mocks';
77
import { screen, waitFor } from '@testing-library/react';
88
import userEvent from '@testing-library/user-event';
9-
import { MOCK_PASSWORD } from '../../mocks';
9+
import { MOCK_CMS_INFO, MOCK_PASSWORD } from '../../mocks';
1010
import GleanMetrics from '../../../lib/glean';
1111

1212
const mockSubmitNewPassword = jest.fn((newPassword: string) =>
@@ -23,9 +23,6 @@ jest.mock('../../../lib/glean', () => ({
2323
},
2424
}));
2525

26-
const serviceRelayText =
27-
'Firefox will try sending you back to use an email mask after you sign in.';
28-
2926
describe('CompleteResetPassword page', () => {
3027
beforeEach(() => {
3128
(GleanMetrics.passwordReset.createNewView as jest.Mock).mockClear();
@@ -75,19 +72,20 @@ describe('CompleteResetPassword page', () => {
7572
expect(
7673
screen.queryByRole('link', { name: 'Use account recovery key' })
7774
).not.toBeInTheDocument();
78-
expect(screen.queryByText(serviceRelayText)).not.toBeInTheDocument();
7975
});
8076

81-
it('renders expected text when service=relay', async () => {
77+
it('renders additional accessibility info from CMS', async () => {
8278
renderWithLocalizationProvider(
8379
<Subject
84-
isFirefoxClientServiceRelay={true}
8580
estimatedSyncDeviceCount={0}
8681
recoveryKeyExists={false}
82+
integration={createMockWebIntegration({ cmsInfo: MOCK_CMS_INFO })}
8783
/>
8884
);
8985
await waitFor(() =>
90-
expect(screen.getByText(serviceRelayText)).toBeVisible()
86+
expect(
87+
screen.getByText(MOCK_CMS_INFO.shared.additionalAccessibilityInfo)
88+
).toBeVisible()
9189
);
9290
});
9391

packages/fxa-settings/src/pages/ResetPassword/CompleteResetPassword/index.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import ResetPasswordWarning from '../../../components/ResetPasswordWarning';
1919
import { Link, useLocation } from '@reach/router';
2020
import Banner from '../../../components/Banner';
2121
import { HeadingPrimary } from '../../../components/HeadingPrimary';
22-
import { useFtlMsgResolver } from '../../../models';
2322

2423
const CompleteResetPassword = ({
2524
email,
@@ -29,11 +28,12 @@ const CompleteResetPassword = ({
2928
submitNewPassword,
3029
estimatedSyncDeviceCount,
3130
recoveryKeyExists,
32-
integrationIsSync,
33-
isFirefoxClientServiceRelay,
31+
integration,
3432
}: CompleteResetPasswordProps) => {
3533
const location = useLocation();
3634
const searchParams = location.search;
35+
const additionalAccessibilityInfo =
36+
integration.getCmsInfo()?.shared.additionalAccessibilityInfo;
3737
useEffect(() => {
3838
if (hasConfirmedRecoveryKey) {
3939
GleanMetrics.passwordReset.recoveryKeyCreatePasswordView();
@@ -43,11 +43,9 @@ const CompleteResetPassword = ({
4343
}
4444
}, [hasConfirmedRecoveryKey, recoveryKeyExists]);
4545

46-
const ftlMsgResolver = useFtlMsgResolver();
47-
4846
const [isSubmitting, setIsSubmitting] = useState(false);
4947
const isActiveSyncUser = !!(
50-
integrationIsSync ||
48+
integration.isSync() ||
5149
(estimatedSyncDeviceCount !== undefined && estimatedSyncDeviceCount > 0)
5250
);
5351
const defaultClosed = !isActiveSyncUser;
@@ -98,15 +96,10 @@ const CompleteResetPassword = ({
9896
*/}
9997
<input type="email" value={email} className="hidden" readOnly />
10098

101-
{isFirefoxClientServiceRelay && (
99+
{additionalAccessibilityInfo && (
102100
<Banner
103101
type="info"
104-
content={{
105-
localizedHeading: ftlMsgResolver.getMsg(
106-
'complete-reset-password-desktop-relay',
107-
'Firefox will try sending you back to use an email mask after you sign in.'
108-
),
109-
}}
102+
content={{ localizedHeading: additionalAccessibilityInfo }}
110103
/>
111104
)}
112105

0 commit comments

Comments
 (0)