@blocklet/payment-react 1.13.113
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/LICENSE +13 -0
- package/README.md +29 -0
- package/babel.config.es.js +8 -0
- package/build.config.ts +29 -0
- package/es/api.d.ts +2 -0
- package/es/api.js +18 -0
- package/es/checkout/index.d.ts +15 -0
- package/es/checkout/index.js +61 -0
- package/es/components/input.d.ts +23 -0
- package/es/components/input.js +44 -0
- package/es/components/livemode.d.ts +2 -0
- package/es/components/livemode.js +24 -0
- package/es/components/pricing-table.d.ts +18 -0
- package/es/components/pricing-table.js +175 -0
- package/es/components/status.d.ts +3 -0
- package/es/components/status.js +20 -0
- package/es/components/switch.d.ts +6 -0
- package/es/components/switch.js +42 -0
- package/es/contexts/payment.d.ts +29 -0
- package/es/contexts/payment.js +45 -0
- package/es/dayjs.d.ts +2 -0
- package/es/dayjs.js +14 -0
- package/es/index.d.ts +16 -0
- package/es/index.js +29 -0
- package/es/locales/en.d.ts +2 -0
- package/es/locales/en.js +213 -0
- package/es/locales/index.d.ts +10 -0
- package/es/locales/index.js +20 -0
- package/es/locales/zh.d.ts +2 -0
- package/es/locales/zh.js +213 -0
- package/es/payment/amount.d.ts +12 -0
- package/es/payment/amount.js +22 -0
- package/es/payment/error.d.ts +13 -0
- package/es/payment/error.js +12 -0
- package/es/payment/footer.d.ts +4 -0
- package/es/payment/footer.js +9 -0
- package/es/payment/form/addon.d.ts +2 -0
- package/es/payment/form/addon.js +14 -0
- package/es/payment/form/address.d.ts +7 -0
- package/es/payment/form/address.js +119 -0
- package/es/payment/form/index.d.ts +9 -0
- package/es/payment/form/index.js +337 -0
- package/es/payment/form/phone.d.ts +4 -0
- package/es/payment/form/phone.js +97 -0
- package/es/payment/form/stripe.d.ts +13 -0
- package/es/payment/form/stripe.js +158 -0
- package/es/payment/header.d.ts +7 -0
- package/es/payment/header.js +29 -0
- package/es/payment/index.d.ts +28 -0
- package/es/payment/index.js +327 -0
- package/es/payment/product-card.d.ts +21 -0
- package/es/payment/product-card.js +34 -0
- package/es/payment/product-item.d.ts +19 -0
- package/es/payment/product-item.js +107 -0
- package/es/payment/product-skeleton.d.ts +4 -0
- package/es/payment/product-skeleton.js +34 -0
- package/es/payment/skeleton/overview.d.ts +2 -0
- package/es/payment/skeleton/overview.js +13 -0
- package/es/payment/skeleton/payment.d.ts +2 -0
- package/es/payment/skeleton/payment.js +19 -0
- package/es/payment/success.d.ts +8 -0
- package/es/payment/success.js +164 -0
- package/es/payment/summary.d.ts +12 -0
- package/es/payment/summary.js +178 -0
- package/es/theme.d.ts +1 -0
- package/es/theme.js +17 -0
- package/es/types/index.d.ts +19 -0
- package/es/types/index.js +0 -0
- package/es/types/shims.d.ts +18 -0
- package/es/util.d.ts +52 -0
- package/es/util.js +390 -0
- package/lib/api.d.ts +2 -0
- package/lib/api.js +26 -0
- package/lib/checkout/index.d.ts +15 -0
- package/lib/checkout/index.js +83 -0
- package/lib/components/input.d.ts +23 -0
- package/lib/components/input.js +72 -0
- package/lib/components/livemode.d.ts +2 -0
- package/lib/components/livemode.js +29 -0
- package/lib/components/pricing-table.d.ts +18 -0
- package/lib/components/pricing-table.js +232 -0
- package/lib/components/status.d.ts +3 -0
- package/lib/components/status.js +23 -0
- package/lib/components/switch.d.ts +6 -0
- package/lib/components/switch.js +51 -0
- package/lib/contexts/payment.d.ts +29 -0
- package/lib/contexts/payment.js +73 -0
- package/lib/dayjs.d.ts +2 -0
- package/lib/dayjs.js +21 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +143 -0
- package/lib/locales/en.d.ts +2 -0
- package/lib/locales/en.js +220 -0
- package/lib/locales/index.d.ts +10 -0
- package/lib/locales/index.js +33 -0
- package/lib/locales/zh.d.ts +2 -0
- package/lib/locales/zh.js +220 -0
- package/lib/payment/amount.d.ts +12 -0
- package/lib/payment/amount.js +28 -0
- package/lib/payment/error.d.ts +13 -0
- package/lib/payment/error.js +52 -0
- package/lib/payment/footer.d.ts +4 -0
- package/lib/payment/footer.js +25 -0
- package/lib/payment/form/addon.d.ts +2 -0
- package/lib/payment/form/addon.js +37 -0
- package/lib/payment/form/address.d.ts +7 -0
- package/lib/payment/form/address.js +152 -0
- package/lib/payment/form/index.d.ts +9 -0
- package/lib/payment/form/index.js +464 -0
- package/lib/payment/form/phone.d.ts +4 -0
- package/lib/payment/form/phone.js +133 -0
- package/lib/payment/form/stripe.d.ts +13 -0
- package/lib/payment/form/stripe.js +213 -0
- package/lib/payment/header.d.ts +7 -0
- package/lib/payment/header.js +58 -0
- package/lib/payment/index.d.ts +28 -0
- package/lib/payment/index.js +382 -0
- package/lib/payment/product-card.d.ts +21 -0
- package/lib/payment/product-card.js +81 -0
- package/lib/payment/product-item.d.ts +19 -0
- package/lib/payment/product-item.js +160 -0
- package/lib/payment/product-skeleton.d.ts +4 -0
- package/lib/payment/product-skeleton.js +71 -0
- package/lib/payment/skeleton/overview.d.ts +2 -0
- package/lib/payment/skeleton/overview.js +48 -0
- package/lib/payment/skeleton/payment.d.ts +2 -0
- package/lib/payment/skeleton/payment.js +54 -0
- package/lib/payment/success.d.ts +8 -0
- package/lib/payment/success.js +215 -0
- package/lib/payment/summary.d.ts +12 -0
- package/lib/payment/summary.js +225 -0
- package/lib/theme.d.ts +1 -0
- package/lib/theme.js +19 -0
- package/lib/types/index.d.ts +19 -0
- package/lib/types/index.js +1 -0
- package/lib/types/shims.d.ts +18 -0
- package/lib/util.d.ts +52 -0
- package/lib/util.js +487 -0
- package/package.json +104 -0
- package/src/api.ts +24 -0
- package/src/checkout/index.tsx +74 -0
- package/src/components/input.tsx +58 -0
- package/src/components/livemode.tsx +23 -0
- package/src/components/pricing-table.tsx +207 -0
- package/src/components/status.tsx +19 -0
- package/src/components/switch.tsx +48 -0
- package/src/contexts/payment.tsx +74 -0
- package/src/dayjs.ts +17 -0
- package/src/index.ts +32 -0
- package/src/locales/en.tsx +218 -0
- package/src/locales/index.tsx +30 -0
- package/src/locales/zh.tsx +214 -0
- package/src/payment/amount.tsx +24 -0
- package/src/payment/error.tsx +29 -0
- package/src/payment/footer.tsx +12 -0
- package/src/payment/form/addon.tsx +24 -0
- package/src/payment/form/address.tsx +119 -0
- package/src/payment/form/index.tsx +401 -0
- package/src/payment/form/phone.tsx +103 -0
- package/src/payment/form/stripe.tsx +195 -0
- package/src/payment/header.tsx +40 -0
- package/src/payment/index.tsx +367 -0
- package/src/payment/product-card.tsx +55 -0
- package/src/payment/product-item.tsx +121 -0
- package/src/payment/product-skeleton.tsx +39 -0
- package/src/payment/skeleton/overview.tsx +21 -0
- package/src/payment/skeleton/payment.tsx +35 -0
- package/src/payment/success.tsx +186 -0
- package/src/payment/summary.tsx +198 -0
- package/src/theme.ts +18 -0
- package/src/types/index.ts +29 -0
- package/src/types/shims.d.ts +18 -0
- package/src/util.ts +543 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import flat from 'flat';
|
|
2
|
+
|
|
3
|
+
export default flat({
|
|
4
|
+
common: {
|
|
5
|
+
id: 'ID',
|
|
6
|
+
url: 'URL',
|
|
7
|
+
createdAt: 'Created At',
|
|
8
|
+
updatedAt: 'Updated At',
|
|
9
|
+
resumesAt: 'Resume At',
|
|
10
|
+
actions: 'Actions',
|
|
11
|
+
options: 'Options',
|
|
12
|
+
advanced: 'Advanced options',
|
|
13
|
+
login: 'Login to access this page',
|
|
14
|
+
settings: 'Settings',
|
|
15
|
+
preview: 'Preview',
|
|
16
|
+
required: 'Required',
|
|
17
|
+
setup: 'Setup',
|
|
18
|
+
name: 'Name',
|
|
19
|
+
amount: 'Amount',
|
|
20
|
+
total: 'Total',
|
|
21
|
+
subtotal: 'Subtotal',
|
|
22
|
+
status: 'Status',
|
|
23
|
+
livemode: 'Test mode',
|
|
24
|
+
afterTime: 'After {time}',
|
|
25
|
+
timeAgo: '{time} ago',
|
|
26
|
+
save: 'Save',
|
|
27
|
+
saved: 'Changes saved',
|
|
28
|
+
remove: 'Remove',
|
|
29
|
+
removed: 'Resource removed',
|
|
30
|
+
confirm: 'Confirm',
|
|
31
|
+
cancel: 'Cancel',
|
|
32
|
+
every: 'every',
|
|
33
|
+
per: 'per {interval}',
|
|
34
|
+
slash: '/ {interval}',
|
|
35
|
+
unit: 'units',
|
|
36
|
+
edit: 'Edit',
|
|
37
|
+
quantity: 'Quantity',
|
|
38
|
+
yes: 'Yes',
|
|
39
|
+
no: 'No',
|
|
40
|
+
email: 'Email',
|
|
41
|
+
did: 'DID',
|
|
42
|
+
txHash: 'Transaction',
|
|
43
|
+
customer: 'Customer',
|
|
44
|
+
custom: 'Custom',
|
|
45
|
+
description: 'Description',
|
|
46
|
+
statementDescriptor: 'Statement descriptor',
|
|
47
|
+
loadMore: 'View more {resource}',
|
|
48
|
+
loadingMore: 'Loading more {resource}...',
|
|
49
|
+
noMore: 'No more {resource}',
|
|
50
|
+
copied: 'Copied',
|
|
51
|
+
previous: 'Back',
|
|
52
|
+
continue: 'Continue',
|
|
53
|
+
qty: 'Qty {count}',
|
|
54
|
+
each: '{unit} each',
|
|
55
|
+
trial: 'Free for {count} days',
|
|
56
|
+
billed: 'billed {rule}',
|
|
57
|
+
metered: 'based on usage',
|
|
58
|
+
hour: 'hour',
|
|
59
|
+
day: 'day',
|
|
60
|
+
week: 'week',
|
|
61
|
+
month: 'month',
|
|
62
|
+
year: 'year',
|
|
63
|
+
hourly: 'hourly',
|
|
64
|
+
daily: 'daily',
|
|
65
|
+
weekly: 'weekly',
|
|
66
|
+
monthly: 'monthly',
|
|
67
|
+
yearly: 'yearly',
|
|
68
|
+
month3: 'every 3 months',
|
|
69
|
+
month6: 'every 6 months',
|
|
70
|
+
recurring: 'every {count} {interval}',
|
|
71
|
+
hours: 'hours',
|
|
72
|
+
days: 'days',
|
|
73
|
+
weeks: 'weeks',
|
|
74
|
+
months: 'months',
|
|
75
|
+
years: 'years',
|
|
76
|
+
},
|
|
77
|
+
payment: {
|
|
78
|
+
checkout: {
|
|
79
|
+
contact: 'Contact information',
|
|
80
|
+
method: 'Payment method',
|
|
81
|
+
processing: 'Processing',
|
|
82
|
+
payment: 'Pay',
|
|
83
|
+
try: 'Try for free',
|
|
84
|
+
include: 'This includes:',
|
|
85
|
+
subscription: 'Subscribe',
|
|
86
|
+
select: 'Select',
|
|
87
|
+
selected: 'Selected',
|
|
88
|
+
noPricing: 'No items to purchase',
|
|
89
|
+
setup: 'Subscribe',
|
|
90
|
+
continue: 'Confirm {action}',
|
|
91
|
+
connect: 'Connect and {action}',
|
|
92
|
+
login: 'Login to load and save contact information',
|
|
93
|
+
portal: 'Manage subscriptions',
|
|
94
|
+
cardPay: '{action} with card',
|
|
95
|
+
empty: 'No thing to pay',
|
|
96
|
+
per: 'per',
|
|
97
|
+
pay: 'Pay {payee}',
|
|
98
|
+
try1: 'Try {name}',
|
|
99
|
+
try2: 'Try {name} and {count} more',
|
|
100
|
+
sub1: 'Subscribe to {name}',
|
|
101
|
+
sub2: 'Subscribe to {name} and {count} more',
|
|
102
|
+
then: 'Then {subscription} {recurring}',
|
|
103
|
+
free: '{count} days free',
|
|
104
|
+
least: 'continue with at least',
|
|
105
|
+
completed: {
|
|
106
|
+
payment: 'Thanks for your purchase',
|
|
107
|
+
subscription: 'Thanks for your subscribing',
|
|
108
|
+
setup: 'Thanks for your subscribing',
|
|
109
|
+
tip: 'A payment to {payee} has been completed. You can view the details of this payment in your account.',
|
|
110
|
+
},
|
|
111
|
+
confirm:
|
|
112
|
+
'By confirming your subscription, you allow {payee} to charge your account for this and future payments in accordance with their terms. You can always cancel your subscription.',
|
|
113
|
+
required: 'Required',
|
|
114
|
+
invalid: 'Invalid',
|
|
115
|
+
billing: {
|
|
116
|
+
auto: 'Country',
|
|
117
|
+
required: 'Billing address',
|
|
118
|
+
country: 'Country',
|
|
119
|
+
state: 'State or province',
|
|
120
|
+
city: 'City or town',
|
|
121
|
+
line1: 'Address',
|
|
122
|
+
line2: 'Line2',
|
|
123
|
+
postal_code: 'Postal code',
|
|
124
|
+
},
|
|
125
|
+
customer: {
|
|
126
|
+
name: 'Name',
|
|
127
|
+
email: 'Email',
|
|
128
|
+
phone: 'Phone',
|
|
129
|
+
phonePlaceholder: 'Phone number',
|
|
130
|
+
phoneTip: 'In case we need to contact you about your order',
|
|
131
|
+
},
|
|
132
|
+
upsell: {
|
|
133
|
+
save: 'Save with {recurring} billing',
|
|
134
|
+
revert: 'Switch to {recurring} billing',
|
|
135
|
+
off: '{saving}% off',
|
|
136
|
+
},
|
|
137
|
+
cross_sell: {
|
|
138
|
+
add: 'Add to order',
|
|
139
|
+
remove: 'Remove from order',
|
|
140
|
+
},
|
|
141
|
+
expired: {
|
|
142
|
+
title: 'Expired Link',
|
|
143
|
+
description:
|
|
144
|
+
'This link has expired. This means that your payment has already been processed or your session has expired.',
|
|
145
|
+
},
|
|
146
|
+
complete: {
|
|
147
|
+
title: 'Checkout Completed',
|
|
148
|
+
description:
|
|
149
|
+
'This checkout session has completed. This means that your payment has already been successfully processed.',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
customer: {
|
|
153
|
+
invoices: 'Invoice History',
|
|
154
|
+
details: 'Billing Details',
|
|
155
|
+
update: 'Update Information',
|
|
156
|
+
empty: 'Seems you do not have any subscriptions or payments here',
|
|
157
|
+
cancel: {
|
|
158
|
+
button: 'Cancel',
|
|
159
|
+
title: 'Cancel your subscription',
|
|
160
|
+
description:
|
|
161
|
+
'Your subscription will be canceled, but it is still available until the end of your current billing period on {date}',
|
|
162
|
+
feedback: {
|
|
163
|
+
tip: 'We would love your feedback, it will help us improve our service',
|
|
164
|
+
too_expensive: 'The service is too expensive',
|
|
165
|
+
missing_features: 'Features are missing for this service',
|
|
166
|
+
switched_service: 'I have switched to alternative service',
|
|
167
|
+
unused: 'I no longer use this service',
|
|
168
|
+
customer_service: 'The customer service is poor',
|
|
169
|
+
too_complex: 'The service is too complex to use',
|
|
170
|
+
low_quality: 'The service does not work well',
|
|
171
|
+
other: 'Other reasons',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
pastDue: {
|
|
175
|
+
button: 'Pay',
|
|
176
|
+
},
|
|
177
|
+
recover: {
|
|
178
|
+
button: 'Renew',
|
|
179
|
+
title: 'Renew your subscription',
|
|
180
|
+
description: 'Your subscription will no longer be canceled, it will renew on {date}',
|
|
181
|
+
},
|
|
182
|
+
upgrade: {
|
|
183
|
+
button: 'Update',
|
|
184
|
+
current: 'Current',
|
|
185
|
+
pay: 'Payment Required',
|
|
186
|
+
scan: 'Complete the payment to upgrade your subscription',
|
|
187
|
+
success: 'Your subscription is successfully upgraded',
|
|
188
|
+
error: 'Failed to upgrade your subscription',
|
|
189
|
+
config: 'Switch to another plan or billing cycle',
|
|
190
|
+
confirm: 'Confirm changes to your subscription',
|
|
191
|
+
summary: 'What you will pay for starting {date}',
|
|
192
|
+
total: 'Total (metered items excluded)',
|
|
193
|
+
appliedCredit: 'Credit applied',
|
|
194
|
+
newCredit: 'Credit issued',
|
|
195
|
+
remaining: 'Amount due today',
|
|
196
|
+
},
|
|
197
|
+
invoice: {
|
|
198
|
+
summary: 'Summary',
|
|
199
|
+
details: 'Details',
|
|
200
|
+
download: 'Download PDF',
|
|
201
|
+
unitPrice: 'Unit Price',
|
|
202
|
+
amountPaid: 'Amount Paid',
|
|
203
|
+
rawQuantity: 'Raw Quantity: {quantity}',
|
|
204
|
+
amountDue: 'Amount Due',
|
|
205
|
+
amountApplied: 'Applied Credit',
|
|
206
|
+
pay: 'Pay this invoice',
|
|
207
|
+
paySuccess: 'You have successfully paid the invoice',
|
|
208
|
+
payError: 'Failed to paid the invoice',
|
|
209
|
+
empty: 'Seems you do not have any payments here',
|
|
210
|
+
},
|
|
211
|
+
subscriptions: {
|
|
212
|
+
title: 'Manage subscriptions',
|
|
213
|
+
current: 'Current subscriptions',
|
|
214
|
+
empty: 'Seems you do not have any subscriptions here',
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable no-prototype-builtins */
|
|
2
|
+
import en from './en';
|
|
3
|
+
import zh from './zh';
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
6
|
+
export const translations = {
|
|
7
|
+
zh,
|
|
8
|
+
en,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const replace = (template: string, data: Record<string, any> = {}) =>
|
|
12
|
+
template.replace(/{(\w*)}/g, (_, key) => (data.hasOwnProperty(key) ? data[key] : ''));
|
|
13
|
+
|
|
14
|
+
export const createTranslator = ({ fallbackLocale = 'en' }: { fallbackLocale?: string }, langs: any = translations) => {
|
|
15
|
+
return (key: string, locale = fallbackLocale, data: Record<string, any> = {}) => {
|
|
16
|
+
if (!langs[locale] || !langs[locale][key]) {
|
|
17
|
+
if (fallbackLocale && langs[fallbackLocale]?.[key]) {
|
|
18
|
+
return replace(langs[fallbackLocale]?.[key], data);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return key;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
return replace(langs[locale][key], data);
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const translate = createTranslator({ fallbackLocale: 'en' });
|
|
30
|
+
export const t = translate;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import flat from 'flat';
|
|
2
|
+
|
|
3
|
+
export default flat({
|
|
4
|
+
common: {
|
|
5
|
+
id: 'ID',
|
|
6
|
+
url: 'URL',
|
|
7
|
+
createdAt: '创建时间',
|
|
8
|
+
updatedAt: '更新时间',
|
|
9
|
+
resumesAt: '恢复时间',
|
|
10
|
+
actions: '操作',
|
|
11
|
+
options: '选项',
|
|
12
|
+
advanced: '高级选项',
|
|
13
|
+
settings: '设置',
|
|
14
|
+
preview: '预览',
|
|
15
|
+
required: '必填',
|
|
16
|
+
setup: '设置',
|
|
17
|
+
name: '姓名',
|
|
18
|
+
login: '登录以访问此页面',
|
|
19
|
+
amount: '金额',
|
|
20
|
+
total: '总计',
|
|
21
|
+
subtotal: '小计',
|
|
22
|
+
status: '状态',
|
|
23
|
+
livemode: '测试模式',
|
|
24
|
+
afterTime: '在{time}后',
|
|
25
|
+
timeAgo: '{time}前',
|
|
26
|
+
save: '保存',
|
|
27
|
+
saved: '更改已保存',
|
|
28
|
+
remove: '删除',
|
|
29
|
+
removed: '资源已删除',
|
|
30
|
+
confirm: '确认',
|
|
31
|
+
cancel: '取消',
|
|
32
|
+
every: '每',
|
|
33
|
+
per: '每{interval}',
|
|
34
|
+
slash: '每{interval}',
|
|
35
|
+
unit: '件',
|
|
36
|
+
edit: '编辑',
|
|
37
|
+
quantity: '数量',
|
|
38
|
+
yes: '是',
|
|
39
|
+
no: '否',
|
|
40
|
+
email: '邮箱',
|
|
41
|
+
did: 'DID',
|
|
42
|
+
txHash: '交易哈希',
|
|
43
|
+
customer: '客户',
|
|
44
|
+
custom: '自定义',
|
|
45
|
+
description: '描述',
|
|
46
|
+
statementDescriptor: '声明描述',
|
|
47
|
+
loadMore: '查看更多{resource}',
|
|
48
|
+
loadingMore: '正在加载更多{resource}...',
|
|
49
|
+
noMore: '没有更多{resource}',
|
|
50
|
+
copied: '已复制',
|
|
51
|
+
previous: '返回',
|
|
52
|
+
continue: '继续',
|
|
53
|
+
qty: '{count} 件',
|
|
54
|
+
each: '每件 {unit}',
|
|
55
|
+
trial: '免费试用 {count} 天',
|
|
56
|
+
billed: '{rule}收费',
|
|
57
|
+
metered: '按用量',
|
|
58
|
+
hour: '小时',
|
|
59
|
+
day: '天',
|
|
60
|
+
week: '周',
|
|
61
|
+
month: '月',
|
|
62
|
+
year: '年',
|
|
63
|
+
hourly: '按小时',
|
|
64
|
+
daily: '按天',
|
|
65
|
+
weekly: '按周',
|
|
66
|
+
monthly: '按月',
|
|
67
|
+
yearly: '按年',
|
|
68
|
+
month3: '按季度',
|
|
69
|
+
month6: '按半年',
|
|
70
|
+
recurring: '每{count}{interval}',
|
|
71
|
+
hours: '小时',
|
|
72
|
+
days: '天',
|
|
73
|
+
weeks: '周',
|
|
74
|
+
months: '月',
|
|
75
|
+
years: '年',
|
|
76
|
+
},
|
|
77
|
+
payment: {
|
|
78
|
+
checkout: {
|
|
79
|
+
contact: '联系信息',
|
|
80
|
+
method: '支付方式',
|
|
81
|
+
processing: '处理中',
|
|
82
|
+
payment: '支付',
|
|
83
|
+
try: '免费试用',
|
|
84
|
+
include: '包括:',
|
|
85
|
+
subscription: '订阅',
|
|
86
|
+
select: '选择',
|
|
87
|
+
selected: '已选',
|
|
88
|
+
noPricing: '没有可购买的物品',
|
|
89
|
+
setup: '订阅',
|
|
90
|
+
continue: '确认{action}',
|
|
91
|
+
connect: '连接并{action}',
|
|
92
|
+
login: '登录以加载并保存联系信息',
|
|
93
|
+
portal: '管理订阅',
|
|
94
|
+
cardPay: '使用卡片{action}',
|
|
95
|
+
empty: '没有可支付的项目',
|
|
96
|
+
per: '每',
|
|
97
|
+
pay: '付款给 {payee}',
|
|
98
|
+
try1: '免费试用 {name}',
|
|
99
|
+
try2: '免费试用 {name} 等{count}个产品',
|
|
100
|
+
sub1: '订阅 {name}',
|
|
101
|
+
sub2: '订阅 {name} 等{count}个产品',
|
|
102
|
+
then: '然后 {subscription} {recurring}',
|
|
103
|
+
free: '{count} 天',
|
|
104
|
+
least: '至少',
|
|
105
|
+
completed: {
|
|
106
|
+
payment: '感谢您的购买',
|
|
107
|
+
subscription: '感谢您的订阅',
|
|
108
|
+
setup: '感谢您的订阅',
|
|
109
|
+
tip: '向{payee}的付款已完成。您可以在您的账户中查看此付款的详细信息。',
|
|
110
|
+
},
|
|
111
|
+
confirm: '通过确认您的订阅,您允许{payee}按照其条款对您的账户进行付款。您随时可以取消您的订阅。',
|
|
112
|
+
required: '必填项',
|
|
113
|
+
invalid: '无效',
|
|
114
|
+
billing: {
|
|
115
|
+
auto: '国家/地区',
|
|
116
|
+
required: '账单地址',
|
|
117
|
+
country: '国家/地区',
|
|
118
|
+
state: '州或省',
|
|
119
|
+
city: '城市或镇',
|
|
120
|
+
line1: '地址',
|
|
121
|
+
line2: '地址2',
|
|
122
|
+
postal_code: '邮政编码',
|
|
123
|
+
},
|
|
124
|
+
customer: {
|
|
125
|
+
name: '姓名',
|
|
126
|
+
email: '邮件',
|
|
127
|
+
phone: '电话',
|
|
128
|
+
phonePlaceholder: '电话号码',
|
|
129
|
+
phoneTip: '以防需要与您联系有关您的订单',
|
|
130
|
+
},
|
|
131
|
+
upsell: {
|
|
132
|
+
save: '使用{recurring}计费方式',
|
|
133
|
+
revert: '切换到{recurring}计费方式',
|
|
134
|
+
off: '省 {saving}%',
|
|
135
|
+
},
|
|
136
|
+
expired: {
|
|
137
|
+
title: '链接已过期',
|
|
138
|
+
description: '此链接已过期。这意味着您的付款已经处理完成或会话已过期。',
|
|
139
|
+
},
|
|
140
|
+
complete: {
|
|
141
|
+
title: '结账已完成',
|
|
142
|
+
description: '此结账会话已完成。这意味着您的付款已成功处理完成。',
|
|
143
|
+
},
|
|
144
|
+
cross_sell: {
|
|
145
|
+
add: '添加到订单',
|
|
146
|
+
remove: '从订单移除',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
customer: {
|
|
150
|
+
invoices: '发票历史',
|
|
151
|
+
details: '计费详情',
|
|
152
|
+
update: '更新客户信息',
|
|
153
|
+
empty: '看起来您在这里没有任何订阅或支付',
|
|
154
|
+
cancel: {
|
|
155
|
+
button: '取消',
|
|
156
|
+
title: '取消您的订阅',
|
|
157
|
+
description: '您的订阅将被取消,但仍然可用直到您当前计费周期结束于{date}',
|
|
158
|
+
feedback: {
|
|
159
|
+
tip: '我们希望听到您的反馈,这将帮助我们改进我们的服务',
|
|
160
|
+
too_expensive: '服务费用太高',
|
|
161
|
+
missing_features: '服务缺少功能',
|
|
162
|
+
switched_service: '我已切换到其他服务',
|
|
163
|
+
unused: '我不再使用此服务',
|
|
164
|
+
customer_service: '客户服务不佳',
|
|
165
|
+
too_complex: '服务使用过于复杂',
|
|
166
|
+
low_quality: '服务质量不佳',
|
|
167
|
+
other: '其他原因',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
pastDue: {
|
|
171
|
+
button: '续费',
|
|
172
|
+
},
|
|
173
|
+
recover: {
|
|
174
|
+
button: '续订',
|
|
175
|
+
title: '续订您的订阅',
|
|
176
|
+
description: '您的订阅将不再被取消,将在{date}续订',
|
|
177
|
+
},
|
|
178
|
+
upgrade: {
|
|
179
|
+
button: '更新',
|
|
180
|
+
current: '当前订阅',
|
|
181
|
+
pay: '需要支付',
|
|
182
|
+
scan: '完成支付以更新你的订阅',
|
|
183
|
+
success: '你的订阅已经更新成功',
|
|
184
|
+
error: '订阅更新失败',
|
|
185
|
+
config: '切换套餐或周期',
|
|
186
|
+
confirm: '确认变更细节',
|
|
187
|
+
summary: '新的付款计划({date} 开始)',
|
|
188
|
+
total: '套餐定价(不含按量部分)',
|
|
189
|
+
appliedCredit: '信用扣除',
|
|
190
|
+
newCredit: '信用增加',
|
|
191
|
+
remaining: '还需支付',
|
|
192
|
+
},
|
|
193
|
+
invoice: {
|
|
194
|
+
summary: '摘要',
|
|
195
|
+
details: '详情',
|
|
196
|
+
download: '下载PDF',
|
|
197
|
+
unitPrice: '单价',
|
|
198
|
+
rawQuantity: '汇总前数量: {quantity}',
|
|
199
|
+
amountPaid: '已支付',
|
|
200
|
+
amountDue: '待支付',
|
|
201
|
+
amountApplied: '余额变更',
|
|
202
|
+
pay: '支付此发票',
|
|
203
|
+
paySuccess: '支付成功',
|
|
204
|
+
payError: '支付失败',
|
|
205
|
+
empty: '你没有任何支付',
|
|
206
|
+
},
|
|
207
|
+
subscriptions: {
|
|
208
|
+
title: '订阅管理',
|
|
209
|
+
current: '当前订阅',
|
|
210
|
+
empty: '你还没有任何订阅',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Typography } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
type Props = { amount: string; sx?: any };
|
|
4
|
+
|
|
5
|
+
export default function PaymentAmount({ amount, sx }: Props) {
|
|
6
|
+
return (
|
|
7
|
+
<Typography
|
|
8
|
+
sx={{
|
|
9
|
+
my: 0.5,
|
|
10
|
+
fontWeight: 600,
|
|
11
|
+
fontSize: '2.5rem',
|
|
12
|
+
lineHeight: '1.3',
|
|
13
|
+
letterSpacing: '-0.03rem',
|
|
14
|
+
fontVariantNumeric: 'tabular-nums',
|
|
15
|
+
...sx,
|
|
16
|
+
}}>
|
|
17
|
+
{amount}
|
|
18
|
+
</Typography>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
PaymentAmount.defaultProps = {
|
|
23
|
+
sx: {},
|
|
24
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Button, Link, Stack, Typography } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
button?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default function PaymentError({ title, description, button }: Props) {
|
|
10
|
+
return (
|
|
11
|
+
<Stack sx={{ height: '100vh' }} alignItems="center" justifyContent="center">
|
|
12
|
+
<Stack sx={{ width: '280px' }} direction="column" alignItems="center" justifyContent="center">
|
|
13
|
+
<Typography variant="h5" sx={{ mb: 2 }}>
|
|
14
|
+
{title}
|
|
15
|
+
</Typography>
|
|
16
|
+
<Typography variant="body1" sx={{ mb: 2, textAlign: 'center' }}>
|
|
17
|
+
{description}
|
|
18
|
+
</Typography>
|
|
19
|
+
<Button variant="text" size="small" component={Link} href={window.blocklet.appUrl}>
|
|
20
|
+
{button}
|
|
21
|
+
</Button>
|
|
22
|
+
</Stack>
|
|
23
|
+
</Stack>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
PaymentError.defaultProps = {
|
|
28
|
+
button: 'Back',
|
|
29
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Typography } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export default function CheckoutFooter({ ...props }) {
|
|
4
|
+
return (
|
|
5
|
+
<Typography color="text.secondary" fontSize={12} {...props}>
|
|
6
|
+
Powered by{' '}
|
|
7
|
+
<Typography component="span" sx={{ fontWeight: 'bold', fontSize: 12 }}>
|
|
8
|
+
ArcBlock
|
|
9
|
+
</Typography>
|
|
10
|
+
</Typography>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import SessionManager from '@arcblock/did-connect/lib/SessionManager';
|
|
2
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
+
import LocaleSelector from '@arcblock/ux/lib/Locale/selector';
|
|
4
|
+
import { Stack, Tooltip } from '@mui/material';
|
|
5
|
+
|
|
6
|
+
import { usePaymentContext } from '../../contexts/payment';
|
|
7
|
+
|
|
8
|
+
export default function UserButtons() {
|
|
9
|
+
const { t } = useLocaleContext();
|
|
10
|
+
const { session } = usePaymentContext();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
|
14
|
+
<LocaleSelector showText={false} />
|
|
15
|
+
{session.user ? (
|
|
16
|
+
<SessionManager session={session} />
|
|
17
|
+
) : (
|
|
18
|
+
<Tooltip title={t('payment.checkout.login')} arrow>
|
|
19
|
+
<SessionManager session={session} />
|
|
20
|
+
</Tooltip>
|
|
21
|
+
)}
|
|
22
|
+
</Stack>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
+
import { Fade, Stack, Typography } from '@mui/material';
|
|
3
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
4
|
+
import { CountrySelector } from 'react-international-phone';
|
|
5
|
+
|
|
6
|
+
import FormInput from '../../components/input';
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
mode: string;
|
|
10
|
+
stripe: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default function AddressForm({ mode, stripe }: Props) {
|
|
14
|
+
const { t } = useLocaleContext();
|
|
15
|
+
const { control, setValue } = useFormContext();
|
|
16
|
+
|
|
17
|
+
if (mode === 'required') {
|
|
18
|
+
return (
|
|
19
|
+
<Fade in>
|
|
20
|
+
<Stack className="cko-payment-address cko-payment-form">
|
|
21
|
+
<Typography sx={{ mb: 1, color: 'text.primary', fontWeight: 600 }}>
|
|
22
|
+
{t(`payment.checkout.billing.${mode}`)}
|
|
23
|
+
</Typography>
|
|
24
|
+
<Stack direction="column" className="cko-payment-form" spacing={0}>
|
|
25
|
+
<Stack direction="row" spacing={0}>
|
|
26
|
+
<Controller
|
|
27
|
+
name="billing_address.country"
|
|
28
|
+
control={control}
|
|
29
|
+
render={({ field }) => (
|
|
30
|
+
<CountrySelector
|
|
31
|
+
selectedCountry={field.value}
|
|
32
|
+
onSelect={({ iso2 }) => setValue(field.name, iso2)}
|
|
33
|
+
buttonStyle={{
|
|
34
|
+
width: '64px',
|
|
35
|
+
height: '40px',
|
|
36
|
+
border: '1px solid #ccc',
|
|
37
|
+
marginLeft: -1,
|
|
38
|
+
marginTop: -1,
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
/>
|
|
43
|
+
<FormInput
|
|
44
|
+
name="billing_address.postal_code"
|
|
45
|
+
rules={{ required: t('payment.checkout.required') }}
|
|
46
|
+
errorPosition="right"
|
|
47
|
+
variant="outlined"
|
|
48
|
+
placeholder={t('payment.checkout.billing.postal_code')}
|
|
49
|
+
/>
|
|
50
|
+
</Stack>
|
|
51
|
+
<FormInput
|
|
52
|
+
name="billing_address.state"
|
|
53
|
+
rules={{ required: t('payment.checkout.required') }}
|
|
54
|
+
errorPosition="right"
|
|
55
|
+
variant="outlined"
|
|
56
|
+
placeholder={t('payment.checkout.billing.state')}
|
|
57
|
+
/>
|
|
58
|
+
<FormInput
|
|
59
|
+
name="billing_address.line1"
|
|
60
|
+
rules={{ required: t('payment.checkout.required') }}
|
|
61
|
+
errorPosition="right"
|
|
62
|
+
variant="outlined"
|
|
63
|
+
placeholder={t('payment.checkout.billing.line1')}
|
|
64
|
+
/>
|
|
65
|
+
<FormInput
|
|
66
|
+
name="billing_address.city"
|
|
67
|
+
rules={{ required: t('payment.checkout.required') }}
|
|
68
|
+
errorPosition="right"
|
|
69
|
+
variant="outlined"
|
|
70
|
+
placeholder={t('payment.checkout.billing.city')}
|
|
71
|
+
/>
|
|
72
|
+
</Stack>
|
|
73
|
+
</Stack>
|
|
74
|
+
</Fade>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (stripe) {
|
|
79
|
+
return (
|
|
80
|
+
<Fade in>
|
|
81
|
+
<Stack className="cko-payment-address cko-payment-form">
|
|
82
|
+
<Typography sx={{ mb: 1, color: 'text.primary', fontWeight: 600 }}>
|
|
83
|
+
{t(`payment.checkout.billing.${mode}`)}
|
|
84
|
+
</Typography>
|
|
85
|
+
<Stack direction="column" className="cko-payment-form" spacing={0}>
|
|
86
|
+
<Stack direction="row" spacing={0}>
|
|
87
|
+
<Controller
|
|
88
|
+
name="billing_address.country"
|
|
89
|
+
control={control}
|
|
90
|
+
render={({ field }) => (
|
|
91
|
+
<CountrySelector
|
|
92
|
+
selectedCountry={field.value}
|
|
93
|
+
onSelect={({ iso2 }) => setValue(field.name, iso2)}
|
|
94
|
+
buttonStyle={{
|
|
95
|
+
width: '64px',
|
|
96
|
+
height: '40px',
|
|
97
|
+
border: '1px solid #ccc',
|
|
98
|
+
marginLeft: -1,
|
|
99
|
+
marginTop: -1,
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
)}
|
|
103
|
+
/>
|
|
104
|
+
<FormInput
|
|
105
|
+
name="billing_address.postal_code"
|
|
106
|
+
rules={{ required: t('payment.checkout.required') }}
|
|
107
|
+
errorPosition="right"
|
|
108
|
+
variant="outlined"
|
|
109
|
+
placeholder={t('payment.checkout.billing.postal_code')}
|
|
110
|
+
/>
|
|
111
|
+
</Stack>
|
|
112
|
+
</Stack>
|
|
113
|
+
</Stack>
|
|
114
|
+
</Fade>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return null;
|
|
119
|
+
}
|