@blocklet/payment-react 1.14.20 → 1.14.22
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 +9 -10
- package/es/checkout/form.d.ts +1 -1
- package/es/checkout/form.js +23 -1
- package/es/checkout/table.d.ts +1 -1
- package/es/checkout/table.js +8 -1
- package/es/components/blockchain/tx.js +2 -1
- package/es/components/country-select.d.ts +16 -0
- package/es/components/country-select.js +82 -0
- package/es/components/input.d.ts +21 -21
- package/es/components/input.js +43 -42
- package/es/components/livemode.js +1 -0
- package/es/components/pricing-table.js +0 -2
- package/es/components/status.js +2 -3
- package/es/components/table.d.ts +2 -0
- package/es/components/table.js +186 -0
- package/es/contexts/payment.d.ts +2 -0
- package/es/contexts/payment.js +5 -2
- package/es/history/invoice/list.d.ts +5 -1
- package/es/history/invoice/list.js +218 -48
- package/es/hooks/mobile.d.ts +4 -0
- package/es/hooks/mobile.js +10 -0
- package/es/index.d.ts +5 -1
- package/es/index.js +7 -1
- package/es/libs/util.d.ts +15 -2
- package/es/libs/util.js +92 -28
- package/es/locales/en.js +23 -7
- package/es/locales/index.d.ts +0 -1
- package/es/locales/index.js +10 -1
- package/es/locales/zh.js +22 -6
- package/es/payment/error.js +2 -2
- package/es/payment/footer.js +1 -1
- package/es/payment/form/address.d.ts +9 -2
- package/es/payment/form/address.js +69 -69
- package/es/payment/form/currency.js +39 -25
- package/es/payment/form/index.d.ts +1 -1
- package/es/payment/form/index.js +83 -81
- package/es/payment/form/phone.js +15 -51
- package/es/payment/index.d.ts +1 -10
- package/es/payment/index.js +274 -219
- package/es/payment/product-card.js +4 -4
- package/es/payment/product-donation.js +7 -2
- package/es/payment/product-item.d.ts +2 -2
- package/es/payment/product-item.js +120 -81
- package/es/payment/summary.js +188 -118
- package/es/theme/index.css +240 -0
- package/es/theme/index.d.ts +9 -0
- package/es/theme/index.js +243 -0
- package/es/theme/typography.d.ts +2 -0
- package/es/theme/typography.js +53 -0
- package/es/types/index.d.ts +11 -0
- package/lib/checkout/donate.d.ts +2 -1
- package/lib/checkout/donate.js +14 -2
- package/lib/checkout/form.d.ts +1 -1
- package/lib/checkout/form.js +22 -1
- package/lib/checkout/table.d.ts +1 -1
- package/lib/checkout/table.js +14 -1
- package/lib/components/blockchain/tx.js +4 -1
- package/lib/components/country-select.d.ts +16 -0
- package/lib/components/country-select.js +115 -0
- package/lib/components/input.d.ts +21 -21
- package/lib/components/input.js +21 -12
- package/lib/components/livemode.js +1 -0
- package/lib/components/pricing-table.js +0 -2
- package/lib/components/status.js +2 -3
- package/lib/components/table.d.ts +2 -0
- package/lib/components/table.js +220 -0
- package/lib/contexts/payment.d.ts +2 -0
- package/lib/contexts/payment.js +4 -1
- package/lib/history/invoice/list.d.ts +5 -1
- package/lib/history/invoice/list.js +293 -62
- package/lib/hooks/mobile.d.ts +4 -0
- package/lib/hooks/mobile.js +17 -0
- package/lib/index.d.ts +5 -1
- package/lib/index.js +36 -0
- package/lib/libs/util.d.ts +15 -2
- package/lib/libs/util.js +115 -37
- package/lib/locales/en.js +23 -7
- package/lib/locales/index.d.ts +0 -1
- package/lib/locales/index.js +14 -3
- package/lib/locales/zh.js +22 -6
- package/lib/payment/error.js +5 -1
- package/lib/payment/footer.js +1 -1
- package/lib/payment/form/address.d.ts +9 -2
- package/lib/payment/form/address.js +67 -59
- package/lib/payment/form/currency.js +31 -24
- package/lib/payment/form/index.d.ts +1 -1
- package/lib/payment/form/index.js +92 -93
- package/lib/payment/form/phone.js +11 -59
- package/lib/payment/index.d.ts +1 -10
- package/lib/payment/index.js +291 -219
- package/lib/payment/product-card.js +5 -4
- package/lib/payment/product-donation.js +9 -2
- package/lib/payment/product-item.d.ts +2 -2
- package/lib/payment/product-item.js +38 -19
- package/lib/payment/summary.js +219 -127
- package/lib/theme/index.css +240 -0
- package/lib/theme/index.d.ts +9 -0
- package/lib/theme/index.js +259 -0
- package/lib/theme/typography.d.ts +2 -0
- package/lib/theme/typography.js +59 -0
- package/lib/types/index.d.ts +11 -0
- package/package.json +14 -11
- package/src/checkout/donate.tsx +16 -10
- package/src/checkout/form.tsx +23 -0
- package/src/checkout/table.tsx +13 -1
- package/src/components/blockchain/tx.tsx +2 -1
- package/src/components/country-select.tsx +93 -0
- package/src/components/input.tsx +49 -46
- package/src/components/livemode.tsx +1 -0
- package/src/components/pricing-table.tsx +0 -2
- package/src/components/status.tsx +1 -2
- package/src/components/table.tsx +200 -0
- package/src/contexts/payment.tsx +6 -1
- package/src/history/invoice/list.tsx +258 -49
- package/src/hooks/mobile.ts +13 -0
- package/src/index.ts +7 -0
- package/src/libs/util.ts +120 -31
- package/src/locales/en.tsx +19 -4
- package/src/locales/index.tsx +10 -3
- package/src/locales/zh.tsx +18 -3
- package/src/payment/error.tsx +2 -2
- package/src/payment/footer.tsx +1 -1
- package/src/payment/form/address.tsx +56 -47
- package/src/payment/form/currency.tsx +29 -23
- package/src/payment/form/index.tsx +89 -76
- package/src/payment/form/phone.tsx +14 -51
- package/src/payment/index.tsx +294 -242
- package/src/payment/product-card.tsx +4 -4
- package/src/payment/product-donation.tsx +7 -3
- package/src/payment/product-item.tsx +49 -20
- package/src/payment/summary.tsx +191 -108
- package/src/theme/index.css +240 -0
- package/src/theme/index.tsx +250 -0
- package/src/theme/typography.ts +56 -0
- package/src/types/index.ts +12 -0
package/es/libs/util.js
CHANGED
|
@@ -400,24 +400,42 @@ export function formatUpsellSaving(items, currency) {
|
|
|
400
400
|
const after = new BN(to.total);
|
|
401
401
|
return Number(before.sub(after).mul(new BN(100)).div(before).toString()).toFixed(0);
|
|
402
402
|
}
|
|
403
|
+
export function formatMeteredThen(subscription, recurring, hasMetered, locale = "en") {
|
|
404
|
+
if (hasMetered) {
|
|
405
|
+
return t("payment.checkout.meteredThen", locale, { subscription, recurring });
|
|
406
|
+
}
|
|
407
|
+
return t("payment.checkout.then", locale, { subscription, recurring });
|
|
408
|
+
}
|
|
409
|
+
export function formatPriceDisplay({ amount, then, actualAmount, showThen }, recurring, hasMetered, locale = "en") {
|
|
410
|
+
if (Number(actualAmount) === 0 && hasMetered) {
|
|
411
|
+
return t("payment.checkout.metered", locale, { recurring });
|
|
412
|
+
}
|
|
413
|
+
if (showThen) {
|
|
414
|
+
return [amount, then].filter(Boolean).join(", ");
|
|
415
|
+
}
|
|
416
|
+
return [amount, then].filter(Boolean).join(" ");
|
|
417
|
+
}
|
|
403
418
|
export function formatCheckoutHeadlines(items, currency, trialInDays, locale = "en") {
|
|
404
419
|
const brand = getStatementDescriptor(items);
|
|
405
420
|
const { total } = getCheckoutAmount(items, currency, trialInDays > 0);
|
|
421
|
+
const actualAmount = fromUnitToToken(total, currency.decimal);
|
|
406
422
|
const amount = `${fromUnitToToken(total, currency.decimal)} ${currency.symbol}`;
|
|
407
423
|
if (items.length === 0) {
|
|
408
424
|
return {
|
|
409
425
|
action: t("payment.checkout.empty", locale),
|
|
410
426
|
amount: "0",
|
|
411
|
-
then: ""
|
|
427
|
+
then: "",
|
|
428
|
+
actualAmount: "0",
|
|
429
|
+
priceDisplay: "0"
|
|
412
430
|
};
|
|
413
431
|
}
|
|
414
432
|
const { name } = items[0]?.price.product || { name: "" };
|
|
415
433
|
if (items.every((x) => x.price.type === "one_time")) {
|
|
416
434
|
const action = t("payment.checkout.pay", locale, { payee: brand });
|
|
417
435
|
if (items.length > 1) {
|
|
418
|
-
return { action, amount };
|
|
436
|
+
return { action, amount, actualAmount, priceDisplay: amount };
|
|
419
437
|
}
|
|
420
|
-
return { action, amount, then: "" };
|
|
438
|
+
return { action, amount, then: "", actualAmount, priceDisplay: amount };
|
|
421
439
|
}
|
|
422
440
|
const item = items.find((x) => x.price.type === "recurring");
|
|
423
441
|
const recurring = formatRecurring(
|
|
@@ -426,8 +444,8 @@ export function formatCheckoutHeadlines(items, currency, trialInDays, locale = "
|
|
|
426
444
|
"per",
|
|
427
445
|
locale
|
|
428
446
|
);
|
|
447
|
+
const hasMetered = items.some((x) => x.price.type === "recurring" && x.price.recurring?.usage_type === "metered");
|
|
429
448
|
if (items.every((x) => x.price.type === "recurring")) {
|
|
430
|
-
const hasMetered = items.some((x) => x.price.type === "recurring" && x.price.recurring?.usage_type === "metered");
|
|
431
449
|
const subscription2 = [
|
|
432
450
|
hasMetered ? t("payment.checkout.least", locale) : "",
|
|
433
451
|
fromUnitToToken(
|
|
@@ -443,29 +461,53 @@ export function formatCheckoutHeadlines(items, currency, trialInDays, locale = "
|
|
|
443
461
|
].filter(Boolean).join(" ");
|
|
444
462
|
if (items.length > 1) {
|
|
445
463
|
if (trialInDays > 0) {
|
|
446
|
-
|
|
464
|
+
const result4 = {
|
|
447
465
|
action: t("payment.checkout.try2", locale, { name, count: items.length - 1 }),
|
|
448
466
|
amount: t("payment.checkout.free", locale, { count: trialInDays }),
|
|
449
|
-
then:
|
|
467
|
+
then: formatMeteredThen(subscription2, recurring, hasMetered && Number(subscription2) === 0, locale),
|
|
468
|
+
showThen: true,
|
|
469
|
+
actualAmount: "0"
|
|
470
|
+
};
|
|
471
|
+
return {
|
|
472
|
+
...result4,
|
|
473
|
+
priceDisplay: formatPriceDisplay(result4, recurring, hasMetered, locale)
|
|
450
474
|
};
|
|
451
475
|
}
|
|
452
|
-
|
|
476
|
+
const result3 = {
|
|
453
477
|
action: t("payment.checkout.sub2", locale, { name, count: items.length - 1 }),
|
|
454
478
|
amount,
|
|
455
|
-
then: recurring
|
|
479
|
+
then: hasMetered ? t("payment.checkout.meteredThen", locale, { recurring }) : recurring,
|
|
480
|
+
showThen: hasMetered,
|
|
481
|
+
actualAmount
|
|
482
|
+
};
|
|
483
|
+
return {
|
|
484
|
+
...result3,
|
|
485
|
+
priceDisplay: formatPriceDisplay(result3, recurring, hasMetered, locale)
|
|
456
486
|
};
|
|
457
487
|
}
|
|
458
488
|
if (trialInDays > 0) {
|
|
459
|
-
|
|
489
|
+
const result3 = {
|
|
460
490
|
action: t("payment.checkout.try1", locale, { name }),
|
|
461
491
|
amount: t("payment.checkout.free", locale, { count: trialInDays }),
|
|
462
|
-
then:
|
|
492
|
+
then: formatMeteredThen(subscription2, recurring, hasMetered && Number(subscription2) === 0, locale),
|
|
493
|
+
showThen: true,
|
|
494
|
+
actualAmount: "0"
|
|
495
|
+
};
|
|
496
|
+
return {
|
|
497
|
+
...result3,
|
|
498
|
+
priceDisplay: formatPriceDisplay(result3, recurring, hasMetered, locale)
|
|
463
499
|
};
|
|
464
500
|
}
|
|
465
|
-
|
|
501
|
+
const result2 = {
|
|
466
502
|
action: t("payment.checkout.sub1", locale, { name }),
|
|
467
503
|
amount,
|
|
468
|
-
then: recurring
|
|
504
|
+
then: hasMetered ? t("payment.checkout.meteredThen", locale, { recurring }) : recurring,
|
|
505
|
+
showThen: hasMetered,
|
|
506
|
+
actualAmount
|
|
507
|
+
};
|
|
508
|
+
return {
|
|
509
|
+
...result2,
|
|
510
|
+
priceDisplay: formatPriceDisplay(result2, recurring, hasMetered, locale)
|
|
469
511
|
};
|
|
470
512
|
}
|
|
471
513
|
const subscription = fromUnitToToken(
|
|
@@ -477,10 +519,21 @@ export function formatCheckoutHeadlines(items, currency, trialInDays, locale = "
|
|
|
477
519
|
}, new BN(0)),
|
|
478
520
|
currency.decimal
|
|
479
521
|
);
|
|
480
|
-
|
|
522
|
+
const result = {
|
|
481
523
|
action: t("payment.checkout.pay", locale, { payee: brand }),
|
|
482
524
|
amount,
|
|
483
|
-
then:
|
|
525
|
+
then: formatMeteredThen(
|
|
526
|
+
`${subscription} ${currency.symbol}`,
|
|
527
|
+
recurring,
|
|
528
|
+
hasMetered && Number(subscription) === 0,
|
|
529
|
+
locale
|
|
530
|
+
),
|
|
531
|
+
showThen: true,
|
|
532
|
+
actualAmount
|
|
533
|
+
};
|
|
534
|
+
return {
|
|
535
|
+
...result,
|
|
536
|
+
priceDisplay: formatPriceDisplay(result, recurring, hasMetered, locale)
|
|
484
537
|
};
|
|
485
538
|
}
|
|
486
539
|
export function formatAmount(amount, decimals) {
|
|
@@ -516,41 +569,46 @@ export function formatSubscriptionProduct(items, maxLength = 2) {
|
|
|
516
569
|
return names.slice(0, maxLength).join(", ") + (names.length > maxLength ? ` and ${names.length - maxLength} more` : "");
|
|
517
570
|
}
|
|
518
571
|
export const getSubscriptionTimeSummary = (subscription) => {
|
|
519
|
-
const lines = [`
|
|
572
|
+
const lines = [`Start on ${formatToDate(subscription.start_date * 1e3, "en", "YYYY-MM-DD")}`];
|
|
573
|
+
const getLineTimeMessage = (time) => {
|
|
574
|
+
const curDay = dayjs().isSame(dayjs(time), "day");
|
|
575
|
+
const timeFormat = curDay ? "HH:mm:ss" : "YYYY-MM-DD";
|
|
576
|
+
return `${curDay ? "in" : "on"} ${formatToDate(time, "en", timeFormat)}`;
|
|
577
|
+
};
|
|
520
578
|
if (subscription.status === "active" || subscription.status === "trialing") {
|
|
521
579
|
if (subscription.cancel_at) {
|
|
522
|
-
lines.push(`
|
|
580
|
+
lines.push(`Ended ${getLineTimeMessage(subscription.cancel_at * 1e3)}`);
|
|
523
581
|
} else if (subscription.cancel_at_period_end) {
|
|
524
|
-
lines.push(`
|
|
582
|
+
lines.push(`Ended ${getLineTimeMessage(subscription.current_period_end * 1e3)}`);
|
|
525
583
|
} else {
|
|
526
|
-
lines.push(`
|
|
584
|
+
lines.push(`Renew ${getLineTimeMessage(subscription.current_period_end * 1e3)}`);
|
|
527
585
|
}
|
|
528
586
|
} else if (subscription.status === "past_due") {
|
|
529
|
-
lines.push(`
|
|
587
|
+
lines.push(`Ended ${getLineTimeMessage((subscription.cancel_at || subscription.current_period_end) * 1e3)}`);
|
|
530
588
|
} else if (subscription.status === "canceled") {
|
|
531
|
-
lines.push(`
|
|
589
|
+
lines.push(`Ended ${getLineTimeMessage(subscription.canceled_at * 1e3)}`);
|
|
532
590
|
}
|
|
533
|
-
return lines.join(",
|
|
591
|
+
return lines.join(",");
|
|
534
592
|
};
|
|
535
|
-
export const getSubscriptionAction = (subscription) => {
|
|
593
|
+
export const getSubscriptionAction = (subscription, actionProps) => {
|
|
536
594
|
if (subscription.status === "active" || subscription.status === "trialing") {
|
|
537
595
|
if (subscription.cancel_at_period_end) {
|
|
538
596
|
if (subscription.cancelation_details?.reason === "payment_failed") {
|
|
539
597
|
return null;
|
|
540
598
|
}
|
|
541
|
-
return { action: "recover", variant: "contained", color: "primary", canRenew: false };
|
|
599
|
+
return { action: "recover", variant: "contained", color: "primary", canRenew: false, ...actionProps?.recover };
|
|
542
600
|
}
|
|
543
601
|
if (subscription.cancel_at && subscription.cancel_at !== subscription.current_period_end) {
|
|
544
602
|
return null;
|
|
545
603
|
}
|
|
546
|
-
return { action: "cancel", variant: "outlined", color: "inherit", canRenew: false };
|
|
604
|
+
return { action: "cancel", variant: "outlined", color: "inherit", canRenew: false, ...actionProps?.cancel };
|
|
547
605
|
}
|
|
548
606
|
if (subscription.status === "past_due") {
|
|
549
607
|
const canRenew = subscription.cancel_at && subscription.cancel_at !== subscription.current_period_end;
|
|
550
|
-
return { action: "pastDue", variant: "contained", color: "primary", canRenew };
|
|
608
|
+
return { action: "pastDue", variant: "contained", color: "primary", canRenew, ...actionProps?.pastDue };
|
|
551
609
|
}
|
|
552
610
|
if (subscription.status !== "canceled" && subscription.cancel_at_period_end) {
|
|
553
|
-
return { action: "recover", variant: "contained", color: "primary", canRenew: false };
|
|
611
|
+
return { action: "recover", variant: "contained", color: "primary", canRenew: false, ...actionProps?.recover };
|
|
554
612
|
}
|
|
555
613
|
return null;
|
|
556
614
|
};
|
|
@@ -657,8 +715,8 @@ export function formatTotalPrice({
|
|
|
657
715
|
}
|
|
658
716
|
const unitValue = new BN(price.custom_unit_amount || price.unit_amount);
|
|
659
717
|
const currency = price?.currency ?? {};
|
|
660
|
-
const total = `${fromUnitToToken(unitValue.mul(new BN(quantity)), currency.decimal)} ${currency.symbol}`;
|
|
661
|
-
const unit = `${fromUnitToToken(unitValue, currency.decimal)} ${currency.symbol}`;
|
|
718
|
+
const total = `${fromUnitToToken(unitValue.mul(new BN(quantity)), currency.decimal)} ${currency.symbol} `;
|
|
719
|
+
const unit = `${fromUnitToToken(unitValue, currency.decimal)} ${currency.symbol} `;
|
|
662
720
|
const appendUnit = (v, alt) => {
|
|
663
721
|
if (product.unit_label) {
|
|
664
722
|
return `${v}/${price.product.unit_label}`;
|
|
@@ -690,6 +748,12 @@ export function formatQuantityInventory(price, quantity, locale = "en") {
|
|
|
690
748
|
}
|
|
691
749
|
return "";
|
|
692
750
|
}
|
|
751
|
+
export function formatSubscriptionStatus(status) {
|
|
752
|
+
if (status === "canceled") {
|
|
753
|
+
return "Ended";
|
|
754
|
+
}
|
|
755
|
+
return status;
|
|
756
|
+
}
|
|
693
757
|
export function formatAmountPrecisionLimit(amount, locale = "en", precision = 6) {
|
|
694
758
|
if (!amount) {
|
|
695
759
|
return "";
|
package/es/locales/en.js
CHANGED
|
@@ -60,7 +60,7 @@ export default flat({
|
|
|
60
60
|
continue: "Continue",
|
|
61
61
|
qty: "Qty {count}",
|
|
62
62
|
each: "{unit} each",
|
|
63
|
-
trial: "Free for {count}
|
|
63
|
+
trial: "Free for {count} day{count > 1 ? 's' : ''}",
|
|
64
64
|
billed: "billed {rule}",
|
|
65
65
|
metered: "based on usage",
|
|
66
66
|
hour: "hour",
|
|
@@ -83,6 +83,7 @@ export default flat({
|
|
|
83
83
|
years: "years",
|
|
84
84
|
type: "type",
|
|
85
85
|
donation: "Donation",
|
|
86
|
+
recoverFrom: "Recovered From",
|
|
86
87
|
quantityLimitPerCheckout: "Exceed purchase limit",
|
|
87
88
|
quantityNotEnough: "Exceed inventory",
|
|
88
89
|
amountPrecisionLimit: "Amount decimal places must be less than or equal to {precision}"
|
|
@@ -108,10 +109,12 @@ export default flat({
|
|
|
108
109
|
subscription: "View subscription",
|
|
109
110
|
invoice: "View invoice"
|
|
110
111
|
},
|
|
112
|
+
paymentRequired: "Payment Required",
|
|
111
113
|
staking: {
|
|
112
114
|
title: "Staking Required",
|
|
113
115
|
tooltip: "Staking is used to ensure that future invoices can be paid normally. Revoking the staking from DID Wallet means canceling the subscription."
|
|
114
116
|
},
|
|
117
|
+
stakingConfirm: "In this payment, the staked amount is separate from the product cost.",
|
|
115
118
|
donation: {
|
|
116
119
|
between: "Please enter an amount between {min} and {max}.",
|
|
117
120
|
custom: "Custom Amount",
|
|
@@ -128,7 +131,9 @@ export default flat({
|
|
|
128
131
|
sub1: "Subscribe to {name}",
|
|
129
132
|
sub2: "Subscribe to {name} and {count} more",
|
|
130
133
|
then: "Then {subscription} {recurring}",
|
|
131
|
-
|
|
134
|
+
meteredThen: "Then {recurring} based on usage",
|
|
135
|
+
metered: "{recurring} based on usage",
|
|
136
|
+
free: "{count} day{count > 1 ? 's' : ''} free",
|
|
132
137
|
least: "continue with at least",
|
|
133
138
|
completed: {
|
|
134
139
|
payment: "Thanks for your purchase",
|
|
@@ -137,7 +142,7 @@ export default flat({
|
|
|
137
142
|
donate: "Thanks for your support",
|
|
138
143
|
tip: "A payment to {payee} has been completed. You can view the details of this payment in your account."
|
|
139
144
|
},
|
|
140
|
-
confirm: "
|
|
145
|
+
confirm: "Confirming allows {payee} to charge or reduce your staking. You can cancel or revoke staking anytime.",
|
|
141
146
|
required: "Required",
|
|
142
147
|
invalid: "Invalid",
|
|
143
148
|
billing: {
|
|
@@ -177,13 +182,17 @@ export default flat({
|
|
|
177
182
|
emptyItems: {
|
|
178
183
|
title: "Nothing to show here",
|
|
179
184
|
description: "Seems this checkoutSession is not configured properly"
|
|
180
|
-
}
|
|
185
|
+
},
|
|
186
|
+
orderSummary: "Order Summary",
|
|
187
|
+
paymentDetails: "Payment Details",
|
|
188
|
+
productListTotal: "Includes {total} items"
|
|
181
189
|
},
|
|
182
190
|
customer: {
|
|
183
191
|
payments: "Payment History",
|
|
184
192
|
invoices: "Invoice History",
|
|
185
193
|
details: "Details",
|
|
186
194
|
summary: "Summary",
|
|
195
|
+
specifics: "Specifics",
|
|
187
196
|
update: "Update Information",
|
|
188
197
|
empty: "Seems you do not have any subscriptions or payments here",
|
|
189
198
|
cancel: {
|
|
@@ -258,13 +267,17 @@ export default flat({
|
|
|
258
267
|
renewSuccess: "You have successfully renewed the subscription",
|
|
259
268
|
renewError: "Failed to renew the subscription",
|
|
260
269
|
empty: "There are no invoices",
|
|
261
|
-
next: "No invoices yet, next invoice will be generated on {date}"
|
|
270
|
+
next: "No invoices yet, next invoice will be generated on {date}",
|
|
271
|
+
invoiceNumber: "Invoice Number",
|
|
272
|
+
emptyList: "No Invoice"
|
|
262
273
|
},
|
|
263
274
|
payment: {
|
|
264
|
-
empty: "There are no payments"
|
|
275
|
+
empty: "There are no payments",
|
|
276
|
+
emptyList: "No Payment"
|
|
265
277
|
},
|
|
266
278
|
refund: {
|
|
267
|
-
empty: "There are no refunds"
|
|
279
|
+
empty: "There are no refunds",
|
|
280
|
+
emptyList: "No Refund"
|
|
268
281
|
},
|
|
269
282
|
subscriptions: {
|
|
270
283
|
plan: "Plan",
|
|
@@ -297,5 +310,8 @@ export default flat({
|
|
|
297
310
|
[RefundType.refund]: "Refund",
|
|
298
311
|
[RefundType.stakeReturn]: "Stake Return"
|
|
299
312
|
}
|
|
313
|
+
},
|
|
314
|
+
empty: {
|
|
315
|
+
records: "No matching records found"
|
|
300
316
|
}
|
|
301
317
|
});
|
package/es/locales/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export declare const translations: {
|
|
|
2
2
|
zh: any;
|
|
3
3
|
en: any;
|
|
4
4
|
};
|
|
5
|
-
export declare const replace: (template: string, data?: Record<string, any>) => string;
|
|
6
5
|
export declare const createTranslator: ({ fallbackLocale }: {
|
|
7
6
|
fallbackLocale?: string | undefined;
|
|
8
7
|
}, langs?: any) => (key: string, locale?: string, data?: Record<string, any>) => string;
|
package/es/locales/index.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import { template } from "lodash";
|
|
1
2
|
import en from "./en.js";
|
|
2
3
|
import zh from "./zh.js";
|
|
3
4
|
export const translations = {
|
|
4
5
|
zh,
|
|
5
6
|
en
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
const replace = (t2, data = {}) => {
|
|
9
|
+
try {
|
|
10
|
+
const compiled = template(t2, { interpolate: /{([\s\S]+?)}/g, escape: /{([\s\S]+?)}/g });
|
|
11
|
+
return compiled(data);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error(`Error evaluating template: ${t2}`, e);
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
8
17
|
export const createTranslator = ({ fallbackLocale = "en" }, langs = translations) => {
|
|
9
18
|
return (key, locale = fallbackLocale, data = {}) => {
|
|
10
19
|
if (!langs[locale] || !langs[locale][key]) {
|
package/es/locales/zh.js
CHANGED
|
@@ -83,6 +83,7 @@ export default flat({
|
|
|
83
83
|
years: "\u5E74",
|
|
84
84
|
type: "\u7C7B\u578B",
|
|
85
85
|
donation: "\u6253\u8D4F",
|
|
86
|
+
recoverFrom: "\u6062\u590D\u81EA",
|
|
86
87
|
quantityLimitPerCheckout: "\u8D85\u51FA\u8D2D\u4E70\u9650\u5236",
|
|
87
88
|
quantityNotEnough: "\u5E93\u5B58\u4E0D\u8DB3",
|
|
88
89
|
amountPrecisionLimit: "\u91D1\u989D\u5C0F\u6570\u4F4D\u6570\u5FC5\u987B\u5728 {precision} \u4F4D\u4EE5\u5185"
|
|
@@ -108,10 +109,12 @@ export default flat({
|
|
|
108
109
|
subscription: "\u67E5\u770B\u8BA2\u9605",
|
|
109
110
|
invoice: "\u67E5\u770B\u8D26\u5355"
|
|
110
111
|
},
|
|
112
|
+
paymentRequired: "\u652F\u4ED8\u6570\u91CF",
|
|
111
113
|
staking: {
|
|
112
114
|
title: "\u8D28\u62BC\u6570\u91CF",
|
|
113
115
|
tooltip: "\u8D28\u62BC\u76F8\u5F53\u4E8E\u4FDD\u8BC1\u91D1\uFF0C\u7528\u4E8E\u786E\u4FDD\u672A\u6765\u7684\u8D26\u5355\u80FD\u591F\u6B63\u5E38\u6263\u6B3E\uFF0C\u5982\u679C\u4F60\u4ECE DID Wallet \u64A4\u9500\u8D28\u62BC\uFF0C\u8BA2\u9605\u4E5F\u4F1A\u88AB\u53D6\u6D88\u3002"
|
|
114
116
|
},
|
|
117
|
+
stakingConfirm: "\u5728\u6B64\u652F\u4ED8\u4E2D\uFF0C\u8D28\u62BC\u91D1\u989D\u4E0E\u4EA7\u54C1\u8D39\u7528\u5206\u5F00",
|
|
115
118
|
donation: {
|
|
116
119
|
between: "\u91D1\u989D\u5FC5\u987B\u5927\u4E8E {min} \u4E14\u5C0F\u4E8E {max}",
|
|
117
120
|
custom: "\u8F93\u5165\u91D1\u989D",
|
|
@@ -128,7 +131,9 @@ export default flat({
|
|
|
128
131
|
sub1: "\u8BA2\u9605 {name}",
|
|
129
132
|
sub2: "\u8BA2\u9605 {name} \u7B49{count}\u4E2A\u4EA7\u54C1",
|
|
130
133
|
then: "\u7136\u540E {subscription} {recurring}",
|
|
131
|
-
|
|
134
|
+
meteredThen: "\u7136\u540E{recurring}\u6309\u7528\u91CF\u8BA1\u8D39",
|
|
135
|
+
metered: "{recurring}\u6309\u7528\u91CF\u8BA1\u8D39",
|
|
136
|
+
free: "\u514D\u8D39\u8BD5\u7528 {count} \u5929",
|
|
132
137
|
least: "\u81F3\u5C11",
|
|
133
138
|
completed: {
|
|
134
139
|
payment: "\u611F\u8C22\u60A8\u7684\u8D2D\u4E70",
|
|
@@ -137,7 +142,7 @@ export default flat({
|
|
|
137
142
|
donate: "\u611F\u8C22\u60A8\u7684\u652F\u6301",
|
|
138
143
|
tip: "\u5411{payee}\u7684\u4ED8\u6B3E\u5DF2\u5B8C\u6210\u3002\u60A8\u53EF\u4EE5\u5728\u60A8\u7684\u8D26\u6237\u4E2D\u67E5\u770B\u6B64\u4ED8\u6B3E\u7684\u8BE6\u7EC6\u4FE1\u606F\u3002"
|
|
139
144
|
},
|
|
140
|
-
confirm: "\
|
|
145
|
+
confirm: "\u786E\u8BA4\u5141\u8BB8{payee}\u5BF9\u60A8\u7684\u8D26\u6237\u8FDB\u884C\u4ED8\u6B3E\u6216\u8005\u7F5A\u6CA1\u60A8\u7684\u8D28\u62BC\u3002\u60A8\u968F\u65F6\u53EF\u4EE5\u53D6\u6D88\u60A8\u7684\u8BA2\u9605\uFF0C\u6216\u8005\u64A4\u9500\u8D28\u62BC\u3002",
|
|
141
146
|
required: "\u5FC5\u586B\u9879",
|
|
142
147
|
invalid: "\u65E0\u6548",
|
|
143
148
|
billing: {
|
|
@@ -177,13 +182,17 @@ export default flat({
|
|
|
177
182
|
emptyItems: {
|
|
178
183
|
title: "\u6CA1\u6709\u4EFB\u4F55\u8D2D\u4E70\u9879\u76EE",
|
|
179
184
|
description: "\u53EF\u80FD\u8FD9\u4E2A\u4ED8\u6B3E\u94FE\u63A5\u6CA1\u6709\u6B63\u786E\u914D\u7F6E"
|
|
180
|
-
}
|
|
185
|
+
},
|
|
186
|
+
orderSummary: "\u8BA2\u5355\u6982\u89C8",
|
|
187
|
+
paymentDetails: "\u652F\u4ED8\u4FE1\u606F",
|
|
188
|
+
productListTotal: "\u5305\u62EC {total} \u9879"
|
|
181
189
|
},
|
|
182
190
|
customer: {
|
|
183
191
|
payments: "\u652F\u4ED8\u5386\u53F2",
|
|
184
192
|
invoices: "\u8D26\u5355\u5386\u53F2",
|
|
185
193
|
details: "\u8D26\u6237\u8BE6\u60C5",
|
|
186
194
|
summary: "\u8BA1\u8D39\u6458\u8981",
|
|
195
|
+
specifics: "\u5177\u4F53\u4FE1\u606F",
|
|
187
196
|
update: "\u66F4\u65B0\u5BA2\u6237\u4FE1\u606F",
|
|
188
197
|
empty: "\u770B\u8D77\u6765\u60A8\u5728\u8FD9\u91CC\u6CA1\u6709\u4EFB\u4F55\u8BA2\u9605\u6216\u652F\u4ED8",
|
|
189
198
|
cancel: {
|
|
@@ -258,13 +267,17 @@ export default flat({
|
|
|
258
267
|
renewSuccess: "\u8BA2\u9605\u6062\u590D\u6210\u529F",
|
|
259
268
|
renewError: "\u8BA2\u9605\u6062\u590D\u5931\u8D25",
|
|
260
269
|
empty: "\u6CA1\u6709\u4EFB\u4F55\u8D26\u5355",
|
|
261
|
-
next: "\u8FD8\u6CA1\u6709\u8D26\u5355\uFF0C\u4E0B\u6B21\u8D26\u5355\u5C06\u5728 {date} \u751F\u6210"
|
|
270
|
+
next: "\u8FD8\u6CA1\u6709\u8D26\u5355\uFF0C\u4E0B\u6B21\u8D26\u5355\u5C06\u5728 {date} \u751F\u6210",
|
|
271
|
+
invoiceNumber: "\u8D26\u5355\u7F16\u53F7",
|
|
272
|
+
emptyList: "\u6CA1\u6709\u8D26\u5355"
|
|
262
273
|
},
|
|
263
274
|
payment: {
|
|
264
|
-
empty: "\u6CA1\u6709\u652F\u4ED8\u8BB0\u5F55"
|
|
275
|
+
empty: "\u6CA1\u6709\u652F\u4ED8\u8BB0\u5F55",
|
|
276
|
+
emptyList: "\u6CA1\u6709\u652F\u4ED8\u8BB0\u5F55"
|
|
265
277
|
},
|
|
266
278
|
refund: {
|
|
267
|
-
empty: "\u6CA1\u6709\u9000\u6B3E\u8BB0\u5F55"
|
|
279
|
+
empty: "\u6CA1\u6709\u9000\u6B3E\u8BB0\u5F55",
|
|
280
|
+
emptyList: "\u6CA1\u6709\u9000\u6B3E\u8BB0\u5F55"
|
|
268
281
|
},
|
|
269
282
|
subscriptions: {
|
|
270
283
|
plan: "\u8BA2\u9605",
|
|
@@ -297,5 +310,8 @@ export default flat({
|
|
|
297
310
|
[RefundType.refund]: "\u9000\u6B3E",
|
|
298
311
|
[RefundType.stakeReturn]: "\u9000\u62BC\u91D1"
|
|
299
312
|
}
|
|
313
|
+
},
|
|
314
|
+
empty: {
|
|
315
|
+
records: "\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u8BB0\u5F55"
|
|
300
316
|
}
|
|
301
317
|
});
|
package/es/payment/error.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Button, Link, Stack, Typography } from "@mui/material";
|
|
|
3
3
|
function getHeightStyle(mode) {
|
|
4
4
|
switch (mode) {
|
|
5
5
|
case "standalone":
|
|
6
|
-
return { height: "100vh" };
|
|
6
|
+
return { height: "100vh", maxHeight: "100%" };
|
|
7
7
|
default:
|
|
8
8
|
return { height: "auto", minHeight: 200 };
|
|
9
9
|
}
|
|
@@ -13,7 +13,7 @@ export default function PaymentError({ title, description, button, mode }) {
|
|
|
13
13
|
return /* @__PURE__ */ jsx(Stack, { sx: heightStyle, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs(Stack, { sx: { width: "280px" }, direction: "column", alignItems: "center", justifyContent: "center", children: [
|
|
14
14
|
/* @__PURE__ */ jsx(Typography, { variant: "h5", sx: { mb: 2 }, children: title }),
|
|
15
15
|
/* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { mb: 2, textAlign: "center" }, children: description }),
|
|
16
|
-
/* @__PURE__ */ jsx(Button, { variant: "text", size: "small", component: Link, href: window.blocklet?.appUrl, children: button })
|
|
16
|
+
/* @__PURE__ */ jsx(Button, { variant: "text", size: "small", sx: { color: "text.link" }, component: Link, href: window.blocklet?.appUrl, children: button })
|
|
17
17
|
] }) });
|
|
18
18
|
}
|
|
19
19
|
PaymentError.defaultProps = {
|
package/es/payment/footer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Typography } from "@mui/material";
|
|
3
3
|
export default function CheckoutFooter({ ...props }) {
|
|
4
|
-
return /* @__PURE__ */ jsxs(Typography, { color: "text.
|
|
4
|
+
return /* @__PURE__ */ jsxs(Typography, { color: "text.lighter", fontSize: 12, ...props, children: [
|
|
5
5
|
"Powered by",
|
|
6
6
|
" ",
|
|
7
7
|
/* @__PURE__ */ jsx(Typography, { component: "span", sx: { fontWeight: "bold", fontSize: 12 }, children: "ArcBlock" })
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { SxProps } from '@mui/material';
|
|
2
3
|
type Props = {
|
|
3
4
|
mode: string;
|
|
4
5
|
stripe: boolean;
|
|
6
|
+
sx?: SxProps;
|
|
5
7
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
declare function AddressForm({ mode, stripe, sx }: Props): import("react").JSX.Element | null;
|
|
9
|
+
declare namespace AddressForm {
|
|
10
|
+
var defaultProps: {
|
|
11
|
+
sx: {};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export default AddressForm;
|