@blocklet/payment-react 1.14.27 → 1.14.29
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.
- package/es/checkout/form.js +3 -3
- package/es/checkout/table.js +11 -3
- package/es/components/livemode.js +1 -1
- package/es/components/pricing-table.js +55 -14
- package/es/components/table.js +1 -1
- package/es/history/invoice/list.js +12 -10
- package/es/libs/util.d.ts +1 -0
- package/es/libs/util.js +6 -0
- package/es/locales/en.js +4 -3
- package/es/locales/zh.js +6 -5
- package/es/payment/form/address.js +1 -1
- package/es/payment/index.d.ts +1 -1
- package/es/payment/index.js +4 -1
- package/es/payment/product-card.js +2 -2
- package/es/payment/skeleton/overview.js +3 -6
- package/es/payment/skeleton/payment.js +8 -7
- package/lib/checkout/form.js +3 -3
- package/lib/checkout/table.js +12 -2
- package/lib/components/livemode.js +1 -1
- package/lib/components/pricing-table.js +90 -41
- package/lib/components/table.js +1 -1
- package/lib/history/invoice/list.js +10 -8
- package/lib/libs/util.d.ts +1 -0
- package/lib/libs/util.js +7 -0
- package/lib/locales/en.js +4 -3
- package/lib/locales/zh.js +6 -5
- package/lib/payment/form/address.js +4 -0
- package/lib/payment/index.d.ts +1 -1
- package/lib/payment/index.js +8 -1
- package/lib/payment/product-card.js +2 -2
- package/lib/payment/skeleton/overview.js +9 -14
- package/lib/payment/skeleton/payment.js +17 -9
- package/package.json +3 -3
- package/src/checkout/form.tsx +3 -3
- package/src/checkout/table.tsx +11 -3
- package/src/components/livemode.tsx +1 -1
- package/src/components/pricing-table.tsx +103 -48
- package/src/components/table.tsx +1 -1
- package/src/history/invoice/list.tsx +11 -10
- package/src/libs/util.ts +7 -0
- package/src/locales/en.tsx +4 -2
- package/src/locales/zh.tsx +5 -4
- package/src/payment/form/address.tsx +1 -1
- package/src/payment/index.tsx +4 -1
- package/src/payment/product-card.tsx +2 -2
- package/src/payment/skeleton/overview.tsx +1 -2
- package/src/payment/skeleton/payment.tsx +10 -11
package/es/checkout/form.js
CHANGED
|
@@ -70,7 +70,7 @@ export default function CheckoutForm({
|
|
|
70
70
|
paymentLink: data?.paymentLink,
|
|
71
71
|
customer: data?.customer,
|
|
72
72
|
completed: state.completed,
|
|
73
|
-
error: apiError
|
|
73
|
+
error: apiError,
|
|
74
74
|
onPaid: handlePaid,
|
|
75
75
|
onError: handleError,
|
|
76
76
|
onChange,
|
|
@@ -91,7 +91,7 @@ export default function CheckoutForm({
|
|
|
91
91
|
paymentLink: data?.paymentLink,
|
|
92
92
|
customer: data?.customer,
|
|
93
93
|
completed: state.completed,
|
|
94
|
-
error: apiError
|
|
94
|
+
error: apiError,
|
|
95
95
|
onPaid: handlePaid,
|
|
96
96
|
onError: handleError,
|
|
97
97
|
onChange,
|
|
@@ -111,7 +111,7 @@ export default function CheckoutForm({
|
|
|
111
111
|
paymentLink: data?.paymentLink,
|
|
112
112
|
customer: data?.customer,
|
|
113
113
|
completed: state.completed,
|
|
114
|
-
error: apiError
|
|
114
|
+
error: apiError,
|
|
115
115
|
onPaid: handlePaid,
|
|
116
116
|
onError: handleError,
|
|
117
117
|
onChange,
|
package/es/checkout/table.js
CHANGED
|
@@ -65,7 +65,7 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
|
|
|
65
65
|
}
|
|
66
66
|
if (!sessionId && !hashSessionId) {
|
|
67
67
|
if (mode === "standalone") {
|
|
68
|
-
return /* @__PURE__ */ jsxs(Stack, { direction: "column", alignItems: "center", children: [
|
|
68
|
+
return /* @__PURE__ */ jsxs(Stack, { direction: "column", alignItems: "center", p: 2.5, children: [
|
|
69
69
|
/* @__PURE__ */ jsxs(
|
|
70
70
|
Box,
|
|
71
71
|
{
|
|
@@ -73,11 +73,19 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
|
|
|
73
73
|
display: "flex",
|
|
74
74
|
flexDirection: "column",
|
|
75
75
|
fontSize: "24px",
|
|
76
|
-
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
margin: {
|
|
78
|
+
xs: "20px 0",
|
|
79
|
+
md: "20px 20px"
|
|
80
|
+
},
|
|
81
|
+
maxWidth: {
|
|
82
|
+
xs: "100%",
|
|
83
|
+
md: 400
|
|
84
|
+
},
|
|
77
85
|
textAlign: "center"
|
|
78
86
|
},
|
|
79
87
|
children: [
|
|
80
|
-
!data.livemode && /* @__PURE__ */ jsx(Livemode, { sx: { display: "flex", marginBottom: "8px" } }),
|
|
88
|
+
!data.livemode && /* @__PURE__ */ jsx(Livemode, { sx: { display: "flex", marginBottom: "8px", width: "fit-content" } }),
|
|
81
89
|
/* @__PURE__ */ jsx(
|
|
82
90
|
Typography,
|
|
83
91
|
{
|
|
@@ -21,6 +21,7 @@ import { styled } from "@mui/system";
|
|
|
21
21
|
import { useSetState } from "ahooks";
|
|
22
22
|
import { useEffect, useMemo, useState } from "react";
|
|
23
23
|
import { BN } from "@ocap/util";
|
|
24
|
+
import { isEmpty } from "lodash";
|
|
24
25
|
import { usePaymentContext } from "../contexts/payment.js";
|
|
25
26
|
import {
|
|
26
27
|
formatError,
|
|
@@ -30,12 +31,19 @@ import {
|
|
|
30
31
|
getPriceUintAmountByCurrency
|
|
31
32
|
} from "../libs/util.js";
|
|
32
33
|
import Amount from "../payment/amount.js";
|
|
34
|
+
import { useMobile } from "../hooks/mobile.js";
|
|
35
|
+
const sortOrder = {
|
|
36
|
+
year: 1,
|
|
37
|
+
month: 2,
|
|
38
|
+
day: 3,
|
|
39
|
+
hour: 4
|
|
40
|
+
};
|
|
33
41
|
const groupItemsByRecurring = (items, currency) => {
|
|
34
42
|
const grouped = {};
|
|
35
43
|
const recurring = {};
|
|
36
44
|
items.forEach((x) => {
|
|
37
45
|
const key = [x.price.recurring?.interval, x.price.recurring?.interval_count].join("-");
|
|
38
|
-
if (x.price.currency_options
|
|
46
|
+
if (x.price.currency_options?.find((c) => c.currency_id === currency.id)) {
|
|
39
47
|
recurring[key] = x.price.recurring;
|
|
40
48
|
}
|
|
41
49
|
if (!grouped[key]) {
|
|
@@ -52,11 +60,28 @@ PricingTable.defaultProps = {
|
|
|
52
60
|
};
|
|
53
61
|
export default function PricingTable({ table, alignItems, interval, mode, onSelect }) {
|
|
54
62
|
const { t, locale } = useLocaleContext();
|
|
63
|
+
const { isMobile } = useMobile();
|
|
55
64
|
const {
|
|
56
65
|
settings: { paymentMethods = [] }
|
|
57
66
|
} = usePaymentContext();
|
|
58
67
|
const [currency, setCurrency] = useState(table.currency || {});
|
|
59
68
|
const { recurring, grouped } = useMemo(() => groupItemsByRecurring(table.items, currency), [table.items, currency]);
|
|
69
|
+
const recurringKeysList = useMemo(() => {
|
|
70
|
+
if (isEmpty(recurring)) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
return Object.keys(recurring).sort((a, b) => {
|
|
74
|
+
const [aType, aValue] = a.split("-");
|
|
75
|
+
const [bType, bValue] = b.split("-");
|
|
76
|
+
if (sortOrder[aType] !== sortOrder[bType]) {
|
|
77
|
+
return sortOrder[aType] - sortOrder[bType];
|
|
78
|
+
}
|
|
79
|
+
if (aValue && bValue) {
|
|
80
|
+
return bValue - aValue;
|
|
81
|
+
}
|
|
82
|
+
return b - a;
|
|
83
|
+
});
|
|
84
|
+
}, [recurring]);
|
|
60
85
|
const [state, setState] = useSetState({ interval });
|
|
61
86
|
const currencyMap = useMemo(() => {
|
|
62
87
|
if (!paymentMethods || paymentMethods.length === 0) {
|
|
@@ -114,12 +139,12 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
114
139
|
gap: 20px;
|
|
115
140
|
}
|
|
116
141
|
@media (max-width: ${({ theme }) => theme.breakpoints.values.sm}px) {
|
|
117
|
-
.price-table-item {
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
.btn-row {
|
|
121
|
-
|
|
122
|
-
}
|
|
142
|
+
// .price-table-item {
|
|
143
|
+
// width: 90% !important;
|
|
144
|
+
// }
|
|
145
|
+
// .btn-row {
|
|
146
|
+
// padding: 0 20px;
|
|
147
|
+
// }
|
|
123
148
|
}
|
|
124
149
|
@media (min-width: ${({ theme }) => theme.breakpoints.values.md}px) {
|
|
125
150
|
.price-table-wrap:has(> div:nth-child(1)) {
|
|
@@ -145,8 +170,17 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
145
170
|
}
|
|
146
171
|
},
|
|
147
172
|
children: [
|
|
148
|
-
/* @__PURE__ */ jsxs(
|
|
149
|
-
|
|
173
|
+
/* @__PURE__ */ jsxs(Stack, { className: "btn-row", flexDirection: "row", children: [
|
|
174
|
+
recurringKeysList.length > 0 && /* @__PURE__ */ jsx(Box, { children: isMobile && recurringKeysList.length > 1 ? /* @__PURE__ */ jsx(
|
|
175
|
+
Select,
|
|
176
|
+
{
|
|
177
|
+
value: state.interval,
|
|
178
|
+
onChange: (e) => setState({ interval: e.target.value }),
|
|
179
|
+
size: "small",
|
|
180
|
+
sx: { m: 1 },
|
|
181
|
+
children: recurringKeysList.map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x, children: /* @__PURE__ */ jsx(Typography, { color: x === state.interval ? "text.primary" : "text.secondary", children: formatRecurring(recurring[x], true, "", locale) }) }, x))
|
|
182
|
+
}
|
|
183
|
+
) : /* @__PURE__ */ jsx(
|
|
150
184
|
ToggleButtonGroup,
|
|
151
185
|
{
|
|
152
186
|
size: "small",
|
|
@@ -165,7 +199,7 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
165
199
|
}
|
|
166
200
|
},
|
|
167
201
|
exclusive: true,
|
|
168
|
-
children:
|
|
202
|
+
children: recurringKeysList.map((x) => /* @__PURE__ */ jsx(
|
|
169
203
|
ToggleButton,
|
|
170
204
|
{
|
|
171
205
|
size: "small",
|
|
@@ -186,7 +220,7 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
186
220
|
x
|
|
187
221
|
))
|
|
188
222
|
}
|
|
189
|
-
),
|
|
223
|
+
) }),
|
|
190
224
|
currencyList.length > 0 && /* @__PURE__ */ jsx(
|
|
191
225
|
Select,
|
|
192
226
|
{
|
|
@@ -232,7 +266,10 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
232
266
|
borderColor: mode === "select" && x.is_selected ? "primary.main" : "#ddd",
|
|
233
267
|
boxShadow: "0 8px 16px rgba(0, 0, 0, 20%)"
|
|
234
268
|
},
|
|
235
|
-
width:
|
|
269
|
+
width: {
|
|
270
|
+
xs: "100%",
|
|
271
|
+
md: "320px"
|
|
272
|
+
},
|
|
236
273
|
maxWidth: "360px",
|
|
237
274
|
padding: "20px",
|
|
238
275
|
position: "relative"
|
|
@@ -366,8 +403,12 @@ function Subscribe({ x, action, onSelect, currencyId }) {
|
|
|
366
403
|
fullWidth: true,
|
|
367
404
|
size: "medium",
|
|
368
405
|
variant: "contained",
|
|
369
|
-
color: x.is_highlight || x.is_selected ? "
|
|
370
|
-
sx: {
|
|
406
|
+
color: x.is_highlight || x.is_selected ? "info" : "primary",
|
|
407
|
+
sx: {
|
|
408
|
+
fontSize: "16px",
|
|
409
|
+
padding: "10px 20px",
|
|
410
|
+
lineHeight: "28px"
|
|
411
|
+
},
|
|
371
412
|
loading: state.loading === x.price_id && !state.loaded,
|
|
372
413
|
disabled: x.is_disabled,
|
|
373
414
|
onClick: () => handleSelect(x.price_id),
|
package/es/components/table.js
CHANGED
|
@@ -83,7 +83,7 @@ const Wrapped = styled(Datatable)`
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
tr.MuiTableRow-root:not(.MuiTableRow-footer):hover {
|
|
86
|
-
background: #
|
|
86
|
+
background: var(--backgrounds-bg-highlight, #eff6ff);
|
|
87
87
|
}
|
|
88
88
|
tr.MuiTableRow-root:last-of-type td:first-of-type {
|
|
89
89
|
border-bottom-left-radius: 8px;
|
|
@@ -94,28 +94,30 @@ const InvoiceTable = React.memo((props) => {
|
|
|
94
94
|
);
|
|
95
95
|
const columns = [
|
|
96
96
|
{
|
|
97
|
-
label: t("
|
|
98
|
-
name: "
|
|
97
|
+
label: t("common.amount"),
|
|
98
|
+
name: "total",
|
|
99
|
+
width: 60,
|
|
100
|
+
align: "right",
|
|
99
101
|
options: {
|
|
100
102
|
customBodyRenderLite: (_, index) => {
|
|
101
103
|
const invoice = data?.list[index];
|
|
102
104
|
const link = getInvoiceLink(invoice, action);
|
|
103
|
-
return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children:
|
|
105
|
+
return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children: /* @__PURE__ */ jsxs(Typography, { children: [
|
|
106
|
+
formatBNStr(invoice.total, invoice.paymentCurrency.decimal),
|
|
107
|
+
"\xA0",
|
|
108
|
+
invoice.paymentCurrency.symbol
|
|
109
|
+
] }) });
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
},
|
|
107
113
|
{
|
|
108
|
-
label: t("
|
|
109
|
-
name: "
|
|
114
|
+
label: t("payment.customer.invoice.invoiceNumber"),
|
|
115
|
+
name: "number",
|
|
110
116
|
options: {
|
|
111
117
|
customBodyRenderLite: (_, index) => {
|
|
112
118
|
const invoice = data?.list[index];
|
|
113
119
|
const link = getInvoiceLink(invoice, action);
|
|
114
|
-
return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children:
|
|
115
|
-
formatBNStr(invoice.total, invoice.paymentCurrency.decimal),
|
|
116
|
-
"\xA0",
|
|
117
|
-
invoice.paymentCurrency.symbol
|
|
118
|
-
] }) });
|
|
120
|
+
return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children: invoice?.number });
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
},
|
package/es/libs/util.d.ts
CHANGED
|
@@ -104,3 +104,4 @@ export declare function formatTotalPrice({ product, quantity, priceId, locale, }
|
|
|
104
104
|
export declare function formatQuantityInventory(price: TPrice, quantity: string | number, locale?: string): string;
|
|
105
105
|
export declare function formatSubscriptionStatus(status: string): string;
|
|
106
106
|
export declare function formatAmountPrecisionLimit(amount: string, locale?: string, precision?: number): string;
|
|
107
|
+
export declare function getWordBreakStyle(value: any): 'break-word' | 'break-all';
|
package/es/libs/util.js
CHANGED
|
@@ -799,3 +799,9 @@ export function formatAmountPrecisionLimit(amount, locale = "en", precision = 6)
|
|
|
799
799
|
}
|
|
800
800
|
return "";
|
|
801
801
|
}
|
|
802
|
+
export function getWordBreakStyle(value) {
|
|
803
|
+
if (typeof value === "string" && /\s/.test(value)) {
|
|
804
|
+
return "break-word";
|
|
805
|
+
}
|
|
806
|
+
return "break-all";
|
|
807
|
+
}
|
package/es/locales/en.js
CHANGED
|
@@ -87,7 +87,8 @@ export default flat({
|
|
|
87
87
|
recoverFrom: "Recovered From",
|
|
88
88
|
quantityLimitPerCheckout: "Exceed purchase limit",
|
|
89
89
|
quantityNotEnough: "Exceed inventory",
|
|
90
|
-
amountPrecisionLimit: "Amount decimal places must be less than or equal to {precision}"
|
|
90
|
+
amountPrecisionLimit: "Amount decimal places must be less than or equal to {precision}",
|
|
91
|
+
saveAsDefaultPriceSuccess: "Set default price successfully"
|
|
91
92
|
},
|
|
92
93
|
payment: {
|
|
93
94
|
checkout: {
|
|
@@ -193,7 +194,7 @@ export default flat({
|
|
|
193
194
|
invoices: "Invoice History",
|
|
194
195
|
details: "Details",
|
|
195
196
|
summary: "Summary",
|
|
196
|
-
|
|
197
|
+
products: "Products",
|
|
197
198
|
update: "Update Information",
|
|
198
199
|
empty: "Seems you do not have any subscriptions or payments here",
|
|
199
200
|
cancel: {
|
|
@@ -226,7 +227,7 @@ export default flat({
|
|
|
226
227
|
recover: {
|
|
227
228
|
button: "Renew",
|
|
228
229
|
title: "Renew your subscription",
|
|
229
|
-
description: "Your subscription will
|
|
230
|
+
description: "Your subscription will not be canceled and will be automatically renewed on {date}, please confirm to continue"
|
|
230
231
|
},
|
|
231
232
|
changePlan: {
|
|
232
233
|
button: "Update",
|
package/es/locales/zh.js
CHANGED
|
@@ -87,7 +87,8 @@ export default flat({
|
|
|
87
87
|
recoverFrom: "\u6062\u590D\u81EA",
|
|
88
88
|
quantityLimitPerCheckout: "\u8D85\u51FA\u8D2D\u4E70\u9650\u5236",
|
|
89
89
|
quantityNotEnough: "\u5E93\u5B58\u4E0D\u8DB3",
|
|
90
|
-
amountPrecisionLimit: "\u91D1\u989D\u5C0F\u6570\u4F4D\u6570\u5FC5\u987B\u5728 {precision} \u4F4D\u4EE5\u5185"
|
|
90
|
+
amountPrecisionLimit: "\u91D1\u989D\u5C0F\u6570\u4F4D\u6570\u5FC5\u987B\u5728 {precision} \u4F4D\u4EE5\u5185",
|
|
91
|
+
saveAsDefaultPriceSuccess: "\u8BBE\u7F6E\u9ED8\u8BA4\u4EF7\u683C\u6210\u529F"
|
|
91
92
|
},
|
|
92
93
|
payment: {
|
|
93
94
|
checkout: {
|
|
@@ -110,9 +111,9 @@ export default flat({
|
|
|
110
111
|
subscription: "\u67E5\u770B\u8BA2\u9605",
|
|
111
112
|
invoice: "\u67E5\u770B\u8D26\u5355"
|
|
112
113
|
},
|
|
113
|
-
paymentRequired: "\u652F\u4ED8\
|
|
114
|
+
paymentRequired: "\u652F\u4ED8\u91D1\u989D",
|
|
114
115
|
staking: {
|
|
115
|
-
title: "\u8D28\u62BC\
|
|
116
|
+
title: "\u8D28\u62BC\u91D1\u989D",
|
|
116
117
|
tooltip: "\u8D28\u62BC\u76F8\u5F53\u4E8E\u4FDD\u8BC1\u91D1\uFF0C\u7528\u4E8E\u786E\u4FDD\u672A\u6765\u7684\u8D26\u5355\u80FD\u591F\u6B63\u5E38\u6263\u6B3E\uFF0C\u5982\u679C\u4F60\u4ECE DID Wallet \u64A4\u9500\u8D28\u62BC\uFF0C\u8BA2\u9605\u4E5F\u4F1A\u88AB\u53D6\u6D88\u3002"
|
|
117
118
|
},
|
|
118
119
|
stakingConfirm: "\u5728\u6B64\u652F\u4ED8\u4E2D\uFF0C\u8D28\u62BC\u91D1\u989D\u4E0E\u4EA7\u54C1\u8D39\u7528\u5206\u5F00",
|
|
@@ -193,7 +194,7 @@ export default flat({
|
|
|
193
194
|
invoices: "\u8D26\u5355\u5386\u53F2",
|
|
194
195
|
details: "\u8D26\u6237\u8BE6\u60C5",
|
|
195
196
|
summary: "\u8BA1\u8D39\u6458\u8981",
|
|
196
|
-
|
|
197
|
+
products: "\u4EA7\u54C1\u4FE1\u606F",
|
|
197
198
|
update: "\u66F4\u65B0\u5BA2\u6237\u4FE1\u606F",
|
|
198
199
|
empty: "\u770B\u8D77\u6765\u60A8\u5728\u8FD9\u91CC\u6CA1\u6709\u4EFB\u4F55\u8BA2\u9605\u6216\u652F\u4ED8",
|
|
199
200
|
cancel: {
|
|
@@ -226,7 +227,7 @@ export default flat({
|
|
|
226
227
|
recover: {
|
|
227
228
|
button: "\u7EED\u8BA2",
|
|
228
229
|
title: "\u7EED\u8BA2\u60A8\u7684\u8BA2\u9605",
|
|
229
|
-
description: "\u60A8\u7684\u8BA2\u9605\u5C06\u4E0D\
|
|
230
|
+
description: "\u60A8\u7684\u8BA2\u9605\u5C06\u4E0D\u4F1A\u88AB\u53D6\u6D88\uFF0C\u5E76\u5C06\u5728{date}\u81EA\u52A8\u7EED\u8BA2\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u7EE7\u7EED"
|
|
230
231
|
},
|
|
231
232
|
changePlan: {
|
|
232
233
|
button: "\u66F4\u65B0",
|
|
@@ -23,7 +23,7 @@ export default function AddressForm({ mode, stripe, sx = {} }) {
|
|
|
23
23
|
variant: "outlined",
|
|
24
24
|
placeholder: t("payment.checkout.billing.postal_code"),
|
|
25
25
|
InputProps: {
|
|
26
|
-
startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx(
|
|
26
|
+
startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", style: { marginRight: "2px", marginLeft: "-8px" }, children: /* @__PURE__ */ jsx(
|
|
27
27
|
Controller,
|
|
28
28
|
{
|
|
29
29
|
name: "billing_address.country",
|
package/es/payment/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type Props = CheckoutContext & CheckoutCallbacks & {
|
|
|
6
6
|
error?: any;
|
|
7
7
|
showCheckoutSummary?: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, }: Props): import("react").JSX.Element;
|
|
9
|
+
declare function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, error, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, }: Props): import("react").JSX.Element;
|
|
10
10
|
declare namespace Payment {
|
|
11
11
|
var defaultProps: {
|
|
12
12
|
completed: boolean;
|
package/es/payment/index.js
CHANGED
|
@@ -209,7 +209,7 @@ export default function Payment({
|
|
|
209
209
|
paymentLink,
|
|
210
210
|
customer,
|
|
211
211
|
completed,
|
|
212
|
-
|
|
212
|
+
error,
|
|
213
213
|
mode,
|
|
214
214
|
onPaid,
|
|
215
215
|
onError,
|
|
@@ -238,6 +238,9 @@ export default function Payment({
|
|
|
238
238
|
}
|
|
239
239
|
}, [checkoutSession, livemode, setLivemode, refresh]);
|
|
240
240
|
const renderContent = () => {
|
|
241
|
+
if (error) {
|
|
242
|
+
return /* @__PURE__ */ jsx(PaymentError, { mode, title: "Oops", description: formatError(error) });
|
|
243
|
+
}
|
|
241
244
|
if (!checkoutSession || !delay) {
|
|
242
245
|
return /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: [
|
|
243
246
|
!hideSummaryCard && /* @__PURE__ */ jsx(Stack, { className: "base-card cko-overview", children: /* @__PURE__ */ jsx(Box, { className: "cko-product", children: /* @__PURE__ */ jsx(OverviewSkeleton, {}) }) }),
|
|
@@ -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, fontSize: 16 },
|
|
27
|
+
sx: { fontWeight: 500, mb: 0.5, lineHeight: 1.2, fontSize: 16 },
|
|
28
28
|
color: "text.primary",
|
|
29
29
|
children: name
|
|
30
30
|
}
|
|
@@ -34,7 +34,7 @@ export default function ProductCard({ size, variant, name, logo, description, ex
|
|
|
34
34
|
{
|
|
35
35
|
variant: "body1",
|
|
36
36
|
title: description,
|
|
37
|
-
sx: { fontSize: "0.85rem", mb: 0.5, lineHeight: 1, textAlign: "left" },
|
|
37
|
+
sx: { fontSize: "0.85rem", mb: 0.5, lineHeight: 1.2, textAlign: "left" },
|
|
38
38
|
color: "text.lighter",
|
|
39
39
|
children: description
|
|
40
40
|
}
|
|
@@ -2,12 +2,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Fade, Skeleton, Stack, Typography } from "@mui/material";
|
|
3
3
|
export default function OverviewSkeleton() {
|
|
4
4
|
return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { direction: "column", children: [
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
|
|
7
|
-
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "2rem", width: "40%" } })
|
|
8
|
-
] }),
|
|
5
|
+
/* @__PURE__ */ jsx(Stack, { direction: "row", alignItems: "center", spacing: 2, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "2rem", width: "40%" } }) }),
|
|
6
|
+
/* @__PURE__ */ jsx(Skeleton, { sx: { mt: 2 }, variant: "rounded", height: 100 }),
|
|
9
7
|
/* @__PURE__ */ jsx(Typography, { mt: 2, component: "div", variant: "h4", children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
10
|
-
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h2", children: /* @__PURE__ */ jsx(Skeleton, {}) })
|
|
11
|
-
/* @__PURE__ */ jsx(Skeleton, { sx: { mt: 2 }, variant: "rounded", width: 200, height: 200 })
|
|
8
|
+
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h2", children: /* @__PURE__ */ jsx(Skeleton, {}) })
|
|
12
9
|
] }) });
|
|
13
10
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Fade, Skeleton, Stack, Typography } from "@mui/material";
|
|
3
3
|
export default function PaymentSkeleton() {
|
|
4
|
-
return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { direction: "column",
|
|
4
|
+
return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { direction: "column", children: [
|
|
5
5
|
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "2rem", width: "40%" } }),
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
|
|
8
|
-
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "
|
|
6
|
+
/* @__PURE__ */ jsx(Skeleton, { sx: { mt: 2 }, variant: "rounded", height: 68 }),
|
|
7
|
+
/* @__PURE__ */ jsxs(Box, { mt: 1, children: [
|
|
8
|
+
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h4", mb: -1, children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
9
|
+
/* @__PURE__ */ jsx(Typography, { component: "div", children: /* @__PURE__ */ jsx(Skeleton, { height: 60 }) })
|
|
9
10
|
] }),
|
|
10
11
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
11
|
-
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h4", children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
12
|
-
/* @__PURE__ */ jsx(Typography, { component: "div",
|
|
12
|
+
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h4", mb: -1, children: /* @__PURE__ */ jsx(Skeleton, {}) }),
|
|
13
|
+
/* @__PURE__ */ jsx(Typography, { component: "div", children: /* @__PURE__ */ jsx(Skeleton, { height: 60 }) })
|
|
13
14
|
] }),
|
|
14
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
15
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Skeleton, { height: 60 }) })
|
|
15
16
|
] }) });
|
|
16
17
|
}
|
package/lib/checkout/form.js
CHANGED
|
@@ -81,7 +81,7 @@ function CheckoutForm({
|
|
|
81
81
|
paymentLink: data?.paymentLink,
|
|
82
82
|
customer: data?.customer,
|
|
83
83
|
completed: state.completed,
|
|
84
|
-
error: apiError
|
|
84
|
+
error: apiError,
|
|
85
85
|
onPaid: handlePaid,
|
|
86
86
|
onError: handleError,
|
|
87
87
|
onChange,
|
|
@@ -101,7 +101,7 @@ function CheckoutForm({
|
|
|
101
101
|
paymentLink: data?.paymentLink,
|
|
102
102
|
customer: data?.customer,
|
|
103
103
|
completed: state.completed,
|
|
104
|
-
error: apiError
|
|
104
|
+
error: apiError,
|
|
105
105
|
onPaid: handlePaid,
|
|
106
106
|
onError: handleError,
|
|
107
107
|
onChange,
|
|
@@ -120,7 +120,7 @@ function CheckoutForm({
|
|
|
120
120
|
paymentLink: data?.paymentLink,
|
|
121
121
|
customer: data?.customer,
|
|
122
122
|
completed: state.completed,
|
|
123
|
-
error: apiError
|
|
123
|
+
error: apiError,
|
|
124
124
|
onPaid: handlePaid,
|
|
125
125
|
onError: handleError,
|
|
126
126
|
onChange,
|
package/lib/checkout/table.js
CHANGED
|
@@ -99,18 +99,28 @@ function CheckoutTableInner({
|
|
|
99
99
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
100
100
|
direction: "column",
|
|
101
101
|
alignItems: "center",
|
|
102
|
+
p: 2.5,
|
|
102
103
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_system.Box, {
|
|
103
104
|
sx: {
|
|
104
105
|
display: "flex",
|
|
105
106
|
flexDirection: "column",
|
|
106
107
|
fontSize: "24px",
|
|
107
|
-
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
margin: {
|
|
110
|
+
xs: "20px 0",
|
|
111
|
+
md: "20px 20px"
|
|
112
|
+
},
|
|
113
|
+
maxWidth: {
|
|
114
|
+
xs: "100%",
|
|
115
|
+
md: 400
|
|
116
|
+
},
|
|
108
117
|
textAlign: "center"
|
|
109
118
|
},
|
|
110
119
|
children: [!data.livemode && /* @__PURE__ */(0, _jsxRuntime.jsx)(_livemode.default, {
|
|
111
120
|
sx: {
|
|
112
121
|
display: "flex",
|
|
113
|
-
marginBottom: "8px"
|
|
122
|
+
marginBottom: "8px",
|
|
123
|
+
width: "fit-content"
|
|
114
124
|
}
|
|
115
125
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
116
126
|
color: "text.primary",
|