@blocklet/payment-react 1.29.0 → 1.29.2
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/contexts/payment.js +0 -20
- package/lib/contexts/payment.js +0 -20
- package/package.json +12 -12
- package/src/contexts/payment.tsx +0 -26
package/es/contexts/payment.js
CHANGED
|
@@ -36,19 +36,6 @@ const getCurrency = (currencyId, methods) => {
|
|
|
36
36
|
const getMethod = (methodId, methods) => {
|
|
37
37
|
return methods.find((x) => x.id === methodId);
|
|
38
38
|
};
|
|
39
|
-
const syncToSpaceRequest = (userDid, spaceDid) => {
|
|
40
|
-
const cacheKey = `sync-space-${userDid}-${spaceDid}`;
|
|
41
|
-
const cachedRequest = new CachedRequest(cacheKey, () => api.post("/api/customers/sync-to-space"), {
|
|
42
|
-
ttl: 1e3 * 60 * 60
|
|
43
|
-
// 1 hour
|
|
44
|
-
});
|
|
45
|
-
return cachedRequest.fetch(false).then((res) => {
|
|
46
|
-
if (!res.success) {
|
|
47
|
-
cachedRequest.clearCache();
|
|
48
|
-
}
|
|
49
|
-
return res;
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
39
|
function PaymentProvider({
|
|
53
40
|
session,
|
|
54
41
|
connect,
|
|
@@ -123,13 +110,6 @@ function PaymentProvider({
|
|
|
123
110
|
() => run(true),
|
|
124
111
|
[run]
|
|
125
112
|
);
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
const didSpace = session?.user?.didSpace;
|
|
128
|
-
const userDid = session?.user?.did;
|
|
129
|
-
if (userDid && didSpace && didSpace.endpoint && didSpace.did) {
|
|
130
|
-
syncToSpaceRequest(userDid, didSpace.did);
|
|
131
|
-
}
|
|
132
|
-
}, [session?.user]);
|
|
133
113
|
const prefix = getPrefix();
|
|
134
114
|
const [payable, setPayable] = useState(true);
|
|
135
115
|
const [paymentState, setPaymentState] = useState({
|
package/lib/contexts/payment.js
CHANGED
|
@@ -56,19 +56,6 @@ const getCurrency = (currencyId, methods) => {
|
|
|
56
56
|
const getMethod = (methodId, methods) => {
|
|
57
57
|
return methods.find(x => x.id === methodId);
|
|
58
58
|
};
|
|
59
|
-
const syncToSpaceRequest = (userDid, spaceDid) => {
|
|
60
|
-
const cacheKey = `sync-space-${userDid}-${spaceDid}`;
|
|
61
|
-
const cachedRequest = new _cachedRequest.CachedRequest(cacheKey, () => _api.default.post("/api/customers/sync-to-space"), {
|
|
62
|
-
ttl: 1e3 * 60 * 60
|
|
63
|
-
// 1 hour
|
|
64
|
-
});
|
|
65
|
-
return cachedRequest.fetch(false).then(res => {
|
|
66
|
-
if (!res.success) {
|
|
67
|
-
cachedRequest.clearCache();
|
|
68
|
-
}
|
|
69
|
-
return res;
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
59
|
function PaymentProvider({
|
|
73
60
|
session,
|
|
74
61
|
connect,
|
|
@@ -140,13 +127,6 @@ function PaymentProvider({
|
|
|
140
127
|
(0, _useBus.default)(
|
|
141
128
|
// @ts-ignore
|
|
142
129
|
["paymentMethod.created", "paymentMethod.updated", "paymentCurrency.added", "paymentCurrency.updated"], () => run(true), [run]);
|
|
143
|
-
(0, _react.useEffect)(() => {
|
|
144
|
-
const didSpace = session?.user?.didSpace;
|
|
145
|
-
const userDid = session?.user?.did;
|
|
146
|
-
if (userDid && didSpace && didSpace.endpoint && didSpace.did) {
|
|
147
|
-
syncToSpaceRequest(userDid, didSpace.did);
|
|
148
|
-
}
|
|
149
|
-
}, [session?.user]);
|
|
150
130
|
const prefix = (0, _util.getPrefix)();
|
|
151
131
|
const [payable, setPayable] = (0, _react.useState)(true);
|
|
152
132
|
const [paymentState, setPaymentState] = (0, _react.useState)({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.2",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@arcblock/bridge": "^3.5.
|
|
58
|
-
"@arcblock/did-connect-react": "^3.5.
|
|
59
|
-
"@arcblock/react-hooks": "^3.5.
|
|
60
|
-
"@arcblock/ux": "^3.5.
|
|
61
|
-
"@arcblock/ws": "^1.30.
|
|
62
|
-
"@blocklet/payment-react-headless": "1.29.
|
|
63
|
-
"@blocklet/theme": "^3.5.
|
|
64
|
-
"@blocklet/ui-react": "^3.5.
|
|
57
|
+
"@arcblock/bridge": "^3.5.4",
|
|
58
|
+
"@arcblock/did-connect-react": "^3.5.4",
|
|
59
|
+
"@arcblock/react-hooks": "^3.5.4",
|
|
60
|
+
"@arcblock/ux": "^3.5.4",
|
|
61
|
+
"@arcblock/ws": "^1.30.24",
|
|
62
|
+
"@blocklet/payment-react-headless": "1.29.2",
|
|
63
|
+
"@blocklet/theme": "^3.5.4",
|
|
64
|
+
"@blocklet/ui-react": "^3.5.4",
|
|
65
65
|
"@mui/icons-material": "^7.1.2",
|
|
66
66
|
"@mui/lab": "7.0.0-beta.14",
|
|
67
67
|
"@mui/material": "^7.1.2",
|
|
68
68
|
"@mui/system": "^7.1.1",
|
|
69
|
-
"@ocap/util": "^1.30.
|
|
69
|
+
"@ocap/util": "^1.30.24",
|
|
70
70
|
"@stripe/react-stripe-js": "^2.9.0",
|
|
71
71
|
"@stripe/stripe-js": "^2.4.0",
|
|
72
72
|
"@vitejs/plugin-legacy": "^7.0.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"@babel/core": "^7.27.4",
|
|
98
98
|
"@babel/preset-env": "^7.27.2",
|
|
99
99
|
"@babel/preset-react": "^7.27.1",
|
|
100
|
-
"@blocklet/payment-types": "1.29.
|
|
100
|
+
"@blocklet/payment-types": "1.29.2",
|
|
101
101
|
"@storybook/addon-essentials": "^7.6.20",
|
|
102
102
|
"@storybook/addon-interactions": "^7.6.20",
|
|
103
103
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"vite-plugin-babel": "^1.3.1",
|
|
129
129
|
"vite-plugin-node-polyfills": "^0.23.0"
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "b4f9a33207cb2341638efff848a900087a18e6cf"
|
|
132
132
|
}
|
package/src/contexts/payment.tsx
CHANGED
|
@@ -83,19 +83,6 @@ const getMethod = (methodId: string, methods: TPaymentMethodExpanded[]) => {
|
|
|
83
83
|
return methods.find((x) => x.id === methodId);
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
const syncToSpaceRequest = (userDid: string, spaceDid: string) => {
|
|
87
|
-
const cacheKey = `sync-space-${userDid}-${spaceDid}`;
|
|
88
|
-
const cachedRequest = new CachedRequest(cacheKey, () => api.post('/api/customers/sync-to-space'), {
|
|
89
|
-
ttl: 1000 * 60 * 60, // 1 hour
|
|
90
|
-
});
|
|
91
|
-
return cachedRequest.fetch(false).then((res) => {
|
|
92
|
-
if (!res.success) {
|
|
93
|
-
cachedRequest.clearCache();
|
|
94
|
-
}
|
|
95
|
-
return res;
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
|
|
99
86
|
function PaymentProvider({
|
|
100
87
|
session,
|
|
101
88
|
connect,
|
|
@@ -187,19 +174,6 @@ function PaymentProvider({
|
|
|
187
174
|
[run]
|
|
188
175
|
);
|
|
189
176
|
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
const didSpace = session?.user?.didSpace as
|
|
192
|
-
| {
|
|
193
|
-
endpoint: string;
|
|
194
|
-
did: string;
|
|
195
|
-
}
|
|
196
|
-
| undefined;
|
|
197
|
-
const userDid = session?.user?.did;
|
|
198
|
-
if (userDid && didSpace && didSpace.endpoint && didSpace.did) {
|
|
199
|
-
syncToSpaceRequest(userDid, didSpace.did);
|
|
200
|
-
}
|
|
201
|
-
}, [session?.user]);
|
|
202
|
-
|
|
203
177
|
const prefix = getPrefix();
|
|
204
178
|
const [payable, setPayable] = useState(true);
|
|
205
179
|
const [paymentState, setPaymentState] = useState({
|