@frontegg/react-hooks 6.5.1 → 6.6.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.
@@ -127,9 +127,13 @@ export const FronteggStoreProvider = props => {
127
127
  hostedLoginBox: app == null ? void 0 : (_app$options7 = app.options) == null ? void 0 : _app$options7.hostedLoginBox
128
128
  };
129
129
  ContextHolder.setContext(context);
130
- const store = useMemo(() => createFronteggStore({
131
- context: context
132
- }, app, previewMode, authOptions), [app, previewMode]);
130
+ const store = useMemo(() => {
131
+ var _app$options8;
132
+
133
+ return createFronteggStore({
134
+ context: context
135
+ }, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$options8 = app.options) == null ? void 0 : _app$options8.urlStrategy);
136
+ }, [app, previewMode]);
133
137
  return /*#__PURE__*/_jsx(Provider, {
134
138
  context: FronteggStoreContext,
135
139
  store: store,
package/common/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
2
  import { FronteggAppInstance, FronteggAppOptions } from '@frontegg/types';
3
+ import { FronteggState } from '@frontegg/redux-store';
3
4
  interface ShadowDomContextData extends FronteggAppOptions {
4
5
  injector: FronteggAppInstance;
5
6
  iframeRendering: boolean;
@@ -14,4 +15,5 @@ export interface DomContext extends ShadowDomContextData {
14
15
  }
15
16
  export declare const ShadowDomContext: import("react").Context<ShadowDomContextData>;
16
17
  export declare const useShadowDom: () => DomContext;
18
+ export declare const useRootState: () => FronteggState['root'];
17
19
  export {};
package/common/index.js CHANGED
@@ -2,6 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["urlStrategy", "onRedirectTo", "renderByRoute", "customLoader", "customStyles", "contextOptions"];
4
4
  import { createContext, useContext } from 'react';
5
+ import { useSelector } from '../FronteggStoreContext';
6
+ import { shallowEqual } from 'react-redux';
5
7
  export const ShadowDomContext = /*#__PURE__*/createContext({});
6
8
  export const useShadowDom = () => {
7
9
  const context = useContext(ShadowDomContext);
@@ -27,4 +29,7 @@ export const useShadowDom = () => {
27
29
  requestCredentials: 'include'
28
30
  }, contextOptions)
29
31
  }, rest);
32
+ };
33
+ export const useRootState = () => {
34
+ return useSelector(state => state.root, shallowEqual);
30
35
  };
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.5.1
1
+ /** @license Frontegg v6.6.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.
@@ -148,9 +148,13 @@ const FronteggStoreProvider = props => {
148
148
 
149
149
  _restApi.ContextHolder.setContext(context);
150
150
 
151
- const store = (0, _react.useMemo)(() => (0, _reduxStore.createFronteggStore)({
152
- context: context
153
- }, app, previewMode, authOptions), [app, previewMode]);
151
+ const store = (0, _react.useMemo)(() => {
152
+ var _app$options8;
153
+
154
+ return (0, _reduxStore.createFronteggStore)({
155
+ context: context
156
+ }, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$options8 = app.options) == null ? void 0 : _app$options8.urlStrategy);
157
+ }, [app, previewMode]);
154
158
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FronteggStoreContext.Provider, {
155
159
  context: _FronteggStoreContext.FronteggStoreContext,
156
160
  store: store,
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.useShadowDom = exports.ShadowDomContext = void 0;
8
+ exports.useShadowDom = exports.useRootState = exports.ShadowDomContext = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
@@ -13,6 +13,10 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
13
13
 
14
14
  var _react = require("react");
15
15
 
16
+ var _FronteggStoreContext = require("../FronteggStoreContext");
17
+
18
+ var _reactRedux = require("react-redux");
19
+
16
20
  const _excluded = ["urlStrategy", "onRedirectTo", "renderByRoute", "customLoader", "customStyles", "contextOptions"];
17
21
  const ShadowDomContext = /*#__PURE__*/(0, _react.createContext)({});
18
22
  exports.ShadowDomContext = ShadowDomContext;
@@ -41,4 +45,10 @@ const useShadowDom = () => {
41
45
  }, rest);
42
46
  };
43
47
 
44
- exports.useShadowDom = useShadowDom;
48
+ exports.useShadowDom = useShadowDom;
49
+
50
+ const useRootState = () => {
51
+ return (0, _FronteggStoreContext.useSelector)(state => state.root, _reactRedux.shallowEqual);
52
+ };
53
+
54
+ exports.useRootState = useRootState;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.5.1
1
+ /** @license Frontegg v6.6.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": "6.5.1",
3
+ "version": "6.6.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": "6.5.1",
10
- "@frontegg/types": "6.5.1",
9
+ "@frontegg/redux-store": "6.6.0",
10
+ "@frontegg/types": "6.6.0",
11
11
  "@types/react": "*",
12
12
  "react-redux": "^7.x"
13
13
  },