@blocklet/payment-react 1.18.56 → 1.19.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.
- 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 +28 -7
- 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/input.d.ts +11 -20
- package/es/components/input.js +46 -43
- 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/invoice/list.d.ts +2 -18
- package/es/history/invoice/list.js +151 -73
- 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/libs/cached-request.js +2 -4
- package/es/libs/phone-validator.js +1 -2
- package/es/libs/util.js +2 -4
- package/es/libs/validator.js +2 -4
- 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 +107 -65
- 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 +5 -14
- 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 +2 -9
- package/es/payment/product-item.js +185 -142
- 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 +2 -17
- package/es/payment/summary.js +184 -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 +11 -7
- 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/input.d.ts +11 -20
- package/lib/components/input.js +20 -23
- 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/invoice/list.d.ts +2 -18
- package/lib/history/invoice/list.js +49 -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.js +2 -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.js +1 -1
- package/lib/libs/validator.js +1 -1
- package/lib/locales/en.js +1 -1
- package/lib/locales/index.js +1 -1
- package/lib/locales/zh.js +1 -1
- 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 +19 -15
- 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 +7 -16
- 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 +2 -9
- package/lib/payment/product-item.js +24 -25
- 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 +2 -17
- package/lib/payment/summary.js +44 -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 +22 -8
- package/src/components/confirm.tsx +4 -11
- package/src/components/country-select.tsx +391 -378
- package/src/components/input.tsx +49 -45
- 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/invoice/list.tsx +74 -35
- package/src/history/payment/list.tsx +53 -16
- package/src/hooks/keyboard.ts +1 -1
- 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 +30 -12
- package/src/payment/form/stripe/form.tsx +1 -5
- package/src/payment/header.tsx +14 -2
- package/src/payment/index.tsx +10 -21
- package/src/payment/product-card.tsx +41 -18
- package/src/payment/product-donation.tsx +85 -47
- package/src/payment/product-item.tsx +46 -24
- 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 +74 -42
- package/src/theme/index.tsx +5 -8
- package/src/theme/typography.ts +2 -2
|
@@ -34,24 +34,19 @@ const getBenefits = async (id, url) => {
|
|
|
34
34
|
const { data } = await api.get(`/api/payment-links/${id}/benefits?${url ? `url=${url}` : ""}`);
|
|
35
35
|
return data;
|
|
36
36
|
};
|
|
37
|
-
PaymentInner.defaultProps = {
|
|
38
|
-
completed: false,
|
|
39
|
-
showCheckoutSummary: true,
|
|
40
|
-
formRender: {}
|
|
41
|
-
};
|
|
42
37
|
function PaymentInner({
|
|
43
38
|
checkoutSession,
|
|
44
39
|
paymentMethods,
|
|
45
40
|
paymentLink,
|
|
46
41
|
paymentIntent,
|
|
47
42
|
customer,
|
|
48
|
-
completed,
|
|
43
|
+
completed = false,
|
|
49
44
|
mode,
|
|
50
45
|
onPaid,
|
|
51
46
|
onError,
|
|
52
47
|
onChange,
|
|
53
48
|
action,
|
|
54
|
-
formRender,
|
|
49
|
+
formRender = {},
|
|
55
50
|
benefits
|
|
56
51
|
}) {
|
|
57
52
|
const { t } = useLocaleContext();
|
|
@@ -193,69 +188,92 @@ function PaymentInner({
|
|
|
193
188
|
}
|
|
194
189
|
}
|
|
195
190
|
),
|
|
196
|
-
/* @__PURE__ */ jsx(
|
|
197
|
-
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
Stack,
|
|
198
193
|
{
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
194
|
+
direction: "row",
|
|
195
|
+
sx: {
|
|
196
|
+
justifyContent: "flex-end",
|
|
197
|
+
alignItems: "center",
|
|
198
|
+
flexWrap: "wrap",
|
|
199
|
+
gap: 1
|
|
200
|
+
},
|
|
201
|
+
children: /* @__PURE__ */ jsx(
|
|
202
|
+
Button,
|
|
203
|
+
{
|
|
204
|
+
variant: "outlined",
|
|
205
|
+
size: "large",
|
|
206
|
+
onClick: formRender?.onCancel,
|
|
207
|
+
sx: { width: "fit-content", minWidth: 120 },
|
|
208
|
+
children: t("common.close")
|
|
209
|
+
}
|
|
210
|
+
)
|
|
204
211
|
}
|
|
205
|
-
)
|
|
212
|
+
)
|
|
206
213
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
207
214
|
benefitsState.open && /* @__PURE__ */ jsx(PaymentBeneficiaries, { data: benefits, currency, totalAmount: benefitsState.amount }),
|
|
208
215
|
/* @__PURE__ */ jsxs(Stack, { sx: { display: benefitsState.open ? "none" : "block" }, children: [
|
|
209
|
-
/* @__PURE__ */ jsxs(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
216
|
+
/* @__PURE__ */ jsxs(
|
|
217
|
+
Stack,
|
|
218
|
+
{
|
|
219
|
+
direction: "row",
|
|
220
|
+
sx: {
|
|
221
|
+
justifyContent: "space-between",
|
|
222
|
+
alignItems: "center",
|
|
223
|
+
mb: 2
|
|
224
|
+
},
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ jsx(
|
|
227
|
+
Typography,
|
|
228
|
+
{
|
|
229
|
+
title: t("payment.checkout.orderSummary"),
|
|
230
|
+
sx: {
|
|
231
|
+
color: "text.primary",
|
|
232
|
+
fontSize: "18px",
|
|
233
|
+
fontWeight: "500",
|
|
234
|
+
lineHeight: "24px"
|
|
235
|
+
},
|
|
236
|
+
children: t("payment.checkout.donation.tipAmount")
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
!isMobile && donationSettings?.amount?.presets && donationSettings.amount.presets.length > 0 && /* @__PURE__ */ jsxs(
|
|
240
|
+
Typography,
|
|
241
|
+
{
|
|
242
|
+
sx: {
|
|
243
|
+
color: "text.secondary",
|
|
244
|
+
fontSize: "13px",
|
|
245
|
+
display: "flex",
|
|
246
|
+
alignItems: "center",
|
|
247
|
+
gap: 0.5,
|
|
248
|
+
opacity: 0.8
|
|
249
|
+
},
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ jsx(
|
|
252
|
+
Box,
|
|
253
|
+
{
|
|
254
|
+
component: "span",
|
|
255
|
+
sx: {
|
|
256
|
+
border: "1px solid",
|
|
257
|
+
borderColor: "divider",
|
|
258
|
+
borderRadius: 0.75,
|
|
259
|
+
px: 0.75,
|
|
260
|
+
py: 0.25,
|
|
261
|
+
fontSize: "12px",
|
|
262
|
+
lineHeight: 1,
|
|
263
|
+
color: "text.secondary",
|
|
264
|
+
fontWeight: "400",
|
|
265
|
+
bgcolor: "transparent"
|
|
266
|
+
},
|
|
267
|
+
children: "Tab"
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
t("payment.checkout.donation.tabHint")
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
),
|
|
259
277
|
items.map((x) => /* @__PURE__ */ jsx(
|
|
260
278
|
ProductDonation,
|
|
261
279
|
{
|
|
@@ -282,91 +300,103 @@ function PaymentInner({
|
|
|
282
300
|
}
|
|
283
301
|
}
|
|
284
302
|
),
|
|
285
|
-
/* @__PURE__ */ jsxs(
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
cursor: "pointer",
|
|
292
|
-
color: "text.secondary",
|
|
293
|
-
"&:hover": {
|
|
294
|
-
color: "text.primary"
|
|
295
|
-
},
|
|
296
|
-
display: "flex",
|
|
297
|
-
alignItems: "center"
|
|
298
|
-
},
|
|
299
|
-
children: [
|
|
300
|
-
/* @__PURE__ */ jsx(ArrowBackOutlined, { className: "benefits-arrow", sx: { fontSize: "18px", mr: 0.5 } }),
|
|
301
|
-
t("common.back")
|
|
302
|
-
]
|
|
303
|
-
}
|
|
304
|
-
) : /* @__PURE__ */ jsxs(
|
|
305
|
-
Box,
|
|
306
|
-
{
|
|
307
|
-
display: "flex",
|
|
308
|
-
gap: 0.5,
|
|
303
|
+
/* @__PURE__ */ jsxs(
|
|
304
|
+
Stack,
|
|
305
|
+
{
|
|
306
|
+
direction: "row",
|
|
307
|
+
sx: {
|
|
308
|
+
justifyContent: "space-between",
|
|
309
309
|
alignItems: "center",
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
310
|
+
flexWrap: "wrap",
|
|
311
|
+
gap: 1
|
|
312
|
+
},
|
|
313
|
+
children: [
|
|
314
|
+
benefits && benefits.length > 0 && (benefitsState.open ? /* @__PURE__ */ jsxs(
|
|
315
|
+
Typography,
|
|
316
|
+
{
|
|
317
|
+
onClick: () => setBenefitsState({ open: false }),
|
|
318
|
+
sx: {
|
|
319
|
+
cursor: "pointer",
|
|
320
|
+
color: "text.secondary",
|
|
321
|
+
"&:hover": {
|
|
322
|
+
color: "text.primary"
|
|
323
|
+
},
|
|
324
|
+
display: "flex",
|
|
325
|
+
alignItems: "center"
|
|
326
|
+
},
|
|
327
|
+
children: [
|
|
328
|
+
/* @__PURE__ */ jsx(ArrowBackOutlined, { className: "benefits-arrow", sx: { fontSize: "18px", mr: 0.5 } }),
|
|
329
|
+
t("common.back")
|
|
330
|
+
]
|
|
325
331
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
332
|
+
) : /* @__PURE__ */ jsxs(
|
|
333
|
+
Box,
|
|
334
|
+
{
|
|
335
|
+
onClick: () => setBenefitsState({ open: true }),
|
|
336
|
+
sx: {
|
|
337
|
+
display: "flex",
|
|
338
|
+
gap: 0.5,
|
|
339
|
+
alignItems: "center",
|
|
340
|
+
color: "text.secondary",
|
|
341
|
+
cursor: "pointer",
|
|
342
|
+
"& .benefits-arrow": {
|
|
343
|
+
opacity: 0,
|
|
344
|
+
transform: "translateX(-4px)",
|
|
345
|
+
transition: "all 0.2s"
|
|
346
|
+
},
|
|
347
|
+
"&:hover": {
|
|
348
|
+
color: "text.primary",
|
|
349
|
+
"& .benefits-arrow": {
|
|
350
|
+
opacity: 1,
|
|
351
|
+
transform: "translateX(0)"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
children: [
|
|
356
|
+
/* @__PURE__ */ jsx(HelpOutlineOutlined, { sx: { fontSize: "18px" } }),
|
|
357
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", children: renderBenefits() }),
|
|
358
|
+
/* @__PURE__ */ jsx(ArrowForwardOutlined, { className: "benefits-arrow", sx: { fontSize: "18px" } })
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
)),
|
|
362
|
+
benefitsState.open ? null : /* @__PURE__ */ jsxs(
|
|
363
|
+
Box,
|
|
364
|
+
{
|
|
365
|
+
sx: {
|
|
366
|
+
display: "flex",
|
|
367
|
+
gap: 2,
|
|
368
|
+
flex: {
|
|
369
|
+
xs: 1,
|
|
370
|
+
md: "auto"
|
|
371
|
+
},
|
|
372
|
+
justifyContent: "flex-end",
|
|
373
|
+
whiteSpace: "nowrap"
|
|
374
|
+
},
|
|
375
|
+
children: [
|
|
376
|
+
formRender?.cancel,
|
|
377
|
+
/* @__PURE__ */ jsx(
|
|
378
|
+
PaymentForm,
|
|
379
|
+
{
|
|
380
|
+
currencyId,
|
|
381
|
+
checkoutSession: state.checkoutSession,
|
|
382
|
+
paymentMethods,
|
|
383
|
+
paymentIntent,
|
|
384
|
+
paymentLink,
|
|
385
|
+
customer,
|
|
386
|
+
onPaid: handlePaid,
|
|
387
|
+
onError,
|
|
388
|
+
mode,
|
|
389
|
+
action,
|
|
390
|
+
onlyShowBtn: true,
|
|
391
|
+
isDonation: true
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
]
|
|
395
|
+
}
|
|
396
|
+
)
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
)
|
|
370
400
|
] }),
|
|
371
401
|
state.customerLimited && /* @__PURE__ */ jsx(
|
|
372
402
|
ConfirmDialog,
|
|
@@ -384,20 +414,14 @@ function PaymentInner({
|
|
|
384
414
|
)
|
|
385
415
|
] }) });
|
|
386
416
|
}
|
|
387
|
-
DonationForm.defaultProps = {
|
|
388
|
-
completed: false,
|
|
389
|
-
error: null,
|
|
390
|
-
showCheckoutSummary: true,
|
|
391
|
-
formRender: {}
|
|
392
|
-
};
|
|
393
417
|
export default function DonationForm({
|
|
394
418
|
checkoutSession,
|
|
395
419
|
paymentMethods,
|
|
396
420
|
paymentIntent,
|
|
397
421
|
paymentLink,
|
|
398
422
|
customer,
|
|
399
|
-
completed,
|
|
400
|
-
error,
|
|
423
|
+
completed = false,
|
|
424
|
+
error = null,
|
|
401
425
|
mode,
|
|
402
426
|
onPaid,
|
|
403
427
|
onError,
|
|
@@ -405,7 +429,7 @@ export default function DonationForm({
|
|
|
405
429
|
goBack,
|
|
406
430
|
action,
|
|
407
431
|
showCheckoutSummary = true,
|
|
408
|
-
formRender,
|
|
432
|
+
formRender = {},
|
|
409
433
|
id
|
|
410
434
|
}) {
|
|
411
435
|
const { t } = useLocaleContext();
|
|
@@ -441,7 +465,19 @@ export default function DonationForm({
|
|
|
441
465
|
const renderContent = () => {
|
|
442
466
|
const footer = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
443
467
|
/* @__PURE__ */ jsx(Divider, { sx: { mt: { xs: "16px", md: "-24px" }, mb: { xs: "16px", md: "-16px" } } }),
|
|
444
|
-
/* @__PURE__ */ jsx(
|
|
468
|
+
/* @__PURE__ */ jsx(
|
|
469
|
+
Stack,
|
|
470
|
+
{
|
|
471
|
+
direction: "row",
|
|
472
|
+
sx: {
|
|
473
|
+
justifyContent: "flex-end",
|
|
474
|
+
alignItems: "center",
|
|
475
|
+
flexWrap: "wrap",
|
|
476
|
+
gap: 1
|
|
477
|
+
},
|
|
478
|
+
children: /* @__PURE__ */ jsx(Button, { variant: "outlined", size: "large", onClick: formRender?.onCancel, children: t("common.cancel") })
|
|
479
|
+
}
|
|
480
|
+
)
|
|
445
481
|
] });
|
|
446
482
|
if (error) {
|
|
447
483
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -504,9 +540,9 @@ export default function DonationForm({
|
|
|
504
540
|
return /* @__PURE__ */ jsxs(
|
|
505
541
|
Stack,
|
|
506
542
|
{
|
|
507
|
-
display: "flex",
|
|
508
|
-
flexDirection: "column",
|
|
509
543
|
sx: {
|
|
544
|
+
display: "flex",
|
|
545
|
+
flexDirection: "column",
|
|
510
546
|
height: mode === "standalone" ? "100vh" : "auto",
|
|
511
547
|
overflow: isMobileSafariEnv ? "visible" : "hidden"
|
|
512
548
|
},
|
package/es/payment/error.d.ts
CHANGED
|
@@ -6,11 +6,5 @@ type Props = {
|
|
|
6
6
|
button?: string | React.ReactNode;
|
|
7
7
|
mode?: ModeType;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
button: string;
|
|
13
|
-
mode: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export default PaymentError;
|
|
9
|
+
export default function PaymentError({ title, description, button, mode }: Props): import("react").JSX.Element;
|
|
10
|
+
export {};
|
package/es/payment/error.js
CHANGED
|
@@ -4,29 +4,49 @@ function getHeightStyle(mode) {
|
|
|
4
4
|
switch (mode) {
|
|
5
5
|
case "standalone":
|
|
6
6
|
return { height: "100vh", maxHeight: "100%" };
|
|
7
|
+
// 独立模式下,高度为100vh
|
|
7
8
|
default:
|
|
8
9
|
return { height: "auto", minHeight: 200 };
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
|
-
export default function PaymentError({ title, description, button, mode }) {
|
|
12
|
+
export default function PaymentError({ title, description, button = "Back", mode = "standalone" }) {
|
|
12
13
|
const heightStyle = getHeightStyle(mode);
|
|
13
|
-
return /* @__PURE__ */ jsx(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Stack,
|
|
16
|
+
{
|
|
17
|
+
sx: [
|
|
18
|
+
{
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "center"
|
|
21
|
+
},
|
|
22
|
+
...Array.isArray(heightStyle) ? heightStyle : [heightStyle]
|
|
23
|
+
],
|
|
24
|
+
children: /* @__PURE__ */ jsxs(
|
|
25
|
+
Stack,
|
|
26
|
+
{
|
|
27
|
+
direction: "column",
|
|
28
|
+
sx: {
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
justifyContent: "center",
|
|
31
|
+
width: "280px"
|
|
32
|
+
},
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", sx: { mb: 2 }, children: title }),
|
|
35
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { mb: 2, textAlign: "center" }, children: description }),
|
|
36
|
+
typeof button === "string" ? /* @__PURE__ */ jsx(
|
|
37
|
+
Button,
|
|
38
|
+
{
|
|
39
|
+
variant: "text",
|
|
40
|
+
size: "small",
|
|
41
|
+
sx: { color: "text.link" },
|
|
42
|
+
component: Link,
|
|
43
|
+
href: window.blocklet?.appUrl,
|
|
44
|
+
children: button
|
|
45
|
+
}
|
|
46
|
+
) : button
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
);
|
|
28
52
|
}
|
|
29
|
-
PaymentError.defaultProps = {
|
|
30
|
-
button: "Back",
|
|
31
|
-
mode: "standalone"
|
|
32
|
-
};
|
package/es/payment/footer.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}): import("react").JSX.Element;
|
|
1
|
+
import { TypographyProps } from '@mui/material';
|
|
2
|
+
export default function CheckoutFooter(props: TypographyProps): import("react").JSX.Element;
|
package/es/payment/footer.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Typography } from "@mui/material";
|
|
3
|
-
export default function CheckoutFooter(
|
|
4
|
-
return /* @__PURE__ */ jsxs(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export default function CheckoutFooter(props) {
|
|
4
|
+
return /* @__PURE__ */ jsxs(
|
|
5
|
+
Typography,
|
|
6
|
+
{
|
|
7
|
+
...props,
|
|
8
|
+
sx: [
|
|
9
|
+
{
|
|
10
|
+
color: "text.lighter",
|
|
11
|
+
fontSize: 12
|
|
12
|
+
},
|
|
13
|
+
...Array.isArray(props.sx) ? props.sx : [props.sx]
|
|
14
|
+
],
|
|
15
|
+
children: [
|
|
16
|
+
"Powered by",
|
|
17
|
+
" ",
|
|
18
|
+
/* @__PURE__ */ jsx(Typography, { component: "span", sx: { fontWeight: "bold", fontSize: 12 }, children: "ArcBlock" })
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
);
|
|
9
22
|
}
|
package/es/payment/form/addon.js
CHANGED
|
@@ -7,8 +7,18 @@ import { usePaymentContext } from "../../contexts/payment.js";
|
|
|
7
7
|
export default function UserButtons() {
|
|
8
8
|
const { t } = useLocaleContext();
|
|
9
9
|
const { session } = usePaymentContext();
|
|
10
|
-
return /* @__PURE__ */ jsxs(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
return /* @__PURE__ */ jsxs(
|
|
11
|
+
Stack,
|
|
12
|
+
{
|
|
13
|
+
direction: "row",
|
|
14
|
+
sx: {
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
justifyContent: "space-between"
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(LocaleSelector, { showText: false }),
|
|
20
|
+
session?.user ? /* @__PURE__ */ jsx(SessionManager, { session }) : /* @__PURE__ */ jsx(Tooltip, { title: t("payment.checkout.login"), arrow: true, children: /* @__PURE__ */ jsx(SessionManager, { session }) })
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
14
24
|
}
|
|
@@ -6,12 +6,5 @@ type Props = {
|
|
|
6
6
|
fieldValidation?: Record<string, any>;
|
|
7
7
|
errorPosition?: 'right' | 'bottom';
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var defaultProps: {
|
|
12
|
-
sx: {};
|
|
13
|
-
fieldValidation: {};
|
|
14
|
-
errorPosition: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export default AddressForm;
|
|
9
|
+
export default function AddressForm({ mode, stripe, sx, fieldValidation, errorPosition }: Props): import("react").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -5,12 +5,7 @@ import { Controller, useFormContext, useWatch } from "react-hook-form";
|
|
|
5
5
|
import FormInput from "../../components/input.js";
|
|
6
6
|
import CountrySelect from "../../components/country-select.js";
|
|
7
7
|
import { getFieldValidation, validatePostalCode } from "../../libs/validator.js";
|
|
8
|
-
AddressForm
|
|
9
|
-
sx: {},
|
|
10
|
-
fieldValidation: {},
|
|
11
|
-
errorPosition: "right"
|
|
12
|
-
};
|
|
13
|
-
export default function AddressForm({ mode, stripe, sx = {}, fieldValidation, errorPosition }) {
|
|
8
|
+
export default function AddressForm({ mode, stripe, sx = {}, fieldValidation = {}, errorPosition = "right" }) {
|
|
14
9
|
const { t, locale } = useLocaleContext();
|
|
15
10
|
const { control } = useFormContext();
|
|
16
11
|
const country = useWatch({ control, name: "billing_address.country" });
|
|
@@ -84,6 +79,7 @@ export default function AddressForm({ mode, stripe, sx = {}, fieldValidation, er
|
|
|
84
79
|
CountrySelect,
|
|
85
80
|
{
|
|
86
81
|
...field,
|
|
82
|
+
ref: field.ref,
|
|
87
83
|
sx: {
|
|
88
84
|
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
89
85
|
borderColor: "transparent"
|
|
@@ -126,6 +122,7 @@ export default function AddressForm({ mode, stripe, sx = {}, fieldValidation, er
|
|
|
126
122
|
CountrySelect,
|
|
127
123
|
{
|
|
128
124
|
...field,
|
|
125
|
+
ref: field.ref,
|
|
129
126
|
sx: {
|
|
130
127
|
".MuiOutlinedInput-notchedOutline": {
|
|
131
128
|
borderColor: "transparent !important"
|