Skip to content

Commit db2770f

Browse files
Merge pull request #18910 from mozilla/FXA-11717-add-localization-to-page-metadata
fix(payments-next): Add localization to page metadata
2 parents 875b4b3 + a789d68 commit db2770f

15 files changed

Lines changed: 227 additions & 75 deletions

File tree

apps/payments/next/app/[locale]/[offeringId]/[interval]/checkout/[cartId]/error/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
CheckoutParams,
1414
SupportedPages,
1515
getErrorFtlInfo,
16+
buildPageMetadata,
1617
} from '@fxa/payments/ui/server';
1718
import {
1819
getCartOrRedirectAction,
@@ -21,7 +22,6 @@ import {
2122
import { config } from 'apps/payments/next/config';
2223
import type { Metadata } from 'next';
2324
import { CartErrorReasonId } from '@fxa/shared/db/mysql/account';
24-
import { buildPageMetadata } from '@fxa/payments/ui';
2525

2626
// forces dynamic rendering
2727
// https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
@@ -38,8 +38,6 @@ export async function generateMetadata(
3838
): Promise<Metadata> {
3939
return buildPageMetadata({
4040
params,
41-
titlePrefix: 'Error',
42-
description: 'There was an error processing your subscription. If this problem persists, please contact support.',
4341
page: 'error',
4442
pageType: 'checkout',
4543
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/checkout/[cartId]/needs_input/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ import {
77
LoadingSpinner,
88
StripeWrapper,
99
PaymentInputHandler,
10-
buildPageMetadata,
1110
} from '@fxa/payments/ui';
12-
import { getApp, SupportedPages } from '@fxa/payments/ui/server';
11+
import {
12+
getApp,
13+
SupportedPages,
14+
buildPageMetadata,
15+
} from '@fxa/payments/ui/server';
1316
import { headers } from 'next/headers';
1417
import { getCartOrRedirectAction } from '@fxa/payments/ui/actions';
1518
import type { Metadata } from 'next';
@@ -26,8 +29,6 @@ export async function generateMetadata(
2629
): Promise<Metadata> {
2730
return buildPageMetadata({
2831
params,
29-
titlePrefix: 'Action required',
30-
description: 'Please complete the required action to proceed with your payment.',
3132
page: 'needs_input',
3233
pageType: 'checkout',
3334
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/checkout/[cartId]/processing/page.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import {
66
PaymentStateObserver,
77
CheckoutParams,
88
LoadingSpinner,
9-
buildPageMetadata,
109
} from '@fxa/payments/ui';
11-
import { getApp, SupportedPages } from '@fxa/payments/ui/server';
10+
import { getApp, SupportedPages, buildPageMetadata } from '@fxa/payments/ui/server';
1211
import { headers } from 'next/headers';
1312
import { validateCartStateAndRedirectAction } from '@fxa/payments/ui/actions';
1413
import type { Metadata } from 'next';
@@ -25,8 +24,6 @@ export async function generateMetadata(
2524
): Promise<Metadata> {
2625
return buildPageMetadata({
2726
params,
28-
titlePrefix: 'Processing',
29-
description: 'Please wait while we finish processing your payment.',
3027
page: 'processing',
3128
pageType: 'checkout',
3229
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/checkout/[cartId]/start/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import {
1111
ButtonVariant,
1212
PaymentSection,
1313
SignInForm,
14-
buildPageMetadata,
1514
} from '@fxa/payments/ui';
1615
import {
1716
getApp,
1817
SupportedPages,
1918
CheckoutParams,
2019
SignedIn,
20+
buildPageMetadata,
2121
} from '@fxa/payments/ui/server';
2222
import AppleLogo from '@fxa/shared/assets/images/apple-logo.svg';
2323
import GoogleLogo from '@fxa/shared/assets/images/google-logo.svg';
@@ -40,10 +40,9 @@ export async function generateMetadata(
4040
searchParams: Record<string, string> | undefined;
4141
},
4242
): Promise<Metadata> {
43+
4344
return buildPageMetadata({
4445
params,
45-
titlePrefix: 'Checkout',
46-
description: 'Enter your payment details to complete your purchase.',
4746
page: 'start',
4847
pageType: 'checkout',
4948
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/checkout/[cartId]/success/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Metadata } from 'next';
66
import { headers } from 'next/headers';
77
import Image from 'next/image';
88
import { auth } from 'apps/payments/next/auth';
9-
import { getCardIcon, buildPageMetadata } from '@fxa/payments/ui';
9+
import { getCardIcon } from '@fxa/payments/ui';
1010
import {
1111
fetchCMSData,
1212
getCartOrRedirectAction,
@@ -16,6 +16,7 @@ import {
1616
getApp,
1717
CheckoutParams,
1818
SupportedPages,
19+
buildPageMetadata,
1920
} from '@fxa/payments/ui/server';
2021
import { config } from 'apps/payments/next/config';
2122

@@ -32,8 +33,6 @@ export async function generateMetadata(
3233
): Promise<Metadata> {
3334
return buildPageMetadata({
3435
params,
35-
titlePrefix: 'Success',
36-
description: 'Congratulations! You have successfully completed your purchase.',
3736
page: 'success',
3837
pageType: 'checkout',
3938
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/upgrade/[cartId]/(mainLayout)/error/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import {
1212
CheckoutParams,
1313
SupportedPages,
1414
getErrorFtlInfo,
15+
buildPageMetadata,
1516
} from '@fxa/payments/ui/server';
1617
import {
1718
getCartOrRedirectAction,
1819
recordEmitterEventAction,
1920
} from '@fxa/payments/ui/actions';
2021
import { config } from 'apps/payments/next/config';
2122
import { Metadata } from 'next';
22-
import { buildPageMetadata } from '@fxa/payments/ui';
2323

2424
// forces dynamic rendering
2525
// https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
@@ -36,8 +36,6 @@ export async function generateMetadata(
3636
): Promise<Metadata> {
3737
return buildPageMetadata({
3838
params,
39-
titlePrefix: 'Error',
40-
description: 'There was an error processing your upgrade. If this problem persists, please contact support.',
4139
page: 'error',
4240
pageType: 'upgrade',
4341
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/upgrade/[cartId]/(mainLayout)/needs_input/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ import {
77
LoadingSpinner,
88
StripeWrapper,
99
PaymentInputHandler,
10-
buildPageMetadata,
1110
} from '@fxa/payments/ui';
12-
import { getApp, SupportedPages } from '@fxa/payments/ui/server';
11+
import {
12+
getApp,
13+
SupportedPages,
14+
buildPageMetadata,
15+
} from '@fxa/payments/ui/server';
1316
import { headers } from 'next/headers';
1417
import { getCartOrRedirectAction } from '@fxa/payments/ui/actions';
1518
import { Metadata } from 'next';
@@ -26,8 +29,6 @@ export async function generateMetadata(
2629
): Promise<Metadata> {
2730
return buildPageMetadata({
2831
params,
29-
titlePrefix: 'Action required',
30-
description: 'Please complete the required action to proceed with your payment.',
3132
page: 'needs_input',
3233
pageType: 'upgrade',
3334
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/upgrade/[cartId]/(mainLayout)/processing/page.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import {
66
PaymentStateObserver,
77
CheckoutParams,
88
LoadingSpinner,
9-
buildPageMetadata,
109
} from '@fxa/payments/ui';
11-
import { getApp, SupportedPages } from '@fxa/payments/ui/server';
10+
import {
11+
getApp,
12+
SupportedPages,
13+
buildPageMetadata,
14+
} from '@fxa/payments/ui/server';
1215
import { headers } from 'next/headers';
1316
import { validateCartStateAndRedirectAction } from '@fxa/payments/ui/actions';
1417
import { Metadata } from 'next';
@@ -25,8 +28,6 @@ export async function generateMetadata(
2528
): Promise<Metadata> {
2629
return buildPageMetadata({
2730
params,
28-
titlePrefix: 'Processing',
29-
description: 'Please wait while we finish processing your payment.',
3031
page: 'processing',
3132
pageType: 'upgrade',
3233
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/upgrade/[cartId]/(mainLayout)/success/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
import { headers } from 'next/headers';
66
import { auth } from 'apps/payments/next/auth';
7-
import { getCardIcon, buildPageMetadata } from '@fxa/payments/ui';
8-
import { SupportedPages, getApp } from '@fxa/payments/ui/server';
7+
import { getCardIcon } from '@fxa/payments/ui';
8+
import {
9+
SupportedPages,
10+
getApp,
11+
buildPageMetadata,
12+
} from '@fxa/payments/ui/server';
913
import {
1014
fetchCMSData,
1115
getCartOrRedirectAction,
@@ -29,8 +33,6 @@ export async function generateMetadata(
2933
): Promise<Metadata> {
3034
return buildPageMetadata({
3135
params,
32-
titlePrefix: 'Success',
33-
description: 'Congratulations! You have successfully completed your upgrade.',
3436
page: 'success',
3537
pageType: 'upgrade',
3638
acceptLanguage: headers().get('accept-language'),

apps/payments/next/app/[locale]/[offeringId]/[interval]/upgrade/[cartId]/(startLayout)/start/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Image from 'next/image';
88
import {
99
getCardIcon,
1010
PaymentSection,
11-
buildPageMetadata,
1211
} from '@fxa/payments/ui';
1312
import {
1413
fetchCMSData,
@@ -18,6 +17,7 @@ import {
1817
getApp,
1918
CheckoutParams,
2019
SupportedPages,
20+
buildPageMetadata,
2121
} from '@fxa/payments/ui/server';
2222
import { Metadata } from 'next';
2323
import { config } from 'apps/payments/next/config';
@@ -35,8 +35,6 @@ export async function generateMetadata(
3535
): Promise<Metadata> {
3636
return buildPageMetadata({
3737
params,
38-
titlePrefix: 'Upgrade',
39-
description: 'Enter your payment details to complete your upgrade.',
4038
page: 'start',
4139
pageType: 'upgrade',
4240
acceptLanguage: headers().get('accept-language'),

0 commit comments

Comments
 (0)