tek-wallet 0.0.823 → 0.0.824

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.
@@ -70,10 +70,12 @@ var mui_1 = require("../../../theme/mui");
70
70
  var AppBackDrop_1 = __importDefault(require("../../ui/AppBackDrop"));
71
71
  var react_simple_pull_to_refresh_1 = __importDefault(require("react-simple-pull-to-refresh"));
72
72
  var Refresh_1 = __importDefault(require("../../ui/Atoms/Refresh"));
73
+ var providers_1 = require("../../../providers");
73
74
  var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
74
75
  var header = props.header, footer = props.footer, children = props.children, sx = props.sx, className = props.className, classNames = props.classNames, statusMessage = props.statusMessage, sxs = props.sxs, pullToRefreshProps = props.pullToRefreshProps, rest = __rest(props, ["header", "footer", "children", "sx", "className", "classNames", "statusMessage", "sxs", "pullToRefreshProps"]);
75
76
  var _a = (0, react_1.useState)(StatusDisplay_1.StatusDisplayType.Normal), status = _a[0], setStatus = _a[1];
76
77
  var theme = (0, mui_1.useTheme)();
78
+ var offset = (0, providers_1.useWalletSetup)().offset;
77
79
  var _b = pullToRefreshProps || {}, onRefresh = _b.onRefresh, isPullable = _b.isPullable, restPullToRefreshProps = __rest(_b, ["onRefresh", "isPullable"]);
78
80
  (0, react_1.useImperativeHandle)(ref, function () {
79
81
  return {
@@ -96,7 +98,7 @@ var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
96
98
  return [2 /*return*/, Promise.all([new Promise(function (resolve) { return setTimeout(resolve, 1000); }), onRefresh === null || onRefresh === void 0 ? void 0 : onRefresh()])]; // for user feel data is loading
97
99
  });
98
100
  }); };
99
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: ref, sx: __assign({ height: "100%", width: "100%", display: "grid", gridTemplateRows: "auto 1fr auto", position: "relative", overflow: "hidden", backgroundColor: theme.palette.background.default }, sx), className: className }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ width: "100%" }, sxs === null || sxs === void 0 ? void 0 : sxs.header), className: classNames === null || classNames === void 0 ? void 0 : classNames.header, children: header }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ height: "100%", width: "100%", overflowX: "hidden", overflowY: "auto" }, sxs === null || sxs === void 0 ? void 0 : sxs.body), className: classNames === null || classNames === void 0 ? void 0 : classNames.body, children: [!!isPullable && ((0, jsx_runtime_1.jsx)(react_simple_pull_to_refresh_1.default, __assign({ pullingContent: null, refreshingContent: ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "center", pt: 3 }, children: (0, jsx_runtime_1.jsx)(Refresh_1.default, {}) })) }, restPullToRefreshProps, { onRefresh: handleRefresh, children: children }))), !isPullable && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ width: "100%" }, sxs === null || sxs === void 0 ? void 0 : sxs.footer), className: classNames === null || classNames === void 0 ? void 0 : classNames.footer, children: footer }), status !== StatusDisplay_1.StatusDisplayType.Normal && ((0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { open: true, hideProgress: true, message: (0, jsx_runtime_1.jsx)(StatusDisplay_2.default, { status: status, statusMessage: statusMessage === null || statusMessage === void 0 ? void 0 : statusMessage[status] }) }))] })));
101
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: ref, sx: __assign({ height: "100%", width: "100%", display: "grid", gridTemplateRows: "auto 1fr auto", position: "relative", overflow: "hidden", backgroundColor: theme.palette.background.default, pt: offset === null || offset === void 0 ? void 0 : offset.top }, sx), className: className }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ width: "100%" }, sxs === null || sxs === void 0 ? void 0 : sxs.header), className: classNames === null || classNames === void 0 ? void 0 : classNames.header, children: header }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ height: "100%", width: "100%", overflowX: "hidden", overflowY: "auto" }, sxs === null || sxs === void 0 ? void 0 : sxs.body), className: classNames === null || classNames === void 0 ? void 0 : classNames.body, children: [!!isPullable && ((0, jsx_runtime_1.jsx)(react_simple_pull_to_refresh_1.default, __assign({ pullingContent: null, refreshingContent: ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "center", pt: 3 }, children: (0, jsx_runtime_1.jsx)(Refresh_1.default, {}) })) }, restPullToRefreshProps, { onRefresh: handleRefresh, children: children }))), !isPullable && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ width: "100%" }, sxs === null || sxs === void 0 ? void 0 : sxs.footer), className: classNames === null || classNames === void 0 ? void 0 : classNames.footer, children: footer }), status !== StatusDisplay_1.StatusDisplayType.Normal && ((0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { open: true, hideProgress: true, message: (0, jsx_runtime_1.jsx)(StatusDisplay_2.default, { status: status, statusMessage: statusMessage === null || statusMessage === void 0 ? void 0 : statusMessage[status] }) }))] })));
100
102
  });
101
103
  ChildPageLayout.displayName = "ChildPageLayout";
102
104
  exports.default = ChildPageLayout;
@@ -15,8 +15,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var material_1 = require("@mui/material");
17
17
  var mui_1 = require("../../../theme/mui");
18
+ var providers_1 = require("../../../providers");
18
19
  var DefaultPageLayout = function (props) {
19
20
  var theme = (0, mui_1.useTheme)();
20
- return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.styleMixins.pagePadding), { minHeight: "100%", width: "100%" }), props.sx), children: props.children }));
21
+ var offset = (0, providers_1.useWalletSetup)().offset;
22
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.styleMixins.pagePadding), { pb: (offset === null || offset === void 0 ? void 0 : offset.bottom) || theme.styleMixins.pagePadding.paddingBottom, minHeight: "100%", width: "100%" }), props.sx), children: props.children }));
21
23
  };
22
24
  exports.default = DefaultPageLayout;
@@ -67,11 +67,13 @@ var AssetViewHeader = function () {
67
67
  var options = (0, TekWalletProvider_1.useWalletSetup)().options;
68
68
  var theme = (0, mui_1.useTheme)();
69
69
  var modalRef = (0, react_1.useRef)(null);
70
+ var offset = (0, TekWalletProvider_1.useWalletSetup)().offset;
70
71
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { justifyContent: "start", position: "relative", boxShadow: "0 0 1px 2px rgba(0, 0, 0, 0.03)", px: theme.styleMixins.customPadding.p16 }), children: [(0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: modalRef, trigger: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.styleMixins.row), { alignItems: "center", justifyContent: "start", textAlign: "center", gap: theme.styleMixins.gaps.g4, py: theme.styleMixins.customPadding.p8 }), theme.styleMixins.value), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "1.25rem", height: "1.25rem" }, children: SvgPath_1.WALLET }), (0, compactWalletAddress_1.default)(masterWallet), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "0.625rem", height: "0.625rem" }, children: SvgPath_1.ARROW_DROP_DOWN })] }), direction: DrawerComponent_1.DRAWER_DIRECTION.TOP, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
71
72
  width: "100%",
72
73
  height: "fit-content",
73
74
  backgroundColor: "background.default",
74
75
  padding: theme.styleMixins.customPadding.p16,
76
+ pt: (offset === null || offset === void 0 ? void 0 : offset.top) || theme.styleMixins.customPadding.p16,
75
77
  }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { justifyContent: "space-between" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { component: "div", sx: __assign(__assign({}, theme.styleMixins.headerTitle), { py: theme.styleMixins.customPadding.p8, textAlign: "left" }), children: "Wallet address" }), (0, jsx_runtime_1.jsx)(CloseModal_1.default, { onClick: function () { var _a; return (_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.close(); } })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.styleMixins.column), children: [!!masterWallet && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: masterWallet !== null && masterWallet !== void 0 ? masterWallet : "", messageSuccess: "Copied Internal address", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ py: theme.styleMixins.customPadding.p8 }, theme.styleMixins.row), { justifyContent: "space-between", alignItems: "center", gap: theme.styleMixins.gaps.g8, color: "text.primary" }), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "1.75rem", height: "1.75rem", opacity: 0.7 }, children: SvgPath_1.WALLET }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.styleMixins.column), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.listTitle), { color: "inherit" }), children: "Internal wallet" }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.styleMixins.listDescription), children: (0, compactWalletAddress_1.default)(masterWallet) })] }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "1rem", height: "1rem" }, children: SvgPath_1.IC_COPY })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
76
78
  my: theme.styleMixins.customPadding.p8,
77
79
  } })] })), blockchainWallets === null || blockchainWallets === void 0 ? void 0 : blockchainWallets.map(function (wallet, index) { return ((0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: wallet.blockchainAddress, messageSuccess: "Copied ".concat(wallet.networkName, " address"), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ py: theme.styleMixins.customPadding.p8 }, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g8, justifyContent: "space-between", alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: wallet.networkIcon, width: 28, sx: { borderRadius: theme.styleMixins.customRadius.full } }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.styleMixins.column), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.styleMixins.listTitle), children: wallet.networkName }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.styleMixins.listDescription), children: (0, compactWalletAddress_1.default)(wallet.blockchainAddress) })] }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "1rem", height: "1rem" }, children: SvgPath_1.IC_COPY })] }) }, wallet.blockchainAddress + index)); })] })] }) }), (0, jsx_runtime_1.jsx)(link_1.default, { href: "".concat((options === null || options === void 0 ? void 0 : options.basePath) || "", "/tek-wallet/").concat(TekWalletView_1.TekWalletViewRoutes.SETTING), children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: {
@@ -131,7 +131,7 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
131
131
  onScan === null || onScan === void 0 ? void 0 : onScan(text);
132
132
  close();
133
133
  }, [onResult, onScan]);
134
- var _d = (0, providers_1.useWalletSetup)(), topOffset = _d.topOffset, overrideQRScanMethod = _d.overrideQRScanMethod;
134
+ var _d = (0, providers_1.useWalletSetup)(), offset = _d.offset, overrideQRScanMethod = _d.overrideQRScanMethod;
135
135
  if (!!overrideQRScanMethod) {
136
136
  var handleOverrideQRScanMethod = function () { return __awaiter(void 0, void 0, void 0, function () {
137
137
  var result, fakeIDetectedBarcode, error_1;
@@ -172,7 +172,7 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
172
172
  backgroundColor: "transparent !important",
173
173
  }, header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { hideBack: true, title: "Scan QR code", sx: {
174
174
  position: "absolute",
175
- top: topOffset || 0,
175
+ top: (offset === null || offset === void 0 ? void 0 : offset.top) || 0,
176
176
  left: 0,
177
177
  right: 0,
178
178
  zIndex: 1001,
@@ -72,9 +72,9 @@ var SettingView = function (props) {
72
72
  onLogout === null || onLogout === void 0 ? void 0 : onLogout();
73
73
  setButtonStatus(Button_1.BUTTON_STATUS.LOADING);
74
74
  };
75
- return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Setting" }), children: (0, jsx_runtime_1.jsxs)(DefaultPageLayout_1.default, { sx: __assign(__assign({}, theme.styleMixins.column), { gap: theme.styleMixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsx)(ChangePasscode_1.default, { children: (0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { hideTag: true, title: "Change Passcode", description: "Change your passcode", icon: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "2rem", height: "2rem", color: "text.secondary" }, children: SvgPath_1.IC_CHANGE_PASSCODE }) }) }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: {
75
+ return ((0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Setting" }), children: (0, jsx_runtime_1.jsxs)(DefaultPageLayout_1.default, { sx: __assign(__assign({}, theme.styleMixins.column), { gap: theme.styleMixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsx)(ChangePasscode_1.default, { children: (0, jsx_runtime_1.jsx)(ListItemCustom_1.default, { hideTag: true, title: "Change Passcode", description: "Change your passcode", icon: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "2rem", height: "2rem", color: "text.secondary" }, children: SvgPath_1.IC_CHANGE_PASSCODE }) }) }), !!onLogout && ((0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: {
76
76
  marginTop: "auto",
77
- }, color: "error", onClick: handleLogout, status: buttonStatus, children: "Logout" })] }) }));
77
+ }, color: "error", onClick: handleLogout, status: buttonStatus, children: "Logout" }))] }) }));
78
78
  };
79
79
  exports.SettingView = SettingView;
80
80
  exports.default = exports.SettingView;
@@ -16,13 +16,19 @@ export interface Options {
16
16
  hideBackButtons: Partial<Record<Views, boolean>>;
17
17
  disableRefetchOnFocus?: boolean;
18
18
  }
19
+ export interface OffsetOptions {
20
+ top?: number;
21
+ bottom?: number;
22
+ left?: number;
23
+ right?: number;
24
+ }
19
25
  export interface TekWalletProviderProps {
20
26
  children: ReactNode;
21
27
  isSSO?: boolean;
22
28
  accessToken?: string;
23
29
  options?: Options;
24
30
  onLogout?: () => void;
25
- topOffset?: number;
31
+ offset?: OffsetOptions;
26
32
  NotFoundPage?: ReactNode;
27
33
  overrideQRScanMethod?: () => Promise<string>;
28
34
  theme?: Theme;
@@ -32,7 +38,7 @@ export interface TekWalletContextType {
32
38
  isSSO: boolean | undefined;
33
39
  options?: Options;
34
40
  onLogout?: () => void;
35
- topOffset?: number;
41
+ offset?: OffsetOptions;
36
42
  theme?: Theme;
37
43
  themeMode?: ThemeModes;
38
44
  overrideQRScanMethod?: () => Promise<string>;
@@ -40,7 +46,7 @@ export interface TekWalletContextType {
40
46
  accessToken?: string;
41
47
  }
42
48
  export declare const TekWalletContext: import("react").Context<TekWalletContextType>;
43
- export declare function TekWalletProvider({ children, isSSO, accessToken, options, topOffset, onLogout, overrideQRScanMethod, theme, themeMode, NotFoundPage, }: TekWalletProviderProps): import("react/jsx-runtime").JSX.Element;
49
+ export declare function TekWalletProvider({ children, isSSO, accessToken, options, offset: offset, onLogout, overrideQRScanMethod, theme, themeMode, NotFoundPage, }: TekWalletProviderProps): import("react/jsx-runtime").JSX.Element;
44
50
  export default TekWalletProvider;
45
51
  export declare const useWalletSetup: () => TekWalletContextType;
46
52
  export declare const useKeyboardThemeMode: () => THEME;
@@ -33,7 +33,7 @@ var initialTekWalletContext = {
33
33
  };
34
34
  exports.TekWalletContext = (0, react_1.createContext)(initialTekWalletContext);
35
35
  function TekWalletProvider(_a) {
36
- var children = _a.children, isSSO = _a.isSSO, accessToken = _a.accessToken, options = _a.options, topOffset = _a.topOffset, onLogout = _a.onLogout, overrideQRScanMethod = _a.overrideQRScanMethod, theme = _a.theme, themeMode = _a.themeMode, NotFoundPage = _a.NotFoundPage;
36
+ var children = _a.children, isSSO = _a.isSSO, accessToken = _a.accessToken, options = _a.options, offset = _a.offset, onLogout = _a.onLogout, overrideQRScanMethod = _a.overrideQRScanMethod, theme = _a.theme, themeMode = _a.themeMode, NotFoundPage = _a.NotFoundPage;
37
37
  var WalletProvider = isSSO ? WalletDataProviderNoImport_1.default : WalletDataProvider_1.default;
38
38
  var _b = (0, react_1.useState)("1"), resetTrigger = _b[0], setResetTrigger = _b[1];
39
39
  var onDisconnect = function () {
@@ -43,7 +43,7 @@ function TekWalletProvider(_a) {
43
43
  isSSO: isSSO,
44
44
  options: options,
45
45
  onLogout: onLogout,
46
- topOffset: topOffset,
46
+ offset: offset,
47
47
  overrideQRScanMethod: overrideQRScanMethod,
48
48
  theme: theme,
49
49
  themeMode: themeMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.823",
3
+ "version": "0.0.824",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",