@blocklet/payment-react 1.18.56 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/checkout/donate.d.ts +1 -15
- package/es/checkout/donate.js +301 -189
- package/es/checkout/form.d.ts +1 -15
- package/es/checkout/form.js +5 -13
- package/es/checkout/table.js +3 -3
- package/es/components/blockchain/gas.d.ts +1 -5
- package/es/components/blockchain/gas.js +10 -2
- package/es/components/blockchain/tx.d.ts +1 -8
- package/es/components/blockchain/tx.js +29 -10
- package/es/components/confirm.d.ts +1 -10
- package/es/components/confirm.js +4 -10
- package/es/components/country-select.d.ts +3 -2
- package/es/components/country-select.js +375 -352
- package/es/components/date-range-picker.d.ts +13 -0
- package/es/components/date-range-picker.js +279 -0
- package/es/components/input.d.ts +14 -20
- package/es/components/input.js +51 -44
- package/es/components/label.d.ts +7 -0
- package/es/components/label.js +49 -0
- package/es/components/lazy-loader.js +1 -2
- package/es/components/link.d.ts +2 -9
- package/es/components/link.js +9 -6
- package/es/components/livemode.d.ts +2 -8
- package/es/components/livemode.js +1 -5
- package/es/components/loading-button.d.ts +6 -1
- package/es/components/loading-button.js +56 -66
- package/es/components/over-due-invoice-payment.d.ts +0 -18
- package/es/components/over-due-invoice-payment.js +138 -95
- package/es/components/payment-beneficiaries.d.ts +2 -7
- package/es/components/payment-beneficiaries.js +86 -40
- package/es/components/pricing-item.d.ts +0 -5
- package/es/components/pricing-item.js +1 -4
- package/es/components/pricing-table.d.ts +2 -10
- package/es/components/pricing-table.js +8 -7
- package/es/components/resume-subscription.d.ts +0 -10
- package/es/components/resume-subscription.js +42 -21
- package/es/components/truncated-text.d.ts +2 -9
- package/es/components/truncated-text.js +0 -5
- package/es/contexts/donate.d.ts +0 -7
- package/es/contexts/donate.js +10 -8
- package/es/contexts/payment.d.ts +1 -4
- package/es/contexts/payment.js +7 -2
- package/es/history/credit/grants-list.d.ts +14 -0
- package/es/history/credit/grants-list.js +215 -0
- package/es/history/credit/transactions-list.d.ts +13 -0
- package/es/history/credit/transactions-list.js +255 -0
- package/es/history/invoice/list.d.ts +2 -18
- package/es/history/invoice/list.js +172 -74
- package/es/history/payment/list.js +115 -38
- package/es/hooks/keyboard.d.ts +1 -1
- package/es/hooks/keyboard.js +2 -4
- package/es/index.d.ts +5 -1
- package/es/index.js +10 -1
- package/es/libs/cached-request.js +2 -4
- package/es/libs/phone-validator.js +1 -2
- package/es/libs/util.d.ts +2 -0
- package/es/libs/util.js +14 -4
- package/es/libs/validator.js +2 -4
- package/es/locales/en.js +20 -2
- package/es/locales/zh.js +20 -2
- package/es/payment/amount.d.ts +2 -7
- package/es/payment/amount.js +1 -5
- package/es/payment/donation-form.d.ts +2 -10
- package/es/payment/donation-form.js +196 -160
- package/es/payment/error.d.ts +2 -8
- package/es/payment/error.js +40 -20
- package/es/payment/footer.d.ts +2 -3
- package/es/payment/footer.js +19 -6
- package/es/payment/form/addon.js +14 -4
- package/es/payment/form/address.d.ts +2 -9
- package/es/payment/form/address.js +3 -6
- package/es/payment/form/currency.js +45 -25
- package/es/payment/form/index.d.ts +2 -8
- package/es/payment/form/index.js +151 -71
- package/es/payment/form/phone.js +2 -4
- package/es/payment/form/stripe/form.d.ts +2 -8
- package/es/payment/form/stripe/form.js +1 -3
- package/es/payment/header.js +38 -16
- package/es/payment/index.d.ts +2 -9
- package/es/payment/index.js +23 -17
- package/es/payment/product-card.d.ts +2 -11
- package/es/payment/product-card.js +84 -50
- package/es/payment/product-donation.js +175 -114
- package/es/payment/product-item.d.ts +9 -9
- package/es/payment/product-item.js +320 -145
- package/es/payment/product-skeleton.js +2 -2
- package/es/payment/skeleton/donation.js +27 -7
- package/es/payment/skeleton/overview.js +22 -2
- package/es/payment/skeleton/payment.js +33 -5
- package/es/payment/success.d.ts +2 -9
- package/es/payment/success.js +41 -14
- package/es/payment/summary.d.ts +4 -17
- package/es/payment/summary.js +193 -111
- package/es/theme/index.d.ts +0 -5
- package/es/theme/index.js +2 -5
- package/es/theme/typography.d.ts +2 -2
- package/lib/checkout/donate.d.ts +1 -15
- package/lib/checkout/donate.js +75 -54
- package/lib/checkout/form.d.ts +1 -15
- package/lib/checkout/form.js +7 -15
- package/lib/checkout/table.js +4 -4
- package/lib/components/blockchain/gas.d.ts +1 -5
- package/lib/components/blockchain/gas.js +3 -2
- package/lib/components/blockchain/tx.d.ts +1 -8
- package/lib/components/blockchain/tx.js +15 -10
- package/lib/components/confirm.d.ts +1 -10
- package/lib/components/confirm.js +5 -11
- package/lib/components/country-select.d.ts +3 -2
- package/lib/components/country-select.js +23 -22
- package/lib/components/date-range-picker.d.ts +13 -0
- package/lib/components/date-range-picker.js +329 -0
- package/lib/components/input.d.ts +14 -20
- package/lib/components/input.js +28 -27
- package/lib/components/label.d.ts +7 -0
- package/lib/components/label.js +60 -0
- package/lib/components/lazy-loader.js +1 -1
- package/lib/components/link.d.ts +2 -9
- package/lib/components/link.js +3 -8
- package/lib/components/livemode.d.ts +2 -8
- package/lib/components/livemode.js +3 -7
- package/lib/components/loading-button.d.ts +6 -1
- package/lib/components/loading-button.js +9 -17
- package/lib/components/over-due-invoice-payment.d.ts +0 -18
- package/lib/components/over-due-invoice-payment.js +31 -33
- package/lib/components/payment-beneficiaries.d.ts +2 -7
- package/lib/components/payment-beneficiaries.js +12 -11
- package/lib/components/pricing-item.d.ts +0 -5
- package/lib/components/pricing-item.js +2 -5
- package/lib/components/pricing-table.d.ts +2 -10
- package/lib/components/pricing-table.js +5 -11
- package/lib/components/resume-subscription.d.ts +0 -10
- package/lib/components/resume-subscription.js +16 -16
- package/lib/components/table.js +1 -1
- package/lib/components/truncated-text.d.ts +2 -9
- package/lib/components/truncated-text.js +1 -6
- package/lib/contexts/donate.d.ts +0 -7
- package/lib/contexts/donate.js +4 -7
- package/lib/contexts/payment.d.ts +1 -4
- package/lib/contexts/payment.js +4 -7
- package/lib/history/credit/grants-list.d.ts +14 -0
- package/lib/history/credit/grants-list.js +277 -0
- package/lib/history/credit/transactions-list.d.ts +13 -0
- package/lib/history/credit/transactions-list.js +301 -0
- package/lib/history/invoice/list.d.ts +2 -18
- package/lib/history/invoice/list.js +73 -37
- package/lib/history/payment/list.js +30 -16
- package/lib/hooks/keyboard.d.ts +1 -1
- package/lib/hooks/mobile.js +1 -1
- package/lib/hooks/subscription.js +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.js +41 -2
- package/lib/libs/api.js +1 -1
- package/lib/libs/dayjs.js +1 -1
- package/lib/libs/phone-validator.js +0 -2
- package/lib/libs/theme.js +1 -1
- package/lib/libs/util.d.ts +2 -0
- package/lib/libs/util.js +15 -1
- package/lib/libs/validator.js +1 -1
- package/lib/locales/en.js +21 -3
- package/lib/locales/index.js +1 -1
- package/lib/locales/zh.js +21 -3
- package/lib/payment/amount.d.ts +2 -7
- package/lib/payment/amount.js +2 -6
- package/lib/payment/donation-form.d.ts +2 -10
- package/lib/payment/donation-form.js +33 -38
- package/lib/payment/error.d.ts +2 -8
- package/lib/payment/error.js +11 -13
- package/lib/payment/footer.d.ts +2 -3
- package/lib/payment/footer.js +5 -5
- package/lib/payment/form/addon.js +5 -3
- package/lib/payment/form/address.d.ts +2 -9
- package/lib/payment/form/address.js +5 -8
- package/lib/payment/form/currency.js +3 -3
- package/lib/payment/form/index.d.ts +2 -8
- package/lib/payment/form/index.js +64 -21
- package/lib/payment/form/phone.js +1 -1
- package/lib/payment/form/stripe/form.d.ts +2 -8
- package/lib/payment/form/stripe/form.js +3 -6
- package/lib/payment/header.js +8 -4
- package/lib/payment/index.d.ts +2 -9
- package/lib/payment/index.js +27 -18
- package/lib/payment/product-card.d.ts +2 -11
- package/lib/payment/product-card.js +13 -20
- package/lib/payment/product-donation.js +71 -66
- package/lib/payment/product-item.d.ts +9 -9
- package/lib/payment/product-item.js +168 -29
- package/lib/payment/product-skeleton.js +2 -2
- package/lib/payment/skeleton/donation.js +8 -4
- package/lib/payment/skeleton/overview.js +6 -2
- package/lib/payment/skeleton/payment.js +9 -3
- package/lib/payment/success.d.ts +2 -9
- package/lib/payment/success.js +12 -15
- package/lib/payment/summary.d.ts +4 -17
- package/lib/payment/summary.js +53 -45
- package/lib/theme/index.d.ts +0 -5
- package/lib/theme/index.js +2 -5
- package/lib/theme/typography.d.ts +2 -2
- package/package.json +40 -40
- package/src/checkout/donate.tsx +103 -35
- package/src/checkout/form.tsx +5 -14
- package/src/checkout/table.tsx +3 -3
- package/src/components/blockchain/gas.tsx +5 -3
- package/src/components/blockchain/tx.tsx +19 -11
- package/src/components/confirm.tsx +4 -11
- package/src/components/country-select.tsx +391 -378
- package/src/components/date-range-picker.tsx +310 -0
- package/src/components/input.tsx +61 -46
- package/src/components/label.tsx +58 -0
- package/src/components/link.tsx +9 -7
- package/src/components/livemode.tsx +2 -6
- package/src/components/loading-button.tsx +63 -76
- package/src/components/over-due-invoice-payment.tsx +43 -28
- package/src/components/payment-beneficiaries.tsx +33 -14
- package/src/components/pricing-item.tsx +1 -4
- package/src/components/pricing-table.tsx +8 -8
- package/src/components/resume-subscription.tsx +20 -14
- package/src/components/table.tsx +2 -2
- package/src/components/truncated-text.tsx +0 -6
- package/src/contexts/donate.tsx +6 -7
- package/src/contexts/payment.tsx +7 -3
- package/src/history/credit/grants-list.tsx +276 -0
- package/src/history/credit/transactions-list.tsx +317 -0
- package/src/history/invoice/list.tsx +92 -36
- package/src/history/payment/list.tsx +53 -16
- package/src/hooks/keyboard.ts +1 -1
- package/src/index.ts +9 -0
- package/src/libs/util.ts +14 -0
- package/src/locales/en.tsx +20 -0
- package/src/locales/zh.tsx +19 -0
- package/src/payment/amount.tsx +1 -6
- package/src/payment/donation-form.tsx +47 -29
- package/src/payment/error.tsx +16 -8
- package/src/payment/footer.tsx +11 -3
- package/src/payment/form/addon.tsx +6 -1
- package/src/payment/form/address.tsx +3 -7
- package/src/payment/form/currency.tsx +12 -2
- package/src/payment/form/index.tsx +121 -45
- package/src/payment/form/stripe/form.tsx +1 -5
- package/src/payment/header.tsx +14 -2
- package/src/payment/index.tsx +27 -22
- package/src/payment/product-card.tsx +41 -18
- package/src/payment/product-donation.tsx +85 -47
- package/src/payment/product-item.tsx +198 -28
- package/src/payment/product-skeleton.tsx +3 -2
- package/src/payment/skeleton/donation.tsx +12 -2
- package/src/payment/skeleton/overview.tsx +12 -2
- package/src/payment/skeleton/payment.tsx +16 -3
- package/src/payment/success.tsx +26 -15
- package/src/payment/summary.tsx +87 -44
- package/src/theme/index.tsx +5 -8
- package/src/theme/typography.ts +2 -2
package/lib/payment/summary.js
CHANGED
|
@@ -24,7 +24,7 @@ var _livemode = _interopRequireDefault(require("../components/livemode"));
|
|
|
24
24
|
var _payment = require("../contexts/payment");
|
|
25
25
|
var _mobile = require("../hooks/mobile");
|
|
26
26
|
var _loadingButton = _interopRequireDefault(require("../components/loading-button"));
|
|
27
|
-
function _interopRequireDefault(
|
|
27
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
28
|
const ExpandMore = (0, _styles.styled)(props => {
|
|
29
29
|
const {
|
|
30
30
|
expand,
|
|
@@ -83,35 +83,24 @@ function getStakingSetup(items, currency, billingThreshold = 0) {
|
|
|
83
83
|
}
|
|
84
84
|
return "0";
|
|
85
85
|
}
|
|
86
|
-
PaymentSummary.defaultProps = {
|
|
87
|
-
onUpsell: _noop.default,
|
|
88
|
-
onDownsell: _noop.default,
|
|
89
|
-
onApplyCrossSell: _noop.default,
|
|
90
|
-
onCancelCrossSell: _noop.default,
|
|
91
|
-
onChangeAmount: _noop.default,
|
|
92
|
-
checkoutSessionId: "",
|
|
93
|
-
crossSellBehavior: "",
|
|
94
|
-
showStaking: false,
|
|
95
|
-
donationSettings: null,
|
|
96
|
-
action: "",
|
|
97
|
-
trialEnd: 0
|
|
98
|
-
};
|
|
99
86
|
function PaymentSummary({
|
|
100
87
|
items,
|
|
101
88
|
currency,
|
|
102
89
|
trialInDays,
|
|
103
90
|
billingThreshold,
|
|
104
|
-
onUpsell,
|
|
105
|
-
onDownsell,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
91
|
+
onUpsell = _noop.default,
|
|
92
|
+
onDownsell = _noop.default,
|
|
93
|
+
onQuantityChange = _noop.default,
|
|
94
|
+
onApplyCrossSell = _noop.default,
|
|
95
|
+
onCancelCrossSell = _noop.default,
|
|
96
|
+
onChangeAmount = _noop.default,
|
|
97
|
+
checkoutSessionId = "",
|
|
98
|
+
crossSellBehavior = "",
|
|
99
|
+
showStaking = false,
|
|
100
|
+
donationSettings = void 0,
|
|
101
|
+
action = "",
|
|
114
102
|
trialEnd = 0,
|
|
103
|
+
completed = false,
|
|
115
104
|
...rest
|
|
116
105
|
}) {
|
|
117
106
|
const {
|
|
@@ -151,6 +140,10 @@ function PaymentSummary({
|
|
|
151
140
|
await onUpsell(from, to);
|
|
152
141
|
runAsync();
|
|
153
142
|
};
|
|
143
|
+
const handleQuantityChange = async (itemId, quantity) => {
|
|
144
|
+
await onQuantityChange(itemId, quantity);
|
|
145
|
+
runAsync();
|
|
146
|
+
};
|
|
154
147
|
const handleDownsell = async from => {
|
|
155
148
|
await onDownsell(from);
|
|
156
149
|
runAsync();
|
|
@@ -209,11 +202,14 @@ function PaymentSummary({
|
|
|
209
202
|
currency,
|
|
210
203
|
onUpsell: handleUpsell,
|
|
211
204
|
onDownsell: handleDownsell,
|
|
205
|
+
adjustableQuantity: x.adjustable_quantity,
|
|
206
|
+
completed,
|
|
207
|
+
onQuantityChange: handleQuantityChange,
|
|
212
208
|
children: x.cross_sell && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
213
209
|
direction: "row",
|
|
214
|
-
alignItems: "center",
|
|
215
|
-
justifyContent: "space-between",
|
|
216
210
|
sx: {
|
|
211
|
+
alignItems: "center",
|
|
212
|
+
justifyContent: "space-between",
|
|
217
213
|
width: 1
|
|
218
214
|
},
|
|
219
215
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_loadingButton.default, {
|
|
@@ -231,7 +227,9 @@ function PaymentSummary({
|
|
|
231
227
|
}), data && items.some(x => x.price_id === data.id) === false && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Grow, {
|
|
232
228
|
in: true,
|
|
233
229
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
234
|
-
|
|
230
|
+
sx: {
|
|
231
|
+
mt: 1
|
|
232
|
+
},
|
|
235
233
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_productItem.default, {
|
|
236
234
|
item: {
|
|
237
235
|
quantity: 1,
|
|
@@ -247,9 +245,9 @@ function PaymentSummary({
|
|
|
247
245
|
onDownsell: _noop.default,
|
|
248
246
|
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
249
247
|
direction: "row",
|
|
250
|
-
alignItems: "center",
|
|
251
|
-
justifyContent: "space-between",
|
|
252
248
|
sx: {
|
|
249
|
+
alignItems: "center",
|
|
250
|
+
justifyContent: "space-between",
|
|
253
251
|
width: 1
|
|
254
252
|
},
|
|
255
253
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
@@ -283,9 +281,9 @@ function PaymentSummary({
|
|
|
283
281
|
direction: "column",
|
|
284
282
|
...rest,
|
|
285
283
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
286
|
-
display: "flex",
|
|
287
|
-
alignItems: "center",
|
|
288
284
|
sx: {
|
|
285
|
+
display: "flex",
|
|
286
|
+
alignItems: "center",
|
|
289
287
|
mb: 2.5
|
|
290
288
|
},
|
|
291
289
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
@@ -303,13 +301,15 @@ function PaymentSummary({
|
|
|
303
301
|
}), !settings.livemode && /* @__PURE__ */(0, _jsxRuntime.jsx)(_livemode.default, {})]
|
|
304
302
|
}), isMobile && !donationSettings ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
305
303
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
306
|
-
justifyContent: "space-between",
|
|
307
|
-
flexDirection: "row",
|
|
308
|
-
alignItems: "center",
|
|
309
|
-
mb: 1.5,
|
|
310
304
|
onClick: () => setState({
|
|
311
305
|
expanded: !state.expanded
|
|
312
306
|
}),
|
|
307
|
+
sx: {
|
|
308
|
+
justifyContent: "space-between",
|
|
309
|
+
flexDirection: "row",
|
|
310
|
+
alignItems: "center",
|
|
311
|
+
mb: 1.5
|
|
312
|
+
},
|
|
313
313
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
314
314
|
children: t("payment.checkout.productListTotal", {
|
|
315
315
|
total: items.length
|
|
@@ -334,13 +334,17 @@ function PaymentSummary({
|
|
|
334
334
|
}), staking > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
335
335
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
336
336
|
direction: "row",
|
|
337
|
-
justifyContent: "space-between",
|
|
338
|
-
alignItems: "center",
|
|
339
337
|
spacing: 1,
|
|
338
|
+
sx: {
|
|
339
|
+
justifyContent: "space-between",
|
|
340
|
+
alignItems: "center"
|
|
341
|
+
},
|
|
340
342
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
341
343
|
direction: "row",
|
|
342
|
-
alignItems: "center",
|
|
343
344
|
spacing: 0.5,
|
|
345
|
+
sx: {
|
|
346
|
+
alignItems: "center"
|
|
347
|
+
},
|
|
344
348
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
345
349
|
sx: {
|
|
346
350
|
color: "text.secondary"
|
|
@@ -364,13 +368,17 @@ function PaymentSummary({
|
|
|
364
368
|
})]
|
|
365
369
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
366
370
|
direction: "row",
|
|
367
|
-
justifyContent: "space-between",
|
|
368
|
-
alignItems: "center",
|
|
369
371
|
spacing: 1,
|
|
372
|
+
sx: {
|
|
373
|
+
justifyContent: "space-between",
|
|
374
|
+
alignItems: "center"
|
|
375
|
+
},
|
|
370
376
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
371
377
|
direction: "row",
|
|
372
|
-
alignItems: "center",
|
|
373
378
|
spacing: 0.5,
|
|
379
|
+
sx: {
|
|
380
|
+
alignItems: "center"
|
|
381
|
+
},
|
|
374
382
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
375
383
|
sx: {
|
|
376
384
|
color: "text.secondary"
|
|
@@ -394,11 +402,11 @@ function PaymentSummary({
|
|
|
394
402
|
})]
|
|
395
403
|
})]
|
|
396
404
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
397
|
-
display: "flex",
|
|
398
|
-
justifyContent: "space-between",
|
|
399
|
-
flexDirection: "row",
|
|
400
|
-
alignItems: "center",
|
|
401
405
|
sx: {
|
|
406
|
+
display: "flex",
|
|
407
|
+
justifyContent: "space-between",
|
|
408
|
+
flexDirection: "row",
|
|
409
|
+
alignItems: "center",
|
|
402
410
|
width: "100%"
|
|
403
411
|
},
|
|
404
412
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
package/lib/theme/index.d.ts
CHANGED
|
@@ -7,9 +7,4 @@ export declare function PaymentThemeProvider({ children, theme: customTheme, }:
|
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
theme?: PaymentThemeOptions;
|
|
9
9
|
}): JSX.Element;
|
|
10
|
-
export declare namespace PaymentThemeProvider {
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
theme: {};
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
10
|
export { typography };
|
package/lib/theme/index.js
CHANGED
|
@@ -19,9 +19,6 @@ var _react = require("react");
|
|
|
19
19
|
require("./index.css");
|
|
20
20
|
require("./types");
|
|
21
21
|
var _typography = require("./typography");
|
|
22
|
-
PaymentThemeProvider.defaultProps = {
|
|
23
|
-
theme: {}
|
|
24
|
-
};
|
|
25
22
|
function PaymentThemeProvider({
|
|
26
23
|
children,
|
|
27
24
|
theme: customTheme = {}
|
|
@@ -277,7 +274,7 @@ function PaymentThemeProvider({
|
|
|
277
274
|
backgroundColor: palette.chip.default.background,
|
|
278
275
|
borderColor: palette.chip.default.border
|
|
279
276
|
},
|
|
280
|
-
"&.MuiChip-
|
|
277
|
+
"&.MuiChip-filled.MuiChip-colorSecondary": {
|
|
281
278
|
color: palette.chip.secondary.text,
|
|
282
279
|
backgroundColor: palette.chip.secondary.background,
|
|
283
280
|
borderColor: palette.chip.secondary.border
|
|
@@ -292,7 +289,7 @@ function PaymentThemeProvider({
|
|
|
292
289
|
backgroundColor: palette.chip.warning.background,
|
|
293
290
|
borderColor: palette.chip.warning.border
|
|
294
291
|
},
|
|
295
|
-
"&.MuiChip-
|
|
292
|
+
"&.MuiChip-filled.MuiChip-colorPrimary,&.MuiChip-filledInfo": {
|
|
296
293
|
color: palette.chip.info.text,
|
|
297
294
|
backgroundColor: palette.chip.info.background,
|
|
298
295
|
borderColor: palette.chip.info.border
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const typography:
|
|
1
|
+
import type { TypographyStyleOptions } from '@mui/material/styles/createTypography';
|
|
2
|
+
export declare const typography: TypographyStyleOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -54,76 +54,76 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@arcblock/did-connect": "^
|
|
58
|
-
"@arcblock/ux": "^
|
|
57
|
+
"@arcblock/did-connect": "^3.0.1",
|
|
58
|
+
"@arcblock/ux": "^3.0.1",
|
|
59
59
|
"@arcblock/ws": "^1.20.14",
|
|
60
|
-
"@blocklet/theme": "^
|
|
61
|
-
"@blocklet/ui-react": "^
|
|
62
|
-
"@mui/icons-material": "^
|
|
63
|
-
"@mui/lab": "
|
|
64
|
-
"@mui/material": "^
|
|
65
|
-
"@mui/system": "^
|
|
60
|
+
"@blocklet/theme": "^3.0.1",
|
|
61
|
+
"@blocklet/ui-react": "^3.0.1",
|
|
62
|
+
"@mui/icons-material": "^7.1.2",
|
|
63
|
+
"@mui/lab": "7.0.0-beta.14",
|
|
64
|
+
"@mui/material": "^7.1.2",
|
|
65
|
+
"@mui/system": "^7.1.1",
|
|
66
66
|
"@ocap/util": "^1.20.14",
|
|
67
|
-
"@stripe/react-stripe-js": "^2.
|
|
67
|
+
"@stripe/react-stripe-js": "^2.9.0",
|
|
68
68
|
"@stripe/stripe-js": "^2.4.0",
|
|
69
|
-
"@vitejs/plugin-legacy": "^
|
|
70
|
-
"ahooks": "^3.8.
|
|
71
|
-
"axios": "^1.
|
|
72
|
-
"dayjs": "^1.11.
|
|
69
|
+
"@vitejs/plugin-legacy": "^7.0.0",
|
|
70
|
+
"ahooks": "^3.8.5",
|
|
71
|
+
"axios": "^1.10.0",
|
|
72
|
+
"dayjs": "^1.11.13",
|
|
73
73
|
"flat": "^5.0.2",
|
|
74
|
-
"google-libphonenumber": "^3.2.
|
|
74
|
+
"google-libphonenumber": "^3.2.42",
|
|
75
75
|
"lodash": "^4.17.21",
|
|
76
76
|
"numbro": "^2.5.0",
|
|
77
|
-
"p-wait-for": "3",
|
|
78
|
-
"react-error-boundary": "^4.
|
|
79
|
-
"react-hook-form": "^7.
|
|
77
|
+
"p-wait-for": "^3.2.0",
|
|
78
|
+
"react-error-boundary": "^4.1.2",
|
|
79
|
+
"react-hook-form": "^7.58.1",
|
|
80
80
|
"react-international-phone": "^3.1.2",
|
|
81
81
|
"ufo": "^1.6.1",
|
|
82
82
|
"use-bus": "^2.5.2",
|
|
83
|
-
"validator": "^13.
|
|
83
|
+
"validator": "^13.15.15"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"react": "
|
|
86
|
+
"react": "^19.1.0"
|
|
87
87
|
},
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
93
|
-
"@babel/cli": "^7.
|
|
94
|
-
"@babel/core": "^7.
|
|
95
|
-
"@babel/preset-env": "^7.
|
|
96
|
-
"@babel/preset-react": "^7.
|
|
97
|
-
"@blocklet/payment-types": "1.
|
|
93
|
+
"@babel/cli": "^7.27.2",
|
|
94
|
+
"@babel/core": "^7.27.4",
|
|
95
|
+
"@babel/preset-env": "^7.27.2",
|
|
96
|
+
"@babel/preset-react": "^7.27.1",
|
|
97
|
+
"@blocklet/payment-types": "1.19.1",
|
|
98
98
|
"@storybook/addon-essentials": "^7.6.20",
|
|
99
99
|
"@storybook/addon-interactions": "^7.6.20",
|
|
100
100
|
"@storybook/addon-links": "^7.6.20",
|
|
101
101
|
"@storybook/addon-onboarding": "^1.0.11",
|
|
102
102
|
"@storybook/blocks": "^7.6.20",
|
|
103
103
|
"@storybook/react": "^7.6.20",
|
|
104
|
-
"@storybook/react-vite": "^
|
|
104
|
+
"@storybook/react-vite": "^9.0.13",
|
|
105
105
|
"@storybook/test": "^7.6.20",
|
|
106
|
-
"@types/react": "^18.3.
|
|
107
|
-
"@types/react-dom": "^18.3.
|
|
108
|
-
"@vitejs/plugin-legacy": "^
|
|
106
|
+
"@types/react": "^18.3.23",
|
|
107
|
+
"@types/react-dom": "^18.3.7",
|
|
108
|
+
"@vitejs/plugin-legacy": "^7.0.0",
|
|
109
109
|
"copyfiles": "^2.4.1",
|
|
110
|
-
"eslint": "^8.57.
|
|
110
|
+
"eslint": "^8.57.1",
|
|
111
111
|
"glob": "^10.4.5",
|
|
112
112
|
"import-sort-style-module": "^6.0.0",
|
|
113
113
|
"jest": "^29.7.0",
|
|
114
|
-
"prettier": "^3.
|
|
114
|
+
"prettier": "^3.6.0",
|
|
115
115
|
"prettier-plugin-import-sort": "^0.0.7",
|
|
116
|
-
"react": "
|
|
117
|
-
"react-dom": "
|
|
116
|
+
"react": "^19.1.0",
|
|
117
|
+
"react-dom": "^19.1.0",
|
|
118
118
|
"rollup-plugin-node-builtins": "^2.1.2",
|
|
119
119
|
"storybook": "^7.6.20",
|
|
120
|
-
"ts-jest": "^29.
|
|
121
|
-
"type-fest": "^4.
|
|
122
|
-
"typescript": "
|
|
120
|
+
"ts-jest": "^29.4.0",
|
|
121
|
+
"type-fest": "^4.41.0",
|
|
122
|
+
"typescript": "5.5.4",
|
|
123
123
|
"unbuild": "^2.0.0",
|
|
124
|
-
"vite": "^
|
|
125
|
-
"vite-plugin-babel": "^1.
|
|
126
|
-
"vite-plugin-node-polyfills": "^0.
|
|
124
|
+
"vite": "^7.0.0",
|
|
125
|
+
"vite-plugin-babel": "^1.3.1",
|
|
126
|
+
"vite-plugin-node-polyfills": "^0.23.0"
|
|
127
127
|
},
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "48d5719c8ce4e89a16f8dd576ff8f72072e3909e"
|
|
129
129
|
}
|
package/src/checkout/donate.tsx
CHANGED
|
@@ -183,9 +183,9 @@ export function DonateDetails({ supporters = [], currency, method }: DonateHisto
|
|
|
183
183
|
}}>
|
|
184
184
|
<Stack
|
|
185
185
|
direction="row"
|
|
186
|
-
alignItems="center"
|
|
187
186
|
spacing={0.5}
|
|
188
187
|
sx={{
|
|
188
|
+
alignItems: 'center',
|
|
189
189
|
flex: 3,
|
|
190
190
|
overflow: 'hidden',
|
|
191
191
|
}}>
|
|
@@ -226,7 +226,14 @@ export function DonateDetails({ supporters = [], currency, method }: DonateHisto
|
|
|
226
226
|
{x.customer?.name}
|
|
227
227
|
</Typography>
|
|
228
228
|
</Stack>
|
|
229
|
-
<Stack
|
|
229
|
+
<Stack
|
|
230
|
+
direction="row"
|
|
231
|
+
spacing={0.5}
|
|
232
|
+
sx={{
|
|
233
|
+
alignItems: 'center',
|
|
234
|
+
justifyContent: 'flex-end',
|
|
235
|
+
flex: 1,
|
|
236
|
+
}}>
|
|
230
237
|
<Avatar
|
|
231
238
|
key={x.id}
|
|
232
239
|
src={currency?.logo}
|
|
@@ -256,7 +263,12 @@ function SupporterAvatar({
|
|
|
256
263
|
const customersNum = customers.length;
|
|
257
264
|
if (customersNum === 0) return null;
|
|
258
265
|
return (
|
|
259
|
-
<Stack
|
|
266
|
+
<Stack
|
|
267
|
+
sx={{
|
|
268
|
+
flexDirection: 'row',
|
|
269
|
+
justifyContent: 'center',
|
|
270
|
+
alignItems: 'center',
|
|
271
|
+
}}>
|
|
260
272
|
<AvatarGroup
|
|
261
273
|
max={5}
|
|
262
274
|
sx={{
|
|
@@ -336,7 +348,13 @@ function SupporterTable({ supporters = [], totalAmount = '0', currency, method }
|
|
|
336
348
|
const customersNum = customers.length;
|
|
337
349
|
if (customersNum === 0) return null;
|
|
338
350
|
return (
|
|
339
|
-
<Box
|
|
351
|
+
<Box
|
|
352
|
+
sx={{
|
|
353
|
+
display: 'flex',
|
|
354
|
+
flexDirection: 'column',
|
|
355
|
+
alignItems: 'center',
|
|
356
|
+
gap: { xs: 0.5, sm: 1 },
|
|
357
|
+
}}>
|
|
340
358
|
<SupporterAvatar supporters={supporters} totalAmount={totalAmount} currency={currency} method={method} />
|
|
341
359
|
<DonateDetails supporters={supporters} totalAmount={totalAmount} currency={currency} method={method} />
|
|
342
360
|
</Box>
|
|
@@ -351,14 +369,21 @@ function SupporterSimple({ supporters = [], totalAmount = '0', currency, method
|
|
|
351
369
|
|
|
352
370
|
return (
|
|
353
371
|
<Box
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
372
|
+
sx={{
|
|
373
|
+
display: 'flex',
|
|
374
|
+
flexDirection: 'column',
|
|
375
|
+
alignItems: 'center',
|
|
376
|
+
|
|
377
|
+
gap: {
|
|
378
|
+
xs: 0.5,
|
|
379
|
+
sm: 1,
|
|
380
|
+
},
|
|
360
381
|
}}>
|
|
361
|
-
<Typography
|
|
382
|
+
<Typography
|
|
383
|
+
component="p"
|
|
384
|
+
sx={{
|
|
385
|
+
color: 'text.secondary',
|
|
386
|
+
}}>
|
|
362
387
|
{customersNum === 0 ? (
|
|
363
388
|
<span style={emojiFont}>{t('payment.checkout.donation.empty')}</span>
|
|
364
389
|
) : (
|
|
@@ -550,7 +575,12 @@ function CheckoutDonateInner({
|
|
|
550
575
|
variant={(donateSettings.appearance?.button?.variant || 'contained') as any}
|
|
551
576
|
{...donateSettings.appearance?.button}
|
|
552
577
|
onClick={handlePopoverOpen}>
|
|
553
|
-
<Stack
|
|
578
|
+
<Stack
|
|
579
|
+
direction="row"
|
|
580
|
+
spacing={0.5}
|
|
581
|
+
sx={{
|
|
582
|
+
alignItems: 'center',
|
|
583
|
+
}}>
|
|
554
584
|
{donateSettings.appearance.button.icon}
|
|
555
585
|
{typeof donateSettings.appearance.button.text === 'string' ? (
|
|
556
586
|
<Typography sx={{ whiteSpace: 'nowrap' }}>{donateSettings.appearance.button.text}</Typography>
|
|
@@ -594,9 +624,20 @@ function CheckoutDonateInner({
|
|
|
594
624
|
<CircularProgress />
|
|
595
625
|
</div>
|
|
596
626
|
)}
|
|
597
|
-
<Box
|
|
627
|
+
<Box
|
|
628
|
+
sx={{
|
|
629
|
+
display: 'flex',
|
|
630
|
+
alignItems: 'center',
|
|
631
|
+
flexDirection: 'column',
|
|
632
|
+
gap: 2,
|
|
633
|
+
}}>
|
|
598
634
|
<Button {...inlineOptions.button} onClick={() => startDonate()}>
|
|
599
|
-
<Stack
|
|
635
|
+
<Stack
|
|
636
|
+
direction="row"
|
|
637
|
+
spacing={0.5}
|
|
638
|
+
sx={{
|
|
639
|
+
alignItems: 'center',
|
|
640
|
+
}}>
|
|
600
641
|
{inlineOptions?.button?.icon}
|
|
601
642
|
{typeof inlineText === 'string' ? (
|
|
602
643
|
<Typography sx={{ whiteSpace: 'nowrap' }}>{inlineText}</Typography>
|
|
@@ -613,11 +654,15 @@ function CheckoutDonateInner({
|
|
|
613
654
|
);
|
|
614
655
|
const defaultRender = (
|
|
615
656
|
<Box
|
|
616
|
-
sx={{
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
657
|
+
sx={{
|
|
658
|
+
display: 'flex',
|
|
659
|
+
flexDirection: 'column',
|
|
660
|
+
alignItems: 'center',
|
|
661
|
+
gap: { xs: 1, sm: 2 },
|
|
662
|
+
width: '100%',
|
|
663
|
+
minWidth: 300,
|
|
664
|
+
maxWidth: 720,
|
|
665
|
+
}}>
|
|
621
666
|
<Button
|
|
622
667
|
size={(donateSettings.appearance?.button?.size || 'medium') as any}
|
|
623
668
|
color={(donateSettings.appearance?.button?.color || 'primary') as any}
|
|
@@ -634,7 +679,12 @@ function CheckoutDonateInner({
|
|
|
634
679
|
}}
|
|
635
680
|
{...donateSettings.appearance?.button}
|
|
636
681
|
onClick={() => startDonate()}>
|
|
637
|
-
<Stack
|
|
682
|
+
<Stack
|
|
683
|
+
direction="row"
|
|
684
|
+
spacing={0.5}
|
|
685
|
+
sx={{
|
|
686
|
+
alignItems: 'center',
|
|
687
|
+
}}>
|
|
638
688
|
{donateSettings.appearance.button.icon && (
|
|
639
689
|
<Typography sx={{ mr: 0.5, display: 'inline-flex', alignItems: 'center' }}>
|
|
640
690
|
{donateSettings.appearance.button.icon}
|
|
@@ -692,7 +742,12 @@ function CheckoutDonateInner({
|
|
|
692
742
|
<Dialog
|
|
693
743
|
open={state.open}
|
|
694
744
|
title={
|
|
695
|
-
<Box
|
|
745
|
+
<Box
|
|
746
|
+
sx={{
|
|
747
|
+
display: 'flex',
|
|
748
|
+
alignItems: 'center',
|
|
749
|
+
gap: 0.5,
|
|
750
|
+
}}>
|
|
696
751
|
<Typography variant="h3" sx={{ maxWidth: 320, textOverflow: 'ellipsis', overflow: 'hidden' }}>
|
|
697
752
|
{donateSettings.title}
|
|
698
753
|
</Typography>
|
|
@@ -714,7 +769,13 @@ function CheckoutDonateInner({
|
|
|
714
769
|
maxWidth="md"
|
|
715
770
|
toolbar={
|
|
716
771
|
isMobile ? null : (
|
|
717
|
-
<Box
|
|
772
|
+
<Box
|
|
773
|
+
sx={{
|
|
774
|
+
display: 'flex',
|
|
775
|
+
alignItems: 'center',
|
|
776
|
+
gap: 1,
|
|
777
|
+
color: 'text.secondary',
|
|
778
|
+
}}>
|
|
718
779
|
<AvatarGroup
|
|
719
780
|
total={customers?.length}
|
|
720
781
|
max={5}
|
|
@@ -801,28 +862,35 @@ function CheckoutDonateInner({
|
|
|
801
862
|
);
|
|
802
863
|
}
|
|
803
864
|
|
|
804
|
-
export default function CheckoutDonate(
|
|
865
|
+
export default function CheckoutDonate(rawProps: DonateProps) {
|
|
866
|
+
const props = Object.assign(
|
|
867
|
+
{
|
|
868
|
+
theme: 'default',
|
|
869
|
+
livemode: undefined,
|
|
870
|
+
inlineOptions: {
|
|
871
|
+
button: {
|
|
872
|
+
text: 'Tip',
|
|
873
|
+
},
|
|
874
|
+
},
|
|
875
|
+
timeout: 5000,
|
|
876
|
+
mode: 'default',
|
|
877
|
+
},
|
|
878
|
+
rawProps
|
|
879
|
+
);
|
|
880
|
+
|
|
805
881
|
const { livemode } = usePaymentContext();
|
|
806
882
|
const content = (
|
|
883
|
+
// eslint-disable-next-line react/prop-types
|
|
807
884
|
<CheckoutDonateInner {...props} livemode={props.livemode === undefined ? livemode : props.livemode} />
|
|
808
885
|
);
|
|
886
|
+
// eslint-disable-next-line react/prop-types
|
|
809
887
|
if (props.theme === 'inherit') {
|
|
810
888
|
return content;
|
|
811
889
|
}
|
|
890
|
+
// eslint-disable-next-line react/prop-types
|
|
812
891
|
if (props.theme && typeof props.theme === 'object') {
|
|
892
|
+
// eslint-disable-next-line react/prop-types
|
|
813
893
|
return <PaymentThemeProvider theme={props.theme}>{content}</PaymentThemeProvider>;
|
|
814
894
|
}
|
|
815
895
|
return <PaymentThemeProvider>{content}</PaymentThemeProvider>;
|
|
816
896
|
}
|
|
817
|
-
|
|
818
|
-
CheckoutDonate.defaultProps = {
|
|
819
|
-
theme: 'default',
|
|
820
|
-
livemode: undefined,
|
|
821
|
-
timeout: 5000,
|
|
822
|
-
mode: 'default',
|
|
823
|
-
inlineOptions: {
|
|
824
|
-
button: {
|
|
825
|
-
text: 'Tip',
|
|
826
|
-
},
|
|
827
|
-
},
|
|
828
|
-
};
|
package/src/checkout/form.tsx
CHANGED
|
@@ -34,13 +34,13 @@ const fetchCheckoutSession = async (id: string): Promise<CheckoutContext> => {
|
|
|
34
34
|
|
|
35
35
|
export default function CheckoutForm({
|
|
36
36
|
id,
|
|
37
|
-
mode,
|
|
38
|
-
onPaid,
|
|
39
|
-
onError,
|
|
37
|
+
mode = 'inline',
|
|
38
|
+
onPaid = noop,
|
|
39
|
+
onError = console.error,
|
|
40
40
|
onChange,
|
|
41
41
|
goBack,
|
|
42
|
-
extraParams,
|
|
43
|
-
action,
|
|
42
|
+
extraParams = {},
|
|
43
|
+
action = '',
|
|
44
44
|
theme = 'default',
|
|
45
45
|
formType = 'payment',
|
|
46
46
|
...restProps
|
|
@@ -124,12 +124,3 @@ export default function CheckoutForm({
|
|
|
124
124
|
}
|
|
125
125
|
return <PaymentThemeProvider>{Checkout}</PaymentThemeProvider>;
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
CheckoutForm.defaultProps = {
|
|
129
|
-
onPaid: noop,
|
|
130
|
-
onError: console.error,
|
|
131
|
-
mode: 'inline',
|
|
132
|
-
action: '',
|
|
133
|
-
extraParams: {},
|
|
134
|
-
formType: 'payment',
|
|
135
|
-
};
|
package/src/checkout/table.tsx
CHANGED
|
@@ -91,8 +91,8 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
|
|
|
91
91
|
return (
|
|
92
92
|
<Stack
|
|
93
93
|
direction="column"
|
|
94
|
-
alignItems="center"
|
|
95
94
|
sx={{
|
|
95
|
+
alignItems: 'center',
|
|
96
96
|
overflow: {
|
|
97
97
|
xs: 'auto',
|
|
98
98
|
md: 'hidden',
|
|
@@ -122,9 +122,9 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
|
|
|
122
122
|
}}>
|
|
123
123
|
{!data.livemode && <Livemode sx={{ display: 'flex', marginBottom: '8px', width: 'fit-content', ml: 0 }} />}
|
|
124
124
|
<Typography
|
|
125
|
-
color="text.primary"
|
|
126
|
-
fontWeight={600}
|
|
127
125
|
sx={{
|
|
126
|
+
color: 'text.primary',
|
|
127
|
+
fontWeight: 600,
|
|
128
128
|
lineHeight: '32px',
|
|
129
129
|
fontSize: '24px',
|
|
130
130
|
}}>
|
|
@@ -6,8 +6,6 @@ import { fromUnitToToken } from '@ocap/util';
|
|
|
6
6
|
import { usePaymentContext } from '../../contexts/payment';
|
|
7
7
|
import { getTxLink } from '../../libs/util';
|
|
8
8
|
|
|
9
|
-
TxGas.defaultProps = {};
|
|
10
|
-
|
|
11
9
|
export default function TxGas(props: { details: PaymentDetails; method: TPaymentMethod }) {
|
|
12
10
|
const { t } = useLocaleContext();
|
|
13
11
|
const { settings } = usePaymentContext();
|
|
@@ -25,7 +23,11 @@ export default function TxGas(props: { details: PaymentDetails; method: TPayment
|
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
return (
|
|
28
|
-
<Typography
|
|
26
|
+
<Typography
|
|
27
|
+
component="small"
|
|
28
|
+
sx={{
|
|
29
|
+
color: 'text.secondary',
|
|
30
|
+
}}>
|
|
29
31
|
{t('common.none')}
|
|
30
32
|
</Typography>
|
|
31
33
|
);
|