@blocklet/payment-react 1.14.20 → 1.14.22

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 (136) hide show
  1. package/es/checkout/donate.d.ts +2 -1
  2. package/es/checkout/donate.js +9 -10
  3. package/es/checkout/form.d.ts +1 -1
  4. package/es/checkout/form.js +23 -1
  5. package/es/checkout/table.d.ts +1 -1
  6. package/es/checkout/table.js +8 -1
  7. package/es/components/blockchain/tx.js +2 -1
  8. package/es/components/country-select.d.ts +16 -0
  9. package/es/components/country-select.js +82 -0
  10. package/es/components/input.d.ts +21 -21
  11. package/es/components/input.js +43 -42
  12. package/es/components/livemode.js +1 -0
  13. package/es/components/pricing-table.js +0 -2
  14. package/es/components/status.js +2 -3
  15. package/es/components/table.d.ts +2 -0
  16. package/es/components/table.js +186 -0
  17. package/es/contexts/payment.d.ts +2 -0
  18. package/es/contexts/payment.js +5 -2
  19. package/es/history/invoice/list.d.ts +5 -1
  20. package/es/history/invoice/list.js +218 -48
  21. package/es/hooks/mobile.d.ts +4 -0
  22. package/es/hooks/mobile.js +10 -0
  23. package/es/index.d.ts +5 -1
  24. package/es/index.js +7 -1
  25. package/es/libs/util.d.ts +15 -2
  26. package/es/libs/util.js +92 -28
  27. package/es/locales/en.js +23 -7
  28. package/es/locales/index.d.ts +0 -1
  29. package/es/locales/index.js +10 -1
  30. package/es/locales/zh.js +22 -6
  31. package/es/payment/error.js +2 -2
  32. package/es/payment/footer.js +1 -1
  33. package/es/payment/form/address.d.ts +9 -2
  34. package/es/payment/form/address.js +69 -69
  35. package/es/payment/form/currency.js +39 -25
  36. package/es/payment/form/index.d.ts +1 -1
  37. package/es/payment/form/index.js +83 -81
  38. package/es/payment/form/phone.js +15 -51
  39. package/es/payment/index.d.ts +1 -10
  40. package/es/payment/index.js +274 -219
  41. package/es/payment/product-card.js +4 -4
  42. package/es/payment/product-donation.js +7 -2
  43. package/es/payment/product-item.d.ts +2 -2
  44. package/es/payment/product-item.js +120 -81
  45. package/es/payment/summary.js +188 -118
  46. package/es/theme/index.css +240 -0
  47. package/es/theme/index.d.ts +9 -0
  48. package/es/theme/index.js +243 -0
  49. package/es/theme/typography.d.ts +2 -0
  50. package/es/theme/typography.js +53 -0
  51. package/es/types/index.d.ts +11 -0
  52. package/lib/checkout/donate.d.ts +2 -1
  53. package/lib/checkout/donate.js +14 -2
  54. package/lib/checkout/form.d.ts +1 -1
  55. package/lib/checkout/form.js +22 -1
  56. package/lib/checkout/table.d.ts +1 -1
  57. package/lib/checkout/table.js +14 -1
  58. package/lib/components/blockchain/tx.js +4 -1
  59. package/lib/components/country-select.d.ts +16 -0
  60. package/lib/components/country-select.js +115 -0
  61. package/lib/components/input.d.ts +21 -21
  62. package/lib/components/input.js +21 -12
  63. package/lib/components/livemode.js +1 -0
  64. package/lib/components/pricing-table.js +0 -2
  65. package/lib/components/status.js +2 -3
  66. package/lib/components/table.d.ts +2 -0
  67. package/lib/components/table.js +220 -0
  68. package/lib/contexts/payment.d.ts +2 -0
  69. package/lib/contexts/payment.js +4 -1
  70. package/lib/history/invoice/list.d.ts +5 -1
  71. package/lib/history/invoice/list.js +293 -62
  72. package/lib/hooks/mobile.d.ts +4 -0
  73. package/lib/hooks/mobile.js +17 -0
  74. package/lib/index.d.ts +5 -1
  75. package/lib/index.js +36 -0
  76. package/lib/libs/util.d.ts +15 -2
  77. package/lib/libs/util.js +115 -37
  78. package/lib/locales/en.js +23 -7
  79. package/lib/locales/index.d.ts +0 -1
  80. package/lib/locales/index.js +14 -3
  81. package/lib/locales/zh.js +22 -6
  82. package/lib/payment/error.js +5 -1
  83. package/lib/payment/footer.js +1 -1
  84. package/lib/payment/form/address.d.ts +9 -2
  85. package/lib/payment/form/address.js +67 -59
  86. package/lib/payment/form/currency.js +31 -24
  87. package/lib/payment/form/index.d.ts +1 -1
  88. package/lib/payment/form/index.js +92 -93
  89. package/lib/payment/form/phone.js +11 -59
  90. package/lib/payment/index.d.ts +1 -10
  91. package/lib/payment/index.js +291 -219
  92. package/lib/payment/product-card.js +5 -4
  93. package/lib/payment/product-donation.js +9 -2
  94. package/lib/payment/product-item.d.ts +2 -2
  95. package/lib/payment/product-item.js +38 -19
  96. package/lib/payment/summary.js +219 -127
  97. package/lib/theme/index.css +240 -0
  98. package/lib/theme/index.d.ts +9 -0
  99. package/lib/theme/index.js +259 -0
  100. package/lib/theme/typography.d.ts +2 -0
  101. package/lib/theme/typography.js +59 -0
  102. package/lib/types/index.d.ts +11 -0
  103. package/package.json +14 -11
  104. package/src/checkout/donate.tsx +16 -10
  105. package/src/checkout/form.tsx +23 -0
  106. package/src/checkout/table.tsx +13 -1
  107. package/src/components/blockchain/tx.tsx +2 -1
  108. package/src/components/country-select.tsx +93 -0
  109. package/src/components/input.tsx +49 -46
  110. package/src/components/livemode.tsx +1 -0
  111. package/src/components/pricing-table.tsx +0 -2
  112. package/src/components/status.tsx +1 -2
  113. package/src/components/table.tsx +200 -0
  114. package/src/contexts/payment.tsx +6 -1
  115. package/src/history/invoice/list.tsx +258 -49
  116. package/src/hooks/mobile.ts +13 -0
  117. package/src/index.ts +7 -0
  118. package/src/libs/util.ts +120 -31
  119. package/src/locales/en.tsx +19 -4
  120. package/src/locales/index.tsx +10 -3
  121. package/src/locales/zh.tsx +18 -3
  122. package/src/payment/error.tsx +2 -2
  123. package/src/payment/footer.tsx +1 -1
  124. package/src/payment/form/address.tsx +56 -47
  125. package/src/payment/form/currency.tsx +29 -23
  126. package/src/payment/form/index.tsx +89 -76
  127. package/src/payment/form/phone.tsx +14 -51
  128. package/src/payment/index.tsx +294 -242
  129. package/src/payment/product-card.tsx +4 -4
  130. package/src/payment/product-donation.tsx +7 -3
  131. package/src/payment/product-item.tsx +49 -20
  132. package/src/payment/summary.tsx +191 -108
  133. package/src/theme/index.css +240 -0
  134. package/src/theme/index.tsx +250 -0
  135. package/src/theme/typography.ts +56 -0
  136. package/src/types/index.ts +12 -0
@@ -5,7 +5,7 @@ type Props = CheckoutContext & CheckoutCallbacks & {
5
5
  completed?: boolean;
6
6
  error?: any;
7
7
  };
8
- declare function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, error, mode, onPaid, onError, onChange, goBack, action, }: Props): import("react").JSX.Element;
8
+ declare function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, mode, onPaid, onError, onChange, goBack, action, }: Props): import("react").JSX.Element;
9
9
  declare namespace Payment {
10
10
  var defaultProps: {
11
11
  completed: boolean;
@@ -13,15 +13,6 @@ declare namespace Payment {
13
13
  };
14
14
  }
15
15
  export default Payment;
16
- type MainProps = CheckoutContext & CheckoutCallbacks & {
17
- completed?: boolean;
18
- };
19
- export declare function PaymentInner({ checkoutSession, paymentMethods, paymentLink, paymentIntent, customer, completed, mode, onPaid, onError, onChange, goBack, action, }: MainProps): import("react").JSX.Element;
20
- export declare namespace PaymentInner {
21
- var defaultProps: {
22
- completed: boolean;
23
- };
24
- }
25
16
  export declare const Root: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
26
17
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
27
18
  }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & {
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PaymentInner = PaymentInner;
7
6
  exports.Root = void 0;
8
7
  module.exports = Payment;
9
8
  var _jsxRuntime = require("react/jsx-runtime");
10
9
  var _context = require("@arcblock/ux/lib/Locale/context");
11
10
  var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
11
+ var _Header = _interopRequireDefault(require("@blocklet/ui-react/lib/Header"));
12
12
  var _iconsMaterial = require("@mui/icons-material");
13
13
  var _material = require("@mui/material");
14
14
  var _system = require("@mui/system");
@@ -22,120 +22,12 @@ var _util2 = require("../libs/util");
22
22
  var _error = _interopRequireDefault(require("./error"));
23
23
  var _footer = _interopRequireDefault(require("./footer"));
24
24
  var _form = _interopRequireDefault(require("./form"));
25
- var _header = _interopRequireDefault(require("./header"));
26
25
  var _overview = _interopRequireDefault(require("./skeleton/overview"));
27
26
  var _payment2 = _interopRequireDefault(require("./skeleton/payment"));
28
27
  var _success = _interopRequireDefault(require("./success"));
29
28
  var _summary = _interopRequireDefault(require("./summary"));
29
+ var _mobile = require("../hooks/mobile");
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
- Payment.defaultProps = {
32
- completed: false,
33
- error: null
34
- };
35
- function Payment({
36
- checkoutSession,
37
- paymentMethods,
38
- paymentIntent,
39
- paymentLink,
40
- customer,
41
- completed,
42
- error,
43
- mode,
44
- onPaid,
45
- onError,
46
- onChange,
47
- goBack,
48
- action
49
- }) {
50
- const {
51
- t
52
- } = (0, _context.useLocaleContext)();
53
- const {
54
- refresh,
55
- livemode,
56
- setLivemode
57
- } = (0, _payment.usePaymentContext)();
58
- const [delay, setDelay] = (0, _react.useState)(false);
59
- (0, _react.useEffect)(() => {
60
- setTimeout(() => {
61
- setDelay(true);
62
- }, 500);
63
- }, []);
64
- (0, _react.useEffect)(() => {
65
- if (checkoutSession) {
66
- if (livemode !== checkoutSession.livemode) {
67
- setLivemode(checkoutSession.livemode);
68
- setTimeout(() => {
69
- refresh();
70
- }, 10);
71
- }
72
- }
73
- }, [checkoutSession, livemode, setLivemode, refresh]);
74
- if (error) {
75
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
76
- mode,
77
- title: "Oops",
78
- description: (0, _util2.formatError)(error)
79
- });
80
- }
81
- if (!checkoutSession || !delay) {
82
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(Root, {
83
- mode,
84
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
85
- className: "cko-container",
86
- sx: {
87
- gap: {
88
- sm: mode === "standalone" ? 0 : 8
89
- }
90
- },
91
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
92
- className: "cko-overview",
93
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_overview.default, {})
94
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
95
- className: "cko-payment",
96
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_payment2.default, {})
97
- }), mode === "standalone" && /* @__PURE__ */(0, _jsxRuntime.jsx)(_footer.default, {
98
- className: "cko-footer"
99
- })]
100
- })
101
- });
102
- }
103
- if (checkoutSession.expires_at <= Math.round(Date.now() / 1e3)) {
104
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
105
- mode,
106
- title: t("payment.checkout.expired.title"),
107
- description: t("payment.checkout.expired.description")
108
- });
109
- }
110
- if (checkoutSession.status === "complete") {
111
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
112
- mode,
113
- title: t("payment.checkout.complete.title"),
114
- description: t("payment.checkout.complete.description")
115
- });
116
- }
117
- if (!checkoutSession.line_items.length) {
118
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
119
- mode,
120
- title: t("payment.checkout.emptyItems.title"),
121
- description: t("payment.checkout.emptyItems.description")
122
- });
123
- }
124
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(PaymentInner, {
125
- checkoutSession,
126
- paymentMethods,
127
- paymentLink,
128
- paymentIntent,
129
- completed,
130
- customer,
131
- onPaid,
132
- onError,
133
- onChange,
134
- goBack,
135
- mode,
136
- action
137
- });
138
- }
139
31
  PaymentInner.defaultProps = {
140
32
  completed: false
141
33
  };
@@ -150,17 +42,18 @@ function PaymentInner({
150
42
  onPaid,
151
43
  onError,
152
44
  onChange,
153
- goBack,
154
45
  action
155
46
  }) {
156
47
  const {
157
- t,
158
- locale
48
+ t
159
49
  } = (0, _context.useLocaleContext)();
160
50
  const {
161
51
  settings,
162
52
  session
163
53
  } = (0, _payment.usePaymentContext)();
54
+ const {
55
+ isMobile
56
+ } = (0, _mobile.useMobile)();
164
57
  const [state, setState] = (0, _ahooks.useSetState)({
165
58
  checkoutSession
166
59
  });
@@ -256,18 +149,10 @@ function PaymentInner({
256
149
  _Toast.default.error((0, _util2.formatError)(err));
257
150
  }
258
151
  };
259
- const min = parseFloat(paymentLink?.donation_settings?.amount.minimum || "0");
260
- const max = paymentLink?.donation_settings?.amount.maximum ? parseFloat(paymentLink?.donation_settings?.amount.maximum) : Infinity;
261
152
  const onChangeAmount = async ({
262
153
  priceId,
263
154
  amount
264
155
  }) => {
265
- if (Number(amount) < min || Number(amount) > max) {
266
- return;
267
- }
268
- if (amount && (0, _util2.formatAmountPrecisionLimit)(String(amount), locale)) {
269
- return;
270
- }
271
156
  try {
272
157
  const {
273
158
  data
@@ -291,8 +176,192 @@ function PaymentInner({
291
176
  };
292
177
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactHookForm.FormProvider, {
293
178
  ...methods,
294
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(Root, {
179
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
180
+ className: "cko-container",
181
+ sx: {
182
+ gap: {
183
+ sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8
184
+ }
185
+ },
186
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Fade, {
187
+ in: true,
188
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
189
+ className: "cko-overview base-card",
190
+ direction: "column",
191
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_summary.default, {
192
+ items: state.checkoutSession.line_items,
193
+ trialInDays: state.checkoutSession.subscription_data?.trial_period_days || 0,
194
+ billingThreshold: Math.max(state.checkoutSession.subscription_data?.billing_threshold_amount || 0,
195
+ // @ts-ignore
196
+ state.checkoutSession.subscription_data?.min_stake_amount || 0),
197
+ showStaking: method.type === "arcblock",
198
+ currency,
199
+ onUpsell,
200
+ onDownsell,
201
+ onApplyCrossSell,
202
+ onCancelCrossSell,
203
+ onChangeAmount,
204
+ checkoutSessionId: state.checkoutSession.id,
205
+ crossSellBehavior: state.checkoutSession.cross_sell_behavior,
206
+ donationSettings: paymentLink?.donation_settings,
207
+ action
208
+ }), mode === "standalone" && !isMobile && /* @__PURE__ */(0, _jsxRuntime.jsx)(_footer.default, {
209
+ className: "cko-footer",
210
+ sx: {
211
+ color: "var(--foregrounds-fg-muted, #98A3B1)"
212
+ }
213
+ })]
214
+ })
215
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
216
+ className: "cko-payment base-card",
217
+ direction: "column",
218
+ spacing: {
219
+ xs: 2,
220
+ sm: 3
221
+ },
222
+ children: [completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_success.default, {
223
+ mode,
224
+ payee: (0, _util2.getStatementDescriptor)(state.checkoutSession.line_items),
225
+ action: state.checkoutSession.mode,
226
+ invoiceId: state.checkoutSession.invoice_id,
227
+ subscriptionId: state.checkoutSession.subscription_id,
228
+ message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(`payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`)
229
+ }), !completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_form.default, {
230
+ checkoutSession: state.checkoutSession,
231
+ paymentMethods,
232
+ paymentIntent,
233
+ paymentLink,
234
+ customer,
235
+ onPaid: handlePaid,
236
+ onError,
237
+ mode,
238
+ action
239
+ })]
240
+ }), mode === "standalone" && isMobile && /* @__PURE__ */(0, _jsxRuntime.jsx)(_footer.default, {
241
+ className: "cko-footer",
242
+ sx: {
243
+ color: "var(--foregrounds-fg-muted, #98A3B1)"
244
+ }
245
+ })]
246
+ })
247
+ });
248
+ }
249
+ Payment.defaultProps = {
250
+ completed: false,
251
+ error: null
252
+ };
253
+ function Payment({
254
+ checkoutSession,
255
+ paymentMethods,
256
+ paymentIntent,
257
+ paymentLink,
258
+ customer,
259
+ completed,
260
+ // error,
261
+ mode,
262
+ onPaid,
263
+ onError,
264
+ onChange,
265
+ goBack,
266
+ action
267
+ }) {
268
+ const {
269
+ t
270
+ } = (0, _context.useLocaleContext)();
271
+ const {
272
+ refresh,
273
+ livemode,
274
+ setLivemode
275
+ } = (0, _payment.usePaymentContext)();
276
+ const [delay, setDelay] = (0, _react.useState)(false);
277
+ (0, _react.useEffect)(() => {
278
+ setTimeout(() => {
279
+ setDelay(true);
280
+ }, 500);
281
+ }, []);
282
+ (0, _react.useEffect)(() => {
283
+ if (checkoutSession) {
284
+ if (livemode !== checkoutSession.livemode) {
285
+ setLivemode(checkoutSession.livemode);
286
+ setTimeout(() => {
287
+ refresh();
288
+ }, 10);
289
+ }
290
+ }
291
+ }, [checkoutSession, livemode, setLivemode, refresh]);
292
+ const renderContent = () => {
293
+ if (!checkoutSession || !delay) {
294
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
295
+ className: "cko-container",
296
+ sx: {
297
+ gap: {
298
+ sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8
299
+ }
300
+ },
301
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
302
+ className: "cko-overview base-card",
303
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
304
+ className: "cko-product",
305
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_overview.default, {})
306
+ })
307
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
308
+ className: "cko-payment base-card",
309
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_payment2.default, {})
310
+ })]
311
+ });
312
+ }
313
+ if (checkoutSession.expires_at <= Math.round(Date.now() / 1e3)) {
314
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
315
+ mode,
316
+ title: t("payment.checkout.expired.title"),
317
+ description: t("payment.checkout.expired.description")
318
+ });
319
+ }
320
+ if (!checkoutSession.line_items.length) {
321
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
322
+ mode,
323
+ title: t("payment.checkout.emptyItems.title"),
324
+ description: t("payment.checkout.emptyItems.description")
325
+ });
326
+ }
327
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(PaymentInner, {
328
+ checkoutSession,
329
+ paymentMethods,
330
+ paymentLink,
331
+ paymentIntent,
332
+ completed: completed || checkoutSession.status === "complete",
333
+ customer,
334
+ onPaid,
335
+ onError,
336
+ onChange,
337
+ goBack,
338
+ mode,
339
+ action
340
+ });
341
+ };
342
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
343
+ display: "flex",
344
+ flexDirection: "column",
345
+ sx: {
346
+ height: mode === "standalone" ? "100vh" : "auto",
347
+ overflow: "hidden"
348
+ },
349
+ children: [mode === "standalone" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_Header.default, {
350
+ meta: void 0,
351
+ addons: void 0,
352
+ sessionManagerProps: void 0,
353
+ homeLink: void 0,
354
+ theme: void 0,
355
+ hideNavMenu: void 0,
356
+ maxWidth: false,
357
+ sx: {
358
+ borderBottom: "1px solid var(--stroke-border-base, #EFF1F5)"
359
+ }
360
+ }) : null, /* @__PURE__ */(0, _jsxRuntime.jsxs)(Root, {
295
361
  mode,
362
+ sx: {
363
+ flex: 1
364
+ },
296
365
  children: [goBack && /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowBackOutlined, {
297
366
  sx: {
298
367
  mr: 0.5,
@@ -303,108 +372,51 @@ function PaymentInner({
303
372
  },
304
373
  onClick: goBack,
305
374
  fontSize: "medium"
306
- }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
375
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
307
376
  className: "cko-container",
308
377
  sx: {
309
378
  gap: {
310
379
  sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8
311
380
  }
312
381
  },
313
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Fade, {
314
- in: true,
315
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
316
- className: "cko-overview",
317
- direction: "column",
318
- children: [mode === "standalone" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_header.default, {
319
- checkoutSession: state.checkoutSession
320
- }) : null, /* @__PURE__ */(0, _jsxRuntime.jsx)(_summary.default, {
321
- items: state.checkoutSession.line_items,
322
- trialInDays: state.checkoutSession.subscription_data?.trial_period_days || 0,
323
- billingThreshold: Math.max(state.checkoutSession.subscription_data?.billing_threshold_amount || 0,
324
- // @ts-ignore
325
- state.checkoutSession.subscription_data?.min_stake_amount || 0),
326
- showStaking: method.type === "arcblock",
327
- currency,
328
- onUpsell,
329
- onDownsell,
330
- onApplyCrossSell,
331
- onCancelCrossSell,
332
- onChangeAmount,
333
- checkoutSessionId: state.checkoutSession.id,
334
- crossSellBehavior: state.checkoutSession.cross_sell_behavior,
335
- donationSettings: paymentLink?.donation_settings,
336
- action
337
- })]
338
- })
339
- }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
340
- className: "cko-payment",
341
- direction: "column",
342
- spacing: {
343
- xs: 2,
344
- sm: 3
345
- },
346
- children: [completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_success.default, {
347
- mode,
348
- payee: (0, _util2.getStatementDescriptor)(state.checkoutSession.line_items),
349
- action: state.checkoutSession.mode,
350
- invoiceId: state.checkoutSession.invoice_id,
351
- subscriptionId: state.checkoutSession.subscription_id,
352
- message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(`payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`)
353
- }), !completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_form.default, {
354
- checkoutSession: state.checkoutSession,
355
- paymentMethods,
356
- paymentIntent,
357
- paymentLink,
358
- customer,
359
- onPaid: handlePaid,
360
- onError,
361
- mode,
362
- action
363
- })]
364
- }), mode === "standalone" && /* @__PURE__ */(0, _jsxRuntime.jsx)(_footer.default, {
365
- className: "cko-footer"
366
- })]
382
+ children: renderContent()
367
383
  })]
368
- })
384
+ })]
369
385
  });
370
386
  }
371
387
  const Root = exports.Root = (0, _system.styled)(_material.Box)`
372
388
  box-sizing: border-box;
373
389
  display: flex;
374
390
  flex-direction: column;
375
- justify-content: center;
391
+ // justify-content: center;
376
392
  align-items: center;
377
- min-height: ${props => props.mode === "standalone" ? "100vh" : "auto"};
393
+ overflow: hidden;
394
+ // min-height: ${props => props.mode === "standalone" ? "100vh" : "auto"};
378
395
  position: relative;
379
-
380
- ${props => props.mode === "standalone" ? `&:before {
381
- animation-fill-mode: both;
382
- background: #ffffff;
383
- content: '';
384
- height: 100%;
385
- position: fixed;
386
- right: 0;
387
- top: 0;
388
- transform-origin: right;
389
- width: 50%;
390
- box-shadow: 15px 0 30px 0 rgba(0, 0, 0, 0.18);
391
- }` : ""}
392
-
393
396
  .cko-container {
397
+ overflow: hidden;
394
398
  width: 100%;
395
- max-width: ${props => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
399
+ // max-width: ${props => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
396
400
  display: flex;
397
401
  flex-direction: row;
398
- justify-content: space-between;
402
+ justify-content: center;
403
+ // gap: 4px;
399
404
  position: relative;
400
- padding: ${props => props.mode === "standalone" ? "0 16px" : "0"};
405
+ flex: 1;
406
+ padding: 1px;
407
+ // padding: ${props => props.mode === "standalone" ? "0 16px" : "0"};
401
408
  }
402
409
 
403
410
  .cko-overview {
404
- width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
405
- min-height: ${props => props.mode === "standalone" ? "540px" : "auto"};
411
+ // width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
412
+ // min-height: ${props => props.mode === "standalone" ? "540px" : "auto"};
406
413
  position: relative;
407
414
  display: ${props => props.mode.endsWith("-minimal") ? "none" : "block"};
415
+ background: var(--backgrounds-bg-base);
416
+ min-height: 'auto';
417
+ // width: 502px;
418
+ display: flex;
419
+ flex-direction: column;
408
420
  }
409
421
  .cko-header {
410
422
  left: 0;
@@ -417,7 +429,8 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
417
429
  box-shadow 0.15s ease-out;
418
430
  }
419
431
  .cko-product {
420
- margin-top: ${props => props.mode === "standalone" ? "64px" : "0"};
432
+ flex: 1;
433
+ overflow: hidden;
421
434
  }
422
435
  .cko-product-summary {
423
436
  width: 100%;
@@ -429,30 +442,60 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
429
442
  text-overflow: ellipsis;
430
443
  }
431
444
 
445
+ .base-card {
446
+ border: none;
447
+ border-radius: 0;
448
+ padding: ${props => props.mode === "standalone" ? "100px 40px 20px" : "20px 0"};
449
+ box-shadow: none;
450
+ flex: 1;
451
+ max-width: 582px;
452
+ }
453
+
432
454
  .cko-payment {
433
- width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
434
- .MuiInputBase-root {
435
- border-radius: 0;
455
+ width: 502px;
456
+ // width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
457
+ // box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
458
+ padding-left: ${props => props.mode === "standalone" ? "40px" : "20px"};
459
+ position: relative;
460
+ &:before {
461
+ -webkit-animation-fill-mode: both;
462
+ content: '';
463
+ height: 100%;
464
+ position: absolute;
465
+ left: 0px;
466
+ top: 0px;
467
+ transform-origin: left center;
468
+ width: 8px;
469
+ box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
436
470
  }
437
471
  }
472
+ .cko-payment-contact {
473
+ overflow: hidden;
474
+ }
475
+ .cko-footer {
476
+ display: ${props => props.mode.endsWith("-minimal") ? "none" : "block"};
477
+ text-align: center;
478
+ margin-top: 20px;
479
+ }
438
480
 
439
481
  .cko-payment-form {
440
- .MuiInputAdornment-positionStart {
441
- width: 50px;
442
- }
482
+ // .MuiInputAdornment-positionStart {
483
+ // width: 50px;
484
+ // }
443
485
 
486
+ .MuiFormLabel-root {
487
+ color: var(--foregrounds-fg-base, #010714);
488
+ font-weight: 500;
489
+ margin-top: 12px;
490
+ margin-bottom: 4px;
491
+ }
444
492
  .MuiBox-root {
445
- border: 1px solid #ccc;
446
493
  margin: -1px 0 0 -1px;
447
494
  }
448
495
 
449
496
  .MuiFormHelperText-root {
450
497
  margin-left: 14px;
451
498
  }
452
-
453
- .MuiOutlinedInput-notchedOutline {
454
- border: none;
455
- }
456
499
  }
457
500
 
458
501
  .cko-payment-methods {
@@ -460,9 +503,9 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
460
503
 
461
504
  .cko-payment-submit {
462
505
  .MuiButtonBase-root {
463
- border-radius: 0;
464
506
  font-size: 1.3rem;
465
507
  position: relative;
508
+ padding: 4px 22px;
466
509
  }
467
510
 
468
511
  .cko-submit-progress {
@@ -477,17 +520,30 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
477
520
  .cko-header {
478
521
  }
479
522
 
480
- .cko-footer {
481
- position: absolute;
482
- bottom: 0;
483
- left: 12px;
484
- margin: 12px 0;
485
- display: ${props => props.mode.endsWith("-minimal") ? "none" : "block"};
523
+ .product-item {
524
+ border-radius: var(--radius-l, 12px);
525
+ border: 1px solid var(--stroke-border-base, #eff1f5);
526
+ .product-item-content {
527
+ padding: 16px;
528
+ background: var(--backgrounds-bg-subtle, #f9fafb);
529
+ border-top-left-radius: var(--radius-l, 12px);
530
+ border-top-right-radius: var(--radius-l, 12px);
531
+ }
532
+ .product-item-upsell {
533
+ margin-top: 0;
534
+ padding: 16px;
535
+ background: var(--backgrounds-bg-component, #f1f3f5);
536
+ border-bottom-left-radius: var(--radius-l, 12px);
537
+ border-bottom-right-radius: var(--radius-l, 12px);
538
+ }
486
539
  }
487
540
 
488
541
  @media (max-width: ${({
489
542
  theme
490
543
  }) => theme.breakpoints.values.md}px) {
544
+ background: ${props => props.mode === "standalone" ? "var(--backgrounds-bg-subtle, #F9FAFB)" : "transparent"};
545
+ padding-top: 0;
546
+ overflow: auto;
491
547
  &:before {
492
548
  display: none;
493
549
  }
@@ -497,18 +553,34 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
497
553
  gap: 32px;
498
554
  min-width: 350px;
499
555
  max-width: 400px;
556
+ overflow: visible;
500
557
  }
501
558
  .cko-overview {
502
559
  width: 100%;
503
560
  min-height: auto;
561
+ flex: none;
504
562
  }
505
563
  .cko-payment {
506
564
  width: 100%;
565
+ height: fit-content;
566
+ flex: none;
567
+ &:before {
568
+ display: none;
569
+ }
507
570
  }
508
571
 
509
572
  .cko-footer {
510
- position: static;
573
+ position: relative;
574
+ margin-bottom: 4px;
511
575
  margin-top: 0;
576
+ bottom: 0;
577
+ left: 0;
578
+ transform: translateX(0);
579
+ }
580
+ .base-card {
581
+ box-shadow: none;
582
+ border-radius: 0;
583
+ padding: 20px;
512
584
  }
513
585
  }
514
586
  `;