tek-wallet 0.0.660 → 0.0.662

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.
Files changed (40) hide show
  1. package/dist/components/TekWallet/components/layouts/ChildPageLayout/index.d.ts +2 -0
  2. package/dist/components/TekWallet/components/layouts/ChildPageLayout/index.js +3 -64
  3. package/dist/components/TekWallet/components/ui/BackHeader/index.d.ts +1 -0
  4. package/dist/components/TekWallet/components/ui/BackHeader/index.js +12 -15
  5. package/dist/components/TekWallet/components/ui/ChangePasscode/index.js +2 -1
  6. package/dist/components/TekWallet/components/ui/CloseModal/index.js +3 -6
  7. package/dist/components/TekWallet/components/ui/ConfirmByPasscode/index.js +14 -12
  8. package/dist/components/TekWallet/components/ui/HistorySwap/index.d.ts +7 -0
  9. package/dist/components/TekWallet/components/ui/HistorySwap/index.js +19 -4
  10. package/dist/components/TekWallet/components/ui/ModalDateFilter/index.d.ts +3 -4
  11. package/dist/components/TekWallet/components/ui/ModalDateFilter/index.js +11 -107
  12. package/dist/components/TekWallet/components/ui/OTP/index copy.d.ts +12 -0
  13. package/dist/components/TekWallet/components/ui/OTP/index copy.js +83 -0
  14. package/dist/components/TekWallet/components/ui/OTP/index.d.ts +5 -2
  15. package/dist/components/TekWallet/components/ui/OTP/index.js +76 -39
  16. package/dist/components/TekWallet/components/ui/PageHeader/index.d.ts +1 -0
  17. package/dist/components/TekWallet/components/ui/PageHeader/index.js +1 -1
  18. package/dist/components/TekWallet/components/ui/ReceiveFunction/index.js +1 -1
  19. package/dist/components/TekWallet/components/ui/ReceiveHistory/DetailsReceiveHistory.d.ts +8 -0
  20. package/dist/components/TekWallet/components/ui/ReceiveHistory/DetailsReceiveHistory.js +121 -0
  21. package/dist/components/TekWallet/components/ui/ReceiveHistory/ReceiveCardHistory.d.ts +11 -0
  22. package/dist/components/TekWallet/components/ui/ReceiveHistory/ReceiveCardHistory.js +77 -0
  23. package/dist/components/TekWallet/components/ui/ReceiveHistory/index.js +50 -20
  24. package/dist/components/TekWallet/components/ui/StatusDisplay/index.d.ts +1 -0
  25. package/dist/components/TekWallet/components/ui/StatusDisplay/index.js +6 -5
  26. package/dist/components/TekWallet/components/ui/SvgPath/index.d.ts +2 -0
  27. package/dist/components/TekWallet/components/ui/SvgPath/index.js +3 -1
  28. package/dist/components/TekWallet/components/ui/SwapToken/index.d.ts +1 -0
  29. package/dist/components/TekWallet/components/ui/SwapToken/index.js +2 -2
  30. package/dist/components/TekWallet/components/ui/UpdateLockToken/index.js +3 -0
  31. package/dist/components/TekWallet/components/views/ChangePasscodeView/index.js +47 -30
  32. package/dist/components/TekWallet/services/axios/receive_service/type.d.ts +36 -0
  33. package/dist/components/TekWallet/services/axios/receive_service/type.js +2 -0
  34. package/dist/components/TekWallet/theme/mui/theme.d.ts +85 -0
  35. package/dist/components/TekWallet/theme/mui/theme.js +26 -3
  36. package/dist/components/TekWallet/utils/number.extension.d.ts +2 -0
  37. package/dist/components/TekWallet/utils/number.extension.js +9 -0
  38. package/dist/components/TekWallet/utils/safeText.d.ts +2 -1
  39. package/dist/components/TekWallet/utils/safeText.js +7 -1
  40. package/package.json +2 -2
@@ -1,7 +1,9 @@
1
1
  import { GeneralProps } from "../../../types/ui";
2
+ import { StatusDisplayType } from "../../ui/StatusDisplay";
2
3
  interface ChildPageLayoutProps extends GeneralProps {
3
4
  header?: React.ReactNode;
4
5
  footer?: React.ReactNode;
6
+ statusMessage?: Partial<Record<StatusDisplayType, string>>;
5
7
  classNames?: {
6
8
  footer?: string;
7
9
  header?: string;
@@ -21,7 +21,7 @@ var StatusDisplay_2 = __importDefault(require("../../ui/StatusDisplay"));
21
21
  var material_1 = require("@mui/material");
22
22
  var ThemeProvider_1 = require("../../../providers/ThemeProvider");
23
23
  var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
24
- var header = props.header, footer = props.footer, children = props.children, sx = props.sx, className = props.className, classNames = props.classNames;
24
+ var header = props.header, footer = props.footer, children = props.children, sx = props.sx, className = props.className, classNames = props.classNames, statusMessage = props.statusMessage;
25
25
  var _a = (0, react_1.useState)(StatusDisplay_1.StatusDisplayType.Normal), status = _a[0], setStatus = _a[1];
26
26
  var theme = (0, ThemeProvider_1.useTheme)();
27
27
  (0, react_1.useImperativeHandle)(ref, function () {
@@ -40,7 +40,7 @@ var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
40
40
  },
41
41
  };
42
42
  });
43
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { ref: ref, sx: __assign({ height: "100dvh", width: "100vw", display: "grid", gridTemplateRows: "auto 1fr auto", position: "relative", backgroundColor: theme.palette.background.white }, sx), className: className, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.header, children: header }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { height: "100%", width: "100%", overflowX: "hidden", overflowY: "auto" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.body, children: children }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.footer, children: footer }), status !== StatusDisplay_1.StatusDisplayType.Normal && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
43
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { ref: ref, sx: __assign({ height: "100%", width: "100%", display: "grid", gridTemplateRows: "auto 1fr auto", position: "relative", backgroundColor: theme.palette.background.white }, sx), className: className, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.header, children: header }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { height: "100%", width: "100%", overflowX: "hidden", overflowY: "auto" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.body, children: children }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.footer, children: footer }), status !== StatusDisplay_1.StatusDisplayType.Normal && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
44
44
  position: "absolute",
45
45
  inset: 0,
46
46
  display: "flex",
@@ -49,68 +49,7 @@ var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
49
49
  backgroundColor: "blackBackground.16",
50
50
  backdropFilter: "blur(4px)",
51
51
  zIndex: 50,
52
- }, children: (0, jsx_runtime_1.jsx)(StatusDisplay_2.default, { status: status }) }))] })
53
- // <Box
54
- // sx={{
55
- // position: "relative",
56
- // backgroundColor: theme.palette.background.white,
57
- // height: "100dvh",
58
- // width: "100vw",
59
- // ...sx,
60
- // }}
61
- // >
62
- // <Box
63
- // sx={{
64
- // minHeight: "3.125rem",
65
- // width: "100%",
66
- // position: "absolute",
67
- // top: 0,
68
- // left: 0,
69
- // zIndex: 50,
70
- // }}
71
- // >
72
- // {header}
73
- // </Box>
74
- // <Box
75
- // sx={{
76
- // height: "100%",
77
- // width: "100%",
78
- // overflowX: "hidden",
79
- // overflowY: "auto",
80
- // paddingTop: header && !fullScreen ? "3.125rem" : 0,
81
- // }}
82
- // >
83
- // {children}
84
- // </Box>
85
- // <Box
86
- // sx={{
87
- // width: "100%",
88
- // position: "absolute",
89
- // bottom: 0,
90
- // left: 0,
91
- // zIndex: 50,
92
- // }}
93
- // >
94
- // {footer}
95
- // </Box>
96
- // {status !== StatusDisplayType.Normal && (
97
- // <Box
98
- // sx={{
99
- // position: "absolute",
100
- // inset: 0,
101
- // display: "flex",
102
- // alignItems: "center",
103
- // justifyContent: "center",
104
- // backgroundColor: "blackBackground.16",
105
- // backdropFilter: "blur(4px)",
106
- // zIndex: 50,
107
- // }}
108
- // >
109
- // <StatusDisplay status={status} />
110
- // </Box>
111
- // )}
112
- // </Box>
113
- );
52
+ }, children: (0, jsx_runtime_1.jsx)(StatusDisplay_2.default, { status: status, statusMessage: statusMessage === null || statusMessage === void 0 ? void 0 : statusMessage[status] }) }))] }));
114
53
  });
115
54
  ChildPageLayout.displayName = "ChildPageLayout";
116
55
  exports.default = ChildPageLayout;
@@ -4,6 +4,7 @@ interface BackHeaderProps extends GeneralProps {
4
4
  center?: React.ReactNode;
5
5
  right?: React.ReactNode;
6
6
  hideBack?: boolean;
7
+ renderBack?: (Back: React.ReactNode) => React.ReactNode;
7
8
  }
8
9
  declare const BackHeader: (props: BackHeaderProps) => import("react/jsx-runtime").JSX.Element;
9
10
  export default BackHeader;
@@ -18,13 +18,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  var jsx_runtime_1 = require("react/jsx-runtime");
19
19
  var BackArrow_1 = __importDefault(require("../BackArrow"));
20
20
  var useCustomRouter_1 = __importDefault(require("../../../hooks/useCustomRouter"));
21
- var Text_1 = __importDefault(require("../Text"));
22
21
  var material_1 = require("@mui/material");
23
22
  var ThemeProvider_1 = require("../../../providers/ThemeProvider");
24
23
  var BackHeader = function (props) {
25
24
  var router = (0, useCustomRouter_1.default)();
26
25
  var theme = (0, ThemeProvider_1.useTheme)();
27
- var center = props.center, children = props.children, hideBack = props.hideBack, right = props.right;
26
+ var center = props.center, children = props.children, hideBack = props.hideBack, right = props.right, _a = props.renderBack, renderBack = _a === void 0 ? function (Back) { return Back; } : _a;
28
27
  var back = function (e) {
29
28
  if (props.overrideBack) {
30
29
  props.overrideBack(e);
@@ -32,18 +31,16 @@ var BackHeader = function (props) {
32
31
  }
33
32
  router.back();
34
33
  };
35
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16, position: "relative", height: "100%" }), props.sx), children: [!hideBack && ((0, jsx_runtime_1.jsxs)(material_1.Box, { component: "button", sx: {
36
- display: "flex",
37
- alignItems: "center",
38
- gap: theme.mixins.gaps.g4,
39
- cursor: "pointer",
40
- "&:active": {
41
- transform: "translateX(-0.25rem)",
42
- transition: "transform 0.2s ease-in-out",
43
- },
44
- }, onClick: back, children: [(0, jsx_runtime_1.jsx)(BackArrow_1.default, {}), " ", (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
45
- color: theme.palette.text.white,
46
- fontSize: theme.typography.fontSize12,
47
- }, children: "Back" })] })), !!center && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.center), theme.mixins.headerTitle), children: center })), children, right && (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { marginLeft: "auto" }, children: right })] }));
34
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16, position: "relative", height: "100%" }), props.sx), children: [!hideBack &&
35
+ renderBack((0, jsx_runtime_1.jsxs)(material_1.Box, { component: "button", sx: {
36
+ display: "flex",
37
+ alignItems: "center",
38
+ gap: theme.mixins.gaps.g4,
39
+ cursor: "pointer",
40
+ "&:active": {
41
+ transform: "translateX(-0.25rem)",
42
+ transition: "transform 0.2s ease-in-out",
43
+ },
44
+ }, onClick: back, children: [(0, jsx_runtime_1.jsx)(BackArrow_1.default, {}), " "] })), !!center && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.center), theme.mixins.headerTitle), children: center })), children, right && (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { marginLeft: "auto" }, children: right })] }));
48
45
  };
49
46
  exports.default = BackHeader;
@@ -66,6 +66,7 @@ var react_1 = require("react");
66
66
  var RequireConnect_1 = __importDefault(require("../RequireConnect"));
67
67
  var material_1 = require("@mui/material");
68
68
  var ChangePasscodeView_1 = __importDefault(require("../../views/ChangePasscodeView"));
69
+ var xhub_keyboard_1 = require("xhub-keyboard");
69
70
  function ChangePasscode(_a) {
70
71
  var children = _a.children, isInitPasscode = _a.isInitPasscode, rest = __rest(_a, ["children", "isInitPasscode"]);
71
72
  var getSeedPhraseViewRef = (0, react_1.useRef)(null);
@@ -79,6 +80,6 @@ function ChangePasscode(_a) {
79
80
  setResetTrigger(function (prev) { return prev + "1"; });
80
81
  }, 400);
81
82
  };
82
- 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.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, isInitPasscode: isInitPasscode }, resetTrigger) }) }));
83
+ 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: "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, isInitPasscode: isInitPasscode }, resetTrigger) }) }));
83
84
  }
84
85
  exports.default = ChangePasscode;
@@ -21,15 +21,12 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  }
22
22
  return t;
23
23
  };
24
- var __importDefault = (this && this.__importDefault) || function (mod) {
25
- return (mod && mod.__esModule) ? mod : { "default": mod };
26
- };
27
24
  Object.defineProperty(exports, "__esModule", { value: true });
28
25
  var jsx_runtime_1 = require("react/jsx-runtime");
29
- var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
30
- var Icon_1 = __importDefault(require("../Icon"));
26
+ var material_1 = require("@mui/material");
27
+ var SvgPath_1 = require("../SvgPath");
31
28
  var CloseModal = function (props) {
32
29
  var rest = __rest(props, []);
33
- return (0, jsx_runtime_1.jsx)(Icon_1.default, __assign({ src: (0, getIcon_1.default)("close_modal"), sx: __assign({ width: "1.5rem", height: "1.5rem" }, props.sx) }, rest));
30
+ return ((0, jsx_runtime_1.jsx)(material_1.SvgIcon, __assign({ sx: { width: 20, height: 20 } }, rest, { children: SvgPath_1.IC_CLOSE })));
34
31
  };
35
32
  exports.default = CloseModal;
@@ -94,6 +94,7 @@ var ThemeProvider_1 = require("../../../providers/ThemeProvider");
94
94
  var LoadingLayout_1 = __importDefault(require("../LoadingLayout"));
95
95
  var DrawerComponent_1 = __importDefault(require("../DrawerComponent"));
96
96
  var authentication_by_passcode_service_1 = __importDefault(require("../../../services/axios/authentication-by-passcode-service"));
97
+ var xhub_keyboard_1 = require("xhub-keyboard");
97
98
  var handleVerifyPasscode = function (data) { return __awaiter(void 0, void 0, void 0, function () {
98
99
  var response, err_1;
99
100
  return __generator(this, function (_a) {
@@ -114,7 +115,7 @@ var handleVerifyPasscode = function (data) { return __awaiter(void 0, void 0, vo
114
115
  }); };
115
116
  var passcodeLength = 6;
116
117
  var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
117
- var onConfirmSuccess = props.onConfirmSuccess, backgroundColor = props.backgroundColor;
118
+ var onConfirmSuccess = props.onConfirmSuccess;
118
119
  var theme = (0, ThemeProvider_1.useTheme)();
119
120
  var _a = (0, react_1.useState)(""), otp = _a[0], setOtp = _a[1];
120
121
  var loadingRef = (0, react_1.useRef)(null);
@@ -122,6 +123,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
122
123
  var drawerRef = (0, react_1.useRef)(null);
123
124
  var handleCleardata = function () {
124
125
  setOtp("");
126
+ setAuthError("");
125
127
  };
126
128
  var handleClose = function () {
127
129
  var _a, _b;
@@ -190,20 +192,20 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
190
192
  }
191
193
  });
192
194
  }); };
193
- return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: handleOnOpen, onClose: handleOnClose, sx: {
195
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { style: {
196
+ width: "100%",
197
+ }, useBrowserInput: false, htmlFor: "confirm-passcode-keyboard", children: props.children }), onOpen: handleOnOpen, onClose: handleOnClose, sx: {
194
198
  width: "100%",
195
199
  maxWidth: "calc(100dvw - 2rem)",
196
200
  display: "flex",
197
- }, children: (0, jsx_runtime_1.jsx)(LoadingLayout_1.default, { initLoading: false, ref: loadingRef, sx: {
198
- backgroundColor: "transparent",
199
- width: "100%",
200
- }, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "Enter Passcode", onClose: handleClose, backgroundColor: backgroundColor, 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)(OTP_1.default, { value: otp, onChange: handleOtpChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.PASSWORD, inputStyle: {
201
- backgroundColor: "white",
202
- } }), (0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
203
- fontSize: theme.typography.fontSize12,
204
- fontWeight: theme.typography.fontWeight500,
205
- color: theme.palette.text.accent2,
206
- }, children: "Forgot password?" }) }), !!authError && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { alignSelf: "flex-start" }), children: authError }))] }) }) }) }));
201
+ }, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { id: "confirm-passcode-keyboard", keyboardType: xhub_keyboard_1.KeyboardType.Integer, value: otp, onChange: handleOtpChange, children: (0, jsx_runtime_1.jsx)(LoadingLayout_1.default, { initLoading: false, ref: loadingRef, sx: {
202
+ backgroundColor: "transparent",
203
+ width: "100%",
204
+ }, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "Enter Passcode", onClose: handleClose, sx: {
205
+ backgroundColor: theme.palette.background.tertiary,
206
+ }, 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: {
207
+ width: "100%",
208
+ }, useBrowserInput: false, htmlFor: "confirm-passcode-keyboard", children: (0, jsx_runtime_1.jsx)(OTP_1.default, { value: otp, onChange: handleOtpChange, 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 }))] }) }) }) }) }));
207
209
  });
208
210
  ConfirmByPasscode.displayName = "ConfirmByPasscode";
209
211
  exports.default = ConfirmByPasscode;
@@ -1,3 +1,4 @@
1
+ import { DrawerComponentRef } from "../DrawerComponent";
1
2
  interface HistorySwapProps {
2
3
  onClose?: () => void;
3
4
  open?: boolean;
@@ -5,5 +6,11 @@ interface HistorySwapProps {
5
6
  export interface HistorySwapRef {
6
7
  resetStatus: () => void;
7
8
  }
9
+ export type DrawerRefs = {
10
+ token: DrawerComponentRef;
11
+ status: DrawerComponentRef;
12
+ detail: DrawerComponentRef;
13
+ date: DrawerComponentRef;
14
+ };
8
15
  declare const HistorySwap: (props: HistorySwapProps) => import("react/jsx-runtime").JSX.Element;
9
16
  export default HistorySwap;
@@ -93,6 +93,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
93
93
  };
94
94
  Object.defineProperty(exports, "__esModule", { value: true });
95
95
  var jsx_runtime_1 = require("react/jsx-runtime");
96
+ /* eslint-disable react-hooks/exhaustive-deps */
96
97
  var react_1 = require("react");
97
98
  var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
98
99
  var providers_1 = require("../../../providers");
@@ -141,8 +142,12 @@ var HistorySwap = function (props) {
141
142
  var _f = (0, react_1.useState)(undefined), getActivities = _f[0], setGetActivities = _f[1];
142
143
  var _g = (0, react_1.useState)(false), isLoading = _g[0], setLoading = _g[1];
143
144
  var drawerRefs = (0, react_1.useRef)({});
144
- var _h = (0, react_1.useState)(null), valueStartDate = _h[0], setValueStartDate = _h[1];
145
- var _j = (0, react_1.useState)(null), valueEndDate = _j[0], setValueEndDate = _j[1];
145
+ // const [valueStartDate, setValueStartDate] = useState<Dayjs | null>(null);
146
+ // const [valueEndDate, setValueEndDate] = useState<Dayjs | null>(null);
147
+ var _h = (0, react_1.useState)({
148
+ startDate: null,
149
+ endDate: null,
150
+ }), dateFilter = _h[0], setDateFilter = _h[1];
146
151
  var router = (0, useCustomRouter_1.default)();
147
152
  var getTransactionStatuses = function (statuses) {
148
153
  if (statuses.includes("all")) {
@@ -161,7 +166,7 @@ var HistorySwap = function (props) {
161
166
  for (var _i = 0; _i < arguments.length; _i++) {
162
167
  args_1[_i] = arguments[_i];
163
168
  }
164
- return __awaiter(void 0, __spreadArray([], args_1, true), void 0, function (statuses) {
169
+ return __awaiter(void 0, __spreadArray([], args_1, true), void 0, function (statuses, fromDate, toDate) {
165
170
  var transactionStatus, response, error_1;
166
171
  var _a;
167
172
  if (statuses === void 0) { statuses = ["all"]; }
@@ -176,6 +181,8 @@ var HistorySwap = function (props) {
176
181
  return [4 /*yield*/, (0, get_activities_service_1.default)({
177
182
  transaction_types: type_1.TransactionSlug.Swap,
178
183
  transaction_status: transactionStatus,
184
+ from_date: fromDate,
185
+ to_date: toDate,
179
186
  page: 1,
180
187
  take: 10,
181
188
  })];
@@ -202,6 +209,12 @@ var HistorySwap = function (props) {
202
209
  (0, react_1.useEffect)(function () {
203
210
  fetchSwapHistory(selectedStatuses);
204
211
  }, [selectedStatuses]);
212
+ (0, react_1.useEffect)(function () {
213
+ var _a, _b;
214
+ if (!!dateFilter.startDate && !!dateFilter.endDate) {
215
+ fetchSwapHistory(selectedStatuses, (_a = dateFilter.startDate) === null || _a === void 0 ? void 0 : _a.toISOString(), (_b = dateFilter.endDate) === null || _b === void 0 ? void 0 : _b.toISOString());
216
+ }
217
+ }, [dateFilter.startDate, dateFilter.endDate]);
205
218
  var resultData = (0, react_1.useMemo)(function () {
206
219
  var data = getActivities || (transactionDetail === null || transactionDetail === void 0 ? void 0 : transactionDetail.data);
207
220
  if (Array.isArray(data)) {
@@ -372,7 +385,9 @@ var HistorySwap = function (props) {
372
385
  height: "15px",
373
386
  }, onClick: handleCloseDrawer })] }), sx: {
374
387
  backgroundColor: theme.palette.background.tertiary,
375
- }, children: (0, jsx_runtime_1.jsx)(ModalDateFilter_1.default, { valueStartDate: valueStartDate, valueEndDate: valueEndDate, setValueStartDate: setValueStartDate, setValueEndDate: setValueEndDate }) }) })] }) }), resultData && resultData.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
388
+ }, children: (0, jsx_runtime_1.jsx)(ModalDateFilter_1.default, { drawerRefs: drawerRefs.current.date, handleConfirm: function (startDate, endDate) {
389
+ setDateFilter({ startDate: startDate || null, endDate: endDate || null });
390
+ } }) }) })] }) }), resultData && resultData.length > 0 && ((0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
376
391
  width: "100%",
377
392
  opacity: 0.6,
378
393
  backgroundColor: theme.palette.border.accent3,
@@ -1,9 +1,8 @@
1
1
  import { Dayjs } from "dayjs";
2
+ import { DrawerComponentRef } from "../DrawerComponent";
2
3
  interface ModalDateFilterProps {
3
- valueStartDate: Dayjs | null;
4
- valueEndDate: Dayjs | null;
5
- setValueStartDate: (date: Dayjs | null) => void;
6
- setValueEndDate: (date: Dayjs | null) => void;
4
+ handleConfirm: (startDate?: Dayjs | null, endDate?: Dayjs | null) => void;
5
+ drawerRefs?: DrawerComponentRef;
7
6
  }
8
7
  declare const ModalDateFilter: (props: ModalDateFilterProps) => import("react/jsx-runtime").JSX.Element;
9
8
  export default ModalDateFilter;
@@ -44,25 +44,28 @@ var Text_1 = __importDefault(require("../Text"));
44
44
  var DatePicker_1 = __importDefault(require("../DatePicker"));
45
45
  var Row_1 = __importDefault(require("../Row"));
46
46
  var Column_1 = __importDefault(require("../Column"));
47
+ var dayjs_1 = __importDefault(require("dayjs"));
47
48
  var SvgPath_1 = require("../SvgPath");
48
49
  var Button_1 = __importStar(require("../Button"));
49
50
  var ModalDateFilter = function (props) {
50
- var valueStartDate = props.valueStartDate, valueEndDate = props.valueEndDate, setValueStartDate = props.setValueStartDate, setValueEndDate = props.setValueEndDate;
51
+ var drawerRefs = props.drawerRefs, handleConfirm = props.handleConfirm;
52
+ var _a = (0, react_1.useState)(null), valueStartDate = _a[0], setValueStartDate = _a[1];
53
+ var _b = (0, react_1.useState)(null), valueEndDate = _b[0], setValueEndDate = _b[1];
51
54
  var theme = (0, providers_1.useTheme)();
52
- var _a = (0, react_1.useState)(null), errorEndDate = _a[0], setErrorEndDate = _a[1];
55
+ var _c = (0, react_1.useState)(null), errorEndDate = _c[0], setErrorEndDate = _c[1];
53
56
  return ((0, jsx_runtime_1.jsxs)(Column_1.default, { sx: {
54
57
  paddingTop: theme.mixins.customPadding.p2,
55
58
  paddingBottom: theme.mixins.customPadding.p2,
56
59
  }, children: [(0, jsx_runtime_1.jsxs)(Row_1.default, { sx: {
57
60
  gap: theme.mixins.gaps.g8,
58
61
  }, children: [(0, jsx_runtime_1.jsx)(DatePicker_1.default, { onSelect: function (date) {
59
- setValueStartDate(date);
62
+ setValueStartDate((0, dayjs_1.default)(date).startOf("day"));
60
63
  }, value: valueStartDate, disableFuture: true }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
61
64
  color: theme.palette.primary.main,
62
65
  fontWeight: theme.typography.fontWeight600,
63
66
  fontSize: theme.typography.fontSize12,
64
67
  }, children: "to" }), (0, jsx_runtime_1.jsx)(DatePicker_1.default, { onSelect: function (date) {
65
- setValueEndDate(date);
68
+ setValueEndDate((0, dayjs_1.default)(date).endOf("day"));
66
69
  }, value: valueEndDate, disablePastFrom: valueStartDate, onError: function (error) {
67
70
  setErrorEndDate(error);
68
71
  }, disableFuture: true })] }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
@@ -83,111 +86,12 @@ var ModalDateFilter = function (props) {
83
86
  alignItems: "center",
84
87
  justifyContent: "center",
85
88
  }, onClick: function () {
86
- // setQueryTransferHistory({
87
- // startDate: null,
88
- // endDate: null,
89
- // });
90
89
  setValueStartDate(null);
91
90
  setValueEndDate(null);
92
- // modalBottomSheetRef.current?.close();
91
+ drawerRefs === null || drawerRefs === void 0 ? void 0 : drawerRefs.close();
93
92
  }, children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: SvgPath_1.IC_TRASH }) }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { className: "w-full", status: !!valueStartDate && !!valueEndDate && !errorEndDate ? Button_1.BUTTON_STATUS.ENABLED : Button_1.BUTTON_STATUS.DISABLED, onClick: function () {
94
- // setQueryTransferHistory({
95
- // startDate: valueStartDate?.toISOString(),
96
- // endDate: valueEndDate?.toISOString(),
97
- // });
98
- // modalBottomSheetRef.current?.close();
99
- // setValueStartDate(valueStartDate);
100
- // setValueEndDate(valueEndDate);
101
- }, children: "Confirm" })] })] })
102
- // <Box>
103
- // <Divider
104
- // sx={{
105
- // backgroundColor: theme.palette.border.accent3,
106
- // width: "100%",
107
- // mt: theme.mixins.customMargin.m12,
108
- // mb: theme.mixins.customMargin.m6,
109
- // }}
110
- // />
111
- // <Text
112
- // sx={{
113
- // color: theme.palette.text.black,
114
- // fontWeight: theme.typography.fontWeight500,
115
- // fontSize: theme.typography.fontSize12,
116
- // }}
117
- // >
118
- // Date Picker
119
- // </Text>
120
- // <Box
121
- // sx={{
122
- // ...theme.mixins.row,
123
- // gap: theme.mixins.gaps.g8,
124
- // mt: theme.mixins.customMargin.m12,
125
- // }}
126
- // >
127
- // <InputBase
128
- // sx={{
129
- // borderRadius: theme.mixins.customRadius.r8,
130
- // border: theme.palette.primary.main,
131
- // padding: theme.mixins.customPadding.p12,
132
- // textAlign: "center",
133
- // backgroundColor: theme.palette.background.white,
134
- // color: theme.palette.primary.main,
135
- // }}
136
- // />
137
- // <Text
138
- // sx={{
139
- // fontWeight: theme.typography.fontWeight600,
140
- // color: theme.palette.text.accent,
141
- // fontSize: theme.typography.fontSize12,
142
- // }}
143
- // >
144
- // to
145
- // </Text>
146
- // <InputBase
147
- // sx={{
148
- // borderRadius: theme.mixins.customRadius.r8,
149
- // border: theme.palette.primary.main,
150
- // padding: theme.mixins.customPadding.p12,
151
- // textAlign: "center",
152
- // backgroundColor: theme.palette.background.white,
153
- // color: theme.palette.primary.main,
154
- // }}
155
- // />
156
- // </Box>
157
- // <Divider
158
- // sx={{
159
- // backgroundColor: theme.palette.border.accent3,
160
- // width: "100%",
161
- // mt: theme.mixins.customMargin.m12,
162
- // mb: theme.mixins.customMargin.m6,
163
- // }}
164
- // />
165
- // {/* <Box
166
- // sx={{
167
- // ...theme.mixins.row,
168
- // gap: theme.mixins.gaps.g8,
169
- // mt: theme.mixins.customMargin.m12,
170
- // }}
171
- // >
172
- // <Button>
173
- // <Icon src={getIcon("")} />
174
- // </Button>
175
- // <Text
176
- // sx={{
177
- // fontWeight: theme.typography.fontWeight600,
178
- // color: theme.palette.text.accent,
179
- // fontSize: theme.typography.fontSize12,
180
- // }}
181
- // >
182
- // to
183
- // </Text>
184
- // <Button sx={{
185
- // backgroundColor:
186
- // }}>
187
- // <Icon src={getIcon("")} />
188
- // </Button>
189
- // </Box> */}
190
- // </Box>
191
- );
93
+ handleConfirm(valueStartDate, valueEndDate);
94
+ drawerRefs === null || drawerRefs === void 0 ? void 0 : drawerRefs.close();
95
+ }, children: "Confirm" })] })] }));
192
96
  };
193
97
  exports.default = ModalDateFilter;
@@ -0,0 +1,12 @@
1
+ import { InputProps, OTPInputProps } from "react-otp-input";
2
+ export declare enum OtpInputType {
3
+ TEXT = "text",
4
+ PASSWORD = "password",
5
+ OTP = "otp"
6
+ }
7
+ interface CustomOtpInputProps extends Omit<OTPInputProps, "renderInput"> {
8
+ otpInputType?: OtpInputType;
9
+ renderInput?: (inputProps: InputProps, index: number) => React.ReactNode;
10
+ }
11
+ declare const CustomOtpInput: (props: CustomOtpInputProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default CustomOtpInput;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.OtpInputType = void 0;
29
+ var jsx_runtime_1 = require("react/jsx-runtime");
30
+ var material_1 = require("@mui/material");
31
+ var react_otp_input_1 = __importDefault(require("react-otp-input"));
32
+ var SvgPath_1 = require("../SvgPath");
33
+ var OtpInputType;
34
+ (function (OtpInputType) {
35
+ OtpInputType["TEXT"] = "text";
36
+ OtpInputType["PASSWORD"] = "password";
37
+ OtpInputType["OTP"] = "otp";
38
+ })(OtpInputType || (exports.OtpInputType = OtpInputType = {}));
39
+ var CustomOtpInput = function (props) {
40
+ var otpInputType = props.otpInputType, rest = __rest(props, ["otpInputType"]);
41
+ switch (otpInputType) {
42
+ case OtpInputType.PASSWORD:
43
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
44
+ display: "flex",
45
+ alignItems: "center",
46
+ justifyContent: "center",
47
+ }, children: (0, jsx_runtime_1.jsx)(react_otp_input_1.default, __assign({}, rest, { inputType: "password", inputStyle: {
48
+ border: "1px solid #00000058",
49
+ borderRadius: "0.75rem",
50
+ width: "2.8rem",
51
+ aspectRatio: "1/1.1",
52
+ margin: "0 0.25rem",
53
+ outline: "none",
54
+ color: "#000",
55
+ backgroundColor: "white",
56
+ }, renderInput: function (props) { return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("input", __assign({}, props, { inputMode: "decimal" })), (0, jsx_runtime_1.jsx)("style", { children: "input::selection {\n background-color: white; \n color: #000; \n }" })] })); } })) }));
57
+ case OtpInputType.OTP:
58
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
59
+ display: "flex",
60
+ alignItems: "center",
61
+ border: "1px solid #00000058",
62
+ borderRadius: "0.5rem",
63
+ padding: "0.75rem 1rem",
64
+ width: "100%",
65
+ backgroundColor: "#ffffff",
66
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: {
67
+ width: 20,
68
+ height: 20,
69
+ }, children: SvgPath_1.IC_PASSCODE }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical", variant: "fullWidth", flexItem: true, sx: {
70
+ margin: "0 0.75rem",
71
+ } }), (0, jsx_runtime_1.jsx)(react_otp_input_1.default, __assign({}, rest, { inputType: "password", inputStyle: {
72
+ borderBottom: "1px solid #000000",
73
+ width: "0.625rem",
74
+ margin: "0 0.25rem",
75
+ outline: "none",
76
+ color: "#000",
77
+ backgroundColor: "#00000000",
78
+ }, renderInput: function (props) { return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("input", __assign({}, props, { inputMode: "decimal" })), (0, jsx_runtime_1.jsx)("style", { children: "input::selection {\n background-color: transparent;\n color: #000;\n }" })] })); } }))] }));
79
+ default:
80
+ return (0, jsx_runtime_1.jsx)(react_otp_input_1.default, __assign({}, rest, { renderInput: function (props) { return (0, jsx_runtime_1.jsx)("input", __assign({}, props, { inputMode: "text", type: "text" })); } }));
81
+ }
82
+ };
83
+ exports.default = CustomOtpInput;
@@ -2,11 +2,14 @@ import { InputProps, OTPInputProps } from "react-otp-input";
2
2
  export declare enum OtpInputType {
3
3
  TEXT = "text",
4
4
  PASSWORD = "password",
5
- OTP = "otp"
5
+ OTP = "otp",
6
+ CONFIRM_BY_PASSCODE = "confirm-by-passcode"
6
7
  }
7
- interface CustomOtpInputProps extends Omit<OTPInputProps, "renderInput"> {
8
+ interface CustomOtpInputProps extends Omit<OTPInputProps, "renderInput" | "onChange"> {
8
9
  otpInputType?: OtpInputType;
9
10
  renderInput?: (inputProps: InputProps, index: number) => React.ReactNode;
11
+ onChange?: (value: string) => void;
12
+ readOnly?: boolean;
10
13
  }
11
14
  declare const CustomOtpInput: (props: CustomOtpInputProps) => import("react/jsx-runtime").JSX.Element;
12
15
  export default CustomOtpInput;