tek-wallet 0.0.738 → 0.0.740
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/TekWallet/components/ui/DrawerComponent/index.d.ts +0 -1
- package/dist/components/TekWallet/components/ui/DrawerComponent/index.js +13 -5
- package/dist/components/TekWallet/components/ui/ReceiveFunction/index.js +91 -84
- package/dist/components/TekWallet/hooks/useWarningWrongPasscode.d.ts +1 -0
- package/dist/components/TekWallet/hooks/useWarningWrongPasscode.js +16 -5
- package/package.json +1 -1
|
@@ -19,7 +19,6 @@ export interface DrawerComponentProps extends Omit<GeneralProps, "onClick" | "sx
|
|
|
19
19
|
disableSwipe?: boolean;
|
|
20
20
|
triggerStatus?: DRAWER_TRIGGER_STATUS;
|
|
21
21
|
onDismiss?: () => void;
|
|
22
|
-
draggable?: boolean;
|
|
23
22
|
}
|
|
24
23
|
export interface DrawerComponentRef {
|
|
25
24
|
open: () => void;
|
|
@@ -39,12 +39,13 @@ 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,
|
|
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"]);
|
|
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 () {
|
|
46
46
|
setIsOpen(isShowDrawerComponent);
|
|
47
47
|
};
|
|
48
|
+
var Component = (0, react_1.useMemo)(function () { return (isOpen !== undefined || disableSwipe ? material_1.Drawer : material_1.SwipeableDrawer); }, [isOpen, disableSwipe]);
|
|
48
49
|
var unlockStatus = function () {
|
|
49
50
|
setIsOpen(undefined);
|
|
50
51
|
};
|
|
@@ -69,6 +70,12 @@ var DrawerComponent = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
69
70
|
var newState = !isShowDrawerComponent;
|
|
70
71
|
setIsShowDrawerComponent(newState);
|
|
71
72
|
onToggle === null || onToggle === void 0 ? void 0 : onToggle(newState);
|
|
73
|
+
if (newState) {
|
|
74
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
78
|
+
}
|
|
72
79
|
};
|
|
73
80
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
74
81
|
open: handleOpen,
|
|
@@ -76,25 +83,26 @@ var DrawerComponent = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
76
83
|
lockStatus: lockStatus,
|
|
77
84
|
unlockStatus: unlockStatus,
|
|
78
85
|
}); });
|
|
79
|
-
var onDrawerClose = function () {
|
|
86
|
+
var onDrawerClose = function (e) {
|
|
80
87
|
setIsShowDrawerComponent(false);
|
|
88
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
81
89
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
82
90
|
};
|
|
83
91
|
var onDrawerOpen = function (e) {
|
|
84
92
|
setIsShowDrawerComponent(true);
|
|
85
93
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen(e);
|
|
86
94
|
};
|
|
87
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, sx), onClick: toggle, children: trigger }), (0, jsx_runtime_1.jsx)(
|
|
95
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ display: "block" }, sx), className: className, onClick: toggle, children: trigger }), (0, jsx_runtime_1.jsx)(Component, __assign({}, rest, { disableSwipeToOpen: true, sx: {
|
|
88
96
|
"& .MuiDrawer-paper": {
|
|
89
97
|
backgroundColor: "transparent",
|
|
90
98
|
overflow: "hidden",
|
|
91
99
|
boxShadow: "none",
|
|
92
100
|
},
|
|
93
|
-
}, anchor: direction ||
|
|
101
|
+
}, anchor: direction || DRAWER_DIRECTION.BOTTOM, open: isOpen !== null && isOpen !== void 0 ? isOpen : isShowDrawerComponent, onOpen: onDrawerOpen, onClose: onDrawerClose, ModalProps: {
|
|
94
102
|
onBackdropClick: function () {
|
|
95
103
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
96
104
|
},
|
|
97
|
-
},
|
|
105
|
+
}, children: children }))] }));
|
|
98
106
|
});
|
|
99
107
|
DrawerComponent.displayName = "DrawerComponent";
|
|
100
108
|
exports.default = DrawerComponent;
|
|
@@ -434,91 +434,98 @@ exports.ReceiveFunction = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
434
434
|
transition: currentStep === ReceiveStep.SHOW_QR_CODE
|
|
435
435
|
? "max-height 0.3s linear 0.3s"
|
|
436
436
|
: "max-height 0s linear",
|
|
437
|
-
}, children: (0, jsx_runtime_1.jsx)(Share_1.default, { elementId: "share-receive-info", onProgress: handleShareProgress, onFinish: handleShareFinish, imageName: sharedImageName, children: (0, jsx_runtime_1.jsx)(BottomActionLayout_1.default, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { fullWidth: true, status: isSharing ? Button_1.BUTTON_STATUS.LOADING : undefined, children: "Share" }) }) }) }), children: (0, jsx_runtime_1.
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
437
|
+
}, children: (0, jsx_runtime_1.jsx)(Share_1.default, { elementId: "share-receive-info", onProgress: handleShareProgress, onFinish: handleShareFinish, imageName: sharedImageName, children: (0, jsx_runtime_1.jsx)(BottomActionLayout_1.default, { children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { fullWidth: true, status: isSharing ? Button_1.BUTTON_STATUS.LOADING : undefined, children: "Share" }) }) }) }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { padding: theme.mixins.pagePadding }, children: [currentStep === ReceiveStep.SELECT_TOKEN && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
438
|
+
position: "sticky",
|
|
439
|
+
backgroundColor: theme.palette.background.white,
|
|
440
|
+
zIndex: 100,
|
|
441
|
+
top: "0px",
|
|
442
|
+
pb: theme.mixins.customPadding.p12,
|
|
443
|
+
}, children: [!isEmptyDepositTokens && ((0, jsx_runtime_1.jsx)(material_1.InputBase, { onChange: handleSearch, startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "start", children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: SvgPath_1.IC_SEARCH }) }), value: searchValue, placeholder: "Search", sx: {
|
|
444
|
+
borderRadius: theme.mixins.customRadius.r12,
|
|
445
|
+
border: "1px solid",
|
|
446
|
+
borderColor: theme.palette.border.accent3,
|
|
447
|
+
background: theme.palette.background.white,
|
|
448
|
+
color: theme.palette.text.black,
|
|
449
|
+
py: theme.mixins.customPadding.p6,
|
|
450
|
+
px: theme.mixins.customPadding.p12,
|
|
451
|
+
fontSize: theme.typography.fontSize16,
|
|
452
|
+
width: "100%",
|
|
453
|
+
lineHeight: "100%",
|
|
454
|
+
"input::placeholder": {
|
|
455
|
+
fontSize: theme.typography.fontSize12,
|
|
456
|
+
pl: theme.mixins.customPadding.p4,
|
|
457
|
+
fontWeight: theme.typography.fontWeight500,
|
|
458
|
+
color: theme.palette.text.black,
|
|
459
|
+
lineHeight: "100%",
|
|
460
|
+
},
|
|
461
|
+
}, endAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", sx: {
|
|
462
|
+
visibility: isSearching ? "visible" : "hidden",
|
|
463
|
+
}, children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: {
|
|
464
|
+
width: 20,
|
|
465
|
+
height: 20,
|
|
466
|
+
p: theme.mixins.customPadding.p4,
|
|
467
|
+
cursor: "pointer",
|
|
468
|
+
}, onClick: handleClearSearch, children: SvgPath_1.IC_CLOSE }) }) })), (tokenRender === null || tokenRender === void 0 ? void 0 : tokenRender.length) > 0 && (0, jsx_runtime_1.jsx)(SortGroup_1.default, { onChange: handleSort })] })), (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: stepSwiperRef, swiperProps: {
|
|
469
|
+
spaceBetween: 32,
|
|
470
|
+
}, disableSwipe: true, initialActiveTab: currentStep - 1, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: [isLoadingDepositTokens && (0, jsx_runtime_1.jsx)(WaitingData_1.default, {}), isEmptyDepositTokens && ((0, jsx_runtime_1.jsx)(EmptyData_1.default, { sx: { py: "4rem" }, title: "No deposit tokens", description: "No deposit tokens" })), isSearching && isEmptySearch && ((0, jsx_runtime_1.jsx)(EmptyData_1.default, { sx: { py: "4rem" }, title: "No search results", description: "Let's try again with a different search" })), tokenRender === null || tokenRender === void 0 ? void 0 : tokenRender.map(function (item, index) {
|
|
471
|
+
var stringifiedTokenData = JSON.stringify(item);
|
|
472
|
+
if (!item)
|
|
473
|
+
return null;
|
|
474
|
+
return ((0, jsx_runtime_1.jsx)(TokenSelection_1.default, { onClick: handleSelectToken, tokenData: stringifiedTokenData, active: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.id) === item.id }, "token_".concat(item.id, "_").concat(index)));
|
|
475
|
+
})] }) }, "slide_step_".concat(ReceiveStep.SELECT_TOKEN)), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, display: isExternal ? "flex" : "none" }), children: [(networks === null || networks === void 0 ? void 0 : networks.length) > 0 && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.paper), { borderRadius: theme.mixins.customRadius.r16, background: theme.palette.background.accent3, gap: theme.mixins.gaps.g2 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.fieldTitle), { fontWeight: theme.typography.fontWeight700, color: theme.palette.text.darkContrast }), children: "Choosing a network? Let us help!" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.activityDescription), { color: theme.palette.text.accent, fontWeight: theme.typography.fontWeight500 }), children: "Select the network used by your sending platform." }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: 0.125, alignItems: "center", children: [(0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: chooseNetworkSupportDrawerRef, sx: {
|
|
476
|
+
mt: 0.25,
|
|
477
|
+
}, trigger: (0, jsx_runtime_1.jsx)(Text_1.default, { component: "div", sx: {
|
|
478
|
+
color: theme.palette.primary.main,
|
|
479
|
+
fontWeight: theme.typography.fontWeight600,
|
|
480
|
+
fontSize: theme.typography.fontSize10,
|
|
481
|
+
lineHeight: "100%",
|
|
482
|
+
}, children: "Learn more" }), children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "How to choose my top up network", onClose: closeChooseNetworkSupport, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { component: "div", sx: __assign(__assign({}, theme.mixins.listDescription), { color: theme.palette.text.blackContrast }), children: "Lorem ipsum dolor sit amet consectetur. Vitae faucibus ornare lectus arcu sit sed et. Eu integer pharetra posuere lobortis varius dapibus risus. Pellentesque quis id diam ante lectus ornare tristique." }), (0, jsx_runtime_1.jsx)(Text_1.default, { component: "div", sx: __assign(__assign({}, theme.mixins.listDescription), { color: theme.palette.text.blackContrast }), children: "Eget viverra quis facilisis velit mattis. Risus sed egestas vitae ridiculus odio sit eu adipiscing. Scelerisque nunc nec nisl mauris venenatis viverra est dictumst adipiscing." }), (0, jsx_runtime_1.jsx)(Text_1.default, { component: "div", sx: __assign(__assign({}, theme.mixins.listDescription), { color: theme.palette.text.blackContrast }), children: "Id pulvinar aliquam quam ut sed ut pharetra turpis ipsum. Condimentum eget a interdum neque sagittis lobortis proin nisi. Magna id massa risus elit at." })] }) }) }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 6, height: 6, mt: "4px" }, children: (0, jsx_runtime_1.jsx)("svg", { width: "4", height: "6", viewBox: "0 0 4 6", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M3.7 3L0.7 6L0 5.3L2.3 3L0 0.7L0.7 0L3.7 3Z", fill: "#1C461D" }) }) })] })] })), networks === null || networks === void 0 ? void 0 : networks.map(function (item, index) {
|
|
483
|
+
if (!item)
|
|
484
|
+
return null;
|
|
485
|
+
return ((0, jsx_runtime_1.jsx)(NetworkSelection_1.default, { onClick: handleSelectNetwork, networkData: JSON.stringify(item), active: (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.id) === item.id, token: selectedToken }, "network_".concat(item.id, "_").concat(index)));
|
|
486
|
+
})] }) }, "slide_step_".concat(ReceiveStep.SELECT_NETWORK)), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
487
|
+
display: "flex",
|
|
488
|
+
flexDirection: "column",
|
|
489
|
+
gap: theme.mixins.gaps.g16,
|
|
490
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { id: "share-receive-info", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ width: "100%" }, theme.mixins.column), { gap: theme.mixins.gaps.g12, backgroundColor: theme.palette.background.tertiary, borderRadius: theme.mixins.customRadius.r16, padding: theme.mixins.customPadding.p16, paddingTop: "5rem", alignItems: "flex-start", position: "relative", marginTop: "4.6875rem" }), children: [(0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
491
|
+
color: theme.palette.border.accent,
|
|
492
|
+
width: "100%",
|
|
493
|
+
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.center), { top: 0, width: "fit-content", height: "fit-content", borderRadius: theme.mixins.customRadius.r12, padding: theme.mixins.customPadding.p8 }), children: [(0, jsx_runtime_1.jsx)(QRCode_1.default, { value: qrCodeValue, logo: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.link, bgColor: "transparent", size: 150 }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.center), { padding: theme.mixins.customPadding.p4, borderRadius: 9999, backgroundColor: theme.palette.background.white }), children: (0, jsx_runtime_1.jsx)(Icon_1.default, { crossOrigin: "anonymous", width: 24, height: 24, src: selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.link, sx: {
|
|
494
|
+
borderRadius: 9999,
|
|
495
|
+
} }) })] }), isExternal && ((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)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: "Network" }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), onClick: handleBack, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { component: "button", sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4, cursor: "pointer", transition: "transform 0.3s ease-in-out", "&:active": {
|
|
496
|
+
transform: "translateX(0.5rem)",
|
|
497
|
+
} }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 24, height: 24, sx: {
|
|
498
|
+
borderRadius: "9999px",
|
|
499
|
+
}, src: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.link }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.name })] }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: {
|
|
500
|
+
width: 12,
|
|
501
|
+
height: 12,
|
|
502
|
+
ml: "auto",
|
|
503
|
+
transform: "rotate(90deg)",
|
|
504
|
+
}, children: SvgPath_1.IC_CHEVRON_RIGHT })] })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g4 }), children: [(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)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: isInternal ? "Internal address" : "Address" }), isInternal && ((0, jsx_runtime_1.jsx)(CustomTooltip_1.default, { trigger: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 16, height: 16, mb: "3px" }, children: SvgPath_1.IC_TOOLTIP }), children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.warning), children: ["This address is used to receive token by internal transfer. You can not use it for blockchain transaction. If you want to receive token by blockchain, please select the ", (0, jsx_runtime_1.jsx)("strong", { children: "Receive External" }), " method instead."] }) }) }))] }), (0, jsx_runtime_1.jsxs)(CopyTextComponent_1.default, { sx: __assign(__assign({}, theme.mixins.row), { justifyContent: "space-between" }), value: receiveAddress || "", children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { wordBreak: "break-all", maxWidth: "85%" }), children: receiveAddress }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: SvgPath_1.IC_COPY })] })] }), (!!userInfo || !!amount || isExternal || !!warningMessage) && ((0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
505
|
+
color: theme.palette.border.accent,
|
|
506
|
+
width: "100%",
|
|
507
|
+
} })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ width: "100%" }, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [!!userInfo && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { sx: {
|
|
508
|
+
alignItems: "start",
|
|
509
|
+
}, field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.accent, fontSize: theme.typography.fontSize13 }), children: "Received user" }), value: (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)(Icon_1.default, { width: 16, height: 16, src: userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar, sx: {
|
|
491
510
|
borderRadius: "9999px",
|
|
492
|
-
},
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
display: "flex",
|
|
511
|
-
justifyContent: "center",
|
|
512
|
-
}, onOpen: handleAmountModalOpen, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsxs)(Button_1.default.Text, { sx: {
|
|
513
|
-
fontSize: theme.typography.fontSize14,
|
|
514
|
-
textTransform: "none",
|
|
515
|
-
fontWeight: theme.typography.fontWeight500,
|
|
516
|
-
display: "flex",
|
|
517
|
-
alignItems: "center",
|
|
518
|
-
gap: theme.mixins.gaps.g4,
|
|
519
|
-
}, children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: amount ? SvgPath_1.IC_EDIT : SvgPath_1.IC_SET }), amount ? "Edit" : "Set", " amount"] }) }), children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { id: keyboardId, onChange: handleChangeAmount, keyboardType: xhub_keyboard_1.KeyboardType.Double, value: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.toString(), keyboardId: "amount-keyboard-id", children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { onClose: function () { var _a; return (_a = amountDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, title: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: [amount ? "Edit" : "Set", " ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name, " amount"] }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Input, { ref: amountInputRef, elementsAcceptIds: ["amount-keyboard-id"], value: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.toString(), displayType: xhub_keyboard_1.DisplayType.Double, rightElement: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { onClick: handleClickMaxAmount, sx: __assign({}, theme.mixins.smallButton), children: "Max" }) }) }), amountError && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: amountError })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%", mt: theme.mixins.customMargin.m8, gap: theme.mixins.gaps.g12 }), children: [!!amount && ((0, jsx_runtime_1.jsx)(Button_1.default.Text, { onClick: handleUnset, children: "Unset" })), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { flex: 1 }, onClick: handleContinue, status: !!amountError
|
|
520
|
-
? Button_1.BUTTON_STATUS.DISABLED
|
|
521
|
-
: Button_1.BUTTON_STATUS.ENABLED, children: "Continue" })] })] }) }) }) }))] }) }, "slide_step_".concat(ReceiveStep.SHOW_QR_CODE))] }) }) }) }) }) }) }));
|
|
511
|
+
} }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g2 }), children: (0, jsx_runtime_1.jsxs)(Text_1.default, { children: [userInfo === null || userInfo === void 0 ? void 0 : userInfo.nickname, " "] }) })] }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { children: userInfo === null || userInfo === void 0 ? void 0 : userInfo.username }) })), !!amount && ((0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.accent, fontSize: theme.typography.fontSize13 }), children: "Amount" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize13 }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name) }) }) })), isExternal && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.accent, fontSize: theme.typography.fontSize13 }), children: "Top Up Arrival Time" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize13 }), children: "~ 7 Minutes" }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.valueDescription), { color: theme.palette.text.accent, fontSize: theme.typography.fontSize13 }), children: "Withdrawal Arrival Time" }), value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { fontSize: theme.typography.fontSize13 }), children: "~ 20 Minutes" }) })] }))] }), !!warningMessage && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
512
|
+
color: theme.palette.border.accent,
|
|
513
|
+
width: "100%",
|
|
514
|
+
mt: theme.mixins.customMargin.m12,
|
|
515
|
+
} }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.valueDescription), children: warningMessage })] }))] }) }), isInternal && ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: amountDrawerRef, sx: {
|
|
516
|
+
width: "100%",
|
|
517
|
+
display: "flex",
|
|
518
|
+
justifyContent: "center",
|
|
519
|
+
}, onOpen: handleAmountModalOpen, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsxs)(Button_1.default.Text, { sx: {
|
|
520
|
+
fontSize: theme.typography.fontSize14,
|
|
521
|
+
textTransform: "none",
|
|
522
|
+
fontWeight: theme.typography.fontWeight500,
|
|
523
|
+
display: "flex",
|
|
524
|
+
alignItems: "center",
|
|
525
|
+
gap: theme.mixins.gaps.g4,
|
|
526
|
+
}, children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 20, height: 20 }, children: amount ? SvgPath_1.IC_EDIT : SvgPath_1.IC_SET }), amount ? "Edit" : "Set", " amount"] }) }), children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { id: keyboardId, onChange: handleChangeAmount, keyboardType: xhub_keyboard_1.KeyboardType.Double, value: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.toString(), keyboardId: "amount-keyboard-id", children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { onClose: function () { var _a; return (_a = amountDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, title: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: [amount ? "Edit" : "Set", " ", selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name, " amount"] }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Input, { ref: amountInputRef, elementsAcceptIds: ["amount-keyboard-id"], value: inputAmount === null || inputAmount === void 0 ? void 0 : inputAmount.toString(), displayType: xhub_keyboard_1.DisplayType.Double, rightElement: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { onClick: handleClickMaxAmount, sx: __assign({}, theme.mixins.smallButton), children: "Max" }) }) }), amountError && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: amountError })), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%", mt: theme.mixins.customMargin.m8, gap: theme.mixins.gaps.g12 }), children: [!!amount && ((0, jsx_runtime_1.jsx)(Button_1.default.Text, { onClick: handleUnset, children: "Unset" })), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { flex: 1 }, onClick: handleContinue, status: !!amountError
|
|
527
|
+
? Button_1.BUTTON_STATUS.DISABLED
|
|
528
|
+
: Button_1.BUTTON_STATUS.ENABLED, children: "Continue" })] })] }) }) }) }))] }) }, "slide_step_".concat(ReceiveStep.SHOW_QR_CODE))] })] }) }) }) }) }) }));
|
|
522
529
|
});
|
|
523
530
|
exports.ReceiveFunction.displayName = "ReceiveFunction";
|
|
524
531
|
exports.default = exports.ReceiveFunction;
|
|
@@ -68,10 +68,11 @@ var ValidatePasscodeResult;
|
|
|
68
68
|
})(ValidatePasscodeResult || (exports.ValidatePasscodeResult = ValidatePasscodeResult = {}));
|
|
69
69
|
function useValidatePasscode() {
|
|
70
70
|
var _this = this;
|
|
71
|
-
var _a = (0, react_1.useState)(
|
|
72
|
-
var _b = (0, react_1.useState)(
|
|
73
|
-
var _c = (0, react_1.useState)(
|
|
74
|
-
var _d = (0,
|
|
71
|
+
var _a = (0, react_1.useState)(false), isLoading = _a[0], setIsLoading = _a[1];
|
|
72
|
+
var _b = (0, react_1.useState)(null), warningContent = _b[0], setWarningContent = _b[1];
|
|
73
|
+
var _c = (0, react_1.useState)(false), isLocked = _c[0], setIsLocked = _c[1];
|
|
74
|
+
var _d = (0, react_1.useState)(null), unknownError = _d[0], setUnknownError = _d[1];
|
|
75
|
+
var _e = (0, useWalletData_1.default)(), policyInfo = _e.policyInfo, isTokensLoading = _e.isTokensLoading, isInitPasscode = _e.isInitPasscode;
|
|
75
76
|
var theme = (0, providers_1.useTheme)();
|
|
76
77
|
var formatTime = (0, useConvertTime_1.useConvertTime)().formatTime;
|
|
77
78
|
var initialized = (0, react_1.useRef)(false);
|
|
@@ -120,9 +121,11 @@ function useValidatePasscode() {
|
|
|
120
121
|
switch (_a.label) {
|
|
121
122
|
case 0:
|
|
122
123
|
_a.trys.push([0, 2, , 3]);
|
|
124
|
+
setIsLoading(true);
|
|
123
125
|
return [4 /*yield*/, (0, authentication_by_passcode_service_1.default)(data)];
|
|
124
126
|
case 1:
|
|
125
127
|
response = _a.sent();
|
|
128
|
+
setIsLoading(false);
|
|
126
129
|
setUnknownError(null);
|
|
127
130
|
if (response === null || response === void 0 ? void 0 : response.success) {
|
|
128
131
|
handleCheckPolicyInfo(null);
|
|
@@ -134,6 +137,7 @@ function useValidatePasscode() {
|
|
|
134
137
|
case 2:
|
|
135
138
|
err_1 = _a.sent();
|
|
136
139
|
console.error("handleVerifyPasscode", err_1);
|
|
140
|
+
setIsLoading(false);
|
|
137
141
|
setUnknownError((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: "Something went wrong, please try again later." }));
|
|
138
142
|
return [2 /*return*/, ValidatePasscodeResult.UNKNOWN_ERROR];
|
|
139
143
|
case 3: return [2 /*return*/];
|
|
@@ -149,5 +153,12 @@ function useValidatePasscode() {
|
|
|
149
153
|
initialized.current = true;
|
|
150
154
|
handleCheckPolicyInfo(policyInfo || null);
|
|
151
155
|
}, [policyInfo, isTokensLoading, handleCheckPolicyInfo, isInitPasscode]);
|
|
152
|
-
return {
|
|
156
|
+
return {
|
|
157
|
+
warningContent: warningContent,
|
|
158
|
+
handleVerifyPasscode: handleVerifyPasscode,
|
|
159
|
+
isLocked: isLocked,
|
|
160
|
+
unknownError: unknownError,
|
|
161
|
+
handleClearUnknownError: handleClearUnknownError,
|
|
162
|
+
isLoading: isLoading,
|
|
163
|
+
};
|
|
153
164
|
}
|