dry-ux 1.37.0 → 1.38.0

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.
@@ -40,3 +40,5 @@ export declare const StorageUtils: {
40
40
  isStorageAvailable: () => boolean;
41
41
  };
42
42
  export declare const toHashCode: (input: string) => number;
43
+ export declare const insertUrlParam: (key: string, value: any) => void;
44
+ export declare const getUrlParams: <T>() => T;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toHashCode = exports.StorageUtils = exports.fnWithAuthCheck = exports.formatDollar = exports.useCountdown = exports.importStyleSheet = exports.importScript = exports.preventDefault = void 0;
3
+ exports.getUrlParams = exports.insertUrlParam = exports.toHashCode = exports.StorageUtils = exports.fnWithAuthCheck = exports.formatDollar = exports.useCountdown = exports.importStyleSheet = exports.importScript = exports.preventDefault = void 0;
4
4
  const React = require("react");
5
5
  /**
6
6
  * Returns a function that will call the given handler and prevent the default event behavior.
@@ -129,3 +129,26 @@ const toHashCode = (input) => {
129
129
  return hash;
130
130
  };
131
131
  exports.toHashCode = toHashCode;
132
+ const insertUrlParam = (key, value) => {
133
+ if (history.pushState) {
134
+ let searchParams = new URLSearchParams(window.location.search);
135
+ searchParams.set(key, value);
136
+ let newUrl = window.location.protocol +
137
+ "//" +
138
+ window.location.host +
139
+ window.location.pathname +
140
+ "?" +
141
+ searchParams.toString();
142
+ window.history.pushState({ path: newUrl }, "", newUrl);
143
+ }
144
+ };
145
+ exports.insertUrlParam = insertUrlParam;
146
+ const getUrlParams = () => {
147
+ const searchParams = new URLSearchParams(window.location.search);
148
+ const params = {};
149
+ for (const [key, value] of searchParams.entries()) {
150
+ params[key] = value;
151
+ }
152
+ return params;
153
+ };
154
+ exports.getUrlParams = getUrlParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dry-ux",
3
- "version": "1.37.0",
3
+ "version": "1.38.0",
4
4
  "description": "",
5
5
  "main": "dist/index",
6
6
  "scripts": {