@blocklet/payment-react 1.15.34 → 1.15.36
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 +2 -1
- package/es/checkout/donate.js +119 -94
- package/es/components/pricing-table.js +35 -13
- package/es/hooks/scroll.d.ts +1 -0
- package/es/hooks/scroll.js +14 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/libs/util.js +10 -4
- package/es/locales/en.js +3 -1
- package/es/locales/zh.js +3 -1
- package/es/payment/product-donation.js +2 -0
- package/lib/checkout/donate.d.ts +2 -1
- package/lib/checkout/donate.js +127 -108
- package/lib/components/pricing-table.js +28 -15
- package/lib/hooks/scroll.d.ts +1 -0
- package/lib/hooks/scroll.js +22 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/libs/util.js +10 -4
- package/lib/locales/en.js +3 -1
- package/lib/locales/zh.js +3 -1
- package/lib/payment/product-donation.js +2 -0
- package/package.json +3 -3
- package/src/checkout/donate.tsx +127 -95
- package/src/components/pricing-table.tsx +30 -12
- package/src/hooks/scroll.ts +16 -0
- package/src/index.ts +1 -0
- package/src/libs/util.ts +9 -6
- package/src/locales/en.tsx +2 -0
- package/src/locales/zh.tsx +2 -0
- package/src/payment/product-donation.tsx +2 -0
package/lib/checkout/donate.js
CHANGED
|
@@ -295,7 +295,8 @@ function CheckoutDonateInner({
|
|
|
295
295
|
onError,
|
|
296
296
|
mode,
|
|
297
297
|
inlineOptions = {},
|
|
298
|
-
theme
|
|
298
|
+
theme,
|
|
299
|
+
children
|
|
299
300
|
}) {
|
|
300
301
|
const {
|
|
301
302
|
state,
|
|
@@ -331,118 +332,136 @@ function CheckoutDonateInner({
|
|
|
331
332
|
const handlePopoverClose = () => {
|
|
332
333
|
setPopoverOpen(false);
|
|
333
334
|
};
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}) : settings.appearance.button.text]
|
|
352
|
-
})
|
|
353
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Popover, {
|
|
354
|
-
id: "mouse-over-popper",
|
|
355
|
-
open: popoverOpen,
|
|
356
|
-
anchorEl,
|
|
357
|
-
onClose: handlePopoverClose,
|
|
358
|
-
anchorOrigin: {
|
|
359
|
-
vertical: "top",
|
|
360
|
-
horizontal: "center"
|
|
361
|
-
},
|
|
362
|
-
transformOrigin: {
|
|
363
|
-
vertical: "bottom",
|
|
364
|
-
horizontal: "center"
|
|
365
|
-
},
|
|
366
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
335
|
+
const startDonate = () => {
|
|
336
|
+
setState({
|
|
337
|
+
open: true
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
const inlineRender = /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
341
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
342
|
+
size: settings.appearance?.button?.size || "medium",
|
|
343
|
+
color: settings.appearance?.button?.color || "primary",
|
|
344
|
+
variant: settings.appearance?.button?.variant || "contained",
|
|
345
|
+
...settings.appearance?.button,
|
|
346
|
+
onClick: handlePopoverOpen,
|
|
347
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
348
|
+
direction: "row",
|
|
349
|
+
alignItems: "center",
|
|
350
|
+
spacing: 0.5,
|
|
351
|
+
children: [settings.appearance.button.icon, typeof settings.appearance.button.text === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
367
352
|
sx: {
|
|
368
|
-
|
|
369
|
-
padding: "20px"
|
|
353
|
+
whiteSpace: "nowrap"
|
|
370
354
|
},
|
|
371
|
-
children:
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
},
|
|
383
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {})
|
|
384
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
385
|
-
display: "flex",
|
|
386
|
-
alignItems: "center",
|
|
387
|
-
flexDirection: "column",
|
|
388
|
-
gap: 2,
|
|
389
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
390
|
-
...inlineOptions.button,
|
|
391
|
-
onClick: () => setState({
|
|
392
|
-
open: true
|
|
393
|
-
}),
|
|
394
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
395
|
-
direction: "row",
|
|
396
|
-
alignItems: "center",
|
|
397
|
-
spacing: 0.5,
|
|
398
|
-
children: [inlineOptions?.button?.icon, typeof inlineOptions?.button?.text === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
399
|
-
sx: {
|
|
400
|
-
whiteSpace: "nowrap"
|
|
401
|
-
},
|
|
402
|
-
children: inlineOptions?.button?.text
|
|
403
|
-
}) : inlineOptions?.button?.text]
|
|
404
|
-
})
|
|
405
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(SupporterSimple, {
|
|
406
|
-
...supporters.data
|
|
407
|
-
})]
|
|
408
|
-
})]
|
|
409
|
-
})
|
|
410
|
-
})]
|
|
411
|
-
}) : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
412
|
-
sx: {
|
|
413
|
-
width: "100%",
|
|
414
|
-
minWidth: 300,
|
|
415
|
-
maxWidth: 720
|
|
355
|
+
children: settings.appearance.button.text
|
|
356
|
+
}) : settings.appearance.button.text]
|
|
357
|
+
})
|
|
358
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Popover, {
|
|
359
|
+
id: "mouse-over-popper",
|
|
360
|
+
open: popoverOpen,
|
|
361
|
+
anchorEl,
|
|
362
|
+
onClose: handlePopoverClose,
|
|
363
|
+
anchorOrigin: {
|
|
364
|
+
vertical: "top",
|
|
365
|
+
horizontal: "center"
|
|
416
366
|
},
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
gap: {
|
|
421
|
-
xs: 1,
|
|
422
|
-
sm: 2
|
|
367
|
+
transformOrigin: {
|
|
368
|
+
vertical: "bottom",
|
|
369
|
+
horizontal: "center"
|
|
423
370
|
},
|
|
424
|
-
children:
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
371
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
372
|
+
sx: {
|
|
373
|
+
minWidth: 320,
|
|
374
|
+
padding: "20px"
|
|
375
|
+
},
|
|
376
|
+
children: [supporters.loading && /* @__PURE__ */(0, _jsxRuntime.jsx)("div", {
|
|
377
|
+
style: {
|
|
378
|
+
position: "absolute",
|
|
379
|
+
top: 0,
|
|
380
|
+
left: 0,
|
|
381
|
+
right: 0,
|
|
382
|
+
bottom: 0,
|
|
383
|
+
display: "flex",
|
|
384
|
+
justifyContent: "center",
|
|
385
|
+
alignItems: "center",
|
|
386
|
+
backgroundColor: "rgba(255, 255, 255, 0.7)"
|
|
387
|
+
},
|
|
388
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {})
|
|
389
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
390
|
+
display: "flex",
|
|
434
391
|
alignItems: "center",
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
392
|
+
flexDirection: "column",
|
|
393
|
+
gap: 2,
|
|
394
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
395
|
+
...inlineOptions.button,
|
|
396
|
+
onClick: () => startDonate(),
|
|
397
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
398
|
+
direction: "row",
|
|
399
|
+
alignItems: "center",
|
|
400
|
+
spacing: 0.5,
|
|
401
|
+
children: [inlineOptions?.button?.icon, typeof inlineOptions?.button?.text === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
402
|
+
sx: {
|
|
403
|
+
whiteSpace: "nowrap"
|
|
404
|
+
},
|
|
405
|
+
children: inlineOptions?.button?.text
|
|
406
|
+
}) : inlineOptions?.button?.text]
|
|
407
|
+
})
|
|
408
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(SupporterSimple, {
|
|
409
|
+
...supporters.data
|
|
410
|
+
})]
|
|
411
|
+
})]
|
|
412
|
+
})
|
|
413
|
+
})]
|
|
414
|
+
});
|
|
415
|
+
const defaultRender = /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
416
|
+
sx: {
|
|
417
|
+
width: "100%",
|
|
418
|
+
minWidth: 300,
|
|
419
|
+
maxWidth: 720
|
|
420
|
+
},
|
|
421
|
+
display: "flex",
|
|
422
|
+
flexDirection: "column",
|
|
423
|
+
alignItems: "center",
|
|
424
|
+
gap: {
|
|
425
|
+
xs: 1,
|
|
426
|
+
sm: 2
|
|
427
|
+
},
|
|
428
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
429
|
+
size: settings.appearance?.button?.size || "medium",
|
|
430
|
+
color: settings.appearance?.button?.color || "primary",
|
|
431
|
+
variant: settings.appearance?.button?.variant || "contained",
|
|
432
|
+
...settings.appearance?.button,
|
|
433
|
+
onClick: () => startDonate(),
|
|
434
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
435
|
+
direction: "row",
|
|
436
|
+
alignItems: "center",
|
|
437
|
+
spacing: 0.5,
|
|
438
|
+
children: [settings.appearance.button.icon, typeof settings.appearance.button.text === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
439
|
+
children: settings.appearance.button.text
|
|
440
|
+
}) : settings.appearance.button.text]
|
|
441
|
+
})
|
|
442
|
+
}), supporters.data && settings.appearance.history.variant === "avatar" && /* @__PURE__ */(0, _jsxRuntime.jsx)(SupporterAvatar, {
|
|
443
|
+
...supporters.data
|
|
444
|
+
}), supporters.data && settings.appearance.history.variant === "table" && /* @__PURE__ */(0, _jsxRuntime.jsx)(SupporterTable, {
|
|
445
|
+
...supporters.data
|
|
446
|
+
})]
|
|
447
|
+
});
|
|
448
|
+
const renderInnerView = () => {
|
|
449
|
+
if (mode === "inline") {
|
|
450
|
+
return inlineRender;
|
|
451
|
+
}
|
|
452
|
+
if (mode === "custom") {
|
|
453
|
+
return children && typeof children === "function" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
454
|
+
children: children(startDonate, `${(0, _util.formatAmount)(supporters.data?.totalAmount || "0", supporters.data?.currency?.decimal)} ${supporters.data?.currency?.symbol}`, supporters.data || {})
|
|
455
|
+
}) : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
456
|
+
children: ["Please provide a valid render function ", /* @__PURE__ */(0, _jsxRuntime.jsx)("pre", {
|
|
457
|
+
children: "(openDonate, donateTotalAmount, supporters) => ReactNode"
|
|
458
|
+
})]
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
return defaultRender;
|
|
462
|
+
};
|
|
463
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
464
|
+
children: [renderInnerView(), donation.data && /* @__PURE__ */(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
446
465
|
open: state.open,
|
|
447
466
|
title: settings.title,
|
|
448
467
|
maxWidth: "md",
|
|
@@ -17,7 +17,6 @@ var _util = require("@ocap/util");
|
|
|
17
17
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
18
18
|
var _payment = require("../contexts/payment");
|
|
19
19
|
var _util2 = require("../libs/util");
|
|
20
|
-
var _amount = _interopRequireDefault(require("../payment/amount"));
|
|
21
20
|
var _mobile = require("../hooks/mobile");
|
|
22
21
|
var _truncatedText = _interopRequireDefault(require("./truncated-text"));
|
|
23
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -189,10 +188,10 @@ function PricingTable({
|
|
|
189
188
|
max-width: 360px !important;
|
|
190
189
|
}
|
|
191
190
|
.price-table-wrap:has(> div:nth-child(2)) {
|
|
192
|
-
max-width:
|
|
191
|
+
max-width: 780px !important;
|
|
193
192
|
}
|
|
194
193
|
.price-table-wrap:has(> div:nth-child(3)) {
|
|
195
|
-
max-width:
|
|
194
|
+
max-width: 1200px !important;
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
`;
|
|
@@ -308,6 +307,7 @@ function PricingTable({
|
|
|
308
307
|
if (mode === "select") {
|
|
309
308
|
action = x.is_selected ? t("payment.checkout.selected") : t("payment.checkout.select");
|
|
310
309
|
}
|
|
310
|
+
const [amount, unit] = (0, _util2.formatPriceAmount)(x.price, currency, x.product.unit_label).split("/");
|
|
311
311
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
312
312
|
padding: 4,
|
|
313
313
|
spacing: 2,
|
|
@@ -329,13 +329,12 @@ function PricingTable({
|
|
|
329
329
|
},
|
|
330
330
|
width: {
|
|
331
331
|
xs: "100%",
|
|
332
|
-
md: "
|
|
332
|
+
md: "360px"
|
|
333
333
|
},
|
|
334
334
|
maxWidth: "360px",
|
|
335
335
|
minWidth: "300px",
|
|
336
336
|
padding: "20px",
|
|
337
|
-
position: "relative"
|
|
338
|
-
height: "fit-content"
|
|
337
|
+
position: "relative"
|
|
339
338
|
},
|
|
340
339
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
341
340
|
textAlign: "center",
|
|
@@ -354,7 +353,7 @@ function PricingTable({
|
|
|
354
353
|
justifyContent: "space-between"
|
|
355
354
|
},
|
|
356
355
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
357
|
-
color: "text.
|
|
356
|
+
color: "text.secondary",
|
|
358
357
|
fontWeight: 600,
|
|
359
358
|
sx: {
|
|
360
359
|
fontSize: "18px !important",
|
|
@@ -367,7 +366,7 @@ function PricingTable({
|
|
|
367
366
|
})
|
|
368
367
|
}), x.is_highlight && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Chip, {
|
|
369
368
|
label: x.highlight_text,
|
|
370
|
-
color: "
|
|
369
|
+
color: "primary",
|
|
371
370
|
size: "small",
|
|
372
371
|
sx: {
|
|
373
372
|
position: "absolute",
|
|
@@ -375,14 +374,28 @@ function PricingTable({
|
|
|
375
374
|
right: "20px"
|
|
376
375
|
}
|
|
377
376
|
})]
|
|
378
|
-
}), /* @__PURE__ */(0, _jsxRuntime.
|
|
379
|
-
|
|
377
|
+
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
378
|
+
component: "div",
|
|
380
379
|
sx: {
|
|
381
380
|
my: 0,
|
|
382
|
-
|
|
383
|
-
fontSize: "
|
|
384
|
-
|
|
385
|
-
|
|
381
|
+
fontWeight: "700",
|
|
382
|
+
fontSize: "32px",
|
|
383
|
+
letterSpacing: "-0.03rem",
|
|
384
|
+
fontVariantNumeric: "tabular-nums",
|
|
385
|
+
display: "flex",
|
|
386
|
+
alignItems: "baseline",
|
|
387
|
+
gap: "4px",
|
|
388
|
+
flexWrap: "wrap"
|
|
389
|
+
},
|
|
390
|
+
children: [amount, unit ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
391
|
+
sx: {
|
|
392
|
+
fontSize: "16px",
|
|
393
|
+
fontWeight: "400",
|
|
394
|
+
color: "text.secondary",
|
|
395
|
+
textAlign: "left"
|
|
396
|
+
},
|
|
397
|
+
children: ["/ ", unit]
|
|
398
|
+
}) : ""]
|
|
386
399
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
387
400
|
color: "text.secondary",
|
|
388
401
|
sx: {
|
|
@@ -484,7 +497,7 @@ function Subscribe({
|
|
|
484
497
|
fullWidth: true,
|
|
485
498
|
size: "medium",
|
|
486
499
|
variant: "contained",
|
|
487
|
-
color:
|
|
500
|
+
color: "primary",
|
|
488
501
|
sx: {
|
|
489
502
|
fontSize: "16px",
|
|
490
503
|
padding: "10px 20px",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function usePreventWheel(): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePreventWheel = usePreventWheel;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
function usePreventWheel() {
|
|
9
|
+
(0, _react.useEffect)(() => {
|
|
10
|
+
const handleWheel = e => {
|
|
11
|
+
if (document.activeElement?.type === "number") {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
window.addEventListener("wheel", handleWheel, {
|
|
16
|
+
passive: false
|
|
17
|
+
});
|
|
18
|
+
return () => {
|
|
19
|
+
window.removeEventListener("wheel", handleWheel);
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -36,5 +36,6 @@ export * from './contexts/payment';
|
|
|
36
36
|
export * from './hooks/subscription';
|
|
37
37
|
export * from './hooks/mobile';
|
|
38
38
|
export * from './hooks/table';
|
|
39
|
+
export * from './hooks/scroll';
|
|
39
40
|
export { translations, createTranslator } from './locales';
|
|
40
41
|
export { createLazyComponent, api, dayjs, FormInput, PhoneInput, AddressForm, StripeForm, Status, Livemode, Switch, ConfirmDialog, CheckoutForm, CheckoutTable, CheckoutDonate, CurrencySelector, Payment, PaymentSummary, PricingTable, ProductSkeleton, Amount, CustomerInvoiceList, CustomerPaymentList, TxLink, TxGas, SafeGuard, PricingItem, CountrySelect, Table, TruncatedText, Link, };
|
package/lib/index.js
CHANGED
|
@@ -351,5 +351,17 @@ Object.keys(_table3).forEach(function (key) {
|
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
353
|
});
|
|
354
|
+
var _scroll = require("./hooks/scroll");
|
|
355
|
+
Object.keys(_scroll).forEach(function (key) {
|
|
356
|
+
if (key === "default" || key === "__esModule") return;
|
|
357
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
358
|
+
if (key in exports && exports[key] === _scroll[key]) return;
|
|
359
|
+
Object.defineProperty(exports, key, {
|
|
360
|
+
enumerable: true,
|
|
361
|
+
get: function () {
|
|
362
|
+
return _scroll[key];
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
});
|
|
354
366
|
var _locales = require("./locales");
|
|
355
367
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/libs/util.js
CHANGED
|
@@ -1045,24 +1045,30 @@ function getInvoiceDescriptionAndReason(invoice, locale = "en") {
|
|
|
1045
1045
|
upcoming: (0, _locales.t)("payment.invoice.reason.upcoming", locale),
|
|
1046
1046
|
slash_stake: (0, _locales.t)("payment.invoice.reason.slashStake", locale),
|
|
1047
1047
|
stake: (0, _locales.t)("payment.invoice.reason.stake", locale),
|
|
1048
|
-
return_stake: (0, _locales.t)("payment.invoice.reason.returnStake", locale)
|
|
1048
|
+
return_stake: (0, _locales.t)("payment.invoice.reason.returnStake", locale),
|
|
1049
|
+
recharge: (0, _locales.t)("payment.invoice.reason.recharge", locale)
|
|
1049
1050
|
};
|
|
1051
|
+
let invoiceType = (0, _locales.t)("payment.invoice.reason.payment", locale);
|
|
1052
|
+
if (reason.includes("stake") || reason.includes("recharge")) {
|
|
1053
|
+
invoiceType = reasonMap[reason];
|
|
1054
|
+
}
|
|
1050
1055
|
if (description?.startsWith("Subscription ") || description?.startsWith("Slash stake")) {
|
|
1051
1056
|
return {
|
|
1052
1057
|
description: reasonMap[reason],
|
|
1053
1058
|
reason: reasonMap[reason],
|
|
1054
|
-
type:
|
|
1059
|
+
type: invoiceType
|
|
1055
1060
|
};
|
|
1056
1061
|
}
|
|
1057
1062
|
const descMap = {
|
|
1058
1063
|
"Stake for subscription plan change": (0, _locales.t)("payment.invoice.reason.stakeForChangePlan", locale),
|
|
1059
1064
|
"Stake for subscription payment change": (0, _locales.t)("payment.invoice.reason.stakeForChangePayment", locale),
|
|
1060
1065
|
"Stake for subscription": (0, _locales.t)("payment.invoice.reason.staking", locale),
|
|
1061
|
-
"Return Subscription staking": (0, _locales.t)("payment.invoice.reason.returnStake", locale)
|
|
1066
|
+
"Return Subscription staking": (0, _locales.t)("payment.invoice.reason.returnStake", locale),
|
|
1067
|
+
"Recharge for subscription": (0, _locales.t)("payment.invoice.reason.rechargeForSubscription", locale)
|
|
1062
1068
|
};
|
|
1063
1069
|
return {
|
|
1064
1070
|
description: descMap[description] || description,
|
|
1065
1071
|
reason: reasonMap[reason] || reason,
|
|
1066
|
-
type:
|
|
1072
|
+
type: invoiceType
|
|
1067
1073
|
};
|
|
1068
1074
|
}
|
package/lib/locales/en.js
CHANGED
|
@@ -319,7 +319,9 @@ module.exports = (0, _flat.default)({
|
|
|
319
319
|
payment: "Payment",
|
|
320
320
|
returnStake: "Return stake",
|
|
321
321
|
stakeForChangePlan: "Subscription plan update",
|
|
322
|
-
stakeForChangePayment: "Subscription payment method update"
|
|
322
|
+
stakeForChangePayment: "Subscription payment method update",
|
|
323
|
+
recharge: "Recharge",
|
|
324
|
+
rechargeForSubscription: "Subscription recharge"
|
|
323
325
|
}
|
|
324
326
|
}
|
|
325
327
|
},
|
package/lib/locales/zh.js
CHANGED
|
@@ -319,7 +319,9 @@ module.exports = (0, _flat.default)({
|
|
|
319
319
|
payment: "\u4ED8\u6B3E",
|
|
320
320
|
returnStake: "\u9000\u62BC\u91D1",
|
|
321
321
|
stakeForChangePlan: "\u8BA2\u9605\u5957\u9910\u66F4\u65B0",
|
|
322
|
-
stakeForChangePayment: "\u8BA2\u9605\u652F\u4ED8\u65B9\u5F0F\u66F4\u65B0"
|
|
322
|
+
stakeForChangePayment: "\u8BA2\u9605\u652F\u4ED8\u65B9\u5F0F\u66F4\u65B0",
|
|
323
|
+
recharge: "\u5145\u503C",
|
|
324
|
+
rechargeForSubscription: "\u8BA2\u9605\u5145\u503C"
|
|
323
325
|
}
|
|
324
326
|
}
|
|
325
327
|
},
|
|
@@ -12,6 +12,7 @@ var _react = require("react");
|
|
|
12
12
|
var _switchButton = _interopRequireDefault(require("../components/switch-button"));
|
|
13
13
|
var _util = require("../libs/util");
|
|
14
14
|
var _payment = require("../contexts/payment");
|
|
15
|
+
var _scroll = require("../hooks/scroll");
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
17
|
function ProductDonation({
|
|
17
18
|
item,
|
|
@@ -26,6 +27,7 @@ function ProductDonation({
|
|
|
26
27
|
const {
|
|
27
28
|
setPayable
|
|
28
29
|
} = (0, _payment.usePaymentContext)();
|
|
30
|
+
(0, _scroll.usePreventWheel)();
|
|
29
31
|
const preset = settings.amount.preset || settings.amount.presets?.[0] || "0";
|
|
30
32
|
const [state, setState] = (0, _ahooks.useSetState)({
|
|
31
33
|
selected: preset,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.36",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@babel/core": "^7.25.2",
|
|
93
93
|
"@babel/preset-env": "^7.25.2",
|
|
94
94
|
"@babel/preset-react": "^7.24.7",
|
|
95
|
-
"@blocklet/payment-types": "1.15.
|
|
95
|
+
"@blocklet/payment-types": "1.15.36",
|
|
96
96
|
"@storybook/addon-essentials": "^7.6.20",
|
|
97
97
|
"@storybook/addon-interactions": "^7.6.20",
|
|
98
98
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"vite-plugin-babel": "^1.2.0",
|
|
123
123
|
"vite-plugin-node-polyfills": "^0.21.0"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "0139cb00a67b6ebd845d932fa6f240cf95b1cc16"
|
|
126
126
|
}
|