tek-wallet 0.0.582 → 0.0.584
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.
|
@@ -191,7 +191,7 @@ var LockToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
191
191
|
(0, react_1.useEffect)(function () {
|
|
192
192
|
validateAmount(props.lockData);
|
|
193
193
|
}, [validateAmount]);
|
|
194
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.TransactionSlug.LockedBalances, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: props.lockData.amount, unit: token === null || token === void 0 ? void 0 : token.name }) }) }), (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: ["Your balance is", " ", (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
194
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.TransactionSlug.LockedBalances, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: props.lockData.amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: ["Your balance is", " ", (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
195
195
|
fontWeight: theme.typography.fontWeight600,
|
|
196
196
|
color: theme.palette.text.secondary,
|
|
197
197
|
}, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: token === null || token === void 0 ? void 0 : token.balance, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) })] }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.gaps.g6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] })), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.TransactionSlug.LockedBalances, onConfirmSuccess: handleLockToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
|
|
@@ -7,9 +7,12 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
var DrawerComponent_1 = __importDefault(require("../DrawerComponent"));
|
|
8
8
|
var react_1 = require("react");
|
|
9
9
|
var react_qr_scanner_1 = require("@yudiel/react-qr-scanner");
|
|
10
|
+
var AppBackDrop_1 = __importDefault(require("../AppBackDrop"));
|
|
10
11
|
var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
|
|
12
|
+
var qrReaderContainer = (0, react_1.useRef)(null);
|
|
11
13
|
var drawerRef = (0, react_1.useRef)(null);
|
|
12
14
|
var _a = (0, react_1.useState)(false), isOpen = _a[0], setIsOpen = _a[1];
|
|
15
|
+
var _b = (0, react_1.useState)(false), isReaderReady = _b[0], setIsReaderReady = _b[1];
|
|
13
16
|
var open = function () {
|
|
14
17
|
var _a;
|
|
15
18
|
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
@@ -25,77 +28,90 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
25
28
|
};
|
|
26
29
|
var onClose = function () {
|
|
27
30
|
setIsOpen(false);
|
|
31
|
+
setIsReaderReady(false);
|
|
28
32
|
};
|
|
29
33
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
30
34
|
open: open,
|
|
31
35
|
close: close,
|
|
32
36
|
}); });
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
37
|
+
var handleCanPlay = function () {
|
|
38
|
+
console.warn("can play");
|
|
39
|
+
setIsReaderReady(true);
|
|
40
|
+
};
|
|
41
|
+
(0, react_1.useEffect)(function () {
|
|
42
|
+
var _a;
|
|
43
|
+
var video = (_a = qrReaderContainer.current) === null || _a === void 0 ? void 0 : _a.querySelector("video");
|
|
44
|
+
video === null || video === void 0 ? void 0 : video.addEventListener("canplay", handleCanPlay);
|
|
45
|
+
return function () {
|
|
46
|
+
video === null || video === void 0 ? void 0 : video.removeEventListener("canplay", handleCanPlay);
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { trigger: props.children, ref: drawerRef, onClose: onClose, onOpen: onOpen, children: (0, jsx_runtime_1.jsx)("div", { ref: qrReaderContainer, children: isOpen && ((0, jsx_runtime_1.jsxs)(react_qr_scanner_1.Scanner, { components: {
|
|
50
|
+
audio: false,
|
|
51
|
+
finder: false,
|
|
52
|
+
}, styles: {
|
|
53
|
+
container: {
|
|
54
|
+
width: "100%",
|
|
55
|
+
height: "100dvh",
|
|
56
|
+
position: "relative",
|
|
57
|
+
},
|
|
58
|
+
video: {
|
|
59
|
+
width: "100%",
|
|
60
|
+
height: "100%",
|
|
61
|
+
objectFit: "cover",
|
|
62
|
+
},
|
|
63
|
+
}, onScan: props.onResult, children: [!isReaderReady && (0, jsx_runtime_1.jsx)(AppBackDrop_1.default, {}), isReaderReady && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
64
|
+
width: "60%",
|
|
65
|
+
aspectRatio: "1",
|
|
66
|
+
position: "absolute",
|
|
67
|
+
top: "40%",
|
|
68
|
+
left: "50%",
|
|
69
|
+
transform: "translateX(-50%) translateY(-50%)",
|
|
70
|
+
display: "relative",
|
|
71
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
72
|
+
position: "absolute",
|
|
73
|
+
borderTopLeftRadius: "12px",
|
|
74
|
+
top: "0",
|
|
75
|
+
left: "0",
|
|
76
|
+
width: "18%",
|
|
77
|
+
height: "18%",
|
|
78
|
+
borderTop: "3px solid white",
|
|
79
|
+
borderLeft: "3px solid white",
|
|
80
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
81
|
+
position: "absolute",
|
|
82
|
+
borderTopRightRadius: "12px",
|
|
83
|
+
top: "0",
|
|
84
|
+
right: "0",
|
|
85
|
+
width: "18%",
|
|
86
|
+
height: "18%",
|
|
87
|
+
borderTop: "3px solid white",
|
|
88
|
+
borderRight: "3px solid white",
|
|
89
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
90
|
+
position: "absolute",
|
|
91
|
+
borderBottomLeftRadius: "12px",
|
|
92
|
+
bottom: "0",
|
|
93
|
+
left: "0",
|
|
94
|
+
width: "18%",
|
|
95
|
+
height: "18%",
|
|
96
|
+
borderBottom: "3px solid white",
|
|
97
|
+
borderLeft: "3px solid white",
|
|
98
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
99
|
+
position: "absolute",
|
|
100
|
+
borderBottomRightRadius: "12px",
|
|
101
|
+
bottom: "0",
|
|
102
|
+
right: "0",
|
|
103
|
+
width: "18%",
|
|
104
|
+
height: "18%",
|
|
105
|
+
borderBottom: "3px solid white",
|
|
106
|
+
borderRight: "3px solid white",
|
|
107
|
+
} })] }), (0, jsx_runtime_1.jsx)("div", { onClick: close, style: {
|
|
108
|
+
position: "absolute",
|
|
109
|
+
top: "1rem",
|
|
110
|
+
right: "1rem",
|
|
111
|
+
zIndex: 6000,
|
|
112
|
+
cursor: "pointer",
|
|
113
|
+
color: "#fff",
|
|
114
|
+
}, children: "Cancel" })] }))] })) }) }));
|
|
99
115
|
});
|
|
100
116
|
QrCodeReader.displayName = "QrCodeReader";
|
|
101
117
|
exports.default = QrCodeReader;
|
|
@@ -110,7 +110,7 @@ var UpdateLockTokenError;
|
|
|
110
110
|
var UpdateLockToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
111
111
|
var _a;
|
|
112
112
|
var theme = (0, material_1.useTheme)();
|
|
113
|
-
var _b = (0, useLockTokenData_1.default)(), lockedTokens = _b.lockedTokens, lockTokens = _b.lockTokens;
|
|
113
|
+
var _b = (0, useLockTokenData_1.default)(), lockedTokens = _b.lockedTokens, lockTokens = _b.lockTokens, updateLockedToken = _b.updateLockedToken;
|
|
114
114
|
var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
|
|
115
115
|
var confirmLayoutDrawerRef = (0, react_1.useRef)(null);
|
|
116
116
|
var _c = (0, react_1.useState)(undefined), token = _c[0], setToken = _c[1];
|
|
@@ -204,7 +204,12 @@ var UpdateLockToken = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
204
204
|
(0, react_1.useEffect)(function () {
|
|
205
205
|
validateAmount(props.lockData);
|
|
206
206
|
}, [validateAmount]);
|
|
207
|
-
|
|
207
|
+
(0, react_1.useEffect)(function () {
|
|
208
|
+
if (!!lockedTokens || !isAuthenticated)
|
|
209
|
+
return;
|
|
210
|
+
updateLockedToken();
|
|
211
|
+
}, [isAuthenticated, lockedTokens]);
|
|
212
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: action, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: props.lockData.locked_amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: ["Your balance is", " ", (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
208
213
|
fontWeight: theme.typography.fontWeight600,
|
|
209
214
|
color: theme.palette.text.secondary,
|
|
210
215
|
}, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: token === null || token === void 0 ? void 0 : token.balance, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) })] }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.gaps.g6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] })), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: action, onConfirmSuccess: handleLockToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
|