diff --git a/apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/en.ftl b/apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/en.ftl index 7d9671621e4..37b8aa2fc2a 100644 --- a/apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/en.ftl +++ b/apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/en.ftl @@ -1,6 +1,8 @@ ## Page -next-new-user-step-1-2 = 1. Create a { -product-mozilla-account } -next-new-user-sign-in-link-2 = Already have a { -product-mozilla-account }? Sign in +checkout-signin-or-create = 1. Sign in or create a { -product-mozilla-account } +checkout-create-account = Create a { -product-mozilla-account } +next-continue-with-google-button = Continue with { -brand-google } +next-continue-with-apple-button = Continue with { -brand-apple } next-payment-confirm-with-legal-links-static-3 = I authorize { -brand-mozilla } to charge my payment method for the amount shown, according to Terms of Service and Privacy Notice, until I cancel my subscription. next-payment-method-header = Choose your payment method diff --git a/apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/page.tsx b/apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/page.tsx index 7c40d1d9475..9fed805cf4e 100644 --- a/apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/page.tsx +++ b/apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/page.tsx @@ -2,17 +2,28 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import { revalidatePath } from 'next/cache'; import { headers } from 'next/headers'; -import { BaseButton, ButtonVariant, PaymentSection } from '@fxa/payments/ui'; -import { getApp, SupportedPages, CheckoutParams, } from '@fxa/payments/ui/server'; +import Image from 'next/image'; +import { + BaseButton, + ButtonVariant, + PaymentSection, + SignInForm, +} from '@fxa/payments/ui'; +import { + getApp, + CheckoutParams, + SupportedPages, +} from '@fxa/payments/ui/server'; import { getCartOrRedirectAction } from '@fxa/payments/ui/actions'; +import AppleLogo from '@fxa/shared/assets/images/apple-logo.svg'; +import GoogleLogo from '@fxa/shared/assets/images/google-logo.svg'; import { DEFAULT_LOCALE } from '@fxa/shared/l10n'; import { getFakeCartData, getCMSContent, } from 'apps/payments/next/app/_lib/apiClient'; -import { auth, signIn } from 'apps/payments/next/auth'; +import { auth } from 'apps/payments/next/auth'; export const dynamic = 'force-dynamic'; @@ -46,74 +57,37 @@ export default async function Checkout({ params }: { params: CheckoutParams }) { <>

{l10n.getString( - 'next-new-user-step-1-2', - '1. Create a Mozilla account' + 'checkout-signin-or-create', + '1. Sign in or create a Mozilla account' )}

-
{ - 'use server'; - await signIn('fxa'); - }} - > -

- {l10n.getFragmentWithSource( - 'next-new-user-sign-in-link-2', - { - elems: { - a: ( - - ), - }, - }, - <> - Already have a Mozilla account?  - - - )} -

-
+ + +

+ {l10n.getString( + 'checkout-create-account', + 'Create a Mozilla account' + )} +

-
- {/** - Temporary Content. This will be replaced in M3b by the Passwordless - email signup form. - */} -

{`Current cart email: ${cart.email}`}

-
{ - 'use server'; - const email = - formData.get('email')?.toString() || 'test@example.com'; - await getApp().getActionsService().updateCart({ - cartId: cart.id, - version: cart.version, - cartDetails: { - email, - }, - }); - revalidatePath('/'); - }} - > - - - {' '} - Set email - -
+
+ + + {l10n.getString( + 'next-continue-with-google-button', + 'Continue with Google' + )} + + + + {l10n.getString( + 'next-continue-with-apple-button', + 'Continue with Apple' + )} +

diff --git a/libs/payments/ui/src/index.ts b/libs/payments/ui/src/index.ts index 4521086eb69..168ee079fb2 100644 --- a/libs/payments/ui/src/index.ts +++ b/libs/payments/ui/src/index.ts @@ -10,6 +10,7 @@ export * from './lib/client/components/CheckoutCheckbox'; export * from './lib/client/components/CouponForm'; export * from './lib/client/components/PaymentSection'; export * from './lib/client/components/PurchaseDetails'; +export * from './lib/client/components/SignInForm'; export * from './lib/client/components/SubmitButton'; export * from './lib/client/components/LoadingSpinner'; export * from './lib/client/components/MetricsWrapper'; diff --git a/libs/payments/ui/src/lib/client/components/BaseButton/index.tsx b/libs/payments/ui/src/lib/client/components/BaseButton/index.tsx index 089bf195f97..23dc44b440f 100644 --- a/libs/payments/ui/src/lib/client/components/BaseButton/index.tsx +++ b/libs/payments/ui/src/lib/client/components/BaseButton/index.tsx @@ -5,6 +5,7 @@ export enum ButtonVariant { Primary, Secondary, + ThirdParty, } interface BaseButtonProps @@ -17,17 +18,21 @@ export function BaseButton({ children, variant, ...props }: BaseButtonProps) { let variantStyles = ''; switch (variant) { case ButtonVariant.Primary: - variantStyles = 'bg-blue-500 hover:bg-blue-700 text-white'; + variantStyles = 'bg-blue-500 font-semibold hover:bg-blue-700 text-white'; break; case ButtonVariant.Secondary: - variantStyles = 'bg-grey-100 hover:bg-grey-200 text-black'; + variantStyles = 'bg-grey-100 font-semibold hover:bg-grey-200 text-black'; + break; + case ButtonVariant.ThirdParty: + variantStyles = + 'w-full bg-transparent border border-grey-300 font-normal text-black hover:border-black'; break; } return ( diff --git a/libs/payments/ui/src/lib/client/components/CheckoutForm/index.tsx b/libs/payments/ui/src/lib/client/components/CheckoutForm/index.tsx index 7a2a976b60b..a3d543ae7ff 100644 --- a/libs/payments/ui/src/lib/client/components/CheckoutForm/index.tsx +++ b/libs/payments/ui/src/lib/client/components/CheckoutForm/index.tsx @@ -169,6 +169,7 @@ export function CheckoutForm({ return ( { engageGlean(); diff --git a/libs/payments/ui/src/lib/client/components/SignInForm/en.ftl b/libs/payments/ui/src/lib/client/components/SignInForm/en.ftl new file mode 100644 index 00000000000..df6707dbb1c --- /dev/null +++ b/libs/payments/ui/src/lib/client/components/SignInForm/en.ftl @@ -0,0 +1,7 @@ +signin-form-continue-button = Continue +signin-form-email-input = Enter your email + +next-new-user-subscribe-product-updates-mdnplus = I’d like to receive product news and updates from { -product-mdn-plus } and { -brand-mozilla } +next-new-user-subscribe-product-updates-mozilla = I’d like to receive product news and updates from { -brand-mozilla } +next-new-user-subscribe-product-updates-snp = I’d like to receive security and privacy news and updates from { -brand-mozilla } +next-new-user-subscribe-product-assurance = We only use your email to create your account. We will never sell it to a third party. diff --git a/libs/payments/ui/src/lib/client/components/SignInForm/images/shield.svg b/libs/payments/ui/src/lib/client/components/SignInForm/images/shield.svg new file mode 100644 index 00000000000..4663d3454f1 --- /dev/null +++ b/libs/payments/ui/src/lib/client/components/SignInForm/images/shield.svg @@ -0,0 +1,3 @@ + + + diff --git a/libs/payments/ui/src/lib/client/components/SignInForm/index.tsx b/libs/payments/ui/src/lib/client/components/SignInForm/index.tsx new file mode 100644 index 00000000000..5dc1d9a4d3f --- /dev/null +++ b/libs/payments/ui/src/lib/client/components/SignInForm/index.tsx @@ -0,0 +1,107 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +'use client'; + +import { Localized } from '@fluent/react'; +import * as Form from '@radix-ui/react-form'; +import Image from 'next/image'; +import { BaseButton, ButtonVariant } from '@fxa/payments/ui'; +import shieldIcon from './images/shield.svg'; + +const DEFAULT_NEWSLETTER_STRING_ID = + 'next-new-user-subscribe-product-updates-mozilla'; + +/** + * The newsletter string is a configurable field. This function returns the correct + * localization string ID and fallback text for the different newsletter string ID options. + */ +function getNewsletterStringInfo(newsletterLabelTextCode: string) { + switch (newsletterLabelTextCode) { + case 'mdnplus': + return { + newsletterStringId: 'next-new-user-subscribe-product-updates-mdnplus', + newsletterStringFallbackText: `I’d like to receive product news and updates from MDN Plus and Mozilla`, + }; + case 'snp': + return { + newsletterStringId: 'next-new-user-subscribe-product-updates-snp', + newsletterStringFallbackText: `I’d like to receive security and privacy news and updates from Mozilla`, + }; + default: + return { + newsletterStringId: DEFAULT_NEWSLETTER_STRING_ID, + newsletterStringFallbackText: `I’d like to receive product news and updates from Mozilla`, + }; + } +} + +interface SignInFormProps { + newsletterLabel: string; +} + +export const SignInForm = ({ newsletterLabel }: SignInFormProps) => { + const { newsletterStringId, newsletterStringFallbackText } = + getNewsletterStringInfo(newsletterLabel); + return ( + + + + Enter your email + + + + + + + + + + + + + + {newsletterStringFallbackText} + + + + + + + + We only use your email to create your account. We will never sell it + to a third party. + + + + + + Continue + + + + ); +}; diff --git a/libs/shared/assets/src/images/apple-logo.svg b/libs/shared/assets/src/images/apple-logo.svg new file mode 100644 index 00000000000..8565622109c --- /dev/null +++ b/libs/shared/assets/src/images/apple-logo.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/libs/shared/assets/src/images/google-logo.svg b/libs/shared/assets/src/images/google-logo.svg new file mode 100644 index 00000000000..141ace815c4 --- /dev/null +++ b/libs/shared/assets/src/images/google-logo.svg @@ -0,0 +1,13 @@ + + + + + + + + +