@@ -3,6 +3,7 @@ import type { __experimental_CommerceCheckoutResource } from '@clerk/types';
33import { Box , Button , descriptors , Heading , Icon , localizationKeys , Span , Text } from '../../customizables' ;
44import { Drawer , LineItems , useDrawerContext } from '../../elements' ;
55import { Check } from '../../icons' ;
6+ import { formatDate } from '../../utils' ;
67
78const capitalize = ( name : string ) => name [ 0 ] . toUpperCase ( ) + name . slice ( 1 ) ;
89
@@ -77,18 +78,22 @@ export const CheckoutComplete = ({ checkout }: { checkout: __experimental_Commer
7778 elementDescriptor = { descriptors . checkoutSuccessTitle }
7879 as = 'h2'
7980 textVariant = 'h2'
80- >
81- { /* TODO(@COMMERCE): needs localization */ }
82- Payment was successful!
83- </ Heading >
81+ localizationKey = {
82+ checkout . subscription ?. status === 'active'
83+ ? localizationKeys ( '__experimental_commerce.checkout.title__paymentSuccessful' )
84+ : localizationKeys ( '__experimental_commerce.checkout.title__subscriptionSuccessful' )
85+ }
86+ />
8487 < Text
8588 elementDescriptor = { descriptors . checkoutSuccessDescription }
8689 colorScheme = 'secondary'
8790 sx = { t => ( { textAlign : 'center' , paddingInline : t . space . $8 , marginBlockStart : t . space . $2 } ) }
88- >
89- { /* TODO(@COMMERCE): needs localization */ }
90- Minim adipisicing enim fugiat enim est ad nisi exercitation nisi exercitation quis culpa.
91- </ Text >
91+ localizationKey = {
92+ checkout . subscription ?. status === 'active'
93+ ? localizationKeys ( '__experimental_commerce.checkout.description__paymentSuccessful' )
94+ : localizationKeys ( '__experimental_commerce.checkout.description__subscriptionSuccessful' )
95+ }
96+ />
9297 </ Span >
9398 </ Span >
9499 </ Drawer . Body >
@@ -100,8 +105,7 @@ export const CheckoutComplete = ({ checkout }: { checkout: __experimental_Commer
100105 >
101106 < LineItems . Root >
102107 < LineItems . Group variant = 'secondary' >
103- { /* TODO(@COMMERCE): needs localization */ }
104- < LineItems . Title title = 'Total paid' />
108+ < LineItems . Title title = { localizationKeys ( '__experimental_commerce.checkout.lineItems.title__totalPaid' ) } />
105109 < LineItems . Description
106110 text = {
107111 checkout . invoice
@@ -111,19 +115,27 @@ export const CheckoutComplete = ({ checkout }: { checkout: __experimental_Commer
111115 />
112116 </ LineItems . Group >
113117 < LineItems . Group variant = 'secondary' >
114- { /* TODO(@COMMERCE): needs localization */ }
115- < LineItems . Title title = 'Payment method' />
118+ < LineItems . Title
119+ title = {
120+ checkout . subscription ?. status === 'active'
121+ ? localizationKeys ( '__experimental_commerce.checkout.lineItems.title__paymentMethod' )
122+ : localizationKeys ( '__experimental_commerce.checkout.lineItems.title__subscriptionBegins' )
123+ }
124+ />
116125 < LineItems . Description
117126 text = {
118- checkout . paymentSource
119- ? `${ capitalize ( checkout . paymentSource . cardType ) } ⋯ ${ checkout . paymentSource . last4 } `
120- : '–'
127+ checkout . subscription ?. status === 'active'
128+ ? checkout . paymentSource
129+ ? `${ capitalize ( checkout . paymentSource . cardType ) } ⋯ ${ checkout . paymentSource . last4 } `
130+ : '–'
131+ : checkout . subscription ?. periodStart
132+ ? formatDate ( new Date ( checkout . subscription . periodStart ) )
133+ : '–'
121134 }
122135 />
123136 </ LineItems . Group >
124137 < LineItems . Group variant = 'tertiary' >
125- { /* TODO(@COMMERCE): needs localization */ }
126- < LineItems . Title title = 'Invoice ID' />
138+ < LineItems . Title title = { localizationKeys ( '__experimental_commerce.checkout.lineItems.title__invoiceId' ) } />
127139 < LineItems . Description
128140 text = { checkout . invoice ? checkout . invoice . id : '–' }
129141 truncateText
0 commit comments