tek-wallet 0.0.766 → 0.0.768

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 (32) hide show
  1. package/dist/components/TekWallet/components/ui/ChangePasscode/index.js +1 -1
  2. package/dist/components/TekWallet/components/ui/ConfirmByPasscode/index.js +3 -3
  3. package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.d.ts +2 -2
  4. package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.js +1 -1
  5. package/dist/components/TekWallet/components/ui/DrawerComponent/index.d.ts +1 -1
  6. package/dist/components/TekWallet/components/ui/DrawerComponent/index.js +1 -1
  7. package/dist/components/TekWallet/components/ui/Formatter/index__.d.ts +18 -0
  8. package/dist/components/TekWallet/components/ui/Formatter/index__.js +100 -0
  9. package/dist/components/TekWallet/components/ui/HistorySwap/index.js +1 -1
  10. package/dist/components/TekWallet/components/ui/QRCode/index.js +1 -1
  11. package/dist/components/TekWallet/components/ui/QrCodeReader/index.js +1 -1
  12. package/dist/components/TekWallet/components/ui/ReceiveFunction/index.js +2 -2
  13. package/dist/components/TekWallet/components/ui/ReceiveHistory/index.js +1 -1
  14. package/dist/components/TekWallet/components/ui/SwapFunction/index.js +2 -2
  15. package/dist/components/TekWallet/components/ui/WithdrawFunction/index.js +1 -1
  16. package/dist/components/TekWallet/components/views/AssetView/index.js +2 -35
  17. package/dist/components/TekWallet/components/views/DetailActivityView/LoadingView.d.ts +2 -0
  18. package/dist/components/TekWallet/components/views/DetailActivityView/LoadingView.js +29 -0
  19. package/dist/components/TekWallet/components/views/DetailActivityView/index.js +91 -5
  20. package/dist/components/TekWallet/components/views/SendExternalView/components/Result.js +1 -1
  21. package/dist/components/TekWallet/components/views/SendExternalView/index.js +3 -2
  22. package/dist/components/TekWallet/components/views/SendInternalView/components/Form.js +12 -2
  23. package/dist/components/TekWallet/components/views/SendInternalView/index.js +3 -4
  24. package/dist/components/TekWallet/components/views/SwapView/index.js +4 -3
  25. package/dist/components/TekWallet/hooks/useEventHandler.js +0 -1
  26. package/dist/components/TekWallet/providers/WalletDataProviderNoImport/index.js +1 -0
  27. package/dist/components/TekWallet/services/axios/get-activity-service/index.d.ts +3 -0
  28. package/dist/components/TekWallet/services/axios/get-activity-service/index.js +54 -0
  29. package/dist/components/TekWallet/services/axios/get-activity-service/type.d.ts +10 -0
  30. package/dist/components/TekWallet/services/axios/get-activity-service/type.js +2 -0
  31. package/dist/components/TekWallet/store/balance/index.js +1 -1
  32. package/package.json +1 -1
@@ -82,6 +82,6 @@ function ChangePasscode(_a) {
82
82
  }, 400);
83
83
  };
84
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) }) }));
85
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { onDone: 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) }) }));
86
86
  }
87
87
  exports.default = ChangePasscode;
@@ -115,7 +115,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
115
115
  var _a, _b;
116
116
  handleBlurAll();
117
117
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
118
- (_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
118
+ (_b = props.onDone) === null || _b === void 0 ? void 0 : _b.call(props);
119
119
  }, [handleBlurAll, props]);
120
120
  (0, react_1.useImperativeHandle)(ref, function () { return ({
121
121
  clearData: handleCleardata,
@@ -138,7 +138,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
138
138
  var handleOnClose = function () {
139
139
  var _a;
140
140
  handleCleardata();
141
- (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
141
+ (_a = props.onDone) === null || _a === void 0 ? void 0 : _a.call(props);
142
142
  };
143
143
  var handleOnOpen = function () {
144
144
  var _a;
@@ -189,7 +189,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
189
189
  }); }, [handleClose, handleVerifyPasscode, onConfirmSuccess, passcode]);
190
190
  return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { style: {
191
191
  width: "100%",
192
- }, useBrowserInput: false, htmlFor: keyboardId, children: props.children }), onOpen: handleOnOpen, onClose: handleOnClose, triggerStatus: props.triggerStatus, sx: __assign({ width: "100%", maxWidth: "calc(100dvw - 2rem)", display: "flex" }, sx), 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, styles: {
192
+ }, useBrowserInput: false, htmlFor: keyboardId, children: props.children }), onOpen: handleOnOpen, onDone: handleOnClose, triggerStatus: props.triggerStatus, sx: __assign({ width: "100%", maxWidth: "calc(100dvw - 2rem)", display: "flex" }, sx), 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, styles: {
193
193
  keyboardContainer: {
194
194
  display: isLocked ? "none" : "block",
195
195
  },
@@ -14,7 +14,7 @@ export interface ConfirmSendExternalProps extends Omit<ConfirmLayoutProps, "acti
14
14
  onError?: (error: Error | unknown) => void;
15
15
  children?: React.ReactNode;
16
16
  sx?: SxProps;
17
- onClose?: ReactEventHandler;
17
+ onDone?: ReactEventHandler;
18
18
  }
19
- export declare const ConfirmSendExternal: ({ payload, onSuccess, onStart, onFinally, onError, children, sx, onClose: onDone, }: ConfirmSendExternalProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const ConfirmSendExternal: ({ payload, onSuccess, onStart, onFinally, onError, children, sx, onDone, }: ConfirmSendExternalProps) => import("react/jsx-runtime").JSX.Element;
20
20
  export default ConfirmSendExternal;
@@ -98,7 +98,7 @@ var useWallet_1 = __importDefault(require("../../../hooks/useWallet"));
98
98
  var type_1 = require("../../../services/axios/get-activities-service/type");
99
99
  var useRealtime_1 = __importDefault(require("../../../hooks/useRealtime"));
100
100
  var ConfirmSendExternal = function (_a) {
101
- var payload = _a.payload, onSuccess = _a.onSuccess, onStart = _a.onStart, onFinally = _a.onFinally, onError = _a.onError, children = _a.children, sx = _a.sx, onDone = _a.onClose;
101
+ var payload = _a.payload, onSuccess = _a.onSuccess, onStart = _a.onStart, onFinally = _a.onFinally, onError = _a.onError, children = _a.children, sx = _a.sx, onDone = _a.onDone;
102
102
  var network = payload.network;
103
103
  var _b = (0, react_1.useState)(), response = _b[0], setResponse = _b[1];
104
104
  var thisTransactionId = (0, react_1.useRef)("");
@@ -12,7 +12,7 @@ export declare enum DRAWER_TRIGGER_STATUS {
12
12
  }
13
13
  export interface DrawerComponentProps extends Omit<GeneralProps, "onClick" | "sx">, Omit<SwipeableDrawerProps, "onClose" | "onToggle" | "onOpen"> {
14
14
  onOpen?: UnknownFunction;
15
- onClose?: UnknownFunction;
15
+ onDone?: UnknownFunction;
16
16
  trigger?: React.ReactNode;
17
17
  onToggle?: (status?: boolean) => unknown;
18
18
  direction?: DRAWER_DIRECTION;
@@ -39,7 +39,7 @@ var DRAWER_TRIGGER_STATUS;
39
39
  DRAWER_TRIGGER_STATUS["DISABLED"] = "DISABLED";
40
40
  })(DRAWER_TRIGGER_STATUS || (exports.DRAWER_TRIGGER_STATUS = DRAWER_TRIGGER_STATUS = {}));
41
41
  var DrawerComponent = (0, react_1.forwardRef)(function (props, ref) {
42
- var onOpen = props.onOpen, onClose = props.onClose, onToggle = props.onToggle, sx = props.sx, trigger = props.trigger, direction = props.direction, children = props.children, _a = props.triggerStatus, triggerStatus = _a === void 0 ? DRAWER_TRIGGER_STATUS.ENABLED : _a, onDismiss = props.onDismiss, disableSwipe = props.disableSwipe, className = props.className, rest = __rest(props, ["onOpen", "onClose", "onToggle", "sx", "trigger", "direction", "children", "triggerStatus", "onDismiss", "disableSwipe", "className"]);
42
+ var onOpen = props.onOpen, onClose = props.onDone, onToggle = props.onToggle, sx = props.sx, trigger = props.trigger, direction = props.direction, children = props.children, _a = props.triggerStatus, triggerStatus = _a === void 0 ? DRAWER_TRIGGER_STATUS.ENABLED : _a, onDismiss = props.onDismiss, disableSwipe = props.disableSwipe, className = props.className, rest = __rest(props, ["onOpen", "onDone", "onToggle", "sx", "trigger", "direction", "children", "triggerStatus", "onDismiss", "disableSwipe", "className"]);
43
43
  var _b = (0, react_1.useState)(false), isShowDrawerComponent = _b[0], setIsShowDrawerComponent = _b[1];
44
44
  var _c = (0, react_1.useState)(undefined), isOpen = _c[0], setIsOpen = _c[1];
45
45
  var lockStatus = function () {
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { BoxProps } from "@mui/material";
3
+ export interface FormatterProps extends BoxProps {
4
+ value?: number | string;
5
+ start?: string;
6
+ unit?: string;
7
+ lengthValueAllowed?: number;
8
+ allowShowZero?: boolean;
9
+ useCompact?: boolean;
10
+ useCompactOnThousand?: boolean;
11
+ disableTooltip?: boolean;
12
+ showLessThan?: boolean;
13
+ isNotCurrency?: boolean;
14
+ hideUnitOutSide?: boolean;
15
+ className?: string;
16
+ }
17
+ export declare const Formatter: React.FC<FormatterProps>;
18
+ export default Formatter;
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Formatter = void 0;
8
+ var jsx_runtime_1 = require("react/jsx-runtime");
9
+ var react_1 = require("react");
10
+ var CustomTooltip_1 = __importDefault(require("../CustomTooltip"));
11
+ var getStandardNumber_1 = __importDefault(require("./functions/getStandardNumber"));
12
+ var lengthFromDotToFirstNonZero_1 = __importDefault(require("./functions/lengthFromDotToFirstNonZero"));
13
+ var formatter_1 = __importDefault(require("./functions/formatter"));
14
+ var clsx_1 = __importDefault(require("clsx"));
15
+ var Formatter = function (_a) {
16
+ var value = _a.value, _b = _a.start, start = _b === void 0 ? "" : _b, _c = _a.unit, unit = _c === void 0 ? "" : _c, _d = _a.lengthValueAllowed, lengthValueAllowed = _d === void 0 ? 4 : _d, _e = _a.allowShowZero, allowShowZero = _e === void 0 ? false : _e, _f = _a.useCompact, useCompact = _f === void 0 ? true : _f, disableTooltip = _a.disableTooltip,
17
+ // showLessThan = false,
18
+ _g = _a.useCompactOnThousand,
19
+ // showLessThan = false,
20
+ useCompactOnThousand = _g === void 0 ? false : _g, _h = _a.isNotCurrency, isNotCurrency = _h === void 0 ? false : _h, _j = _a.hideUnitOutSide, hideUnitOutSide = _j === void 0 ? false : _j, className = _a.className;
21
+ // TODO: get user setting from backend
22
+ var userSetting = {
23
+ currency: "usd",
24
+ currencySymbol: "$",
25
+ rate: 1,
26
+ decimalDot: ".",
27
+ decimalComma: ",",
28
+ unitDirection: "right",
29
+ };
30
+ var valueInNumber = Number(value);
31
+ var addUnit = function (value) {
32
+ if (hideUnitOutSide)
33
+ return value;
34
+ var isLeft = userSetting.unitDirection === "left";
35
+ if (isLeft) {
36
+ return ((0, jsx_runtime_1.jsxs)("span", { className: (0, clsx_1.default)(className), children: [unit, " ", value] }));
37
+ }
38
+ return ((0, jsx_runtime_1.jsxs)("span", { className: (0, clsx_1.default)(className), children: [value, " ", unit] }));
39
+ };
40
+ var valueDisplay = (0, react_1.useCallback)(function () {
41
+ var returnFalsyValue = function () {
42
+ if (!allowShowZero)
43
+ return "--";
44
+ return (0, jsx_runtime_1.jsx)("span", { className: (0, clsx_1.default)(className), children: "0" });
45
+ };
46
+ if (isNaN(valueInNumber))
47
+ return returnFalsyValue();
48
+ if (valueInNumber === 0)
49
+ return returnFalsyValue();
50
+ var formattedNumber = (0, getStandardNumber_1.default)(valueInNumber);
51
+ // console.log("🚀 ~ formattedNumber:", formattedNumber);
52
+ // const beforeDot = formattedNumber.slice(0, formattedNumber.indexOf("."));
53
+ // console.log("🚀 ~ beforeDot:", beforeDot);
54
+ // const afterDot = formattedNumber.slice(formattedNumber.indexOf(".") + 1);
55
+ // console.log("🚀 ~ afterDot:", afterDot);
56
+ var lengthFromDot = (0, lengthFromDotToFirstNonZero_1.default)(formattedNumber);
57
+ // console.log("🚀 ~ lengthFromDot:", lengthFromDot);
58
+ // const useCompact = valueInNumber > 0 && valueInNumber < 0.01;
59
+ var useCompactInline = (formattedNumber === null || formattedNumber === void 0 ? void 0 : formattedNumber.length) > lengthValueAllowed;
60
+ // console.log("🚀 ~ useCompactInline:", useCompactInline);
61
+ // console.log("🚀 ~ valueInNumber:", valueInNumber);
62
+ if (useCompactInline) {
63
+ // if (showLessThan) {
64
+ // return (
65
+ // <span className={clsx(className)}>
66
+ // {start}
67
+ // {"< "}0{userSetting.decimalDot}01
68
+ // </span>
69
+ // );
70
+ // } else {
71
+ return ((0, jsx_runtime_1.jsxs)("span", { className: (0, clsx_1.default)(className), children: [start, "0.0", (0, jsx_runtime_1.jsx)("sub", { children: lengthFromDot }), formattedNumber.slice(2 + lengthFromDot, lengthValueAllowed - 1 + lengthFromDot)] }));
72
+ // }
73
+ }
74
+ return ((0, jsx_runtime_1.jsxs)("span", { className: (0, clsx_1.default)(className), children: [start, (0, formatter_1.default)(valueInNumber, useCompact, useCompactOnThousand, lengthValueAllowed)] }));
75
+ }, [
76
+ valueInNumber,
77
+ className,
78
+ start,
79
+ useCompact,
80
+ useCompactOnThousand,
81
+ lengthValueAllowed,
82
+ allowShowZero,
83
+ // showLessThan,
84
+ // userSetting.decimalDot,
85
+ ]);
86
+ var trigger = valueDisplay();
87
+ return ((0, jsx_runtime_1.jsx)(CustomTooltip_1.default, { disabled: disableTooltip, trigger: value ? addUnit(trigger) : trigger, sx: {
88
+ "& .MuiPaper-root": {
89
+ whiteSpace: "nowrap",
90
+ backdropFilter: "blur(10px)",
91
+ borderRadius: "0.37rem",
92
+ padding: "0.5rem 0.75rem",
93
+ fontSize: "1.05em",
94
+ fontWeight: 500,
95
+ lineHeight: "100%",
96
+ },
97
+ }, children: (0, jsx_runtime_1.jsx)(exports.Formatter, { disableTooltip: true, start: start, value: value, lengthValueAllowed: 18, useCompact: false, unit: unit, allowShowZero: true, isNotCurrency: isNotCurrency }) }));
98
+ };
99
+ exports.Formatter = Formatter;
100
+ exports.default = exports.Formatter;
@@ -400,7 +400,7 @@ var HistorySwap = function (props) {
400
400
  width: "100%",
401
401
  overflow: "hidden",
402
402
  },
403
- }, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
403
+ }, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, onDone: handleOnClose, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
404
404
  padding: 0,
405
405
  width: "100%",
406
406
  }, children: selectedItem && ((0, jsx_runtime_1.jsx)(DetailSwapResult_1.default, { onClose: handleCloseDetailDrawer, swapData: {
@@ -4,7 +4,7 @@ var jsx_runtime_1 = require("react/jsx-runtime");
4
4
  var qrcode_react_1 = require("qrcode.react");
5
5
  function QRCode(props) {
6
6
  var value = props.value, _a = props.size, size = _a === void 0 ? 156 : _a, logo = props.logo, title = props.title, _b = props.bgColor, bgColor = _b === void 0 ? "#ffffff" : _b;
7
- return ((0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeCanvas, { value: value, title: title, size: size, bgColor: bgColor, fgColor: "#044C2F", level: "L", minVersion: 8, marginSize: 4, imageSettings: {
7
+ return ((0, jsx_runtime_1.jsx)(qrcode_react_1.QRCodeCanvas, { value: value, title: title, size: size, bgColor: bgColor, fgColor: "#044C2F", level: "L", minVersion: 8, marginSize: 3, imageSettings: {
8
8
  src: logo || "/",
9
9
  x: undefined,
10
10
  y: undefined,
@@ -89,7 +89,7 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
89
89
  };
90
90
  }, []);
91
91
  var theme = (0, providers_1.useTheme)();
92
- return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { trigger: props.children, ref: drawerRef, onClose: onClose, onOpen: onOpen, sx: sx, className: className, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { sx: {
92
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { trigger: props.children, ref: drawerRef, onDone: onClose, onOpen: onOpen, sx: sx, className: className, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { sx: {
93
93
  backgroundColor: "transparent !important",
94
94
  }, header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { hideBack: true, title: "Scan QR code", sx: {
95
95
  position: "absolute",
@@ -429,7 +429,7 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (_a, ref) {
429
429
  var handleClearSearch = function () {
430
430
  setSearchValue("");
431
431
  };
432
- return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, sx: props.sx, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: RECEIVE_STEP_NAME[ReceiveStep.SELECT_METHOD], onClose: close, children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: stepDrawerRef, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, sx: {
432
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onDone: handleOnClose, sx: props.sx, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: RECEIVE_STEP_NAME[ReceiveStep.SELECT_METHOD], onClose: close, children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: stepDrawerRef, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, sx: {
433
433
  width: "100%",
434
434
  }, trigger: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content", width: "100%" }), children: [functionsList.includes(ReceiveMethods.RECEIVE_INTERNAL) && ((0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: "Top up via internal transfer", description: "Receive crypto from other Ting users", icon: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 24, height: 24 }, children: SvgPath_1.IC_RECEIVE_INTERNAL }), onClick: function () { return handleSelectMethod(ReceiveMethods.RECEIVE_INTERNAL); }, recommended: true })), functionsList.includes(ReceiveMethods.RECEIVE_EXTERNAL) && ((0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: "Top up via blockchain", description: "Deposit using a Web3 or an Exchange wallet", icon: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 24, height: 24 }, children: SvgPath_1.IC_RECEIVE_EXTERNAL }), onClick: function () { return handleSelectMethod(ReceiveMethods.RECEIVE_EXTERNAL); }, recommended: true })), functionsList.includes(ReceiveMethods.RECEIVE_FIAT) && ((0, jsx_runtime_1.jsx)(FiatDeposit_1.default, { children: (0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { title: "Fiat-Gateway", description: "Experimental deposit via bank transfer", icon: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 24, height: 24 }, children: SvgPath_1.IC_RECEIVE_EXTERNAL }), recommended: false, onClick: function () { return handleSelectMethod(ReceiveMethods.RECEIVE_FIAT); } }) }))] }), children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { sx: {
435
435
  position: "relative",
@@ -545,7 +545,7 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (_a, ref) {
545
545
  width: "100%",
546
546
  display: "flex",
547
547
  justifyContent: "center",
548
- }, onOpen: handleAmountModalOpen, onClose: onCloseAmountModal, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsxs)(Button_1.default.Text, { sx: {
548
+ }, onOpen: handleAmountModalOpen, onDone: onCloseAmountModal, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsxs)(Button_1.default.Text, { sx: {
549
549
  fontSize: theme.typography.fontSize14,
550
550
  textTransform: "none",
551
551
  fontWeight: theme.typography.fontWeight500,
@@ -411,7 +411,7 @@ var ReceiveHistory = function (props) {
411
411
  drawerRefs.current.detail = ref !== null && ref !== void 0 ? ref : undefined;
412
412
  }, sx: {
413
413
  width: "100%",
414
- }, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
414
+ }, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, onDone: handleOnClose, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
415
415
  padding: 0,
416
416
  width: "100dvw",
417
417
  }, children: selectedItem && ((0, jsx_runtime_1.jsx)(ReceiveHistoryDetails_1.default, { onClose: handleCloseDetailDrawer, receiveData: {
@@ -231,13 +231,13 @@ exports.SwapFunction = (0, react_1.forwardRef)(function (props, ref) {
231
231
  openHistory();
232
232
  }
233
233
  }, [isSwapPage, isHistoryPage, isHistoryDetailPage]);
234
- return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { className: className, sx: sx, ref: drawerRef, trigger: props.children, onOpen: handleOnOpenSwap, onClose: handleOnCloseSwap, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: SWAP_STEP_NAME[currentStep], overrideBack: handleBack, children: currentStep === SwapStep.SELECT_SWAP && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 18, height: 18 }, children: SvgPath_1.IC_HELP }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical", sx: {
234
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { className: className, sx: sx, ref: drawerRef, trigger: props.children, onOpen: handleOnOpenSwap, onDone: handleOnCloseSwap, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: SWAP_STEP_NAME[currentStep], overrideBack: handleBack, children: currentStep === SwapStep.SELECT_SWAP && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 18, height: 18 }, children: SvgPath_1.IC_HELP }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical", sx: {
235
235
  height: "1rem",
236
236
  width: "1px",
237
237
  backgroundColor: theme.palette.border.accent3,
238
238
  marginLeft: theme.mixins.customMargin.m4,
239
239
  marginRight: theme.mixins.customMargin.m4,
240
- } }), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: historyRef, trigger: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 18, height: 18 }, children: SvgPath_1.IC_HISTORY }), direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, onOpen: handleOnOpenHistory, onClose: handleOnCloseHistory, children: (0, jsx_runtime_1.jsx)(HistorySwap_1.default, { onClose: closeHistory }) })] })) }) }), footer: currentStep === SwapStep.SELECT_SWAP && ((0, jsx_runtime_1.jsx)(BottomActionLayout_1.default, { children: (0, jsx_runtime_1.jsx)(SwapToken_1.default
240
+ } }), (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: historyRef, trigger: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 18, height: 18 }, children: SvgPath_1.IC_HISTORY }), direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, onOpen: handleOnOpenHistory, onDone: handleOnCloseHistory, children: (0, jsx_runtime_1.jsx)(HistorySwap_1.default, { onClose: closeHistory }) })] })) }) }), footer: currentStep === SwapStep.SELECT_SWAP && ((0, jsx_runtime_1.jsx)(BottomActionLayout_1.default, { children: (0, jsx_runtime_1.jsx)(SwapToken_1.default
241
241
  // onResetNumber={resetNumber}
242
242
  , {
243
243
  // onResetNumber={resetNumber}
@@ -535,7 +535,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
535
535
  (0, react_1.useEffect)(function () {
536
536
  getEstimateFee();
537
537
  }, [getEstimateFee]);
538
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsxs)(ModalLayout_1.default, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
538
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onDone: handleOnClose, children: (0, jsx_runtime_1.jsxs)(ModalLayout_1.default, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
539
539
  width: "100%",
540
540
  display: "flex",
541
541
  alignItems: "center",
@@ -11,39 +11,6 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
- Object.defineProperty(o, "default", { enumerable: true, value: v });
27
- }) : function(o, v) {
28
- o["default"] = v;
29
- });
30
- var __importStar = (this && this.__importStar) || (function () {
31
- var ownKeys = function(o) {
32
- ownKeys = Object.getOwnPropertyNames || function (o) {
33
- var ar = [];
34
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
- return ar;
36
- };
37
- return ownKeys(o);
38
- };
39
- return function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- })();
47
14
  var __rest = (this && this.__rest) || function (s, e) {
48
15
  var t = {};
49
16
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -71,7 +38,7 @@ var ThemeProvider_1 = require("../../../providers/ThemeProvider");
71
38
  var AmountGroupAndChart_1 = __importDefault(require("../../ui/AmountGroupAndChart"));
72
39
  var link_1 = __importDefault(require("next/link"));
73
40
  var TekWalletProvider_1 = require("../../../providers/TekWalletProvider");
74
- var ReceiveFunction_1 = __importStar(require("../../ui/ReceiveFunction"));
41
+ var ReceiveFunction_1 = __importDefault(require("../../ui/ReceiveFunction"));
75
42
  var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
76
43
  var Menu_1 = __importDefault(require("./Menu"));
77
44
  var ActivitiesTypeSlice_1 = __importDefault(require("../../ui/ActivitiesTypeSlice"));
@@ -95,7 +62,7 @@ var AssetView = function (props) {
95
62
  router.back();
96
63
  };
97
64
  return ((0, jsx_runtime_1.jsxs)(ChildPageLayout_1.default, { header: !!isInitPasscode && (0, jsx_runtime_1.jsx)(AssetViewHeader_1.default, {}), children: [!isInitPasscode && !!masterWallet && ((0, jsx_runtime_1.jsx)(ChangePasscodeView_1.default, { isInitPasscode: true, onBack: handleBackInitPasscodeView, idPrefix: idPrefix })), !!isInitPasscode && ((0, jsx_runtime_1.jsxs)(DefaultPageLayout_1.default, __assign({}, rest, { sx: __assign({ display: "flex", flexDirection: "column", gap: theme.mixins.gaps.g16 }, sx), children: [useBasicAmountGroupInAssetView ? (0, jsx_runtime_1.jsx)(BasicAmountGroup_1.default, {}) : (0, jsx_runtime_1.jsx)(AmountGroupAndChart_1.default, {}), (0, jsx_runtime_1.jsx)(Menu_1.default, { items: [
98
- (0, jsx_runtime_1.jsx)(ReceiveFunction_1.default, { functionsList: Object.values(ReceiveFunction_1.ReceiveMethods), children: (0, jsx_runtime_1.jsx)(material_1.ListItem, { sx: {
65
+ (0, jsx_runtime_1.jsx)(ReceiveFunction_1.default, { children: (0, jsx_runtime_1.jsx)(material_1.ListItem, { sx: {
99
66
  borderRight: "1px solid ".concat(theme.palette.border.accent3),
100
67
  placeContent: "center",
101
68
  columnSpan: 1,
@@ -0,0 +1,2 @@
1
+ declare function LoadingView(): import("react/jsx-runtime").JSX.Element;
2
+ export default LoadingView;
@@ -0,0 +1,29 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var jsx_runtime_1 = require("react/jsx-runtime");
15
+ var material_1 = require("@mui/material");
16
+ var ThemeProvider_1 = require("../../../providers/ThemeProvider");
17
+ function LoadingView() {
18
+ var theme = (0, ThemeProvider_1.useTheme)();
19
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", gap: 2, flexDirection: "column", alignItems: "center", sx: { width: "100%" }, children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 64, height: 64 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4, alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", sx: {
20
+ transform: "scale(1)",
21
+ }, width: "40%", height: 42 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", sx: {
22
+ transform: "scale(1)",
23
+ }, width: "60%", height: 18 })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4 }), children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", sx: {
24
+ transform: "scale(1)",
25
+ }, width: "40%", height: 20 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", sx: {
26
+ transform: "scale(1)",
27
+ }, width: "100%", height: 40 })] })] }));
28
+ }
29
+ exports.default = LoadingView;
@@ -1,5 +1,41 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
14
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
3
39
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
40
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
41
  };
@@ -14,18 +50,68 @@ var ActivityDetail_1 = __importDefault(require("../../ui/ActivityDetail"));
14
50
  var EmptyData_1 = __importDefault(require("../../ui/EmptyData"));
15
51
  var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
16
52
  var DefaultPageLayout_1 = __importDefault(require("../../layouts/DefaultPageLayout"));
53
+ var get_activity_service_1 = __importDefault(require("../../../services/axios/get-activity-service"));
54
+ var LoadingView_1 = __importDefault(require("./LoadingView"));
55
+ var ActivityDataStatus;
56
+ (function (ActivityDataStatus) {
57
+ ActivityDataStatus["Loading"] = "loading";
58
+ ActivityDataStatus["NotFound"] = "not_found";
59
+ ActivityDataStatus["Error"] = "error";
60
+ ActivityDataStatus["Filled"] = "filled";
61
+ })(ActivityDataStatus || (ActivityDataStatus = {}));
17
62
  var DetailActivityView = function (props) {
18
63
  var sx = props.sx, id = props.id;
19
- var activities = (0, useWallet_1.default)().activities;
20
- var _a = (0, react_1.useState)(null), activityData = _a[0], setActivityData = _a[1];
64
+ var _a = (0, useWallet_1.default)(), masterWallet = _a.masterWallet, activities = _a.activities;
65
+ var _b = (0, react_1.useState)(ActivityDataStatus.Loading), activityDataStatus = _b[0], setActivityDataStatus = _b[1];
66
+ var _c = (0, react_1.useState)(null), activityData = _c[0], setActivityData = _c[1];
21
67
  (0, react_1.useEffect)(function () {
22
68
  var _a, _b;
69
+ if (!id) {
70
+ setActivityDataStatus(ActivityDataStatus.NotFound);
71
+ setActivityData(null);
72
+ return;
73
+ }
23
74
  if (activities) {
24
75
  var activity = (_b = (_a = Object.values(activities)) === null || _a === void 0 ? void 0 : _a.flat()) === null || _b === void 0 ? void 0 : _b.find(function (activity) { return "".concat(activity.id) === "".concat(id); });
25
- setActivityData(activity || null);
76
+ if (activity) {
77
+ setActivityData(activity);
78
+ setActivityDataStatus(ActivityDataStatus.Filled);
79
+ return;
80
+ }
81
+ }
82
+ if (!!masterWallet) {
83
+ (function () { return __awaiter(void 0, void 0, void 0, function () {
84
+ var response, error_1;
85
+ return __generator(this, function (_a) {
86
+ switch (_a.label) {
87
+ case 0:
88
+ _a.trys.push([0, 2, , 3]);
89
+ setActivityDataStatus(ActivityDataStatus.Loading);
90
+ return [4 /*yield*/, (0, get_activity_service_1.default)({ id: id })];
91
+ case 1:
92
+ response = _a.sent();
93
+ setActivityData(response.data);
94
+ setActivityDataStatus(ActivityDataStatus.Filled);
95
+ return [3 /*break*/, 3];
96
+ case 2:
97
+ error_1 = _a.sent();
98
+ console.error("🚀 ~ DetailActivityView ~ error:", error_1);
99
+ if (error_1.status === 404) {
100
+ setActivityDataStatus(ActivityDataStatus.NotFound);
101
+ setActivityData(null);
102
+ }
103
+ else {
104
+ setActivityDataStatus(ActivityDataStatus.Error);
105
+ setActivityData(null);
106
+ }
107
+ return [3 /*break*/, 3];
108
+ case 3: return [2 /*return*/];
109
+ }
110
+ });
111
+ }); })();
26
112
  }
27
- }, [activities, id]);
28
- return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Detail" }), sx: sx, children: (0, jsx_runtime_1.jsxs)(DefaultPageLayout_1.default, { children: [activityData && (0, jsx_runtime_1.jsx)(ActivityDetail_1.default, { activityData: activityData }), !activityData && ((0, jsx_runtime_1.jsx)(EmptyData_1.default, { sx: { marginBottom: "auto", marginTop: "4rem" }, icon: (0, getIcon_1.default)("empty_" + "all"), description: "Activity not found", children: "Activity not found" }))] }) }));
113
+ }, [activities, id, masterWallet]);
114
+ return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Detail" }), sx: sx, children: (0, jsx_runtime_1.jsxs)(DefaultPageLayout_1.default, { children: [activityDataStatus === ActivityDataStatus.Loading && (0, jsx_runtime_1.jsx)(LoadingView_1.default, {}), activityDataStatus === ActivityDataStatus.Filled && ((0, jsx_runtime_1.jsx)(ActivityDetail_1.default, { activityData: activityData })), activityDataStatus === ActivityDataStatus.NotFound && ((0, jsx_runtime_1.jsx)(EmptyData_1.default, { sx: { marginBottom: "auto", marginTop: "4rem" }, icon: (0, getIcon_1.default)("empty_" + "all"), description: "Activity not found" })), activityDataStatus === ActivityDataStatus.Error && ((0, jsx_runtime_1.jsx)(EmptyData_1.default, { sx: { marginBottom: "auto", marginTop: "4rem" }, icon: (0, getIcon_1.default)("error_" + "detail_activity"), description: "Something went wrong, please try again later" }))] }) }));
29
115
  };
30
116
  exports.DetailActivityView = DetailActivityView;
31
117
  exports.default = exports.DetailActivityView;
@@ -136,5 +136,5 @@ function Result(props) {
136
136
  display: "grid",
137
137
  gridTemplateColumns: "1fr",
138
138
  gap: theme.mixins.gaps.g8,
139
- }, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, onClick: onDone, children: "Done" }) })] }));
139
+ }, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, onClick: onDone, children: "Done c" }) })] }));
140
140
  }
@@ -112,7 +112,8 @@ var SendExternalView = (0, react_1.forwardRef)(function (props, ref) {
112
112
  setIsChangeSlidePromptly(true);
113
113
  }, []);
114
114
  var startNewTransaction = function () {
115
- gotoStep(SendExternalStep.SELECT_TOKEN);
115
+ // gotoStep(SendExternalStep.SELECT_TOKEN);
116
+ router.back();
116
117
  };
117
118
  (0, react_1.useEffect)(function () {
118
119
  if (isInitPasscode && !withdrawTokens) {
@@ -130,7 +131,7 @@ var SendExternalView = (0, react_1.forwardRef)(function (props, ref) {
130
131
  height: "100%",
131
132
  }, children: payload && ((0, jsx_runtime_1.jsx)(Summary_1.default, { estimateFee: estimateFee, payload: __assign(__assign({}, payload), { await_completion: true }), selectedToken: selectedToken, confirmProps: {
132
133
  onSuccess: handleSendSuccess,
133
- onClose: startNewTransaction,
134
+ onDone: startNewTransaction,
134
135
  } })) }) }, SendExternalStep.CONFIRM)] }) }));
135
136
  });
136
137
  SendExternalView.displayName = "SendExternalView";
@@ -87,7 +87,6 @@ exports.default = Form;
87
87
  var jsx_runtime_1 = require("react/jsx-runtime");
88
88
  var material_1 = require("@mui/material");
89
89
  var Input_1 = __importDefault(require("../../../ui/Input"));
90
- var Formatter_1 = __importDefault(require("../../../ui/Formatter"));
91
90
  var SvgPath_1 = require("../../../ui/SvgPath");
92
91
  var Text_1 = __importDefault(require("../../../ui/Text"));
93
92
  var providers_1 = require("../../../../providers");
@@ -105,6 +104,8 @@ var Fees_1 = __importStar(require("../../../ui/Fees"));
105
104
  var xhub_keyboard_1 = require("xhub-keyboard");
106
105
  var useUniqueId_1 = require("../../../../hooks/useUniqueId");
107
106
  var ChildPageLayout_1 = __importDefault(require("../../../layouts/ChildPageLayout"));
107
+ var Formatter_1 = __importDefault(require("../../../ui/Formatter"));
108
+ var navigation_1 = require("next/navigation");
108
109
  var validateAddressDebounce = (0, lodash_1.debounce)(function (callback) {
109
110
  callback();
110
111
  }, 500, { leading: true, trailing: true });
@@ -114,6 +115,8 @@ var getEstimateFeeDebounce = (0, lodash_1.debounce)(function (callback) {
114
115
  function Form(props) {
115
116
  var _this = this;
116
117
  var theme = (0, providers_1.useTheme)();
118
+ var searchParams = (0, navigation_1.useSearchParams)();
119
+ var address = searchParams.get("address") || "";
117
120
  var selectedToken = props.selectedToken, onContinue = props.onContinue, sx = props.sx;
118
121
  var _a = (0, react_1.useState)(""), recipientAddress = _a[0], setRecipientAddress = _a[1];
119
122
  var _b = (0, react_1.useState)(), recipientAddressError = _b[0], setRecipientAddressError = _b[1];
@@ -314,6 +317,13 @@ function Form(props) {
314
317
  var handleKeyboardClose = function () {
315
318
  setIsKeyboardOpen(false);
316
319
  };
320
+ (0, react_1.useEffect)(function () {
321
+ if (address) {
322
+ handleChangeRecipientAddress({
323
+ target: { value: address },
324
+ });
325
+ }
326
+ }, [address]);
317
327
  return ((0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { styles: {
318
328
  container: {
319
329
  height: "100%",
@@ -336,7 +346,7 @@ function Form(props) {
336
346
  fontSize: theme.typography.fontSize14,
337
347
  color: theme.palette.text.black,
338
348
  fontWeight: theme.typography.fontWeight700,
339
- }, children: "Withdrawal amount" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize11, color: theme.palette.text.accent }), children: "Your balance " }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize12, color: theme.palette.text.black, fontWeight: theme.typography.fontWeight700 }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.balance, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) })] })] }), (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Input, { elementsAcceptIds: ["form-amount-keyboard-id"], value: amount === null || amount === void 0 ? void 0 : amount.toString(), displayType: xhub_keyboard_1.DisplayType.Double, placeholder: ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
349
+ }, children: "Transfer amount" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8, alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize11, color: theme.palette.text.accent }), children: "Your balance " }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize12, color: theme.palette.text.black, fontWeight: theme.typography.fontWeight700 }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.balance, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) })] })] }), (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Input, { elementsAcceptIds: ["form-amount-keyboard-id"], value: amount === null || amount === void 0 ? void 0 : amount.toString(), displayType: xhub_keyboard_1.DisplayType.Double, placeholder: ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
340
350
  display: "inline-flex",
341
351
  alignItems: "center",
342
352
  gap: theme.mixins.gaps.g4,
@@ -108,9 +108,8 @@ exports.SendInternalView = (0, react_1.forwardRef)(function (props, ref) {
108
108
  gotoStep(currentStep - 1);
109
109
  };
110
110
  var handleCloseResult = (0, react_1.useCallback)(function () {
111
- gotoStep(TransferStep.SELECT_TOKEN);
112
- setIsChangeSlidePromptly(false);
113
- }, [gotoStep]);
111
+ router.back();
112
+ }, []);
114
113
  var gotoConfirmStep = function (payload, estimateFee) {
115
114
  gotoStep(TransferStep.CONFIRM);
116
115
  setPayload(payload);
@@ -143,7 +142,7 @@ exports.SendInternalView = (0, react_1.forwardRef)(function (props, ref) {
143
142
  paddingRight: "0px",
144
143
  paddingTop: "0px",
145
144
  paddingBottom: "0px",
146
- }, children: selectedToken && ((0, jsx_runtime_1.jsx)(Form_1.default, { sx: __assign({}, theme.mixins.pagePadding), selectedToken: selectedToken, onContinue: gotoConfirmStep }, clearFormKey)) }) }, TransferStep.FORM), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: { minHeight: "100%" }, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
145
+ }, children: selectedToken && ((0, jsx_runtime_1.jsx)(react_1.Suspense, { children: (0, jsx_runtime_1.jsx)(Form_1.default, { sx: __assign({}, theme.mixins.pagePadding), selectedToken: selectedToken, onContinue: gotoConfirmStep }, clearFormKey) })) }) }, TransferStep.FORM), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: { minHeight: "100%" }, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
147
146
  height: "100%",
148
147
  }, children: payload && ((0, jsx_runtime_1.jsx)(Summary_1.default, { estimateFee: estimateFee, payload: __assign(__assign({}, payload), { await_completion: true }), selectedToken: selectedToken, confirmProps: {
149
148
  onSuccess: handleSendSuccess,
@@ -150,9 +150,10 @@ var SwapView = function () {
150
150
  gotoStep(currentStep - 1);
151
151
  }, [currentStep, clearValues, router]);
152
152
  var handleNewTransaction = (0, react_1.useCallback)(function () {
153
- clearValues();
154
- gotoStep(SwapStep.FORM);
155
- setIsChangeSlidePromptly(false);
153
+ // clearValues();
154
+ // gotoStep(SwapStep.FORM);
155
+ // setIsChangeSlidePromptly(false);
156
+ router.back();
156
157
  }, [clearValues]);
157
158
  var handleOnSuccessSwap = (0, react_1.useCallback)(function () {
158
159
  setIsChangeSlidePromptly(true);
@@ -13,7 +13,6 @@ var useWallet_1 = __importDefault(require("./useWallet"));
13
13
  var useEventHandler = function () {
14
14
  var _a = (0, useWallet_1.default)(), updateLockToken = _a.updateLockToken, updateReceiveExternalToken = _a.updateReceiveExternalToken, updateReceiveInternalToken = _a.updateReceiveInternalToken, updateSendInternalToken = _a.updateSendInternalToken, updateSwapTokens = _a.updateSwapTokens, updateWalletDetail = _a.updateWalletDetail, updateWithdrawToken = _a.updateWithdrawToken, updateLockedToken = _a.updateLockedToken, updateActivities = _a.updateActivities;
15
15
  var updateData = (0, react_1.useCallback)(function (transactionType, showActivities) {
16
- console.warn("🚀 ~ useEventHandler ~ transactionType:", transactionType);
17
16
  updateWithdrawToken();
18
17
  updateSendInternalToken();
19
18
  updateReceiveInternalToken();
@@ -160,6 +160,7 @@ function WalletDataProviderNoImport(_a) {
160
160
  switch (_a.label) {
161
161
  case 0:
162
162
  _a.trys.push([0, 2, , 3]);
163
+ console.warn("🚀 ~ WalletDataProviderNoImport ~ isTokensLoading:", isTokensLoading);
163
164
  if (isTokensLoading)
164
165
  return [2 /*return*/];
165
166
  setIsTokensLoading(true);
@@ -0,0 +1,3 @@
1
+ import { GetActivityServiceQuery, GetActivitiesServiceResponse } from "./type";
2
+ declare const getActivityService: (params?: GetActivityServiceQuery) => Promise<GetActivitiesServiceResponse>;
3
+ export default getActivityService;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var userClientRequest_1 = __importDefault(require("../clients/userClientRequest"));
43
+ var getActivityService = function (params) { return __awaiter(void 0, void 0, void 0, function () {
44
+ var response;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0: return [4 /*yield*/, userClientRequest_1.default.get("/transaction/".concat(params === null || params === void 0 ? void 0 : params.id))];
48
+ case 1:
49
+ response = _a.sent();
50
+ return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
51
+ }
52
+ });
53
+ }); };
54
+ exports.default = getActivityService;
@@ -0,0 +1,10 @@
1
+ import { Transaction } from "../get-activities-service/type";
2
+ export interface GetActivityServiceQuery {
3
+ id: string;
4
+ }
5
+ export interface GetActivitiesServiceResponse {
6
+ success: boolean;
7
+ message: string;
8
+ data: Transaction;
9
+ timestamp: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -13,7 +13,7 @@ var useBalanceStore = (0, zustand_1.create)()((0, middleware_1.persist)(function
13
13
  setAnalytic: function (analytic) { return set({ analytic: analytic }); },
14
14
  tokens: undefined,
15
15
  setTokens: function (tokens) {
16
- var totalBalanceInUSD = tokens === null || tokens === void 0 ? void 0 : tokens.reduce(function (acc, token) { return acc + Number(token.total_value) * Number(token.usd_rate); }, 0);
16
+ var totalBalanceInUSD = tokens === null || tokens === void 0 ? void 0 : tokens.reduce(function (acc, token) { return acc + Number(token.current_value) * Number(token.usd_rate); }, 0);
17
17
  set({ tokens: tokens, totalBalanceInUSD: totalBalanceInUSD });
18
18
  },
19
19
  totalBalanceInUSD: undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.766",
3
+ "version": "0.0.768",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",