@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
@@ -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,122 +22,15 @@ 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
- completed: false
32
+ completed: false,
33
+ showCheckoutSummary: true
141
34
  };
142
35
  function PaymentInner({
143
36
  checkoutSession,
@@ -150,22 +43,25 @@ function PaymentInner({
150
43
  onPaid,
151
44
  onError,
152
45
  onChange,
153
- goBack,
154
- action
46
+ action,
47
+ showCheckoutSummary = true
155
48
  }) {
156
49
  const {
157
- t,
158
- locale
50
+ t
159
51
  } = (0, _context.useLocaleContext)();
160
52
  const {
161
53
  settings,
162
54
  session
163
55
  } = (0, _payment.usePaymentContext)();
56
+ const {
57
+ isMobile
58
+ } = (0, _mobile.useMobile)();
164
59
  const [state, setState] = (0, _ahooks.useSetState)({
165
60
  checkoutSession
166
61
  });
167
62
  const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
168
63
  const defaultMethodId = paymentMethods.find(m => m.payment_currencies.some(c => c.id === defaultCurrencyId))?.id;
64
+ const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
169
65
  const methods = (0, _reactHookForm.useForm)({
170
66
  defaultValues: {
171
67
  customer_name: customer?.name || session?.user?.fullName || "",
@@ -256,18 +152,10 @@ function PaymentInner({
256
152
  _Toast.default.error((0, _util2.formatError)(err));
257
153
  }
258
154
  };
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
155
  const onChangeAmount = async ({
262
156
  priceId,
263
157
  amount
264
158
  }) => {
265
- if (Number(amount) < min || Number(amount) > max) {
266
- return;
267
- }
268
- if (amount && (0, _util2.formatAmountPrecisionLimit)(String(amount), locale)) {
269
- return;
270
- }
271
159
  try {
272
160
  const {
273
161
  data
@@ -291,8 +179,196 @@ function PaymentInner({
291
179
  };
292
180
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactHookForm.FormProvider, {
293
181
  ...methods,
294
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(Root, {
182
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
183
+ className: "cko-container",
184
+ sx: {
185
+ gap: {
186
+ sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8
187
+ }
188
+ },
189
+ children: [!hideSummaryCard && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Fade, {
190
+ in: true,
191
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
192
+ className: "base-card cko-overview",
193
+ direction: "column",
194
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_summary.default, {
195
+ items: state.checkoutSession.line_items,
196
+ trialInDays: state.checkoutSession.subscription_data?.trial_period_days || 0,
197
+ billingThreshold: Math.max(state.checkoutSession.subscription_data?.billing_threshold_amount || 0,
198
+ // @ts-ignore
199
+ state.checkoutSession.subscription_data?.min_stake_amount || 0),
200
+ showStaking: method.type === "arcblock",
201
+ currency,
202
+ onUpsell,
203
+ onDownsell,
204
+ onApplyCrossSell,
205
+ onCancelCrossSell,
206
+ onChangeAmount,
207
+ checkoutSessionId: state.checkoutSession.id,
208
+ crossSellBehavior: state.checkoutSession.cross_sell_behavior,
209
+ donationSettings: paymentLink?.donation_settings,
210
+ action
211
+ }), mode === "standalone" && !isMobile && /* @__PURE__ */(0, _jsxRuntime.jsx)(_footer.default, {
212
+ className: "cko-footer",
213
+ sx: {
214
+ color: "var(--foregrounds-fg-muted, #98A3B1)"
215
+ }
216
+ })]
217
+ })
218
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
219
+ className: "base-card cko-payment",
220
+ direction: "column",
221
+ spacing: {
222
+ xs: 2,
223
+ sm: 3
224
+ },
225
+ children: [completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_success.default, {
226
+ mode,
227
+ payee: (0, _util2.getStatementDescriptor)(state.checkoutSession.line_items),
228
+ action: state.checkoutSession.mode,
229
+ invoiceId: state.checkoutSession.invoice_id,
230
+ subscriptionId: state.checkoutSession.subscription_id,
231
+ message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(`payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`)
232
+ }), !completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_form.default, {
233
+ checkoutSession: state.checkoutSession,
234
+ paymentMethods,
235
+ paymentIntent,
236
+ paymentLink,
237
+ customer,
238
+ onPaid: handlePaid,
239
+ onError,
240
+ mode,
241
+ action
242
+ })]
243
+ }), mode === "standalone" && isMobile && /* @__PURE__ */(0, _jsxRuntime.jsx)(_footer.default, {
244
+ className: "cko-footer",
245
+ sx: {
246
+ color: "var(--foregrounds-fg-muted, #98A3B1)"
247
+ }
248
+ })]
249
+ })
250
+ });
251
+ }
252
+ Payment.defaultProps = {
253
+ completed: false,
254
+ error: null,
255
+ showCheckoutSummary: true
256
+ };
257
+ function Payment({
258
+ checkoutSession,
259
+ paymentMethods,
260
+ paymentIntent,
261
+ paymentLink,
262
+ customer,
263
+ completed,
264
+ // error,
265
+ mode,
266
+ onPaid,
267
+ onError,
268
+ onChange,
269
+ goBack,
270
+ action,
271
+ showCheckoutSummary = true
272
+ }) {
273
+ const {
274
+ t
275
+ } = (0, _context.useLocaleContext)();
276
+ const {
277
+ refresh,
278
+ livemode,
279
+ setLivemode
280
+ } = (0, _payment.usePaymentContext)();
281
+ const [delay, setDelay] = (0, _react.useState)(false);
282
+ const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
283
+ (0, _react.useEffect)(() => {
284
+ setTimeout(() => {
285
+ setDelay(true);
286
+ }, 500);
287
+ }, []);
288
+ (0, _react.useEffect)(() => {
289
+ if (checkoutSession) {
290
+ if (livemode !== checkoutSession.livemode) {
291
+ setLivemode(checkoutSession.livemode);
292
+ setTimeout(() => {
293
+ refresh();
294
+ }, 10);
295
+ }
296
+ }
297
+ }, [checkoutSession, livemode, setLivemode, refresh]);
298
+ const renderContent = () => {
299
+ if (!checkoutSession || !delay) {
300
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
301
+ className: "cko-container",
302
+ sx: {
303
+ gap: {
304
+ sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8
305
+ }
306
+ },
307
+ children: [!hideSummaryCard && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
308
+ className: "base-card cko-overview",
309
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
310
+ className: "cko-product",
311
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_overview.default, {})
312
+ })
313
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
314
+ className: "base-card cko-payment",
315
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_payment2.default, {})
316
+ })]
317
+ });
318
+ }
319
+ if (checkoutSession.expires_at <= Math.round(Date.now() / 1e3)) {
320
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
321
+ mode,
322
+ title: t("payment.checkout.expired.title"),
323
+ description: t("payment.checkout.expired.description")
324
+ });
325
+ }
326
+ if (!checkoutSession.line_items.length) {
327
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
328
+ mode,
329
+ title: t("payment.checkout.emptyItems.title"),
330
+ description: t("payment.checkout.emptyItems.description")
331
+ });
332
+ }
333
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(PaymentInner, {
334
+ checkoutSession,
335
+ paymentMethods,
336
+ paymentLink,
337
+ paymentIntent,
338
+ completed: completed || checkoutSession.status === "complete",
339
+ customer,
340
+ onPaid,
341
+ onError,
342
+ onChange,
343
+ goBack,
344
+ mode,
345
+ action,
346
+ showCheckoutSummary
347
+ });
348
+ };
349
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
350
+ display: "flex",
351
+ flexDirection: "column",
352
+ sx: {
353
+ height: mode === "standalone" ? "100vh" : "auto",
354
+ overflow: "hidden"
355
+ },
356
+ children: [mode === "standalone" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_Header.default, {
357
+ meta: void 0,
358
+ addons: void 0,
359
+ sessionManagerProps: void 0,
360
+ homeLink: void 0,
361
+ theme: void 0,
362
+ hideNavMenu: void 0,
363
+ maxWidth: false,
364
+ sx: {
365
+ borderBottom: "1px solid var(--stroke-border-base, #EFF1F5)"
366
+ }
367
+ }) : null, /* @__PURE__ */(0, _jsxRuntime.jsxs)(Root, {
295
368
  mode,
369
+ sx: {
370
+ flex: 1
371
+ },
296
372
  children: [goBack && /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.ArrowBackOutlined, {
297
373
  sx: {
298
374
  mr: 0.5,
@@ -303,108 +379,59 @@ function PaymentInner({
303
379
  },
304
380
  onClick: goBack,
305
381
  fontSize: "medium"
306
- }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
382
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
307
383
  className: "cko-container",
308
384
  sx: {
309
385
  gap: {
310
386
  sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8
311
387
  }
312
388
  },
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
- })]
389
+ children: renderContent()
367
390
  })]
368
- })
391
+ })]
369
392
  });
370
393
  }
371
394
  const Root = exports.Root = (0, _system.styled)(_material.Box)`
372
395
  box-sizing: border-box;
373
396
  display: flex;
374
397
  flex-direction: column;
375
- justify-content: center;
398
+ // justify-content: center;
376
399
  align-items: center;
377
- min-height: ${props => props.mode === "standalone" ? "100vh" : "auto"};
400
+ overflow: hidden;
401
+ // min-height: ${props => props.mode === "standalone" ? "100vh" : "auto"};
378
402
  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
403
  .cko-container {
404
+ overflow: hidden;
394
405
  width: 100%;
395
- max-width: ${props => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
406
+ // max-width: ${props => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
396
407
  display: flex;
397
408
  flex-direction: row;
398
- justify-content: space-between;
409
+ justify-content: center;
410
+ // gap: 4px;
399
411
  position: relative;
400
- padding: ${props => props.mode === "standalone" ? "0 16px" : "0"};
412
+ flex: 1;
413
+ padding: 1px;
414
+ // padding: ${props => props.mode === "standalone" ? "0 16px" : "0"};
415
+ }
416
+
417
+ .base-card {
418
+ border: none;
419
+ border-radius: 0;
420
+ padding: ${props => props.mode === "standalone" ? "100px 40px 20px" : "20px 0"};
421
+ box-shadow: none;
422
+ flex: 1;
423
+ max-width: 582px;
401
424
  }
402
425
 
403
426
  .cko-overview {
404
- width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
405
- min-height: ${props => props.mode === "standalone" ? "540px" : "auto"};
427
+ // width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
428
+ // min-height: ${props => props.mode === "standalone" ? "540px" : "auto"};
406
429
  position: relative;
407
- display: ${props => props.mode.endsWith("-minimal") ? "none" : "block"};
430
+ flex-direction: column;
431
+ display: ${props => props.mode.endsWith("-minimal") ? "none" : "flex"};
432
+ background: var(--backgrounds-bg-base);
433
+ min-height: 'auto';
434
+ // width: 502px;
408
435
  }
409
436
  .cko-header {
410
437
  left: 0;
@@ -417,7 +444,8 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
417
444
  box-shadow 0.15s ease-out;
418
445
  }
419
446
  .cko-product {
420
- margin-top: ${props => props.mode === "standalone" ? "64px" : "0"};
447
+ flex: 1;
448
+ overflow: hidden;
421
449
  }
422
450
  .cko-product-summary {
423
451
  width: 100%;
@@ -430,29 +458,50 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
430
458
  }
431
459
 
432
460
  .cko-payment {
433
- width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
434
- .MuiInputBase-root {
435
- border-radius: 0;
461
+ width: 502px;
462
+ // width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
463
+ // box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
464
+ padding-left: ${props => props.mode === "standalone" ? "40px" : "20px"};
465
+ position: relative;
466
+ &:before {
467
+ -webkit-animation-fill-mode: both;
468
+ content: '';
469
+ height: 100%;
470
+ position: absolute;
471
+ left: 0px;
472
+ top: 0px;
473
+ transform-origin: left center;
474
+ width: 8px;
475
+ box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
436
476
  }
437
477
  }
478
+ .cko-payment-contact {
479
+ overflow: hidden;
480
+ }
481
+ .cko-footer {
482
+ display: ${props => props.mode.endsWith("-minimal") ? "none" : "block"};
483
+ text-align: center;
484
+ margin-top: 20px;
485
+ }
438
486
 
439
487
  .cko-payment-form {
440
- .MuiInputAdornment-positionStart {
441
- width: 50px;
442
- }
488
+ // .MuiInputAdornment-positionStart {
489
+ // width: 50px;
490
+ // }
443
491
 
492
+ .MuiFormLabel-root {
493
+ color: var(--foregrounds-fg-base, #010714);
494
+ font-weight: 500;
495
+ margin-top: 12px;
496
+ margin-bottom: 4px;
497
+ }
444
498
  .MuiBox-root {
445
- border: 1px solid #ccc;
446
- margin: -1px 0 0 -1px;
499
+ margin: 0;
447
500
  }
448
501
 
449
502
  .MuiFormHelperText-root {
450
503
  margin-left: 14px;
451
504
  }
452
-
453
- .MuiOutlinedInput-notchedOutline {
454
- border: none;
455
- }
456
505
  }
457
506
 
458
507
  .cko-payment-methods {
@@ -460,9 +509,9 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
460
509
 
461
510
  .cko-payment-submit {
462
511
  .MuiButtonBase-root {
463
- border-radius: 0;
464
512
  font-size: 1.3rem;
465
513
  position: relative;
514
+ padding: 4px 22px;
466
515
  }
467
516
 
468
517
  .cko-submit-progress {
@@ -477,17 +526,30 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
477
526
  .cko-header {
478
527
  }
479
528
 
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"};
529
+ .product-item {
530
+ border-radius: var(--radius-l, 12px);
531
+ border: 1px solid var(--stroke-border-base, #eff1f5);
532
+ .product-item-content {
533
+ padding: 16px;
534
+ background: var(--backgrounds-bg-subtle, #f9fafb);
535
+ border-top-left-radius: var(--radius-l, 12px);
536
+ border-top-right-radius: var(--radius-l, 12px);
537
+ }
538
+ .product-item-upsell {
539
+ margin-top: 0;
540
+ padding: 16px;
541
+ background: var(--backgrounds-bg-component, #f1f3f5);
542
+ border-bottom-left-radius: var(--radius-l, 12px);
543
+ border-bottom-right-radius: var(--radius-l, 12px);
544
+ }
486
545
  }
487
546
 
488
547
  @media (max-width: ${({
489
548
  theme
490
549
  }) => theme.breakpoints.values.md}px) {
550
+ background: ${props => props.mode === "standalone" ? "var(--backgrounds-bg-subtle, #F9FAFB)" : "transparent"};
551
+ padding-top: 0;
552
+ overflow: auto;
491
553
  &:before {
492
554
  display: none;
493
555
  }
@@ -495,20 +557,35 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
495
557
  flex-direction: column;
496
558
  align-items: center;
497
559
  gap: 32px;
498
- min-width: 350px;
499
- max-width: 400px;
560
+ overflow: visible;
561
+ min-width: 200px;
500
562
  }
501
563
  .cko-overview {
502
564
  width: 100%;
503
565
  min-height: auto;
566
+ flex: none;
504
567
  }
505
568
  .cko-payment {
506
569
  width: 100%;
570
+ height: fit-content;
571
+ flex: none;
572
+ &:before {
573
+ display: none;
574
+ }
507
575
  }
508
576
 
509
577
  .cko-footer {
510
- position: static;
578
+ position: relative;
579
+ margin-bottom: 4px;
511
580
  margin-top: 0;
581
+ bottom: 0;
582
+ left: 0;
583
+ transform: translateX(0);
584
+ }
585
+ .base-card {
586
+ box-shadow: none;
587
+ border-radius: 0;
588
+ padding: 20px;
512
589
  }
513
590
  }
514
591
  `;