tek-wallet 0.0.288 → 0.0.289

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.
@@ -0,0 +1,11 @@
1
+ import { DialogProps } from "@mui/material";
2
+ import { GeneralProps } from "../../../types/ui";
3
+ interface AppDialogProps extends Omit<DialogProps, "open">, Omit<GeneralProps, "sx" | "onClick"> {
4
+ overrideOpen?: boolean;
5
+ }
6
+ export interface AppDialogRef {
7
+ open: () => void;
8
+ close: () => void;
9
+ }
10
+ declare const AppDialog: import("react").ForwardRefExoticComponent<Omit<AppDialogProps, "ref"> & import("react").RefAttributes<AppDialogRef>>;
11
+ export default AppDialog;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ var jsx_runtime_1 = require("react/jsx-runtime");
26
+ var material_1 = require("@mui/material");
27
+ var react_1 = require("react");
28
+ var AppDialog = (0, react_1.forwardRef)(function (props, ref) {
29
+ var _a = (0, react_1.useState)(false), isOpen = _a[0], setIsOpen = _a[1];
30
+ var sx = props.sx, children = props.children, overrideOpen = props.overrideOpen, rest = __rest(props, ["sx", "children", "overrideOpen"]);
31
+ (0, react_1.useImperativeHandle)(ref, function () { return ({
32
+ open: function () { return setIsOpen(true); },
33
+ close: function () { return setIsOpen(false); },
34
+ }); });
35
+ return ((0, jsx_runtime_1.jsx)(material_1.Dialog, __assign({ open: overrideOpen !== null && overrideOpen !== void 0 ? overrideOpen : isOpen, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description", sx: __assign({}, sx) }, rest, { children: children })));
36
+ });
37
+ AppDialog.displayName = "AppDialog";
38
+ exports.default = AppDialog;
@@ -0,0 +1,8 @@
1
+ import { BoxProps } from "@mui/material";
2
+ import { ReactNode } from "react";
3
+ interface DialogContentLayoutProps extends Omit<BoxProps, "content" | "actions"> {
4
+ content?: ReactNode;
5
+ actions?: ReactNode;
6
+ }
7
+ declare function DialogContentLayout(props: DialogContentLayoutProps): import("react/jsx-runtime").JSX.Element;
8
+ export default DialogContentLayout;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ var jsx_runtime_1 = require("react/jsx-runtime");
29
+ var material_1 = require("@mui/material");
30
+ var Text_1 = __importDefault(require("../Text"));
31
+ function DialogContentLayout(props) {
32
+ var content = props.content, actions = props.actions, sx = props.sx, rest = __rest(props, ["content", "actions", "sx"]);
33
+ var theme = (0, material_1.useTheme)();
34
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ sx: __assign(__assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, padding: theme.mixins.customPadding.p12, borderRadius: theme.mixins.theBorderRadius.r12, backgroundColor: theme.palette.background.black64, backdropFilter: "blur(12px)" }), sx) }, rest, { children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.dialogContent), children: content }), !!actions && (0, jsx_runtime_1.jsx)(material_1.Divider, {}), actions] })));
35
+ }
36
+ exports.default = DialogContentLayout;
@@ -76,7 +76,9 @@ var Input_1 = __importDefault(require("../Input"));
76
76
  var QrCodeReader_1 = __importDefault(require("../QrCodeReader"));
77
77
  var validate_wallet_address_service_1 = __importDefault(require("../../../services/axios/validate-wallet-address-service"));
78
78
  var parseTonTransferUrl_1 = __importDefault(require("../../../utils/parseTonTransferUrl"));
79
- var BackDrop_1 = __importDefault(require("../BackDrop"));
79
+ var AppBackDrop_1 = __importDefault(require("../AppBackDrop"));
80
+ var DialogContentLayout_1 = __importDefault(require("../DialogContentLayout"));
81
+ var AppDialog_1 = __importDefault(require("../AppDialog"));
80
82
  var SendMethods;
81
83
  (function (SendMethods) {
82
84
  SendMethods["SCAN_QR_CODE"] = "scan qr code";
@@ -105,13 +107,14 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
105
107
  var _c = (0, react_1.useState)(), selectedNetwork = _c[0], setSelectedNetwork = _c[1];
106
108
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
107
109
  var _d = (0, useWithdrawData_1.default)(), withdrawTokens = _d.withdrawTokens, updateWithdrawToken = _d.updateWithdrawToken;
108
- var _e = (0, react_1.useState)(""), amount = _e[0], setAmount = _e[1];
109
- var _f = (0, react_1.useState)(""), memo = _f[0], setMemo = _f[1];
110
- var _g = (0, react_1.useState)(""), recipientAddress = _g[0], setRecipientAddress = _g[1];
110
+ var _e = (0, react_1.useState)(), dialogContent = _e[0], setDialogContent = _e[1];
111
+ var _f = (0, react_1.useState)(""), amount = _f[0], setAmount = _f[1];
112
+ var _g = (0, react_1.useState)(""), memo = _g[0], setMemo = _g[1];
113
+ var _h = (0, react_1.useState)(""), recipientAddress = _h[0], setRecipientAddress = _h[1];
111
114
  var scannerAllQrCodeRef = (0, react_1.useRef)(null);
112
115
  var scannerAddressQrCodeRef = (0, react_1.useRef)(null);
113
116
  var backDropRef = (0, react_1.useRef)(null);
114
- var _h = (0, react_1.useState)(), selectedMethod = _h[0], setSelectedMethod = _h[1];
117
+ var _j = (0, react_1.useState)(), selectedMethod = _j[0], setSelectedMethod = _j[1];
115
118
  var networks = (0, react_1.useMemo)(function () {
116
119
  console.warn("🚀 ~ networks ~ selectedToken:", selectedToken);
117
120
  if (!selectedToken) {
@@ -250,7 +253,11 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
250
253
  return [2 /*return*/];
251
254
  }
252
255
  (_d = backDropRef.current) === null || _d === void 0 ? void 0 : _d.close();
256
+ setDialogContent("Unsupported QR, please scan a valid QR code or enter the recipient address manually");
253
257
  console.warn("validateWalletAddress", validateWalletAddress);
258
+ // if(validateWalletAddress?.is_current_wallet) {
259
+ // return
260
+ // }
254
261
  if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address)) {
255
262
  //internal
256
263
  console.warn("internal");
@@ -317,7 +324,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
317
324
  placeholder: "Enter memo",
318
325
  value: memo,
319
326
  onChange: handleChangeMemo,
320
- } })] }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" })] }) }, WithdrawStep.CONFIRM)] }, withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.length), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAllQrCodeRef, onResult: handleScanAllQrCode }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAddressQrCodeRef, onResult: handleScanAddressQrCode }), (0, jsx_runtime_1.jsx)(BackDrop_1.default, { ref: backDropRef })] }) }) }));
327
+ } })] }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" })] }) }, WithdrawStep.CONFIRM)] }, withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.length), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAllQrCodeRef, onResult: handleScanAllQrCode }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAddressQrCodeRef, onResult: handleScanAddressQrCode }), (0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { ref: backDropRef }), (0, jsx_runtime_1.jsx)(AppDialog_1.default, { overrideOpen: !!dialogContent, children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: dialogContent, actions: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { children: "Confirm" }) }) })] }) }) }));
321
328
  });
322
329
  WithdrawFunction.displayName = "WithdrawFunction";
323
330
  exports.default = WithdrawFunction;
@@ -265,6 +265,21 @@ var theme = (0, styles_1.createTheme)({
265
265
  borderRadius: theBorderRadius.full,
266
266
  lineHeight: typography.leading100,
267
267
  },
268
+ dialogContent: {
269
+ fontSize: typography.fontSize14,
270
+ lineHeight: typography.leading140,
271
+ color: text.white64,
272
+ },
273
+ dialogActionsOk: {
274
+ fontSize: typography.fontSize14,
275
+ lineHeight: typography.leading140,
276
+ color: "#2482ff",
277
+ },
278
+ dialogActionsCancel: {
279
+ fontSize: typography.fontSize14,
280
+ lineHeight: typography.leading140,
281
+ color: text.white64,
282
+ },
268
283
  },
269
284
  });
270
285
  exports.default = theme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.288",
3
+ "version": "0.0.289",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",