@blocklet/payment-react 1.25.10 → 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.
Files changed (160) hide show
  1. package/es/checkout-v2/checkout-v2.d.ts +2 -0
  2. package/es/checkout-v2/checkout-v2.js +121 -0
  3. package/es/checkout-v2/components/dialogs/checkout-dialogs.d.ts +1 -0
  4. package/es/checkout-v2/components/dialogs/checkout-dialogs.js +106 -0
  5. package/es/checkout-v2/components/left/billing-toggle.d.ts +6 -0
  6. package/es/checkout-v2/components/left/billing-toggle.js +118 -0
  7. package/es/checkout-v2/components/left/cross-sell-card.d.ts +10 -0
  8. package/es/checkout-v2/components/left/cross-sell-card.js +167 -0
  9. package/es/checkout-v2/components/left/product-item-card.d.ts +26 -0
  10. package/es/checkout-v2/components/left/product-item-card.js +571 -0
  11. package/es/checkout-v2/components/left/promotion-input.d.ts +19 -0
  12. package/es/checkout-v2/components/left/promotion-input.js +178 -0
  13. package/es/checkout-v2/components/left/staking-breakdown.d.ts +9 -0
  14. package/es/checkout-v2/components/left/staking-breakdown.js +48 -0
  15. package/es/checkout-v2/components/left/trial-info.d.ts +13 -0
  16. package/es/checkout-v2/components/left/trial-info.js +48 -0
  17. package/es/checkout-v2/components/right/currency-grid.d.ts +8 -0
  18. package/es/checkout-v2/components/right/currency-grid.js +48 -0
  19. package/es/checkout-v2/components/right/customer-info-card.d.ts +17 -0
  20. package/es/checkout-v2/components/right/customer-info-card.js +156 -0
  21. package/es/checkout-v2/components/right/status-feedback.d.ts +7 -0
  22. package/es/checkout-v2/components/right/status-feedback.js +17 -0
  23. package/es/checkout-v2/components/right/submit-button.d.ts +10 -0
  24. package/es/checkout-v2/components/right/submit-button.js +29 -0
  25. package/es/checkout-v2/components/right/subscription-disclaimer.d.ts +11 -0
  26. package/es/checkout-v2/components/right/subscription-disclaimer.js +8 -0
  27. package/es/checkout-v2/components/shared/exchange-rate-footer.d.ts +23 -0
  28. package/es/checkout-v2/components/shared/exchange-rate-footer.js +182 -0
  29. package/es/checkout-v2/components/shared/scenario-badge.d.ts +6 -0
  30. package/es/checkout-v2/components/shared/scenario-badge.js +47 -0
  31. package/es/checkout-v2/components/shared/total-display.d.ts +7 -0
  32. package/es/checkout-v2/components/shared/total-display.js +84 -0
  33. package/es/checkout-v2/index.d.ts +2 -0
  34. package/es/checkout-v2/index.js +1 -0
  35. package/es/checkout-v2/layouts/checkout-layout.d.ts +7 -0
  36. package/es/checkout-v2/layouts/checkout-layout.js +226 -0
  37. package/es/checkout-v2/panels/left/composite-panel.d.ts +1 -0
  38. package/es/checkout-v2/panels/left/composite-panel.js +423 -0
  39. package/es/checkout-v2/panels/left/credit-topup-panel.d.ts +1 -0
  40. package/es/checkout-v2/panels/left/credit-topup-panel.js +615 -0
  41. package/es/checkout-v2/panels/left/scenario-router.d.ts +1 -0
  42. package/es/checkout-v2/panels/left/scenario-router.js +19 -0
  43. package/es/checkout-v2/panels/right/payment-panel.d.ts +1 -0
  44. package/es/checkout-v2/panels/right/payment-panel.js +644 -0
  45. package/es/checkout-v2/types.d.ts +15 -0
  46. package/es/checkout-v2/types.js +0 -0
  47. package/es/checkout-v2/utils/format.d.ts +59 -0
  48. package/es/checkout-v2/utils/format.js +125 -0
  49. package/es/checkout-v2/utils/scenario-detector.d.ts +3 -0
  50. package/es/checkout-v2/utils/scenario-detector.js +17 -0
  51. package/es/checkout-v2/views/error-view.d.ts +7 -0
  52. package/es/checkout-v2/views/error-view.js +269 -0
  53. package/es/checkout-v2/views/loading-view.d.ts +5 -0
  54. package/es/checkout-v2/views/loading-view.js +158 -0
  55. package/es/checkout-v2/views/success-view.d.ts +29 -0
  56. package/es/checkout-v2/views/success-view.js +614 -0
  57. package/es/components/phone-field.d.ts +14 -0
  58. package/es/components/phone-field.js +96 -0
  59. package/es/index.d.ts +3 -1
  60. package/es/index.js +3 -1
  61. package/es/locales/en.js +45 -6
  62. package/es/locales/zh.js +45 -6
  63. package/es/payment/form/index.js +10 -1
  64. package/lib/checkout-v2/checkout-v2.d.ts +2 -0
  65. package/lib/checkout-v2/checkout-v2.js +151 -0
  66. package/lib/checkout-v2/components/dialogs/checkout-dialogs.d.ts +1 -0
  67. package/lib/checkout-v2/components/dialogs/checkout-dialogs.js +131 -0
  68. package/lib/checkout-v2/components/left/billing-toggle.d.ts +6 -0
  69. package/lib/checkout-v2/components/left/billing-toggle.js +126 -0
  70. package/lib/checkout-v2/components/left/cross-sell-card.d.ts +10 -0
  71. package/lib/checkout-v2/components/left/cross-sell-card.js +257 -0
  72. package/lib/checkout-v2/components/left/product-item-card.d.ts +26 -0
  73. package/lib/checkout-v2/components/left/product-item-card.js +738 -0
  74. package/lib/checkout-v2/components/left/promotion-input.d.ts +19 -0
  75. package/lib/checkout-v2/components/left/promotion-input.js +220 -0
  76. package/lib/checkout-v2/components/left/staking-breakdown.d.ts +9 -0
  77. package/lib/checkout-v2/components/left/staking-breakdown.js +96 -0
  78. package/lib/checkout-v2/components/left/trial-info.d.ts +13 -0
  79. package/lib/checkout-v2/components/left/trial-info.js +82 -0
  80. package/lib/checkout-v2/components/right/currency-grid.d.ts +8 -0
  81. package/lib/checkout-v2/components/right/currency-grid.js +96 -0
  82. package/lib/checkout-v2/components/right/customer-info-card.d.ts +17 -0
  83. package/lib/checkout-v2/components/right/customer-info-card.js +246 -0
  84. package/lib/checkout-v2/components/right/status-feedback.d.ts +7 -0
  85. package/lib/checkout-v2/components/right/status-feedback.js +30 -0
  86. package/lib/checkout-v2/components/right/submit-button.d.ts +10 -0
  87. package/lib/checkout-v2/components/right/submit-button.js +35 -0
  88. package/lib/checkout-v2/components/right/subscription-disclaimer.d.ts +11 -0
  89. package/lib/checkout-v2/components/right/subscription-disclaimer.js +33 -0
  90. package/lib/checkout-v2/components/shared/exchange-rate-footer.d.ts +23 -0
  91. package/lib/checkout-v2/components/shared/exchange-rate-footer.js +282 -0
  92. package/lib/checkout-v2/components/shared/scenario-badge.d.ts +6 -0
  93. package/lib/checkout-v2/components/shared/scenario-badge.js +57 -0
  94. package/lib/checkout-v2/components/shared/total-display.d.ts +7 -0
  95. package/lib/checkout-v2/components/shared/total-display.js +154 -0
  96. package/lib/checkout-v2/index.d.ts +2 -0
  97. package/lib/checkout-v2/index.js +13 -0
  98. package/lib/checkout-v2/layouts/checkout-layout.d.ts +7 -0
  99. package/lib/checkout-v2/layouts/checkout-layout.js +308 -0
  100. package/lib/checkout-v2/panels/left/composite-panel.d.ts +1 -0
  101. package/lib/checkout-v2/panels/left/composite-panel.js +515 -0
  102. package/lib/checkout-v2/panels/left/credit-topup-panel.d.ts +1 -0
  103. package/lib/checkout-v2/panels/left/credit-topup-panel.js +799 -0
  104. package/lib/checkout-v2/panels/left/scenario-router.d.ts +1 -0
  105. package/lib/checkout-v2/panels/left/scenario-router.js +29 -0
  106. package/lib/checkout-v2/panels/right/payment-panel.d.ts +1 -0
  107. package/lib/checkout-v2/panels/right/payment-panel.js +906 -0
  108. package/lib/checkout-v2/types.d.ts +15 -0
  109. package/lib/checkout-v2/types.js +1 -0
  110. package/lib/checkout-v2/utils/format.d.ts +59 -0
  111. package/lib/checkout-v2/utils/format.js +158 -0
  112. package/lib/checkout-v2/utils/scenario-detector.d.ts +3 -0
  113. package/lib/checkout-v2/utils/scenario-detector.js +23 -0
  114. package/lib/checkout-v2/views/error-view.d.ts +7 -0
  115. package/lib/checkout-v2/views/error-view.js +321 -0
  116. package/lib/checkout-v2/views/loading-view.d.ts +5 -0
  117. package/lib/checkout-v2/views/loading-view.js +168 -0
  118. package/lib/checkout-v2/views/success-view.d.ts +29 -0
  119. package/lib/checkout-v2/views/success-view.js +735 -0
  120. package/lib/components/phone-field.d.ts +14 -0
  121. package/lib/components/phone-field.js +130 -0
  122. package/lib/index.d.ts +3 -1
  123. package/lib/index.js +8 -0
  124. package/lib/locales/en.js +45 -6
  125. package/lib/locales/zh.js +45 -6
  126. package/lib/payment/form/index.js +10 -1
  127. package/package.json +4 -3
  128. package/src/checkout-v2/checkout-v2.tsx +155 -0
  129. package/src/checkout-v2/components/dialogs/checkout-dialogs.tsx +134 -0
  130. package/src/checkout-v2/components/left/billing-toggle.tsx +122 -0
  131. package/src/checkout-v2/components/left/cross-sell-card.tsx +170 -0
  132. package/src/checkout-v2/components/left/product-item-card.tsx +634 -0
  133. package/src/checkout-v2/components/left/promotion-input.tsx +207 -0
  134. package/src/checkout-v2/components/left/staking-breakdown.tsx +57 -0
  135. package/src/checkout-v2/components/left/trial-info.tsx +63 -0
  136. package/src/checkout-v2/components/right/currency-grid.tsx +59 -0
  137. package/src/checkout-v2/components/right/customer-info-card.tsx +214 -0
  138. package/src/checkout-v2/components/right/status-feedback.tsx +35 -0
  139. package/src/checkout-v2/components/right/submit-button.tsx +37 -0
  140. package/src/checkout-v2/components/right/subscription-disclaimer.tsx +27 -0
  141. package/src/checkout-v2/components/shared/exchange-rate-footer.tsx +221 -0
  142. package/src/checkout-v2/components/shared/scenario-badge.tsx +51 -0
  143. package/src/checkout-v2/components/shared/total-display.tsx +112 -0
  144. package/src/checkout-v2/index.ts +2 -0
  145. package/src/checkout-v2/layouts/checkout-layout.tsx +232 -0
  146. package/src/checkout-v2/panels/left/composite-panel.tsx +465 -0
  147. package/src/checkout-v2/panels/left/credit-topup-panel.tsx +681 -0
  148. package/src/checkout-v2/panels/left/scenario-router.tsx +22 -0
  149. package/src/checkout-v2/panels/right/payment-panel.tsx +703 -0
  150. package/src/checkout-v2/types.ts +18 -0
  151. package/src/checkout-v2/utils/format.ts +204 -0
  152. package/src/checkout-v2/utils/scenario-detector.ts +30 -0
  153. package/src/checkout-v2/views/error-view.tsx +293 -0
  154. package/src/checkout-v2/views/loading-view.tsx +162 -0
  155. package/src/checkout-v2/views/success-view.tsx +770 -0
  156. package/src/components/phone-field.tsx +119 -0
  157. package/src/index.ts +3 -0
  158. package/src/locales/en.tsx +45 -4
  159. package/src/locales/zh.tsx +43 -4
  160. package/src/payment/form/index.tsx +16 -1
@@ -0,0 +1,19 @@
1
+ interface PromotionInputProps {
2
+ promotion: {
3
+ applied: boolean;
4
+ code: string | null;
5
+ active: boolean;
6
+ inactiveReason: string | null;
7
+ apply: (code: string) => Promise<{
8
+ success: boolean;
9
+ error?: string;
10
+ }>;
11
+ remove: () => Promise<void>;
12
+ };
13
+ discounts: any[];
14
+ discountAmount: string | null;
15
+ /** Start with input field visible (skip the "Add promotion code" button) */
16
+ initialShowInput?: boolean;
17
+ }
18
+ export default function PromotionInput({ promotion, discounts, discountAmount, initialShowInput, }: PromotionInputProps): import("react").JSX.Element | null;
19
+ export {};
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = PromotionInput;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _react = require("react");
9
+ var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
10
+ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
11
+ var _LocalOffer = _interopRequireDefault(require("@mui/icons-material/LocalOffer"));
12
+ var _material = require("@mui/material");
13
+ var _context = require("@arcblock/ux/lib/Locale/context");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function PromotionInput({
16
+ promotion,
17
+ discounts,
18
+ discountAmount,
19
+ initialShowInput = false
20
+ }) {
21
+ const {
22
+ t
23
+ } = (0, _context.useLocaleContext)();
24
+ const [showInput, setShowInput] = (0, _react.useState)(false);
25
+ const [code, setCode] = (0, _react.useState)("");
26
+ const [applying, setApplying] = (0, _react.useState)(false);
27
+ const [error, setError] = (0, _react.useState)("");
28
+ const effectiveShowInput = initialShowInput || showInput;
29
+ const handleApply = async () => {
30
+ if (!code.trim()) return;
31
+ setApplying(true);
32
+ setError("");
33
+ const result = await promotion.apply(code.trim());
34
+ if (!result.success) {
35
+ setError(result.error || "Invalid code");
36
+ } else {
37
+ setCode("");
38
+ setShowInput(false);
39
+ }
40
+ setApplying(false);
41
+ };
42
+ const handleKeyPress = event => {
43
+ if (event.key === "Enter" && !applying && code.trim()) {
44
+ handleApply();
45
+ }
46
+ };
47
+ if (discounts?.length > 0) {
48
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
49
+ children: discounts.map((disc, i) => {
50
+ const discCode = disc.promotion_code_details?.code || disc.verification_data?.code || disc.promotion_code || "";
51
+ const coupon = disc.coupon_details || {};
52
+ const couponOff = coupon.percent_off > 0 ? t("payment.checkout.coupon.percentage", {
53
+ percent: coupon.percent_off
54
+ }) : `${coupon.percent_off || 0}%`;
55
+ let description = "";
56
+ if (coupon.duration === "repeating" && coupon.duration_in_months) {
57
+ const months = coupon.duration_in_months;
58
+ description = `${couponOff} for ${months} month${months > 1 ? "s" : ""}`;
59
+ } else if (coupon.duration === "forever") {
60
+ description = t("payment.checkout.coupon.terms.forever", {
61
+ couponOff
62
+ });
63
+ } else if (coupon.duration === "once") {
64
+ description = t("payment.checkout.coupon.terms.once", {
65
+ couponOff
66
+ });
67
+ }
68
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
69
+ direction: "row",
70
+ justifyContent: "space-between",
71
+ alignItems: "center",
72
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
73
+ direction: "row",
74
+ alignItems: "center",
75
+ spacing: 0.5,
76
+ sx: {
77
+ bgcolor: theme => theme.palette.mode === "dark" ? "rgba(18,184,134,0.1)" : "#ebfef5",
78
+ px: 1.5,
79
+ py: 0.5,
80
+ borderRadius: "8px",
81
+ border: "1px solid",
82
+ borderColor: theme => theme.palette.mode === "dark" ? "rgba(18,184,134,0.2)" : "#d3f9e8"
83
+ },
84
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_LocalOffer.default, {
85
+ sx: {
86
+ color: "#12b886",
87
+ fontSize: 14
88
+ }
89
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
90
+ sx: {
91
+ fontWeight: 700,
92
+ fontSize: 13,
93
+ color: "#12b886"
94
+ },
95
+ children: discCode
96
+ }), description && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
97
+ sx: {
98
+ fontSize: 12,
99
+ color: "#12b886",
100
+ fontWeight: 500,
101
+ opacity: 0.8
102
+ },
103
+ children: ["\xB7 ", description]
104
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.IconButton, {
105
+ size: "small",
106
+ onClick: promotion.remove,
107
+ sx: {
108
+ width: 18,
109
+ height: 18,
110
+ ml: 0.25
111
+ },
112
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Close.default, {
113
+ sx: {
114
+ fontSize: 12,
115
+ color: "#12b886"
116
+ }
117
+ })
118
+ })]
119
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
120
+ sx: {
121
+ color: "text.primary",
122
+ fontWeight: 600,
123
+ fontSize: 14
124
+ },
125
+ children: ["-", discountAmount || "0"]
126
+ })]
127
+ }, disc.promotion_code || disc.coupon || i);
128
+ })
129
+ });
130
+ }
131
+ if (!promotion.active) return null;
132
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
133
+ sx: {
134
+ minHeight: 36
135
+ },
136
+ children: effectiveShowInput ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
137
+ onBlur: e => {
138
+ if (initialShowInput) return;
139
+ if (!e.currentTarget.contains(e.relatedTarget) && !code.trim()) {
140
+ setShowInput(false);
141
+ }
142
+ },
143
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
144
+ fullWidth: true,
145
+ size: "small",
146
+ value: code,
147
+ onChange: e => setCode(e.target.value),
148
+ onKeyPress: handleKeyPress,
149
+ placeholder: t("payment.checkout.promotion.placeholder"),
150
+ disabled: applying,
151
+ autoFocus: true,
152
+ slotProps: {
153
+ input: {
154
+ endAdornment: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.InputAdornment, {
155
+ position: "end",
156
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
157
+ size: "small",
158
+ onClick: handleApply,
159
+ disabled: !code.trim() || applying,
160
+ variant: "text",
161
+ sx: {
162
+ color: "primary.main",
163
+ fontSize: 13,
164
+ textTransform: "none",
165
+ minWidth: "auto",
166
+ fontWeight: 600
167
+ },
168
+ children: applying ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {
169
+ size: 16
170
+ }) : t("payment.checkout.promotion.apply")
171
+ })
172
+ })
173
+ }
174
+ },
175
+ sx: {
176
+ "& .MuiOutlinedInput-root": {
177
+ pr: 1,
178
+ borderRadius: "8px",
179
+ height: 36
180
+ },
181
+ "& .MuiOutlinedInput-input": {
182
+ py: "6px",
183
+ fontSize: 13
184
+ }
185
+ }
186
+ }), error && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Alert, {
187
+ severity: "error",
188
+ sx: {
189
+ mt: 0.5,
190
+ py: 0,
191
+ fontSize: 12,
192
+ borderRadius: "6px"
193
+ },
194
+ children: error
195
+ })]
196
+ }) : /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
197
+ onClick: () => setShowInput(true),
198
+ startIcon: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Add.default, {
199
+ sx: {
200
+ fontSize: 18
201
+ }
202
+ }),
203
+ variant: "text",
204
+ sx: {
205
+ fontWeight: 600,
206
+ fontSize: 13,
207
+ textTransform: "none",
208
+ justifyContent: "flex-start",
209
+ p: 0,
210
+ height: 36,
211
+ color: "primary.main",
212
+ "&:hover": {
213
+ backgroundColor: "transparent",
214
+ textDecoration: "underline"
215
+ }
216
+ },
217
+ children: t("payment.checkout.promotion.add_code")
218
+ })
219
+ });
220
+ }
@@ -0,0 +1,9 @@
1
+ interface StakingBreakdownProps {
2
+ staking: string;
3
+ paymentAmount: string;
4
+ trialActive: boolean;
5
+ trialDays: number;
6
+ afterTrialInterval: string | null;
7
+ }
8
+ export default function StakingBreakdown({ staking, paymentAmount, trialActive, trialDays, afterTrialInterval, }: StakingBreakdownProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = StakingBreakdown;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _HelpOutline = _interopRequireDefault(require("@mui/icons-material/HelpOutline"));
9
+ var _material = require("@mui/material");
10
+ var _context = require("@arcblock/ux/lib/Locale/context");
11
+ var _format = require("../../utils/format");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function StakingBreakdown({
14
+ staking,
15
+ paymentAmount,
16
+ trialActive,
17
+ trialDays,
18
+ afterTrialInterval
19
+ }) {
20
+ const {
21
+ t
22
+ } = (0, _context.useLocaleContext)();
23
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
24
+ spacing: 1,
25
+ sx: {
26
+ mb: 1
27
+ },
28
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
29
+ direction: "row",
30
+ justifyContent: "space-between",
31
+ alignItems: "center",
32
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
33
+ direction: "row",
34
+ spacing: 0.5,
35
+ alignItems: "center",
36
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
37
+ sx: {
38
+ color: "text.secondary",
39
+ fontSize: 14
40
+ },
41
+ children: t("payment.checkout.paymentRequired")
42
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Tooltip, {
43
+ title: t("payment.checkout.stakingConfirm"),
44
+ placement: "top",
45
+ arrow: true,
46
+ slotProps: {
47
+ popper: {
48
+ sx: _format.whiteTooltipSx
49
+ }
50
+ },
51
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_HelpOutline.default, {
52
+ sx: {
53
+ fontSize: 16,
54
+ color: "text.disabled"
55
+ }
56
+ })
57
+ })]
58
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
59
+ children: trialActive ? (0, _format.formatTrialText)(t, trialDays, afterTrialInterval || "day") : paymentAmount
60
+ })]
61
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
62
+ direction: "row",
63
+ justifyContent: "space-between",
64
+ alignItems: "center",
65
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
66
+ direction: "row",
67
+ spacing: 0.5,
68
+ alignItems: "center",
69
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
70
+ sx: {
71
+ color: "text.secondary",
72
+ fontSize: 14
73
+ },
74
+ children: t("payment.checkout.staking.title")
75
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Tooltip, {
76
+ title: t("payment.checkout.staking.tooltip"),
77
+ placement: "top",
78
+ arrow: true,
79
+ slotProps: {
80
+ popper: {
81
+ sx: _format.whiteTooltipSx
82
+ }
83
+ },
84
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_HelpOutline.default, {
85
+ sx: {
86
+ fontSize: 16,
87
+ color: "text.disabled"
88
+ }
89
+ })
90
+ })]
91
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
92
+ children: staking
93
+ })]
94
+ })]
95
+ });
96
+ }
@@ -0,0 +1,13 @@
1
+ import type { TLineItemExpanded } from '@blocklet/payment-types';
2
+ interface TrialInfoProps {
3
+ trial: {
4
+ active: boolean;
5
+ days: number;
6
+ afterTrialPrice: string | null;
7
+ afterTrialInterval: string | null;
8
+ };
9
+ mode: string;
10
+ items: TLineItemExpanded[];
11
+ }
12
+ export default function TrialInfo({ trial, mode, items }: TrialInfoProps): import("react").JSX.Element | null;
13
+ export {};
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = TrialInfo;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _material = require("@mui/material");
9
+ var _context = require("@arcblock/ux/lib/Locale/context");
10
+ var _format = require("../../utils/format");
11
+ function TrialInfo({
12
+ trial,
13
+ mode,
14
+ items
15
+ }) {
16
+ const {
17
+ t
18
+ } = (0, _context.useLocaleContext)();
19
+ if (trial.active && trial.afterTrialPrice) {
20
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
21
+ direction: "row",
22
+ justifyContent: "space-between",
23
+ alignItems: "center",
24
+ sx: {
25
+ borderTop: "1px solid",
26
+ borderColor: "divider",
27
+ pt: 1,
28
+ mt: 1
29
+ },
30
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
31
+ sx: {
32
+ color: "text.secondary",
33
+ fontSize: 14
34
+ },
35
+ children: t("common.nextCharge")
36
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
37
+ sx: {
38
+ fontSize: 16,
39
+ color: "text.secondary"
40
+ },
41
+ children: [trial.afterTrialPrice, trial.afterTrialInterval ? ` ${t(_format.INTERVAL_LOCALE_KEY[trial.afterTrialInterval] || "")}` : ""]
42
+ })]
43
+ });
44
+ }
45
+ if (!trial.active && ["subscription", "setup"].includes(mode)) {
46
+ const meteredItem = items.find(item => (item.upsell_price || item.price)?.recurring?.usage_type === "metered");
47
+ if (!meteredItem) return null;
48
+ const meteredInterval = (meteredItem.upsell_price || meteredItem.price)?.recurring?.interval;
49
+ if (!meteredInterval) return null;
50
+ const recurringText = t("common.per", {
51
+ interval: t(`common.${meteredInterval}`)
52
+ });
53
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
54
+ direction: "row",
55
+ justifyContent: "space-between",
56
+ alignItems: "center",
57
+ sx: {
58
+ borderTop: "1px solid",
59
+ borderColor: "divider",
60
+ pt: 1,
61
+ mt: 1
62
+ },
63
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
64
+ sx: {
65
+ color: "text.secondary",
66
+ fontSize: 14,
67
+ fontWeight: 600
68
+ },
69
+ children: t("common.nextCharge")
70
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
71
+ sx: {
72
+ fontSize: 16,
73
+ color: "text.secondary"
74
+ },
75
+ children: t("payment.checkout.metered", {
76
+ recurring: recurringText
77
+ })
78
+ })]
79
+ });
80
+ }
81
+ return null;
82
+ }
@@ -0,0 +1,8 @@
1
+ import type { TPaymentCurrency } from '@blocklet/payment-types';
2
+ interface CurrencyGridProps {
3
+ currencies: TPaymentCurrency[];
4
+ selectedId: string | undefined;
5
+ onSelect: (id: string) => Promise<void>;
6
+ }
7
+ export default function CurrencyGrid({ currencies, selectedId, onSelect }: CurrencyGridProps): import("react").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = CurrencyGrid;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _material = require("@mui/material");
9
+ var _styles = require("@mui/material/styles");
10
+ const CurrencyRoot = (0, _styles.styled)("section")`
11
+ display: grid;
12
+ width: 100%;
13
+ gap: 12px;
14
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
15
+
16
+ .cko-payment-card {
17
+ position: relative;
18
+ border: 1px solid ${({
19
+ theme
20
+ }) => theme.palette.primary.main};
21
+ padding: 4px 8px;
22
+ cursor: pointer;
23
+ background: ${({
24
+ theme
25
+ }) => theme.palette.grey[50]};
26
+ }
27
+
28
+ .cko-payment-card-unselect {
29
+ border: 1px solid ${({
30
+ theme
31
+ }) => theme.palette.divider};
32
+ padding: 4px 8px;
33
+ cursor: pointer;
34
+ background: ${({
35
+ theme
36
+ }) => theme.palette.grey[50]};
37
+ }
38
+ `;
39
+ function CurrencyGrid({
40
+ currencies,
41
+ selectedId,
42
+ onSelect
43
+ }) {
44
+ if (!currencies?.length) return null;
45
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(CurrencyRoot, {
46
+ style: {
47
+ display: currencies.length > 1 ? "grid" : "block"
48
+ },
49
+ children: currencies.map(cur => {
50
+ const selected = cur.id === selectedId;
51
+ const methodName = cur.method?.name || cur.name || "";
52
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Card, {
53
+ variant: "outlined",
54
+ onClick: () => onSelect(cur.id),
55
+ className: selected ? "cko-payment-card" : "cko-payment-card-unselect",
56
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
57
+ direction: "row",
58
+ sx: {
59
+ alignItems: "center",
60
+ position: "relative"
61
+ },
62
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
63
+ src: cur.logo,
64
+ alt: cur.name,
65
+ sx: {
66
+ width: 40,
67
+ height: 40,
68
+ mr: "12px"
69
+ }
70
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)("div", {
71
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
72
+ sx: {
73
+ fontSize: 16,
74
+ color: "text.primary",
75
+ fontWeight: 500
76
+ },
77
+ children: cur.symbol
78
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
79
+ sx: {
80
+ color: "text.secondary",
81
+ fontSize: 14
82
+ },
83
+ children: methodName
84
+ })]
85
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Radio, {
86
+ checked: selected,
87
+ sx: {
88
+ position: "absolute",
89
+ right: 0
90
+ }
91
+ })]
92
+ })
93
+ }, cur.id);
94
+ })
95
+ });
96
+ }
@@ -0,0 +1,17 @@
1
+ interface FieldConfig {
2
+ name: string;
3
+ type: string;
4
+ required: boolean;
5
+ }
6
+ interface CustomerInfoCardProps {
7
+ form: {
8
+ fields: FieldConfig[];
9
+ values: Record<string, any>;
10
+ onChange: (field: string, value: string | boolean | Record<string, string>) => void;
11
+ errors: Partial<Record<string, string>>;
12
+ validateField: (field: string) => Promise<void>;
13
+ };
14
+ isLoggedIn: boolean;
15
+ }
16
+ export default function CustomerInfoCard({ form, isLoggedIn }: CustomerInfoCardProps): import("react").JSX.Element | null;
17
+ export {};