@blocklet/payment-react 1.25.9 → 1.26.0
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-v2/checkout-v2.d.ts +2 -0
- package/es/checkout-v2/checkout-v2.js +121 -0
- package/es/checkout-v2/components/dialogs/checkout-dialogs.d.ts +1 -0
- package/es/checkout-v2/components/dialogs/checkout-dialogs.js +106 -0
- package/es/checkout-v2/components/left/billing-toggle.d.ts +6 -0
- package/es/checkout-v2/components/left/billing-toggle.js +118 -0
- package/es/checkout-v2/components/left/cross-sell-card.d.ts +10 -0
- package/es/checkout-v2/components/left/cross-sell-card.js +167 -0
- package/es/checkout-v2/components/left/product-item-card.d.ts +26 -0
- package/es/checkout-v2/components/left/product-item-card.js +571 -0
- package/es/checkout-v2/components/left/promotion-input.d.ts +19 -0
- package/es/checkout-v2/components/left/promotion-input.js +178 -0
- package/es/checkout-v2/components/left/staking-breakdown.d.ts +9 -0
- package/es/checkout-v2/components/left/staking-breakdown.js +48 -0
- package/es/checkout-v2/components/left/trial-info.d.ts +13 -0
- package/es/checkout-v2/components/left/trial-info.js +48 -0
- package/es/checkout-v2/components/right/currency-grid.d.ts +8 -0
- package/es/checkout-v2/components/right/currency-grid.js +48 -0
- package/es/checkout-v2/components/right/customer-info-card.d.ts +17 -0
- package/es/checkout-v2/components/right/customer-info-card.js +156 -0
- package/es/checkout-v2/components/right/status-feedback.d.ts +7 -0
- package/es/checkout-v2/components/right/status-feedback.js +17 -0
- package/es/checkout-v2/components/right/submit-button.d.ts +10 -0
- package/es/checkout-v2/components/right/submit-button.js +29 -0
- package/es/checkout-v2/components/right/subscription-disclaimer.d.ts +11 -0
- package/es/checkout-v2/components/right/subscription-disclaimer.js +8 -0
- package/es/checkout-v2/components/shared/exchange-rate-footer.d.ts +23 -0
- package/es/checkout-v2/components/shared/exchange-rate-footer.js +182 -0
- package/es/checkout-v2/components/shared/scenario-badge.d.ts +6 -0
- package/es/checkout-v2/components/shared/scenario-badge.js +47 -0
- package/es/checkout-v2/components/shared/total-display.d.ts +7 -0
- package/es/checkout-v2/components/shared/total-display.js +84 -0
- package/es/checkout-v2/index.d.ts +2 -0
- package/es/checkout-v2/index.js +1 -0
- package/es/checkout-v2/layouts/checkout-layout.d.ts +7 -0
- package/es/checkout-v2/layouts/checkout-layout.js +226 -0
- package/es/checkout-v2/panels/left/composite-panel.d.ts +1 -0
- package/es/checkout-v2/panels/left/composite-panel.js +423 -0
- package/es/checkout-v2/panels/left/credit-topup-panel.d.ts +1 -0
- package/es/checkout-v2/panels/left/credit-topup-panel.js +615 -0
- package/es/checkout-v2/panels/left/scenario-router.d.ts +1 -0
- package/es/checkout-v2/panels/left/scenario-router.js +19 -0
- package/es/checkout-v2/panels/right/payment-panel.d.ts +1 -0
- package/es/checkout-v2/panels/right/payment-panel.js +644 -0
- package/es/checkout-v2/types.d.ts +15 -0
- package/es/checkout-v2/types.js +0 -0
- package/es/checkout-v2/utils/format.d.ts +59 -0
- package/es/checkout-v2/utils/format.js +125 -0
- package/es/checkout-v2/utils/scenario-detector.d.ts +3 -0
- package/es/checkout-v2/utils/scenario-detector.js +17 -0
- package/es/checkout-v2/views/error-view.d.ts +7 -0
- package/es/checkout-v2/views/error-view.js +269 -0
- package/es/checkout-v2/views/loading-view.d.ts +5 -0
- package/es/checkout-v2/views/loading-view.js +158 -0
- package/es/checkout-v2/views/success-view.d.ts +29 -0
- package/es/checkout-v2/views/success-view.js +614 -0
- package/es/components/phone-field.d.ts +14 -0
- package/es/components/phone-field.js +96 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/locales/en.js +45 -6
- package/es/locales/zh.js +45 -6
- package/es/payment/form/index.js +10 -1
- package/lib/checkout-v2/checkout-v2.d.ts +2 -0
- package/lib/checkout-v2/checkout-v2.js +151 -0
- package/lib/checkout-v2/components/dialogs/checkout-dialogs.d.ts +1 -0
- package/lib/checkout-v2/components/dialogs/checkout-dialogs.js +131 -0
- package/lib/checkout-v2/components/left/billing-toggle.d.ts +6 -0
- package/lib/checkout-v2/components/left/billing-toggle.js +126 -0
- package/lib/checkout-v2/components/left/cross-sell-card.d.ts +10 -0
- package/lib/checkout-v2/components/left/cross-sell-card.js +257 -0
- package/lib/checkout-v2/components/left/product-item-card.d.ts +26 -0
- package/lib/checkout-v2/components/left/product-item-card.js +738 -0
- package/lib/checkout-v2/components/left/promotion-input.d.ts +19 -0
- package/lib/checkout-v2/components/left/promotion-input.js +220 -0
- package/lib/checkout-v2/components/left/staking-breakdown.d.ts +9 -0
- package/lib/checkout-v2/components/left/staking-breakdown.js +96 -0
- package/lib/checkout-v2/components/left/trial-info.d.ts +13 -0
- package/lib/checkout-v2/components/left/trial-info.js +82 -0
- package/lib/checkout-v2/components/right/currency-grid.d.ts +8 -0
- package/lib/checkout-v2/components/right/currency-grid.js +96 -0
- package/lib/checkout-v2/components/right/customer-info-card.d.ts +17 -0
- package/lib/checkout-v2/components/right/customer-info-card.js +246 -0
- package/lib/checkout-v2/components/right/status-feedback.d.ts +7 -0
- package/lib/checkout-v2/components/right/status-feedback.js +30 -0
- package/lib/checkout-v2/components/right/submit-button.d.ts +10 -0
- package/lib/checkout-v2/components/right/submit-button.js +35 -0
- package/lib/checkout-v2/components/right/subscription-disclaimer.d.ts +11 -0
- package/lib/checkout-v2/components/right/subscription-disclaimer.js +33 -0
- package/lib/checkout-v2/components/shared/exchange-rate-footer.d.ts +23 -0
- package/lib/checkout-v2/components/shared/exchange-rate-footer.js +282 -0
- package/lib/checkout-v2/components/shared/scenario-badge.d.ts +6 -0
- package/lib/checkout-v2/components/shared/scenario-badge.js +57 -0
- package/lib/checkout-v2/components/shared/total-display.d.ts +7 -0
- package/lib/checkout-v2/components/shared/total-display.js +154 -0
- package/lib/checkout-v2/index.d.ts +2 -0
- package/lib/checkout-v2/index.js +13 -0
- package/lib/checkout-v2/layouts/checkout-layout.d.ts +7 -0
- package/lib/checkout-v2/layouts/checkout-layout.js +308 -0
- package/lib/checkout-v2/panels/left/composite-panel.d.ts +1 -0
- package/lib/checkout-v2/panels/left/composite-panel.js +515 -0
- package/lib/checkout-v2/panels/left/credit-topup-panel.d.ts +1 -0
- package/lib/checkout-v2/panels/left/credit-topup-panel.js +799 -0
- package/lib/checkout-v2/panels/left/scenario-router.d.ts +1 -0
- package/lib/checkout-v2/panels/left/scenario-router.js +29 -0
- package/lib/checkout-v2/panels/right/payment-panel.d.ts +1 -0
- package/lib/checkout-v2/panels/right/payment-panel.js +906 -0
- package/lib/checkout-v2/types.d.ts +15 -0
- package/lib/checkout-v2/types.js +1 -0
- package/lib/checkout-v2/utils/format.d.ts +59 -0
- package/lib/checkout-v2/utils/format.js +158 -0
- package/lib/checkout-v2/utils/scenario-detector.d.ts +3 -0
- package/lib/checkout-v2/utils/scenario-detector.js +23 -0
- package/lib/checkout-v2/views/error-view.d.ts +7 -0
- package/lib/checkout-v2/views/error-view.js +321 -0
- package/lib/checkout-v2/views/loading-view.d.ts +5 -0
- package/lib/checkout-v2/views/loading-view.js +168 -0
- package/lib/checkout-v2/views/success-view.d.ts +29 -0
- package/lib/checkout-v2/views/success-view.js +735 -0
- package/lib/components/phone-field.d.ts +14 -0
- package/lib/components/phone-field.js +130 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.js +8 -0
- package/lib/locales/en.js +45 -6
- package/lib/locales/zh.js +45 -6
- package/lib/payment/form/index.js +10 -1
- package/package.json +10 -9
- package/src/checkout-v2/checkout-v2.tsx +155 -0
- package/src/checkout-v2/components/dialogs/checkout-dialogs.tsx +134 -0
- package/src/checkout-v2/components/left/billing-toggle.tsx +122 -0
- package/src/checkout-v2/components/left/cross-sell-card.tsx +170 -0
- package/src/checkout-v2/components/left/product-item-card.tsx +634 -0
- package/src/checkout-v2/components/left/promotion-input.tsx +207 -0
- package/src/checkout-v2/components/left/staking-breakdown.tsx +57 -0
- package/src/checkout-v2/components/left/trial-info.tsx +63 -0
- package/src/checkout-v2/components/right/currency-grid.tsx +59 -0
- package/src/checkout-v2/components/right/customer-info-card.tsx +214 -0
- package/src/checkout-v2/components/right/status-feedback.tsx +35 -0
- package/src/checkout-v2/components/right/submit-button.tsx +37 -0
- package/src/checkout-v2/components/right/subscription-disclaimer.tsx +27 -0
- package/src/checkout-v2/components/shared/exchange-rate-footer.tsx +221 -0
- package/src/checkout-v2/components/shared/scenario-badge.tsx +51 -0
- package/src/checkout-v2/components/shared/total-display.tsx +112 -0
- package/src/checkout-v2/index.ts +2 -0
- package/src/checkout-v2/layouts/checkout-layout.tsx +232 -0
- package/src/checkout-v2/panels/left/composite-panel.tsx +465 -0
- package/src/checkout-v2/panels/left/credit-topup-panel.tsx +681 -0
- package/src/checkout-v2/panels/left/scenario-router.tsx +22 -0
- package/src/checkout-v2/panels/right/payment-panel.tsx +703 -0
- package/src/checkout-v2/types.ts +18 -0
- package/src/checkout-v2/utils/format.ts +204 -0
- package/src/checkout-v2/utils/scenario-detector.ts +30 -0
- package/src/checkout-v2/views/error-view.tsx +293 -0
- package/src/checkout-v2/views/loading-view.tsx +162 -0
- package/src/checkout-v2/views/success-view.tsx +770 -0
- package/src/components/phone-field.tsx +119 -0
- package/src/index.ts +3 -0
- package/src/locales/en.tsx +45 -4
- package/src/locales/zh.tsx +43 -4
- package/src/payment/form/index.tsx +16 -1
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = PaymentPanel;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _ArrowForward = _interopRequireDefault(require("@mui/icons-material/ArrowForward"));
|
|
10
|
+
var _CreditCard = _interopRequireDefault(require("@mui/icons-material/CreditCard"));
|
|
11
|
+
var _CurrencyBitcoin = _interopRequireDefault(require("@mui/icons-material/CurrencyBitcoin"));
|
|
12
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
13
|
+
var _HelpOutline = _interopRequireDefault(require("@mui/icons-material/HelpOutline"));
|
|
14
|
+
var _LocalOfferOutlined = _interopRequireDefault(require("@mui/icons-material/LocalOfferOutlined"));
|
|
15
|
+
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
16
|
+
var _LockOutlined = _interopRequireDefault(require("@mui/icons-material/LockOutlined"));
|
|
17
|
+
var _material = require("@mui/material");
|
|
18
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
19
|
+
var _paymentReactHeadless = require("@blocklet/payment-react-headless");
|
|
20
|
+
var _ufo = require("ufo");
|
|
21
|
+
var _payment = require("../../../contexts/payment");
|
|
22
|
+
var _mobile = require("../../../hooks/mobile");
|
|
23
|
+
var _util = require("../../../libs/util");
|
|
24
|
+
var _overDueInvoicePayment = _interopRequireDefault(require("../../../components/over-due-invoice-payment"));
|
|
25
|
+
var _format = require("../../utils/format");
|
|
26
|
+
var _customerInfoCard = _interopRequireDefault(require("../../components/right/customer-info-card"));
|
|
27
|
+
var _subscriptionDisclaimer = _interopRequireDefault(require("../../components/right/subscription-disclaimer"));
|
|
28
|
+
var _statusFeedback = _interopRequireDefault(require("../../components/right/status-feedback"));
|
|
29
|
+
var _promotionInput = _interopRequireDefault(require("../../components/left/promotion-input"));
|
|
30
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
31
|
+
function PaymentPanel() {
|
|
32
|
+
const {
|
|
33
|
+
t,
|
|
34
|
+
locale
|
|
35
|
+
} = (0, _context.useLocaleContext)();
|
|
36
|
+
const {
|
|
37
|
+
session,
|
|
38
|
+
sessionData,
|
|
39
|
+
subscription,
|
|
40
|
+
refresh
|
|
41
|
+
} = (0, _paymentReactHeadless.useSessionContext)();
|
|
42
|
+
const {
|
|
43
|
+
isDonation
|
|
44
|
+
} = (0, _paymentReactHeadless.useCheckoutStatus)();
|
|
45
|
+
const paymentMethod = (0, _paymentReactHeadless.usePaymentMethodFeature)();
|
|
46
|
+
const form = (0, _paymentReactHeadless.useCustomerFormFeature)();
|
|
47
|
+
const submit = (0, _paymentReactHeadless.useSubmitFeature)();
|
|
48
|
+
const pricing = (0, _paymentReactHeadless.usePricingFeature)();
|
|
49
|
+
const {
|
|
50
|
+
session: didSession,
|
|
51
|
+
connect,
|
|
52
|
+
prefix: paymentKitPrefix
|
|
53
|
+
} = (0, _payment.usePaymentContext)();
|
|
54
|
+
const {
|
|
55
|
+
inventoryOk
|
|
56
|
+
} = (0, _paymentReactHeadless.useLineItems)();
|
|
57
|
+
const promotion = (0, _paymentReactHeadless.usePromotion)();
|
|
58
|
+
const rate = (0, _paymentReactHeadless.useExchangeRate)();
|
|
59
|
+
const {
|
|
60
|
+
isMobile
|
|
61
|
+
} = (0, _mobile.useMobile)();
|
|
62
|
+
const isAmountLoading = paymentMethod.switching || rate.hasDynamicPricing && rate.status === "loading";
|
|
63
|
+
const {
|
|
64
|
+
currency,
|
|
65
|
+
types,
|
|
66
|
+
isStripe,
|
|
67
|
+
isCrypto
|
|
68
|
+
} = paymentMethod;
|
|
69
|
+
const mode = session?.mode || "payment";
|
|
70
|
+
const discounts = session?.discounts || [];
|
|
71
|
+
const isLoggedIn = !!didSession?.user;
|
|
72
|
+
const actionLabel = isDonation ? t("payment.checkout.donate") : t(`payment.checkout.${mode}`);
|
|
73
|
+
const buttonLabel = isLoggedIn ? actionLabel : t("payment.checkout.connect", {
|
|
74
|
+
action: actionLabel
|
|
75
|
+
});
|
|
76
|
+
const [customerLimited, setCustomerLimited] = (0, _react.useState)(false);
|
|
77
|
+
const [mobileDetailsOpen, setMobileDetailsOpen] = (0, _react.useState)(false);
|
|
78
|
+
const [promoDrawerOpen, setPromoDrawerOpen] = (0, _react.useState)(false);
|
|
79
|
+
(0, _react.useEffect)(() => {
|
|
80
|
+
if (submit.status === "failed" && submit.context?.code === "CUSTOMER_LIMITED") {
|
|
81
|
+
setCustomerLimited(true);
|
|
82
|
+
}
|
|
83
|
+
}, [submit.status, submit.context]);
|
|
84
|
+
const canSubmit = submit.status === "idle" && session?.status === "open" && inventoryOk;
|
|
85
|
+
const isProcessing = ["submitting", "waiting_did"].includes(submit.status);
|
|
86
|
+
const handleAction = (0, _react.useCallback)(() => {
|
|
87
|
+
if (!canSubmit) return;
|
|
88
|
+
submit.lock();
|
|
89
|
+
if (isLoggedIn || isDonation) {
|
|
90
|
+
submit.execute();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
didSession?.login?.(() => {
|
|
94
|
+
Promise.all([refresh(true), form.refetchCustomer()]).then(() => submit.execute()).catch(err => {
|
|
95
|
+
console.error("Post-login refresh failed:", err);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}, [canSubmit, isLoggedIn, isDonation, didSession, refresh, form, submit]);
|
|
99
|
+
(0, _react.useEffect)(() => {
|
|
100
|
+
if (didSession?.user && !submit.status.startsWith("submitting")) {
|
|
101
|
+
form.refetchCustomer();
|
|
102
|
+
}
|
|
103
|
+
}, [didSession?.user]);
|
|
104
|
+
const cryptoType = types.find(tp => tp.type === "crypto");
|
|
105
|
+
const cryptoMethods = (0, _react.useMemo)(() => paymentMethod.available.filter(m => m.type !== "stripe"), [paymentMethod.available]);
|
|
106
|
+
const networks = (0, _react.useMemo)(() => {
|
|
107
|
+
if (!cryptoMethods.length) return [];
|
|
108
|
+
return cryptoMethods.map(m => ({
|
|
109
|
+
id: m.id,
|
|
110
|
+
name: m.name,
|
|
111
|
+
logo: m.logo || "",
|
|
112
|
+
currencies: m.payment_currencies || []
|
|
113
|
+
}));
|
|
114
|
+
}, [cryptoMethods]);
|
|
115
|
+
const currentMethodId = paymentMethod.current?.id || "";
|
|
116
|
+
(0, _react.useEffect)(() => {
|
|
117
|
+
const handleKeyDown = e => {
|
|
118
|
+
if (e.key === "Enter" && canSubmit && submit.status === "idle") {
|
|
119
|
+
const tag = e.target?.tagName?.toLowerCase();
|
|
120
|
+
if (tag === "textarea") return;
|
|
121
|
+
handleAction();
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
125
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
126
|
+
}, [canSubmit, submit.status, handleAction]);
|
|
127
|
+
const didConnectOpenedRef = (0, _react.useRef)(false);
|
|
128
|
+
(0, _react.useEffect)(() => {
|
|
129
|
+
if (submit.status !== "waiting_did") {
|
|
130
|
+
didConnectOpenedRef.current = false;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const ctx = submit.context;
|
|
134
|
+
if (ctx?.type !== "did_connect" || !connect) return;
|
|
135
|
+
if (didConnectOpenedRef.current) return;
|
|
136
|
+
didConnectOpenedRef.current = true;
|
|
137
|
+
const didPrefix = `${paymentKitPrefix}/api/did`.replace(/([^:])\/\//g, "$1/");
|
|
138
|
+
connect.open({
|
|
139
|
+
locale,
|
|
140
|
+
action: ctx.action,
|
|
141
|
+
prefix: didPrefix,
|
|
142
|
+
saveConnect: false,
|
|
143
|
+
extraParams: ctx.extraParams,
|
|
144
|
+
onSuccess: () => {
|
|
145
|
+
connect.close();
|
|
146
|
+
},
|
|
147
|
+
onClose: () => {
|
|
148
|
+
connect.close();
|
|
149
|
+
submit.reset();
|
|
150
|
+
},
|
|
151
|
+
onError: err => {
|
|
152
|
+
console.error("DID Connect error:", err);
|
|
153
|
+
submit.reset();
|
|
154
|
+
},
|
|
155
|
+
messages: {
|
|
156
|
+
title: t("payment.checkout.connectModal.title", {
|
|
157
|
+
action: buttonLabel
|
|
158
|
+
}),
|
|
159
|
+
scan: t("payment.checkout.connectModal.scan"),
|
|
160
|
+
confirm: t("payment.checkout.connectModal.confirm")
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}, [submit.status, submit.context, connect, locale, t, buttonLabel]);
|
|
164
|
+
const activeType = types.find(tp => tp.active)?.type || "crypto";
|
|
165
|
+
const hasMultipleTypes = types.length > 1;
|
|
166
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
167
|
+
sx: {
|
|
168
|
+
display: "flex",
|
|
169
|
+
flexDirection: "column",
|
|
170
|
+
flex: 1,
|
|
171
|
+
minHeight: 0
|
|
172
|
+
},
|
|
173
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
174
|
+
sx: {
|
|
175
|
+
flex: 1,
|
|
176
|
+
display: "flex",
|
|
177
|
+
flexDirection: "column",
|
|
178
|
+
overflowY: "auto",
|
|
179
|
+
minHeight: 0,
|
|
180
|
+
"&::-webkit-scrollbar": {
|
|
181
|
+
display: "none"
|
|
182
|
+
},
|
|
183
|
+
scrollbarWidth: "none"
|
|
184
|
+
},
|
|
185
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
186
|
+
sx: {
|
|
187
|
+
fontSize: 13,
|
|
188
|
+
fontWeight: 700,
|
|
189
|
+
letterSpacing: "0.02em",
|
|
190
|
+
color: "text.primary",
|
|
191
|
+
mb: 2.5
|
|
192
|
+
},
|
|
193
|
+
children: t("payment.checkout.paymentDetails")
|
|
194
|
+
}), hasMultipleTypes && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.ToggleButtonGroup, {
|
|
195
|
+
value: activeType,
|
|
196
|
+
exclusive: true,
|
|
197
|
+
onChange: (_, v) => v && paymentMethod.setType(v),
|
|
198
|
+
fullWidth: true,
|
|
199
|
+
size: "small",
|
|
200
|
+
sx: {
|
|
201
|
+
mb: 2.5,
|
|
202
|
+
bgcolor: theme => theme.palette.mode === "dark" ? "rgba(255,255,255,0.06)" : "grey.100",
|
|
203
|
+
borderRadius: "10px",
|
|
204
|
+
p: 0.5,
|
|
205
|
+
"& .MuiToggleButton-root": {
|
|
206
|
+
textTransform: "none",
|
|
207
|
+
borderRadius: "8px !important",
|
|
208
|
+
py: 0.75,
|
|
209
|
+
border: "none",
|
|
210
|
+
fontSize: 14,
|
|
211
|
+
fontWeight: 500,
|
|
212
|
+
gap: 0.75,
|
|
213
|
+
color: "text.secondary"
|
|
214
|
+
},
|
|
215
|
+
"& .Mui-selected": {
|
|
216
|
+
bgcolor: "background.paper !important",
|
|
217
|
+
color: "text.primary",
|
|
218
|
+
fontWeight: 600,
|
|
219
|
+
boxShadow: theme => theme.palette.mode === "dark" ? "0 1px 3px rgba(0,0,0,0.3)" : "0 1px 3px rgba(0,0,0,0.08)",
|
|
220
|
+
"&:hover": {
|
|
221
|
+
bgcolor: "background.paper !important"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
children: types.map(tp => /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.ToggleButton, {
|
|
226
|
+
value: tp.type,
|
|
227
|
+
children: [tp.type === "stripe" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_CreditCard.default, {
|
|
228
|
+
sx: {
|
|
229
|
+
fontSize: 18
|
|
230
|
+
}
|
|
231
|
+
}) : /* @__PURE__ */(0, _jsxRuntime.jsx)(_CurrencyBitcoin.default, {
|
|
232
|
+
sx: {
|
|
233
|
+
fontSize: 18
|
|
234
|
+
}
|
|
235
|
+
}), tp.label || (tp.type === "stripe" ? "Card" : "Crypto")]
|
|
236
|
+
}, tp.type))
|
|
237
|
+
}), isCrypto && networks.length > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
238
|
+
direction: "row",
|
|
239
|
+
spacing: 1.5,
|
|
240
|
+
sx: {
|
|
241
|
+
mb: 2.5
|
|
242
|
+
},
|
|
243
|
+
children: [networks.length > 1 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
244
|
+
sx: {
|
|
245
|
+
flex: 1
|
|
246
|
+
},
|
|
247
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
248
|
+
sx: {
|
|
249
|
+
fontSize: 12,
|
|
250
|
+
fontWeight: 600,
|
|
251
|
+
color: "text.secondary",
|
|
252
|
+
mb: 0.5,
|
|
253
|
+
letterSpacing: "0.02em"
|
|
254
|
+
},
|
|
255
|
+
children: t("common.network")
|
|
256
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Select, {
|
|
257
|
+
value: currentMethodId,
|
|
258
|
+
onChange: e => {
|
|
259
|
+
const network = networks.find(n => n.id === e.target.value);
|
|
260
|
+
if (network?.currencies?.[0]) {
|
|
261
|
+
paymentMethod.setCurrency(network.currencies[0].id);
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
fullWidth: true,
|
|
265
|
+
size: "small",
|
|
266
|
+
sx: {
|
|
267
|
+
borderRadius: "8px",
|
|
268
|
+
bgcolor: theme => theme.palette.mode === "dark" ? "rgba(255,255,255,0.06)" : "grey.50",
|
|
269
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
270
|
+
borderColor: "transparent"
|
|
271
|
+
},
|
|
272
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
273
|
+
borderColor: "divider"
|
|
274
|
+
},
|
|
275
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
276
|
+
borderColor: "primary.main",
|
|
277
|
+
borderWidth: 1
|
|
278
|
+
},
|
|
279
|
+
"& .MuiSelect-select": {
|
|
280
|
+
display: "flex",
|
|
281
|
+
alignItems: "center",
|
|
282
|
+
gap: 1,
|
|
283
|
+
py: 1
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
children: networks.map(net => /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
287
|
+
value: net.id,
|
|
288
|
+
sx: {
|
|
289
|
+
gap: 1
|
|
290
|
+
},
|
|
291
|
+
children: [net.logo && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
292
|
+
src: net.logo,
|
|
293
|
+
sx: {
|
|
294
|
+
width: 20,
|
|
295
|
+
height: 20
|
|
296
|
+
}
|
|
297
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
298
|
+
sx: {
|
|
299
|
+
fontSize: 14
|
|
300
|
+
},
|
|
301
|
+
children: net.name
|
|
302
|
+
})]
|
|
303
|
+
}, net.id))
|
|
304
|
+
})]
|
|
305
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
306
|
+
sx: {
|
|
307
|
+
flex: 1
|
|
308
|
+
},
|
|
309
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
310
|
+
sx: {
|
|
311
|
+
fontSize: 12,
|
|
312
|
+
fontWeight: 600,
|
|
313
|
+
color: "text.secondary",
|
|
314
|
+
mb: 0.5,
|
|
315
|
+
letterSpacing: "0.02em"
|
|
316
|
+
},
|
|
317
|
+
children: t("common.currency")
|
|
318
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Select, {
|
|
319
|
+
value: currency?.id || "",
|
|
320
|
+
onChange: e => paymentMethod.setCurrency(e.target.value),
|
|
321
|
+
fullWidth: true,
|
|
322
|
+
size: "small",
|
|
323
|
+
sx: {
|
|
324
|
+
borderRadius: "8px",
|
|
325
|
+
bgcolor: theme => theme.palette.mode === "dark" ? "rgba(255,255,255,0.06)" : "grey.50",
|
|
326
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
327
|
+
borderColor: "transparent"
|
|
328
|
+
},
|
|
329
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
330
|
+
borderColor: "divider"
|
|
331
|
+
},
|
|
332
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
333
|
+
borderColor: "primary.main",
|
|
334
|
+
borderWidth: 1
|
|
335
|
+
},
|
|
336
|
+
"& .MuiSelect-select": {
|
|
337
|
+
display: "flex",
|
|
338
|
+
alignItems: "center",
|
|
339
|
+
gap: 1,
|
|
340
|
+
py: 1
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
children: (isCrypto && networks.length > 1 ? networks.find(n => n.id === currentMethodId)?.currencies || [] : cryptoType?.currencies || []).map(cur => /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
344
|
+
value: cur.id,
|
|
345
|
+
sx: {
|
|
346
|
+
gap: 1
|
|
347
|
+
},
|
|
348
|
+
children: [cur.logo && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
349
|
+
src: cur.logo,
|
|
350
|
+
sx: {
|
|
351
|
+
width: 20,
|
|
352
|
+
height: 20
|
|
353
|
+
}
|
|
354
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
355
|
+
sx: {
|
|
356
|
+
fontSize: 14
|
|
357
|
+
},
|
|
358
|
+
children: cur.symbol
|
|
359
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
360
|
+
sx: {
|
|
361
|
+
fontSize: 12,
|
|
362
|
+
color: "text.secondary",
|
|
363
|
+
ml: 0.5
|
|
364
|
+
},
|
|
365
|
+
children: cur.name
|
|
366
|
+
})]
|
|
367
|
+
}, cur.id))
|
|
368
|
+
})]
|
|
369
|
+
})]
|
|
370
|
+
}), isStripe && currency && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
371
|
+
sx: {
|
|
372
|
+
mb: 2.5
|
|
373
|
+
},
|
|
374
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
375
|
+
sx: {
|
|
376
|
+
fontSize: 12,
|
|
377
|
+
fontWeight: 600,
|
|
378
|
+
color: "text.secondary",
|
|
379
|
+
mb: 0.5,
|
|
380
|
+
letterSpacing: "0.02em"
|
|
381
|
+
},
|
|
382
|
+
children: t("common.currency")
|
|
383
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Select, {
|
|
384
|
+
value: currency.id || "usd",
|
|
385
|
+
readOnly: true,
|
|
386
|
+
fullWidth: true,
|
|
387
|
+
size: "small",
|
|
388
|
+
IconComponent: () => null,
|
|
389
|
+
sx: {
|
|
390
|
+
borderRadius: "8px",
|
|
391
|
+
bgcolor: theme => theme.palette.mode === "dark" ? "rgba(255,255,255,0.06)" : "grey.50",
|
|
392
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
393
|
+
borderColor: "transparent !important"
|
|
394
|
+
},
|
|
395
|
+
"& .MuiSelect-select": {
|
|
396
|
+
display: "flex",
|
|
397
|
+
alignItems: "center",
|
|
398
|
+
gap: 1,
|
|
399
|
+
py: 1
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
403
|
+
value: currency.id || "usd",
|
|
404
|
+
sx: {
|
|
405
|
+
gap: 1
|
|
406
|
+
},
|
|
407
|
+
children: [currency.logo && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
408
|
+
src: currency.logo,
|
|
409
|
+
sx: {
|
|
410
|
+
width: 20,
|
|
411
|
+
height: 20
|
|
412
|
+
}
|
|
413
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
414
|
+
sx: {
|
|
415
|
+
fontSize: 14,
|
|
416
|
+
fontWeight: 600
|
|
417
|
+
},
|
|
418
|
+
children: currency.symbol
|
|
419
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
420
|
+
sx: {
|
|
421
|
+
fontSize: 12,
|
|
422
|
+
color: "text.secondary",
|
|
423
|
+
ml: 0.5
|
|
424
|
+
},
|
|
425
|
+
children: currency.name
|
|
426
|
+
})]
|
|
427
|
+
})
|
|
428
|
+
})]
|
|
429
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_customerInfoCard.default, {
|
|
430
|
+
form,
|
|
431
|
+
isLoggedIn
|
|
432
|
+
})]
|
|
433
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
434
|
+
className: "cko-v2-submit-btn",
|
|
435
|
+
sx: {
|
|
436
|
+
flexShrink: 0
|
|
437
|
+
},
|
|
438
|
+
children: [isMobile && pricing.staking && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
439
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
440
|
+
onClick: () => setMobileDetailsOpen(!mobileDetailsOpen),
|
|
441
|
+
sx: {
|
|
442
|
+
display: "flex",
|
|
443
|
+
alignItems: "center",
|
|
444
|
+
justifyContent: "space-between",
|
|
445
|
+
cursor: "pointer",
|
|
446
|
+
mb: 1
|
|
447
|
+
},
|
|
448
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
449
|
+
sx: {
|
|
450
|
+
fontSize: 13,
|
|
451
|
+
fontWeight: 600,
|
|
452
|
+
color: "text.secondary"
|
|
453
|
+
},
|
|
454
|
+
children: t("payment.checkout.orderSummary")
|
|
455
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
456
|
+
sx: {
|
|
457
|
+
fontSize: 18,
|
|
458
|
+
color: "text.secondary",
|
|
459
|
+
transition: "0.2s",
|
|
460
|
+
transform: mobileDetailsOpen ? "rotate(180deg)" : "rotate(0deg)"
|
|
461
|
+
}
|
|
462
|
+
})]
|
|
463
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Collapse, {
|
|
464
|
+
in: mobileDetailsOpen,
|
|
465
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
466
|
+
direction: "row",
|
|
467
|
+
justifyContent: "space-between",
|
|
468
|
+
alignItems: "center",
|
|
469
|
+
sx: {
|
|
470
|
+
mb: 1
|
|
471
|
+
},
|
|
472
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
473
|
+
direction: "row",
|
|
474
|
+
spacing: 0.5,
|
|
475
|
+
alignItems: "center",
|
|
476
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
477
|
+
sx: {
|
|
478
|
+
fontSize: 13,
|
|
479
|
+
color: "text.secondary"
|
|
480
|
+
},
|
|
481
|
+
children: t("payment.checkout.staking.title")
|
|
482
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_HelpOutline.default, {
|
|
483
|
+
sx: {
|
|
484
|
+
fontSize: 14,
|
|
485
|
+
color: "text.disabled"
|
|
486
|
+
}
|
|
487
|
+
})]
|
|
488
|
+
}), isAmountLoading ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
489
|
+
variant: "text",
|
|
490
|
+
width: 60,
|
|
491
|
+
height: 18
|
|
492
|
+
}) : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
493
|
+
sx: {
|
|
494
|
+
fontSize: 13,
|
|
495
|
+
fontWeight: 600
|
|
496
|
+
},
|
|
497
|
+
children: ["+", pricing.staking]
|
|
498
|
+
})]
|
|
499
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
500
|
+
sx: {
|
|
501
|
+
mb: 1
|
|
502
|
+
}
|
|
503
|
+
})]
|
|
504
|
+
})]
|
|
505
|
+
}), !isMobile && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
506
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Divider, {
|
|
507
|
+
sx: {
|
|
508
|
+
mb: 2
|
|
509
|
+
}
|
|
510
|
+
}), pricing.staking && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
511
|
+
direction: "row",
|
|
512
|
+
justifyContent: "space-between",
|
|
513
|
+
alignItems: "center",
|
|
514
|
+
sx: {
|
|
515
|
+
mb: 1
|
|
516
|
+
},
|
|
517
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
518
|
+
direction: "row",
|
|
519
|
+
spacing: 0.5,
|
|
520
|
+
alignItems: "center",
|
|
521
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
522
|
+
sx: {
|
|
523
|
+
fontSize: 14,
|
|
524
|
+
color: "text.secondary"
|
|
525
|
+
},
|
|
526
|
+
children: t("payment.checkout.staking.title")
|
|
527
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
528
|
+
title: t("payment.checkout.staking.tooltip"),
|
|
529
|
+
placement: "top",
|
|
530
|
+
arrow: true,
|
|
531
|
+
slotProps: {
|
|
532
|
+
popper: {
|
|
533
|
+
sx: _format.whiteTooltipSx
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_HelpOutline.default, {
|
|
537
|
+
sx: {
|
|
538
|
+
fontSize: 16,
|
|
539
|
+
color: "text.disabled"
|
|
540
|
+
}
|
|
541
|
+
})
|
|
542
|
+
})]
|
|
543
|
+
}), isAmountLoading ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
544
|
+
variant: "text",
|
|
545
|
+
width: 80,
|
|
546
|
+
height: 22
|
|
547
|
+
}) : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
548
|
+
sx: {
|
|
549
|
+
fontSize: 14,
|
|
550
|
+
fontWeight: 600
|
|
551
|
+
},
|
|
552
|
+
children: ["+", pricing.staking]
|
|
553
|
+
})]
|
|
554
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_promotionInput.default, {
|
|
555
|
+
promotion: {
|
|
556
|
+
applied: promotion.applied,
|
|
557
|
+
code: promotion.code,
|
|
558
|
+
active: promotion.active,
|
|
559
|
+
inactiveReason: promotion.inactiveReason,
|
|
560
|
+
apply: promotion.apply,
|
|
561
|
+
remove: promotion.remove
|
|
562
|
+
},
|
|
563
|
+
discounts,
|
|
564
|
+
discountAmount: pricing.discount
|
|
565
|
+
})]
|
|
566
|
+
}), (() => {
|
|
567
|
+
const totalStr = pricing.total || "0";
|
|
568
|
+
const parts = totalStr.split(/\s+/);
|
|
569
|
+
const num = parts[0] || "0";
|
|
570
|
+
const sym = parts.slice(1).join(" ") || currency?.symbol || "";
|
|
571
|
+
const dotIdx = num.indexOf(".");
|
|
572
|
+
const intPart = dotIdx >= 0 ? num.slice(0, dotIdx) : num;
|
|
573
|
+
const decPart = dotIdx >= 0 ? num.slice(dotIdx) : "";
|
|
574
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
575
|
+
sx: {
|
|
576
|
+
mb: isMobile ? 1.5 : 2.5
|
|
577
|
+
},
|
|
578
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
579
|
+
direction: "row",
|
|
580
|
+
justifyContent: "space-between",
|
|
581
|
+
alignItems: "flex-end",
|
|
582
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
583
|
+
sx: {
|
|
584
|
+
fontWeight: 700,
|
|
585
|
+
fontSize: 14,
|
|
586
|
+
color: "text.secondary",
|
|
587
|
+
pb: 0.5
|
|
588
|
+
},
|
|
589
|
+
children: t("common.totalDue")
|
|
590
|
+
}), isAmountLoading ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
|
|
591
|
+
variant: "text",
|
|
592
|
+
width: 140,
|
|
593
|
+
height: 44
|
|
594
|
+
}) : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
595
|
+
sx: {
|
|
596
|
+
textAlign: "right"
|
|
597
|
+
},
|
|
598
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
599
|
+
component: "span",
|
|
600
|
+
sx: {
|
|
601
|
+
fontSize: {
|
|
602
|
+
xs: 28,
|
|
603
|
+
md: 36
|
|
604
|
+
},
|
|
605
|
+
fontWeight: 800,
|
|
606
|
+
color: "text.primary",
|
|
607
|
+
lineHeight: 1,
|
|
608
|
+
transition: "opacity 0.3s ease"
|
|
609
|
+
},
|
|
610
|
+
children: intPart
|
|
611
|
+
}), decPart && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
612
|
+
component: "span",
|
|
613
|
+
sx: {
|
|
614
|
+
fontSize: {
|
|
615
|
+
xs: 16,
|
|
616
|
+
md: 20
|
|
617
|
+
},
|
|
618
|
+
fontWeight: 700,
|
|
619
|
+
color: "text.secondary",
|
|
620
|
+
lineHeight: 1
|
|
621
|
+
},
|
|
622
|
+
children: decPart
|
|
623
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
624
|
+
component: "span",
|
|
625
|
+
sx: {
|
|
626
|
+
fontSize: {
|
|
627
|
+
xs: 14,
|
|
628
|
+
md: 16
|
|
629
|
+
},
|
|
630
|
+
fontWeight: 600,
|
|
631
|
+
color: "text.secondary",
|
|
632
|
+
ml: 0.75
|
|
633
|
+
},
|
|
634
|
+
children: sym
|
|
635
|
+
})]
|
|
636
|
+
})]
|
|
637
|
+
}), (pricing.usdEquivalent || isMobile && promotion.active) && !isAmountLoading && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
638
|
+
direction: "row",
|
|
639
|
+
justifyContent: "space-between",
|
|
640
|
+
alignItems: "center",
|
|
641
|
+
sx: {
|
|
642
|
+
mt: 0.25
|
|
643
|
+
},
|
|
644
|
+
children: [(() => {
|
|
645
|
+
if (isMobile && !promotion.applied && promotion.active) {
|
|
646
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
647
|
+
onClick: () => setPromoDrawerOpen(true),
|
|
648
|
+
sx: {
|
|
649
|
+
display: "flex",
|
|
650
|
+
alignItems: "center",
|
|
651
|
+
gap: 0.5,
|
|
652
|
+
cursor: "pointer"
|
|
653
|
+
},
|
|
654
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_LocalOfferOutlined.default, {
|
|
655
|
+
sx: {
|
|
656
|
+
fontSize: 14,
|
|
657
|
+
color: "primary.main"
|
|
658
|
+
}
|
|
659
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
660
|
+
sx: {
|
|
661
|
+
fontSize: 12,
|
|
662
|
+
fontWeight: 600,
|
|
663
|
+
color: "primary.main"
|
|
664
|
+
},
|
|
665
|
+
children: (0, _format.tSafe)(t, "payment.checkout.promotion.add", "Add promo code")
|
|
666
|
+
})]
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
if (isMobile && promotion.applied) {
|
|
670
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
671
|
+
direction: "row",
|
|
672
|
+
alignItems: "center",
|
|
673
|
+
spacing: 0.5,
|
|
674
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_LocalOfferOutlined.default, {
|
|
675
|
+
sx: {
|
|
676
|
+
fontSize: 14,
|
|
677
|
+
color: "success.main"
|
|
678
|
+
}
|
|
679
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
680
|
+
sx: {
|
|
681
|
+
fontSize: 12,
|
|
682
|
+
fontWeight: 600,
|
|
683
|
+
color: "success.main"
|
|
684
|
+
},
|
|
685
|
+
children: promotion.code
|
|
686
|
+
}), pricing.discount && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
687
|
+
sx: {
|
|
688
|
+
fontSize: 11,
|
|
689
|
+
color: "text.secondary"
|
|
690
|
+
},
|
|
691
|
+
children: ["(-", pricing.discount, ")"]
|
|
692
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_Close.default, {
|
|
693
|
+
onClick: promotion.remove,
|
|
694
|
+
sx: {
|
|
695
|
+
fontSize: 14,
|
|
696
|
+
color: "error.main",
|
|
697
|
+
cursor: "pointer",
|
|
698
|
+
ml: 0.25
|
|
699
|
+
}
|
|
700
|
+
})]
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {});
|
|
704
|
+
})(), pricing.usdEquivalent && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
705
|
+
sx: {
|
|
706
|
+
fontSize: 13,
|
|
707
|
+
color: "text.secondary"
|
|
708
|
+
},
|
|
709
|
+
children: ["\u2248 ", pricing.usdEquivalent]
|
|
710
|
+
})]
|
|
711
|
+
})]
|
|
712
|
+
});
|
|
713
|
+
})(), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
714
|
+
variant: "contained",
|
|
715
|
+
size: "large",
|
|
716
|
+
fullWidth: true,
|
|
717
|
+
disabled: !canSubmit || submit.status === "waiting_stripe",
|
|
718
|
+
onClick: handleAction,
|
|
719
|
+
startIcon: isProcessing ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {
|
|
720
|
+
size: 20,
|
|
721
|
+
color: "inherit"
|
|
722
|
+
}) : null,
|
|
723
|
+
endIcon: !isProcessing ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_ArrowForward.default, {}) : void 0,
|
|
724
|
+
sx: {
|
|
725
|
+
py: 1.5,
|
|
726
|
+
fontSize: "1.1rem",
|
|
727
|
+
fontWeight: 600,
|
|
728
|
+
textTransform: "none",
|
|
729
|
+
borderRadius: "12px"
|
|
730
|
+
},
|
|
731
|
+
children: isProcessing ? `${t("payment.checkout.processing")}...` : buttonLabel
|
|
732
|
+
}), isMobile && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
733
|
+
direction: "row",
|
|
734
|
+
alignItems: "center",
|
|
735
|
+
justifyContent: "center",
|
|
736
|
+
spacing: 0.75,
|
|
737
|
+
sx: {
|
|
738
|
+
mt: 1.5,
|
|
739
|
+
opacity: 0.55
|
|
740
|
+
},
|
|
741
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_LockOutlined.default, {
|
|
742
|
+
sx: {
|
|
743
|
+
fontSize: 13,
|
|
744
|
+
color: "text.secondary"
|
|
745
|
+
}
|
|
746
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
747
|
+
sx: {
|
|
748
|
+
fontSize: 11,
|
|
749
|
+
color: "text.secondary"
|
|
750
|
+
},
|
|
751
|
+
children: (0, _format.tSafe)(t, "payment.checkout.ssl", "SSL Secure")
|
|
752
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
753
|
+
sx: {
|
|
754
|
+
fontSize: 11,
|
|
755
|
+
color: "text.disabled"
|
|
756
|
+
},
|
|
757
|
+
children: "\xB7"
|
|
758
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
759
|
+
sx: {
|
|
760
|
+
fontSize: 11,
|
|
761
|
+
color: "text.secondary"
|
|
762
|
+
},
|
|
763
|
+
children: (0, _format.tSafe)(t, "common.terms", "Terms")
|
|
764
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
765
|
+
sx: {
|
|
766
|
+
fontSize: 11,
|
|
767
|
+
color: "text.disabled"
|
|
768
|
+
},
|
|
769
|
+
children: "|"
|
|
770
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
771
|
+
sx: {
|
|
772
|
+
fontSize: 11,
|
|
773
|
+
color: "text.secondary"
|
|
774
|
+
},
|
|
775
|
+
children: (0, _format.tSafe)(t, "common.privacy", "Privacy")
|
|
776
|
+
})]
|
|
777
|
+
})]
|
|
778
|
+
}), isMobile && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Drawer, {
|
|
779
|
+
anchor: "bottom",
|
|
780
|
+
open: promoDrawerOpen,
|
|
781
|
+
onClose: () => setPromoDrawerOpen(false),
|
|
782
|
+
PaperProps: {
|
|
783
|
+
sx: {
|
|
784
|
+
borderRadius: "16px 16px 0 0",
|
|
785
|
+
p: 3,
|
|
786
|
+
pb: 4,
|
|
787
|
+
minHeight: "30vh"
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
791
|
+
sx: {
|
|
792
|
+
width: 40,
|
|
793
|
+
height: 4,
|
|
794
|
+
bgcolor: "divider",
|
|
795
|
+
borderRadius: 2,
|
|
796
|
+
mx: "auto",
|
|
797
|
+
mb: 3
|
|
798
|
+
}
|
|
799
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
800
|
+
sx: {
|
|
801
|
+
fontWeight: 700,
|
|
802
|
+
fontSize: 16,
|
|
803
|
+
mb: 2
|
|
804
|
+
},
|
|
805
|
+
children: (0, _format.tSafe)(t, "payment.checkout.promotion.add", "Add promo code")
|
|
806
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_promotionInput.default, {
|
|
807
|
+
initialShowInput: true,
|
|
808
|
+
promotion: {
|
|
809
|
+
applied: promotion.applied,
|
|
810
|
+
code: promotion.code,
|
|
811
|
+
active: promotion.active,
|
|
812
|
+
inactiveReason: promotion.inactiveReason,
|
|
813
|
+
apply: async (...args) => {
|
|
814
|
+
const result = await promotion.apply(...args);
|
|
815
|
+
if (result.success) setPromoDrawerOpen(false);
|
|
816
|
+
return result;
|
|
817
|
+
},
|
|
818
|
+
remove: promotion.remove
|
|
819
|
+
},
|
|
820
|
+
discounts,
|
|
821
|
+
discountAmount: pricing.discount
|
|
822
|
+
})]
|
|
823
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
824
|
+
sx: {
|
|
825
|
+
flexShrink: 0
|
|
826
|
+
},
|
|
827
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_subscriptionDisclaimer.default, {
|
|
828
|
+
mode,
|
|
829
|
+
subscription,
|
|
830
|
+
staking: pricing.staking,
|
|
831
|
+
appName: session?.metadata?.app_name || "New Payment Kit"
|
|
832
|
+
}), !isMobile && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
833
|
+
direction: "row",
|
|
834
|
+
alignItems: "center",
|
|
835
|
+
justifyContent: "center",
|
|
836
|
+
spacing: 0.75,
|
|
837
|
+
sx: {
|
|
838
|
+
mt: 2.5,
|
|
839
|
+
opacity: 0.55
|
|
840
|
+
},
|
|
841
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_LockOutlined.default, {
|
|
842
|
+
sx: {
|
|
843
|
+
fontSize: 13,
|
|
844
|
+
color: "text.secondary"
|
|
845
|
+
}
|
|
846
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
847
|
+
sx: {
|
|
848
|
+
fontSize: 11,
|
|
849
|
+
color: "text.secondary"
|
|
850
|
+
},
|
|
851
|
+
children: (0, _format.tSafe)(t, "payment.checkout.ssl", "SSL Secure")
|
|
852
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
853
|
+
sx: {
|
|
854
|
+
fontSize: 11,
|
|
855
|
+
color: "text.disabled"
|
|
856
|
+
},
|
|
857
|
+
children: "\xB7"
|
|
858
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
859
|
+
sx: {
|
|
860
|
+
fontSize: 11,
|
|
861
|
+
color: "text.secondary"
|
|
862
|
+
},
|
|
863
|
+
children: (0, _format.tSafe)(t, "common.terms", "Terms")
|
|
864
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
865
|
+
sx: {
|
|
866
|
+
fontSize: 11,
|
|
867
|
+
color: "text.disabled"
|
|
868
|
+
},
|
|
869
|
+
children: "|"
|
|
870
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
871
|
+
sx: {
|
|
872
|
+
fontSize: 11,
|
|
873
|
+
color: "text.secondary"
|
|
874
|
+
},
|
|
875
|
+
children: (0, _format.tSafe)(t, "common.privacy", "Privacy")
|
|
876
|
+
})]
|
|
877
|
+
})]
|
|
878
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_statusFeedback.default, {
|
|
879
|
+
status: submit.status,
|
|
880
|
+
context: submit.context,
|
|
881
|
+
onReset: submit.reset
|
|
882
|
+
}), customerLimited && /* @__PURE__ */(0, _jsxRuntime.jsx)(_overDueInvoicePayment.default, {
|
|
883
|
+
customerId: sessionData?.customer?.id || session?.user?.did,
|
|
884
|
+
onPaid: () => {
|
|
885
|
+
setCustomerLimited(false);
|
|
886
|
+
submit.retry();
|
|
887
|
+
},
|
|
888
|
+
alertMessage: t("payment.customer.pastDue.alert.customMessage"),
|
|
889
|
+
detailLinkOptions: {
|
|
890
|
+
enabled: true,
|
|
891
|
+
onClick: () => {
|
|
892
|
+
setCustomerLimited(false);
|
|
893
|
+
window.open((0, _ufo.joinURL)((0, _util.getPrefix)(), `/customer/invoice/past-due?referer=${encodeURIComponent(window.location.href)}`), "_self");
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
dialogProps: {
|
|
897
|
+
open: customerLimited,
|
|
898
|
+
onClose: () => {
|
|
899
|
+
setCustomerLimited(false);
|
|
900
|
+
submit.reset();
|
|
901
|
+
},
|
|
902
|
+
title: t("payment.customer.pastDue.alert.title")
|
|
903
|
+
}
|
|
904
|
+
})]
|
|
905
|
+
});
|
|
906
|
+
}
|