From 43d7295c687cc4daa8895fb99f13bef045f26d39 Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Tue, 18 Mar 2025 11:18:23 -0400 Subject: [PATCH 1/6] refactor(clerk-js): Add localization support to commerce components --- .../src/ui/components/Checkout/Checkout.tsx | 2 +- .../components/Checkout/CheckoutComplete.tsx | 39 +++++++++------- .../ui/components/Checkout/CheckoutForm.tsx | 42 ++++++++--------- .../ui/components/PricingTable/PlanCard.tsx | 10 +++- .../clerk-js/src/ui/elements/Disclosure.tsx | 10 ++-- packages/clerk-js/src/ui/elements/Drawer.tsx | 19 +++++--- .../clerk-js/src/ui/elements/LineItems.tsx | 46 ++++++++++--------- .../src/ui/elements/SegmentedControl.tsx | 9 ++-- 8 files changed, 100 insertions(+), 77 deletions(-) diff --git a/packages/clerk-js/src/ui/components/Checkout/Checkout.tsx b/packages/clerk-js/src/ui/components/Checkout/Checkout.tsx index 7d4e4bcb933..e22669613de 100644 --- a/packages/clerk-js/src/ui/components/Checkout/Checkout.tsx +++ b/packages/clerk-js/src/ui/components/Checkout/Checkout.tsx @@ -35,7 +35,7 @@ const AuthenticatedRoutes = withCoreUserGuard((props: __experimental_CheckoutPro > - + diff --git a/packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx b/packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx index c44ff51e7ba..0e93ca59093 100644 --- a/packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx +++ b/packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx @@ -1,7 +1,7 @@ import type { __experimental_CommerceCheckoutResource } from '@clerk/types'; import { useCheckoutContext } from '../../contexts'; -import { Box, Button, descriptors, Heading, Icon, Span, Text } from '../../customizables'; +import { Box, Button, descriptors, Heading, Icon, localizationKeys, Span, Text } from '../../customizables'; import { Drawer, LineItems } from '../../elements'; import { Check } from '../../icons'; @@ -98,30 +98,35 @@ export const CheckoutComplete = ({ checkout }: { checkout: __experimental_Commer > - Total paid - - {checkout.invoice - ? `${checkout.invoice.totals.grandTotal.currencySymbol}${checkout.invoice.totals.grandTotal.amountFormatted}` - : '–'} - + {/* TODO(@COMMERCE): needs localization */} + + {/* TODO(@COMMERCE): needs localization */} - Payment method - - {checkout.paymentSource ? `${checkout.paymentSource.cardType} ⋯ ${checkout.paymentSource.last4}` : '–'} - + + {/* TODO(@COMMERCE): needs localization */} - Invoice ID - {checkout.invoice ? checkout.invoice.id : '–'} + + - +