@blocklet/payment-react 1.18.19 → 1.18.20
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/locales/en.js +2 -1
- package/es/locales/zh.js +2 -1
- package/es/payment/donation-form.js +51 -14
- package/lib/locales/en.js +2 -1
- package/lib/locales/zh.js +2 -1
- package/lib/payment/donation-form.js +42 -7
- package/package.json +3 -3
- package/src/locales/en.tsx +2 -1
- package/src/locales/zh.tsx +2 -1
- package/src/payment/donation-form.tsx +44 -11
package/es/locales/en.js
CHANGED
|
@@ -131,6 +131,7 @@ export default flat({
|
|
|
131
131
|
empty: "No supporters yet",
|
|
132
132
|
gaveTips: "{count} people gave tips",
|
|
133
133
|
tipAmount: "Tip Amount",
|
|
134
|
+
tabHint: "to switch amount",
|
|
134
135
|
benefits: {
|
|
135
136
|
one: "{name} will receive all tips",
|
|
136
137
|
multiple: "Tips will be distributed to {count} beneficiaries",
|
|
@@ -144,7 +145,7 @@ export default flat({
|
|
|
144
145
|
later: "Configure Later",
|
|
145
146
|
configTip: "Configure donation settings in Payment Kit"
|
|
146
147
|
},
|
|
147
|
-
cardPay: "{action} with card",
|
|
148
|
+
cardPay: "{action} with bank card",
|
|
148
149
|
empty: "No thing to pay",
|
|
149
150
|
per: "per",
|
|
150
151
|
pay: "Pay {payee}",
|
package/es/locales/zh.js
CHANGED
|
@@ -131,6 +131,7 @@ export default flat({
|
|
|
131
131
|
empty: "\u2764\uFE0F \u652F\u6301\u4E00\u4E0B",
|
|
132
132
|
gaveTips: "\u5DF2\u6709 {count} \u4EBA\u6253\u8D4F",
|
|
133
133
|
tipAmount: "\u6253\u8D4F\u91D1\u989D",
|
|
134
|
+
tabHint: "\u5FEB\u901F\u5207\u6362\u91D1\u989D",
|
|
134
135
|
benefits: {
|
|
135
136
|
one: "{name} \u5C06\u83B7\u5F97\u5168\u90E8\u6253\u8D4F",
|
|
136
137
|
multiple: "\u6253\u8D4F\u5C06\u6309\u6BD4\u4F8B\u5206\u914D\u7ED9 {count} \u4F4D\u53D7\u76CA\u4EBA",
|
|
@@ -144,7 +145,7 @@ export default flat({
|
|
|
144
145
|
later: "\u7A0D\u540E\u914D\u7F6E",
|
|
145
146
|
configTip: "\u524D\u5F80 Payment Kit \u914D\u7F6E\u6253\u8D4F\u9009\u9879"
|
|
146
147
|
},
|
|
147
|
-
cardPay: "\u4F7F\u7528\u5361
|
|
148
|
+
cardPay: "\u4F7F\u7528\u94F6\u884C\u5361{action}",
|
|
148
149
|
empty: "\u6CA1\u6709\u53EF\u652F\u4ED8\u7684\u9879\u76EE",
|
|
149
150
|
per: "\u6BCF",
|
|
150
151
|
pay: "\u4ED8\u6B3E\u7ED9 {payee}",
|
|
@@ -55,6 +55,7 @@ function PaymentInner({
|
|
|
55
55
|
}) {
|
|
56
56
|
const { t } = useLocaleContext();
|
|
57
57
|
const { settings, session } = usePaymentContext();
|
|
58
|
+
const { isMobile } = useMobile();
|
|
58
59
|
const [state, setState] = useSetState({
|
|
59
60
|
checkoutSession,
|
|
60
61
|
submitting: false,
|
|
@@ -202,20 +203,56 @@ function PaymentInner({
|
|
|
202
203
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
203
204
|
benefitsState.open && /* @__PURE__ */ jsx(PaymentBeneficiaries, { data: benefits, currency, totalAmount: benefitsState.amount }),
|
|
204
205
|
/* @__PURE__ */ jsxs(Stack, { sx: { display: benefitsState.open ? "none" : "block" }, children: [
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
206
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mb: 2 }, children: [
|
|
207
|
+
/* @__PURE__ */ jsx(
|
|
208
|
+
Typography,
|
|
209
|
+
{
|
|
210
|
+
title: t("payment.checkout.orderSummary"),
|
|
211
|
+
sx: {
|
|
212
|
+
color: "text.primary",
|
|
213
|
+
fontSize: "18px",
|
|
214
|
+
fontWeight: "500",
|
|
215
|
+
lineHeight: "24px"
|
|
216
|
+
},
|
|
217
|
+
children: t("payment.checkout.donation.tipAmount")
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
!isMobile && donationSettings?.amount?.presets && donationSettings.amount.presets.length > 0 && /* @__PURE__ */ jsxs(
|
|
221
|
+
Typography,
|
|
222
|
+
{
|
|
223
|
+
sx: {
|
|
224
|
+
color: "text.secondary",
|
|
225
|
+
fontSize: "13px",
|
|
226
|
+
display: "flex",
|
|
227
|
+
alignItems: "center",
|
|
228
|
+
gap: 0.5,
|
|
229
|
+
opacity: 0.8
|
|
230
|
+
},
|
|
231
|
+
children: [
|
|
232
|
+
/* @__PURE__ */ jsx(
|
|
233
|
+
Box,
|
|
234
|
+
{
|
|
235
|
+
component: "span",
|
|
236
|
+
sx: {
|
|
237
|
+
border: "1px solid",
|
|
238
|
+
borderColor: "divider",
|
|
239
|
+
borderRadius: 0.75,
|
|
240
|
+
px: 0.75,
|
|
241
|
+
py: 0.25,
|
|
242
|
+
fontSize: "12px",
|
|
243
|
+
lineHeight: 1,
|
|
244
|
+
color: "text.secondary",
|
|
245
|
+
fontWeight: "400",
|
|
246
|
+
bgcolor: "transparent"
|
|
247
|
+
},
|
|
248
|
+
children: "Tab"
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
t("payment.checkout.donation.tabHint")
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] }),
|
|
219
256
|
items.map((x) => /* @__PURE__ */ jsx(
|
|
220
257
|
ProductDonation,
|
|
221
258
|
{
|
package/lib/locales/en.js
CHANGED
|
@@ -138,6 +138,7 @@ module.exports = (0, _flat.default)({
|
|
|
138
138
|
empty: "No supporters yet",
|
|
139
139
|
gaveTips: "{count} people gave tips",
|
|
140
140
|
tipAmount: "Tip Amount",
|
|
141
|
+
tabHint: "to switch amount",
|
|
141
142
|
benefits: {
|
|
142
143
|
one: "{name} will receive all tips",
|
|
143
144
|
multiple: "Tips will be distributed to {count} beneficiaries",
|
|
@@ -151,7 +152,7 @@ module.exports = (0, _flat.default)({
|
|
|
151
152
|
later: "Configure Later",
|
|
152
153
|
configTip: "Configure donation settings in Payment Kit"
|
|
153
154
|
},
|
|
154
|
-
cardPay: "{action} with card",
|
|
155
|
+
cardPay: "{action} with bank card",
|
|
155
156
|
empty: "No thing to pay",
|
|
156
157
|
per: "per",
|
|
157
158
|
pay: "Pay {payee}",
|
package/lib/locales/zh.js
CHANGED
|
@@ -138,6 +138,7 @@ module.exports = (0, _flat.default)({
|
|
|
138
138
|
empty: "\u2764\uFE0F \u652F\u6301\u4E00\u4E0B",
|
|
139
139
|
gaveTips: "\u5DF2\u6709 {count} \u4EBA\u6253\u8D4F",
|
|
140
140
|
tipAmount: "\u6253\u8D4F\u91D1\u989D",
|
|
141
|
+
tabHint: "\u5FEB\u901F\u5207\u6362\u91D1\u989D",
|
|
141
142
|
benefits: {
|
|
142
143
|
one: "{name} \u5C06\u83B7\u5F97\u5168\u90E8\u6253\u8D4F",
|
|
143
144
|
multiple: "\u6253\u8D4F\u5C06\u6309\u6BD4\u4F8B\u5206\u914D\u7ED9 {count} \u4F4D\u53D7\u76CA\u4EBA",
|
|
@@ -151,7 +152,7 @@ module.exports = (0, _flat.default)({
|
|
|
151
152
|
later: "\u7A0D\u540E\u914D\u7F6E",
|
|
152
153
|
configTip: "\u524D\u5F80 Payment Kit \u914D\u7F6E\u6253\u8D4F\u9009\u9879"
|
|
153
154
|
},
|
|
154
|
-
cardPay: "\u4F7F\u7528\u5361
|
|
155
|
+
cardPay: "\u4F7F\u7528\u94F6\u884C\u5361{action}",
|
|
155
156
|
empty: "\u6CA1\u6709\u53EF\u652F\u4ED8\u7684\u9879\u76EE",
|
|
156
157
|
per: "\u6BCF",
|
|
157
158
|
pay: "\u4ED8\u6B3E\u7ED9 {payee}",
|
|
@@ -62,6 +62,9 @@ function PaymentInner({
|
|
|
62
62
|
settings,
|
|
63
63
|
session
|
|
64
64
|
} = (0, _payment.usePaymentContext)();
|
|
65
|
+
const {
|
|
66
|
+
isMobile
|
|
67
|
+
} = (0, _mobile.useMobile)();
|
|
65
68
|
const [state, setState] = (0, _ahooks.useSetState)({
|
|
66
69
|
checkoutSession,
|
|
67
70
|
submitting: false,
|
|
@@ -234,16 +237,48 @@ function PaymentInner({
|
|
|
234
237
|
sx: {
|
|
235
238
|
display: benefitsState.open ? "none" : "block"
|
|
236
239
|
},
|
|
237
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.
|
|
238
|
-
|
|
240
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
241
|
+
direction: "row",
|
|
242
|
+
justifyContent: "space-between",
|
|
243
|
+
alignItems: "center",
|
|
239
244
|
sx: {
|
|
240
|
-
color: "text.primary",
|
|
241
|
-
fontSize: "18px",
|
|
242
|
-
fontWeight: "500",
|
|
243
|
-
lineHeight: "24px",
|
|
244
245
|
mb: 2
|
|
245
246
|
},
|
|
246
|
-
children:
|
|
247
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
248
|
+
title: t("payment.checkout.orderSummary"),
|
|
249
|
+
sx: {
|
|
250
|
+
color: "text.primary",
|
|
251
|
+
fontSize: "18px",
|
|
252
|
+
fontWeight: "500",
|
|
253
|
+
lineHeight: "24px"
|
|
254
|
+
},
|
|
255
|
+
children: t("payment.checkout.donation.tipAmount")
|
|
256
|
+
}), !isMobile && donationSettings?.amount?.presets && donationSettings.amount.presets.length > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
257
|
+
sx: {
|
|
258
|
+
color: "text.secondary",
|
|
259
|
+
fontSize: "13px",
|
|
260
|
+
display: "flex",
|
|
261
|
+
alignItems: "center",
|
|
262
|
+
gap: 0.5,
|
|
263
|
+
opacity: 0.8
|
|
264
|
+
},
|
|
265
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
266
|
+
component: "span",
|
|
267
|
+
sx: {
|
|
268
|
+
border: "1px solid",
|
|
269
|
+
borderColor: "divider",
|
|
270
|
+
borderRadius: 0.75,
|
|
271
|
+
px: 0.75,
|
|
272
|
+
py: 0.25,
|
|
273
|
+
fontSize: "12px",
|
|
274
|
+
lineHeight: 1,
|
|
275
|
+
color: "text.secondary",
|
|
276
|
+
fontWeight: "400",
|
|
277
|
+
bgcolor: "transparent"
|
|
278
|
+
},
|
|
279
|
+
children: "Tab"
|
|
280
|
+
}), t("payment.checkout.donation.tabHint")]
|
|
281
|
+
})]
|
|
247
282
|
}), items.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_productDonation.default, {
|
|
248
283
|
item: x,
|
|
249
284
|
settings: donationSettings,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.20",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@babel/core": "^7.25.2",
|
|
94
94
|
"@babel/preset-env": "^7.25.2",
|
|
95
95
|
"@babel/preset-react": "^7.24.7",
|
|
96
|
-
"@blocklet/payment-types": "1.18.
|
|
96
|
+
"@blocklet/payment-types": "1.18.20",
|
|
97
97
|
"@storybook/addon-essentials": "^7.6.20",
|
|
98
98
|
"@storybook/addon-interactions": "^7.6.20",
|
|
99
99
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"vite-plugin-babel": "^1.2.0",
|
|
125
125
|
"vite-plugin-node-polyfills": "^0.21.0"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "f71a0013f704d58e4c04ebfcc5a35480a0942bcc"
|
|
128
128
|
}
|
package/src/locales/en.tsx
CHANGED
|
@@ -134,6 +134,7 @@ export default flat({
|
|
|
134
134
|
empty: 'No supporters yet',
|
|
135
135
|
gaveTips: '{count} people gave tips',
|
|
136
136
|
tipAmount: 'Tip Amount',
|
|
137
|
+
tabHint: 'to switch amount',
|
|
137
138
|
benefits: {
|
|
138
139
|
one: '{name} will receive all tips',
|
|
139
140
|
multiple: 'Tips will be distributed to {count} beneficiaries',
|
|
@@ -147,7 +148,7 @@ export default flat({
|
|
|
147
148
|
later: 'Configure Later',
|
|
148
149
|
configTip: 'Configure donation settings in Payment Kit',
|
|
149
150
|
},
|
|
150
|
-
cardPay: '{action} with card',
|
|
151
|
+
cardPay: '{action} with bank card',
|
|
151
152
|
empty: 'No thing to pay',
|
|
152
153
|
per: 'per',
|
|
153
154
|
pay: 'Pay {payee}',
|
package/src/locales/zh.tsx
CHANGED
|
@@ -133,6 +133,7 @@ export default flat({
|
|
|
133
133
|
empty: '❤️ 支持一下',
|
|
134
134
|
gaveTips: '已有 {count} 人打赏',
|
|
135
135
|
tipAmount: '打赏金额',
|
|
136
|
+
tabHint: '快速切换金额',
|
|
136
137
|
benefits: {
|
|
137
138
|
one: '{name} 将获得全部打赏',
|
|
138
139
|
multiple: '打赏将按比例分配给 {count} 位受益人',
|
|
@@ -146,7 +147,7 @@ export default flat({
|
|
|
146
147
|
later: '稍后配置',
|
|
147
148
|
configTip: '前往 Payment Kit 配置打赏选项',
|
|
148
149
|
},
|
|
149
|
-
cardPay: '
|
|
150
|
+
cardPay: '使用银行卡{action}',
|
|
150
151
|
empty: '没有可支付的项目',
|
|
151
152
|
per: '每',
|
|
152
153
|
pay: '付款给 {payee}',
|
|
@@ -74,6 +74,7 @@ function PaymentInner({
|
|
|
74
74
|
}: MainProps) {
|
|
75
75
|
const { t } = useLocaleContext();
|
|
76
76
|
const { settings, session } = usePaymentContext();
|
|
77
|
+
const { isMobile } = useMobile();
|
|
77
78
|
const [state, setState] = useSetState({
|
|
78
79
|
checkoutSession,
|
|
79
80
|
submitting: false,
|
|
@@ -238,17 +239,49 @@ function PaymentInner({
|
|
|
238
239
|
)}
|
|
239
240
|
|
|
240
241
|
<Stack sx={{ display: benefitsState.open ? 'none' : 'block' }}>
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
242
|
+
<Stack direction="row" justifyContent="space-between" alignItems="center" sx={{ mb: 2 }}>
|
|
243
|
+
<Typography
|
|
244
|
+
title={t('payment.checkout.orderSummary')}
|
|
245
|
+
sx={{
|
|
246
|
+
color: 'text.primary',
|
|
247
|
+
fontSize: '18px',
|
|
248
|
+
fontWeight: '500',
|
|
249
|
+
lineHeight: '24px',
|
|
250
|
+
}}>
|
|
251
|
+
{t('payment.checkout.donation.tipAmount')}
|
|
252
|
+
</Typography>
|
|
253
|
+
|
|
254
|
+
{!isMobile && donationSettings?.amount?.presets && donationSettings.amount.presets.length > 0 && (
|
|
255
|
+
<Typography
|
|
256
|
+
sx={{
|
|
257
|
+
color: 'text.secondary',
|
|
258
|
+
fontSize: '13px',
|
|
259
|
+
display: 'flex',
|
|
260
|
+
alignItems: 'center',
|
|
261
|
+
gap: 0.5,
|
|
262
|
+
opacity: 0.8,
|
|
263
|
+
}}>
|
|
264
|
+
<Box
|
|
265
|
+
component="span"
|
|
266
|
+
sx={{
|
|
267
|
+
border: '1px solid',
|
|
268
|
+
borderColor: 'divider',
|
|
269
|
+
borderRadius: 0.75,
|
|
270
|
+
px: 0.75,
|
|
271
|
+
py: 0.25,
|
|
272
|
+
fontSize: '12px',
|
|
273
|
+
lineHeight: 1,
|
|
274
|
+
color: 'text.secondary',
|
|
275
|
+
fontWeight: '400',
|
|
276
|
+
bgcolor: 'transparent',
|
|
277
|
+
}}>
|
|
278
|
+
Tab
|
|
279
|
+
</Box>
|
|
280
|
+
{t('payment.checkout.donation.tabHint')}
|
|
281
|
+
</Typography>
|
|
282
|
+
)}
|
|
283
|
+
</Stack>
|
|
284
|
+
|
|
252
285
|
{items.map((x: TLineItemExpanded) => (
|
|
253
286
|
<ProductDonation
|
|
254
287
|
key={`${x.price_id}-${currency.id}`}
|