@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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
3
|
-
import { Box, Stack, Typography } from "@mui/material";
|
|
4
|
-
import {
|
|
3
|
+
import { Box, Stack, Typography, IconButton, TextField, Alert } from "@mui/material";
|
|
4
|
+
import { Add, Remove } from "@mui/icons-material";
|
|
5
|
+
import { useMemo, useState } from "react";
|
|
5
6
|
import Status from "../components/status.js";
|
|
6
7
|
import Switch from "../components/switch-button.js";
|
|
7
8
|
import {
|
|
9
|
+
findCurrency,
|
|
8
10
|
formatLineItemPricing,
|
|
9
11
|
formatPrice,
|
|
10
12
|
formatQuantityInventory,
|
|
@@ -13,27 +15,87 @@ import {
|
|
|
13
15
|
} from "../libs/util.js";
|
|
14
16
|
import ProductCard from "./product-card.js";
|
|
15
17
|
import dayjs from "../libs/dayjs.js";
|
|
16
|
-
|
|
17
|
-
mode: "normal",
|
|
18
|
-
children: null,
|
|
19
|
-
trialEnd: 0
|
|
20
|
-
};
|
|
18
|
+
import { usePaymentContext } from "../contexts/payment.js";
|
|
21
19
|
export default function ProductItem({
|
|
22
20
|
item,
|
|
23
21
|
items,
|
|
24
22
|
trialInDays,
|
|
25
23
|
trialEnd = 0,
|
|
26
24
|
currency,
|
|
27
|
-
mode,
|
|
28
|
-
children,
|
|
25
|
+
mode = "normal",
|
|
26
|
+
children = null,
|
|
29
27
|
onUpsell,
|
|
30
|
-
onDownsell
|
|
28
|
+
onDownsell,
|
|
29
|
+
completed = false,
|
|
30
|
+
adjustableQuantity = { enabled: false },
|
|
31
|
+
onQuantityChange = () => {
|
|
32
|
+
}
|
|
31
33
|
}) {
|
|
32
34
|
const { t, locale } = useLocaleContext();
|
|
35
|
+
const { settings } = usePaymentContext();
|
|
33
36
|
const pricing = formatLineItemPricing(item, currency, { trialEnd, trialInDays }, locale);
|
|
34
37
|
const saving = formatUpsellSaving(items, currency);
|
|
35
38
|
const metered = item.price?.recurring?.usage_type === "metered" ? t("common.metered") : "";
|
|
36
39
|
const canUpsell = mode === "normal" && items.length === 1;
|
|
40
|
+
const isCreditProduct = item.price.product?.type === "credit" && item.price.metadata?.credit_config?.credit_amount;
|
|
41
|
+
const creditAmount = isCreditProduct ? Number(item.price.metadata.credit_config.credit_amount) : 0;
|
|
42
|
+
const creditCurrency = isCreditProduct ? findCurrency(settings.paymentMethods, item.price.metadata?.credit_config?.currency_id ?? "") : null;
|
|
43
|
+
const validDuration = item.price.metadata?.credit_config?.valid_duration_value;
|
|
44
|
+
const validDurationUnit = item.price.metadata?.credit_config?.valid_duration_unit || "days";
|
|
45
|
+
const [localQuantity, setLocalQuantity] = useState(item.quantity);
|
|
46
|
+
const canAdjustQuantity = adjustableQuantity.enabled && mode === "normal";
|
|
47
|
+
const minQuantity = Math.max(adjustableQuantity.minimum || 1, 1);
|
|
48
|
+
const quantityAvailable = Math.min(item.price.quantity_limit_per_checkout, item.price.quantity_available);
|
|
49
|
+
const maxQuantity = Math.min(adjustableQuantity.maximum || 999, quantityAvailable || 999);
|
|
50
|
+
const handleQuantityChange = (newQuantity) => {
|
|
51
|
+
if (newQuantity >= minQuantity && newQuantity <= maxQuantity) {
|
|
52
|
+
setLocalQuantity(newQuantity);
|
|
53
|
+
if (formatQuantityInventory(item.price, newQuantity, locale)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
onQuantityChange(item.price_id, newQuantity);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const handleQuantityIncrease = () => {
|
|
60
|
+
if (localQuantity < maxQuantity) {
|
|
61
|
+
handleQuantityChange(localQuantity + 1);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const handleQuantityDecrease = () => {
|
|
65
|
+
if (localQuantity > minQuantity) {
|
|
66
|
+
handleQuantityChange(localQuantity - 1);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const handleQuantityInputChange = (event) => {
|
|
70
|
+
const value = parseInt(event.target.value, 10);
|
|
71
|
+
if (!Number.isNaN(value)) {
|
|
72
|
+
handleQuantityChange(value);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const formatCreditInfo = () => {
|
|
76
|
+
if (!isCreditProduct) return null;
|
|
77
|
+
const isRecurring = item.price.type === "recurring";
|
|
78
|
+
const totalCredit = creditAmount * localQuantity;
|
|
79
|
+
let message = "";
|
|
80
|
+
if (isRecurring) {
|
|
81
|
+
message = t("payment.checkout.credit.recurringInfo", {
|
|
82
|
+
amount: totalCredit,
|
|
83
|
+
period: formatRecurring(item.price.recurring, true, "per", locale)
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
message = t("payment.checkout.credit.oneTimeInfo", {
|
|
87
|
+
amount: totalCredit,
|
|
88
|
+
symbol: creditCurrency?.symbol || "Credits"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (validDuration && validDuration > 0) {
|
|
92
|
+
message += `\uFF0C${t("payment.checkout.credit.expiresIn", {
|
|
93
|
+
duration: validDuration,
|
|
94
|
+
unit: t(`common.${validDurationUnit}`)
|
|
95
|
+
})}`;
|
|
96
|
+
}
|
|
97
|
+
return message;
|
|
98
|
+
};
|
|
37
99
|
const primaryText = useMemo(() => {
|
|
38
100
|
const price = item.upsell_price || item.price || {};
|
|
39
101
|
const isRecurring = price?.type === "recurring" && price?.recurring;
|
|
@@ -43,140 +105,253 @@ export default function ProductItem({
|
|
|
43
105
|
}
|
|
44
106
|
return pricing.primary;
|
|
45
107
|
}, [trialInDays, trialEnd, pricing, item, locale]);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
const quantityInventoryError = formatQuantityInventory(item.price, localQuantity, locale);
|
|
109
|
+
return /* @__PURE__ */ jsxs(
|
|
110
|
+
Stack,
|
|
111
|
+
{
|
|
112
|
+
direction: "column",
|
|
113
|
+
spacing: 1,
|
|
114
|
+
className: "product-item",
|
|
115
|
+
sx: {
|
|
116
|
+
alignItems: "flex-start",
|
|
117
|
+
width: "100%"
|
|
118
|
+
},
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsxs(
|
|
121
|
+
Stack,
|
|
122
|
+
{
|
|
123
|
+
direction: "column",
|
|
124
|
+
className: "product-item-content",
|
|
125
|
+
sx: {
|
|
126
|
+
alignItems: "flex-start",
|
|
127
|
+
width: "100%"
|
|
128
|
+
},
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsxs(
|
|
131
|
+
Stack,
|
|
132
|
+
{
|
|
133
|
+
direction: "row",
|
|
134
|
+
spacing: 0.5,
|
|
135
|
+
sx: {
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
flexWrap: "wrap",
|
|
138
|
+
justifyContent: "space-between",
|
|
139
|
+
width: "100%"
|
|
140
|
+
},
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
ProductCard,
|
|
144
|
+
{
|
|
145
|
+
logo: item.price.product?.images[0],
|
|
146
|
+
name: item.price.product?.name,
|
|
147
|
+
extra: /* @__PURE__ */ jsx(
|
|
148
|
+
Box,
|
|
149
|
+
{
|
|
150
|
+
sx: {
|
|
151
|
+
display: "flex",
|
|
152
|
+
alignItems: "center"
|
|
153
|
+
},
|
|
154
|
+
children: item.price.type === "recurring" && item.price.recurring ? [pricing.quantity, t("common.billed", { rule: `${formatRecurring(item.upsell_price?.recurring || item.price.recurring, true, "per", locale)} ${metered}` })].filter(Boolean).join(", ") : pricing.quantity
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ jsxs(
|
|
160
|
+
Stack,
|
|
161
|
+
{
|
|
162
|
+
direction: "column",
|
|
163
|
+
sx: {
|
|
164
|
+
alignItems: "flex-end",
|
|
165
|
+
flex: 1
|
|
166
|
+
},
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ jsx(Typography, { sx: { color: "text.primary", fontWeight: 500, whiteSpace: "nowrap" }, gutterBottom: true, children: primaryText }),
|
|
169
|
+
pricing.secondary && /* @__PURE__ */ jsx(Typography, { sx: { fontSize: "0.74375rem", color: "text.lighter" }, children: pricing.secondary })
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
quantityInventoryError ? /* @__PURE__ */ jsx(
|
|
177
|
+
Status,
|
|
178
|
+
{
|
|
179
|
+
label: quantityInventoryError,
|
|
180
|
+
variant: "outlined",
|
|
181
|
+
sx: {
|
|
182
|
+
mt: 1,
|
|
183
|
+
borderColor: "chip.error.border",
|
|
184
|
+
backgroundColor: "chip.error.background",
|
|
185
|
+
color: "chip.error.text"
|
|
116
186
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
}
|
|
188
|
+
) : null,
|
|
189
|
+
canAdjustQuantity && !completed && /* @__PURE__ */ jsx(Box, { sx: { mt: 1, p: 1 }, children: /* @__PURE__ */ jsxs(
|
|
190
|
+
Stack,
|
|
191
|
+
{
|
|
192
|
+
direction: "row",
|
|
193
|
+
spacing: 1,
|
|
194
|
+
sx: {
|
|
195
|
+
alignItems: "center"
|
|
196
|
+
},
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsxs(
|
|
199
|
+
Typography,
|
|
200
|
+
{
|
|
201
|
+
variant: "body2",
|
|
202
|
+
sx: {
|
|
203
|
+
color: "text.secondary",
|
|
204
|
+
minWidth: "fit-content"
|
|
205
|
+
},
|
|
206
|
+
children: [
|
|
207
|
+
t("common.quantity"),
|
|
208
|
+
":"
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsx(
|
|
213
|
+
IconButton,
|
|
214
|
+
{
|
|
215
|
+
size: "small",
|
|
216
|
+
onClick: handleQuantityDecrease,
|
|
217
|
+
disabled: localQuantity <= minQuantity,
|
|
218
|
+
sx: { minWidth: 32, width: 32, height: 32 },
|
|
219
|
+
children: /* @__PURE__ */ jsx(Remove, { fontSize: "small" })
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
/* @__PURE__ */ jsx(
|
|
223
|
+
TextField,
|
|
224
|
+
{
|
|
225
|
+
size: "small",
|
|
226
|
+
value: localQuantity,
|
|
227
|
+
onChange: handleQuantityInputChange,
|
|
228
|
+
sx: { width: 60 },
|
|
229
|
+
type: "number",
|
|
230
|
+
slotProps: {
|
|
231
|
+
htmlInput: {
|
|
232
|
+
min: minQuantity,
|
|
233
|
+
max: maxQuantity,
|
|
234
|
+
style: { textAlign: "center", padding: "4px" }
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ jsx(
|
|
240
|
+
IconButton,
|
|
241
|
+
{
|
|
242
|
+
size: "small",
|
|
243
|
+
onClick: handleQuantityIncrease,
|
|
244
|
+
disabled: localQuantity >= maxQuantity,
|
|
245
|
+
sx: { minWidth: 32, width: 32, height: 32 },
|
|
246
|
+
children: /* @__PURE__ */ jsx(Add, { fontSize: "small" })
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
) }),
|
|
252
|
+
isCreditProduct && /* @__PURE__ */ jsx(Alert, { severity: "info", sx: { mt: 1, fontSize: "0.875rem" }, icon: false, children: formatCreditInfo() }),
|
|
253
|
+
children
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
canUpsell && !item.upsell_price_id && item.price.upsell?.upsells_to && /* @__PURE__ */ jsxs(
|
|
258
|
+
Stack,
|
|
259
|
+
{
|
|
260
|
+
direction: "row",
|
|
261
|
+
className: "product-item-upsell",
|
|
262
|
+
sx: {
|
|
263
|
+
alignItems: "center",
|
|
264
|
+
justifyContent: "space-between",
|
|
265
|
+
width: "100%"
|
|
266
|
+
},
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ jsxs(
|
|
269
|
+
Typography,
|
|
270
|
+
{
|
|
271
|
+
component: "label",
|
|
272
|
+
htmlFor: "upsell-switch",
|
|
273
|
+
sx: {
|
|
274
|
+
fontSize: 12,
|
|
275
|
+
cursor: "pointer",
|
|
276
|
+
color: "text.secondary"
|
|
277
|
+
},
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsx(
|
|
280
|
+
Switch,
|
|
281
|
+
{
|
|
282
|
+
id: "upsell-switch",
|
|
283
|
+
sx: { mr: 1 },
|
|
284
|
+
variant: "success",
|
|
285
|
+
checked: false,
|
|
286
|
+
onChange: () => onUpsell(item.price_id, item.price.upsell?.upsells_to_id)
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
t("payment.checkout.upsell.save", {
|
|
290
|
+
recurring: formatRecurring(item.price.upsell.upsells_to.recurring, true, "per", locale)
|
|
291
|
+
}),
|
|
292
|
+
/* @__PURE__ */ jsx(
|
|
293
|
+
Status,
|
|
294
|
+
{
|
|
295
|
+
label: t("payment.checkout.upsell.off", { saving }),
|
|
296
|
+
variant: "outlined",
|
|
297
|
+
sx: {
|
|
298
|
+
ml: 1,
|
|
299
|
+
borderColor: "chip.warning.border",
|
|
300
|
+
backgroundColor: "chip.warning.background",
|
|
301
|
+
color: "chip.warning.text"
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ jsx(Typography, { component: "span", sx: { fontSize: 12 }, children: formatPrice(item.price.upsell.upsells_to, currency, item.price.product?.unit_label, 1, true, locale) })
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
canUpsell && item.upsell_price_id && /* @__PURE__ */ jsxs(
|
|
313
|
+
Stack,
|
|
314
|
+
{
|
|
315
|
+
direction: "row",
|
|
316
|
+
className: "product-item-upsell",
|
|
317
|
+
sx: {
|
|
318
|
+
alignItems: "center",
|
|
319
|
+
justifyContent: "space-between",
|
|
320
|
+
width: "100%"
|
|
321
|
+
},
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ jsxs(
|
|
324
|
+
Typography,
|
|
325
|
+
{
|
|
326
|
+
component: "label",
|
|
327
|
+
htmlFor: "upsell-switch",
|
|
328
|
+
sx: {
|
|
329
|
+
fontSize: 12,
|
|
330
|
+
cursor: "pointer",
|
|
331
|
+
color: "text.secondary"
|
|
332
|
+
},
|
|
333
|
+
children: [
|
|
334
|
+
/* @__PURE__ */ jsx(
|
|
335
|
+
Switch,
|
|
336
|
+
{
|
|
337
|
+
id: "upsell-switch",
|
|
338
|
+
sx: { mr: 1 },
|
|
339
|
+
variant: "success",
|
|
340
|
+
checked: true,
|
|
341
|
+
onChange: () => onDownsell(item.upsell_price_id)
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
t("payment.checkout.upsell.revert", {
|
|
345
|
+
recurring: t(`common.${formatRecurring(item.price.recurring)}`)
|
|
346
|
+
})
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
/* @__PURE__ */ jsx(Typography, { component: "span", sx: { fontSize: 12 }, children: formatPrice(item.price, currency, item.price.product?.unit_label, 1, true, locale) })
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
)
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
);
|
|
182
357
|
}
|
|
@@ -5,10 +5,10 @@ export default function ProductSkeleton({ count }) {
|
|
|
5
5
|
Stack,
|
|
6
6
|
{
|
|
7
7
|
direction: "column",
|
|
8
|
-
alignItems: "center",
|
|
9
|
-
padding: 4,
|
|
10
8
|
spacing: 1,
|
|
11
9
|
sx: {
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
padding: 4,
|
|
12
12
|
width: 320,
|
|
13
13
|
border: "1px solid",
|
|
14
14
|
borderColor: "grey.100",
|
|
@@ -19,12 +19,32 @@ export default function DonationSkeleton() {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
),
|
|
22
|
-
/* @__PURE__ */ jsxs(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
/* @__PURE__ */ jsxs(
|
|
23
|
+
Stack,
|
|
24
|
+
{
|
|
25
|
+
direction: "row",
|
|
26
|
+
spacing: 2,
|
|
27
|
+
sx: {
|
|
28
|
+
justifyContent: "space-between"
|
|
29
|
+
},
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "1.5rem", width: "40%" } }),
|
|
32
|
+
/* @__PURE__ */ jsxs(
|
|
33
|
+
Box,
|
|
34
|
+
{
|
|
35
|
+
sx: {
|
|
36
|
+
display: "flex",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
gap: 2
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Skeleton, { height: 60, width: 80 }) }),
|
|
42
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Skeleton, { height: 60, width: 120 }) })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
)
|
|
29
49
|
] }) });
|
|
30
50
|
}
|
|
@@ -2,9 +2,29 @@ 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__ */ jsx(
|
|
5
|
+
/* @__PURE__ */ jsx(
|
|
6
|
+
Stack,
|
|
7
|
+
{
|
|
8
|
+
direction: "row",
|
|
9
|
+
spacing: 2,
|
|
10
|
+
sx: {
|
|
11
|
+
alignItems: "center"
|
|
12
|
+
},
|
|
13
|
+
children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "1.75rem", width: "40%" } })
|
|
14
|
+
}
|
|
15
|
+
),
|
|
6
16
|
/* @__PURE__ */ jsx(Skeleton, { sx: { mt: 2 }, variant: "rounded", height: 100 }),
|
|
7
|
-
/* @__PURE__ */ jsx(
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
Typography,
|
|
19
|
+
{
|
|
20
|
+
component: "div",
|
|
21
|
+
variant: "h4",
|
|
22
|
+
sx: {
|
|
23
|
+
mt: 2
|
|
24
|
+
},
|
|
25
|
+
children: /* @__PURE__ */ jsx(Skeleton, {})
|
|
26
|
+
}
|
|
27
|
+
),
|
|
8
28
|
/* @__PURE__ */ jsx(Typography, { component: "div", variant: "h2", children: /* @__PURE__ */ jsx(Skeleton, {}) })
|
|
9
29
|
] }) });
|
|
10
30
|
}
|
|
@@ -4,12 +4,40 @@ export default function PaymentSkeleton() {
|
|
|
4
4
|
return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { direction: "column", children: [
|
|
5
5
|
/* @__PURE__ */ jsx(Skeleton, { variant: "text", sx: { fontSize: "1.75rem", width: "40%" } }),
|
|
6
6
|
/* @__PURE__ */ jsx(Skeleton, { sx: { mt: 2 }, variant: "rounded", height: 68 }),
|
|
7
|
-
/* @__PURE__ */ jsxs(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/* @__PURE__ */ jsxs(
|
|
8
|
+
Box,
|
|
9
|
+
{
|
|
10
|
+
sx: {
|
|
11
|
+
mt: 1
|
|
12
|
+
},
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ jsx(
|
|
15
|
+
Typography,
|
|
16
|
+
{
|
|
17
|
+
component: "div",
|
|
18
|
+
variant: "h4",
|
|
19
|
+
sx: {
|
|
20
|
+
mb: -1
|
|
21
|
+
},
|
|
22
|
+
children: /* @__PURE__ */ jsx(Skeleton, {})
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
/* @__PURE__ */ jsx(Typography, { component: "div", children: /* @__PURE__ */ jsx(Skeleton, { height: 60 }) })
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
),
|
|
11
29
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
12
|
-
/* @__PURE__ */ jsx(
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
Typography,
|
|
32
|
+
{
|
|
33
|
+
component: "div",
|
|
34
|
+
variant: "h4",
|
|
35
|
+
sx: {
|
|
36
|
+
mb: -1
|
|
37
|
+
},
|
|
38
|
+
children: /* @__PURE__ */ jsx(Skeleton, {})
|
|
39
|
+
}
|
|
40
|
+
),
|
|
13
41
|
/* @__PURE__ */ jsx(Typography, { component: "div", children: /* @__PURE__ */ jsx(Skeleton, { height: 60 }) })
|
|
14
42
|
] }),
|
|
15
43
|
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Skeleton, { height: 60 }) })
|
package/es/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 {};
|