@frontegg/react-hooks 7.11.0 → 7.12.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.
package/common/index.js CHANGED
@@ -6,12 +6,20 @@ import { useStore } from '../FronteggStoreContext';
6
6
  import { useSnapshot } from '../useSnapshot';
7
7
  import { FetchClient, createApiClient } from '@frontegg/rest-api';
8
8
  export const ShadowDomContext = /*#__PURE__*/createContext({});
9
+ const defaultPathOnRedirectTo = path => {
10
+ var _window$history, _window$history$pushS;
11
+ return typeof window !== 'undefined' && ((_window$history = window.history) == null ? void 0 : (_window$history$pushS = _window$history.pushState) == null ? void 0 : _window$history$pushS.call(_window$history, null, '', path));
12
+ };
13
+ const defaultHashOnRedirectTo = path => {
14
+ var _window$history2, _window$history2$push;
15
+ return typeof window !== 'undefined' && ((_window$history2 = window.history) == null ? void 0 : (_window$history2$push = _window$history2.pushState) == null ? void 0 : _window$history2$push.call(_window$history2, null, '', `#${path}`));
16
+ };
9
17
  export const useShadowDom = () => {
10
18
  var _rest$injector$name, _rest$injector;
11
19
  const context = useContext(ShadowDomContext);
12
20
  const {
13
21
  urlStrategy = 'path',
14
- onRedirectTo = urlStrategy === 'path' ? path => window.history.pushState(null, '', path) : path => window.history.pushState(null, '', `#${path}`),
22
+ onRedirectTo = urlStrategy === 'path' ? defaultPathOnRedirectTo : defaultHashOnRedirectTo,
15
23
  renderByRoute = false,
16
24
  customLoader = false,
17
25
  customStyles,
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.11.0
1
+ /** @license Frontegg v7.12.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -31,12 +31,20 @@ Object.keys(_CustomComponentHolder).forEach(function (key) {
31
31
  const _excluded = ["urlStrategy", "onRedirectTo", "renderByRoute", "customLoader", "customStyles", "contextOptions"];
32
32
  const ShadowDomContext = /*#__PURE__*/(0, _react.createContext)({});
33
33
  exports.ShadowDomContext = ShadowDomContext;
34
+ const defaultPathOnRedirectTo = path => {
35
+ var _window$history, _window$history$pushS;
36
+ return typeof window !== 'undefined' && ((_window$history = window.history) == null ? void 0 : (_window$history$pushS = _window$history.pushState) == null ? void 0 : _window$history$pushS.call(_window$history, null, '', path));
37
+ };
38
+ const defaultHashOnRedirectTo = path => {
39
+ var _window$history2, _window$history2$push;
40
+ return typeof window !== 'undefined' && ((_window$history2 = window.history) == null ? void 0 : (_window$history2$push = _window$history2.pushState) == null ? void 0 : _window$history2$push.call(_window$history2, null, '', `#${path}`));
41
+ };
34
42
  const useShadowDom = () => {
35
43
  var _rest$injector$name, _rest$injector;
36
44
  const context = (0, _react.useContext)(ShadowDomContext);
37
45
  const {
38
46
  urlStrategy = 'path',
39
- onRedirectTo = urlStrategy === 'path' ? path => window.history.pushState(null, '', path) : path => window.history.pushState(null, '', `#${path}`),
47
+ onRedirectTo = urlStrategy === 'path' ? defaultPathOnRedirectTo : defaultHashOnRedirectTo,
40
48
  renderByRoute = false,
41
49
  customLoader = false,
42
50
  customStyles,
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.11.0
1
+ /** @license Frontegg v7.12.0
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/react-hooks",
3
- "version": "7.11.0",
3
+ "version": "7.12.0",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Frontegg LTD",
7
7
  "dependencies": {
8
8
  "@babel/runtime": "^7.18.6",
9
- "@frontegg/redux-store": "7.11.0",
10
- "@frontegg/types": "7.11.0",
9
+ "@frontegg/redux-store": "7.12.0",
10
+ "@frontegg/types": "7.12.0",
11
11
  "@types/react": "*",
12
12
  "@types/react-is": "^17.0.7",
13
13
  "get-value": "^3.0.1",