@blocklet/payment-react 1.22.9 → 1.22.11
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/locales/en.js +2 -1
- package/es/locales/zh.js +2 -1
- package/es/payment/success.js +17 -0
- package/lib/locales/en.js +2 -1
- package/lib/locales/zh.js +2 -1
- package/lib/payment/success.js +19 -0
- package/package.json +5 -3
- package/src/locales/en.tsx +1 -0
- package/src/locales/zh.tsx +1 -0
- package/src/payment/success.tsx +20 -1
package/es/locales/en.js
CHANGED
|
@@ -197,7 +197,8 @@ export default flat({
|
|
|
197
197
|
processing: "Domain ({name}) registering",
|
|
198
198
|
completed: "Domain ({name}) registered successfully",
|
|
199
199
|
failed: "Domain ({name}) registered failed"
|
|
200
|
-
}
|
|
200
|
+
},
|
|
201
|
+
arcSphereToast: "Successfully installed, three seconds to return to the page continue..."
|
|
201
202
|
},
|
|
202
203
|
confirm: {
|
|
203
204
|
withStake: "By confirming, you allow {payee} to charge your account for future payments and, if necessary, slash your stake. You can cancel your subscription or withdraw your stake at any time.",
|
package/es/locales/zh.js
CHANGED
|
@@ -197,7 +197,8 @@ export default flat({
|
|
|
197
197
|
processing: "\u6B63\u5728\u6CE8\u518C {name}",
|
|
198
198
|
completed: "\u6CE8\u518C {name} \u6210\u529F",
|
|
199
199
|
failed: "\u6CE8\u518C {name} \u5931\u8D25"
|
|
200
|
-
}
|
|
200
|
+
},
|
|
201
|
+
arcSphereToast: "\u652F\u4ED8\u5E76\u5B89\u88C5\u6210\u529F\uFF0C\u4E09\u79D2\u540E\u8FD4\u56DE\u9875\u9762\u7EE7\u7EED..."
|
|
201
202
|
},
|
|
202
203
|
confirm: {
|
|
203
204
|
withStake: "\u786E\u8BA4\u8BA2\u9605\uFF0C\u5373\u8868\u793A\u60A8\u6388\u6743 {payee} \u4ECE\u60A8\u7684\u8D26\u6237\u6263\u53D6\u672A\u6765\u6B3E\u9879\uFF0C\u5E76\u5728\u5FC5\u8981\u65F6\u7F5A\u6CA1\u8D28\u62BC\u3002\u60A8\u53EF\u968F\u65F6\u53D6\u6D88\u8BA2\u9605\u6216\u64A4\u9500\u8D28\u62BC\u3002",
|
package/es/payment/success.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import bridge from "@arcblock/bridge";
|
|
3
|
+
import useArcblockBrowser from "@arcblock/react-hooks/lib/useBrowser";
|
|
2
4
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
3
5
|
import { Box, Grow, Link, Paper, Stack, styled, Typography } from "@mui/material";
|
|
4
6
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -24,6 +26,8 @@ export default function PaymentSuccess({
|
|
|
24
26
|
const [isAllCompleted, setIsAllCompleted] = useState(false);
|
|
25
27
|
const [hasFailed, setHasFailed] = useState(false);
|
|
26
28
|
const timerRef = useRef(Date.now());
|
|
29
|
+
const browser = useArcblockBrowser();
|
|
30
|
+
const inArcsphere = browser?.arcSphere;
|
|
27
31
|
let next = null;
|
|
28
32
|
useEffect(() => {
|
|
29
33
|
if (vendorCount === 0 || !sessionId) return void 0;
|
|
@@ -51,6 +55,19 @@ export default function PaymentSuccess({
|
|
|
51
55
|
}, 5e3);
|
|
52
56
|
return () => clearInterval(interval);
|
|
53
57
|
}, [vendorCount, api, prefix, sessionId]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (inArcsphere && isAllCompleted) {
|
|
60
|
+
try {
|
|
61
|
+
bridge?.call?.("arc__toast", { text: t("payment.checkout.vendor.arcSphereToast") });
|
|
62
|
+
const timer = setTimeout(() => {
|
|
63
|
+
bridge?.call?.("arcClosePage");
|
|
64
|
+
}, 3e3);
|
|
65
|
+
return () => clearTimeout(timer);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return void 0;
|
|
70
|
+
}, [isAllCompleted, t, locale, inArcsphere]);
|
|
54
71
|
const renderPlaceholders = () => {
|
|
55
72
|
const placeholders = [];
|
|
56
73
|
for (let i = 0; i < vendorCount; i++) {
|
package/lib/locales/en.js
CHANGED
|
@@ -204,7 +204,8 @@ module.exports = (0, _flat.default)({
|
|
|
204
204
|
processing: "Domain ({name}) registering",
|
|
205
205
|
completed: "Domain ({name}) registered successfully",
|
|
206
206
|
failed: "Domain ({name}) registered failed"
|
|
207
|
-
}
|
|
207
|
+
},
|
|
208
|
+
arcSphereToast: "Successfully installed, three seconds to return to the page continue..."
|
|
208
209
|
},
|
|
209
210
|
confirm: {
|
|
210
211
|
withStake: "By confirming, you allow {payee} to charge your account for future payments and, if necessary, slash your stake. You can cancel your subscription or withdraw your stake at any time.",
|
package/lib/locales/zh.js
CHANGED
|
@@ -204,7 +204,8 @@ module.exports = (0, _flat.default)({
|
|
|
204
204
|
processing: "\u6B63\u5728\u6CE8\u518C {name}",
|
|
205
205
|
completed: "\u6CE8\u518C {name} \u6210\u529F",
|
|
206
206
|
failed: "\u6CE8\u518C {name} \u5931\u8D25"
|
|
207
|
-
}
|
|
207
|
+
},
|
|
208
|
+
arcSphereToast: "\u652F\u4ED8\u5E76\u5B89\u88C5\u6210\u529F\uFF0C\u4E09\u79D2\u540E\u8FD4\u56DE\u9875\u9762\u7EE7\u7EED..."
|
|
208
209
|
},
|
|
209
210
|
confirm: {
|
|
210
211
|
withStake: "\u786E\u8BA4\u8BA2\u9605\uFF0C\u5373\u8868\u793A\u60A8\u6388\u6743 {payee} \u4ECE\u60A8\u7684\u8D26\u6237\u6263\u53D6\u672A\u6765\u6B3E\u9879\uFF0C\u5E76\u5728\u5FC5\u8981\u65F6\u7F5A\u6CA1\u8D28\u62BC\u3002\u60A8\u53EF\u968F\u65F6\u53D6\u6D88\u8BA2\u9605\u6216\u64A4\u9500\u8D28\u62BC\u3002",
|
package/lib/payment/success.js
CHANGED
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
module.exports = PaymentSuccess;
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _bridge = _interopRequireDefault(require("@arcblock/bridge"));
|
|
9
|
+
var _useBrowser = _interopRequireDefault(require("@arcblock/react-hooks/lib/useBrowser"));
|
|
8
10
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
9
11
|
var _material = require("@mui/material");
|
|
10
12
|
var _react = require("react");
|
|
@@ -12,6 +14,7 @@ var _ufo = require("ufo");
|
|
|
12
14
|
var _ux = require("@arcblock/ux");
|
|
13
15
|
var _payment = require("../contexts/payment");
|
|
14
16
|
var _progressItem = require("./progress-item");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
18
|
function PaymentSuccess({
|
|
16
19
|
mode,
|
|
17
20
|
pageInfo = {},
|
|
@@ -36,6 +39,8 @@ function PaymentSuccess({
|
|
|
36
39
|
const [isAllCompleted, setIsAllCompleted] = (0, _react.useState)(false);
|
|
37
40
|
const [hasFailed, setHasFailed] = (0, _react.useState)(false);
|
|
38
41
|
const timerRef = (0, _react.useRef)(Date.now());
|
|
42
|
+
const browser = (0, _useBrowser.default)();
|
|
43
|
+
const inArcsphere = browser?.arcSphere;
|
|
39
44
|
let next = null;
|
|
40
45
|
(0, _react.useEffect)(() => {
|
|
41
46
|
if (vendorCount === 0 || !sessionId) return void 0;
|
|
@@ -61,6 +66,20 @@ function PaymentSuccess({
|
|
|
61
66
|
}, 5e3);
|
|
62
67
|
return () => clearInterval(interval);
|
|
63
68
|
}, [vendorCount, api, prefix, sessionId]);
|
|
69
|
+
(0, _react.useEffect)(() => {
|
|
70
|
+
if (inArcsphere && isAllCompleted) {
|
|
71
|
+
try {
|
|
72
|
+
_bridge.default?.call?.("arc__toast", {
|
|
73
|
+
text: t("payment.checkout.vendor.arcSphereToast")
|
|
74
|
+
});
|
|
75
|
+
const timer = setTimeout(() => {
|
|
76
|
+
_bridge.default?.call?.("arcClosePage");
|
|
77
|
+
}, 3e3);
|
|
78
|
+
return () => clearTimeout(timer);
|
|
79
|
+
} catch (error) {}
|
|
80
|
+
}
|
|
81
|
+
return void 0;
|
|
82
|
+
}, [isAllCompleted, t, locale, inArcsphere]);
|
|
64
83
|
const renderPlaceholders = () => {
|
|
65
84
|
const placeholders = [];
|
|
66
85
|
for (let i = 0; i < vendorCount; i++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/payment-react",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.11",
|
|
4
4
|
"description": "Reusable react components for payment kit v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -54,7 +54,9 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
+
"@arcblock/bridge": "^3.2.2",
|
|
57
58
|
"@arcblock/did-connect-react": "^3.2.1",
|
|
59
|
+
"@arcblock/react-hooks": "^3.2.1",
|
|
58
60
|
"@arcblock/ux": "^3.2.1",
|
|
59
61
|
"@arcblock/ws": "^1.27.3",
|
|
60
62
|
"@blocklet/theme": "^3.2.1",
|
|
@@ -94,7 +96,7 @@
|
|
|
94
96
|
"@babel/core": "^7.27.4",
|
|
95
97
|
"@babel/preset-env": "^7.27.2",
|
|
96
98
|
"@babel/preset-react": "^7.27.1",
|
|
97
|
-
"@blocklet/payment-types": "1.22.
|
|
99
|
+
"@blocklet/payment-types": "1.22.11",
|
|
98
100
|
"@storybook/addon-essentials": "^7.6.20",
|
|
99
101
|
"@storybook/addon-interactions": "^7.6.20",
|
|
100
102
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -125,5 +127,5 @@
|
|
|
125
127
|
"vite-plugin-babel": "^1.3.1",
|
|
126
128
|
"vite-plugin-node-polyfills": "^0.23.0"
|
|
127
129
|
},
|
|
128
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "d90e964e8aba2c288fe2960365df20f4159a56a1"
|
|
129
131
|
}
|
package/src/locales/en.tsx
CHANGED
|
@@ -202,6 +202,7 @@ export default flat({
|
|
|
202
202
|
completed: 'Domain ({name}) registered successfully',
|
|
203
203
|
failed: 'Domain ({name}) registered failed',
|
|
204
204
|
},
|
|
205
|
+
arcSphereToast: 'Successfully installed, three seconds to return to the page continue...',
|
|
205
206
|
},
|
|
206
207
|
confirm: {
|
|
207
208
|
withStake:
|
package/src/locales/zh.tsx
CHANGED
package/src/payment/success.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import bridge from '@arcblock/bridge';
|
|
2
|
+
import useArcblockBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
|
1
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
4
|
import { Box, Grow, Link, Paper, Stack, styled, Typography } from '@mui/material';
|
|
3
5
|
import { useEffect, useRef, useState } from 'react';
|
|
@@ -57,6 +59,9 @@ export default function PaymentSuccess({
|
|
|
57
59
|
const [isAllCompleted, setIsAllCompleted] = useState(false);
|
|
58
60
|
const [hasFailed, setHasFailed] = useState(false);
|
|
59
61
|
const timerRef = useRef(Date.now());
|
|
62
|
+
const browser = useArcblockBrowser();
|
|
63
|
+
const inArcsphere = browser?.arcSphere;
|
|
64
|
+
|
|
60
65
|
let next: any = null;
|
|
61
66
|
|
|
62
67
|
// Fetch vendor status when vendorCount > 0
|
|
@@ -94,6 +99,21 @@ export default function PaymentSuccess({
|
|
|
94
99
|
return () => clearInterval(interval);
|
|
95
100
|
}, [vendorCount, api, prefix, sessionId]);
|
|
96
101
|
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (inArcsphere && isAllCompleted) {
|
|
104
|
+
try {
|
|
105
|
+
bridge?.call?.('arc__toast', { text: t('payment.checkout.vendor.arcSphereToast') });
|
|
106
|
+
const timer = setTimeout(() => {
|
|
107
|
+
bridge?.call?.('arcClosePage');
|
|
108
|
+
}, 3000);
|
|
109
|
+
return () => clearTimeout(timer);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
//
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
115
|
+
}, [isAllCompleted, t, locale, inArcsphere]);
|
|
116
|
+
|
|
97
117
|
const renderPlaceholders = () => {
|
|
98
118
|
const placeholders = [];
|
|
99
119
|
for (let i = 0; i < vendorCount; i++) {
|
|
@@ -101,7 +121,6 @@ export default function PaymentSuccess({
|
|
|
101
121
|
}
|
|
102
122
|
return placeholders;
|
|
103
123
|
};
|
|
104
|
-
|
|
105
124
|
const renderVendors = () => {
|
|
106
125
|
if (!vendorStatus) return renderPlaceholders();
|
|
107
126
|
return vendorStatus.vendors?.map((vendor, index) => {
|