Skip to content

Commit 0b46908

Browse files
authored
Merge pull request #19353 from mozilla/FXA-12286-accounts-required-properties
chore(cms): Update required Accounts CMS properties
2 parents 8778428 + 96b9b4f commit 0b46908

34 files changed

Lines changed: 153 additions & 229 deletions

File tree

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

Lines changed: 8 additions & 8 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/types.ts

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

55
export interface Page {
6-
headline: string | null;
6+
headline: string;
77
description: string | null;
8-
primaryButtonText: string | null;
8+
primaryButtonText: string;
99
logoUrl: string | null;
1010
logoAltText: string | null;
1111
pageTitle: string | null;
@@ -44,14 +44,14 @@ export interface RelyingPartyResult {
4444
entrypoint: string | null;
4545
name: string | null;
4646
l10nId: string;
47-
EmailFirstPage?: Page;
48-
SignupSetPasswordPage?: Page;
49-
SignupConfirmCodePage?: Page;
50-
SignupConfirmedSyncPage?: Page;
51-
SigninPage?: Page;
47+
EmailFirstPage: Page;
48+
SignupSetPasswordPage: Page;
49+
SignupConfirmCodePage: Page;
50+
SignupConfirmedSyncPage: Page;
51+
SigninPage: Page;
5252
SigninTokenCodePage?: Page;
5353
SigninUnblockCodePage?: Page;
54-
shared?: Shared;
54+
shared: Shared;
5555
NewDeviceLoginEmail?: Email;
5656
VerifyLoginCodeEmail?: Email;
5757
VerifyShortCodeEmail?: Email;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exports[`<AppLayout /> snapshots renders correctly with CMS: background wrapper
44
<div
55
class="flex min-h-screen flex-col items-center tablet:[background:var(--cms-bg)]"
66
data-testid="app"
7-
style="--cms-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);"
7+
style="--cms-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 26, 26, 0.25) 40%, rgba(230, 0, 0, 0.3) 70%, rgba(179, 0, 0, 0.45) 100%);"
88
/>
99
`;
1010

@@ -17,13 +17,13 @@ exports[`<AppLayout /> snapshots renders correctly with CMS: header background 1
1717

1818
exports[`<AppLayout /> snapshots renders correctly with CMS: header logo 1`] = `
1919
<img
20-
alt="Snapshot CMS Custom Logo"
20+
alt="custom-header-logo"
2121
class="h-auto w-[140px] mx-0"
22-
src="https://example.com/snapshot-cms-logo.png"
22+
src="https://cdn.accounts.firefox.com/other/firefox-browser-logo.svg"
2323
/>
2424
`;
2525

26-
exports[`<AppLayout /> snapshots renders correctly with CMS: title 1`] = `"Snapshot App - Custom Title | Mozilla accounts"`;
26+
exports[`<AppLayout /> snapshots renders correctly with CMS: title 1`] = `"MOCK Shared Title | Mozilla accounts"`;
2727

2828
exports[`<AppLayout /> snapshots renders correctly without CMS: background wrapper 1`] = `
2929
<div

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

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
MOCK_CMS_INFO_DEFAULT_LOGO,
1818
MOCK_CMS_INFO_HEADER_LOGO_WITH_OTHER_PROPS,
1919
} from './mocks';
20-
import { RelierCmsInfo } from '../../models';
20+
import { MOCK_CMS_INFO } from '../../pages/mocks';
2121

2222
// Mock the useConfig hook
2323
jest.mock('../../models/hooks', () => ({
@@ -309,34 +309,16 @@ describe('<AppLayout />', () => {
309309

310310
describe('snapshots', () => {
311311
it('renders correctly with CMS', () => {
312-
const mockCmsInfo: RelierCmsInfo = {
313-
name: 'Test App',
314-
clientId: 'test123',
315-
entrypoint: 'snapshot-test',
316-
shared: {
317-
headerLogoUrl: 'https://example.com/snapshot-cms-logo.png',
318-
headerLogoAltText: 'Snapshot CMS Custom Logo',
319-
buttonColor: '#0078d4',
320-
logoUrl: 'https://example.com/snapshot-cms-logo.png',
321-
logoAltText: 'Snapshot App Logo',
322-
backgroundColor: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
323-
headerBackground: 'linear-gradient(135deg, #764ba2 0%, #667eea 100%)',
324-
pageTitle: 'Snapshot App - Custom Title',
325-
},
326-
};
327-
328312
const { container } = renderWithLocalizationProvider(
329-
<AppLayout cmsInfo={mockCmsInfo}>
313+
<AppLayout cmsInfo={MOCK_CMS_INFO}>
330314
<p>Hello, world!</p>
331315
</AppLayout>
332316
);
333317

334318
// title should have override
335319
const title = document.title;
336320
// header logo image
337-
const headerLogo = screen.getByRole('img', {
338-
name: mockCmsInfo.shared?.headerLogoAltText,
339-
});
321+
const headerLogo = screen.getByRole('img', { name: MOCK_CMS_INFO.shared.headerLogoAltText });
340322
// div containing the background styling. We use cloneNode to remove
341323
// child content so the snap is only the background styles we want to ensure
342324
// are getting passed through

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const AppLayout = ({
6161
const hasValidBackgroundImage = looseValidBgCheck(cmsBackgroundColor);
6262
const hasValidHeaderBackground = looseValidBgCheck(cmsHeaderBackground);
6363

64-
const favicon = cmsInfo?.shared?.favicon;
64+
const favicon = cmsInfo?.shared.favicon;
6565

6666
const showLocaleToggle =config.featureFlags?.showLocaleToggle;
6767

packages/fxa-settings/src/components/AppLayout/mocks.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import { RelierCmsInfo } from '../../models/integrations';
66

7-
export const MOCK_CMS_INFO_VALID_LINEAR_BG: RelierCmsInfo = {
7+
export const MOCK_CMS_INFO_VALID_LINEAR_BG = {
88
name: 'Test App',
99
clientId: 'test123',
1010
entrypoint: 'test',
@@ -15,9 +15,9 @@ export const MOCK_CMS_INFO_VALID_LINEAR_BG: RelierCmsInfo = {
1515
backgroundColor: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
1616
pageTitle: 'Test App - Custom Title',
1717
},
18-
};
18+
} as RelierCmsInfo;
1919

20-
export const MOCK_CMS_INFO_VALID_RADIAL_BG: RelierCmsInfo = {
20+
export const MOCK_CMS_INFO_VALID_RADIAL_BG = {
2121
name: 'Test App',
2222
clientId: 'test123',
2323
entrypoint: 'test',
@@ -28,9 +28,9 @@ export const MOCK_CMS_INFO_VALID_RADIAL_BG: RelierCmsInfo = {
2828
backgroundColor: 'radial-gradient(circle, #ff6b6b, #4ecdc4)',
2929
pageTitle: 'Test App - Custom Title',
3030
},
31-
};
31+
} as RelierCmsInfo;
3232

33-
export const MOCK_CMS_INFO_NO_BG: RelierCmsInfo = {
33+
export const MOCK_CMS_INFO_NO_BG = {
3434
name: 'Test App',
3535
clientId: 'test123',
3636
entrypoint: 'test',
@@ -40,9 +40,9 @@ export const MOCK_CMS_INFO_NO_BG: RelierCmsInfo = {
4040
logoAltText: 'Test App Logo',
4141
pageTitle: 'Test App - Custom Title',
4242
},
43-
};
43+
} as RelierCmsInfo;
4444

45-
export const MOCK_CMS_INFO_INVALID_BG_COLOR: RelierCmsInfo = {
45+
export const MOCK_CMS_INFO_INVALID_BG_COLOR = {
4646
name: 'Test App',
4747
clientId: 'test123',
4848
entrypoint: 'test',
@@ -53,9 +53,9 @@ export const MOCK_CMS_INFO_INVALID_BG_COLOR: RelierCmsInfo = {
5353
backgroundColor: 'solid-color-red',
5454
pageTitle: 'Test App - Custom Title',
5555
},
56-
};
56+
} as RelierCmsInfo;
5757

58-
export const MOCK_CMS_INFO_WITH_PAGE_TITLE: RelierCmsInfo = {
58+
export const MOCK_CMS_INFO_WITH_PAGE_TITLE = {
5959
name: 'Test App',
6060
clientId: 'test123',
6161
entrypoint: 'test',
@@ -65,9 +65,9 @@ export const MOCK_CMS_INFO_WITH_PAGE_TITLE: RelierCmsInfo = {
6565
logoAltText: 'Test App Logo',
6666
pageTitle: 'CMS Custom Title',
6767
},
68-
};
68+
} as RelierCmsInfo;
6969

70-
export const MOCK_CMS_INFO_NO_PAGE_TITLE: RelierCmsInfo = {
70+
export const MOCK_CMS_INFO_NO_PAGE_TITLE = {
7171
name: 'Test App',
7272
clientId: 'test123',
7373
entrypoint: 'test',
@@ -76,9 +76,9 @@ export const MOCK_CMS_INFO_NO_PAGE_TITLE: RelierCmsInfo = {
7676
logoUrl: 'https://example.com/logo.png',
7777
logoAltText: 'Test App Logo',
7878
},
79-
};
79+
} as RelierCmsInfo;
8080

81-
export const MOCK_CMS_INFO_HEADER_LOGO: RelierCmsInfo = {
81+
export const MOCK_CMS_INFO_HEADER_LOGO = {
8282
name: 'Test App',
8383
clientId: 'test123',
8484
entrypoint: 'test',
@@ -89,9 +89,9 @@ export const MOCK_CMS_INFO_HEADER_LOGO: RelierCmsInfo = {
8989
headerLogoUrl: 'https://example.com/cms-logo.png',
9090
headerLogoAltText: 'CMS Custom Logo',
9191
},
92-
};
92+
} as RelierCmsInfo;
9393

94-
export const MOCK_CMS_INFO_HEADER_LOGO_NO_ALT: RelierCmsInfo = {
94+
export const MOCK_CMS_INFO_HEADER_LOGO_NO_ALT = {
9595
name: 'Test App',
9696
clientId: 'test123',
9797
entrypoint: 'test',
@@ -101,9 +101,9 @@ export const MOCK_CMS_INFO_HEADER_LOGO_NO_ALT: RelierCmsInfo = {
101101
logoAltText: undefined,
102102
headerLogoUrl: 'https://example.com/cms-logo.png',
103103
},
104-
};
104+
} as RelierCmsInfo;
105105

106-
export const MOCK_CMS_INFO_DEFAULT_LOGO: RelierCmsInfo = {
106+
export const MOCK_CMS_INFO_DEFAULT_LOGO = {
107107
name: 'Test App',
108108
clientId: 'test123',
109109
entrypoint: 'test',
@@ -112,9 +112,9 @@ export const MOCK_CMS_INFO_DEFAULT_LOGO: RelierCmsInfo = {
112112
logoUrl: undefined,
113113
logoAltText: undefined,
114114
},
115-
};
115+
} as RelierCmsInfo;
116116

117-
export const MOCK_CMS_INFO_HEADER_LOGO_WITH_OTHER_PROPS: RelierCmsInfo = {
117+
export const MOCK_CMS_INFO_HEADER_LOGO_WITH_OTHER_PROPS = {
118118
name: 'Test App',
119119
clientId: 'test123',
120120
entrypoint: 'test',
@@ -127,7 +127,7 @@ export const MOCK_CMS_INFO_HEADER_LOGO_WITH_OTHER_PROPS: RelierCmsInfo = {
127127
backgroundColor: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
128128
pageTitle: 'Test App - Custom Title',
129129
},
130-
};
130+
} as RelierCmsInfo;
131131

132132
export const INTEGRATION_WITH_UNDEFINED_GETCMSINFO = {
133133
getCmsInfo: () => undefined,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export const ButtonDownloadRecoveryKeyPDF = ({
154154
await downloadFile();
155155
navigateForward && navigateForward();
156156
}}
157-
buttonColor={cmsInfo?.shared?.buttonColor}
157+
buttonColor={cmsInfo?.shared.buttonColor}
158158
>
159159
Download and continue
160160
</CmsButtonWithFallback>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const CmsButtonWithFallback: React.FC<CmsButtonWithFallbackProps> = ({
9595
isCms ? 'cta-primary-cms' : 'cta-primary',
9696
'cta-xl',
9797
{
98-
// add a text-shadow if the CMS background color does not meet color contast
98+
// add a text-shadow if the CMS background color does not meet color contrast
9999
// standards, as our CTA button text is always white
100100
'text-shadow-cms': isCms && buttonColor && !hasSufficientContrast(buttonColor.trim(), '#ffffff'),
101101
},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports[`InlineRecoveryKeySetupCreate renders button with CMS passthrough 1`] =
1919
<button
2020
class="cta-primary-cms cta-xl flex justify-center items-center"
2121
data-glean-id="inline_recovery_key_cta_submit"
22-
style="--cta-bg: #000000; --cta-border: #000000; --cta-active: #000000; --cta-disabled: #00000060;"
22+
style="--cta-bg: #D41C1C; --cta-border: #D41C1C; --cta-active: #D41C1C; --cta-disabled: #D41C1C60;"
2323
type="submit"
2424
>
2525
<span

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { screen } from '@testing-library/react';
66
import { renderWithLocalizationProvider } from 'fxa-react/lib/test-utils/localizationProvider';
77
import { Subject } from './mocks';
8-
import { RelierCmsInfo } from '../../models';
8+
import { MOCK_CMS_INFO } from '../../pages/mocks';
99

1010
describe('InlineRecoveryKeySetupCreate', () => {
1111
it('renders as expected', () => {
@@ -39,20 +39,11 @@ describe('InlineRecoveryKeySetupCreate', () => {
3939
});
4040

4141
it('renders button with CMS passthrough', () => {
42-
const cmsInfo: RelierCmsInfo = {
43-
name: '',
44-
clientId: '',
45-
entrypoint: '',
46-
shared: {
47-
buttonColor: '#000000',
48-
logoUrl: '',
49-
logoAltText: ''
50-
}
51-
};
42+
5243
// in this test, we don't want the full container, only the button that
5344
// cms info is passed onto to ensure we're still passing through
5445
renderWithLocalizationProvider(
55-
<Subject cmsInfo={cmsInfo} />
46+
<Subject cmsInfo={MOCK_CMS_INFO} />
5647
);
5748

5849
const cmsButton = screen.queryByRole('button', {

0 commit comments

Comments
 (0)