tek-wallet 0.0.494 → 0.0.497

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.
@@ -30,6 +30,8 @@ var material_1 = require("@mui/material");
30
30
  var navigation_1 = require("next/navigation");
31
31
  var useCustomRouter_1 = __importDefault(require("../../../hooks/useCustomRouter"));
32
32
  var navigation_2 = require("next/navigation");
33
+ var createDebounce_1 = __importDefault(require("../../../utils/createDebounce"));
34
+ var rememberTabDeBounce = (0, createDebounce_1.default)(1000);
33
35
  var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
34
36
  var swiperRef = (0, react_2.useRef)(null);
35
37
  var router = (0, useCustomRouter_1.default)();
@@ -62,21 +64,20 @@ var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
62
64
  update: update,
63
65
  }); });
64
66
  var rememberTab = function (index) {
65
- setTimeout(function () {
66
- var params = new URLSearchParams(window.location.search);
67
- params.set(tabParamName, index.toString());
68
- router.replace("".concat(pathname, "?").concat(params.toString()));
69
- }, 500);
67
+ console.warn("rememberTab", index);
68
+ var params = new URLSearchParams(window.location.search);
69
+ params.set(tabParamName, index.toString());
70
+ router.replace("".concat(pathname, "?").concat(params.toString()));
70
71
  };
71
72
  var handleSlideChange = function (swiper) {
72
73
  setActiveTab(swiper.activeIndex);
73
- rememberTab(swiper.activeIndex);
74
+ rememberTabDeBounce(function () { return rememberTab(swiper.activeIndex); });
74
75
  };
75
76
  var handleTabChange = function (event, value) {
76
77
  var _a, _b;
77
78
  setActiveTab(value);
78
79
  (_b = (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(value);
79
- rememberTab(value);
80
+ rememberTabDeBounce(function () { return rememberTab(value); });
80
81
  };
81
82
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ width: "100%", display: "flex", flexDirection: "column" }, props.sx), children: [props.tabs && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
82
83
  maxWidth: "100%",
@@ -0,0 +1 @@
1
+ export default function createDebounce(delay: number): (func: () => any) => void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = createDebounce;
4
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5
+ function createDebounce(delay) {
6
+ var timeout;
7
+ return function (func) {
8
+ clearTimeout(timeout);
9
+ timeout = setTimeout(function () { return func(); }, delay);
10
+ };
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.494",
3
+ "version": "0.0.497",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",