@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
package/lib/locales/zh.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
var _flat = _interopRequireDefault(require("flat"));
|
|
8
8
|
var _constant = require("../libs/constant");
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
module.exports = (0, _flat.default)({
|
|
11
11
|
common: {
|
|
12
12
|
id: "ID",
|
|
@@ -38,6 +38,10 @@ module.exports = (0, _flat.default)({
|
|
|
38
38
|
change: "\u66F4\u6362",
|
|
39
39
|
confirm: "\u786E\u8BA4",
|
|
40
40
|
cancel: "\u53D6\u6D88",
|
|
41
|
+
clear: "\u6E05\u7A7A",
|
|
42
|
+
selectTimeRange: "\u9009\u62E9\u65F6\u95F4\u8303\u56F4",
|
|
43
|
+
startDate: "\u5F00\u59CB\u65E5\u671F",
|
|
44
|
+
endDate: "\u7ED3\u675F\u65E5\u671F",
|
|
41
45
|
close: "\u5173\u95ED",
|
|
42
46
|
back: "\u8FD4\u56DE",
|
|
43
47
|
every: "\u6BCF",
|
|
@@ -107,7 +111,8 @@ module.exports = (0, _flat.default)({
|
|
|
107
111
|
scan: "\u4F7F\u7528\u4EE5\u4E0B\u65B9\u5F0F\u5B8C\u6210\u672C\u6B21{action}",
|
|
108
112
|
confirm: "\u786E\u8BA4",
|
|
109
113
|
cancel: "\u53D6\u6D88"
|
|
110
|
-
}
|
|
114
|
+
},
|
|
115
|
+
paymentMethod: "\u652F\u4ED8\u65B9\u5F0F"
|
|
111
116
|
},
|
|
112
117
|
payment: {
|
|
113
118
|
checkout: {
|
|
@@ -219,6 +224,11 @@ module.exports = (0, _flat.default)({
|
|
|
219
224
|
add: "\u6DFB\u52A0\u5230\u8BA2\u5355",
|
|
220
225
|
remove: "\u4ECE\u8BA2\u5355\u79FB\u9664"
|
|
221
226
|
},
|
|
227
|
+
credit: {
|
|
228
|
+
oneTimeInfo: "\u4ED8\u6B3E\u5B8C\u6210\u540E\u60A8\u5C06\u83B7\u5F97 {amount} {symbol} \u989D\u5EA6",
|
|
229
|
+
recurringInfo: "\u60A8\u5C06{period}\u83B7\u5F97 {amount} {symbol} \u989D\u5EA6",
|
|
230
|
+
expiresIn: "\u989D\u5EA6\u6709\u6548\u671F\u4E3A {duration} {unit}"
|
|
231
|
+
},
|
|
222
232
|
emptyItems: {
|
|
223
233
|
title: "\u6CA1\u6709\u4EFB\u4F55\u8D2D\u4E70\u9879\u76EE",
|
|
224
234
|
description: "\u53EF\u80FD\u8FD9\u4E2A\u4ED8\u6B3E\u94FE\u63A5\u6CA1\u6709\u6B63\u786E\u914D\u7F6E"
|
|
@@ -239,7 +249,15 @@ module.exports = (0, _flat.default)({
|
|
|
239
249
|
payer: "\u8D26\u6237\u5730\u5740",
|
|
240
250
|
amount: "\u652F\u4ED8\u91D1\u989D",
|
|
241
251
|
failed: "\u8D26\u6237\u53D1\u751F\u53D8\u5316\uFF0C\u65E0\u6CD5\u81EA\u52A8\u5B8C\u6210\u652F\u4ED8\uFF0C\u8BF7\u624B\u52A8\u652F\u4ED8\u3002",
|
|
242
|
-
balanceLink: "\u67E5\u770B\u4F59\u989D"
|
|
252
|
+
balanceLink: "\u67E5\u770B\u4F59\u989D",
|
|
253
|
+
credit: {
|
|
254
|
+
title: "\u786E\u8BA4\u989D\u5EA6\u652F\u4ED8",
|
|
255
|
+
availableAmount: "\u53EF\u7528\u989D\u5EA6\uFF1A{amount}",
|
|
256
|
+
confirmMessage: "\u60A8\u5C06\u4F7F\u7528 {amount} \u989D\u5EA6\u6765\u8BA2\u9605\u6B64\u670D\u52A1\u3002",
|
|
257
|
+
meteringSubscriptionMessage: "\u6B64\u8BA2\u9605\u670D\u52A1\u5C06\u6839\u636E\u5B9E\u9645\u4F7F\u7528\u60C5\u51B5\u5B9E\u65F6\u6263\u9664\u989D\u5EA6\u3002\u60A8\u5F53\u524D\u53EF\u7528\u989D\u5EA6\u4E3A {available}\uFF0C\u786E\u8BA4\u662F\u5426\u7EE7\u7EED\uFF1F",
|
|
258
|
+
insufficientTitle: "\u989D\u5EA6\u4E0D\u8DB3",
|
|
259
|
+
insufficientMessage: "\u6B64\u8BA2\u9605\u670D\u52A1\u5C06\u6839\u636E\u5B9E\u9645\u4F7F\u7528\u60C5\u51B5\u5B9E\u65F6\u6263\u9664\u989D\u5EA6\u3002\u60A8\u5F53\u524D\u53EF\u7528\u989D\u5EA6\u4E0D\u8DB3\uFF0C\u8BF7\u5148\u5145\u503C\u989D\u5EA6\u3002"
|
|
260
|
+
}
|
|
243
261
|
}
|
|
244
262
|
},
|
|
245
263
|
customer: {
|
package/lib/payment/amount.d.ts
CHANGED
|
@@ -2,10 +2,5 @@ import type { TypographyProps } from '@mui/material';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
amount: string;
|
|
4
4
|
} & TypographyProps;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var defaultProps: {
|
|
8
|
-
sx: {};
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export default PaymentAmount;
|
|
5
|
+
export default function PaymentAmount({ amount, sx }: Props): import("react").JSX.Element;
|
|
6
|
+
export {};
|
package/lib/payment/amount.js
CHANGED
|
@@ -8,7 +8,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
8
8
|
var _material = require("@mui/material");
|
|
9
9
|
function PaymentAmount({
|
|
10
10
|
amount,
|
|
11
|
-
sx
|
|
11
|
+
sx = {}
|
|
12
12
|
}) {
|
|
13
13
|
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
14
14
|
component: "div",
|
|
@@ -22,8 +22,4 @@ function PaymentAmount({
|
|
|
22
22
|
},
|
|
23
23
|
children: amount
|
|
24
24
|
});
|
|
25
|
-
}
|
|
26
|
-
PaymentAmount.defaultProps = {
|
|
27
|
-
// eslint-disable-next-line react/default-props-match-prop-types
|
|
28
|
-
sx: {}
|
|
29
|
-
};
|
|
25
|
+
}
|
|
@@ -8,17 +8,9 @@ type Props = CheckoutContext & CheckoutCallbacks & {
|
|
|
8
8
|
formRender?: Record<string, any>;
|
|
9
9
|
id: string;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
declare namespace DonationForm {
|
|
13
|
-
var defaultProps: {
|
|
14
|
-
completed: boolean;
|
|
15
|
-
error: null;
|
|
16
|
-
showCheckoutSummary: boolean;
|
|
17
|
-
formRender: {};
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export default DonationForm;
|
|
11
|
+
export default function DonationForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, error, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, formRender, id, }: Props): import("react").JSX.Element;
|
|
21
12
|
type RootProps = {
|
|
22
13
|
mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
|
|
23
14
|
} & BoxProps;
|
|
24
15
|
export declare const Root: React.FC<RootProps>;
|
|
16
|
+
export {};
|
|
@@ -29,31 +29,26 @@ var _confirm = _interopRequireDefault(require("../components/confirm"));
|
|
|
29
29
|
var _paymentBeneficiaries = _interopRequireDefault(require("../components/payment-beneficiaries"));
|
|
30
30
|
var _donation = _interopRequireDefault(require("./skeleton/donation"));
|
|
31
31
|
var _phoneValidator = require("../libs/phone-validator");
|
|
32
|
-
function _interopRequireDefault(
|
|
32
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
33
33
|
const getBenefits = async (id, url) => {
|
|
34
34
|
const {
|
|
35
35
|
data
|
|
36
36
|
} = await _api.default.get(`/api/payment-links/${id}/benefits?${url ? `url=${url}` : ""}`);
|
|
37
37
|
return data;
|
|
38
38
|
};
|
|
39
|
-
PaymentInner.defaultProps = {
|
|
40
|
-
completed: false,
|
|
41
|
-
showCheckoutSummary: true,
|
|
42
|
-
formRender: {}
|
|
43
|
-
};
|
|
44
39
|
function PaymentInner({
|
|
45
40
|
checkoutSession,
|
|
46
41
|
paymentMethods,
|
|
47
42
|
paymentLink,
|
|
48
43
|
paymentIntent,
|
|
49
44
|
customer,
|
|
50
|
-
completed,
|
|
45
|
+
completed = false,
|
|
51
46
|
mode,
|
|
52
47
|
onPaid,
|
|
53
48
|
onError,
|
|
54
49
|
onChange,
|
|
55
50
|
action,
|
|
56
|
-
formRender,
|
|
51
|
+
formRender = {},
|
|
57
52
|
benefits
|
|
58
53
|
}) {
|
|
59
54
|
const {
|
|
@@ -214,10 +209,12 @@ function PaymentInner({
|
|
|
214
209
|
}
|
|
215
210
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
216
211
|
direction: "row",
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
sx: {
|
|
213
|
+
justifyContent: "flex-end",
|
|
214
|
+
alignItems: "center",
|
|
215
|
+
flexWrap: "wrap",
|
|
216
|
+
gap: 1
|
|
217
|
+
},
|
|
221
218
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
222
219
|
variant: "outlined",
|
|
223
220
|
size: "large",
|
|
@@ -240,9 +237,9 @@ function PaymentInner({
|
|
|
240
237
|
},
|
|
241
238
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
242
239
|
direction: "row",
|
|
243
|
-
justifyContent: "space-between",
|
|
244
|
-
alignItems: "center",
|
|
245
240
|
sx: {
|
|
241
|
+
justifyContent: "space-between",
|
|
242
|
+
alignItems: "center",
|
|
246
243
|
mb: 2
|
|
247
244
|
},
|
|
248
245
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
@@ -299,10 +296,12 @@ function PaymentInner({
|
|
|
299
296
|
}
|
|
300
297
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
301
298
|
direction: "row",
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
299
|
+
sx: {
|
|
300
|
+
justifyContent: "space-between",
|
|
301
|
+
alignItems: "center",
|
|
302
|
+
flexWrap: "wrap",
|
|
303
|
+
gap: 1
|
|
304
|
+
},
|
|
306
305
|
children: [benefits && benefits.length > 0 && (benefitsState.open ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
307
306
|
onClick: () => setBenefitsState({
|
|
308
307
|
open: false
|
|
@@ -324,13 +323,13 @@ function PaymentInner({
|
|
|
324
323
|
}
|
|
325
324
|
}), t("common.back")]
|
|
326
325
|
}) : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
327
|
-
display: "flex",
|
|
328
|
-
gap: 0.5,
|
|
329
|
-
alignItems: "center",
|
|
330
326
|
onClick: () => setBenefitsState({
|
|
331
327
|
open: true
|
|
332
328
|
}),
|
|
333
329
|
sx: {
|
|
330
|
+
display: "flex",
|
|
331
|
+
gap: 0.5,
|
|
332
|
+
alignItems: "center",
|
|
334
333
|
color: "text.secondary",
|
|
335
334
|
cursor: "pointer",
|
|
336
335
|
"& .benefits-arrow": {
|
|
@@ -360,9 +359,9 @@ function PaymentInner({
|
|
|
360
359
|
}
|
|
361
360
|
})]
|
|
362
361
|
})), benefitsState.open ? null : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
363
|
-
display: "flex",
|
|
364
|
-
gap: 2,
|
|
365
362
|
sx: {
|
|
363
|
+
display: "flex",
|
|
364
|
+
gap: 2,
|
|
366
365
|
flex: {
|
|
367
366
|
xs: 1,
|
|
368
367
|
md: "auto"
|
|
@@ -399,20 +398,14 @@ function PaymentInner({
|
|
|
399
398
|
})
|
|
400
399
|
});
|
|
401
400
|
}
|
|
402
|
-
DonationForm.defaultProps = {
|
|
403
|
-
completed: false,
|
|
404
|
-
error: null,
|
|
405
|
-
showCheckoutSummary: true,
|
|
406
|
-
formRender: {}
|
|
407
|
-
};
|
|
408
401
|
function DonationForm({
|
|
409
402
|
checkoutSession,
|
|
410
403
|
paymentMethods,
|
|
411
404
|
paymentIntent,
|
|
412
405
|
paymentLink,
|
|
413
406
|
customer,
|
|
414
|
-
completed,
|
|
415
|
-
error,
|
|
407
|
+
completed = false,
|
|
408
|
+
error = null,
|
|
416
409
|
mode,
|
|
417
410
|
onPaid,
|
|
418
411
|
onError,
|
|
@@ -420,7 +413,7 @@ function DonationForm({
|
|
|
420
413
|
goBack,
|
|
421
414
|
action,
|
|
422
415
|
showCheckoutSummary = true,
|
|
423
|
-
formRender,
|
|
416
|
+
formRender = {},
|
|
424
417
|
id
|
|
425
418
|
}) {
|
|
426
419
|
const {
|
|
@@ -476,10 +469,12 @@ function DonationForm({
|
|
|
476
469
|
}
|
|
477
470
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
478
471
|
direction: "row",
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
472
|
+
sx: {
|
|
473
|
+
justifyContent: "flex-end",
|
|
474
|
+
alignItems: "center",
|
|
475
|
+
flexWrap: "wrap",
|
|
476
|
+
gap: 1
|
|
477
|
+
},
|
|
483
478
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
484
479
|
variant: "outlined",
|
|
485
480
|
size: "large",
|
|
@@ -540,9 +535,9 @@ function DonationForm({
|
|
|
540
535
|
});
|
|
541
536
|
};
|
|
542
537
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
543
|
-
display: "flex",
|
|
544
|
-
flexDirection: "column",
|
|
545
538
|
sx: {
|
|
539
|
+
display: "flex",
|
|
540
|
+
flexDirection: "column",
|
|
546
541
|
height: mode === "standalone" ? "100vh" : "auto",
|
|
547
542
|
overflow: isMobileSafariEnv ? "visible" : "hidden"
|
|
548
543
|
},
|
package/lib/payment/error.d.ts
CHANGED
|
@@ -6,11 +6,5 @@ type Props = {
|
|
|
6
6
|
button?: string | React.ReactNode;
|
|
7
7
|
mode?: ModeType;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
button: string;
|
|
13
|
-
mode: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export default PaymentError;
|
|
9
|
+
export default function PaymentError({ title, description, button, mode }: Props): import("react").JSX.Element;
|
|
10
|
+
export {};
|
package/lib/payment/error.js
CHANGED
|
@@ -13,6 +13,7 @@ function getHeightStyle(mode) {
|
|
|
13
13
|
height: "100vh",
|
|
14
14
|
maxHeight: "100%"
|
|
15
15
|
};
|
|
16
|
+
// 独立模式下,高度为100vh
|
|
16
17
|
default:
|
|
17
18
|
return {
|
|
18
19
|
height: "auto",
|
|
@@ -23,21 +24,22 @@ function getHeightStyle(mode) {
|
|
|
23
24
|
function PaymentError({
|
|
24
25
|
title,
|
|
25
26
|
description,
|
|
26
|
-
button,
|
|
27
|
-
mode
|
|
27
|
+
button = "Back",
|
|
28
|
+
mode = "standalone"
|
|
28
29
|
}) {
|
|
29
30
|
const heightStyle = getHeightStyle(mode);
|
|
30
31
|
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
31
|
-
sx:
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
sx: [{
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
justifyContent: "center"
|
|
35
|
+
}, ...(Array.isArray(heightStyle) ? heightStyle : [heightStyle])],
|
|
34
36
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
37
|
+
direction: "column",
|
|
35
38
|
sx: {
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
justifyContent: "center",
|
|
36
41
|
width: "280px"
|
|
37
42
|
},
|
|
38
|
-
direction: "column",
|
|
39
|
-
alignItems: "center",
|
|
40
|
-
justifyContent: "center",
|
|
41
43
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
42
44
|
variant: "h5",
|
|
43
45
|
sx: {
|
|
@@ -63,8 +65,4 @@ function PaymentError({
|
|
|
63
65
|
}) : button]
|
|
64
66
|
})
|
|
65
67
|
});
|
|
66
|
-
}
|
|
67
|
-
PaymentError.defaultProps = {
|
|
68
|
-
button: "Back",
|
|
69
|
-
mode: "standalone"
|
|
70
|
-
};
|
|
68
|
+
}
|
package/lib/payment/footer.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}): import("react").JSX.Element;
|
|
1
|
+
import { TypographyProps } from '@mui/material';
|
|
2
|
+
export default function CheckoutFooter(props: TypographyProps): import("react").JSX.Element;
|
package/lib/payment/footer.js
CHANGED
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
module.exports = CheckoutFooter;
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
var _material = require("@mui/material");
|
|
9
|
-
function CheckoutFooter({
|
|
10
|
-
...props
|
|
11
|
-
}) {
|
|
9
|
+
function CheckoutFooter(props) {
|
|
12
10
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
13
|
-
color: "text.lighter",
|
|
14
|
-
fontSize: 12,
|
|
15
11
|
...props,
|
|
12
|
+
sx: [{
|
|
13
|
+
color: "text.lighter",
|
|
14
|
+
fontSize: 12
|
|
15
|
+
}, ...(Array.isArray(props.sx) ? props.sx : [props.sx])],
|
|
16
16
|
children: ["Powered by", " ", /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
17
17
|
component: "span",
|
|
18
18
|
sx: {
|
|
@@ -10,7 +10,7 @@ var _context = require("@arcblock/ux/lib/Locale/context");
|
|
|
10
10
|
var _selector = _interopRequireDefault(require("@arcblock/ux/lib/Locale/selector"));
|
|
11
11
|
var _material = require("@mui/material");
|
|
12
12
|
var _payment = require("../../contexts/payment");
|
|
13
|
-
function _interopRequireDefault(
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
function UserButtons() {
|
|
15
15
|
const {
|
|
16
16
|
t
|
|
@@ -20,8 +20,10 @@ function UserButtons() {
|
|
|
20
20
|
} = (0, _payment.usePaymentContext)();
|
|
21
21
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
22
22
|
direction: "row",
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
sx: {
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "space-between"
|
|
26
|
+
},
|
|
25
27
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_selector.default, {
|
|
26
28
|
showText: false
|
|
27
29
|
}), session?.user ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_SessionManager.default, {
|
|
@@ -6,12 +6,5 @@ type Props = {
|
|
|
6
6
|
fieldValidation?: Record<string, any>;
|
|
7
7
|
errorPosition?: 'right' | 'bottom';
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
sx: {};
|
|
13
|
-
fieldValidation: {};
|
|
14
|
-
errorPosition: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export default AddressForm;
|
|
9
|
+
export default function AddressForm({ mode, stripe, sx, fieldValidation, errorPosition }: Props): import("react").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -11,18 +11,13 @@ var _reactHookForm = require("react-hook-form");
|
|
|
11
11
|
var _input = _interopRequireDefault(require("../../components/input"));
|
|
12
12
|
var _countrySelect = _interopRequireDefault(require("../../components/country-select"));
|
|
13
13
|
var _validator = require("../../libs/validator");
|
|
14
|
-
function _interopRequireDefault(
|
|
15
|
-
AddressForm.defaultProps = {
|
|
16
|
-
sx: {},
|
|
17
|
-
fieldValidation: {},
|
|
18
|
-
errorPosition: "right"
|
|
19
|
-
};
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
15
|
function AddressForm({
|
|
21
16
|
mode,
|
|
22
17
|
stripe,
|
|
23
18
|
sx = {},
|
|
24
|
-
fieldValidation,
|
|
25
|
-
errorPosition
|
|
19
|
+
fieldValidation = {},
|
|
20
|
+
errorPosition = "right"
|
|
26
21
|
}) {
|
|
27
22
|
const {
|
|
28
23
|
t,
|
|
@@ -111,6 +106,7 @@ function AddressForm({
|
|
|
111
106
|
field
|
|
112
107
|
}) => /* @__PURE__ */(0, _jsxRuntime.jsx)(_countrySelect.default, {
|
|
113
108
|
...field,
|
|
109
|
+
ref: field.ref,
|
|
114
110
|
sx: {
|
|
115
111
|
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
116
112
|
borderColor: "transparent"
|
|
@@ -168,6 +164,7 @@ function AddressForm({
|
|
|
168
164
|
field
|
|
169
165
|
}) => /* @__PURE__ */(0, _jsxRuntime.jsx)(_countrySelect.default, {
|
|
170
166
|
...field,
|
|
167
|
+
ref: field.ref,
|
|
171
168
|
sx: {
|
|
172
169
|
".MuiOutlinedInput-notchedOutline": {
|
|
173
170
|
borderColor: "transparent !important"
|
|
@@ -29,8 +29,8 @@ function CurrencySelector({
|
|
|
29
29
|
className: selected ? "cko-payment-card" : "cko-payment-card-unselect",
|
|
30
30
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
31
31
|
direction: "row",
|
|
32
|
-
alignItems: "center",
|
|
33
32
|
sx: {
|
|
33
|
+
alignItems: "center",
|
|
34
34
|
position: "relative"
|
|
35
35
|
},
|
|
36
36
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
@@ -52,11 +52,11 @@ function CurrencySelector({
|
|
|
52
52
|
},
|
|
53
53
|
children: x.symbol
|
|
54
54
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
55
|
+
gutterBottom: true,
|
|
55
56
|
sx: {
|
|
57
|
+
color: "text.lighter",
|
|
56
58
|
fontSize: 14
|
|
57
59
|
},
|
|
58
|
-
color: "text.lighter",
|
|
59
|
-
gutterBottom: true,
|
|
60
60
|
children: x.method.name
|
|
61
61
|
})]
|
|
62
62
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Radio, {
|
|
@@ -6,11 +6,5 @@ type PageData = CheckoutContext & CheckoutCallbacks & {
|
|
|
6
6
|
onlyShowBtn?: boolean;
|
|
7
7
|
isDonation?: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
onlyShowBtn: boolean;
|
|
13
|
-
isDonation: boolean;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export default PaymentForm;
|
|
9
|
+
export default function PaymentForm({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, onPaid, onError, action, onlyShowBtn, isDonation, }: PageData): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -37,7 +37,7 @@ var _overDueInvoicePayment = _interopRequireDefault(require("../../components/ov
|
|
|
37
37
|
var _currency2 = require("../../libs/currency");
|
|
38
38
|
var _confirm = _interopRequireDefault(require("../../components/confirm"));
|
|
39
39
|
var _validator = require("../../libs/validator");
|
|
40
|
-
function _interopRequireDefault(
|
|
40
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
41
41
|
const waitForCheckoutComplete = async sessionId => {
|
|
42
42
|
let result;
|
|
43
43
|
await (0, _pWaitFor.default)(async () => {
|
|
@@ -97,10 +97,6 @@ const setUserFormValues = (userInfo, currentValues, setValue, options = {}) => {
|
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
|
-
PaymentForm.defaultProps = {
|
|
101
|
-
onlyShowBtn: false,
|
|
102
|
-
isDonation: false
|
|
103
|
-
};
|
|
104
100
|
function PaymentForm({
|
|
105
101
|
checkoutSession,
|
|
106
102
|
paymentMethods,
|
|
@@ -111,7 +107,7 @@ function PaymentForm({
|
|
|
111
107
|
onError,
|
|
112
108
|
// mode,
|
|
113
109
|
action,
|
|
114
|
-
onlyShowBtn,
|
|
110
|
+
onlyShowBtn = false,
|
|
115
111
|
isDonation = false
|
|
116
112
|
}) {
|
|
117
113
|
const {
|
|
@@ -158,7 +154,8 @@ function PaymentForm({
|
|
|
158
154
|
customer,
|
|
159
155
|
customerLimited: false,
|
|
160
156
|
stripePaying: false,
|
|
161
|
-
fastCheckoutInfo: null
|
|
157
|
+
fastCheckoutInfo: null,
|
|
158
|
+
creditInsufficientInfo: null
|
|
162
159
|
});
|
|
163
160
|
const currencies = (0, _util2.flattenPaymentMethods)(paymentMethods);
|
|
164
161
|
const onCheckoutComplete = (0, _ahooks.useMemoizedFn)(async ({
|
|
@@ -350,6 +347,11 @@ function PaymentForm({
|
|
|
350
347
|
fastCheckoutInfo: null
|
|
351
348
|
});
|
|
352
349
|
};
|
|
350
|
+
const handleCreditInsufficientClose = () => {
|
|
351
|
+
setState({
|
|
352
|
+
creditInsufficientInfo: null
|
|
353
|
+
});
|
|
354
|
+
};
|
|
353
355
|
const openConnect = () => {
|
|
354
356
|
try {
|
|
355
357
|
if (!["arcblock", "ethereum", "base"].includes(method.type)) {
|
|
@@ -420,7 +422,27 @@ function PaymentForm({
|
|
|
420
422
|
customerLimited: false
|
|
421
423
|
});
|
|
422
424
|
if (["arcblock", "ethereum", "base"].includes(method.type)) {
|
|
423
|
-
if (
|
|
425
|
+
if (paymentCurrency?.type === "credit") {
|
|
426
|
+
if (result.data.creditSufficient === true) {
|
|
427
|
+
setState({
|
|
428
|
+
fastCheckoutInfo: {
|
|
429
|
+
open: true,
|
|
430
|
+
loading: false,
|
|
431
|
+
sourceType: "credit",
|
|
432
|
+
amount: result.data.fastPayInfo?.amount || "0",
|
|
433
|
+
payer: result.data.fastPayInfo?.payer,
|
|
434
|
+
availableCredit: result.data.fastPayInfo?.amount || "0",
|
|
435
|
+
balance: result.data.fastPayInfo?.token?.balance || "0"
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
} else {
|
|
439
|
+
setState({
|
|
440
|
+
creditInsufficientInfo: {
|
|
441
|
+
open: true
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
} else if ((result.data.balance?.sufficient || result.data.delegation?.sufficient) && !isDonationMode && result.data.fastPayInfo) {
|
|
424
446
|
setState({
|
|
425
447
|
fastCheckoutInfo: {
|
|
426
448
|
open: true,
|
|
@@ -529,8 +551,12 @@ function PaymentForm({
|
|
|
529
551
|
const FastCheckoutConfirmDialog = state.fastCheckoutInfo && /* @__PURE__ */(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
530
552
|
onConfirm: handleFastCheckoutConfirm,
|
|
531
553
|
onCancel: handleFastCheckoutCancel,
|
|
532
|
-
title: t("payment.checkout.fastPay.title"),
|
|
533
|
-
message: /* @__PURE__ */(0, _jsxRuntime.
|
|
554
|
+
title: state.fastCheckoutInfo.sourceType === "credit" ? t("payment.checkout.fastPay.credit.title") : t("payment.checkout.fastPay.title"),
|
|
555
|
+
message: state.fastCheckoutInfo.sourceType === "credit" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
556
|
+
children: t("payment.checkout.fastPay.credit.meteringSubscriptionMessage", {
|
|
557
|
+
available: `${(0, _util.fromUnitToToken)(state.fastCheckoutInfo?.balance || "0", paymentCurrency?.decimal || 18).toString()} ${paymentCurrency?.symbol}`
|
|
558
|
+
})
|
|
559
|
+
}) : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
534
560
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
535
561
|
children: t("payment.checkout.fastPay.autoPaymentReason")
|
|
536
562
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
@@ -541,12 +567,14 @@ function PaymentForm({
|
|
|
541
567
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
542
568
|
spacing: 1,
|
|
543
569
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
570
|
+
sx: {
|
|
571
|
+
flexDirection: "row",
|
|
572
|
+
alignItems: "center",
|
|
573
|
+
justifyContent: "space-between"
|
|
574
|
+
},
|
|
547
575
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
548
|
-
color: "text.primary",
|
|
549
576
|
sx: {
|
|
577
|
+
color: "text.primary",
|
|
550
578
|
whiteSpace: "nowrap"
|
|
551
579
|
},
|
|
552
580
|
children: t("payment.checkout.fastPay.payer")
|
|
@@ -579,11 +607,15 @@ function PaymentForm({
|
|
|
579
607
|
})]
|
|
580
608
|
})]
|
|
581
609
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
610
|
+
sx: {
|
|
611
|
+
flexDirection: "row",
|
|
612
|
+
alignItems: "center",
|
|
613
|
+
justifyContent: "space-between"
|
|
614
|
+
},
|
|
585
615
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
586
|
-
|
|
616
|
+
sx: {
|
|
617
|
+
color: "text.primary"
|
|
618
|
+
},
|
|
587
619
|
children: t("payment.checkout.fastPay.amount")
|
|
588
620
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
589
621
|
children: [(0, _util.fromUnitToToken)(state.fastCheckoutInfo.amount, paymentCurrency?.decimal || 18).toString(), " ", paymentCurrency?.symbol]
|
|
@@ -594,6 +626,15 @@ function PaymentForm({
|
|
|
594
626
|
loading: state.fastCheckoutInfo.loading,
|
|
595
627
|
color: "primary"
|
|
596
628
|
});
|
|
629
|
+
const CreditInsufficientDialog = state.creditInsufficientInfo && /* @__PURE__ */(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
630
|
+
onConfirm: handleCreditInsufficientClose,
|
|
631
|
+
onCancel: handleCreditInsufficientClose,
|
|
632
|
+
title: t("payment.checkout.fastPay.credit.insufficientTitle"),
|
|
633
|
+
message: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
634
|
+
children: t("payment.checkout.fastPay.credit.insufficientMessage")
|
|
635
|
+
}),
|
|
636
|
+
confirm: t("common.confirm")
|
|
637
|
+
});
|
|
597
638
|
if (onlyShowBtn) {
|
|
598
639
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
599
640
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
@@ -644,7 +685,7 @@ function PaymentForm({
|
|
|
644
685
|
}),
|
|
645
686
|
title: t("payment.customer.pastDue.alert.title")
|
|
646
687
|
}
|
|
647
|
-
}), FastCheckoutConfirmDialog]
|
|
688
|
+
}), FastCheckoutConfirmDialog, CreditInsufficientDialog]
|
|
648
689
|
});
|
|
649
690
|
}
|
|
650
691
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -669,8 +710,10 @@ function PaymentForm({
|
|
|
669
710
|
in: true,
|
|
670
711
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
671
712
|
direction: "column",
|
|
672
|
-
alignItems: "flex-start",
|
|
673
713
|
className: "cko-payment-methods",
|
|
714
|
+
sx: {
|
|
715
|
+
alignItems: "flex-start"
|
|
716
|
+
},
|
|
674
717
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
675
718
|
direction: "row",
|
|
676
719
|
sx: {
|
|
@@ -848,6 +891,6 @@ function PaymentForm({
|
|
|
848
891
|
}),
|
|
849
892
|
title: t("payment.customer.pastDue.alert.title")
|
|
850
893
|
}
|
|
851
|
-
}), FastCheckoutConfirmDialog]
|
|
894
|
+
}), FastCheckoutConfirmDialog, CreditInsufficientDialog]
|
|
852
895
|
});
|
|
853
896
|
}
|