tek-wallet 0.0.690 → 0.0.692

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.
@@ -1,11 +1,12 @@
1
1
  import { GeneralProps } from "../../../types/ui";
2
- import { DrawerComponentProps, DrawerComponentRef } from "../DrawerComponent";
2
+ import { DRAWER_TRIGGER_STATUS, DrawerComponentProps, DrawerComponentRef } from "../DrawerComponent";
3
3
  import { TransactionSlug } from "../../../services/axios/get-activities-service/type";
4
4
  interface ConfirmByPasscodeProps extends Omit<GeneralProps, "onclick" | "sx" | "onClick">, DrawerComponentProps {
5
5
  onConfirmSuccess?: (passcode: string) => any;
6
6
  action?: TransactionSlug;
7
7
  customAction?: string;
8
8
  backgroundColor?: string;
9
+ triggerStatus?: DRAWER_TRIGGER_STATUS;
9
10
  }
10
11
  export interface ConfirmByPasscodeRef extends Omit<DrawerComponentRef, "trigger"> {
11
12
  clearData: () => void;
@@ -205,7 +205,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
205
205
  }); }, [handleClose, onConfirmSuccess]);
206
206
  return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { style: {
207
207
  width: "100%",
208
- }, useBrowserInput: false, htmlFor: keyboardId, children: props.children }), onOpen: handleOnOpen, onClose: handleOnClose, sx: {
208
+ }, useBrowserInput: false, htmlFor: keyboardId, children: props.children }), onOpen: handleOnOpen, onClose: handleOnClose, triggerStatus: props.triggerStatus, sx: {
209
209
  width: "100%",
210
210
  maxWidth: "calc(100dvw - 2rem)",
211
211
  display: "flex",
@@ -6,6 +6,10 @@ export declare enum DRAWER_DIRECTION {
6
6
  TOP = "top",
7
7
  BOTTOM = "bottom"
8
8
  }
9
+ export declare enum DRAWER_TRIGGER_STATUS {
10
+ ENABLED = "ENABLED",
11
+ DISABLED = "DISABLED"
12
+ }
9
13
  export interface DrawerComponentProps extends Omit<GeneralProps, "onClick" | "sx">, Omit<SwipeableDrawerProps, "onClose" | "onToggle" | "onOpen"> {
10
14
  onOpen?: UnknownFunction;
11
15
  onClose?: UnknownFunction;
@@ -13,6 +17,7 @@ export interface DrawerComponentProps extends Omit<GeneralProps, "onClick" | "sx
13
17
  onToggle?: (status?: boolean) => unknown;
14
18
  direction?: DRAWER_DIRECTION;
15
19
  disableSwipe?: boolean;
20
+ triggerStatus?: DRAWER_TRIGGER_STATUS;
16
21
  }
17
22
  export interface DrawerComponentRef {
18
23
  open: () => void;
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  return t;
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.DRAWER_DIRECTION = void 0;
25
+ exports.DRAWER_TRIGGER_STATUS = exports.DRAWER_DIRECTION = void 0;
26
26
  var jsx_runtime_1 = require("react/jsx-runtime");
27
27
  var material_1 = require("@mui/material");
28
28
  var react_1 = require("react");
@@ -33,10 +33,15 @@ var DRAWER_DIRECTION;
33
33
  DRAWER_DIRECTION["TOP"] = "top";
34
34
  DRAWER_DIRECTION["BOTTOM"] = "bottom";
35
35
  })(DRAWER_DIRECTION || (exports.DRAWER_DIRECTION = DRAWER_DIRECTION = {}));
36
+ var DRAWER_TRIGGER_STATUS;
37
+ (function (DRAWER_TRIGGER_STATUS) {
38
+ DRAWER_TRIGGER_STATUS["ENABLED"] = "ENABLED";
39
+ DRAWER_TRIGGER_STATUS["DISABLED"] = "DISABLED";
40
+ })(DRAWER_TRIGGER_STATUS || (exports.DRAWER_TRIGGER_STATUS = DRAWER_TRIGGER_STATUS = {}));
36
41
  var DrawerComponent = (0, react_1.forwardRef)(function (props, ref) {
37
- var onOpen = props.onOpen, onClose = props.onClose, onToggle = props.onToggle, sx = props.sx, trigger = props.trigger, direction = props.direction, children = props.children, disableSwipe = props.disableSwipe, className = props.className, rest = __rest(props, ["onOpen", "onClose", "onToggle", "sx", "trigger", "direction", "children", "disableSwipe", "className"]);
38
- var _a = (0, react_1.useState)(false), isShowDrawerComponent = _a[0], setIsShowDrawerComponent = _a[1];
39
- var _b = (0, react_1.useState)(undefined), isOpen = _b[0], setIsOpen = _b[1];
42
+ var onOpen = props.onOpen, onClose = props.onClose, onToggle = props.onToggle, sx = props.sx, trigger = props.trigger, direction = props.direction, children = props.children, disableSwipe = props.disableSwipe, className = props.className, _a = props.triggerStatus, triggerStatus = _a === void 0 ? DRAWER_TRIGGER_STATUS.ENABLED : _a, rest = __rest(props, ["onOpen", "onClose", "onToggle", "sx", "trigger", "direction", "children", "disableSwipe", "className", "triggerStatus"]);
43
+ var _b = (0, react_1.useState)(false), isShowDrawerComponent = _b[0], setIsShowDrawerComponent = _b[1];
44
+ var _c = (0, react_1.useState)(undefined), isOpen = _c[0], setIsOpen = _c[1];
40
45
  var DrawerComponent = (0, react_1.useMemo)(function () { return (isOpen !== undefined || disableSwipe ? material_1.Drawer : material_1.SwipeableDrawer); }, [isOpen, disableSwipe]);
41
46
  var lockStatus = function () {
42
47
  setIsOpen(isShowDrawerComponent);
@@ -57,7 +62,7 @@ var DrawerComponent = (0, react_1.forwardRef)(function (props, ref) {
57
62
  var toggle = function (e) {
58
63
  var children = Array.from(e.currentTarget.children);
59
64
  var button = children.find(function (child) { return child.tagName === "BUTTON"; });
60
- if (button === null || button === void 0 ? void 0 : button.disabled) {
65
+ if ((button === null || button === void 0 ? void 0 : button.disabled) || triggerStatus === DRAWER_TRIGGER_STATUS.DISABLED) {
61
66
  e.stopPropagation();
62
67
  return;
63
68
  }
@@ -88,6 +88,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
88
88
  exports.TransferConfirmation = exports.TransferConfirmationError = void 0;
89
89
  var jsx_runtime_1 = require("react/jsx-runtime");
90
90
  var Button_1 = __importStar(require("../Button"));
91
+ var DrawerComponent_1 = require("../DrawerComponent");
91
92
  var ConfirmLayout_1 = __importDefault(require("../ConfirmLayout"));
92
93
  var Formatter_1 = __importDefault(require("../Formatter"));
93
94
  var react_1 = require("react");
@@ -237,7 +238,9 @@ exports.TransferConfirmation = (0, react_1.forwardRef)(function (props, ref) {
237
238
  updateSendInternalToken();
238
239
  }
239
240
  }, [sendInternalTokens, updateSendInternalToken, isInitPasscode]);
240
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: props.titleHeader, trigger: props.children, onOpen: validateAll, confirmAction: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.TransactionSlug.TransferInternal, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isValidatingAddress || errorAddress
241
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: props.titleHeader, trigger: props.children, onOpen: validateAll, confirmAction: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.TransactionSlug.TransferInternal, onConfirmSuccess: handleSendInternalToken, triggerStatus: !!error || isValidatingAddress || errorAddress
242
+ ? DrawerComponent_1.DRAWER_TRIGGER_STATUS.DISABLED
243
+ : DrawerComponent_1.DRAWER_TRIGGER_STATUS.ENABLED, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isValidatingAddress || errorAddress
241
244
  ? Button_1.BUTTON_STATUS.DISABLED
242
245
  : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) }), children: [transferContent, !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: (_a = theme.mixins.gaps) === null || _a === void 0 ? void 0 : _a.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) })] }))] }) }));
243
246
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.690",
3
+ "version": "0.0.692",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",