@blocklet/payment-react 1.14.33 → 1.14.36
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/payment/summary.js +18 -15
- package/lib/payment/summary.js +18 -15
- package/package.json +3 -3
- package/src/payment/summary.tsx +23 -15
package/es/payment/summary.js
CHANGED
|
@@ -54,24 +54,27 @@ function getStakingSetup(items, currency, billingThreshold = 0) {
|
|
|
54
54
|
licensed: new BN(0),
|
|
55
55
|
metered: new BN(0)
|
|
56
56
|
};
|
|
57
|
-
items.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
const recurringItems = items.map((x) => x.upsell_price || x.price).filter((x) => x.type === "recurring" && x.recurring);
|
|
58
|
+
if (recurringItems.length > 0) {
|
|
59
|
+
if (+billingThreshold) {
|
|
60
|
+
return fromTokenToUnit(billingThreshold, currency.decimal).toString();
|
|
61
|
+
}
|
|
62
|
+
items.forEach((x) => {
|
|
63
|
+
const price = x.upsell_price || x.price;
|
|
64
|
+
const unit = getPriceUintAmountByCurrency(price, currency);
|
|
65
|
+
const amount = new BN(unit).mul(new BN(x.quantity));
|
|
66
|
+
if (price.type === "recurring" && price.recurring) {
|
|
67
|
+
if (price.recurring.usage_type === "licensed") {
|
|
68
|
+
staking.licensed = staking.licensed.add(amount);
|
|
69
|
+
}
|
|
70
|
+
if (price.recurring.usage_type === "metered") {
|
|
69
71
|
staking.metered = staking.metered.add(amount);
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
});
|
|
75
|
+
return staking.licensed.add(staking.metered).toString();
|
|
76
|
+
}
|
|
77
|
+
return "0";
|
|
75
78
|
}
|
|
76
79
|
PaymentSummary.defaultProps = {
|
|
77
80
|
onUpsell: noop,
|
package/lib/payment/summary.js
CHANGED
|
@@ -61,24 +61,27 @@ function getStakingSetup(items, currency, billingThreshold = 0) {
|
|
|
61
61
|
licensed: new _util.BN(0),
|
|
62
62
|
metered: new _util.BN(0)
|
|
63
63
|
};
|
|
64
|
-
items.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
const recurringItems = items.map(x => x.upsell_price || x.price).filter(x => x.type === "recurring" && x.recurring);
|
|
65
|
+
if (recurringItems.length > 0) {
|
|
66
|
+
if (+billingThreshold) {
|
|
67
|
+
return (0, _util.fromTokenToUnit)(billingThreshold, currency.decimal).toString();
|
|
68
|
+
}
|
|
69
|
+
items.forEach(x => {
|
|
70
|
+
const price = x.upsell_price || x.price;
|
|
71
|
+
const unit = (0, _util2.getPriceUintAmountByCurrency)(price, currency);
|
|
72
|
+
const amount = new _util.BN(unit).mul(new _util.BN(x.quantity));
|
|
73
|
+
if (price.type === "recurring" && price.recurring) {
|
|
74
|
+
if (price.recurring.usage_type === "licensed") {
|
|
75
|
+
staking.licensed = staking.licensed.add(amount);
|
|
76
|
+
}
|
|
77
|
+
if (price.recurring.usage_type === "metered") {
|
|
76
78
|
staking.metered = staking.metered.add(amount);
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
});
|
|
82
|
+
return staking.licensed.add(staking.metered).toString();
|
|
83
|
+
}
|
|
84
|
+
return "0";
|
|
82
85
|
}
|
|
83
86
|
PaymentSummary.defaultProps = {
|
|
84
87
|
onUpsell: _noop.default,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.36",
|
|
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.14.
|
|
96
|
+
"@blocklet/payment-types": "1.14.36",
|
|
97
97
|
"@storybook/addon-essentials": "^7.6.20",
|
|
98
98
|
"@storybook/addon-interactions": "^7.6.20",
|
|
99
99
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"vite-plugin-babel": "^1.2.0",
|
|
124
124
|
"vite-plugin-node-polyfills": "^0.21.0"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "927e39d554524434d20f22a950eec503166ae529"
|
|
127
127
|
}
|
package/src/payment/summary.tsx
CHANGED
|
@@ -100,25 +100,33 @@ function getStakingSetup(items: TLineItemExpanded[], currency: TPaymentCurrency,
|
|
|
100
100
|
metered: new BN(0),
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
const recurringItems = items
|
|
104
|
+
.map((x) => x.upsell_price || x.price)
|
|
105
|
+
.filter((x) => x.type === 'recurring' && x.recurring);
|
|
106
|
+
|
|
107
|
+
if (recurringItems.length > 0) {
|
|
108
|
+
if (+billingThreshold) {
|
|
109
|
+
return fromTokenToUnit(billingThreshold, currency.decimal).toString();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
items.forEach((x) => {
|
|
113
|
+
const price = x.upsell_price || x.price;
|
|
114
|
+
const unit = getPriceUintAmountByCurrency(price, currency);
|
|
115
|
+
const amount = new BN(unit).mul(new BN(x.quantity));
|
|
116
|
+
if (price.type === 'recurring' && price.recurring) {
|
|
117
|
+
if (price.recurring.usage_type === 'licensed') {
|
|
118
|
+
staking.licensed = staking.licensed.add(amount);
|
|
119
|
+
}
|
|
120
|
+
if (price.recurring.usage_type === 'metered') {
|
|
115
121
|
staking.metered = staking.metered.add(amount);
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
|
-
}
|
|
119
|
-
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return staking.licensed.add(staking.metered).toString();
|
|
127
|
+
}
|
|
120
128
|
|
|
121
|
-
return
|
|
129
|
+
return '0';
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
PaymentSummary.defaultProps = {
|