tek-wallet 0.0.674 → 0.0.675
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/dist/components/TekWallet/components/ui/ChangePasscode/index.js +3 -1
- package/dist/components/TekWallet/components/ui/ConfirmByPasscode/index.js +18 -12
- package/dist/components/TekWallet/components/ui/RequireConnect/index.js +2 -2
- package/dist/components/TekWallet/components/views/ChangePasscodeView/index.js +1 -1
- package/dist/components/TekWallet/hooks/useUniqueId.js +1 -1
- package/dist/components/TekWallet/providers/WalletDataProviderNoImport/index.js +0 -1
- package/package.json +2 -2
- package/dist/components/TekWallet/components/ui/InitPasscode/index.d.ts +0 -6
- package/dist/components/TekWallet/components/ui/InitPasscode/index.js +0 -61
|
@@ -67,6 +67,7 @@ var RequireConnect_1 = __importDefault(require("../RequireConnect"));
|
|
|
67
67
|
var material_1 = require("@mui/material");
|
|
68
68
|
var ChangePasscodeView_1 = __importDefault(require("../../views/ChangePasscodeView"));
|
|
69
69
|
var xhub_keyboard_1 = require("xhub-keyboard");
|
|
70
|
+
var useUniqueId_1 = require("../../../hooks/useUniqueId");
|
|
70
71
|
function ChangePasscode(_a) {
|
|
71
72
|
var children = _a.children, rest = __rest(_a, ["children"]);
|
|
72
73
|
var getSeedPhraseViewRef = (0, react_1.useRef)(null);
|
|
@@ -80,6 +81,7 @@ function ChangePasscode(_a) {
|
|
|
80
81
|
setResetTrigger(function (prev) { return prev + "1"; });
|
|
81
82
|
}, 400);
|
|
82
83
|
};
|
|
83
|
-
|
|
84
|
+
var keyboardPrefix = (0, useUniqueId_1.useUniqueId)();
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { onClose: onClose, ref: getSeedPhraseViewRef, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { autoFocus: true, useBrowserInput: false, htmlFor: "".concat(keyboardPrefix, "-change-passcode-keyboard"), children: (0, jsx_runtime_1.jsxs)(material_1.Box, __assign({}, rest, { sx: { position: "relative" }, children: [children, (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { position: "absolute", inset: 0, zIndex: 10 } })] })) }), children: (0, jsx_runtime_1.jsx)(ChangePasscodeView_1.default, { onBack: backAuthView, idPrefix: keyboardPrefix }, resetTrigger) }) }));
|
|
84
86
|
}
|
|
85
87
|
exports.default = ChangePasscode;
|
|
@@ -96,6 +96,7 @@ var DrawerComponent_1 = __importDefault(require("../DrawerComponent"));
|
|
|
96
96
|
var authentication_by_passcode_service_1 = __importDefault(require("../../../services/axios/authentication-by-passcode-service"));
|
|
97
97
|
var xhub_keyboard_1 = require("xhub-keyboard");
|
|
98
98
|
var useUniqueId_1 = require("../../../hooks/useUniqueId");
|
|
99
|
+
var xhub_keyboard_2 = require("xhub-keyboard");
|
|
99
100
|
var handleVerifyPasscode = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
101
|
var response, err_1;
|
|
101
102
|
return __generator(this, function (_a) {
|
|
@@ -118,21 +119,23 @@ var passcodeLength = 6;
|
|
|
118
119
|
var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
|
|
119
120
|
var onConfirmSuccess = props.onConfirmSuccess;
|
|
120
121
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
121
|
-
var _a = (0, react_1.useState)(""),
|
|
122
|
+
var _a = (0, react_1.useState)(""), passcode = _a[0], setPasscode = _a[1];
|
|
122
123
|
var loadingRef = (0, react_1.useRef)(null);
|
|
123
124
|
var _b = (0, react_1.useState)(""), authError = _b[0], setAuthError = _b[1];
|
|
124
125
|
var keyboardId = (0, useUniqueId_1.useUniqueId)("confirm-passcode-keyboard");
|
|
126
|
+
var keyboardRef = (0, react_1.useRef)(null);
|
|
125
127
|
var drawerRef = (0, react_1.useRef)(null);
|
|
128
|
+
var handleBlurAll = (0, xhub_keyboard_2.useBlurAll)().handleBlurAll;
|
|
126
129
|
var handleCleardata = function () {
|
|
127
|
-
|
|
130
|
+
setPasscode("");
|
|
128
131
|
setAuthError("");
|
|
129
132
|
};
|
|
130
|
-
var handleClose = function () {
|
|
133
|
+
var handleClose = (0, react_1.useCallback)(function () {
|
|
131
134
|
var _a, _b;
|
|
135
|
+
handleBlurAll();
|
|
132
136
|
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
133
|
-
handleCleardata();
|
|
134
137
|
(_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
135
|
-
};
|
|
138
|
+
}, [handleBlurAll, props]);
|
|
136
139
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
137
140
|
clearData: handleCleardata,
|
|
138
141
|
open: function () {
|
|
@@ -159,19 +162,22 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
159
162
|
var handleOnOpen = function () {
|
|
160
163
|
var _a;
|
|
161
164
|
(_a = props.onOpen) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
165
|
+
handleCleardata();
|
|
162
166
|
};
|
|
163
|
-
var handlePasscodeChange = function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
167
|
+
var handlePasscodeChange = (0, react_1.useCallback)(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
164
168
|
var isAuth, err_2;
|
|
165
169
|
var _a, _b;
|
|
166
170
|
return __generator(this, function (_c) {
|
|
167
171
|
switch (_c.label) {
|
|
168
172
|
case 0:
|
|
173
|
+
if (value.length > passcodeLength)
|
|
174
|
+
return [2 /*return*/];
|
|
169
175
|
value = value === null || value === void 0 ? void 0 : value.slice(0, passcodeLength);
|
|
170
176
|
_c.label = 1;
|
|
171
177
|
case 1:
|
|
172
178
|
_c.trys.push([1, 4, , 5]);
|
|
173
|
-
|
|
174
|
-
if (!(value.length === passcodeLength)) return [3 /*break*/, 3];
|
|
179
|
+
setPasscode(value);
|
|
180
|
+
if (!(value.length === passcodeLength && value !== passcode)) return [3 /*break*/, 3];
|
|
175
181
|
(_a = loadingRef.current) === null || _a === void 0 ? void 0 : _a.startLoading();
|
|
176
182
|
return [4 /*yield*/, handleVerifyPasscode({
|
|
177
183
|
passcode: value,
|
|
@@ -184,7 +190,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
184
190
|
}
|
|
185
191
|
else {
|
|
186
192
|
setAuthError("Invalid passcode");
|
|
187
|
-
|
|
193
|
+
setPasscode("");
|
|
188
194
|
}
|
|
189
195
|
(_b = loadingRef.current) === null || _b === void 0 ? void 0 : _b.endLoading();
|
|
190
196
|
_c.label = 3;
|
|
@@ -196,21 +202,21 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
196
202
|
case 5: return [2 /*return*/];
|
|
197
203
|
}
|
|
198
204
|
});
|
|
199
|
-
}); };
|
|
205
|
+
}); }, [handleClose, onConfirmSuccess]);
|
|
200
206
|
return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { style: {
|
|
201
207
|
width: "100%",
|
|
202
208
|
}, useBrowserInput: false, htmlFor: keyboardId, children: props.children }), onOpen: handleOnOpen, onClose: handleOnClose, sx: {
|
|
203
209
|
width: "100%",
|
|
204
210
|
maxWidth: "calc(100dvw - 2rem)",
|
|
205
211
|
display: "flex",
|
|
206
|
-
}, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { id: keyboardId, value:
|
|
212
|
+
}, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { ref: keyboardRef, id: keyboardId, value: passcode, onChange: handlePasscodeChange, keyboardType: xhub_keyboard_1.KeyboardType.Text, layoutType: xhub_keyboard_1.LayoutType.Integer, children: (0, jsx_runtime_1.jsx)(LoadingLayout_1.default, { initLoading: false, ref: loadingRef, sx: {
|
|
207
213
|
backgroundColor: "transparent",
|
|
208
214
|
width: "100%",
|
|
209
215
|
}, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "Enter Passcode", onClose: handleClose, sx: {
|
|
210
216
|
backgroundColor: theme.palette.background.tertiary,
|
|
211
217
|
}, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { justifyContent: "center", alignItems: "center", gap: "0.75rem", width: "100%" }), children: [(0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { style: {
|
|
212
218
|
width: "100%",
|
|
213
|
-
}, useBrowserInput: false, htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(OTP_1.default, { value:
|
|
219
|
+
}, useBrowserInput: false, htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(OTP_1.default, { value: passcode, onChange: handlePasscodeChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.CONFIRM_BY_PASSCODE }) }), !!authError && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { alignSelf: "flex-start" }), children: authError }))] }) }) }) }) }));
|
|
214
220
|
});
|
|
215
221
|
ConfirmByPasscode.displayName = "ConfirmByPasscode";
|
|
216
222
|
exports.default = ConfirmByPasscode;
|
|
@@ -63,7 +63,7 @@ function RequireConnect(_a) {
|
|
|
63
63
|
var children = _a.children, signIn = _a.signIn, component = _a.component, sx = _a.sx;
|
|
64
64
|
var authViewRef = (0, react_1.useRef)(null);
|
|
65
65
|
var initPasscodeRef = (0, react_1.useRef)(null);
|
|
66
|
-
var _b = (0, useWalletData_1.default)(), isInitPasscode = _b.isInitPasscode, isSSO = _b.isSSO, isAuthenticated = _b.isAuthenticated;
|
|
66
|
+
var _b = (0, useWalletData_1.default)(), isInitPasscode = _b.isInitPasscode, isSSO = _b.isSSO, isAuthenticated = _b.isAuthenticated, masterWallet = _b.masterWallet;
|
|
67
67
|
var idPrefix = (0, useUniqueId_1.useUniqueId)();
|
|
68
68
|
var backAuthView = function () {
|
|
69
69
|
var _a;
|
|
@@ -85,7 +85,7 @@ function RequireConnect(_a) {
|
|
|
85
85
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ position: "relative" }, sx), component: component || "div", children: [children, (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { position: "absolute", inset: 0, zIndex: 10 }, onClick: handleOpenAuthView, children: (0, jsx_runtime_1.jsxs)(DrawerComponent_1.default, { ref: authViewRef, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, onClick: stopPropagation, children: [isSSO && (0, jsx_runtime_1.jsx)(AuthViewSignIn_1.default, { onBack: backAuthView, onSignIn: signIn }), !isSSO && (0, jsx_runtime_1.jsx)(AuthView_1.default, { onBack: backAuthView })] }) })] }) }));
|
|
86
86
|
}
|
|
87
87
|
if (!isInitPasscode) {
|
|
88
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ position: "relative" }, sx), component: component || "div", onClick: function () {
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ position: "relative", pointerEvents: masterWallet ? "initial" : "none" }, sx), component: component || "div", onClick: function () {
|
|
89
89
|
var _a;
|
|
90
90
|
(_a = initPasscodeRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
91
91
|
}, children: [children, (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { autoFocus: true, useBrowserInput: false, htmlFor: "".concat(idPrefix, "-init-passcode-keyboard"), style: {
|
|
@@ -318,7 +318,7 @@ var ChangePasscodeView = function (props) {
|
|
|
318
318
|
alignItems: "center",
|
|
319
319
|
height: "100%",
|
|
320
320
|
gap: "1rem",
|
|
321
|
-
}, children: [
|
|
321
|
+
}, children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionTitle), children: stepsContent[type_1.ChangePasscodeViewStep.ENTER_NEW_PASSCODE].title }), (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { useBrowserInput: false, htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(OTP_1.default, { value: newPasscode, onChange: handleNewPasscodeChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.PASSWORD, readOnly: true }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionDescription), children: stepsContent[type_1.ChangePasscodeViewStep.ENTER_NEW_PASSCODE].description })] }) }), (0, jsx_runtime_1.jsx)(react_1.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
322
322
|
display: "flex",
|
|
323
323
|
flexDirection: "column",
|
|
324
324
|
alignItems: "center",
|
|
@@ -5,6 +5,6 @@ var react_1 = require("react");
|
|
|
5
5
|
var uuid_1 = require("uuid");
|
|
6
6
|
var useUniqueId = function (name) {
|
|
7
7
|
var id = (0, react_1.useRef)((0, uuid_1.v4)());
|
|
8
|
-
return
|
|
8
|
+
return "id-".concat(id.current, "-").concat(name || "");
|
|
9
9
|
};
|
|
10
10
|
exports.useUniqueId = useUniqueId;
|
|
@@ -130,7 +130,6 @@ function WalletDataProviderNoImport(_a) {
|
|
|
130
130
|
return [4 /*yield*/, (0, getBalanceService_1.default)()];
|
|
131
131
|
case 1:
|
|
132
132
|
response = _a.sent();
|
|
133
|
-
console.warn("🚀 ~ updateWalletDetail ~ response:", response);
|
|
134
133
|
setTokens(response === null || response === void 0 ? void 0 : response.balances);
|
|
135
134
|
setIsInitPasscode(response === null || response === void 0 ? void 0 : response.is_initialized_passcode);
|
|
136
135
|
setMasterWallet(response === null || response === void 0 ? void 0 : response.address);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tek-wallet",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.675",
|
|
4
4
|
"description": "A custom React provider with TypeScript support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"ton-core": "^0.53.0",
|
|
62
62
|
"ton-crypto": "^3.2.0",
|
|
63
63
|
"uuid": "^11.1.0",
|
|
64
|
-
"xhub-keyboard": "^0.0.
|
|
64
|
+
"xhub-keyboard": "^0.0.22"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { GeneralProps } from "../../../types/ui";
|
|
2
|
-
export interface InitPasscodeProps extends GeneralProps {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
export declare function InitPasscode({ children }: InitPasscodeProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export default InitPasscode;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.InitPasscode = InitPasscode;
|
|
41
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
|
-
var DrawerComponent_1 = __importStar(require("../DrawerComponent"));
|
|
43
|
-
var react_1 = require("react");
|
|
44
|
-
var ChangePasscodeView_1 = __importDefault(require("../../views/ChangePasscodeView"));
|
|
45
|
-
var xhub_keyboard_1 = require("xhub-keyboard");
|
|
46
|
-
function InitPasscode(_a) {
|
|
47
|
-
var children = _a.children;
|
|
48
|
-
var getSeedPhraseViewRef = (0, react_1.useRef)(null);
|
|
49
|
-
var backAuthView = function () {
|
|
50
|
-
var _a;
|
|
51
|
-
(_a = getSeedPhraseViewRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
52
|
-
};
|
|
53
|
-
var _b = (0, react_1.useState)("1"), resetTrigger = _b[0], setResetTrigger = _b[1];
|
|
54
|
-
var onClose = function () {
|
|
55
|
-
setTimeout(function () {
|
|
56
|
-
setResetTrigger(function (prev) { return prev + "1"; });
|
|
57
|
-
}, 400);
|
|
58
|
-
};
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { onClose: onClose, ref: getSeedPhraseViewRef, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { autoFocus: true, useBrowserInput: false, htmlFor: "init-passcode-keyboard", style: { width: "100%", height: "100%" }, children: children }), children: (0, jsx_runtime_1.jsx)(ChangePasscodeView_1.default, { onBack: backAuthView, isInitPasscode: true }, resetTrigger) }));
|
|
60
|
-
}
|
|
61
|
-
exports.default = InitPasscode;
|