@blocklet/launcher-util 2.3.49 → 2.3.50
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/util.js +7 -5
- package/lib/util.js +7 -5
- package/package.json +3 -3
package/es/util.js
CHANGED
|
@@ -129,14 +129,16 @@ const getBlockletUrlOnStore = ({ did, baseUrl }) => {
|
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
const getDefaultTrialEnd = () => moment().add(1, "years").unix();
|
|
132
|
-
const getProductFreeTrial = (typeName, freeTrialProducts) => {
|
|
133
|
-
const result = { isFreeTrial: false };
|
|
132
|
+
const getProductFreeTrial = ({ typeName, freeTrialProducts, currencyId }) => {
|
|
134
133
|
if (!Array.isArray(freeTrialProducts)) {
|
|
135
|
-
return
|
|
134
|
+
return null;
|
|
136
135
|
}
|
|
137
|
-
const matched = freeTrialProducts.find((x) =>
|
|
136
|
+
const matched = freeTrialProducts.find((x) => {
|
|
137
|
+
const paymentCurrencies = x.paymentCurrencies.split(",").map((y) => y.trim()).filter(Boolean);
|
|
138
|
+
return x.productTypeName === typeName && x.isFreeTrial && paymentCurrencies.includes(currencyId);
|
|
139
|
+
});
|
|
138
140
|
if (!matched) {
|
|
139
|
-
return
|
|
141
|
+
return null;
|
|
140
142
|
}
|
|
141
143
|
return matched;
|
|
142
144
|
};
|
package/lib/util.js
CHANGED
|
@@ -131,14 +131,16 @@ const getBlockletUrlOnStore = ({ did, baseUrl }) => {
|
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
const getDefaultTrialEnd = () => moment().add(1, "years").unix();
|
|
134
|
-
const getProductFreeTrial = (typeName, freeTrialProducts) => {
|
|
135
|
-
const result = { isFreeTrial: false };
|
|
134
|
+
const getProductFreeTrial = ({ typeName, freeTrialProducts, currencyId }) => {
|
|
136
135
|
if (!Array.isArray(freeTrialProducts)) {
|
|
137
|
-
return
|
|
136
|
+
return null;
|
|
138
137
|
}
|
|
139
|
-
const matched = freeTrialProducts.find((x) =>
|
|
138
|
+
const matched = freeTrialProducts.find((x) => {
|
|
139
|
+
const paymentCurrencies = x.paymentCurrencies.split(",").map((y) => y.trim()).filter(Boolean);
|
|
140
|
+
return x.productTypeName === typeName && x.isFreeTrial && paymentCurrencies.includes(currencyId);
|
|
141
|
+
});
|
|
140
142
|
if (!matched) {
|
|
141
|
-
return
|
|
143
|
+
return null;
|
|
142
144
|
}
|
|
143
145
|
return matched;
|
|
144
146
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/launcher-util",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.50",
|
|
4
4
|
"description": "Common constants",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"constant"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"url": "https://github.com/blocklet/launcher/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@blocklet/sdk": "1.16.
|
|
38
|
+
"@blocklet/sdk": "1.16.30",
|
|
39
39
|
"@ocap/util": "^1.18.132",
|
|
40
40
|
"axios": "^0.27.2",
|
|
41
41
|
"flat": "^5.0.2",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"vite": "^5.4.2",
|
|
49
49
|
"vite-plugin-build": "^0.10.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "1fce965a3faefe5ed5bf0f98f04b6daaaa6437b1"
|
|
52
52
|
}
|