@blocklet/payment-react 1.25.10 → 1.26.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-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 +611 -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 +795 -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 +4 -3
- 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 +642 -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 +677 -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 +205 -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,515 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
module.exports = CompositePanel;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
10
|
+
var _TrendingDown = _interopRequireDefault(require("@mui/icons-material/TrendingDown"));
|
|
11
|
+
var _material = require("@mui/material");
|
|
12
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
13
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
14
|
+
var _paymentReactHeadless = require("@blocklet/payment-react-headless");
|
|
15
|
+
var _mobile = require("../../../hooks/mobile");
|
|
16
|
+
var _format = require("../../utils/format");
|
|
17
|
+
var _productItemCard = _interopRequireDefault(require("../../components/left/product-item-card"));
|
|
18
|
+
var _billingToggle = _interopRequireDefault(require("../../components/left/billing-toggle"));
|
|
19
|
+
var _crossSellCard = _interopRequireDefault(require("../../components/left/cross-sell-card"));
|
|
20
|
+
var _exchangeRateFooter = _interopRequireDefault(require("../../components/shared/exchange-rate-footer"));
|
|
21
|
+
var _trialInfo = _interopRequireDefault(require("../../components/left/trial-info"));
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
function CompositePanel() {
|
|
24
|
+
const {
|
|
25
|
+
t
|
|
26
|
+
} = (0, _context.useLocaleContext)();
|
|
27
|
+
const {
|
|
28
|
+
session
|
|
29
|
+
} = (0, _paymentReactHeadless.useSessionContext)();
|
|
30
|
+
const {
|
|
31
|
+
currency,
|
|
32
|
+
isStripe,
|
|
33
|
+
switching: currencySwitching
|
|
34
|
+
} = (0, _paymentReactHeadless.usePaymentMethodContext)();
|
|
35
|
+
const {
|
|
36
|
+
livemode
|
|
37
|
+
} = (0, _paymentReactHeadless.useCheckoutStatus)();
|
|
38
|
+
const {
|
|
39
|
+
product,
|
|
40
|
+
pageInfo
|
|
41
|
+
} = (0, _paymentReactHeadless.useProduct)();
|
|
42
|
+
const lineItems = (0, _paymentReactHeadless.useLineItems)();
|
|
43
|
+
const billingInterval = (0, _paymentReactHeadless.useBillingInterval)();
|
|
44
|
+
const pricing = (0, _paymentReactHeadless.usePricingFeature)();
|
|
45
|
+
const rate = (0, _paymentReactHeadless.useExchangeRate)();
|
|
46
|
+
const slippage = (0, _paymentReactHeadless.useSlippage)();
|
|
47
|
+
const {
|
|
48
|
+
isMobile
|
|
49
|
+
} = (0, _mobile.useMobile)();
|
|
50
|
+
const mode = session?.mode || "payment";
|
|
51
|
+
const discounts = session?.discounts || [];
|
|
52
|
+
const appName = session?.app_name || session?.payment_link?.app_name || "";
|
|
53
|
+
const appLogo = session?.app_logo || session?.payment_link?.app_logo || "";
|
|
54
|
+
const showItemsCollapse = isMobile || lineItems.items.length >= 4;
|
|
55
|
+
const [itemsExpanded, setItemsExpanded] = (0, _react.useState)(isMobile ? lineItems.items.length <= 1 : lineItems.items.length < 4);
|
|
56
|
+
const crossSellNotAdded = lineItems.crossSellItem && !lineItems.items.some(i => i.price_id === lineItems.crossSellItem?.id);
|
|
57
|
+
const nonCrossSellItems = lineItems.items.filter(i => !i.cross_sell);
|
|
58
|
+
const itemsWithUpsell = lineItems.items.filter(i => i.price?.upsell?.upsells_to);
|
|
59
|
+
const upsellPrimaryItem = itemsWithUpsell.length === 1 ? itemsWithUpsell[0] : null;
|
|
60
|
+
const upsellTarget = upsellPrimaryItem ? upsellPrimaryItem.price?.upsell?.upsells_to : null;
|
|
61
|
+
const canUpsell = nonCrossSellItems.length <= 1;
|
|
62
|
+
const hasTopUpsell = canUpsell && !!upsellPrimaryItem && ["subscription", "setup"].includes(mode);
|
|
63
|
+
const isUpselled = !!upsellPrimaryItem?.upsell_price;
|
|
64
|
+
const currentInterval = hasTopUpsell ? upsellPrimaryItem.price?.recurring?.interval : null;
|
|
65
|
+
const upsellInterval = hasTopUpsell ? upsellTarget?.recurring?.interval : null;
|
|
66
|
+
let upsellSavings = 0;
|
|
67
|
+
if (hasTopUpsell && currentInterval && upsellInterval) {
|
|
68
|
+
const fromAmt = parseFloat(upsellPrimaryItem.price?.base_amount || upsellPrimaryItem.price?.unit_amount || "0");
|
|
69
|
+
const toAmt = parseFloat(upsellTarget?.base_amount || upsellTarget?.unit_amount || "0");
|
|
70
|
+
const yearMap = {
|
|
71
|
+
day: 365,
|
|
72
|
+
week: 52,
|
|
73
|
+
month: 12,
|
|
74
|
+
year: 1
|
|
75
|
+
};
|
|
76
|
+
const fromY = fromAmt * (yearMap[currentInterval] || 1);
|
|
77
|
+
const toY = toAmt * (yearMap[upsellInterval] || 1);
|
|
78
|
+
if (fromY > toY && fromY > 0) upsellSavings = Math.round((fromY - toY) / fromY * 100);
|
|
79
|
+
}
|
|
80
|
+
const prevRateStatusRef = (0, _react.useRef)(rate.status);
|
|
81
|
+
(0, _react.useEffect)(() => {
|
|
82
|
+
if (prevRateStatusRef.current !== "unavailable" && rate.status === "unavailable" && !isStripe) {
|
|
83
|
+
_Toast.default.error(t("payment.dynamicPricing.unavailable.message"));
|
|
84
|
+
}
|
|
85
|
+
prevRateStatusRef.current = rate.status;
|
|
86
|
+
}, [rate.status, isStripe, t]);
|
|
87
|
+
const headerMeta = (0, _format.getSessionHeaderMeta)(t, session, product, lineItems.items);
|
|
88
|
+
const isMultiItem = lineItems.items.length > 1;
|
|
89
|
+
const activeSx = {
|
|
90
|
+
bgcolor: "primary.main",
|
|
91
|
+
color: "#fff",
|
|
92
|
+
boxShadow: "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)"
|
|
93
|
+
};
|
|
94
|
+
const inactiveSx = {
|
|
95
|
+
color: "text.secondary",
|
|
96
|
+
"&:hover": {
|
|
97
|
+
color: "text.primary"
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const capsuleBtnSx = active => ({
|
|
101
|
+
px: 3.5,
|
|
102
|
+
py: 1,
|
|
103
|
+
borderRadius: "9999px",
|
|
104
|
+
cursor: "pointer",
|
|
105
|
+
transition: "all 0.3s ease",
|
|
106
|
+
userSelect: "none",
|
|
107
|
+
...(active ? activeSx : inactiveSx)
|
|
108
|
+
});
|
|
109
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
110
|
+
sx: {
|
|
111
|
+
display: "flex",
|
|
112
|
+
flexDirection: "column",
|
|
113
|
+
flex: 1
|
|
114
|
+
},
|
|
115
|
+
children: [!isMobile && (appName || appLogo) && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
116
|
+
direction: "row",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
spacing: 1,
|
|
119
|
+
sx: {
|
|
120
|
+
mb: 5
|
|
121
|
+
},
|
|
122
|
+
children: [appLogo && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
123
|
+
src: appLogo,
|
|
124
|
+
alt: appName,
|
|
125
|
+
sx: {
|
|
126
|
+
width: 48,
|
|
127
|
+
height: 48,
|
|
128
|
+
borderRadius: "16px",
|
|
129
|
+
bgcolor: "background.paper",
|
|
130
|
+
boxShadow: 1,
|
|
131
|
+
border: "1px solid",
|
|
132
|
+
borderColor: "divider"
|
|
133
|
+
}
|
|
134
|
+
}), appName && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
135
|
+
sx: {
|
|
136
|
+
fontWeight: 600,
|
|
137
|
+
fontSize: 15,
|
|
138
|
+
color: "text.primary"
|
|
139
|
+
},
|
|
140
|
+
children: appName
|
|
141
|
+
})]
|
|
142
|
+
}), !isMobile && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
143
|
+
sx: {
|
|
144
|
+
flexGrow: 1,
|
|
145
|
+
flexShrink: 1,
|
|
146
|
+
flexBasis: 0
|
|
147
|
+
}
|
|
148
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
149
|
+
sx: {
|
|
150
|
+
flexShrink: 0
|
|
151
|
+
},
|
|
152
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
153
|
+
sx: {
|
|
154
|
+
mb: {
|
|
155
|
+
xs: 3,
|
|
156
|
+
md: 4
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
children: [isMobile && (appName || appLogo) && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
160
|
+
direction: "row",
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
spacing: 1,
|
|
163
|
+
sx: {
|
|
164
|
+
mb: 1
|
|
165
|
+
},
|
|
166
|
+
children: [appLogo && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
167
|
+
src: appLogo,
|
|
168
|
+
alt: appName,
|
|
169
|
+
sx: {
|
|
170
|
+
width: 24,
|
|
171
|
+
height: 24,
|
|
172
|
+
borderRadius: "6px"
|
|
173
|
+
}
|
|
174
|
+
}), appName && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
175
|
+
sx: {
|
|
176
|
+
fontWeight: 600,
|
|
177
|
+
fontSize: 13,
|
|
178
|
+
color: "text.secondary"
|
|
179
|
+
},
|
|
180
|
+
children: appName
|
|
181
|
+
})]
|
|
182
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
183
|
+
direction: "row",
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
spacing: 1,
|
|
186
|
+
sx: {
|
|
187
|
+
mb: 1.5
|
|
188
|
+
},
|
|
189
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
190
|
+
component: "span",
|
|
191
|
+
sx: {
|
|
192
|
+
fontSize: 10,
|
|
193
|
+
fontWeight: 700,
|
|
194
|
+
letterSpacing: "0.1em",
|
|
195
|
+
lineHeight: 1,
|
|
196
|
+
textTransform: "uppercase",
|
|
197
|
+
color: "primary.main",
|
|
198
|
+
bgcolor: theme => theme.palette.mode === "dark" ? `${theme.palette.primary.main}1A` : `${theme.palette.primary.main}0D`,
|
|
199
|
+
px: 1,
|
|
200
|
+
py: 0.5,
|
|
201
|
+
borderRadius: "4px"
|
|
202
|
+
},
|
|
203
|
+
children: headerMeta.badgeLabel
|
|
204
|
+
}), pricing.trial.active && pricing.trial.days > 0 && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
205
|
+
component: "span",
|
|
206
|
+
sx: {
|
|
207
|
+
fontSize: 10,
|
|
208
|
+
fontWeight: 700,
|
|
209
|
+
letterSpacing: "0.1em",
|
|
210
|
+
lineHeight: 1,
|
|
211
|
+
textTransform: "uppercase",
|
|
212
|
+
color: "primary.main",
|
|
213
|
+
bgcolor: theme => theme.palette.mode === "dark" ? `${theme.palette.primary.main}1A` : `${theme.palette.primary.main}0D`,
|
|
214
|
+
px: 1,
|
|
215
|
+
py: 0.5,
|
|
216
|
+
borderRadius: "4px"
|
|
217
|
+
},
|
|
218
|
+
children: (0, _format.formatTrialText)(t, pricing.trial.days, pricing.trial.afterTrialInterval || "day")
|
|
219
|
+
}), !livemode && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
220
|
+
component: "span",
|
|
221
|
+
sx: {
|
|
222
|
+
fontSize: 10,
|
|
223
|
+
fontWeight: 700,
|
|
224
|
+
letterSpacing: "0.1em",
|
|
225
|
+
lineHeight: 1,
|
|
226
|
+
textTransform: "uppercase",
|
|
227
|
+
color: theme => theme.palette.mode === "dark" ? theme.palette.grey[500] : theme.palette.grey[400],
|
|
228
|
+
bgcolor: theme => theme.palette.mode === "dark" ? "rgba(255,255,255,0.06)" : theme.palette.grey[100],
|
|
229
|
+
px: 1,
|
|
230
|
+
py: 0.5,
|
|
231
|
+
borderRadius: "4px"
|
|
232
|
+
},
|
|
233
|
+
children: t("common.livemode")
|
|
234
|
+
})]
|
|
235
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
236
|
+
sx: {
|
|
237
|
+
fontWeight: 800,
|
|
238
|
+
fontSize: {
|
|
239
|
+
xs: 24,
|
|
240
|
+
md: 36
|
|
241
|
+
},
|
|
242
|
+
lineHeight: 1.1,
|
|
243
|
+
letterSpacing: "-0.03em",
|
|
244
|
+
color: "text.primary",
|
|
245
|
+
mb: 0.75
|
|
246
|
+
},
|
|
247
|
+
children: isMultiItem ? (0, _format.tSafe)(t, "payment.checkout.orderSummary", "Order Summary") : headerMeta.title
|
|
248
|
+
}), (isMultiItem || headerMeta.subtitle) && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
249
|
+
sx: {
|
|
250
|
+
color: "text.secondary",
|
|
251
|
+
fontSize: {
|
|
252
|
+
xs: 14,
|
|
253
|
+
md: 16
|
|
254
|
+
},
|
|
255
|
+
fontWeight: 500,
|
|
256
|
+
lineHeight: 1.5
|
|
257
|
+
},
|
|
258
|
+
children: isMultiItem ? (0, _format.tSafe)(t, "payment.checkout.orderSummarySubtitle", "Items included in this purchase") : headerMeta.subtitle
|
|
259
|
+
}), hasTopUpsell && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
260
|
+
direction: "row",
|
|
261
|
+
alignItems: "center",
|
|
262
|
+
spacing: 2,
|
|
263
|
+
sx: {
|
|
264
|
+
mt: 2.5
|
|
265
|
+
},
|
|
266
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
267
|
+
direction: "row",
|
|
268
|
+
alignItems: "center",
|
|
269
|
+
sx: {
|
|
270
|
+
bgcolor: "background.paper",
|
|
271
|
+
borderRadius: "9999px",
|
|
272
|
+
border: "1px solid",
|
|
273
|
+
borderColor: "divider",
|
|
274
|
+
p: "4px",
|
|
275
|
+
display: "inline-flex",
|
|
276
|
+
boxShadow: theme => theme.palette.mode === "dark" ? "0 1px 2px 0 rgba(0,0,0,0.3)" : "0 1px 2px 0 rgba(0,0,0,0.05)"
|
|
277
|
+
},
|
|
278
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
279
|
+
onClick: async () => {
|
|
280
|
+
if (isUpselled) {
|
|
281
|
+
try {
|
|
282
|
+
await lineItems.downsell(upsellPrimaryItem.upsell_price?.id || upsellPrimaryItem.price_id);
|
|
283
|
+
} catch (err) {
|
|
284
|
+
_Toast.default.error(err?.response?.data?.error || err?.message || "Failed");
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
sx: capsuleBtnSx(!isUpselled),
|
|
289
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
290
|
+
component: "span",
|
|
291
|
+
sx: {
|
|
292
|
+
fontSize: 14,
|
|
293
|
+
fontWeight: 700,
|
|
294
|
+
color: "inherit",
|
|
295
|
+
lineHeight: 1
|
|
296
|
+
},
|
|
297
|
+
children: t(_format.INTERVAL_LOCALE_KEY[currentInterval] || "")
|
|
298
|
+
})
|
|
299
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
300
|
+
onClick: async () => {
|
|
301
|
+
if (!isUpselled) {
|
|
302
|
+
try {
|
|
303
|
+
await lineItems.upsell(upsellPrimaryItem.price_id, upsellTarget.id);
|
|
304
|
+
} catch (err) {
|
|
305
|
+
_Toast.default.error(err?.response?.data?.error || err?.message || "Failed");
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
sx: capsuleBtnSx(isUpselled),
|
|
310
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
311
|
+
component: "span",
|
|
312
|
+
sx: {
|
|
313
|
+
fontSize: 14,
|
|
314
|
+
fontWeight: 700,
|
|
315
|
+
color: "inherit",
|
|
316
|
+
lineHeight: 1
|
|
317
|
+
},
|
|
318
|
+
children: t(_format.INTERVAL_LOCALE_KEY[upsellInterval] || "")
|
|
319
|
+
})
|
|
320
|
+
})]
|
|
321
|
+
}), upsellSavings > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
322
|
+
direction: "row",
|
|
323
|
+
alignItems: "center",
|
|
324
|
+
spacing: 0.75,
|
|
325
|
+
sx: {
|
|
326
|
+
px: 1.5,
|
|
327
|
+
py: 0.75,
|
|
328
|
+
bgcolor: theme => theme.palette.mode === "dark" ? "rgba(18,184,134,0.1)" : "#ebfef5",
|
|
329
|
+
color: "#12b886",
|
|
330
|
+
fontSize: 11,
|
|
331
|
+
fontWeight: 700,
|
|
332
|
+
borderRadius: "9999px",
|
|
333
|
+
border: "1px solid",
|
|
334
|
+
borderColor: theme => theme.palette.mode === "dark" ? "rgba(18,184,134,0.2)" : "#d3f9e8",
|
|
335
|
+
textTransform: "uppercase",
|
|
336
|
+
letterSpacing: "0.05em"
|
|
337
|
+
},
|
|
338
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_TrendingDown.default, {
|
|
339
|
+
sx: {
|
|
340
|
+
fontSize: 14
|
|
341
|
+
}
|
|
342
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
343
|
+
component: "span",
|
|
344
|
+
sx: {
|
|
345
|
+
fontSize: "inherit",
|
|
346
|
+
fontWeight: "inherit",
|
|
347
|
+
color: "inherit",
|
|
348
|
+
lineHeight: 1
|
|
349
|
+
},
|
|
350
|
+
children: ["SAVE ", upsellSavings, "%"]
|
|
351
|
+
})]
|
|
352
|
+
})]
|
|
353
|
+
})]
|
|
354
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_billingToggle.default, {
|
|
355
|
+
billingInterval
|
|
356
|
+
})]
|
|
357
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
358
|
+
sx: {
|
|
359
|
+
flexGrow: 0,
|
|
360
|
+
flexShrink: 1,
|
|
361
|
+
flexBasis: "auto",
|
|
362
|
+
minHeight: {
|
|
363
|
+
md: 0
|
|
364
|
+
},
|
|
365
|
+
overflowY: {
|
|
366
|
+
md: "auto"
|
|
367
|
+
},
|
|
368
|
+
"&::-webkit-scrollbar": {
|
|
369
|
+
display: "none"
|
|
370
|
+
},
|
|
371
|
+
scrollbarWidth: "none"
|
|
372
|
+
},
|
|
373
|
+
children: [showItemsCollapse && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
374
|
+
direction: "row",
|
|
375
|
+
alignItems: "center",
|
|
376
|
+
justifyContent: "space-between",
|
|
377
|
+
onClick: () => setItemsExpanded(!itemsExpanded),
|
|
378
|
+
sx: {
|
|
379
|
+
cursor: "pointer",
|
|
380
|
+
mb: 1.5
|
|
381
|
+
},
|
|
382
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
383
|
+
sx: {
|
|
384
|
+
fontSize: 14,
|
|
385
|
+
fontWeight: 600
|
|
386
|
+
},
|
|
387
|
+
children: t("payment.checkout.productListTotal", {
|
|
388
|
+
total: lineItems.items.length
|
|
389
|
+
})
|
|
390
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
391
|
+
sx: {
|
|
392
|
+
transform: itemsExpanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
393
|
+
transition: "0.3s"
|
|
394
|
+
}
|
|
395
|
+
})]
|
|
396
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Collapse, {
|
|
397
|
+
in: itemsExpanded || !showItemsCollapse,
|
|
398
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
399
|
+
spacing: 2,
|
|
400
|
+
sx: {
|
|
401
|
+
mb: 2
|
|
402
|
+
},
|
|
403
|
+
children: lineItems.items.map(item => /* @__PURE__ */(0, _jsxRuntime.jsx)(_productItemCard.default, {
|
|
404
|
+
item,
|
|
405
|
+
currency,
|
|
406
|
+
discounts,
|
|
407
|
+
exchangeRate: rate.value,
|
|
408
|
+
onQuantityChange: lineItems.updateQuantity,
|
|
409
|
+
onUpsell: lineItems.upsell,
|
|
410
|
+
onDownsell: lineItems.downsell,
|
|
411
|
+
trialActive: pricing.trial.active,
|
|
412
|
+
trialDays: pricing.trial.days,
|
|
413
|
+
hideUpsell: hasTopUpsell || !canUpsell,
|
|
414
|
+
isRateLoading: currencySwitching || rate.hasDynamicPricing && rate.status === "loading",
|
|
415
|
+
showFeatures: pageInfo?.showProductFeatures ?? false,
|
|
416
|
+
t,
|
|
417
|
+
children: item.cross_sell && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
418
|
+
size: "small",
|
|
419
|
+
color: "error",
|
|
420
|
+
variant: "text",
|
|
421
|
+
onClick: lineItems.removeCrossSell,
|
|
422
|
+
sx: {
|
|
423
|
+
mt: 1,
|
|
424
|
+
ml: -0.5,
|
|
425
|
+
textTransform: "none",
|
|
426
|
+
fontSize: 12
|
|
427
|
+
},
|
|
428
|
+
children: t("payment.checkout.cross_sell.remove")
|
|
429
|
+
})
|
|
430
|
+
}, item.id))
|
|
431
|
+
}), crossSellNotAdded && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
432
|
+
sx: {
|
|
433
|
+
mb: 2
|
|
434
|
+
},
|
|
435
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_crossSellCard.default, {
|
|
436
|
+
crossSellItem: lineItems.crossSellItem,
|
|
437
|
+
currency,
|
|
438
|
+
exchangeRate: rate.value,
|
|
439
|
+
crossSellRequired: lineItems.crossSellRequired,
|
|
440
|
+
onAdd: lineItems.addCrossSell
|
|
441
|
+
})
|
|
442
|
+
})]
|
|
443
|
+
})]
|
|
444
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
445
|
+
sx: {
|
|
446
|
+
flexShrink: 0
|
|
447
|
+
},
|
|
448
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_trialInfo.default, {
|
|
449
|
+
trial: {
|
|
450
|
+
active: pricing.trial.active,
|
|
451
|
+
days: pricing.trial.days,
|
|
452
|
+
afterTrialPrice: pricing.trial.afterTrialPrice,
|
|
453
|
+
afterTrialInterval: pricing.trial.afterTrialInterval
|
|
454
|
+
},
|
|
455
|
+
mode,
|
|
456
|
+
items: lineItems.items
|
|
457
|
+
})
|
|
458
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
459
|
+
sx: {
|
|
460
|
+
flexGrow: 1,
|
|
461
|
+
flexShrink: 1,
|
|
462
|
+
flexBasis: 0
|
|
463
|
+
}
|
|
464
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
465
|
+
sx: {
|
|
466
|
+
flexShrink: 0
|
|
467
|
+
},
|
|
468
|
+
children: [rate.hasDynamicPricing && rate.status === "unavailable" && !isStripe && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
469
|
+
direction: "row",
|
|
470
|
+
alignItems: "center",
|
|
471
|
+
spacing: 0.75,
|
|
472
|
+
sx: {
|
|
473
|
+
mb: 2
|
|
474
|
+
},
|
|
475
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
476
|
+
sx: {
|
|
477
|
+
fontSize: 13,
|
|
478
|
+
color: "text.secondary",
|
|
479
|
+
fontWeight: 500
|
|
480
|
+
},
|
|
481
|
+
children: t("payment.dynamicPricing.unavailable.title")
|
|
482
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
483
|
+
component: "span",
|
|
484
|
+
onClick: rate.refresh,
|
|
485
|
+
sx: {
|
|
486
|
+
fontSize: 13,
|
|
487
|
+
color: "primary.main",
|
|
488
|
+
fontWeight: 600,
|
|
489
|
+
cursor: "pointer",
|
|
490
|
+
"&:hover": {
|
|
491
|
+
textDecoration: "underline"
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
children: t("payment.dynamicPricing.unavailable.retry")
|
|
495
|
+
})]
|
|
496
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_exchangeRateFooter.default, {
|
|
497
|
+
hasDynamicPricing: rate.hasDynamicPricing,
|
|
498
|
+
rate: {
|
|
499
|
+
value: rate.value,
|
|
500
|
+
display: rate.display,
|
|
501
|
+
provider: rate.provider,
|
|
502
|
+
providerDisplay: rate.providerDisplay,
|
|
503
|
+
fetchedAt: rate.fetchedAt,
|
|
504
|
+
status: rate.status
|
|
505
|
+
},
|
|
506
|
+
slippage: {
|
|
507
|
+
percent: slippage.percent,
|
|
508
|
+
set: slippage.set
|
|
509
|
+
},
|
|
510
|
+
currencySymbol: currency?.symbol || "",
|
|
511
|
+
isSubscription: ["subscription", "setup"].includes(mode)
|
|
512
|
+
})]
|
|
513
|
+
})]
|
|
514
|
+
});
|
|
515
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CreditTopupPanel(): import("react").JSX.Element;
|