payment-kit 1.22.5 → 1.22.6
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/api/src/libs/resource.ts +25 -15
- package/blocklet.yml +1 -1
- package/package.json +6 -6
package/api/src/libs/resource.ts
CHANGED
|
@@ -16,26 +16,36 @@ import { createProductAndPrices } from '../routes/products';
|
|
|
16
16
|
import { PaymentCurrency, PaymentLink, Price, Product, nextPriceId } from '../store/models';
|
|
17
17
|
|
|
18
18
|
export async function getPackResource(type: string) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
try {
|
|
20
|
+
const resources = await getPackResources({
|
|
21
|
+
types: [
|
|
22
|
+
{
|
|
23
|
+
did: env.componentDid,
|
|
24
|
+
type,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
});
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (resources) {
|
|
30
|
+
return resources[0] || null;
|
|
31
|
+
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
return null;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
console.error(`failed to get ${type} pack resource from ${env.componentDid}`, error);
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
export async function getResourcesByType(type: string) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
try {
|
|
42
|
+
const pack = await getPackResource(type);
|
|
43
|
+
const resources = await getResources({ types: [{ did: env.componentDid, type }], skipRunningCheck: true });
|
|
44
|
+
return pack ? [pack, ...resources] : resources;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error(`failed to get ${type} resources from ${env.componentDid}`, error);
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
export async function initPaywallResources() {
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.6",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@blocklet/error": "^0.2.5",
|
|
58
58
|
"@blocklet/js-sdk": "^1.17.0-beta-20251104-112713-e947b159",
|
|
59
59
|
"@blocklet/logger": "^1.17.0-beta-20251104-112713-e947b159",
|
|
60
|
-
"@blocklet/payment-broker-client": "1.22.
|
|
61
|
-
"@blocklet/payment-react": "1.22.
|
|
62
|
-
"@blocklet/payment-vendor": "1.22.
|
|
60
|
+
"@blocklet/payment-broker-client": "1.22.6",
|
|
61
|
+
"@blocklet/payment-react": "1.22.6",
|
|
62
|
+
"@blocklet/payment-vendor": "1.22.6",
|
|
63
63
|
"@blocklet/sdk": "^1.17.0-beta-20251104-112713-e947b159",
|
|
64
64
|
"@blocklet/ui-react": "^3.1.54",
|
|
65
65
|
"@blocklet/uploader": "^0.3.4",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"devDependencies": {
|
|
130
130
|
"@abtnode/types": "^1.17.0-beta-20251104-112713-e947b159",
|
|
131
131
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
132
|
-
"@blocklet/payment-types": "1.22.
|
|
132
|
+
"@blocklet/payment-types": "1.22.6",
|
|
133
133
|
"@types/cookie-parser": "^1.4.9",
|
|
134
134
|
"@types/cors": "^2.8.19",
|
|
135
135
|
"@types/debug": "^4.1.12",
|
|
@@ -176,5 +176,5 @@
|
|
|
176
176
|
"parser": "typescript"
|
|
177
177
|
}
|
|
178
178
|
},
|
|
179
|
-
"gitHead": "
|
|
179
|
+
"gitHead": "69c7b775a4fa6ba27b5b317aa76e25db3fd4177f"
|
|
180
180
|
}
|