tek-wallet 0.0.169 → 0.0.170

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.
@@ -99,10 +99,11 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
99
99
  var _a = (0, react_1.useState)(""), otp = _a[0], setOtp = _a[1];
100
100
  var loadingRef = (0, react_1.useRef)(null);
101
101
  var drawerRef = (0, react_1.useRef)(null);
102
+ var handleCleardata = function () {
103
+ setOtp("");
104
+ };
102
105
  (0, react_1.useImperativeHandle)(ref, function () { return ({
103
- clearData: function () {
104
- setOtp("");
105
- },
106
+ clearData: handleCleardata,
106
107
  open: function () {
107
108
  var _a;
108
109
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
@@ -120,6 +121,15 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
120
121
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.unlockStatus();
121
122
  },
122
123
  }); });
124
+ var handleOnClose = function () {
125
+ var _a;
126
+ (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
127
+ handleCleardata();
128
+ };
129
+ var handleOnOpen = function () {
130
+ var _a;
131
+ (_a = props.onOpen) === null || _a === void 0 ? void 0 : _a.call(props);
132
+ };
123
133
  var handleOtpChange = function (value) { return __awaiter(void 0, void 0, void 0, function () {
124
134
  var err_1;
125
135
  var _a, _b, _c, _d, _e;
@@ -148,7 +158,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
148
158
  }
149
159
  });
150
160
  }); };
151
- return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: props.onClose, children: (0, jsx_runtime_1.jsx)(LoadingLayout_1.default, { initLoading: false, ref: loadingRef, sx: { width: "100%" }, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "Authentication", 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)("form", { autoComplete: "off", children: (0, jsx_runtime_1.jsx)(OTP_1.default, { value: otp, onChange: handleOtpChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.PASSWORD }) })] }) }) }) }));
161
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: handleOnOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(LoadingLayout_1.default, { initLoading: false, ref: loadingRef, sx: { width: "100%" }, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "Authentication", 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)(OTP_1.default, { value: otp, onChange: handleOtpChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.PASSWORD })] }) }) }) }));
152
162
  });
153
163
  ConfirmByPasscode.displayName = "ConfirmByPasscode";
154
164
  exports.default = ConfirmByPasscode;
@@ -11,6 +11,17 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
+ var __rest = (this && this.__rest) || function (s, e) {
15
+ var t = {};
16
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17
+ t[p] = s[p];
18
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
19
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
20
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
21
+ t[p[i]] = s[p[i]];
22
+ }
23
+ return t;
24
+ };
14
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
15
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
16
27
  };
@@ -24,8 +35,32 @@ var ModalLayout_1 = __importDefault(require("../ModalLayout"));
24
35
  var DrawerComponent_1 = __importDefault(require("../DrawerComponent"));
25
36
  var react_1 = require("react");
26
37
  var ConfirmLayout = (0, react_1.forwardRef)(function (props, ref) {
38
+ var children = props.children, rest = __rest(props, ["children"]);
27
39
  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), { 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] }) }) }));
40
+ var confirmByPasscodeDrawerRef = (0, react_1.useRef)(null);
41
+ var handleOnClose = function () {
42
+ var _a;
43
+ (_a = confirmByPasscodeDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
44
+ };
45
+ (0, react_1.useImperativeHandle)(ref, function () { return ({
46
+ open: function () {
47
+ var _a;
48
+ (_a = confirmByPasscodeDrawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
49
+ },
50
+ close: function () {
51
+ var _a;
52
+ (_a = confirmByPasscodeDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
53
+ },
54
+ lockStatus: function () {
55
+ var _a;
56
+ (_a = confirmByPasscodeDrawerRef.current) === null || _a === void 0 ? void 0 : _a.lockStatus();
57
+ },
58
+ unlockStatus: function () {
59
+ var _a;
60
+ (_a = confirmByPasscodeDrawerRef.current) === null || _a === void 0 ? void 0 : _a.unlockStatus();
61
+ },
62
+ }); });
63
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, __assign({ ref: confirmByPasscodeDrawerRef }, rest, { children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { onClose: handleOnClose, 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 })] }), children] }) }) })));
29
64
  });
30
65
  ConfirmLayout.displayName = "ConfirmLayout";
31
66
  exports.default = ConfirmLayout;
@@ -32,6 +32,6 @@ var LockToken = function (props) {
32
32
  (_a = confirmByPasscodeDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
33
33
  console.warn("🚀 ~ handleLockToken ~ lockData:", props.lockData, passcode);
34
34
  };
35
- 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)(ConfirmByPasscode_1.default, { action: type_1.ActionConfirm.LOCK, onConfirmSuccess: handleLockToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
35
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { ref: confirmByPasscodeDrawerRef, 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)(ConfirmByPasscode_1.default, { action: type_1.ActionConfirm.LOCK, onConfirmSuccess: handleLockToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
36
36
  };
37
37
  exports.default = LockToken;
@@ -21,7 +21,7 @@ var material_1 = require("@mui/material");
21
21
  var getImage_1 = __importDefault(require("../../../utils/getImage"));
22
22
  var ModalLayout = function (props) {
23
23
  var theme = (0, material_1.useTheme)();
24
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ borderTop: "2px ".concat(theme.palette.secondary.main, " solid"), borderRadius: "1.5rem 1.5rem 0 0", maxHeight: "100dvh", backgroundImage: "url(".concat((0, getImage_1.default)("modal-bg", "jpg"), ")"), backgroundSize: "cover", backgroundPosition: "top", backgroundRepeat: "no-repeat", display: "flex", flexDirection: "column" }, theme.mixins.pagePadding), props.sx), children: [!props.hideHeader && !props.overrideHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
24
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({ borderTop: "2px ".concat(theme.palette.secondary.main, " solid"), borderRadius: "1.5rem 1.5rem 0 0", maxHeight: "100dvh", backgroundImage: "url(".concat((0, getImage_1.default)("modal-bg", "jpg"), ")"), backgroundSize: "cover", backgroundPosition: "top", backgroundRepeat: "no-repeat", display: "flex", flexDirection: "column" }, theme.mixins.pagePadding), { paddingTop: theme.mixins.customPadding.p24 }), props.sx), children: [!props.hideHeader && !props.overrideHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
25
25
  width: "100%",
26
26
  position: "relative",
27
27
  }, children: [(0, jsx_runtime_1.jsx)(ModalTitle_1.default, { children: props.title }), (0, jsx_runtime_1.jsx)(CloseModal_1.default, { sx: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.169",
3
+ "version": "0.0.170",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",