@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
|
@@ -15,7 +15,7 @@ var _input = _interopRequireDefault(require("../../components/input"));
|
|
|
15
15
|
var _util = require("../../libs/util");
|
|
16
16
|
var _countrySelect = _interopRequireDefault(require("../../components/country-select"));
|
|
17
17
|
var _phoneValidator = require("../../libs/phone-validator");
|
|
18
|
-
function _interopRequireDefault(
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
function PhoneInput({
|
|
20
20
|
...props
|
|
21
21
|
}) {
|
|
@@ -5,7 +5,7 @@ export type StripeCheckoutFormProps = {
|
|
|
5
5
|
customer: TCustomer;
|
|
6
6
|
mode: string;
|
|
7
7
|
onConfirm: Function;
|
|
8
|
-
returnUrl
|
|
8
|
+
returnUrl?: string;
|
|
9
9
|
};
|
|
10
10
|
export type StripeCheckoutProps = {
|
|
11
11
|
clientSecret: string;
|
|
@@ -17,10 +17,4 @@ export type StripeCheckoutProps = {
|
|
|
17
17
|
onCancel: Function;
|
|
18
18
|
returnUrl?: string;
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
declare namespace StripeCheckout {
|
|
22
|
-
var defaultProps: {
|
|
23
|
-
returnUrl: string;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export default StripeCheckout;
|
|
20
|
+
export default function StripeCheckout({ clientSecret, intentType, publicKey, mode, customer, onConfirm, onCancel, returnUrl, }: StripeCheckoutProps): import("react").JSX.Element;
|
|
@@ -14,7 +14,7 @@ var _ahooks = require("ahooks");
|
|
|
14
14
|
var _react = require("react");
|
|
15
15
|
var _mobile = require("../../../hooks/mobile");
|
|
16
16
|
var _loadingButton = _interopRequireDefault(require("../../../components/loading-button"));
|
|
17
|
-
function _interopRequireDefault(
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
const {
|
|
19
19
|
Elements,
|
|
20
20
|
PaymentElement,
|
|
@@ -104,6 +104,7 @@ function StripeCheckoutForm({
|
|
|
104
104
|
});
|
|
105
105
|
break;
|
|
106
106
|
case "requires_payment_method":
|
|
107
|
+
// 忽略该状态
|
|
107
108
|
default:
|
|
108
109
|
break;
|
|
109
110
|
}
|
|
@@ -188,7 +189,6 @@ function StripeCheckoutForm({
|
|
|
188
189
|
}, [customer, intentType, stripe, state.showBillingForm, returnUrl]
|
|
189
190
|
// eslint-disable-line
|
|
190
191
|
);
|
|
191
|
-
|
|
192
192
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(Content, {
|
|
193
193
|
onSubmit: handleSubmit,
|
|
194
194
|
children: [(!state.paymentMethod || ["link", "card"].includes(state.paymentMethod)) && /* @__PURE__ */(0, _jsxRuntime.jsx)(LinkAuthenticationElement, {
|
|
@@ -356,7 +356,4 @@ function StripeCheckout({
|
|
|
356
356
|
})
|
|
357
357
|
})
|
|
358
358
|
});
|
|
359
|
-
}
|
|
360
|
-
StripeCheckout.defaultProps = {
|
|
361
|
-
returnUrl: ""
|
|
362
|
-
};
|
|
359
|
+
}
|
package/lib/payment/header.js
CHANGED
|
@@ -11,7 +11,7 @@ var _ahooks = require("ahooks");
|
|
|
11
11
|
var _livemode = _interopRequireDefault(require("../components/livemode"));
|
|
12
12
|
var _util = require("../libs/util");
|
|
13
13
|
var _addon = _interopRequireDefault(require("./form/addon"));
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function PaymentHeader({
|
|
16
16
|
checkoutSession
|
|
17
17
|
}) {
|
|
@@ -33,12 +33,16 @@ function PaymentHeader({
|
|
|
33
33
|
className: "cko-header",
|
|
34
34
|
direction: "row",
|
|
35
35
|
spacing: 1,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
sx: {
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
justifyContent: "space-between"
|
|
39
|
+
},
|
|
38
40
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
39
41
|
direction: "row",
|
|
40
42
|
spacing: 1,
|
|
41
|
-
|
|
43
|
+
sx: {
|
|
44
|
+
alignItems: "center"
|
|
45
|
+
},
|
|
42
46
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
43
47
|
variant: "square",
|
|
44
48
|
src: window.blocklet.appLogo,
|
package/lib/payment/index.d.ts
CHANGED
|
@@ -6,16 +6,9 @@ type Props = CheckoutContext & CheckoutCallbacks & {
|
|
|
6
6
|
error?: any;
|
|
7
7
|
showCheckoutSummary?: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
declare namespace Payment {
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
completed: boolean;
|
|
13
|
-
error: null;
|
|
14
|
-
showCheckoutSummary: boolean;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export default Payment;
|
|
9
|
+
export default function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, error, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, }: Props): import("react").JSX.Element;
|
|
18
10
|
type RootProps = {
|
|
19
11
|
mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
|
|
20
12
|
} & BoxProps;
|
|
21
13
|
export declare const Root: React.FC<RootProps>;
|
|
14
|
+
export {};
|
package/lib/payment/index.js
CHANGED
|
@@ -31,19 +31,15 @@ var _mobile = require("../hooks/mobile");
|
|
|
31
31
|
var _phoneValidator = require("../libs/phone-validator");
|
|
32
32
|
var _currency = require("../libs/currency");
|
|
33
33
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
34
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
35
|
-
function _interopRequireDefault(
|
|
36
|
-
PaymentInner.defaultProps = {
|
|
37
|
-
completed: false,
|
|
38
|
-
showCheckoutSummary: true
|
|
39
|
-
};
|
|
34
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
35
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
40
36
|
function PaymentInner({
|
|
41
37
|
checkoutSession,
|
|
42
38
|
paymentMethods,
|
|
43
39
|
paymentLink,
|
|
44
40
|
paymentIntent,
|
|
45
41
|
customer,
|
|
46
|
-
completed,
|
|
42
|
+
completed = false,
|
|
47
43
|
mode,
|
|
48
44
|
onPaid,
|
|
49
45
|
onError,
|
|
@@ -200,6 +196,22 @@ function PaymentInner({
|
|
|
200
196
|
_Toast.default.error((0, _util2.formatError)(err));
|
|
201
197
|
}
|
|
202
198
|
};
|
|
199
|
+
const onQuantityChange = async (itemId, quantity) => {
|
|
200
|
+
try {
|
|
201
|
+
const {
|
|
202
|
+
data
|
|
203
|
+
} = await _api.default.put(`/api/checkout-sessions/${state.checkoutSession.id}/adjust-quantity`, {
|
|
204
|
+
itemId,
|
|
205
|
+
quantity
|
|
206
|
+
});
|
|
207
|
+
setState({
|
|
208
|
+
checkoutSession: data
|
|
209
|
+
});
|
|
210
|
+
} catch (err) {
|
|
211
|
+
console.error(err);
|
|
212
|
+
_Toast.default.error((0, _util2.formatError)(err));
|
|
213
|
+
}
|
|
214
|
+
};
|
|
203
215
|
const onCancelCrossSell = async () => {
|
|
204
216
|
try {
|
|
205
217
|
const {
|
|
@@ -266,17 +278,19 @@ function PaymentInner({
|
|
|
266
278
|
billingThreshold: Math.max(state.checkoutSession.subscription_data?.billing_threshold_amount || 0,
|
|
267
279
|
// @ts-ignore
|
|
268
280
|
state.checkoutSession.subscription_data?.min_stake_amount || 0),
|
|
269
|
-
showStaking: method
|
|
281
|
+
showStaking: (0, _util2.showStaking)(method, currency, !!state.checkoutSession.subscription_data?.no_stake),
|
|
270
282
|
currency,
|
|
271
283
|
onUpsell,
|
|
272
284
|
onDownsell,
|
|
285
|
+
onQuantityChange,
|
|
273
286
|
onApplyCrossSell,
|
|
274
287
|
onCancelCrossSell,
|
|
275
288
|
onChangeAmount,
|
|
276
289
|
checkoutSessionId: state.checkoutSession.id,
|
|
277
290
|
crossSellBehavior: state.checkoutSession.cross_sell_behavior,
|
|
278
291
|
donationSettings: paymentLink?.donation_settings,
|
|
279
|
-
action
|
|
292
|
+
action,
|
|
293
|
+
completed
|
|
280
294
|
}), mode === "standalone" && !isMobile && /* @__PURE__ */(0, _jsxRuntime.jsx)(_footer.default, {
|
|
281
295
|
className: "cko-footer",
|
|
282
296
|
sx: {
|
|
@@ -320,19 +334,14 @@ function PaymentInner({
|
|
|
320
334
|
})
|
|
321
335
|
});
|
|
322
336
|
}
|
|
323
|
-
Payment.defaultProps = {
|
|
324
|
-
completed: false,
|
|
325
|
-
error: null,
|
|
326
|
-
showCheckoutSummary: true
|
|
327
|
-
};
|
|
328
337
|
function Payment({
|
|
329
338
|
checkoutSession,
|
|
330
339
|
paymentMethods,
|
|
331
340
|
paymentIntent,
|
|
332
341
|
paymentLink,
|
|
333
342
|
customer,
|
|
334
|
-
completed,
|
|
335
|
-
error,
|
|
343
|
+
completed = false,
|
|
344
|
+
error = null,
|
|
336
345
|
mode,
|
|
337
346
|
onPaid,
|
|
338
347
|
onError,
|
|
@@ -426,9 +435,9 @@ function Payment({
|
|
|
426
435
|
});
|
|
427
436
|
};
|
|
428
437
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
429
|
-
display: "flex",
|
|
430
|
-
flexDirection: "column",
|
|
431
438
|
sx: {
|
|
439
|
+
display: "flex",
|
|
440
|
+
flexDirection: "column",
|
|
432
441
|
height: mode === "standalone" ? "100vh" : "auto",
|
|
433
442
|
overflow: isMobileSafariEnv ? "visible" : "hidden"
|
|
434
443
|
},
|
|
@@ -7,14 +7,5 @@ type Props = {
|
|
|
7
7
|
extra?: React.ReactNode;
|
|
8
8
|
variant?: LiteralUnion<'square' | 'rounded' | 'circular', string>;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var defaultProps: {
|
|
13
|
-
logo: string;
|
|
14
|
-
size: number;
|
|
15
|
-
description: string;
|
|
16
|
-
variant: string;
|
|
17
|
-
extra: undefined;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export default ProductCard;
|
|
10
|
+
export default function ProductCard({ size, variant, name, logo, description, extra, }: Props): import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -7,12 +7,12 @@ module.exports = ProductCard;
|
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
var _material = require("@mui/material");
|
|
9
9
|
function ProductCard({
|
|
10
|
-
size,
|
|
11
|
-
variant,
|
|
10
|
+
size = 48,
|
|
11
|
+
variant = "rounded",
|
|
12
12
|
name,
|
|
13
|
-
logo,
|
|
14
|
-
description,
|
|
15
|
-
extra
|
|
13
|
+
logo = "",
|
|
14
|
+
description = "",
|
|
15
|
+
extra = void 0
|
|
16
16
|
}) {
|
|
17
17
|
const s = {
|
|
18
18
|
width: size,
|
|
@@ -20,10 +20,10 @@ function ProductCard({
|
|
|
20
20
|
};
|
|
21
21
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
22
22
|
direction: "row",
|
|
23
|
-
alignItems: "center",
|
|
24
23
|
spacing: 1,
|
|
25
|
-
flex: 2,
|
|
26
24
|
sx: {
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
flex: 2,
|
|
27
27
|
width: "100%"
|
|
28
28
|
},
|
|
29
29
|
children: [logo ?
|
|
@@ -43,9 +43,9 @@ function ProductCard({
|
|
|
43
43
|
children: (name || "?").slice(0, 1)
|
|
44
44
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
45
45
|
direction: "column",
|
|
46
|
-
alignItems: "flex-start",
|
|
47
|
-
justifyContent: "space-around",
|
|
48
46
|
sx: {
|
|
47
|
+
alignItems: "flex-start",
|
|
48
|
+
justifyContent: "space-around",
|
|
49
49
|
flexShrink: 1,
|
|
50
50
|
overflow: "hidden"
|
|
51
51
|
},
|
|
@@ -54,38 +54,31 @@ function ProductCard({
|
|
|
54
54
|
variant: "body1",
|
|
55
55
|
title: name,
|
|
56
56
|
sx: {
|
|
57
|
+
color: "text.primary",
|
|
57
58
|
fontWeight: 500,
|
|
58
59
|
mb: 0.5,
|
|
59
60
|
lineHeight: 1.2,
|
|
60
61
|
fontSize: 16
|
|
61
62
|
},
|
|
62
|
-
color: "text.primary",
|
|
63
63
|
children: name
|
|
64
64
|
}), description && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
65
65
|
variant: "body1",
|
|
66
66
|
title: description,
|
|
67
67
|
sx: {
|
|
68
|
+
color: "text.lighter",
|
|
68
69
|
fontSize: "0.74375rem",
|
|
69
70
|
mb: 0.5,
|
|
70
71
|
lineHeight: 1.2,
|
|
71
72
|
textAlign: "left"
|
|
72
73
|
},
|
|
73
|
-
color: "text.lighter",
|
|
74
74
|
children: description
|
|
75
75
|
}), extra && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
76
76
|
sx: {
|
|
77
|
+
color: "text.lighter",
|
|
77
78
|
fontSize: "0.74375rem"
|
|
78
79
|
},
|
|
79
|
-
color: "text.lighter",
|
|
80
80
|
children: extra
|
|
81
81
|
})]
|
|
82
82
|
})]
|
|
83
83
|
});
|
|
84
|
-
}
|
|
85
|
-
ProductCard.defaultProps = {
|
|
86
|
-
logo: "",
|
|
87
|
-
size: 48,
|
|
88
|
-
description: "",
|
|
89
|
-
variant: "rounded",
|
|
90
|
-
extra: void 0
|
|
91
|
-
};
|
|
84
|
+
}
|
|
@@ -14,7 +14,7 @@ var _util = require("../libs/util");
|
|
|
14
14
|
var _payment = require("../contexts/payment");
|
|
15
15
|
var _scroll = require("../hooks/scroll");
|
|
16
16
|
var _keyboard = require("../hooks/keyboard");
|
|
17
|
-
function _interopRequireDefault(
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
const DONATION_PRESET_KEY_BASE = "payment-donation-preset";
|
|
19
19
|
const DONATION_CUSTOM_AMOUNT_KEY_BASE = "payment-donation-custom-amount";
|
|
20
20
|
const formatAmount = amount => {
|
|
@@ -259,22 +259,23 @@ function ProductDonation({
|
|
|
259
259
|
};
|
|
260
260
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
261
261
|
ref: containerRef,
|
|
262
|
-
display: "flex",
|
|
263
|
-
flexDirection: "column",
|
|
264
|
-
alignItems: "flex-start",
|
|
265
|
-
gap: 1.5,
|
|
266
262
|
onKeyDown: handleKeyDown,
|
|
267
263
|
tabIndex: 0,
|
|
268
264
|
sx: {
|
|
265
|
+
display: "flex",
|
|
266
|
+
flexDirection: "column",
|
|
267
|
+
alignItems: "flex-start",
|
|
268
|
+
gap: 1.5,
|
|
269
269
|
outline: "none"
|
|
270
270
|
},
|
|
271
271
|
children: [supportPreset && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
272
272
|
container: true,
|
|
273
273
|
spacing: 2,
|
|
274
274
|
children: [presets.map(amount => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
size: {
|
|
276
|
+
xs: 6,
|
|
277
|
+
sm: 3
|
|
278
|
+
},
|
|
278
279
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Card, {
|
|
279
280
|
variant: "outlined",
|
|
280
281
|
className: "tab-navigable-card",
|
|
@@ -302,13 +303,13 @@ function ProductDonation({
|
|
|
302
303
|
"aria-selected": formatAmount(state.selected) === formatAmount(amount) && !state.custom,
|
|
303
304
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
304
305
|
direction: "row",
|
|
306
|
+
spacing: 0.5,
|
|
305
307
|
sx: {
|
|
308
|
+
alignItems: "center",
|
|
309
|
+
justifyContent: "center",
|
|
306
310
|
py: 1.5,
|
|
307
311
|
px: 1.5
|
|
308
312
|
},
|
|
309
|
-
spacing: 0.5,
|
|
310
|
-
alignItems: "center",
|
|
311
|
-
justifyContent: "center",
|
|
312
313
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
313
314
|
src: currency?.logo,
|
|
314
315
|
sx: {
|
|
@@ -319,26 +320,29 @@ function ProductDonation({
|
|
|
319
320
|
alt: currency?.symbol
|
|
320
321
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
321
322
|
component: "strong",
|
|
322
|
-
lineHeight: 1,
|
|
323
323
|
variant: "h3",
|
|
324
324
|
sx: {
|
|
325
|
+
lineHeight: 1,
|
|
325
326
|
fontVariantNumeric: "tabular-nums",
|
|
326
327
|
fontWeight: 400
|
|
327
328
|
},
|
|
328
329
|
children: amount
|
|
329
330
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
sx: {
|
|
332
|
+
lineHeight: 1,
|
|
333
|
+
fontSize: 14,
|
|
334
|
+
color: "text.secondary"
|
|
335
|
+
},
|
|
333
336
|
children: currency?.symbol
|
|
334
337
|
})]
|
|
335
338
|
})
|
|
336
339
|
})
|
|
337
340
|
})
|
|
338
341
|
}, amount)), supportCustom && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
+
size: {
|
|
343
|
+
xs: 6,
|
|
344
|
+
sm: 3
|
|
345
|
+
},
|
|
342
346
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Card, {
|
|
343
347
|
variant: "outlined",
|
|
344
348
|
className: "tab-navigable-card",
|
|
@@ -365,17 +369,17 @@ function ProductDonation({
|
|
|
365
369
|
"aria-selected": state.custom,
|
|
366
370
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
367
371
|
direction: "row",
|
|
372
|
+
spacing: 0.5,
|
|
368
373
|
sx: {
|
|
374
|
+
alignItems: "center",
|
|
375
|
+
justifyContent: "center",
|
|
369
376
|
py: 1.5,
|
|
370
377
|
px: 1.5
|
|
371
378
|
},
|
|
372
|
-
spacing: 0.5,
|
|
373
|
-
alignItems: "center",
|
|
374
|
-
justifyContent: "center",
|
|
375
379
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
376
380
|
variant: "h3",
|
|
377
|
-
lineHeight: 1,
|
|
378
381
|
sx: {
|
|
382
|
+
lineHeight: 1,
|
|
379
383
|
fontWeight: 400
|
|
380
384
|
},
|
|
381
385
|
children: t("common.custom")
|
|
@@ -393,49 +397,6 @@ function ProductDonation({
|
|
|
393
397
|
error: !!state.error,
|
|
394
398
|
helperText: state.error,
|
|
395
399
|
inputRef: customInputRef,
|
|
396
|
-
InputProps: {
|
|
397
|
-
endAdornment: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
398
|
-
direction: "row",
|
|
399
|
-
spacing: 0.5,
|
|
400
|
-
alignItems: "center",
|
|
401
|
-
sx: {
|
|
402
|
-
ml: 1
|
|
403
|
-
},
|
|
404
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
405
|
-
size: "small",
|
|
406
|
-
onClick: handleCustomSelect,
|
|
407
|
-
disabled: state.animating,
|
|
408
|
-
sx: {
|
|
409
|
-
mr: 0.5,
|
|
410
|
-
opacity: state.animating ? 0.5 : 1,
|
|
411
|
-
transition: "all 0.2s ease",
|
|
412
|
-
"&:hover": {
|
|
413
|
-
transform: "scale(1.2)",
|
|
414
|
-
transition: "transform 0.3s ease"
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
"aria-label": t("common.random"),
|
|
418
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_AutoAwesome.default, {
|
|
419
|
-
fontSize: "small"
|
|
420
|
-
})
|
|
421
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
422
|
-
src: currency?.logo,
|
|
423
|
-
sx: {
|
|
424
|
-
width: 16,
|
|
425
|
-
height: 16
|
|
426
|
-
},
|
|
427
|
-
alt: currency?.symbol
|
|
428
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
429
|
-
children: currency?.symbol
|
|
430
|
-
})]
|
|
431
|
-
}),
|
|
432
|
-
autoComplete: "off",
|
|
433
|
-
sx: {
|
|
434
|
-
"& input": {
|
|
435
|
-
transition: "all 0.25s ease"
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
400
|
sx: {
|
|
440
401
|
mt: defaultPreset !== "0" ? 0 : 1,
|
|
441
402
|
"& .MuiInputBase-root": {
|
|
@@ -451,8 +412,52 @@ function ProductDonation({
|
|
|
451
412
|
"& input[type=number]::-webkit-inner-spin-button": {
|
|
452
413
|
WebkitAppearance: "none",
|
|
453
414
|
margin: 0
|
|
415
|
+
},
|
|
416
|
+
"& input": {
|
|
417
|
+
transition: "all 0.25s ease"
|
|
454
418
|
}
|
|
455
|
-
}
|
|
419
|
+
},
|
|
420
|
+
slotProps: {
|
|
421
|
+
input: {
|
|
422
|
+
endAdornment: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
423
|
+
direction: "row",
|
|
424
|
+
spacing: 0.5,
|
|
425
|
+
sx: {
|
|
426
|
+
alignItems: "center",
|
|
427
|
+
ml: 1
|
|
428
|
+
},
|
|
429
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
430
|
+
size: "small",
|
|
431
|
+
onClick: handleCustomSelect,
|
|
432
|
+
disabled: state.animating,
|
|
433
|
+
sx: {
|
|
434
|
+
mr: 0.5,
|
|
435
|
+
opacity: state.animating ? 0.5 : 1,
|
|
436
|
+
transition: "all 0.2s ease",
|
|
437
|
+
"&:hover": {
|
|
438
|
+
transform: "scale(1.2)",
|
|
439
|
+
transition: "transform 0.3s ease"
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
"aria-label": t("common.random"),
|
|
443
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_AutoAwesome.default, {
|
|
444
|
+
fontSize: "small"
|
|
445
|
+
})
|
|
446
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
447
|
+
src: currency?.logo,
|
|
448
|
+
sx: {
|
|
449
|
+
width: 16,
|
|
450
|
+
height: 16
|
|
451
|
+
},
|
|
452
|
+
alt: currency?.symbol
|
|
453
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
454
|
+
children: currency?.symbol
|
|
455
|
+
})]
|
|
456
|
+
}),
|
|
457
|
+
autoComplete: "off"
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
autoComplete: "off"
|
|
456
461
|
})]
|
|
457
462
|
});
|
|
458
463
|
}
|
|
@@ -10,13 +10,13 @@ type Props = {
|
|
|
10
10
|
onDownsell: Function;
|
|
11
11
|
mode?: 'normal' | 'cross-sell';
|
|
12
12
|
children?: React.ReactNode;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
mode: string;
|
|
18
|
-
children: null;
|
|
19
|
-
trialEnd: number;
|
|
13
|
+
adjustableQuantity?: {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
minimum?: number;
|
|
16
|
+
maximum?: number;
|
|
20
17
|
};
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
onQuantityChange?: (itemId: string, quantity: number) => void;
|
|
19
|
+
completed?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export default function ProductItem({ item, items, trialInDays, trialEnd, currency, mode, children, onUpsell, onDownsell, completed, adjustableQuantity, onQuantityChange, }: Props): JSX.Element;
|
|
22
|
+
export {};
|