@blocklet/payment-react 1.14.21 → 1.14.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +77 -0
  2. package/es/checkout/donate.d.ts +4 -2
  3. package/es/checkout/donate.js +13 -10
  4. package/es/checkout/form.d.ts +1 -1
  5. package/es/checkout/form.js +50 -4
  6. package/es/checkout/table.d.ts +1 -1
  7. package/es/checkout/table.js +11 -1
  8. package/es/components/blockchain/tx.js +2 -1
  9. package/es/components/country-select.d.ts +16 -0
  10. package/es/components/country-select.js +82 -0
  11. package/es/components/input.d.ts +21 -21
  12. package/es/components/input.js +43 -42
  13. package/es/components/livemode.js +1 -0
  14. package/es/components/pricing-table.js +0 -2
  15. package/es/components/status.js +2 -3
  16. package/es/components/table.d.ts +2 -0
  17. package/es/components/table.js +186 -0
  18. package/es/contexts/payment.d.ts +2 -0
  19. package/es/contexts/payment.js +5 -2
  20. package/es/history/invoice/list.d.ts +3 -1
  21. package/es/history/invoice/list.js +215 -48
  22. package/es/hooks/mobile.d.ts +4 -0
  23. package/es/hooks/mobile.js +10 -0
  24. package/es/index.d.ts +5 -1
  25. package/es/index.js +7 -1
  26. package/es/libs/util.d.ts +21 -8
  27. package/es/libs/util.js +92 -28
  28. package/es/locales/en.js +22 -7
  29. package/es/locales/index.d.ts +0 -1
  30. package/es/locales/index.js +10 -1
  31. package/es/locales/zh.js +21 -6
  32. package/es/payment/error.js +2 -2
  33. package/es/payment/footer.js +1 -1
  34. package/es/payment/form/address.d.ts +9 -2
  35. package/es/payment/form/address.js +69 -69
  36. package/es/payment/form/currency.js +39 -25
  37. package/es/payment/form/index.d.ts +1 -1
  38. package/es/payment/form/index.js +83 -81
  39. package/es/payment/form/phone.js +15 -51
  40. package/es/payment/index.d.ts +3 -10
  41. package/es/payment/index.js +295 -224
  42. package/es/payment/product-card.js +4 -4
  43. package/es/payment/product-donation.js +9 -3
  44. package/es/payment/product-item.d.ts +2 -2
  45. package/es/payment/product-item.js +120 -81
  46. package/es/payment/summary.js +188 -118
  47. package/es/theme/index.css +240 -0
  48. package/es/theme/index.d.ts +14 -0
  49. package/es/theme/index.js +256 -0
  50. package/es/theme/typography.d.ts +2 -0
  51. package/es/theme/typography.js +53 -0
  52. package/es/types/index.d.ts +16 -0
  53. package/lib/checkout/donate.d.ts +4 -2
  54. package/lib/checkout/donate.js +23 -2
  55. package/lib/checkout/form.d.ts +1 -1
  56. package/lib/checkout/form.js +60 -15
  57. package/lib/checkout/table.d.ts +1 -1
  58. package/lib/checkout/table.js +22 -1
  59. package/lib/components/blockchain/tx.js +4 -1
  60. package/lib/components/country-select.d.ts +16 -0
  61. package/lib/components/country-select.js +115 -0
  62. package/lib/components/input.d.ts +21 -21
  63. package/lib/components/input.js +21 -12
  64. package/lib/components/livemode.js +1 -0
  65. package/lib/components/pricing-table.js +0 -2
  66. package/lib/components/status.js +2 -3
  67. package/lib/components/table.d.ts +2 -0
  68. package/lib/components/table.js +220 -0
  69. package/lib/contexts/payment.d.ts +2 -0
  70. package/lib/contexts/payment.js +4 -1
  71. package/lib/history/invoice/list.d.ts +3 -1
  72. package/lib/history/invoice/list.js +290 -62
  73. package/lib/hooks/mobile.d.ts +4 -0
  74. package/lib/hooks/mobile.js +17 -0
  75. package/lib/index.d.ts +5 -1
  76. package/lib/index.js +36 -0
  77. package/lib/libs/util.d.ts +21 -8
  78. package/lib/libs/util.js +115 -37
  79. package/lib/locales/en.js +22 -7
  80. package/lib/locales/index.d.ts +0 -1
  81. package/lib/locales/index.js +14 -3
  82. package/lib/locales/zh.js +21 -6
  83. package/lib/payment/error.js +5 -1
  84. package/lib/payment/footer.js +1 -1
  85. package/lib/payment/form/address.d.ts +9 -2
  86. package/lib/payment/form/address.js +67 -59
  87. package/lib/payment/form/currency.js +31 -24
  88. package/lib/payment/form/index.d.ts +1 -1
  89. package/lib/payment/form/index.js +92 -93
  90. package/lib/payment/form/phone.js +11 -59
  91. package/lib/payment/index.d.ts +3 -10
  92. package/lib/payment/index.js +302 -225
  93. package/lib/payment/product-card.js +5 -4
  94. package/lib/payment/product-donation.js +11 -7
  95. package/lib/payment/product-item.d.ts +2 -2
  96. package/lib/payment/product-item.js +38 -19
  97. package/lib/payment/summary.js +219 -127
  98. package/lib/theme/index.css +240 -0
  99. package/lib/theme/index.d.ts +14 -0
  100. package/lib/theme/index.js +273 -0
  101. package/lib/theme/typography.d.ts +2 -0
  102. package/lib/theme/typography.js +59 -0
  103. package/lib/types/index.d.ts +16 -0
  104. package/package.json +14 -11
  105. package/src/checkout/donate.tsx +25 -11
  106. package/src/checkout/form.tsx +63 -15
  107. package/src/checkout/table.tsx +20 -1
  108. package/src/components/blockchain/tx.tsx +2 -1
  109. package/src/components/country-select.tsx +93 -0
  110. package/src/components/input.tsx +49 -46
  111. package/src/components/livemode.tsx +1 -0
  112. package/src/components/pricing-table.tsx +0 -2
  113. package/src/components/status.tsx +1 -2
  114. package/src/components/table.tsx +200 -0
  115. package/src/contexts/payment.tsx +6 -1
  116. package/src/history/invoice/list.tsx +254 -49
  117. package/src/hooks/mobile.ts +13 -0
  118. package/src/index.ts +7 -0
  119. package/src/libs/util.ts +120 -31
  120. package/src/locales/en.tsx +18 -4
  121. package/src/locales/index.tsx +10 -3
  122. package/src/locales/zh.tsx +17 -3
  123. package/src/payment/error.tsx +2 -2
  124. package/src/payment/footer.tsx +1 -1
  125. package/src/payment/form/address.tsx +56 -47
  126. package/src/payment/form/currency.tsx +29 -23
  127. package/src/payment/form/index.tsx +89 -76
  128. package/src/payment/form/phone.tsx +14 -51
  129. package/src/payment/index.tsx +298 -231
  130. package/src/payment/product-card.tsx +4 -4
  131. package/src/payment/product-donation.tsx +9 -4
  132. package/src/payment/product-item.tsx +49 -20
  133. package/src/payment/summary.tsx +191 -108
  134. package/src/theme/index.css +240 -0
  135. package/src/theme/index.tsx +271 -0
  136. package/src/theme/typography.ts +56 -0
  137. package/src/types/index.ts +17 -0
@@ -1,6 +1,8 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
3
3
  import Toast from '@arcblock/ux/lib/Toast';
4
+ // eslint-disable-next-line import/no-extraneous-dependencies
5
+ import Header from '@blocklet/ui-react/lib/Header';
4
6
  import type {
5
7
  TCheckoutSessionExpanded,
6
8
  TCustomer,
@@ -19,144 +21,27 @@ import type { LiteralUnion } from 'type-fest';
19
21
 
20
22
  import { usePaymentContext } from '../contexts/payment';
21
23
  import api from '../libs/api';
22
- import {
23
- findCurrency,
24
- formatAmountPrecisionLimit,
25
- formatError,
26
- getStatementDescriptor,
27
- isValidCountry,
28
- } from '../libs/util';
24
+ import { findCurrency, formatError, getStatementDescriptor, isValidCountry } from '../libs/util';
29
25
  import { CheckoutCallbacks, CheckoutContext, CheckoutFormData } from '../types';
30
26
  import PaymentError from './error';
31
27
  import CheckoutFooter from './footer';
32
28
  import PaymentForm from './form';
33
- import PaymentHeader from './header';
29
+ // import PaymentHeader from './header';
34
30
  import OverviewSkeleton from './skeleton/overview';
35
31
  import PaymentSkeleton from './skeleton/payment';
36
32
  import PaymentSuccess from './success';
37
33
  import PaymentSummary from './summary';
34
+ import { useMobile } from '../hooks/mobile';
38
35
 
39
- type Props = CheckoutContext & CheckoutCallbacks & { completed?: boolean; error?: any };
40
-
41
- Payment.defaultProps = {
42
- completed: false,
43
- error: null,
44
- };
45
-
46
- export default function Payment({
47
- checkoutSession,
48
- paymentMethods,
49
- paymentIntent,
50
- paymentLink,
51
- customer,
52
- completed,
53
- error,
54
- mode,
55
- onPaid,
56
- onError,
57
- onChange,
58
- goBack,
59
- action,
60
- }: Props) {
61
- const { t } = useLocaleContext();
62
- const { refresh, livemode, setLivemode } = usePaymentContext();
63
- const [delay, setDelay] = useState(false);
64
-
65
- useEffect(() => {
66
- setTimeout(() => {
67
- // 骨架屏 delay
68
- setDelay(true);
69
- }, 500);
70
- }, []);
71
-
72
- useEffect(() => {
73
- if (checkoutSession) {
74
- if (livemode !== checkoutSession.livemode) {
75
- setLivemode(checkoutSession.livemode);
76
- setTimeout(() => {
77
- refresh();
78
- }, 10);
79
- }
80
- }
81
- }, [checkoutSession, livemode, setLivemode, refresh]);
82
-
83
- if (error) {
84
- return <PaymentError mode={mode} title="Oops" description={formatError(error)} />;
85
- }
86
-
87
- if (!checkoutSession || !delay) {
88
- return (
89
- <Root mode={mode}>
90
- <Stack className="cko-container" sx={{ gap: { sm: mode === 'standalone' ? 0 : 8 } }}>
91
- <Stack className="cko-overview">
92
- <OverviewSkeleton />
93
- </Stack>
94
- <Stack className="cko-payment">
95
- <PaymentSkeleton />
96
- </Stack>
97
- {mode === 'standalone' && <CheckoutFooter className="cko-footer" />}
98
- </Stack>
99
- </Root>
100
- );
101
- }
102
-
103
- // expired session
104
- if (checkoutSession.expires_at <= Math.round(Date.now() / 1000)) {
105
- return (
106
- <PaymentError
107
- mode={mode}
108
- title={t('payment.checkout.expired.title')}
109
- description={t('payment.checkout.expired.description')}
110
- />
111
- );
112
- }
113
-
114
- // completed session
115
- if (checkoutSession.status === 'complete') {
116
- return (
117
- <PaymentError
118
- mode={mode}
119
- title={t('payment.checkout.complete.title')}
120
- description={t('payment.checkout.complete.description')}
121
- />
122
- );
123
- }
124
-
125
- if (!checkoutSession.line_items.length) {
126
- return (
127
- <PaymentError
128
- mode={mode}
129
- title={t('payment.checkout.emptyItems.title')}
130
- description={t('payment.checkout.emptyItems.description')}
131
- />
132
- );
133
- }
134
-
135
- return (
136
- <PaymentInner
137
- checkoutSession={checkoutSession}
138
- paymentMethods={paymentMethods as TPaymentMethodExpanded[]}
139
- paymentLink={paymentLink}
140
- paymentIntent={paymentIntent}
141
- completed={completed}
142
- customer={customer as TCustomer}
143
- onPaid={onPaid}
144
- onError={onError}
145
- onChange={onChange}
146
- goBack={goBack}
147
- mode={mode}
148
- action={action}
149
- />
150
- );
151
- }
152
-
153
- type MainProps = CheckoutContext & CheckoutCallbacks & { completed?: boolean };
36
+ // eslint-disable-next-line react/no-unused-prop-types
37
+ type Props = CheckoutContext & CheckoutCallbacks & { completed?: boolean; error?: any; showCheckoutSummary?: boolean };
154
38
 
155
39
  PaymentInner.defaultProps = {
156
40
  completed: false,
41
+ showCheckoutSummary: true,
157
42
  };
158
43
 
159
- export function PaymentInner({
44
+ function PaymentInner({
160
45
  checkoutSession,
161
46
  paymentMethods,
162
47
  paymentLink,
@@ -167,15 +52,17 @@ export function PaymentInner({
167
52
  onPaid,
168
53
  onError,
169
54
  onChange,
170
- goBack,
171
55
  action,
56
+ showCheckoutSummary = true,
172
57
  }: MainProps) {
173
- const { t, locale } = useLocaleContext();
58
+ const { t } = useLocaleContext();
174
59
  const { settings, session } = usePaymentContext();
60
+ const { isMobile } = useMobile();
175
61
  const [state, setState] = useSetState<{ checkoutSession: TCheckoutSessionExpanded }>({ checkoutSession });
176
62
 
177
63
  const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
178
64
  const defaultMethodId = paymentMethods.find((m) => m.payment_currencies.some((c) => c.id === defaultCurrencyId))?.id;
65
+ const hideSummaryCard = mode.endsWith('-minimal') || !showCheckoutSummary;
179
66
 
180
67
  const methods = useForm<CheckoutFormData>({
181
68
  defaultValues: {
@@ -251,19 +138,7 @@ export function PaymentInner({
251
138
  }
252
139
  };
253
140
 
254
- const min = parseFloat(paymentLink?.donation_settings?.amount.minimum || '0');
255
- const max = paymentLink?.donation_settings?.amount.maximum
256
- ? parseFloat(paymentLink?.donation_settings?.amount.maximum)
257
- : Infinity;
258
-
259
141
  const onChangeAmount = async ({ priceId, amount }: { priceId: string; amount: string }) => {
260
- if (Number(amount) < min || Number(amount) > max) {
261
- return;
262
- }
263
-
264
- if (amount && formatAmountPrecisionLimit(String(amount), locale)) {
265
- return;
266
- }
267
142
  try {
268
143
  const { data } = await api.put(`/api/checkout-sessions/${state.checkoutSession.id}/amount`, {
269
144
  priceId,
@@ -280,21 +155,12 @@ export function PaymentInner({
280
155
  setState({ checkoutSession: result.checkoutSession });
281
156
  onPaid(result);
282
157
  };
283
-
284
158
  return (
285
159
  <FormProvider {...methods}>
286
- <Root mode={mode}>
287
- {goBack && (
288
- <ArrowBackOutlined
289
- sx={{ mr: 0.5, color: 'text.secondary', alignSelf: 'flex-start', margin: '16px 0', cursor: 'pointer' }}
290
- onClick={goBack}
291
- fontSize="medium"
292
- />
293
- )}
294
- <Stack className="cko-container" sx={{ gap: { sm: mode === 'standalone' ? 0 : mode === 'inline' ? 4 : 8 } }}>
160
+ <Stack className="cko-container" sx={{ gap: { sm: mode === 'standalone' ? 0 : mode === 'inline' ? 4 : 8 } }}>
161
+ {!hideSummaryCard && (
295
162
  <Fade in>
296
- <Stack className="cko-overview" direction="column">
297
- {mode === 'standalone' ? <PaymentHeader checkoutSession={state.checkoutSession} /> : null}
163
+ <Stack className="base-card cko-overview" direction="column">
298
164
  <PaymentSummary
299
165
  items={state.checkoutSession.line_items}
300
166
  trialInDays={state.checkoutSession.subscription_data?.trial_period_days || 0}
@@ -315,87 +181,238 @@ export function PaymentInner({
315
181
  donationSettings={paymentLink?.donation_settings}
316
182
  action={action}
317
183
  />
184
+ {mode === 'standalone' && !isMobile && (
185
+ <CheckoutFooter className="cko-footer" sx={{ color: 'var(--foregrounds-fg-muted, #98A3B1)' }} />
186
+ )}
318
187
  </Stack>
319
188
  </Fade>
320
- <Stack className="cko-payment" direction="column" spacing={{ xs: 2, sm: 3 }}>
321
- {completed && (
322
- <PaymentSuccess
323
- mode={mode}
324
- payee={getStatementDescriptor(state.checkoutSession.line_items)}
325
- action={state.checkoutSession.mode}
326
- invoiceId={state.checkoutSession.invoice_id}
327
- subscriptionId={state.checkoutSession.subscription_id}
328
- message={
329
- paymentLink?.after_completion?.hosted_confirmation?.custom_message ||
330
- t(
331
- `payment.checkout.completed.${
332
- state.checkoutSession.submit_type === 'donate' ? 'donate' : state.checkoutSession.mode
333
- }`
334
- )
335
- }
336
- />
337
- )}
338
- {!completed && (
339
- <PaymentForm
340
- checkoutSession={state.checkoutSession}
341
- paymentMethods={paymentMethods as TPaymentMethodExpanded[]}
342
- paymentIntent={paymentIntent}
343
- paymentLink={paymentLink}
344
- customer={customer}
345
- onPaid={handlePaid}
346
- onError={onError}
347
- mode={mode}
348
- action={action}
349
- />
350
- )}
189
+ )}
190
+ <Stack
191
+ className="base-card cko-payment"
192
+ direction="column"
193
+ spacing={{
194
+ xs: 2,
195
+ sm: 3,
196
+ }}>
197
+ {completed && (
198
+ <PaymentSuccess
199
+ mode={mode}
200
+ payee={getStatementDescriptor(state.checkoutSession.line_items)}
201
+ action={state.checkoutSession.mode}
202
+ invoiceId={state.checkoutSession.invoice_id}
203
+ subscriptionId={state.checkoutSession.subscription_id}
204
+ message={
205
+ paymentLink?.after_completion?.hosted_confirmation?.custom_message ||
206
+ t(
207
+ `payment.checkout.completed.${
208
+ state.checkoutSession.submit_type === 'donate' ? 'donate' : state.checkoutSession.mode
209
+ }`
210
+ )
211
+ }
212
+ />
213
+ )}
214
+ {!completed && (
215
+ <PaymentForm
216
+ checkoutSession={state.checkoutSession}
217
+ paymentMethods={paymentMethods as TPaymentMethodExpanded[]}
218
+ paymentIntent={paymentIntent}
219
+ paymentLink={paymentLink}
220
+ customer={customer}
221
+ onPaid={handlePaid}
222
+ onError={onError}
223
+ mode={mode}
224
+ action={action}
225
+ />
226
+ )}
227
+ </Stack>
228
+ {mode === 'standalone' && isMobile && (
229
+ <CheckoutFooter className="cko-footer" sx={{ color: 'var(--foregrounds-fg-muted, #98A3B1)' }} />
230
+ )}
231
+ </Stack>
232
+ </FormProvider>
233
+ );
234
+ }
235
+
236
+ Payment.defaultProps = {
237
+ completed: false,
238
+ error: null,
239
+ showCheckoutSummary: true,
240
+ };
241
+
242
+ export default function Payment({
243
+ checkoutSession,
244
+ paymentMethods,
245
+ paymentIntent,
246
+ paymentLink,
247
+ customer,
248
+ completed,
249
+ // error,
250
+ mode,
251
+ onPaid,
252
+ onError,
253
+ onChange,
254
+ goBack,
255
+ action,
256
+ showCheckoutSummary = true,
257
+ }: Props) {
258
+ const { t } = useLocaleContext();
259
+ const { refresh, livemode, setLivemode } = usePaymentContext();
260
+ const [delay, setDelay] = useState(false);
261
+ const hideSummaryCard = mode.endsWith('-minimal') || !showCheckoutSummary;
262
+
263
+ useEffect(() => {
264
+ setTimeout(() => {
265
+ // 骨架屏 delay
266
+ setDelay(true);
267
+ }, 500);
268
+ }, []);
269
+
270
+ useEffect(() => {
271
+ if (checkoutSession) {
272
+ if (livemode !== checkoutSession.livemode) {
273
+ setLivemode(checkoutSession.livemode);
274
+ setTimeout(() => {
275
+ refresh();
276
+ }, 10);
277
+ }
278
+ }
279
+ }, [checkoutSession, livemode, setLivemode, refresh]);
280
+
281
+ const renderContent = () => {
282
+ if (!checkoutSession || !delay) {
283
+ return (
284
+ <Stack className="cko-container" sx={{ gap: { sm: mode === 'standalone' ? 0 : mode === 'inline' ? 4 : 8 } }}>
285
+ {!hideSummaryCard && (
286
+ <Stack className="base-card cko-overview">
287
+ <Box className="cko-product">
288
+ <OverviewSkeleton />
289
+ </Box>
290
+ {/* {mode === 'standalone' && !isMobile && (
291
+ <CheckoutFooter className="cko-footer" sx={{ color: 'var(--foregrounds-fg-muted, #98A3B1)' }} />
292
+ )} */}
293
+ </Stack>
294
+ )}
295
+ <Stack className="base-card cko-payment">
296
+ <PaymentSkeleton />
351
297
  </Stack>
352
- {mode === 'standalone' && <CheckoutFooter className="cko-footer" />}
298
+ {/* {mode === 'standalone' && isMobile && (
299
+ <CheckoutFooter className="cko-footer" sx={{ color: 'var(--foregrounds-fg-muted, #98A3B1)' }} />
300
+ )} */}
301
+ </Stack>
302
+ );
303
+ }
304
+ if (checkoutSession.expires_at <= Math.round(Date.now() / 1000)) {
305
+ return (
306
+ <PaymentError
307
+ mode={mode}
308
+ title={t('payment.checkout.expired.title')}
309
+ description={t('payment.checkout.expired.description')}
310
+ />
311
+ );
312
+ }
313
+ if (!checkoutSession.line_items.length) {
314
+ return (
315
+ <PaymentError
316
+ mode={mode}
317
+ title={t('payment.checkout.emptyItems.title')}
318
+ description={t('payment.checkout.emptyItems.description')}
319
+ />
320
+ );
321
+ }
322
+ return (
323
+ <PaymentInner
324
+ checkoutSession={checkoutSession}
325
+ paymentMethods={paymentMethods as TPaymentMethodExpanded[]}
326
+ paymentLink={paymentLink}
327
+ paymentIntent={paymentIntent}
328
+ completed={completed || checkoutSession.status === 'complete'}
329
+ customer={customer as TCustomer}
330
+ onPaid={onPaid}
331
+ onError={onError}
332
+ onChange={onChange}
333
+ goBack={goBack}
334
+ mode={mode}
335
+ action={action}
336
+ showCheckoutSummary={showCheckoutSummary}
337
+ />
338
+ );
339
+ };
340
+ return (
341
+ <Stack
342
+ display="flex"
343
+ flexDirection="column"
344
+ sx={{ height: mode === 'standalone' ? '100vh' : 'auto', overflow: 'hidden' }}>
345
+ {mode === 'standalone' ? (
346
+ <Header
347
+ meta={undefined}
348
+ addons={undefined}
349
+ sessionManagerProps={undefined}
350
+ homeLink={undefined}
351
+ theme={undefined}
352
+ hideNavMenu={undefined}
353
+ maxWidth={false}
354
+ sx={{ borderBottom: '1px solid var(--stroke-border-base, #EFF1F5)' }}
355
+ />
356
+ ) : null}
357
+ <Root mode={mode} sx={{ flex: 1 }}>
358
+ {goBack && (
359
+ <ArrowBackOutlined
360
+ sx={{ mr: 0.5, color: 'text.secondary', alignSelf: 'flex-start', margin: '16px 0', cursor: 'pointer' }}
361
+ onClick={goBack}
362
+ fontSize="medium"
363
+ />
364
+ )}
365
+ <Stack className="cko-container" sx={{ gap: { sm: mode === 'standalone' ? 0 : mode === 'inline' ? 4 : 8 } }}>
366
+ {renderContent()}
353
367
  </Stack>
354
368
  </Root>
355
- </FormProvider>
369
+ </Stack>
356
370
  );
357
371
  }
358
372
 
373
+ type MainProps = CheckoutContext & CheckoutCallbacks & { completed?: boolean; showCheckoutSummary?: boolean };
374
+
359
375
  export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | 'popup', string> }>`
360
376
  box-sizing: border-box;
361
377
  display: flex;
362
378
  flex-direction: column;
363
- justify-content: center;
379
+ // justify-content: center;
364
380
  align-items: center;
365
- min-height: ${(props) => (props.mode === 'standalone' ? '100vh' : 'auto')};
381
+ overflow: hidden;
382
+ // min-height: ${(props) => (props.mode === 'standalone' ? '100vh' : 'auto')};
366
383
  position: relative;
367
-
368
- ${(props) =>
369
- props.mode === 'standalone'
370
- ? `&:before {
371
- animation-fill-mode: both;
372
- background: #ffffff;
373
- content: '';
374
- height: 100%;
375
- position: fixed;
376
- right: 0;
377
- top: 0;
378
- transform-origin: right;
379
- width: 50%;
380
- box-shadow: 15px 0 30px 0 rgba(0, 0, 0, 0.18);
381
- }`
382
- : ''}
383
-
384
384
  .cko-container {
385
+ overflow: hidden;
385
386
  width: 100%;
386
- max-width: ${(props) => (props.mode.endsWith('-minimal') ? '400px' : '1000px')};
387
+ // max-width: ${(props) => (props.mode.endsWith('-minimal') ? '400px' : '1000px')};
387
388
  display: flex;
388
389
  flex-direction: row;
389
- justify-content: space-between;
390
+ justify-content: center;
391
+ // gap: 4px;
390
392
  position: relative;
391
- padding: ${(props) => (props.mode === 'standalone' ? '0 16px' : '0')};
393
+ flex: 1;
394
+ padding: 1px;
395
+ // padding: ${(props) => (props.mode === 'standalone' ? '0 16px' : '0')};
396
+ }
397
+
398
+ .base-card {
399
+ border: none;
400
+ border-radius: 0;
401
+ padding: ${(props) => (props.mode === 'standalone' ? '100px 40px 20px' : '20px 0')};
402
+ box-shadow: none;
403
+ flex: 1;
404
+ max-width: 582px;
392
405
  }
393
406
 
394
407
  .cko-overview {
395
- width: ${(props) => (props.mode.endsWith('-minimal') ? '100%' : '400px')};
396
- min-height: ${(props) => (props.mode === 'standalone' ? '540px' : 'auto')};
408
+ // width: ${(props) => (props.mode.endsWith('-minimal') ? '100%' : '400px')};
409
+ // min-height: ${(props) => (props.mode === 'standalone' ? '540px' : 'auto')};
397
410
  position: relative;
398
- display: ${(props) => (props.mode.endsWith('-minimal') ? 'none' : 'block')};
411
+ flex-direction: column;
412
+ display: ${(props) => (props.mode.endsWith('-minimal') ? 'none' : 'flex')};
413
+ background: var(--backgrounds-bg-base);
414
+ min-height: 'auto';
415
+ // width: 502px;
399
416
  }
400
417
  .cko-header {
401
418
  left: 0;
@@ -408,7 +425,8 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
408
425
  box-shadow 0.15s ease-out;
409
426
  }
410
427
  .cko-product {
411
- margin-top: ${(props) => (props.mode === 'standalone' ? '64px' : '0')};
428
+ flex: 1;
429
+ overflow: hidden;
412
430
  }
413
431
  .cko-product-summary {
414
432
  width: 100%;
@@ -421,29 +439,50 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
421
439
  }
422
440
 
423
441
  .cko-payment {
424
- width: ${(props) => (props.mode.endsWith('-minimal') ? '100%' : '400px')};
425
- .MuiInputBase-root {
426
- border-radius: 0;
442
+ width: 502px;
443
+ // width: ${(props) => (props.mode.endsWith('-minimal') ? '100%' : '400px')};
444
+ // box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
445
+ padding-left: ${(props) => (props.mode === 'standalone' ? '40px' : '20px')};
446
+ position: relative;
447
+ &:before {
448
+ -webkit-animation-fill-mode: both;
449
+ content: '';
450
+ height: 100%;
451
+ position: absolute;
452
+ left: 0px;
453
+ top: 0px;
454
+ transform-origin: left center;
455
+ width: 8px;
456
+ box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
427
457
  }
428
458
  }
459
+ .cko-payment-contact {
460
+ overflow: hidden;
461
+ }
462
+ .cko-footer {
463
+ display: ${(props) => (props.mode.endsWith('-minimal') ? 'none' : 'block')};
464
+ text-align: center;
465
+ margin-top: 20px;
466
+ }
429
467
 
430
468
  .cko-payment-form {
431
- .MuiInputAdornment-positionStart {
432
- width: 50px;
469
+ // .MuiInputAdornment-positionStart {
470
+ // width: 50px;
471
+ // }
472
+
473
+ .MuiFormLabel-root {
474
+ color: var(--foregrounds-fg-base, #010714);
475
+ font-weight: 500;
476
+ margin-top: 12px;
477
+ margin-bottom: 4px;
433
478
  }
434
-
435
479
  .MuiBox-root {
436
- border: 1px solid #ccc;
437
- margin: -1px 0 0 -1px;
480
+ margin: 0;
438
481
  }
439
482
 
440
483
  .MuiFormHelperText-root {
441
484
  margin-left: 14px;
442
485
  }
443
-
444
- .MuiOutlinedInput-notchedOutline {
445
- border: none;
446
- }
447
486
  }
448
487
 
449
488
  .cko-payment-methods {
@@ -451,9 +490,9 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
451
490
 
452
491
  .cko-payment-submit {
453
492
  .MuiButtonBase-root {
454
- border-radius: 0;
455
493
  font-size: 1.3rem;
456
494
  position: relative;
495
+ padding: 4px 22px;
457
496
  }
458
497
 
459
498
  .cko-submit-progress {
@@ -468,15 +507,28 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
468
507
  .cko-header {
469
508
  }
470
509
 
471
- .cko-footer {
472
- position: absolute;
473
- bottom: 0;
474
- left: 12px;
475
- margin: 12px 0;
476
- display: ${(props) => (props.mode.endsWith('-minimal') ? 'none' : 'block')};
510
+ .product-item {
511
+ border-radius: var(--radius-l, 12px);
512
+ border: 1px solid var(--stroke-border-base, #eff1f5);
513
+ .product-item-content {
514
+ padding: 16px;
515
+ background: var(--backgrounds-bg-subtle, #f9fafb);
516
+ border-top-left-radius: var(--radius-l, 12px);
517
+ border-top-right-radius: var(--radius-l, 12px);
518
+ }
519
+ .product-item-upsell {
520
+ margin-top: 0;
521
+ padding: 16px;
522
+ background: var(--backgrounds-bg-component, #f1f3f5);
523
+ border-bottom-left-radius: var(--radius-l, 12px);
524
+ border-bottom-right-radius: var(--radius-l, 12px);
525
+ }
477
526
  }
478
527
 
479
528
  @media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
529
+ background: ${(props) => (props.mode === 'standalone' ? 'var(--backgrounds-bg-subtle, #F9FAFB)' : 'transparent')};
530
+ padding-top: 0;
531
+ overflow: auto;
480
532
  &:before {
481
533
  display: none;
482
534
  }
@@ -484,20 +536,35 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
484
536
  flex-direction: column;
485
537
  align-items: center;
486
538
  gap: 32px;
487
- min-width: 350px;
488
- max-width: 400px;
539
+ overflow: visible;
540
+ min-width: 200px;
489
541
  }
490
542
  .cko-overview {
491
543
  width: 100%;
492
544
  min-height: auto;
545
+ flex: none;
493
546
  }
494
547
  .cko-payment {
495
548
  width: 100%;
549
+ height: fit-content;
550
+ flex: none;
551
+ &:before {
552
+ display: none;
553
+ }
496
554
  }
497
555
 
498
556
  .cko-footer {
499
- position: static;
557
+ position: relative;
558
+ margin-bottom: 4px;
500
559
  margin-top: 0;
560
+ bottom: 0;
561
+ left: 0;
562
+ transform: translateX(0);
563
+ }
564
+ .base-card {
565
+ box-shadow: none;
566
+ border-radius: 0;
567
+ padding: 20px;
501
568
  }
502
569
  }
503
570
  `;