tek-wallet 0.0.160 → 0.0.162
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/ui/ConfirmByPasscode/index.d.ts +1 -0
- package/dist/components/ui/ConfirmByPasscode/index.js +6 -1
- package/dist/components/ui/ConfirmLayout/index.js +1 -1
- package/dist/components/ui/ConfirmLayout/type.d.ts +1 -1
- package/dist/components/ui/ConfirmLayout/type.js +1 -1
- package/dist/components/ui/LoadingLayout/index.js +1 -1
- package/dist/components/ui/LockToken/index.js +9 -1
- package/dist/components/ui/ModalLayout/index.js +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { ActionConfirm } from "../ConfirmLayout/type";
|
|
|
3
3
|
interface ConfirmByPasscodeProps extends GeneralProps {
|
|
4
4
|
onConfirmSuccess?: (value: string) => any;
|
|
5
5
|
action: ActionConfirm;
|
|
6
|
+
onClose?: () => void;
|
|
6
7
|
}
|
|
7
8
|
export interface ConfirmByPasscodeRef {
|
|
8
9
|
clearData: () => void;
|
|
@@ -97,6 +97,11 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
97
97
|
var theme = (0, material_1.useTheme)();
|
|
98
98
|
var _a = (0, react_1.useState)(""), otp = _a[0], setOtp = _a[1];
|
|
99
99
|
var loadingRef = (0, react_1.useRef)(null);
|
|
100
|
+
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
101
|
+
clearData: function () {
|
|
102
|
+
setOtp("");
|
|
103
|
+
},
|
|
104
|
+
}); });
|
|
100
105
|
var handleOtpChange = function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
106
|
var err_1;
|
|
102
107
|
var _a, _b;
|
|
@@ -123,7 +128,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
123
128
|
}
|
|
124
129
|
});
|
|
125
130
|
}); };
|
|
126
|
-
return ((0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "Confirm",
|
|
131
|
+
return ((0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "Confirm", onClose: props.onClose, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { justifyContent: "center", alignItems: "center", gap: "1rem", width: "100%" }), children: [(0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.sessionTitle), children: ["Enter your passcode to confirm", " ", (0, jsx_runtime_1.jsx)(Text_1.default, { sx: { fontWeight: theme.typography.fontWeight600 }, children: action })] }), (0, jsx_runtime_1.jsx)(LoadingLayout_1.default, { initLoading: false, ref: loadingRef, children: (0, jsx_runtime_1.jsx)(OTP_1.default, { value: otp, onChange: handleOtpChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.PASSWORD }) })] }) }));
|
|
127
132
|
});
|
|
128
133
|
ConfirmByPasscode.displayName = "ConfirmByPasscode";
|
|
129
134
|
exports.default = ConfirmByPasscode;
|
|
@@ -25,7 +25,7 @@ var DrawerComponent_1 = __importDefault(require("../DrawerComponent"));
|
|
|
25
25
|
var react_1 = require("react");
|
|
26
26
|
var ConfirmLayout = (0, react_1.forwardRef)(function (props, ref) {
|
|
27
27
|
var theme = (0, material_1.useTheme)();
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: ref, trigger: props.trigger, onOpen: props.onOpen, onClose: props.onClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { alignItems: "center", gap: theme.mixins.gaps.g16 }), 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)(Icon_1.default, { width: 64, sx: {}, src: (0, getIcon_1.default)("wallet_logo") }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionDescription), children: "Confirm action" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionTitle), children: props.action })] }), props.children] }) }) }));
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: ref, trigger: props.trigger, onOpen: props.onOpen, onClose: props.onClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { alignItems: "center", gap: theme.mixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { alignItems: "center", gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 64, sx: {}, src: (0, getIcon_1.default)("wallet_logo") }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionDescription), children: "Confirm action" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.sessionTitle), { textTransform: "capitalize" }), children: props.action })] }), props.children] }) }) }));
|
|
29
29
|
});
|
|
30
30
|
ConfirmLayout.displayName = "ConfirmLayout";
|
|
31
31
|
exports.default = ConfirmLayout;
|
|
@@ -5,5 +5,5 @@ var ActionConfirm;
|
|
|
5
5
|
(function (ActionConfirm) {
|
|
6
6
|
ActionConfirm["WITHDRAW"] = "withdraw";
|
|
7
7
|
ActionConfirm["TRANSFER"] = "transfer";
|
|
8
|
-
ActionConfirm["LOCK"] = "lock";
|
|
8
|
+
ActionConfirm["LOCK"] = "lock token";
|
|
9
9
|
})(ActionConfirm || (exports.ActionConfirm = ActionConfirm = {}));
|
|
@@ -30,7 +30,7 @@ var LoadingLayout = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
30
30
|
setLoading(false);
|
|
31
31
|
},
|
|
32
32
|
}); });
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ position: "relative", width: "100%", height: "fit-content" }, sx), children: [children, loading && ((0, jsx_runtime_1.jsx)(
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ position: "relative", width: "100%", height: "fit-content" }, sx), children: [children, loading && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({ position: "absolute", inset: 0 }, theme.mixins.whiteLoadingOverlay), { zIndex: 1000 }), children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.center), children: loadingMessage }) }))] }));
|
|
34
34
|
});
|
|
35
35
|
LoadingLayout.displayName = "LoadingLayout";
|
|
36
36
|
exports.default = LoadingLayout;
|
|
@@ -27,14 +27,22 @@ var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
|
27
27
|
var react_1 = require("react");
|
|
28
28
|
var LockToken = function (props) {
|
|
29
29
|
var theme = (0, material_1.useTheme)();
|
|
30
|
+
var confirmByPasscodeDrawerRef = (0, react_1.useRef)(null);
|
|
30
31
|
var confirmByPasscodeRef = (0, react_1.useRef)(null);
|
|
31
32
|
var handleClearConfirmData = function () {
|
|
32
33
|
var _a;
|
|
33
34
|
(_a = confirmByPasscodeRef.current) === null || _a === void 0 ? void 0 : _a.clearData();
|
|
34
35
|
};
|
|
36
|
+
var closeAuthModal = function () {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
(_a = confirmByPasscodeDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
39
|
+
(_b = confirmByPasscodeRef.current) === null || _b === void 0 ? void 0 : _b.clearData();
|
|
40
|
+
};
|
|
35
41
|
var handleLockToken = function () {
|
|
42
|
+
var _a;
|
|
43
|
+
(_a = confirmByPasscodeDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
36
44
|
console.warn("🚀 ~ handleLockToken ~ lockData:", props.lockData);
|
|
37
45
|
};
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { action: type_1.ActionConfirm.LOCK, trigger: props.trigger, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16 }), 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: props.lockData.tokenSlug }) }), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { trigger: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" }), onOpen: handleClearConfirmData, children: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { ref: confirmByPasscodeRef, action: type_1.ActionConfirm.LOCK, onConfirmSuccess: handleLockToken }) })] }) }) }));
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { action: type_1.ActionConfirm.LOCK, trigger: props.trigger, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16 }), 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: props.lockData.tokenSlug }) }), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { trigger: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" }), onOpen: handleClearConfirmData, onClose: handleClearConfirmData, children: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { ref: confirmByPasscodeRef, action: type_1.ActionConfirm.LOCK, onConfirmSuccess: handleLockToken, onClose: closeAuthModal }) })] }) }) }));
|
|
39
47
|
};
|
|
40
48
|
exports.default = LockToken;
|
|
@@ -29,6 +29,6 @@ var ModalLayout = function (props) {
|
|
|
29
29
|
right: 0,
|
|
30
30
|
top: "50%",
|
|
31
31
|
transform: "translateY(-50%)",
|
|
32
|
-
}, onClick: props.onClose })] }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { my: "0.75rem" } })] })), props.overrideHeader, (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { flex: 1, overflowY: "auto" }, children: props.children })] }));
|
|
32
|
+
}, onClick: props.onClose })] }), props.title && (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { my: "0.75rem" } })] })), props.overrideHeader, (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { flex: 1, overflowY: "auto" }, children: props.children })] }));
|
|
33
33
|
};
|
|
34
34
|
exports.default = ModalLayout;
|