@blocklet/payment-react 1.13.283 → 1.13.285
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/components/pricing-table.js +19 -11
- package/es/libs/constant.d.ts +4 -0
- package/es/libs/constant.js +4 -0
- package/es/libs/util.js +3 -5
- package/es/locales/en.js +9 -1
- package/es/locales/zh.js +9 -1
- package/es/payment/index.js +3 -1
- package/lib/components/pricing-table.js +24 -16
- package/lib/libs/constant.d.ts +4 -0
- package/lib/libs/constant.js +10 -0
- package/lib/libs/util.js +3 -2
- package/lib/locales/en.js +9 -1
- package/lib/locales/zh.js +9 -1
- package/lib/payment/index.js +3 -1
- package/package.json +5 -5
- package/src/components/pricing-table.tsx +24 -12
- package/src/libs/constant.ts +4 -0
- package/src/libs/util.ts +5 -5
- package/src/locales/en.tsx +9 -0
- package/src/locales/zh.tsx +9 -0
- package/src/payment/index.tsx +3 -1
|
@@ -46,15 +46,23 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
46
46
|
const {
|
|
47
47
|
settings: { paymentMethods = [] }
|
|
48
48
|
} = usePaymentContext();
|
|
49
|
-
const [currency, setCurrency] = useState(table.currency);
|
|
49
|
+
const [currency, setCurrency] = useState(table.currency || {});
|
|
50
50
|
const { recurring, grouped } = groupItemsByRecurring(table.items);
|
|
51
51
|
const [state, setState] = useSetState({ interval });
|
|
52
52
|
const currencyMap = useMemo(() => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
if (!paymentMethods || paymentMethods.length === 0) {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
const ans = {};
|
|
57
|
+
paymentMethods.forEach((paymentMethod) => {
|
|
58
|
+
const { payment_currencies: paymentCurrencies = [] } = paymentMethod;
|
|
59
|
+
if (paymentCurrencies && paymentCurrencies.length > 0) {
|
|
60
|
+
paymentCurrencies.forEach((x) => {
|
|
61
|
+
ans[x.id] = x;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return ans;
|
|
58
66
|
}, [paymentMethods]);
|
|
59
67
|
const currencyList = useMemo(() => {
|
|
60
68
|
const visited = {};
|
|
@@ -66,7 +74,7 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
66
74
|
visited[c?.currency_id] = true;
|
|
67
75
|
});
|
|
68
76
|
});
|
|
69
|
-
return Object.keys(visited).map((x) => currencyMap[x]);
|
|
77
|
+
return Object.keys(visited).map((x) => currencyMap[x]).filter((v) => v);
|
|
70
78
|
}, [currencyMap, grouped, state.interval]);
|
|
71
79
|
useEffect(() => {
|
|
72
80
|
if (table) {
|
|
@@ -164,11 +172,11 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
164
172
|
currencyList.length > 1 && /* @__PURE__ */ jsx(
|
|
165
173
|
Select,
|
|
166
174
|
{
|
|
167
|
-
value: currency
|
|
168
|
-
onChange: (e) => setCurrency(currencyList.find((v) => v
|
|
175
|
+
value: currency?.id,
|
|
176
|
+
onChange: (e) => setCurrency(currencyList.find((v) => v?.id === e.target.value)),
|
|
169
177
|
size: "small",
|
|
170
178
|
sx: { m: 1, width: 120 },
|
|
171
|
-
children: currencyList.map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x
|
|
179
|
+
children: currencyList.map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x?.id, children: /* @__PURE__ */ jsx(Typography, { color: x?.id === currency?.id ? "text.primary" : "text.secondary", children: x?.symbol }) }, x?.id))
|
|
172
180
|
}
|
|
173
181
|
)
|
|
174
182
|
] }),
|
|
@@ -314,7 +322,7 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
314
322
|
)
|
|
315
323
|
] }, f.name))
|
|
316
324
|
] }) }),
|
|
317
|
-
/* @__PURE__ */ jsx(Subscribe, { x, action, onSelect, currencyId: currency
|
|
325
|
+
/* @__PURE__ */ jsx(Subscribe, { x, action, onSelect, currencyId: currency?.id })
|
|
318
326
|
]
|
|
319
327
|
},
|
|
320
328
|
x?.price_id
|
package/es/libs/util.js
CHANGED
|
@@ -205,11 +205,9 @@ export function formatLineItemPricing(item, currency, trial, locale = "en") {
|
|
|
205
205
|
if (price.recurring?.usage_type === "metered" || +item.quantity === 1) {
|
|
206
206
|
quantity = "";
|
|
207
207
|
}
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
)} ${currency.symbol}`;
|
|
212
|
-
const unit = `${fromUnitToToken(getPriceUintAmountByCurrency(price, currency))} ${currency.symbol}`;
|
|
208
|
+
const unitValue = new BN(getPriceUintAmountByCurrency(price, currency));
|
|
209
|
+
const total = `${fromUnitToToken(unitValue.mul(new BN(item.quantity)), currency.decimal)} ${currency.symbol}`;
|
|
210
|
+
const unit = `${fromUnitToToken(unitValue, currency.decimal)} ${currency.symbol}`;
|
|
213
211
|
const appendUnit = (v, alt) => {
|
|
214
212
|
if (price.product.unit_label) {
|
|
215
213
|
return `${v}/${price.product.unit_label}`;
|
package/es/locales/en.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import flat from "flat";
|
|
2
|
+
import { RefundType } from "../libs/constant.js";
|
|
2
3
|
export default flat({
|
|
3
4
|
common: {
|
|
4
5
|
id: "ID",
|
|
@@ -79,7 +80,8 @@ export default flat({
|
|
|
79
80
|
days: "days",
|
|
80
81
|
weeks: "weeks",
|
|
81
82
|
months: "months",
|
|
82
|
-
years: "years"
|
|
83
|
+
years: "years",
|
|
84
|
+
type: "type"
|
|
83
85
|
},
|
|
84
86
|
payment: {
|
|
85
87
|
checkout: {
|
|
@@ -283,5 +285,11 @@ export default flat({
|
|
|
283
285
|
upcoming: "Upcoming invoice"
|
|
284
286
|
}
|
|
285
287
|
}
|
|
288
|
+
},
|
|
289
|
+
refund: {
|
|
290
|
+
type: {
|
|
291
|
+
[RefundType.refund]: "Refund",
|
|
292
|
+
[RefundType.stakeReturn]: "Stake Return"
|
|
293
|
+
}
|
|
286
294
|
}
|
|
287
295
|
});
|
package/es/locales/zh.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import flat from "flat";
|
|
2
|
+
import { RefundType } from "../libs/constant.js";
|
|
2
3
|
export default flat({
|
|
3
4
|
common: {
|
|
4
5
|
id: "ID",
|
|
@@ -79,7 +80,8 @@ export default flat({
|
|
|
79
80
|
days: "\u5929",
|
|
80
81
|
weeks: "\u5468",
|
|
81
82
|
months: "\u6708",
|
|
82
|
-
years: "\u5E74"
|
|
83
|
+
years: "\u5E74",
|
|
84
|
+
type: "\u7C7B\u578B"
|
|
83
85
|
},
|
|
84
86
|
payment: {
|
|
85
87
|
checkout: {
|
|
@@ -283,5 +285,11 @@ export default flat({
|
|
|
283
285
|
upcoming: "\u672A\u6765\u8D26\u5355"
|
|
284
286
|
}
|
|
285
287
|
}
|
|
288
|
+
},
|
|
289
|
+
refund: {
|
|
290
|
+
type: {
|
|
291
|
+
[RefundType.refund]: "\u9000\u6B3E",
|
|
292
|
+
[RefundType.stakeReturn]: "\u9000\u62BC\u91D1"
|
|
293
|
+
}
|
|
286
294
|
}
|
|
287
295
|
});
|
package/es/payment/index.js
CHANGED
|
@@ -326,7 +326,9 @@ export const Root = styled(Box)`
|
|
|
326
326
|
position: absolute;
|
|
327
327
|
right: 0;
|
|
328
328
|
top: 0;
|
|
329
|
-
transition:
|
|
329
|
+
transition:
|
|
330
|
+
background-color 0.15s ease,
|
|
331
|
+
box-shadow 0.15s ease-out;
|
|
330
332
|
}
|
|
331
333
|
.cko-product {
|
|
332
334
|
margin-top: ${(props) => props.mode === "standalone" ? "64px" : "0"};
|
|
@@ -54,7 +54,7 @@ function PricingTable({
|
|
|
54
54
|
paymentMethods = []
|
|
55
55
|
}
|
|
56
56
|
} = (0, _payment.usePaymentContext)();
|
|
57
|
-
const [currency, setCurrency] = (0, _react.useState)(table.currency);
|
|
57
|
+
const [currency, setCurrency] = (0, _react.useState)(table.currency || {});
|
|
58
58
|
const {
|
|
59
59
|
recurring,
|
|
60
60
|
grouped
|
|
@@ -63,13 +63,21 @@ function PricingTable({
|
|
|
63
63
|
interval
|
|
64
64
|
});
|
|
65
65
|
const currencyMap = (0, _react.useMemo)(() => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
if (!paymentMethods || paymentMethods.length === 0) {
|
|
67
|
+
return {};
|
|
68
|
+
}
|
|
69
|
+
const ans = {};
|
|
70
|
+
paymentMethods.forEach(paymentMethod => {
|
|
71
|
+
const {
|
|
72
|
+
payment_currencies: paymentCurrencies = []
|
|
73
|
+
} = paymentMethod;
|
|
74
|
+
if (paymentCurrencies && paymentCurrencies.length > 0) {
|
|
75
|
+
paymentCurrencies.forEach(x => {
|
|
76
|
+
ans[x.id] = x;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return ans;
|
|
73
81
|
}, [paymentMethods]);
|
|
74
82
|
const currencyList = (0, _react.useMemo)(() => {
|
|
75
83
|
const visited = {};
|
|
@@ -81,7 +89,7 @@ function PricingTable({
|
|
|
81
89
|
visited[c?.currency_id] = true;
|
|
82
90
|
});
|
|
83
91
|
});
|
|
84
|
-
return Object.keys(visited).map(x => currencyMap[x]);
|
|
92
|
+
return Object.keys(visited).map(x => currencyMap[x]).filter(v => v);
|
|
85
93
|
}, [currencyMap, grouped, state.interval]);
|
|
86
94
|
(0, _react.useEffect)(() => {
|
|
87
95
|
if (table) {
|
|
@@ -176,20 +184,20 @@ function PricingTable({
|
|
|
176
184
|
children: (0, _util.formatRecurring)(recurring[x], true, "", locale)
|
|
177
185
|
}, x))
|
|
178
186
|
}), currencyList.length > 1 && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Select, {
|
|
179
|
-
value: currency
|
|
180
|
-
onChange: e => setCurrency(currencyList.find(v => v
|
|
187
|
+
value: currency?.id,
|
|
188
|
+
onChange: e => setCurrency(currencyList.find(v => v?.id === e.target.value)),
|
|
181
189
|
size: "small",
|
|
182
190
|
sx: {
|
|
183
191
|
m: 1,
|
|
184
192
|
width: 120
|
|
185
193
|
},
|
|
186
194
|
children: currencyList.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
187
|
-
value: x
|
|
195
|
+
value: x?.id,
|
|
188
196
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
189
|
-
color: x
|
|
190
|
-
children: x
|
|
197
|
+
color: x?.id === currency?.id ? "text.primary" : "text.secondary",
|
|
198
|
+
children: x?.symbol
|
|
191
199
|
})
|
|
192
|
-
}, x
|
|
200
|
+
}, x?.id))
|
|
193
201
|
})]
|
|
194
202
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
195
203
|
flexWrap: "wrap",
|
|
@@ -337,7 +345,7 @@ function PricingTable({
|
|
|
337
345
|
x,
|
|
338
346
|
action,
|
|
339
347
|
onSelect,
|
|
340
|
-
currencyId: currency
|
|
348
|
+
currencyId: currency?.id
|
|
341
349
|
})]
|
|
342
350
|
}, x?.price_id);
|
|
343
351
|
})
|
package/lib/libs/util.js
CHANGED
|
@@ -264,8 +264,9 @@ function formatLineItemPricing(item, currency, trial, locale = "en") {
|
|
|
264
264
|
if (price.recurring?.usage_type === "metered" || +item.quantity === 1) {
|
|
265
265
|
quantity = "";
|
|
266
266
|
}
|
|
267
|
-
const
|
|
268
|
-
const
|
|
267
|
+
const unitValue = new _util.BN(getPriceUintAmountByCurrency(price, currency));
|
|
268
|
+
const total = `${(0, _util.fromUnitToToken)(unitValue.mul(new _util.BN(item.quantity)), currency.decimal)} ${currency.symbol}`;
|
|
269
|
+
const unit = `${(0, _util.fromUnitToToken)(unitValue, currency.decimal)} ${currency.symbol}`;
|
|
269
270
|
const appendUnit = (v, alt) => {
|
|
270
271
|
if (price.product.unit_label) {
|
|
271
272
|
return `${v}/${price.product.unit_label}`;
|
package/lib/locales/en.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
var _flat = _interopRequireDefault(require("flat"));
|
|
8
|
+
var _constant = require("../libs/constant");
|
|
8
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
10
|
module.exports = (0, _flat.default)({
|
|
10
11
|
common: {
|
|
@@ -86,7 +87,8 @@ module.exports = (0, _flat.default)({
|
|
|
86
87
|
days: "days",
|
|
87
88
|
weeks: "weeks",
|
|
88
89
|
months: "months",
|
|
89
|
-
years: "years"
|
|
90
|
+
years: "years",
|
|
91
|
+
type: "type"
|
|
90
92
|
},
|
|
91
93
|
payment: {
|
|
92
94
|
checkout: {
|
|
@@ -290,5 +292,11 @@ module.exports = (0, _flat.default)({
|
|
|
290
292
|
upcoming: "Upcoming invoice"
|
|
291
293
|
}
|
|
292
294
|
}
|
|
295
|
+
},
|
|
296
|
+
refund: {
|
|
297
|
+
type: {
|
|
298
|
+
[_constant.RefundType.refund]: "Refund",
|
|
299
|
+
[_constant.RefundType.stakeReturn]: "Stake Return"
|
|
300
|
+
}
|
|
293
301
|
}
|
|
294
302
|
});
|
package/lib/locales/zh.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
var _flat = _interopRequireDefault(require("flat"));
|
|
8
|
+
var _constant = require("../libs/constant");
|
|
8
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
10
|
module.exports = (0, _flat.default)({
|
|
10
11
|
common: {
|
|
@@ -86,7 +87,8 @@ module.exports = (0, _flat.default)({
|
|
|
86
87
|
days: "\u5929",
|
|
87
88
|
weeks: "\u5468",
|
|
88
89
|
months: "\u6708",
|
|
89
|
-
years: "\u5E74"
|
|
90
|
+
years: "\u5E74",
|
|
91
|
+
type: "\u7C7B\u578B"
|
|
90
92
|
},
|
|
91
93
|
payment: {
|
|
92
94
|
checkout: {
|
|
@@ -290,5 +292,11 @@ module.exports = (0, _flat.default)({
|
|
|
290
292
|
upcoming: "\u672A\u6765\u8D26\u5355"
|
|
291
293
|
}
|
|
292
294
|
}
|
|
295
|
+
},
|
|
296
|
+
refund: {
|
|
297
|
+
type: {
|
|
298
|
+
[_constant.RefundType.refund]: "\u9000\u6B3E",
|
|
299
|
+
[_constant.RefundType.stakeReturn]: "\u9000\u62BC\u91D1"
|
|
300
|
+
}
|
|
293
301
|
}
|
|
294
302
|
});
|
package/lib/payment/index.js
CHANGED
|
@@ -401,7 +401,9 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
|
|
|
401
401
|
position: absolute;
|
|
402
402
|
right: 0;
|
|
403
403
|
top: 0;
|
|
404
|
-
transition:
|
|
404
|
+
transition:
|
|
405
|
+
background-color 0.15s ease,
|
|
406
|
+
box-shadow 0.15s ease-out;
|
|
405
407
|
}
|
|
406
408
|
.cko-product {
|
|
407
409
|
margin-top: ${props => props.mode === "standalone" ? "64px" : "0"};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.285",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@arcblock/eslint-config-ts": "^0.3.
|
|
89
|
+
"@arcblock/eslint-config-ts": "^0.3.2",
|
|
90
90
|
"@babel/cli": "^7.24.7",
|
|
91
91
|
"@babel/core": "^7.24.7",
|
|
92
92
|
"@babel/preset-env": "^7.24.7",
|
|
93
93
|
"@babel/preset-react": "^7.24.7",
|
|
94
|
-
"@blocklet/payment-types": "1.13.
|
|
94
|
+
"@blocklet/payment-types": "1.13.285",
|
|
95
95
|
"@storybook/addon-essentials": "^7.6.19",
|
|
96
96
|
"@storybook/addon-interactions": "^7.6.19",
|
|
97
97
|
"@storybook/addon-links": "^7.6.19",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"glob": "^10.4.1",
|
|
108
108
|
"import-sort-style-module": "^6.0.0",
|
|
109
109
|
"jest": "^29.7.0",
|
|
110
|
-
"prettier": "^
|
|
110
|
+
"prettier": "^3.3.2",
|
|
111
111
|
"prettier-plugin-import-sort": "^0.0.7",
|
|
112
112
|
"react": "^18.3.1",
|
|
113
113
|
"react-dom": "^18.3.1",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"vite-plugin-babel": "^1.2.0",
|
|
121
121
|
"vite-plugin-node-polyfills": "^0.21.0"
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "d95d4a86102a7394461680849860140aa372ab06"
|
|
124
124
|
}
|
|
@@ -64,15 +64,23 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
64
64
|
const {
|
|
65
65
|
settings: { paymentMethods = [] },
|
|
66
66
|
} = usePaymentContext();
|
|
67
|
-
const [currency, setCurrency] = useState(table.currency);
|
|
67
|
+
const [currency, setCurrency] = useState(table.currency || {});
|
|
68
68
|
const { recurring, grouped } = groupItemsByRecurring(table.items);
|
|
69
69
|
const [state, setState] = useSetState({ interval });
|
|
70
70
|
const currencyMap = useMemo(() => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
if (!paymentMethods || paymentMethods.length === 0) {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
const ans: { [key: string]: any } = {};
|
|
75
|
+
paymentMethods.forEach((paymentMethod) => {
|
|
76
|
+
const { payment_currencies: paymentCurrencies = [] } = paymentMethod;
|
|
77
|
+
if (paymentCurrencies && paymentCurrencies.length > 0) {
|
|
78
|
+
paymentCurrencies.forEach((x: { id: string; symbol: string }) => {
|
|
79
|
+
ans[x.id] = x;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return ans;
|
|
76
84
|
}, [paymentMethods]);
|
|
77
85
|
|
|
78
86
|
const currencyList = useMemo(() => {
|
|
@@ -85,7 +93,9 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
85
93
|
visited[c?.currency_id] = true;
|
|
86
94
|
});
|
|
87
95
|
});
|
|
88
|
-
return Object.keys(visited)
|
|
96
|
+
return Object.keys(visited)
|
|
97
|
+
.map((x) => currencyMap[x])
|
|
98
|
+
.filter((v) => v);
|
|
89
99
|
}, [currencyMap, grouped, state.interval]);
|
|
90
100
|
|
|
91
101
|
useEffect(() => {
|
|
@@ -182,13 +192,15 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
182
192
|
)}
|
|
183
193
|
{currencyList.length > 1 && (
|
|
184
194
|
<Select
|
|
185
|
-
value={currency
|
|
186
|
-
onChange={(e) => setCurrency(currencyList.find((v) => v
|
|
195
|
+
value={currency?.id}
|
|
196
|
+
onChange={(e) => setCurrency(currencyList.find((v) => v?.id === e.target.value))}
|
|
187
197
|
size="small"
|
|
188
198
|
sx={{ m: 1, width: 120 }}>
|
|
189
199
|
{currencyList.map((x) => (
|
|
190
|
-
<MenuItem key={x
|
|
191
|
-
<Typography color={x
|
|
200
|
+
<MenuItem key={x?.id} value={x?.id}>
|
|
201
|
+
<Typography color={x?.id === currency?.id ? 'text.primary' : 'text.secondary'}>
|
|
202
|
+
{x?.symbol}
|
|
203
|
+
</Typography>
|
|
192
204
|
</MenuItem>
|
|
193
205
|
))}
|
|
194
206
|
</Select>
|
|
@@ -324,7 +336,7 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
|
|
|
324
336
|
</List>
|
|
325
337
|
</Box>
|
|
326
338
|
)}
|
|
327
|
-
<Subscribe x={x} action={action} onSelect={onSelect} currencyId={currency
|
|
339
|
+
<Subscribe x={x} action={action} onSelect={onSelect} currencyId={currency?.id} />
|
|
328
340
|
</Stack>
|
|
329
341
|
);
|
|
330
342
|
}
|
package/src/libs/util.ts
CHANGED
|
@@ -298,11 +298,11 @@ export function formatLineItemPricing(
|
|
|
298
298
|
quantity = '';
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const unit = `${fromUnitToToken(
|
|
301
|
+
const unitValue = new BN(getPriceUintAmountByCurrency(price, currency));
|
|
302
|
+
|
|
303
|
+
const total = `${fromUnitToToken(unitValue.mul(new BN(item.quantity)), currency.decimal)} ${currency.symbol}`;
|
|
304
|
+
|
|
305
|
+
const unit = `${fromUnitToToken(unitValue, currency.decimal)} ${currency.symbol}`;
|
|
306
306
|
|
|
307
307
|
const appendUnit = (v: string, alt: string) => {
|
|
308
308
|
if (price.product.unit_label) {
|
package/src/locales/en.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import flat from 'flat';
|
|
2
2
|
|
|
3
|
+
import { RefundType } from '../libs/constant';
|
|
4
|
+
|
|
3
5
|
export default flat({
|
|
4
6
|
common: {
|
|
5
7
|
id: 'ID',
|
|
@@ -81,6 +83,7 @@ export default flat({
|
|
|
81
83
|
weeks: 'weeks',
|
|
82
84
|
months: 'months',
|
|
83
85
|
years: 'years',
|
|
86
|
+
type: 'type',
|
|
84
87
|
},
|
|
85
88
|
payment: {
|
|
86
89
|
checkout: {
|
|
@@ -295,4 +298,10 @@ export default flat({
|
|
|
295
298
|
},
|
|
296
299
|
},
|
|
297
300
|
},
|
|
301
|
+
refund: {
|
|
302
|
+
type: {
|
|
303
|
+
[RefundType.refund]: 'Refund',
|
|
304
|
+
[RefundType.stakeReturn]: 'Stake Return',
|
|
305
|
+
},
|
|
306
|
+
},
|
|
298
307
|
});
|
package/src/locales/zh.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import flat from 'flat';
|
|
2
2
|
|
|
3
|
+
import { RefundType } from '../libs/constant';
|
|
4
|
+
|
|
3
5
|
export default flat({
|
|
4
6
|
common: {
|
|
5
7
|
id: 'ID',
|
|
@@ -81,6 +83,7 @@ export default flat({
|
|
|
81
83
|
weeks: '周',
|
|
82
84
|
months: '月',
|
|
83
85
|
years: '年',
|
|
86
|
+
type: '类型',
|
|
84
87
|
},
|
|
85
88
|
payment: {
|
|
86
89
|
checkout: {
|
|
@@ -287,4 +290,10 @@ export default flat({
|
|
|
287
290
|
},
|
|
288
291
|
},
|
|
289
292
|
},
|
|
293
|
+
refund: {
|
|
294
|
+
type: {
|
|
295
|
+
[RefundType.refund]: '退款',
|
|
296
|
+
[RefundType.stakeReturn]: '退押金',
|
|
297
|
+
},
|
|
298
|
+
},
|
|
290
299
|
});
|
package/src/payment/index.tsx
CHANGED
|
@@ -381,7 +381,9 @@ export const Root = styled(Box)<{ mode: LiteralUnion<'standalone' | 'inline' | '
|
|
|
381
381
|
position: absolute;
|
|
382
382
|
right: 0;
|
|
383
383
|
top: 0;
|
|
384
|
-
transition:
|
|
384
|
+
transition:
|
|
385
|
+
background-color 0.15s ease,
|
|
386
|
+
box-shadow 0.15s ease-out;
|
|
385
387
|
}
|
|
386
388
|
.cko-product {
|
|
387
389
|
margin-top: ${(props) => (props.mode === 'standalone' ? '64px' : '0')};
|