@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,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
3
3
  import Toast from "@arcblock/ux/lib/Toast";
4
+ import Header from "@blocklet/ui-react/lib/Header";
4
5
  import { ArrowBackOutlined } from "@mui/icons-material";
5
6
  import { Box, Fade, Stack } from "@mui/material";
6
7
  import { styled } from "@mui/system";
@@ -10,120 +11,20 @@ import { useEffect, useState } from "react";
10
11
  import { FormProvider, useForm, useWatch } from "react-hook-form";
11
12
  import { usePaymentContext } from "../contexts/payment.js";
12
13
  import api from "../libs/api.js";
13
- import {
14
- findCurrency,
15
- formatAmountPrecisionLimit,
16
- formatError,
17
- getStatementDescriptor,
18
- isValidCountry
19
- } from "../libs/util.js";
14
+ import { findCurrency, formatError, getStatementDescriptor, isValidCountry } from "../libs/util.js";
20
15
  import PaymentError from "./error.js";
21
16
  import CheckoutFooter from "./footer.js";
22
17
  import PaymentForm from "./form/index.js";
23
- import PaymentHeader from "./header.js";
24
18
  import OverviewSkeleton from "./skeleton/overview.js";
25
19
  import PaymentSkeleton from "./skeleton/payment.js";
26
20
  import PaymentSuccess from "./success.js";
27
21
  import PaymentSummary from "./summary.js";
28
- Payment.defaultProps = {
29
- completed: false,
30
- error: null
31
- };
32
- export default function Payment({
33
- checkoutSession,
34
- paymentMethods,
35
- paymentIntent,
36
- paymentLink,
37
- customer,
38
- completed,
39
- error,
40
- mode,
41
- onPaid,
42
- onError,
43
- onChange,
44
- goBack,
45
- action
46
- }) {
47
- const { t } = useLocaleContext();
48
- const { refresh, livemode, setLivemode } = usePaymentContext();
49
- const [delay, setDelay] = useState(false);
50
- useEffect(() => {
51
- setTimeout(() => {
52
- setDelay(true);
53
- }, 500);
54
- }, []);
55
- useEffect(() => {
56
- if (checkoutSession) {
57
- if (livemode !== checkoutSession.livemode) {
58
- setLivemode(checkoutSession.livemode);
59
- setTimeout(() => {
60
- refresh();
61
- }, 10);
62
- }
63
- }
64
- }, [checkoutSession, livemode, setLivemode, refresh]);
65
- if (error) {
66
- return /* @__PURE__ */ jsx(PaymentError, { mode, title: "Oops", description: formatError(error) });
67
- }
68
- if (!checkoutSession || !delay) {
69
- return /* @__PURE__ */ jsx(Root, { mode, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : 8 } }, children: [
70
- /* @__PURE__ */ jsx(Stack, { className: "cko-overview", children: /* @__PURE__ */ jsx(OverviewSkeleton, {}) }),
71
- /* @__PURE__ */ jsx(Stack, { className: "cko-payment", children: /* @__PURE__ */ jsx(PaymentSkeleton, {}) }),
72
- mode === "standalone" && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer" })
73
- ] }) });
74
- }
75
- if (checkoutSession.expires_at <= Math.round(Date.now() / 1e3)) {
76
- return /* @__PURE__ */ jsx(
77
- PaymentError,
78
- {
79
- mode,
80
- title: t("payment.checkout.expired.title"),
81
- description: t("payment.checkout.expired.description")
82
- }
83
- );
84
- }
85
- if (checkoutSession.status === "complete") {
86
- return /* @__PURE__ */ jsx(
87
- PaymentError,
88
- {
89
- mode,
90
- title: t("payment.checkout.complete.title"),
91
- description: t("payment.checkout.complete.description")
92
- }
93
- );
94
- }
95
- if (!checkoutSession.line_items.length) {
96
- return /* @__PURE__ */ jsx(
97
- PaymentError,
98
- {
99
- mode,
100
- title: t("payment.checkout.emptyItems.title"),
101
- description: t("payment.checkout.emptyItems.description")
102
- }
103
- );
104
- }
105
- return /* @__PURE__ */ jsx(
106
- PaymentInner,
107
- {
108
- checkoutSession,
109
- paymentMethods,
110
- paymentLink,
111
- paymentIntent,
112
- completed,
113
- customer,
114
- onPaid,
115
- onError,
116
- onChange,
117
- goBack,
118
- mode,
119
- action
120
- }
121
- );
122
- }
22
+ import { useMobile } from "../hooks/mobile.js";
123
23
  PaymentInner.defaultProps = {
124
- completed: false
24
+ completed: false,
25
+ showCheckoutSummary: true
125
26
  };
126
- export function PaymentInner({
27
+ function PaymentInner({
127
28
  checkoutSession,
128
29
  paymentMethods,
129
30
  paymentLink,
@@ -134,14 +35,16 @@ export function PaymentInner({
134
35
  onPaid,
135
36
  onError,
136
37
  onChange,
137
- goBack,
138
- action
38
+ action,
39
+ showCheckoutSummary = true
139
40
  }) {
140
- const { t, locale } = useLocaleContext();
41
+ const { t } = useLocaleContext();
141
42
  const { settings, session } = usePaymentContext();
43
+ const { isMobile } = useMobile();
142
44
  const [state, setState] = useSetState({ checkoutSession });
143
45
  const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
144
46
  const defaultMethodId = paymentMethods.find((m) => m.payment_currencies.some((c) => c.id === defaultCurrencyId))?.id;
47
+ const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
145
48
  const methods = useForm({
146
49
  defaultValues: {
147
50
  customer_name: customer?.name || session?.user?.fullName || "",
@@ -207,15 +110,7 @@ export function PaymentInner({
207
110
  Toast.error(formatError(err));
208
111
  }
209
112
  };
210
- const min = parseFloat(paymentLink?.donation_settings?.amount.minimum || "0");
211
- const max = paymentLink?.donation_settings?.amount.maximum ? parseFloat(paymentLink?.donation_settings?.amount.maximum) : Infinity;
212
113
  const onChangeAmount = async ({ priceId, amount }) => {
213
- if (Number(amount) < min || Number(amount) > max) {
214
- return;
215
- }
216
- if (amount && formatAmountPrecisionLimit(String(amount), locale)) {
217
- return;
218
- }
219
114
  try {
220
115
  const { data } = await api.put(`/api/checkout-sessions/${state.checkoutSession.id}/amount`, {
221
116
  priceId,
@@ -231,112 +126,238 @@ export function PaymentInner({
231
126
  setState({ checkoutSession: result.checkoutSession });
232
127
  onPaid(result);
233
128
  };
234
- return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsxs(Root, { mode, children: [
235
- goBack && /* @__PURE__ */ jsx(
236
- ArrowBackOutlined,
129
+ return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: [
130
+ !hideSummaryCard && /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { className: "base-card cko-overview", direction: "column", children: [
131
+ /* @__PURE__ */ jsx(
132
+ PaymentSummary,
133
+ {
134
+ items: state.checkoutSession.line_items,
135
+ trialInDays: state.checkoutSession.subscription_data?.trial_period_days || 0,
136
+ billingThreshold: Math.max(
137
+ state.checkoutSession.subscription_data?.billing_threshold_amount || 0,
138
+ // @ts-ignore
139
+ state.checkoutSession.subscription_data?.min_stake_amount || 0
140
+ ),
141
+ showStaking: method.type === "arcblock",
142
+ currency,
143
+ onUpsell,
144
+ onDownsell,
145
+ onApplyCrossSell,
146
+ onCancelCrossSell,
147
+ onChangeAmount,
148
+ checkoutSessionId: state.checkoutSession.id,
149
+ crossSellBehavior: state.checkoutSession.cross_sell_behavior,
150
+ donationSettings: paymentLink?.donation_settings,
151
+ action
152
+ }
153
+ ),
154
+ mode === "standalone" && !isMobile && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer", sx: { color: "var(--foregrounds-fg-muted, #98A3B1)" } })
155
+ ] }) }),
156
+ /* @__PURE__ */ jsxs(
157
+ Stack,
237
158
  {
238
- sx: { mr: 0.5, color: "text.secondary", alignSelf: "flex-start", margin: "16px 0", cursor: "pointer" },
239
- onClick: goBack,
240
- fontSize: "medium"
159
+ className: "base-card cko-payment",
160
+ direction: "column",
161
+ spacing: {
162
+ xs: 2,
163
+ sm: 3
164
+ },
165
+ children: [
166
+ completed && /* @__PURE__ */ jsx(
167
+ PaymentSuccess,
168
+ {
169
+ mode,
170
+ payee: getStatementDescriptor(state.checkoutSession.line_items),
171
+ action: state.checkoutSession.mode,
172
+ invoiceId: state.checkoutSession.invoice_id,
173
+ subscriptionId: state.checkoutSession.subscription_id,
174
+ message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(
175
+ `payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`
176
+ )
177
+ }
178
+ ),
179
+ !completed && /* @__PURE__ */ jsx(
180
+ PaymentForm,
181
+ {
182
+ checkoutSession: state.checkoutSession,
183
+ paymentMethods,
184
+ paymentIntent,
185
+ paymentLink,
186
+ customer,
187
+ onPaid: handlePaid,
188
+ onError,
189
+ mode,
190
+ action
191
+ }
192
+ )
193
+ ]
241
194
  }
242
195
  ),
243
- /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: [
244
- /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-overview", direction: "column", children: [
245
- mode === "standalone" ? /* @__PURE__ */ jsx(PaymentHeader, { checkoutSession: state.checkoutSession }) : null,
246
- /* @__PURE__ */ jsx(
247
- PaymentSummary,
248
- {
249
- items: state.checkoutSession.line_items,
250
- trialInDays: state.checkoutSession.subscription_data?.trial_period_days || 0,
251
- billingThreshold: Math.max(
252
- state.checkoutSession.subscription_data?.billing_threshold_amount || 0,
253
- // @ts-ignore
254
- state.checkoutSession.subscription_data?.min_stake_amount || 0
255
- ),
256
- showStaking: method.type === "arcblock",
257
- currency,
258
- onUpsell,
259
- onDownsell,
260
- onApplyCrossSell,
261
- onCancelCrossSell,
262
- onChangeAmount,
263
- checkoutSessionId: state.checkoutSession.id,
264
- crossSellBehavior: state.checkoutSession.cross_sell_behavior,
265
- donationSettings: paymentLink?.donation_settings,
266
- action
267
- }
268
- )
269
- ] }) }),
270
- /* @__PURE__ */ jsxs(Stack, { className: "cko-payment", direction: "column", spacing: { xs: 2, sm: 3 }, children: [
271
- completed && /* @__PURE__ */ jsx(
272
- PaymentSuccess,
273
- {
274
- mode,
275
- payee: getStatementDescriptor(state.checkoutSession.line_items),
276
- action: state.checkoutSession.mode,
277
- invoiceId: state.checkoutSession.invoice_id,
278
- subscriptionId: state.checkoutSession.subscription_id,
279
- message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(
280
- `payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`
281
- )
282
- }
283
- ),
284
- !completed && /* @__PURE__ */ jsx(
285
- PaymentForm,
196
+ mode === "standalone" && isMobile && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer", sx: { color: "var(--foregrounds-fg-muted, #98A3B1)" } })
197
+ ] }) });
198
+ }
199
+ Payment.defaultProps = {
200
+ completed: false,
201
+ error: null,
202
+ showCheckoutSummary: true
203
+ };
204
+ export default function Payment({
205
+ checkoutSession,
206
+ paymentMethods,
207
+ paymentIntent,
208
+ paymentLink,
209
+ customer,
210
+ completed,
211
+ // error,
212
+ mode,
213
+ onPaid,
214
+ onError,
215
+ onChange,
216
+ goBack,
217
+ action,
218
+ showCheckoutSummary = true
219
+ }) {
220
+ const { t } = useLocaleContext();
221
+ const { refresh, livemode, setLivemode } = usePaymentContext();
222
+ const [delay, setDelay] = useState(false);
223
+ const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
224
+ useEffect(() => {
225
+ setTimeout(() => {
226
+ setDelay(true);
227
+ }, 500);
228
+ }, []);
229
+ useEffect(() => {
230
+ if (checkoutSession) {
231
+ if (livemode !== checkoutSession.livemode) {
232
+ setLivemode(checkoutSession.livemode);
233
+ setTimeout(() => {
234
+ refresh();
235
+ }, 10);
236
+ }
237
+ }
238
+ }, [checkoutSession, livemode, setLivemode, refresh]);
239
+ const renderContent = () => {
240
+ if (!checkoutSession || !delay) {
241
+ return /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: [
242
+ !hideSummaryCard && /* @__PURE__ */ jsx(Stack, { className: "base-card cko-overview", children: /* @__PURE__ */ jsx(Box, { className: "cko-product", children: /* @__PURE__ */ jsx(OverviewSkeleton, {}) }) }),
243
+ /* @__PURE__ */ jsx(Stack, { className: "base-card cko-payment", children: /* @__PURE__ */ jsx(PaymentSkeleton, {}) })
244
+ ] });
245
+ }
246
+ if (checkoutSession.expires_at <= Math.round(Date.now() / 1e3)) {
247
+ return /* @__PURE__ */ jsx(
248
+ PaymentError,
249
+ {
250
+ mode,
251
+ title: t("payment.checkout.expired.title"),
252
+ description: t("payment.checkout.expired.description")
253
+ }
254
+ );
255
+ }
256
+ if (!checkoutSession.line_items.length) {
257
+ return /* @__PURE__ */ jsx(
258
+ PaymentError,
259
+ {
260
+ mode,
261
+ title: t("payment.checkout.emptyItems.title"),
262
+ description: t("payment.checkout.emptyItems.description")
263
+ }
264
+ );
265
+ }
266
+ return /* @__PURE__ */ jsx(
267
+ PaymentInner,
268
+ {
269
+ checkoutSession,
270
+ paymentMethods,
271
+ paymentLink,
272
+ paymentIntent,
273
+ completed: completed || checkoutSession.status === "complete",
274
+ customer,
275
+ onPaid,
276
+ onError,
277
+ onChange,
278
+ goBack,
279
+ mode,
280
+ action,
281
+ showCheckoutSummary
282
+ }
283
+ );
284
+ };
285
+ return /* @__PURE__ */ jsxs(
286
+ Stack,
287
+ {
288
+ display: "flex",
289
+ flexDirection: "column",
290
+ sx: { height: mode === "standalone" ? "100vh" : "auto", overflow: "hidden" },
291
+ children: [
292
+ mode === "standalone" ? /* @__PURE__ */ jsx(
293
+ Header,
286
294
  {
287
- checkoutSession: state.checkoutSession,
288
- paymentMethods,
289
- paymentIntent,
290
- paymentLink,
291
- customer,
292
- onPaid: handlePaid,
293
- onError,
294
- mode,
295
- action
295
+ meta: void 0,
296
+ addons: void 0,
297
+ sessionManagerProps: void 0,
298
+ homeLink: void 0,
299
+ theme: void 0,
300
+ hideNavMenu: void 0,
301
+ maxWidth: false,
302
+ sx: { borderBottom: "1px solid var(--stroke-border-base, #EFF1F5)" }
296
303
  }
297
- )
298
- ] }),
299
- mode === "standalone" && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer" })
300
- ] })
301
- ] }) });
304
+ ) : null,
305
+ /* @__PURE__ */ jsxs(Root, { mode, sx: { flex: 1 }, children: [
306
+ goBack && /* @__PURE__ */ jsx(
307
+ ArrowBackOutlined,
308
+ {
309
+ sx: { mr: 0.5, color: "text.secondary", alignSelf: "flex-start", margin: "16px 0", cursor: "pointer" },
310
+ onClick: goBack,
311
+ fontSize: "medium"
312
+ }
313
+ ),
314
+ /* @__PURE__ */ jsx(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: renderContent() })
315
+ ] })
316
+ ]
317
+ }
318
+ );
302
319
  }
303
320
  export const Root = styled(Box)`
304
321
  box-sizing: border-box;
305
322
  display: flex;
306
323
  flex-direction: column;
307
- justify-content: center;
324
+ // justify-content: center;
308
325
  align-items: center;
309
- min-height: ${(props) => props.mode === "standalone" ? "100vh" : "auto"};
326
+ overflow: hidden;
327
+ // min-height: ${(props) => props.mode === "standalone" ? "100vh" : "auto"};
310
328
  position: relative;
311
-
312
- ${(props) => props.mode === "standalone" ? `&:before {
313
- animation-fill-mode: both;
314
- background: #ffffff;
315
- content: '';
316
- height: 100%;
317
- position: fixed;
318
- right: 0;
319
- top: 0;
320
- transform-origin: right;
321
- width: 50%;
322
- box-shadow: 15px 0 30px 0 rgba(0, 0, 0, 0.18);
323
- }` : ""}
324
-
325
329
  .cko-container {
330
+ overflow: hidden;
326
331
  width: 100%;
327
- max-width: ${(props) => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
332
+ // max-width: ${(props) => props.mode.endsWith("-minimal") ? "400px" : "1000px"};
328
333
  display: flex;
329
334
  flex-direction: row;
330
- justify-content: space-between;
335
+ justify-content: center;
336
+ // gap: 4px;
331
337
  position: relative;
332
- padding: ${(props) => props.mode === "standalone" ? "0 16px" : "0"};
338
+ flex: 1;
339
+ padding: 1px;
340
+ // padding: ${(props) => props.mode === "standalone" ? "0 16px" : "0"};
341
+ }
342
+
343
+ .base-card {
344
+ border: none;
345
+ border-radius: 0;
346
+ padding: ${(props) => props.mode === "standalone" ? "100px 40px 20px" : "20px 0"};
347
+ box-shadow: none;
348
+ flex: 1;
349
+ max-width: 582px;
333
350
  }
334
351
 
335
352
  .cko-overview {
336
- width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
337
- min-height: ${(props) => props.mode === "standalone" ? "540px" : "auto"};
353
+ // width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
354
+ // min-height: ${(props) => props.mode === "standalone" ? "540px" : "auto"};
338
355
  position: relative;
339
- display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "block"};
356
+ flex-direction: column;
357
+ display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "flex"};
358
+ background: var(--backgrounds-bg-base);
359
+ min-height: 'auto';
360
+ // width: 502px;
340
361
  }
341
362
  .cko-header {
342
363
  left: 0;
@@ -349,7 +370,8 @@ export const Root = styled(Box)`
349
370
  box-shadow 0.15s ease-out;
350
371
  }
351
372
  .cko-product {
352
- margin-top: ${(props) => props.mode === "standalone" ? "64px" : "0"};
373
+ flex: 1;
374
+ overflow: hidden;
353
375
  }
354
376
  .cko-product-summary {
355
377
  width: 100%;
@@ -362,29 +384,50 @@ export const Root = styled(Box)`
362
384
  }
363
385
 
364
386
  .cko-payment {
365
- width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
366
- .MuiInputBase-root {
367
- border-radius: 0;
387
+ width: 502px;
388
+ // width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
389
+ // box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
390
+ padding-left: ${(props) => props.mode === "standalone" ? "40px" : "20px"};
391
+ position: relative;
392
+ &:before {
393
+ -webkit-animation-fill-mode: both;
394
+ content: '';
395
+ height: 100%;
396
+ position: absolute;
397
+ left: 0px;
398
+ top: 0px;
399
+ transform-origin: left center;
400
+ width: 8px;
401
+ box-shadow: -4px 0px 8px 0px rgba(2, 7, 19, 0.04);
368
402
  }
369
403
  }
404
+ .cko-payment-contact {
405
+ overflow: hidden;
406
+ }
407
+ .cko-footer {
408
+ display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "block"};
409
+ text-align: center;
410
+ margin-top: 20px;
411
+ }
370
412
 
371
413
  .cko-payment-form {
372
- .MuiInputAdornment-positionStart {
373
- width: 50px;
374
- }
414
+ // .MuiInputAdornment-positionStart {
415
+ // width: 50px;
416
+ // }
375
417
 
418
+ .MuiFormLabel-root {
419
+ color: var(--foregrounds-fg-base, #010714);
420
+ font-weight: 500;
421
+ margin-top: 12px;
422
+ margin-bottom: 4px;
423
+ }
376
424
  .MuiBox-root {
377
- border: 1px solid #ccc;
378
- margin: -1px 0 0 -1px;
425
+ margin: 0;
379
426
  }
380
427
 
381
428
  .MuiFormHelperText-root {
382
429
  margin-left: 14px;
383
430
  }
384
-
385
- .MuiOutlinedInput-notchedOutline {
386
- border: none;
387
- }
388
431
  }
389
432
 
390
433
  .cko-payment-methods {
@@ -392,9 +435,9 @@ export const Root = styled(Box)`
392
435
 
393
436
  .cko-payment-submit {
394
437
  .MuiButtonBase-root {
395
- border-radius: 0;
396
438
  font-size: 1.3rem;
397
439
  position: relative;
440
+ padding: 4px 22px;
398
441
  }
399
442
 
400
443
  .cko-submit-progress {
@@ -409,15 +452,28 @@ export const Root = styled(Box)`
409
452
  .cko-header {
410
453
  }
411
454
 
412
- .cko-footer {
413
- position: absolute;
414
- bottom: 0;
415
- left: 12px;
416
- margin: 12px 0;
417
- display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "block"};
455
+ .product-item {
456
+ border-radius: var(--radius-l, 12px);
457
+ border: 1px solid var(--stroke-border-base, #eff1f5);
458
+ .product-item-content {
459
+ padding: 16px;
460
+ background: var(--backgrounds-bg-subtle, #f9fafb);
461
+ border-top-left-radius: var(--radius-l, 12px);
462
+ border-top-right-radius: var(--radius-l, 12px);
463
+ }
464
+ .product-item-upsell {
465
+ margin-top: 0;
466
+ padding: 16px;
467
+ background: var(--backgrounds-bg-component, #f1f3f5);
468
+ border-bottom-left-radius: var(--radius-l, 12px);
469
+ border-bottom-right-radius: var(--radius-l, 12px);
470
+ }
418
471
  }
419
472
 
420
473
  @media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
474
+ background: ${(props) => props.mode === "standalone" ? "var(--backgrounds-bg-subtle, #F9FAFB)" : "transparent"};
475
+ padding-top: 0;
476
+ overflow: auto;
421
477
  &:before {
422
478
  display: none;
423
479
  }
@@ -425,20 +481,35 @@ export const Root = styled(Box)`
425
481
  flex-direction: column;
426
482
  align-items: center;
427
483
  gap: 32px;
428
- min-width: 350px;
429
- max-width: 400px;
484
+ overflow: visible;
485
+ min-width: 200px;
430
486
  }
431
487
  .cko-overview {
432
488
  width: 100%;
433
489
  min-height: auto;
490
+ flex: none;
434
491
  }
435
492
  .cko-payment {
436
493
  width: 100%;
494
+ height: fit-content;
495
+ flex: none;
496
+ &:before {
497
+ display: none;
498
+ }
437
499
  }
438
500
 
439
501
  .cko-footer {
440
- position: static;
502
+ position: relative;
503
+ margin-bottom: 4px;
441
504
  margin-top: 0;
505
+ bottom: 0;
506
+ left: 0;
507
+ transform: translateX(0);
508
+ }
509
+ .base-card {
510
+ box-shadow: none;
511
+ border-radius: 0;
512
+ padding: 20px;
442
513
  }
443
514
  }
444
515
  `;
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Avatar, Stack, Typography } from "@mui/material";
3
3
  export default function ProductCard({ size, variant, name, logo, description, extra }) {
4
4
  const s = { width: size, height: size };
5
- return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "flex-start", spacing: 1, flex: 2, sx: { width: "100%" }, children: [
5
+ return /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, flex: 2, sx: { width: "100%" }, children: [
6
6
  logo ? (
7
7
  // @ts-ignore
8
8
  /* @__PURE__ */ jsx(Avatar, { src: logo, alt: name, variant, sx: s })
@@ -24,7 +24,7 @@ export default function ProductCard({ size, variant, name, logo, description, ex
24
24
  className: "cko-ellipsis",
25
25
  variant: "body1",
26
26
  title: name,
27
- sx: { fontWeight: 500, mb: 0.5, lineHeight: 1 },
27
+ sx: { fontWeight: 500, mb: 0.5, lineHeight: 1, fontSize: 16 },
28
28
  color: "text.primary",
29
29
  children: name
30
30
  }
@@ -35,11 +35,11 @@ export default function ProductCard({ size, variant, name, logo, description, ex
35
35
  variant: "body1",
36
36
  title: description,
37
37
  sx: { fontSize: "0.85rem", mb: 0.5, lineHeight: 1, textAlign: "left" },
38
- color: "text.secondary",
38
+ color: "text.lighter",
39
39
  children: description
40
40
  }
41
41
  ),
42
- extra && /* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { fontSize: "0.85rem" }, color: "text.secondary", children: extra })
42
+ extra && /* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { fontSize: "0.85rem" }, color: "text.lighter", children: extra })
43
43
  ]
44
44
  }
45
45
  )