@blocklet/payment-react 1.15.4 → 1.15.6
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 -1
- package/es/checkout/donate.js +13 -7
- package/es/checkout/table.js +55 -36
- package/es/components/pricing-table.js +255 -210
- package/es/contexts/payment.js +6 -3
- package/es/history/invoice/list.d.ts +2 -0
- package/es/history/invoice/list.js +34 -4
- package/es/libs/util.js +2 -1
- package/es/payment/index.js +0 -3
- package/es/payment/product-card.js +2 -2
- package/lib/checkout/donate.d.ts +1 -1
- package/lib/checkout/donate.js +18 -13
- package/lib/checkout/table.js +12 -1
- package/lib/components/pricing-table.js +41 -2
- package/lib/contexts/payment.js +12 -5
- package/lib/history/invoice/list.d.ts +2 -0
- package/lib/history/invoice/list.js +32 -4
- package/lib/libs/util.js +2 -1
- package/lib/payment/index.js +0 -3
- package/lib/payment/product-card.js +1 -2
- package/package.json +6 -6
- package/src/checkout/donate.tsx +14 -14
- package/src/checkout/table.tsx +15 -1
- package/src/components/pricing-table.tsx +43 -1
- package/src/contexts/payment.tsx +7 -3
- package/src/history/invoice/list.tsx +37 -1
- package/src/libs/util.ts +2 -1
- package/src/payment/index.tsx +0 -3
- package/src/payment/product-card.tsx +3 -3
package/es/checkout/donate.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ declare function CheckoutDonate(props: DonateProps): import("react").JSX.Element
|
|
|
26
26
|
declare namespace CheckoutDonate {
|
|
27
27
|
var defaultProps: {
|
|
28
28
|
theme: string;
|
|
29
|
-
livemode:
|
|
29
|
+
livemode: undefined;
|
|
30
30
|
timeout: number;
|
|
31
31
|
mode: string;
|
|
32
32
|
inlineOptions: {
|
package/es/checkout/donate.js
CHANGED
|
@@ -26,6 +26,7 @@ import api from "../libs/api.js";
|
|
|
26
26
|
import { formatAmount, formatBNStr, formatDateTime, formatError, getCustomerAvatar, lazyLoad } from "../libs/util.js";
|
|
27
27
|
import CheckoutForm from "./form.js";
|
|
28
28
|
import { PaymentThemeProvider } from "../theme/index.js";
|
|
29
|
+
import { usePaymentContext } from "../contexts/payment.js";
|
|
29
30
|
const donationCache = {};
|
|
30
31
|
const createOrUpdateDonation = (settings, livemode = true) => {
|
|
31
32
|
if (!donationCache[settings.target]) {
|
|
@@ -177,7 +178,7 @@ function SupporterSimple({ supporters = [], totalAmount = "0", currency, method
|
|
|
177
178
|
}
|
|
178
179
|
);
|
|
179
180
|
}
|
|
180
|
-
function useDonation(settings, livemode
|
|
181
|
+
function useDonation(settings, livemode, mode = "default") {
|
|
181
182
|
const [state, setState] = useSetState({
|
|
182
183
|
open: false,
|
|
183
184
|
supporterLoaded: false,
|
|
@@ -217,7 +218,7 @@ function useDonation(settings, livemode = true, mode = "default") {
|
|
|
217
218
|
}
|
|
218
219
|
function CheckoutDonateInner({
|
|
219
220
|
settings,
|
|
220
|
-
livemode,
|
|
221
|
+
livemode = true,
|
|
221
222
|
timeout,
|
|
222
223
|
onPaid,
|
|
223
224
|
onError,
|
|
@@ -375,7 +376,10 @@ function CheckoutDonateInner({
|
|
|
375
376
|
onError,
|
|
376
377
|
action: settings.appearance?.button?.text,
|
|
377
378
|
mode: "inline",
|
|
378
|
-
theme
|
|
379
|
+
theme,
|
|
380
|
+
extraParams: {
|
|
381
|
+
livemode
|
|
382
|
+
}
|
|
379
383
|
}
|
|
380
384
|
) })
|
|
381
385
|
}
|
|
@@ -383,17 +387,19 @@ function CheckoutDonateInner({
|
|
|
383
387
|
] });
|
|
384
388
|
}
|
|
385
389
|
export default function CheckoutDonate(props) {
|
|
390
|
+
const { livemode } = usePaymentContext();
|
|
391
|
+
const content = /* @__PURE__ */ jsx(CheckoutDonateInner, { ...props, livemode: props.livemode === void 0 ? livemode : props.livemode });
|
|
386
392
|
if (props.theme === "inherit") {
|
|
387
|
-
return
|
|
393
|
+
return content;
|
|
388
394
|
}
|
|
389
395
|
if (props.theme && typeof props.theme === "object") {
|
|
390
|
-
return /* @__PURE__ */ jsx(PaymentThemeProvider, { theme: props.theme, children:
|
|
396
|
+
return /* @__PURE__ */ jsx(PaymentThemeProvider, { theme: props.theme, children: content });
|
|
391
397
|
}
|
|
392
|
-
return /* @__PURE__ */ jsx(PaymentThemeProvider, { children:
|
|
398
|
+
return /* @__PURE__ */ jsx(PaymentThemeProvider, { children: content });
|
|
393
399
|
}
|
|
394
400
|
CheckoutDonate.defaultProps = {
|
|
395
401
|
theme: "default",
|
|
396
|
-
livemode:
|
|
402
|
+
livemode: void 0,
|
|
397
403
|
timeout: 5e3,
|
|
398
404
|
mode: "default",
|
|
399
405
|
inlineOptions: {
|
package/es/checkout/table.js
CHANGED
|
@@ -66,44 +66,63 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
|
|
|
66
66
|
}
|
|
67
67
|
if (!sessionId && !hashSessionId) {
|
|
68
68
|
if (mode === "standalone") {
|
|
69
|
-
return /* @__PURE__ */ jsxs(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
margin: {
|
|
79
|
-
xs: "20px 0",
|
|
80
|
-
md: "20px 20px"
|
|
81
|
-
},
|
|
82
|
-
maxWidth: {
|
|
83
|
-
xs: "100%",
|
|
84
|
-
md: 400
|
|
85
|
-
},
|
|
86
|
-
textAlign: "center"
|
|
69
|
+
return /* @__PURE__ */ jsxs(
|
|
70
|
+
Stack,
|
|
71
|
+
{
|
|
72
|
+
direction: "column",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
sx: {
|
|
75
|
+
overflow: {
|
|
76
|
+
xs: "auto",
|
|
77
|
+
md: "hidden"
|
|
87
78
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
79
|
+
height: "100%",
|
|
80
|
+
pt: {
|
|
81
|
+
xs: 2.5,
|
|
82
|
+
md: 7.5
|
|
83
|
+
},
|
|
84
|
+
px: 2.5
|
|
85
|
+
},
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsxs(
|
|
88
|
+
Box,
|
|
89
|
+
{
|
|
90
|
+
sx: {
|
|
91
|
+
display: "flex",
|
|
92
|
+
flexDirection: "column",
|
|
93
|
+
fontSize: "24px",
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
margin: {
|
|
96
|
+
xs: "20px 0",
|
|
97
|
+
md: "20px 20px"
|
|
98
|
+
},
|
|
99
|
+
maxWidth: {
|
|
100
|
+
xs: "100%",
|
|
101
|
+
md: 400
|
|
98
102
|
},
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
textAlign: "center"
|
|
104
|
+
},
|
|
105
|
+
children: [
|
|
106
|
+
!data.livemode && /* @__PURE__ */ jsx(Livemode, { sx: { display: "flex", marginBottom: "8px", width: "fit-content", ml: 0 } }),
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
Typography,
|
|
109
|
+
{
|
|
110
|
+
color: "text.primary",
|
|
111
|
+
fontWeight: 600,
|
|
112
|
+
sx: {
|
|
113
|
+
lineHeight: "32px",
|
|
114
|
+
fontSize: "24px"
|
|
115
|
+
},
|
|
116
|
+
children: /* @__PURE__ */ jsx(TruncatedText, { text: data.name, maxLength: 60, useWidth: true })
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ jsx(PricingTable, { table: data, onSelect: handleSelect })
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
);
|
|
107
126
|
}
|
|
108
127
|
return /* @__PURE__ */ jsx(PricingTable, { mode: "select", table: data, onSelect: handleSelect });
|
|
109
128
|
}
|