@blocklet/payment-react 1.18.56 → 1.19.1
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/donate.d.ts +1 -15
- package/es/checkout/donate.js +301 -189
- package/es/checkout/form.d.ts +1 -15
- package/es/checkout/form.js +5 -13
- package/es/checkout/table.js +3 -3
- package/es/components/blockchain/gas.d.ts +1 -5
- package/es/components/blockchain/gas.js +10 -2
- package/es/components/blockchain/tx.d.ts +1 -8
- package/es/components/blockchain/tx.js +29 -10
- package/es/components/confirm.d.ts +1 -10
- package/es/components/confirm.js +4 -10
- package/es/components/country-select.d.ts +3 -2
- package/es/components/country-select.js +375 -352
- package/es/components/date-range-picker.d.ts +13 -0
- package/es/components/date-range-picker.js +279 -0
- package/es/components/input.d.ts +14 -20
- package/es/components/input.js +51 -44
- package/es/components/label.d.ts +7 -0
- package/es/components/label.js +49 -0
- package/es/components/lazy-loader.js +1 -2
- package/es/components/link.d.ts +2 -9
- package/es/components/link.js +9 -6
- package/es/components/livemode.d.ts +2 -8
- package/es/components/livemode.js +1 -5
- package/es/components/loading-button.d.ts +6 -1
- package/es/components/loading-button.js +56 -66
- package/es/components/over-due-invoice-payment.d.ts +0 -18
- package/es/components/over-due-invoice-payment.js +138 -95
- package/es/components/payment-beneficiaries.d.ts +2 -7
- package/es/components/payment-beneficiaries.js +86 -40
- package/es/components/pricing-item.d.ts +0 -5
- package/es/components/pricing-item.js +1 -4
- package/es/components/pricing-table.d.ts +2 -10
- package/es/components/pricing-table.js +8 -7
- package/es/components/resume-subscription.d.ts +0 -10
- package/es/components/resume-subscription.js +42 -21
- package/es/components/truncated-text.d.ts +2 -9
- package/es/components/truncated-text.js +0 -5
- package/es/contexts/donate.d.ts +0 -7
- package/es/contexts/donate.js +10 -8
- package/es/contexts/payment.d.ts +1 -4
- package/es/contexts/payment.js +7 -2
- package/es/history/credit/grants-list.d.ts +14 -0
- package/es/history/credit/grants-list.js +215 -0
- package/es/history/credit/transactions-list.d.ts +13 -0
- package/es/history/credit/transactions-list.js +255 -0
- package/es/history/invoice/list.d.ts +2 -18
- package/es/history/invoice/list.js +172 -74
- package/es/history/payment/list.js +115 -38
- package/es/hooks/keyboard.d.ts +1 -1
- package/es/hooks/keyboard.js +2 -4
- package/es/index.d.ts +5 -1
- package/es/index.js +10 -1
- package/es/libs/cached-request.js +2 -4
- package/es/libs/phone-validator.js +1 -2
- package/es/libs/util.d.ts +2 -0
- package/es/libs/util.js +14 -4
- package/es/libs/validator.js +2 -4
- package/es/locales/en.js +20 -2
- package/es/locales/zh.js +20 -2
- package/es/payment/amount.d.ts +2 -7
- package/es/payment/amount.js +1 -5
- package/es/payment/donation-form.d.ts +2 -10
- package/es/payment/donation-form.js +196 -160
- package/es/payment/error.d.ts +2 -8
- package/es/payment/error.js +40 -20
- package/es/payment/footer.d.ts +2 -3
- package/es/payment/footer.js +19 -6
- package/es/payment/form/addon.js +14 -4
- package/es/payment/form/address.d.ts +2 -9
- package/es/payment/form/address.js +3 -6
- package/es/payment/form/currency.js +45 -25
- package/es/payment/form/index.d.ts +2 -8
- package/es/payment/form/index.js +151 -71
- package/es/payment/form/phone.js +2 -4
- package/es/payment/form/stripe/form.d.ts +2 -8
- package/es/payment/form/stripe/form.js +1 -3
- package/es/payment/header.js +38 -16
- package/es/payment/index.d.ts +2 -9
- package/es/payment/index.js +23 -17
- package/es/payment/product-card.d.ts +2 -11
- package/es/payment/product-card.js +84 -50
- package/es/payment/product-donation.js +175 -114
- package/es/payment/product-item.d.ts +9 -9
- package/es/payment/product-item.js +320 -145
- package/es/payment/product-skeleton.js +2 -2
- package/es/payment/skeleton/donation.js +27 -7
- package/es/payment/skeleton/overview.js +22 -2
- package/es/payment/skeleton/payment.js +33 -5
- package/es/payment/success.d.ts +2 -9
- package/es/payment/success.js +41 -14
- package/es/payment/summary.d.ts +4 -17
- package/es/payment/summary.js +193 -111
- package/es/theme/index.d.ts +0 -5
- package/es/theme/index.js +2 -5
- package/es/theme/typography.d.ts +2 -2
- package/lib/checkout/donate.d.ts +1 -15
- package/lib/checkout/donate.js +75 -54
- package/lib/checkout/form.d.ts +1 -15
- package/lib/checkout/form.js +7 -15
- package/lib/checkout/table.js +4 -4
- package/lib/components/blockchain/gas.d.ts +1 -5
- package/lib/components/blockchain/gas.js +3 -2
- package/lib/components/blockchain/tx.d.ts +1 -8
- package/lib/components/blockchain/tx.js +15 -10
- package/lib/components/confirm.d.ts +1 -10
- package/lib/components/confirm.js +5 -11
- package/lib/components/country-select.d.ts +3 -2
- package/lib/components/country-select.js +23 -22
- package/lib/components/date-range-picker.d.ts +13 -0
- package/lib/components/date-range-picker.js +329 -0
- package/lib/components/input.d.ts +14 -20
- package/lib/components/input.js +28 -27
- package/lib/components/label.d.ts +7 -0
- package/lib/components/label.js +60 -0
- package/lib/components/lazy-loader.js +1 -1
- package/lib/components/link.d.ts +2 -9
- package/lib/components/link.js +3 -8
- package/lib/components/livemode.d.ts +2 -8
- package/lib/components/livemode.js +3 -7
- package/lib/components/loading-button.d.ts +6 -1
- package/lib/components/loading-button.js +9 -17
- package/lib/components/over-due-invoice-payment.d.ts +0 -18
- package/lib/components/over-due-invoice-payment.js +31 -33
- package/lib/components/payment-beneficiaries.d.ts +2 -7
- package/lib/components/payment-beneficiaries.js +12 -11
- package/lib/components/pricing-item.d.ts +0 -5
- package/lib/components/pricing-item.js +2 -5
- package/lib/components/pricing-table.d.ts +2 -10
- package/lib/components/pricing-table.js +5 -11
- package/lib/components/resume-subscription.d.ts +0 -10
- package/lib/components/resume-subscription.js +16 -16
- package/lib/components/table.js +1 -1
- package/lib/components/truncated-text.d.ts +2 -9
- package/lib/components/truncated-text.js +1 -6
- package/lib/contexts/donate.d.ts +0 -7
- package/lib/contexts/donate.js +4 -7
- package/lib/contexts/payment.d.ts +1 -4
- package/lib/contexts/payment.js +4 -7
- package/lib/history/credit/grants-list.d.ts +14 -0
- package/lib/history/credit/grants-list.js +277 -0
- package/lib/history/credit/transactions-list.d.ts +13 -0
- package/lib/history/credit/transactions-list.js +301 -0
- package/lib/history/invoice/list.d.ts +2 -18
- package/lib/history/invoice/list.js +73 -37
- package/lib/history/payment/list.js +30 -16
- package/lib/hooks/keyboard.d.ts +1 -1
- package/lib/hooks/mobile.js +1 -1
- package/lib/hooks/subscription.js +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.js +41 -2
- package/lib/libs/api.js +1 -1
- package/lib/libs/dayjs.js +1 -1
- package/lib/libs/phone-validator.js +0 -2
- package/lib/libs/theme.js +1 -1
- package/lib/libs/util.d.ts +2 -0
- package/lib/libs/util.js +15 -1
- package/lib/libs/validator.js +1 -1
- package/lib/locales/en.js +21 -3
- package/lib/locales/index.js +1 -1
- package/lib/locales/zh.js +21 -3
- package/lib/payment/amount.d.ts +2 -7
- package/lib/payment/amount.js +2 -6
- package/lib/payment/donation-form.d.ts +2 -10
- package/lib/payment/donation-form.js +33 -38
- package/lib/payment/error.d.ts +2 -8
- package/lib/payment/error.js +11 -13
- package/lib/payment/footer.d.ts +2 -3
- package/lib/payment/footer.js +5 -5
- package/lib/payment/form/addon.js +5 -3
- package/lib/payment/form/address.d.ts +2 -9
- package/lib/payment/form/address.js +5 -8
- package/lib/payment/form/currency.js +3 -3
- package/lib/payment/form/index.d.ts +2 -8
- package/lib/payment/form/index.js +64 -21
- package/lib/payment/form/phone.js +1 -1
- package/lib/payment/form/stripe/form.d.ts +2 -8
- package/lib/payment/form/stripe/form.js +3 -6
- package/lib/payment/header.js +8 -4
- package/lib/payment/index.d.ts +2 -9
- package/lib/payment/index.js +27 -18
- package/lib/payment/product-card.d.ts +2 -11
- package/lib/payment/product-card.js +13 -20
- package/lib/payment/product-donation.js +71 -66
- package/lib/payment/product-item.d.ts +9 -9
- package/lib/payment/product-item.js +168 -29
- package/lib/payment/product-skeleton.js +2 -2
- package/lib/payment/skeleton/donation.js +8 -4
- package/lib/payment/skeleton/overview.js +6 -2
- package/lib/payment/skeleton/payment.js +9 -3
- package/lib/payment/success.d.ts +2 -9
- package/lib/payment/success.js +12 -15
- package/lib/payment/summary.d.ts +4 -17
- package/lib/payment/summary.js +53 -45
- package/lib/theme/index.d.ts +0 -5
- package/lib/theme/index.js +2 -5
- package/lib/theme/typography.d.ts +2 -2
- package/package.json +40 -40
- package/src/checkout/donate.tsx +103 -35
- package/src/checkout/form.tsx +5 -14
- package/src/checkout/table.tsx +3 -3
- package/src/components/blockchain/gas.tsx +5 -3
- package/src/components/blockchain/tx.tsx +19 -11
- package/src/components/confirm.tsx +4 -11
- package/src/components/country-select.tsx +391 -378
- package/src/components/date-range-picker.tsx +310 -0
- package/src/components/input.tsx +61 -46
- package/src/components/label.tsx +58 -0
- package/src/components/link.tsx +9 -7
- package/src/components/livemode.tsx +2 -6
- package/src/components/loading-button.tsx +63 -76
- package/src/components/over-due-invoice-payment.tsx +43 -28
- package/src/components/payment-beneficiaries.tsx +33 -14
- package/src/components/pricing-item.tsx +1 -4
- package/src/components/pricing-table.tsx +8 -8
- package/src/components/resume-subscription.tsx +20 -14
- package/src/components/table.tsx +2 -2
- package/src/components/truncated-text.tsx +0 -6
- package/src/contexts/donate.tsx +6 -7
- package/src/contexts/payment.tsx +7 -3
- package/src/history/credit/grants-list.tsx +276 -0
- package/src/history/credit/transactions-list.tsx +317 -0
- package/src/history/invoice/list.tsx +92 -36
- package/src/history/payment/list.tsx +53 -16
- package/src/hooks/keyboard.ts +1 -1
- package/src/index.ts +9 -0
- package/src/libs/util.ts +14 -0
- package/src/locales/en.tsx +20 -0
- package/src/locales/zh.tsx +19 -0
- package/src/payment/amount.tsx +1 -6
- package/src/payment/donation-form.tsx +47 -29
- package/src/payment/error.tsx +16 -8
- package/src/payment/footer.tsx +11 -3
- package/src/payment/form/addon.tsx +6 -1
- package/src/payment/form/address.tsx +3 -7
- package/src/payment/form/currency.tsx +12 -2
- package/src/payment/form/index.tsx +121 -45
- package/src/payment/form/stripe/form.tsx +1 -5
- package/src/payment/header.tsx +14 -2
- package/src/payment/index.tsx +27 -22
- package/src/payment/product-card.tsx +41 -18
- package/src/payment/product-donation.tsx +85 -47
- package/src/payment/product-item.tsx +198 -28
- package/src/payment/product-skeleton.tsx +3 -2
- package/src/payment/skeleton/donation.tsx +12 -2
- package/src/payment/skeleton/overview.tsx +12 -2
- package/src/payment/skeleton/payment.tsx +16 -3
- package/src/payment/success.tsx +26 -15
- package/src/payment/summary.tsx +87 -44
- package/src/theme/index.tsx +5 -8
- package/src/theme/typography.ts +2 -2
|
@@ -7,33 +7,38 @@ module.exports = ProductItem;
|
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
9
9
|
var _material = require("@mui/material");
|
|
10
|
+
var _iconsMaterial = require("@mui/icons-material");
|
|
10
11
|
var _react = require("react");
|
|
11
12
|
var _status = _interopRequireDefault(require("../components/status"));
|
|
12
13
|
var _switchButton = _interopRequireDefault(require("../components/switch-button"));
|
|
13
14
|
var _util = require("../libs/util");
|
|
14
15
|
var _productCard = _interopRequireDefault(require("./product-card"));
|
|
15
16
|
var _dayjs = _interopRequireDefault(require("../libs/dayjs"));
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
mode: "normal",
|
|
19
|
-
children: null,
|
|
20
|
-
trialEnd: 0
|
|
21
|
-
};
|
|
17
|
+
var _payment = require("../contexts/payment");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
19
|
function ProductItem({
|
|
23
20
|
item,
|
|
24
21
|
items,
|
|
25
22
|
trialInDays,
|
|
26
23
|
trialEnd = 0,
|
|
27
24
|
currency,
|
|
28
|
-
mode,
|
|
29
|
-
children,
|
|
25
|
+
mode = "normal",
|
|
26
|
+
children = null,
|
|
30
27
|
onUpsell,
|
|
31
|
-
onDownsell
|
|
28
|
+
onDownsell,
|
|
29
|
+
completed = false,
|
|
30
|
+
adjustableQuantity = {
|
|
31
|
+
enabled: false
|
|
32
|
+
},
|
|
33
|
+
onQuantityChange = () => {}
|
|
32
34
|
}) {
|
|
33
35
|
const {
|
|
34
36
|
t,
|
|
35
37
|
locale
|
|
36
38
|
} = (0, _context.useLocaleContext)();
|
|
39
|
+
const {
|
|
40
|
+
settings
|
|
41
|
+
} = (0, _payment.usePaymentContext)();
|
|
37
42
|
const pricing = (0, _util.formatLineItemPricing)(item, currency, {
|
|
38
43
|
trialEnd,
|
|
39
44
|
trialInDays
|
|
@@ -41,6 +46,65 @@ function ProductItem({
|
|
|
41
46
|
const saving = (0, _util.formatUpsellSaving)(items, currency);
|
|
42
47
|
const metered = item.price?.recurring?.usage_type === "metered" ? t("common.metered") : "";
|
|
43
48
|
const canUpsell = mode === "normal" && items.length === 1;
|
|
49
|
+
const isCreditProduct = item.price.product?.type === "credit" && item.price.metadata?.credit_config?.credit_amount;
|
|
50
|
+
const creditAmount = isCreditProduct ? Number(item.price.metadata.credit_config.credit_amount) : 0;
|
|
51
|
+
const creditCurrency = isCreditProduct ? (0, _util.findCurrency)(settings.paymentMethods, item.price.metadata?.credit_config?.currency_id ?? "") : null;
|
|
52
|
+
const validDuration = item.price.metadata?.credit_config?.valid_duration_value;
|
|
53
|
+
const validDurationUnit = item.price.metadata?.credit_config?.valid_duration_unit || "days";
|
|
54
|
+
const [localQuantity, setLocalQuantity] = (0, _react.useState)(item.quantity);
|
|
55
|
+
const canAdjustQuantity = adjustableQuantity.enabled && mode === "normal";
|
|
56
|
+
const minQuantity = Math.max(adjustableQuantity.minimum || 1, 1);
|
|
57
|
+
const quantityAvailable = Math.min(item.price.quantity_limit_per_checkout, item.price.quantity_available);
|
|
58
|
+
const maxQuantity = Math.min(adjustableQuantity.maximum || 999, quantityAvailable || 999);
|
|
59
|
+
const handleQuantityChange = newQuantity => {
|
|
60
|
+
if (newQuantity >= minQuantity && newQuantity <= maxQuantity) {
|
|
61
|
+
setLocalQuantity(newQuantity);
|
|
62
|
+
if ((0, _util.formatQuantityInventory)(item.price, newQuantity, locale)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
onQuantityChange(item.price_id, newQuantity);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const handleQuantityIncrease = () => {
|
|
69
|
+
if (localQuantity < maxQuantity) {
|
|
70
|
+
handleQuantityChange(localQuantity + 1);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const handleQuantityDecrease = () => {
|
|
74
|
+
if (localQuantity > minQuantity) {
|
|
75
|
+
handleQuantityChange(localQuantity - 1);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const handleQuantityInputChange = event => {
|
|
79
|
+
const value = parseInt(event.target.value, 10);
|
|
80
|
+
if (!Number.isNaN(value)) {
|
|
81
|
+
handleQuantityChange(value);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const formatCreditInfo = () => {
|
|
85
|
+
if (!isCreditProduct) return null;
|
|
86
|
+
const isRecurring = item.price.type === "recurring";
|
|
87
|
+
const totalCredit = creditAmount * localQuantity;
|
|
88
|
+
let message = "";
|
|
89
|
+
if (isRecurring) {
|
|
90
|
+
message = t("payment.checkout.credit.recurringInfo", {
|
|
91
|
+
amount: totalCredit,
|
|
92
|
+
period: (0, _util.formatRecurring)(item.price.recurring, true, "per", locale)
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
message = t("payment.checkout.credit.oneTimeInfo", {
|
|
96
|
+
amount: totalCredit,
|
|
97
|
+
symbol: creditCurrency?.symbol || "Credits"
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (validDuration && validDuration > 0) {
|
|
101
|
+
message += `\uFF0C${t("payment.checkout.credit.expiresIn", {
|
|
102
|
+
duration: validDuration,
|
|
103
|
+
unit: t(`common.${validDurationUnit}`)
|
|
104
|
+
})}`;
|
|
105
|
+
}
|
|
106
|
+
return message;
|
|
107
|
+
};
|
|
44
108
|
const primaryText = (0, _react.useMemo)(() => {
|
|
45
109
|
const price = item.upsell_price || item.price || {};
|
|
46
110
|
const isRecurring = price?.type === "recurring" && price?.recurring;
|
|
@@ -50,44 +114,49 @@ function ProductItem({
|
|
|
50
114
|
}
|
|
51
115
|
return pricing.primary;
|
|
52
116
|
}, [trialInDays, trialEnd, pricing, item, locale]);
|
|
117
|
+
const quantityInventoryError = (0, _util.formatQuantityInventory)(item.price, localQuantity, locale);
|
|
53
118
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
54
119
|
direction: "column",
|
|
55
|
-
alignItems: "flex-start",
|
|
56
120
|
spacing: 1,
|
|
121
|
+
className: "product-item",
|
|
57
122
|
sx: {
|
|
123
|
+
alignItems: "flex-start",
|
|
58
124
|
width: "100%"
|
|
59
125
|
},
|
|
60
|
-
className: "product-item",
|
|
61
126
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
62
127
|
direction: "column",
|
|
63
|
-
|
|
128
|
+
className: "product-item-content",
|
|
64
129
|
sx: {
|
|
130
|
+
alignItems: "flex-start",
|
|
65
131
|
width: "100%"
|
|
66
132
|
},
|
|
67
|
-
className: "product-item-content",
|
|
68
133
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
69
134
|
direction: "row",
|
|
70
|
-
alignItems: "center",
|
|
71
|
-
flexWrap: "wrap",
|
|
72
135
|
spacing: 0.5,
|
|
73
|
-
justifyContent: "space-between",
|
|
74
136
|
sx: {
|
|
137
|
+
alignItems: "center",
|
|
138
|
+
flexWrap: "wrap",
|
|
139
|
+
justifyContent: "space-between",
|
|
75
140
|
width: "100%"
|
|
76
141
|
},
|
|
77
142
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_productCard.default, {
|
|
78
143
|
logo: item.price.product?.images[0],
|
|
79
144
|
name: item.price.product?.name,
|
|
80
145
|
extra: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
81
|
-
|
|
82
|
-
|
|
146
|
+
sx: {
|
|
147
|
+
display: "flex",
|
|
148
|
+
alignItems: "center"
|
|
149
|
+
},
|
|
83
150
|
children: item.price.type === "recurring" && item.price.recurring ? [pricing.quantity, t("common.billed", {
|
|
84
151
|
rule: `${(0, _util.formatRecurring)(item.upsell_price?.recurring || item.price.recurring, true, "per", locale)} ${metered}`
|
|
85
152
|
})].filter(Boolean).join(", ") : pricing.quantity
|
|
86
153
|
})
|
|
87
154
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
88
155
|
direction: "column",
|
|
89
|
-
|
|
90
|
-
|
|
156
|
+
sx: {
|
|
157
|
+
alignItems: "flex-end",
|
|
158
|
+
flex: 1
|
|
159
|
+
},
|
|
91
160
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
92
161
|
sx: {
|
|
93
162
|
color: "text.primary",
|
|
@@ -104,8 +173,8 @@ function ProductItem({
|
|
|
104
173
|
children: pricing.secondary
|
|
105
174
|
})]
|
|
106
175
|
})]
|
|
107
|
-
}),
|
|
108
|
-
label:
|
|
176
|
+
}), quantityInventoryError ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_status.default, {
|
|
177
|
+
label: quantityInventoryError,
|
|
109
178
|
variant: "outlined",
|
|
110
179
|
sx: {
|
|
111
180
|
mt: 1,
|
|
@@ -113,15 +182,85 @@ function ProductItem({
|
|
|
113
182
|
backgroundColor: "chip.error.background",
|
|
114
183
|
color: "chip.error.text"
|
|
115
184
|
}
|
|
116
|
-
}) : null,
|
|
185
|
+
}) : null, canAdjustQuantity && !completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
186
|
+
sx: {
|
|
187
|
+
mt: 1,
|
|
188
|
+
p: 1
|
|
189
|
+
},
|
|
190
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
191
|
+
direction: "row",
|
|
192
|
+
spacing: 1,
|
|
193
|
+
sx: {
|
|
194
|
+
alignItems: "center"
|
|
195
|
+
},
|
|
196
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
197
|
+
variant: "body2",
|
|
198
|
+
sx: {
|
|
199
|
+
color: "text.secondary",
|
|
200
|
+
minWidth: "fit-content"
|
|
201
|
+
},
|
|
202
|
+
children: [t("common.quantity"), ":"]
|
|
203
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
204
|
+
size: "small",
|
|
205
|
+
onClick: handleQuantityDecrease,
|
|
206
|
+
disabled: localQuantity <= minQuantity,
|
|
207
|
+
sx: {
|
|
208
|
+
minWidth: 32,
|
|
209
|
+
width: 32,
|
|
210
|
+
height: 32
|
|
211
|
+
},
|
|
212
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.Remove, {
|
|
213
|
+
fontSize: "small"
|
|
214
|
+
})
|
|
215
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
216
|
+
size: "small",
|
|
217
|
+
value: localQuantity,
|
|
218
|
+
onChange: handleQuantityInputChange,
|
|
219
|
+
sx: {
|
|
220
|
+
width: 60
|
|
221
|
+
},
|
|
222
|
+
type: "number",
|
|
223
|
+
slotProps: {
|
|
224
|
+
htmlInput: {
|
|
225
|
+
min: minQuantity,
|
|
226
|
+
max: maxQuantity,
|
|
227
|
+
style: {
|
|
228
|
+
textAlign: "center",
|
|
229
|
+
padding: "4px"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
234
|
+
size: "small",
|
|
235
|
+
onClick: handleQuantityIncrease,
|
|
236
|
+
disabled: localQuantity >= maxQuantity,
|
|
237
|
+
sx: {
|
|
238
|
+
minWidth: 32,
|
|
239
|
+
width: 32,
|
|
240
|
+
height: 32
|
|
241
|
+
},
|
|
242
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.Add, {
|
|
243
|
+
fontSize: "small"
|
|
244
|
+
})
|
|
245
|
+
})]
|
|
246
|
+
})
|
|
247
|
+
}), isCreditProduct && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Alert, {
|
|
248
|
+
severity: "info",
|
|
249
|
+
sx: {
|
|
250
|
+
mt: 1,
|
|
251
|
+
fontSize: "0.875rem"
|
|
252
|
+
},
|
|
253
|
+
icon: false,
|
|
254
|
+
children: formatCreditInfo()
|
|
255
|
+
}), children]
|
|
117
256
|
}), canUpsell && !item.upsell_price_id && item.price.upsell?.upsells_to && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
118
257
|
direction: "row",
|
|
119
|
-
|
|
120
|
-
justifyContent: "space-between",
|
|
258
|
+
className: "product-item-upsell",
|
|
121
259
|
sx: {
|
|
260
|
+
alignItems: "center",
|
|
261
|
+
justifyContent: "space-between",
|
|
122
262
|
width: "100%"
|
|
123
263
|
},
|
|
124
|
-
className: "product-item-upsell",
|
|
125
264
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
126
265
|
component: "label",
|
|
127
266
|
htmlFor: "upsell-switch",
|
|
@@ -161,12 +300,12 @@ function ProductItem({
|
|
|
161
300
|
})]
|
|
162
301
|
}), canUpsell && item.upsell_price_id && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
163
302
|
direction: "row",
|
|
164
|
-
|
|
165
|
-
justifyContent: "space-between",
|
|
303
|
+
className: "product-item-upsell",
|
|
166
304
|
sx: {
|
|
305
|
+
alignItems: "center",
|
|
306
|
+
justifyContent: "space-between",
|
|
167
307
|
width: "100%"
|
|
168
308
|
},
|
|
169
|
-
className: "product-item-upsell",
|
|
170
309
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
171
310
|
component: "label",
|
|
172
311
|
htmlFor: "upsell-switch",
|
|
@@ -13,10 +13,10 @@ function ProductSkeleton({
|
|
|
13
13
|
in: true,
|
|
14
14
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
15
15
|
direction: "column",
|
|
16
|
-
alignItems: "center",
|
|
17
|
-
padding: 4,
|
|
18
16
|
spacing: 1,
|
|
19
17
|
sx: {
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
padding: 4,
|
|
20
20
|
width: 320,
|
|
21
21
|
border: "1px solid",
|
|
22
22
|
borderColor: "grey.100",
|
|
@@ -36,8 +36,10 @@ function DonationSkeleton() {
|
|
|
36
36
|
}
|
|
37
37
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
38
38
|
direction: "row",
|
|
39
|
-
justifyContent: "space-between",
|
|
40
39
|
spacing: 2,
|
|
40
|
+
sx: {
|
|
41
|
+
justifyContent: "space-between"
|
|
42
|
+
},
|
|
41
43
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
42
44
|
variant: "text",
|
|
43
45
|
sx: {
|
|
@@ -45,9 +47,11 @@ function DonationSkeleton() {
|
|
|
45
47
|
width: "40%"
|
|
46
48
|
}
|
|
47
49
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
sx: {
|
|
51
|
+
display: "flex",
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
gap: 2
|
|
54
|
+
},
|
|
51
55
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
52
56
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
53
57
|
height: 60,
|
|
@@ -13,8 +13,10 @@ function OverviewSkeleton() {
|
|
|
13
13
|
direction: "column",
|
|
14
14
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
15
15
|
direction: "row",
|
|
16
|
-
alignItems: "center",
|
|
17
16
|
spacing: 2,
|
|
17
|
+
sx: {
|
|
18
|
+
alignItems: "center"
|
|
19
|
+
},
|
|
18
20
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
19
21
|
variant: "text",
|
|
20
22
|
sx: {
|
|
@@ -29,9 +31,11 @@ function OverviewSkeleton() {
|
|
|
29
31
|
variant: "rounded",
|
|
30
32
|
height: 100
|
|
31
33
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
32
|
-
mt: 2,
|
|
33
34
|
component: "div",
|
|
34
35
|
variant: "h4",
|
|
36
|
+
sx: {
|
|
37
|
+
mt: 2
|
|
38
|
+
},
|
|
35
39
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
|
|
36
40
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
37
41
|
component: "div",
|
|
@@ -24,11 +24,15 @@ function PaymentSkeleton() {
|
|
|
24
24
|
variant: "rounded",
|
|
25
25
|
height: 68
|
|
26
26
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
27
|
-
|
|
27
|
+
sx: {
|
|
28
|
+
mt: 1
|
|
29
|
+
},
|
|
28
30
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
29
31
|
component: "div",
|
|
30
32
|
variant: "h4",
|
|
31
|
-
|
|
33
|
+
sx: {
|
|
34
|
+
mb: -1
|
|
35
|
+
},
|
|
32
36
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
|
|
33
37
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
34
38
|
component: "div",
|
|
@@ -40,7 +44,9 @@ function PaymentSkeleton() {
|
|
|
40
44
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
41
45
|
component: "div",
|
|
42
46
|
variant: "h4",
|
|
43
|
-
|
|
47
|
+
sx: {
|
|
48
|
+
mb: -1
|
|
49
|
+
},
|
|
44
50
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
|
|
45
51
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
46
52
|
component: "div",
|
package/lib/payment/success.d.ts
CHANGED
|
@@ -7,12 +7,5 @@ type Props = {
|
|
|
7
7
|
subscriptionId?: string;
|
|
8
8
|
subscriptions?: any[];
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var defaultProps: {
|
|
13
|
-
invoiceId: string;
|
|
14
|
-
subscriptionId: string;
|
|
15
|
-
subscriptions: never[];
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export default PaymentSuccess;
|
|
10
|
+
export default function PaymentSuccess({ mode, message, action, payee, invoiceId, subscriptionId, subscriptions, }: Props): import("react").JSX.Element;
|
|
11
|
+
export {};
|
package/lib/payment/success.js
CHANGED
|
@@ -15,9 +15,9 @@ function PaymentSuccess({
|
|
|
15
15
|
message,
|
|
16
16
|
action,
|
|
17
17
|
payee,
|
|
18
|
-
invoiceId,
|
|
19
|
-
subscriptionId,
|
|
20
|
-
subscriptions
|
|
18
|
+
invoiceId = "",
|
|
19
|
+
subscriptionId = "",
|
|
20
|
+
subscriptions = []
|
|
21
21
|
}) {
|
|
22
22
|
const {
|
|
23
23
|
t
|
|
@@ -91,8 +91,8 @@ function PaymentSuccess({
|
|
|
91
91
|
}
|
|
92
92
|
} else if (invoiceId) {
|
|
93
93
|
next = /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
94
|
-
textAlign: "center",
|
|
95
94
|
sx: {
|
|
95
|
+
textAlign: "center",
|
|
96
96
|
mt: 2
|
|
97
97
|
},
|
|
98
98
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Link, {
|
|
@@ -107,9 +107,9 @@ function PaymentSuccess({
|
|
|
107
107
|
in: true,
|
|
108
108
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
109
109
|
direction: "column",
|
|
110
|
-
alignItems: "center",
|
|
111
|
-
justifyContent: mode === "standalone" ? "center" : "flex-start",
|
|
112
110
|
sx: {
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
justifyContent: mode === "standalone" ? "center" : "flex-start",
|
|
113
113
|
height: mode === "standalone" ? "fit-content" : 300
|
|
114
114
|
},
|
|
115
115
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(Div, {
|
|
@@ -127,14 +127,16 @@ function PaymentSuccess({
|
|
|
127
127
|
})
|
|
128
128
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
129
129
|
variant: "h5",
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
sx: {
|
|
131
|
+
color: "text.primary",
|
|
132
|
+
mb: 3
|
|
133
|
+
},
|
|
132
134
|
children: message
|
|
133
135
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
134
136
|
variant: "body1",
|
|
135
|
-
color: "text.secondary",
|
|
136
|
-
textAlign: "center",
|
|
137
137
|
sx: {
|
|
138
|
+
color: "text.secondary",
|
|
139
|
+
textAlign: "center",
|
|
138
140
|
fontSize: "14px"
|
|
139
141
|
},
|
|
140
142
|
children: t("payment.checkout.completed.tip", {
|
|
@@ -144,11 +146,6 @@ function PaymentSuccess({
|
|
|
144
146
|
})
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
|
-
PaymentSuccess.defaultProps = {
|
|
148
|
-
invoiceId: "",
|
|
149
|
-
subscriptionId: "",
|
|
150
|
-
subscriptions: []
|
|
151
|
-
};
|
|
152
149
|
const Div = (0, _material.styled)("div")`
|
|
153
150
|
width: 80px;
|
|
154
151
|
height: 115px;
|
package/lib/payment/summary.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ type Props = {
|
|
|
8
8
|
showStaking?: boolean;
|
|
9
9
|
onUpsell?: Function;
|
|
10
10
|
onDownsell?: Function;
|
|
11
|
+
onQuantityChange?: Function;
|
|
11
12
|
onChangeAmount?: Function;
|
|
12
13
|
onApplyCrossSell?: Function;
|
|
13
14
|
onCancelCrossSell?: Function;
|
|
@@ -15,21 +16,7 @@ type Props = {
|
|
|
15
16
|
crossSellBehavior?: string;
|
|
16
17
|
donationSettings?: DonationSettings;
|
|
17
18
|
action?: string;
|
|
19
|
+
completed?: boolean;
|
|
18
20
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var defaultProps: {
|
|
22
|
-
onUpsell: any;
|
|
23
|
-
onDownsell: any;
|
|
24
|
-
onApplyCrossSell: any;
|
|
25
|
-
onCancelCrossSell: any;
|
|
26
|
-
onChangeAmount: any;
|
|
27
|
-
checkoutSessionId: string;
|
|
28
|
-
crossSellBehavior: string;
|
|
29
|
-
showStaking: boolean;
|
|
30
|
-
donationSettings: null;
|
|
31
|
-
action: string;
|
|
32
|
-
trialEnd: number;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export default PaymentSummary;
|
|
21
|
+
export default function PaymentSummary({ items, currency, trialInDays, billingThreshold, onUpsell, onDownsell, onQuantityChange, onApplyCrossSell, onCancelCrossSell, onChangeAmount, checkoutSessionId, crossSellBehavior, showStaking, donationSettings, action, trialEnd, completed, ...rest }: Props): import("react").JSX.Element;
|
|
22
|
+
export {};
|