tek-wallet 0.0.737 → 0.0.738

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 (67) hide show
  1. package/dist/components/TekWallet/components/ui/Button/index.js +1 -1
  2. package/dist/components/TekWallet/components/ui/ConfirmByPasscode/index.js +23 -31
  3. package/dist/components/TekWallet/components/ui/EmptyData/index.js +1 -2
  4. package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareAction.d.ts +8 -0
  5. package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareAction.js +149 -0
  6. package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareDrawer.d.ts +8 -0
  7. package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareDrawer.js +21 -0
  8. package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareImage.d.ts +9 -0
  9. package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareImage.js +125 -0
  10. package/dist/components/TekWallet/components/ui/FiatDeposit/index.d.ts +5 -0
  11. package/dist/components/TekWallet/components/ui/FiatDeposit/index.js +254 -0
  12. package/dist/components/TekWallet/components/ui/Formatter/index.js +9 -8
  13. package/dist/components/TekWallet/components/ui/HistorySwap/index.js +2 -3
  14. package/dist/components/TekWallet/components/ui/ListItemCustom/index.d.ts +2 -1
  15. package/dist/components/TekWallet/components/ui/ListItemCustom/index.js +9 -2
  16. package/dist/components/TekWallet/components/ui/LoadingLayout/index.d.ts +2 -0
  17. package/dist/components/TekWallet/components/ui/LoadingLayout/index.js +3 -3
  18. package/dist/components/TekWallet/components/ui/OTP/index.d.ts +1 -0
  19. package/dist/components/TekWallet/components/ui/OTP/index.js +3 -1
  20. package/dist/components/TekWallet/components/ui/PageHeader/index.js +1 -1
  21. package/dist/components/TekWallet/components/ui/QRCode/index.js +1 -1
  22. package/dist/components/TekWallet/components/ui/QrCodeReader/index.js +4 -1
  23. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/HelpButton.d.ts +2 -0
  24. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/HelpButton.js +53 -0
  25. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/HelpView.d.ts +5 -0
  26. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/HelpView.js +80 -0
  27. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/SortGroup.d.ts +10 -0
  28. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/SortGroup.js +64 -0
  29. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/SortTool.d.ts +11 -0
  30. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/{sortByBalance.js → SortTool.js} +20 -19
  31. package/dist/components/TekWallet/components/ui/ReceiveFunction/index.d.ts +9 -1
  32. package/dist/components/TekWallet/components/ui/ReceiveFunction/index.js +198 -86
  33. package/dist/components/TekWallet/components/ui/ReceiveHistory/index.js +3 -4
  34. package/dist/components/TekWallet/components/ui/SvgPath/index.d.ts +4 -0
  35. package/dist/components/TekWallet/components/ui/SvgPath/index.js +7 -3
  36. package/dist/components/TekWallet/components/ui/TimeText/index.d.ts +5 -0
  37. package/dist/components/TekWallet/components/ui/TimeText/index.js +22 -0
  38. package/dist/components/TekWallet/components/views/ChangePasscodeView/index.js +24 -10
  39. package/dist/components/TekWallet/hooks/useConvertTime.d.ts +3 -0
  40. package/dist/components/TekWallet/hooks/useConvertTime.js +25 -0
  41. package/dist/components/TekWallet/hooks/useEventHandler.js +7 -10
  42. package/dist/components/TekWallet/hooks/useFormatter.d.ts +2 -0
  43. package/dist/components/TekWallet/hooks/useFormatter.js +2 -0
  44. package/dist/components/TekWallet/hooks/useWarningWrongPasscode.d.ts +14 -0
  45. package/dist/components/TekWallet/hooks/useWarningWrongPasscode.js +153 -0
  46. package/dist/components/TekWallet/providers/WalletDataProviderNoImport/index.js +5 -2
  47. package/dist/components/TekWallet/services/axios/authentication-by-passcode-service/index.d.ts +1 -1
  48. package/dist/components/TekWallet/services/axios/authentication-by-passcode-service/index.js +9 -19
  49. package/dist/components/TekWallet/services/axios/authentication-by-passcode-service/type.d.ts +14 -0
  50. package/dist/components/TekWallet/services/axios/get-deposit-fiat-info-service/getDepositFiatInfoService.d.ts +13 -0
  51. package/dist/components/TekWallet/services/axios/get-deposit-fiat-info-service/getDepositFiatInfoService.js +55 -0
  52. package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/components.d.ts +3 -0
  53. package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/components.js +158 -0
  54. package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/palette.d.ts +55 -0
  55. package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/palette.js +45 -0
  56. package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/theme.d.ts +2 -0
  57. package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/theme.js +13 -0
  58. package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/typography.d.ts +39 -0
  59. package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/typography.js +65 -0
  60. package/dist/components/TekWallet/theme/mui/theme.js +6 -6
  61. package/dist/components/TekWallet/types/expose-type.d.ts +49 -0
  62. package/dist/components/TekWallet/utils/cn.d.ts +2 -0
  63. package/dist/components/TekWallet/utils/cn.js +12 -0
  64. package/dist/components/TekWallet/utils/formatDate.d.ts +9 -6
  65. package/dist/components/TekWallet/utils/formatDate.js +410 -91
  66. package/package.json +5 -2
  67. package/dist/components/TekWallet/components/ui/ReceiveFunction/components/sortByBalance.d.ts +0 -11
@@ -56,7 +56,7 @@ Button.Primary = function (props) {
56
56
  // color: theme.palette.text.white24,
57
57
  // },
58
58
  // };
59
- return ((0, jsx_runtime_1.jsxs)(Button, __assign({}, rest, { variant: "contained", status: status, sx: __assign({ backgroundColor: theme.palette.background.primary, color: theme.palette.text.secondary, borderRadius: theme.mixins.customRadius.r12, textTransform: "capitalize", position: "relative", px: theme.mixins.customPadding.p16, py: theme.mixins.customPadding.p10, fontWeight: 600 }, sx), disabled: status !== BUTTON_STATUS.ENABLED, children: [status === BUTTON_STATUS.LOADING && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
59
+ return ((0, jsx_runtime_1.jsxs)(Button, __assign({}, rest, { variant: "contained", status: status, sx: __assign({ backgroundColor: theme.palette.background.primary, color: theme.palette.text.secondary, borderRadius: theme.mixins.customRadius.r12, textTransform: "capitalize", position: "relative", px: theme.mixins.customPadding.p16, py: theme.mixins.customPadding.p10, fontWeight: theme.typography.fontWeight500 }, sx), disabled: status !== BUTTON_STATUS.ENABLED, children: [status === BUTTON_STATUS.LOADING && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
60
60
  position: "absolute",
61
61
  inset: 0,
62
62
  display: "flex",
@@ -87,48 +87,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
87
87
  var jsx_runtime_1 = require("react/jsx-runtime");
88
88
  var OTP_1 = __importStar(require("../OTP"));
89
89
  var react_1 = require("react");
90
- var Text_1 = __importDefault(require("../Text"));
91
90
  var ModalLayout_1 = __importDefault(require("../ModalLayout"));
92
91
  var material_1 = require("@mui/material");
93
92
  var ThemeProvider_1 = require("../../../providers/ThemeProvider");
94
93
  var LoadingLayout_1 = __importDefault(require("../LoadingLayout"));
95
94
  var DrawerComponent_1 = __importDefault(require("../DrawerComponent"));
96
- var authentication_by_passcode_service_1 = __importDefault(require("../../../services/axios/authentication-by-passcode-service"));
97
95
  var xhub_keyboard_1 = require("xhub-keyboard");
98
96
  var useUniqueId_1 = require("../../../hooks/useUniqueId");
99
97
  var xhub_keyboard_2 = require("xhub-keyboard");
100
- var handleVerifyPasscode = function (data) { return __awaiter(void 0, void 0, void 0, function () {
101
- var response, err_1;
102
- return __generator(this, function (_a) {
103
- switch (_a.label) {
104
- case 0:
105
- _a.trys.push([0, 2, , 3]);
106
- return [4 /*yield*/, (0, authentication_by_passcode_service_1.default)(data)];
107
- case 1:
108
- response = _a.sent();
109
- return [2 /*return*/, response === null || response === void 0 ? void 0 : response.success];
110
- case 2:
111
- err_1 = _a.sent();
112
- console.error("handleVerifyPasscode", err_1);
113
- return [2 /*return*/, false];
114
- case 3: return [2 /*return*/];
115
- }
116
- });
117
- }); };
98
+ var useWarningWrongPasscode_1 = require("../../../hooks/useWarningWrongPasscode");
99
+ var clsx_1 = __importDefault(require("clsx"));
118
100
  var passcodeLength = 6;
119
101
  var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
120
102
  var onConfirmSuccess = props.onConfirmSuccess;
121
103
  var theme = (0, ThemeProvider_1.useTheme)();
122
104
  var _a = (0, react_1.useState)(""), passcode = _a[0], setPasscode = _a[1];
123
105
  var loadingRef = (0, react_1.useRef)(null);
124
- var _b = (0, react_1.useState)(""), authError = _b[0], setAuthError = _b[1];
106
+ var _b = (0, useWarningWrongPasscode_1.useValidatePasscode)(), handleVerifyPasscode = _b.handleVerifyPasscode, warningContent = _b.warningContent, isLocked = _b.isLocked, handleClearUnknownError = _b.handleClearUnknownError, unknownError = _b.unknownError;
125
107
  var keyboardId = (0, useUniqueId_1.useUniqueId)("confirm-passcode-keyboard");
126
108
  var keyboardRef = (0, react_1.useRef)(null);
127
109
  var drawerRef = (0, react_1.useRef)(null);
128
110
  var handleBlurAll = (0, xhub_keyboard_2.useBlurAll)().handleBlurAll;
129
111
  var handleCleardata = function () {
130
112
  setPasscode("");
131
- setAuthError("");
113
+ handleClearUnknownError();
132
114
  };
133
115
  var handleClose = (0, react_1.useCallback)(function () {
134
116
  var _a, _b;
@@ -165,7 +147,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
165
147
  handleCleardata();
166
148
  };
167
149
  var handlePasscodeChange = (0, react_1.useCallback)(function (value) { return __awaiter(void 0, void 0, void 0, function () {
168
- var isAuth, err_2;
150
+ var result, err_1;
169
151
  var _a, _b;
170
152
  return __generator(this, function (_c) {
171
153
  switch (_c.label) {
@@ -183,40 +165,50 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
183
165
  passcode: value,
184
166
  })];
185
167
  case 2:
186
- isAuth = _c.sent();
187
- if (isAuth) {
168
+ result = _c.sent();
169
+ console.warn("🚀 ~ result:", result);
170
+ if (result === useWarningWrongPasscode_1.ValidatePasscodeResult.SUCCESS) {
188
171
  handleClose();
189
172
  onConfirmSuccess === null || onConfirmSuccess === void 0 ? void 0 : onConfirmSuccess(value);
190
173
  }
174
+ else if (result === useWarningWrongPasscode_1.ValidatePasscodeResult.WRONG_PASSCODE) {
175
+ setPasscode("");
176
+ }
191
177
  else {
192
- setAuthError("Invalid passcode");
193
178
  setPasscode("");
194
179
  }
195
180
  (_b = loadingRef.current) === null || _b === void 0 ? void 0 : _b.endLoading();
196
181
  _c.label = 3;
197
182
  case 3: return [3 /*break*/, 5];
198
183
  case 4:
199
- err_2 = _c.sent();
200
- console.error(err_2);
184
+ err_1 = _c.sent();
185
+ console.error(err_1);
201
186
  return [3 /*break*/, 5];
202
187
  case 5: return [2 /*return*/];
203
188
  }
204
189
  });
205
- }); }, [handleClose, onConfirmSuccess]);
190
+ }); }, [handleClose, onConfirmSuccess, passcode]);
206
191
  return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { style: {
207
192
  width: "100%",
208
193
  }, useBrowserInput: false, htmlFor: keyboardId, children: props.children }), onOpen: handleOnOpen, onClose: handleOnClose, triggerStatus: props.triggerStatus, sx: {
209
194
  width: "100%",
210
195
  maxWidth: "calc(100dvw - 2rem)",
211
196
  display: "flex",
212
- }, 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, children: (0, jsx_runtime_1.jsx)(LoadingLayout_1.default, { initLoading: false, ref: loadingRef, sx: {
197
+ }, 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, classNames: {
198
+ keyboardContainer: (0, clsx_1.default)({
199
+ "!hidden": isLocked,
200
+ }),
201
+ }, children: (0, jsx_runtime_1.jsx)(LoadingLayout_1.default, { initLoading: false, ref: loadingRef, sx: {
213
202
  backgroundColor: "transparent",
214
203
  width: "100%",
204
+ borderRadius: "1.5rem 1.5rem 0 0",
205
+ }, overlaySx: {
206
+ borderRadius: "1.5rem 1.5rem 0 0",
215
207
  }, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: "Enter Passcode", onClose: handleClose, sx: {
216
208
  backgroundColor: theme.palette.background.tertiary,
217
209
  }, 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: {
218
210
  width: "100%",
219
- }, useBrowserInput: false, htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(OTP_1.default, { value: passcode, onChange: handlePasscodeChange, 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 }))] }) }) }) }) }));
211
+ }, useBrowserInput: false, htmlFor: keyboardId, children: (0, jsx_runtime_1.jsx)(OTP_1.default, { disabled: isLocked, value: passcode, onChange: handlePasscodeChange, numInputs: passcodeLength, otpInputType: OTP_1.OtpInputType.CONFIRM_BY_PASSCODE }) }), warningContent, unknownError] }) }) }) }) }));
220
212
  });
221
213
  ConfirmByPasscode.displayName = "ConfirmByPasscode";
222
214
  exports.default = ConfirmByPasscode;
@@ -18,10 +18,9 @@ var jsx_runtime_1 = require("react/jsx-runtime");
18
18
  var material_1 = require("@mui/material");
19
19
  var ThemeProvider_1 = require("../../../providers/ThemeProvider");
20
20
  var Text_1 = __importDefault(require("../Text"));
21
- var Icon_1 = __importDefault(require("../Icon"));
22
21
  var Button_1 = __importDefault(require("../Button"));
23
22
  function EmptyData(props) {
24
23
  var theme = (0, ThemeProvider_1.useTheme)();
25
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16, alignItems: "center", justifyContent: "center" }), props.sx), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 48, src: props.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionTitle), children: props.title }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionDescription), children: props.description }), props.action && (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { onClick: props.action, children: props.actionText })] }));
24
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16, alignItems: "center", justifyContent: "center" }), props.sx), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 62, height: 62 }, children: (0, jsx_runtime_1.jsxs)("svg", { width: "63", height: "62", viewBox: "0 0 63 62", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M46.0312 23.25H21.7544C21.4638 23.25 21.1925 23.1241 21.0084 22.9012L17.3272 18.4837C16.775 17.8153 15.9612 17.4375 15.0991 17.4375H5.34375C3.74531 17.4375 2.4375 18.7453 2.4375 20.3438V59.0938C2.4375 59.4231 2.61188 59.7331 2.89281 59.9172C3.04781 60.0141 3.23188 60.0625 3.40625 60.0625C3.55156 60.0625 3.68719 60.0334 3.82281 59.9656L48.3853 38.6531C48.7244 38.4884 48.9375 38.1494 48.9375 37.7812V26.1562C48.9375 24.5578 47.6297 23.25 46.0312 23.25Z", fill: "#A3A3A3" }), (0, jsx_runtime_1.jsx)("path", { d: "M60.2912 37.7522C59.9425 37.1613 59.3225 36.8125 58.6347 36.8125H15.535C14.8278 36.8125 14.1787 37.2 13.8397 37.8297L2.55373 58.6287C2.38904 58.9291 2.39873 59.2972 2.5731 59.5878C2.74748 59.8784 3.06717 60.0625 3.40623 60.0625H46.9709C48.3853 60.0625 49.6834 59.2875 50.3615 58.0378L60.3203 39.6703C60.6497 39.06 60.64 38.3431 60.2815 37.7522H60.2912Z", fill: "#1C461D" }), (0, jsx_runtime_1.jsx)("path", { d: "M27.625 50.375H16.9688C16.4359 50.375 16 49.9391 16 49.4062C16 48.8734 16.4359 48.4375 16.9688 48.4375H27.625C28.1578 48.4375 28.5938 48.8734 28.5938 49.4062C28.5938 49.9391 28.1578 50.375 27.625 50.375Z", fill: "#ECF4E9" }), (0, jsx_runtime_1.jsx)("path", { d: "M31.5 55.2188H14.0625C13.5297 55.2188 13.0938 54.7828 13.0938 54.25C13.0938 53.7172 13.5297 53.2812 14.0625 53.2812H31.5C32.0328 53.2812 32.4688 53.7172 32.4688 54.25C32.4688 54.7828 32.0328 55.2188 31.5 55.2188Z", fill: "#ECF4E9" }), (0, jsx_runtime_1.jsx)("path", { d: "M39.25 1.9375C31.7713 1.9375 25.6875 8.02125 25.6875 15.5C25.6875 21.7969 30.0663 27.2897 36.1597 28.7041L38.4169 32.4628C38.5912 32.7534 38.9109 32.9375 39.25 32.9375C39.5891 32.9375 39.9088 32.7631 40.0831 32.4628L42.3403 28.7041C48.4337 27.2897 52.8125 21.7969 52.8125 15.5C52.8125 8.02125 46.7288 1.9375 39.25 1.9375Z", fill: "#E5E6E6" }), (0, jsx_runtime_1.jsx)("path", { d: "M44.7817 9.96891C44.4039 9.59109 43.7936 9.59109 43.4158 9.96891L39.2598 14.1248L35.1039 9.96891C34.7261 9.59109 34.1158 9.59109 33.7379 9.96891C33.3601 10.3467 33.3601 10.957 33.7379 11.3348L37.8939 15.4908L33.7379 19.6467C33.3601 20.0245 33.3601 20.6348 33.7379 21.0127C33.9317 21.2064 34.1739 21.2936 34.4258 21.2936C34.6776 21.2936 34.9198 21.1967 35.1136 21.0127L39.2695 16.8567L43.4254 21.0127C43.6192 21.2064 43.8614 21.2936 44.1133 21.2936C44.3651 21.2936 44.6073 21.1967 44.8011 21.0127C45.1789 20.6348 45.1789 20.0245 44.8011 19.6467L40.6451 15.4908L44.8011 11.3348C45.1789 10.957 45.1789 10.3467 44.8011 9.96891H44.7817Z", fill: "#1C461D" })] }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionTitle), children: props.title }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.sessionDescription), children: props.description })] }), props.action && (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { onClick: props.action, children: props.actionText })] }));
26
25
  }
27
26
  exports.default = EmptyData;
@@ -0,0 +1,8 @@
1
+ import { FiatDepositData } from "../../../../types/expose-type";
2
+ export declare const SuccessAnimation: () => import("react/jsx-runtime").JSX.Element;
3
+ export interface IShareActionProps {
4
+ data: FiatDepositData | null;
5
+ shareRef: React.RefObject<HTMLDivElement | null>;
6
+ }
7
+ declare const _default: import("react").NamedExoticComponent<IShareActionProps>;
8
+ export default _default;
@@ -0,0 +1,149 @@
1
+ "use strict";
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
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.SuccessAnimation = void 0;
41
+ var jsx_runtime_1 = require("react/jsx-runtime");
42
+ var material_1 = require("@mui/material");
43
+ var react_1 = require("react");
44
+ var html_to_image_1 = require("html-to-image");
45
+ var SuccessAnimation = function () { return ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M4.5 12.75L10.5 18.75L19.5 5.25", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })); };
46
+ exports.SuccessAnimation = SuccessAnimation;
47
+ exports.default = (0, react_1.memo)(function ShareAction(_a) {
48
+ var _this = this;
49
+ var data = _a.data, shareRef = _a.shareRef;
50
+ var _b = (0, react_1.useState)(false), isDownloading = _b[0], setIsDownloading = _b[1];
51
+ var _c = (0, react_1.useState)(false), copySuccess = _c[0], setCopySuccess = _c[1];
52
+ var convertHtml2Img = function () { return __awaiter(_this, void 0, void 0, function () {
53
+ var _a, _b;
54
+ var _c;
55
+ return __generator(this, function (_d) {
56
+ switch (_d.label) {
57
+ case 0:
58
+ if (!shareRef.current)
59
+ return [2 /*return*/];
60
+ _a = html_to_image_1.toPng;
61
+ _b = [shareRef.current];
62
+ _c = {};
63
+ return [4 /*yield*/, (0, html_to_image_1.getFontEmbedCSS)(shareRef.current)];
64
+ case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([(_c.fontEmbedCSS = _d.sent(), _c)]))];
65
+ case 2: return [2 /*return*/, _d.sent()];
66
+ }
67
+ });
68
+ }); };
69
+ var handleDownloadFile = function (url, filename) { return __awaiter(_this, void 0, void 0, function () {
70
+ var link;
71
+ return __generator(this, function (_a) {
72
+ link = document.createElement("a");
73
+ link.download = filename;
74
+ link.href = url;
75
+ link.setAttribute("data-downloadurl", ["image/png", link.download, link.href].join(":"));
76
+ document.body.appendChild(link);
77
+ link.click();
78
+ document.body.removeChild(link);
79
+ return [2 /*return*/];
80
+ });
81
+ }); };
82
+ var handleDownload = function () { return __awaiter(_this, void 0, void 0, function () {
83
+ var dataUrl, error_1;
84
+ return __generator(this, function (_a) {
85
+ switch (_a.label) {
86
+ case 0:
87
+ if (isDownloading)
88
+ return [2 /*return*/];
89
+ setIsDownloading(true);
90
+ _a.label = 1;
91
+ case 1:
92
+ _a.trys.push([1, 3, , 4]);
93
+ return [4 /*yield*/, convertHtml2Img()];
94
+ case 2:
95
+ dataUrl = _a.sent();
96
+ handleDownloadFile(dataUrl !== null && dataUrl !== void 0 ? dataUrl : "", "".concat(data === null || data === void 0 ? void 0 : data.id, ".png")).finally(function () { return setIsDownloading(false); });
97
+ return [3 /*break*/, 4];
98
+ case 3:
99
+ error_1 = _a.sent();
100
+ console.warn("🚀 ~ handleDownload ~ error:", error_1);
101
+ return [3 /*break*/, 4];
102
+ case 4: return [2 /*return*/];
103
+ }
104
+ });
105
+ }); };
106
+ var handleCopyLink = function () {
107
+ if (!(data === null || data === void 0 ? void 0 : data.id) || copySuccess)
108
+ return;
109
+ var link = data._link.payment_link.href;
110
+ navigator.clipboard
111
+ .writeText(link)
112
+ .then(function () {
113
+ setCopySuccess(true);
114
+ })
115
+ .catch(function (err) {
116
+ console.error("Failed to copy link:", err);
117
+ });
118
+ };
119
+ (0, react_1.useEffect)(function () {
120
+ if (copySuccess) {
121
+ var timeout_1 = setTimeout(function () {
122
+ setCopySuccess(false);
123
+ }, 2000);
124
+ return function () { return clearTimeout(timeout_1); };
125
+ }
126
+ }, [copySuccess]);
127
+ return ((0, jsx_runtime_1.jsxs)(material_1.Grid2, { sx: {
128
+ gridTemplateColumns: "1fr 1fr 1fr 1fr",
129
+ gridTemplateRows: "1fr",
130
+ alignItems: "center",
131
+ gap: "0.5rem",
132
+ }, container: true, display: "grid", children: [(0, jsx_runtime_1.jsxs)(material_1.Grid2, { display: "flex", flexDirection: "column", gap: "0.375rem", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { loading: isDownloading, color: "primary", onClick: handleDownload, sx: {
133
+ borderRadius: "0.75rem",
134
+ justifyContent: "center",
135
+ alignItems: "center",
136
+ width: "3rem",
137
+ height: "3rem",
138
+ display: "flex",
139
+ color: "#fff",
140
+ }, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "21", height: "20", viewBox: "0 0 21 20", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M3.375 13.75V15.625C3.375 16.1223 3.57254 16.5992 3.92417 16.9508C4.27581 17.3025 4.75272 17.5 5.25 17.5H16.5C16.9973 17.5 17.4742 17.3025 17.8258 16.9508C18.1775 16.5992 18.375 16.1223 18.375 15.625V13.75M14.625 10L10.875 13.75M10.875 13.75L7.125 10M10.875 13.75V2.5", stroke: "white", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "content02", color: "positive", children: "Save photo" })] }), (0, jsx_runtime_1.jsxs)(material_1.Grid2, { display: "flex", flexDirection: "column", gap: "0.375rem", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { color: "primary", onClick: handleCopyLink, sx: {
141
+ borderRadius: "0.75rem",
142
+ justifyContent: "center",
143
+ alignItems: "center",
144
+ width: "3rem",
145
+ height: "3rem",
146
+ display: "flex",
147
+ color: "#fff",
148
+ }, children: copySuccess ? ((0, jsx_runtime_1.jsx)(exports.SuccessAnimation, {})) : ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "21", height: "20", viewBox: "0 0 21 20", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M11.6167 7.24002C12.1582 7.49857 12.6298 7.8833 12.9918 8.36189C13.3538 8.84048 13.5956 9.39895 13.697 9.9904C13.7985 10.5818 13.7564 11.189 13.5745 11.7608C13.3926 12.3327 13.0762 12.8525 12.6517 13.2767L8.90169 17.0267C8.19842 17.73 7.24459 18.125 6.25002 18.125C5.25546 18.125 4.30162 17.73 3.59836 17.0267C2.89509 16.3234 2.5 15.3696 2.5 14.375C2.5 13.3805 2.89509 12.4266 3.59836 11.7234L5.06252 10.2592M16.1875 9.74086L17.6517 8.27669C18.355 7.57342 18.75 6.61959 18.75 5.62502C18.75 4.63046 18.355 3.67662 17.6517 2.97336C16.9484 2.27009 15.9946 1.875 15 1.875C14.0055 1.875 13.0516 2.27009 12.3484 2.97336L8.59836 6.72336C8.17389 7.14752 7.85741 7.66736 7.67551 8.23921C7.49361 8.81105 7.45159 9.4182 7.553 10.0096C7.6544 10.6011 7.89626 11.1596 8.25827 11.6382C8.62027 12.1167 9.09183 12.5015 9.63336 12.76", stroke: "white", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) })) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "content02", color: "positive", children: copySuccess ? "Copied!" : "Copy link" })] })] }));
149
+ });
@@ -0,0 +1,8 @@
1
+ import { FiatDepositData } from "../../../../types/expose-type";
2
+ export interface IShareDrawerProps {
3
+ depositData: FiatDepositData | null;
4
+ count?: number;
5
+ handleRefresh?: () => void;
6
+ onClose?: () => void;
7
+ }
8
+ export default function ShareDrawer({ depositData, count, handleRefresh, onClose, }: IShareDrawerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = ShareDrawer;
7
+ var jsx_runtime_1 = require("react/jsx-runtime");
8
+ var material_1 = require("@mui/material");
9
+ var shareImage_1 = __importDefault(require("./shareImage"));
10
+ var shareAction_1 = __importDefault(require("./shareAction"));
11
+ var theme_1 = __importDefault(require("../../../../theme/mui/deposit-fiat-theme/theme"));
12
+ var react_1 = require("react");
13
+ function ShareDrawer(_a) {
14
+ var depositData = _a.depositData, count = _a.count, handleRefresh = _a.handleRefresh, onClose = _a.onClose;
15
+ var shareRef = (0, react_1.useRef)(null);
16
+ return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { p: "1rem", sx: {
17
+ background: theme_1.default.palette.tertiary.main,
18
+ maxHeight: "70%",
19
+ overflowY: "auto",
20
+ }, pb: "2.5rem", gap: "0.75rem", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { width: "100%", flexDirection: "row", alignItems: "center", justifyContent: "space-between", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "title01", color: "positive", children: "Share" }), (0, jsx_runtime_1.jsx)("svg", { onClick: onClose, xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M1 13L13 1M1 1L13 13", stroke: "#121212", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), (0, jsx_runtime_1.jsx)(material_1.Divider, { flexItem: true }), (0, jsx_runtime_1.jsx)(shareImage_1.default, { ref: shareRef, data: depositData, count: count, handleRefresh: handleRefresh }), (0, jsx_runtime_1.jsx)(material_1.Divider, { flexItem: true }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: "0.75rem", width: "100%", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "title01", color: "positive", children: "Share To" }), (0, jsx_runtime_1.jsx)(shareAction_1.default, { data: depositData, shareRef: shareRef })] })] }));
21
+ }
@@ -0,0 +1,9 @@
1
+ import { FiatDepositData } from "../../../../types/expose-type";
2
+ import { RefObject } from "react";
3
+ export interface IShareImageProps {
4
+ data: FiatDepositData | null;
5
+ count?: number;
6
+ handleRefresh?: () => void;
7
+ ref: RefObject<HTMLDivElement | null>;
8
+ }
9
+ export default function ShareImage({ data, count, handleRefresh, ref }: IShareImageProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = ShareImage;
7
+ var jsx_runtime_1 = require("react/jsx-runtime");
8
+ var material_1 = require("@mui/material");
9
+ var image_1 = __importDefault(require("next/image"));
10
+ var formatter_1 = __importDefault(require("../../Formatter/functions/formatter"));
11
+ var theme_1 = __importDefault(require("../../../../theme/mui/deposit-fiat-theme/theme"));
12
+ function ShareImage(_a) {
13
+ var _b, _c;
14
+ var data = _a.data, count = _a.count, handleRefresh = _a.handleRefresh, ref = _a.ref;
15
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { width: "55%", p: "0.75rem", ref: ref, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { position: "relative", py: "1.5rem", sx: {
16
+ background: theme_1.default.palette.negative.main,
17
+ borderRadius: "0.563rem",
18
+ gap: "2rem",
19
+ alignItems: "center",
20
+ textAlign: "center",
21
+ }, children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { alignItems: "center", children: [(0, jsx_runtime_1.jsx)(image_1.default, { src: "/icons/logo.svg", alt: "", width: 34, height: 34 }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { component: "span", color: "positive", sx: {
22
+ gap: "3px",
23
+ fontSize: "9px",
24
+ fontWeight: 700,
25
+ lineHeight: "140%",
26
+ }, children: ["Ting.Money", (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: {
27
+ fontSize: "6px",
28
+ fontWeight: 500,
29
+ lineHeight: "140%",
30
+ }, color: "accent2", children: "Ting.Money \u2013 Powering Your Global Travel Dreams" })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { alignItems: "center", style: {
31
+ gap: "12px",
32
+ width: "100%",
33
+ paddingLeft: "16px",
34
+ paddingRight: "16px",
35
+ }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { width: "52%", position: "relative", aspectRatio: "1 / 1" }, children: [(0, jsx_runtime_1.jsx)(image_1.default, { alt: "", fill: true, src: (_b = data === null || data === void 0 ? void 0 : data.qr_code) !== null && _b !== void 0 ? _b : "/", style: { filter: count === 0 ? "blur(6px)" : "none" } }), count === 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, { onClick: handleRefresh, sx: {
36
+ display: "flex",
37
+ position: "absolute",
38
+ inset: "0",
39
+ backgroundColor: "transparent",
40
+ alignItems: "center",
41
+ justifyContent: "center",
42
+ }, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M16.0234 9.34794H21.0154L17.8344 6.16494C16.8103 5.14081 15.5346 4.40433 14.1356 4.02955C12.7366 3.65476 11.2636 3.65487 9.86464 4.02986C8.4657 4.40486 7.19014 5.14153 6.16617 6.16581C5.14221 7.19009 4.40594 8.46588 4.03138 9.86494M2.98537 19.6439V14.6519M2.98537 14.6519H7.97738M2.98537 14.6519L6.16537 17.8349C7.18949 18.8591 8.46517 19.5955 9.86416 19.9703C11.2632 20.3451 12.7362 20.345 14.1351 19.97C15.534 19.595 16.8096 18.8584 17.8336 17.8341C18.8575 16.8098 19.5938 15.534 19.9684 14.1349M21.0154 4.35594V9.34594", stroke: "#1E4841", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }))] }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { component: "span", variant: "title01", sx: {
43
+ display: "flex",
44
+ flexDirection: "column",
45
+ fontSize: "0.813rem",
46
+ fontWeight: 600,
47
+ lineHeight: "140%",
48
+ alignItems: "center",
49
+ }, color: "primary", children: [(0, formatter_1.default)((_c = data === null || data === void 0 ? void 0 : data.amount) !== null && _c !== void 0 ? _c : 0, !!0, !!0) || "--", (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "title01", sx: {
50
+ fontSize: ".5rem",
51
+ fontWeight: 500,
52
+ lineHeight: "140%",
53
+ }, color: "accent2", children: "VND" })] }), (0, jsx_runtime_1.jsx)(material_1.Divider, { flexItem: true }), (0, jsx_runtime_1.jsxs)(material_1.Typography, { component: "span", sx: {
54
+ display: "flex",
55
+ flexDirection: "column",
56
+ gap: "3px",
57
+ fontSize: "0.563rem",
58
+ alignItems: "center",
59
+ textAlign: "center",
60
+ }, children: [data === null || data === void 0 ? void 0 : data.metadata.bank_account.account_name, (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: ".375rem" }, children: data === null || data === void 0 ? void 0 : data.metadata.bank_account.bank_name }), (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: { fontSize: ".563rem", display: "flex", alignItems: "center", gap: "4px" }, children: data === null || data === void 0 ? void 0 : data.metadata.bank_account.account_number })] })] }), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
61
+ position: "absolute",
62
+ top: "-1px",
63
+ left: "-1px",
64
+ width: "16px",
65
+ height: "16px",
66
+ borderTop: "1px solid #1E4841",
67
+ borderLeft: "1px solid #1E4841",
68
+ borderTopLeftRadius: "9px",
69
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
70
+ position: "absolute",
71
+ top: "-1px",
72
+ right: "-1px",
73
+ width: "16px",
74
+ height: "16px",
75
+ borderTop: "1px solid #1E4841",
76
+ borderRight: "1px solid #1E4841",
77
+ borderTopRightRadius: "9px",
78
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
79
+ position: "absolute",
80
+ bottom: "-1px",
81
+ left: "-1px",
82
+ width: "16px",
83
+ height: "16px",
84
+ borderBottom: "1px solid #1E4841",
85
+ borderLeft: "1px solid #1E4841",
86
+ borderBottomLeftRadius: "9px",
87
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
88
+ position: "absolute",
89
+ bottom: "-1px",
90
+ right: "-1px",
91
+ width: "16px",
92
+ height: "16px",
93
+ borderBottom: "1px solid #1E4841",
94
+ borderRight: "1px solid #1E4841",
95
+ borderBottomRightRadius: "9px",
96
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
97
+ position: "absolute",
98
+ top: "-1px",
99
+ width: "16px",
100
+ height: "16px",
101
+ borderTop: "1px solid #1E4841",
102
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
103
+ position: "absolute",
104
+ bottom: "-1px",
105
+ width: "16px",
106
+ height: "16px",
107
+ borderBottom: "1px solid #1E4841",
108
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
109
+ position: "absolute",
110
+ left: "-1px",
111
+ width: "16px",
112
+ height: "16px",
113
+ borderLeft: "1px solid #1E4841",
114
+ top: "50%",
115
+ transform: "translateY(-50%)",
116
+ } }), (0, jsx_runtime_1.jsx)("div", { style: {
117
+ position: "absolute",
118
+ right: "-1px",
119
+ width: "16px",
120
+ height: "16px",
121
+ borderRight: "1px solid #1E4841",
122
+ top: "50%",
123
+ transform: "translateY(-50%)",
124
+ } })] })] }) }));
125
+ }
@@ -0,0 +1,5 @@
1
+ export interface IFiatDepositProps {
2
+ children?: React.ReactNode;
3
+ }
4
+ export declare const CopyIcon: () => import("react/jsx-runtime").JSX.Element;
5
+ export default function FiatDeposit({ children }: IFiatDepositProps): import("react/jsx-runtime").JSX.Element;