@frontegg/react-hooks 6.69.0-alpha.0 → 6.70.0-alpha.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.
Files changed (72) hide show
  1. package/FronteggProvider/index.js +2 -18
  2. package/FronteggStoreContext/index.js +2 -2
  3. package/audits/auditLogs.js +0 -2
  4. package/audits/auditsMetadata.js +0 -2
  5. package/audits/hooks.js +1 -2
  6. package/auth/acceptInvitation.js +1 -2
  7. package/auth/activateAccount.js +0 -2
  8. package/auth/apiTokens.js +0 -2
  9. package/auth/forgotPassword.js +0 -2
  10. package/auth/hooks.js +4 -8
  11. package/auth/impersonate.js +0 -2
  12. package/auth/login.js +0 -2
  13. package/auth/mfa.js +0 -2
  14. package/auth/profile.js +0 -2
  15. package/auth/provisioning.js +0 -2
  16. package/auth/resetPhoneNumber.js +0 -2
  17. package/auth/restrictions.js +4 -4
  18. package/auth/roles.js +0 -2
  19. package/auth/securityPolicy.js +4 -4
  20. package/auth/sessions.js +0 -2
  21. package/auth/sessionsPolicy.js +0 -2
  22. package/auth/signup.js +0 -2
  23. package/auth/socialLogin.js +0 -2
  24. package/auth/sso.js +0 -2
  25. package/auth/team.js +0 -2
  26. package/auth/tenants.js +0 -2
  27. package/common/index.d.ts +1 -1
  28. package/common/index.js +8 -10
  29. package/connectivity/hooks.js +0 -2
  30. package/flags/useFeatureFlags.js +0 -1
  31. package/index.js +1 -1
  32. package/node/FronteggProvider/index.js +2 -32
  33. package/node/FronteggStoreContext/index.js +2 -8
  34. package/node/audits/auditLogs.js +0 -6
  35. package/node/audits/auditsMetadata.js +0 -6
  36. package/node/audits/hooks.js +1 -18
  37. package/node/audits/index.js +0 -5
  38. package/node/auth/acceptInvitation.js +1 -6
  39. package/node/auth/activateAccount.js +0 -6
  40. package/node/auth/apiTokens.js +0 -6
  41. package/node/auth/forgotPassword.js +0 -6
  42. package/node/auth/hooks.js +4 -38
  43. package/node/auth/impersonate.js +0 -6
  44. package/node/auth/index.js +0 -41
  45. package/node/auth/login.js +0 -6
  46. package/node/auth/mfa.js +0 -6
  47. package/node/auth/profile.js +0 -9
  48. package/node/auth/provisioning.js +0 -6
  49. package/node/auth/resetPhoneNumber.js +0 -6
  50. package/node/auth/restrictions.js +4 -13
  51. package/node/auth/roles.js +0 -6
  52. package/node/auth/securityPolicy.js +4 -13
  53. package/node/auth/sessions.js +0 -6
  54. package/node/auth/sessionsPolicy.js +0 -6
  55. package/node/auth/signup.js +0 -6
  56. package/node/auth/socialLogin.js +0 -6
  57. package/node/auth/sso.js +0 -6
  58. package/node/auth/team.js +0 -6
  59. package/node/auth/tenants.js +0 -6
  60. package/node/common/index.js +8 -19
  61. package/node/connectivity/hooks.js +0 -8
  62. package/node/connectivity/index.js +0 -1
  63. package/node/flags/index.js +0 -2
  64. package/node/flags/useFeatureFlags.js +0 -4
  65. package/node/index.js +1 -19
  66. package/node/subscriptions/hooks.js +0 -46
  67. package/node/subscriptions/index.js +0 -2
  68. package/node/vendor/hooks.js +0 -8
  69. package/node/vendor/index.js +0 -1
  70. package/package.json +3 -3
  71. package/subscriptions/hooks.js +0 -4
  72. package/vendor/hooks.js +0 -2
@@ -8,7 +8,6 @@ import { useAuth, useAuthRoutes } from '../auth';
8
8
  import { Provider, FronteggStoreContext } from '../FronteggStoreContext';
9
9
  import { Fragment as _Fragment } from "react/jsx-runtime";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
-
12
11
  const defaultSetLoading = loading => {
13
12
  if (loading) {
14
13
  document.body.classList.add('frontegg-loading');
@@ -16,7 +15,6 @@ const defaultSetLoading = loading => {
16
15
  document.body.classList.remove('frontegg-loading');
17
16
  }
18
17
  };
19
-
20
18
  const HideChildrenIfFronteggRoutes = ({
21
19
  children,
22
20
  basename
@@ -30,7 +28,6 @@ const HideChildrenIfFronteggRoutes = ({
30
28
  uriRef.current = window.location.pathname;
31
29
  setUri(document.location.pathname);
32
30
  }
33
-
34
31
  animationFrameRef.current = window.requestAnimationFrame(checker);
35
32
  }, []);
36
33
  useEffect(() => {
@@ -52,25 +49,20 @@ const HideChildrenIfFronteggRoutes = ({
52
49
  };
53
50
  }, [checker, setUri]);
54
51
  const calculatedBasename = basename ? basename.endsWith('/') ? basename.substring(0, basename.length - 1) : '' : '';
55
-
56
52
  const checkRoutes = _objectWithoutPropertiesLoose(routes, _excluded);
57
-
58
53
  if (Object.values(checkRoutes).map(url => `${calculatedBasename}${url}`).indexOf(uri) !== -1) {
59
54
  return null;
60
55
  }
61
-
62
56
  return /*#__PURE__*/_jsx(_Fragment, {
63
57
  children: children
64
58
  });
65
59
  };
66
-
67
60
  const FronteggContent = ({
68
61
  children,
69
62
  app,
70
63
  setLoading
71
64
  }) => {
72
65
  var _app$options, _app$options2;
73
-
74
66
  const {
75
67
  isLoading
76
68
  } = useAuth(({
@@ -82,44 +74,37 @@ const FronteggContent = ({
82
74
  const isNextJS = (app == null ? void 0 : (_app$options2 = app.options) == null ? void 0 : _app$options2.framework) === 'nextjs';
83
75
  const alwaysShowChildren = customLoginBox || isNextJS;
84
76
  const loadingRef = useRef(undefined);
85
-
86
77
  if (isLoading !== loadingRef.current && !isNextJS) {
87
78
  loadingRef.current = isLoading;
88
79
  setLoading(isLoading);
89
80
  }
90
-
91
81
  if (isLoading && !isNextJS) {
92
82
  return null;
93
83
  }
94
-
95
84
  if (alwaysShowChildren) {
96
85
  return /*#__PURE__*/_jsx(_Fragment, {
97
86
  children: children
98
87
  });
99
88
  }
100
-
101
89
  return /*#__PURE__*/_jsx(HideChildrenIfFronteggRoutes, {
102
90
  basename: app == null ? void 0 : app.options.basename,
103
91
  children: children
104
92
  });
105
93
  };
106
-
107
94
  export const FronteggStoreProvider = props => {
108
95
  var _app$options$contextO, _app$options3, _app$options$previewM, _app$options4, _app$options5, _app$options6;
109
-
110
96
  const {
111
97
  children,
112
98
  app,
113
99
  contextOptions,
114
100
  setLoading = defaultSetLoading
115
- } = props; // TODO: make this optionals more readable
101
+ } = props;
116
102
 
103
+ // TODO: make this optionals more readable
117
104
  const context = (_app$options$contextO = app == null ? void 0 : (_app$options3 = app.options) == null ? void 0 : _app$options3.contextOptions) != null ? _app$options$contextO : contextOptions;
118
-
119
105
  if (!context) {
120
106
  throw Error('contextOptions must not be null or undefined');
121
107
  }
122
-
123
108
  const previewMode = (_app$options$previewM = app == null ? void 0 : (_app$options4 = app.options) == null ? void 0 : _app$options4.previewMode) != null ? _app$options$previewM : false;
124
109
  const authOptions = app != null && (_app$options5 = app.options) != null && _app$options5.authOptions ? _extends({}, app.options.authOptions, {
125
110
  hostedLoginBox: app.options.hostedLoginBox
@@ -129,7 +114,6 @@ export const FronteggStoreProvider = props => {
129
114
  ContextHolder.setContext(context);
130
115
  const store = useMemo(() => {
131
116
  var _app$options7;
132
-
133
117
  return createFronteggStore({
134
118
  context
135
119
  }, app, previewMode, authOptions, undefined, false, app == null ? void 0 : (_app$options7 = app.options) == null ? void 0 : _app$options7.urlStrategy);
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { createSelectorHook, createDispatchHook, createStoreHook, Provider as ReactReduxProvider } from 'react-redux';
3
- export const FronteggStoreContext = /*#__PURE__*/React.createContext(null); // @ts-ignore
3
+ export const FronteggStoreContext = /*#__PURE__*/React.createContext(null);
4
4
 
5
+ // @ts-ignore
5
6
  if (process.env.NODE_ENV !== 'production') {
6
7
  FronteggStoreContext.displayName = 'FronteggStoreContext';
7
8
  }
8
-
9
9
  export const useSelector = createSelectorHook(FronteggStoreContext);
10
10
  export const useDispatch = createDispatchHook(FronteggStoreContext);
11
11
  export const useStore = createStoreHook(FronteggStoreContext);
@@ -1,8 +1,6 @@
1
1
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
2
2
  import { auditLogsActions, auditLogsReducers } from '@frontegg/redux-store';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useAuditLogsState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'auditLogsState');
8
6
  }
@@ -1,8 +1,6 @@
1
1
  import { auditsMetadataActions, auditsMetadataReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useAuditsMetadataState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'auditsMetadataState');
8
6
  }
package/audits/hooks.js CHANGED
@@ -15,10 +15,10 @@ export const useAuditsActions = () => {
15
15
  const dispatch = useDispatch();
16
16
  return useMemo(() => bindActionCreators(auditsActions, dispatch), [auditsActions]);
17
17
  };
18
+
18
19
  /**
19
20
  * hooks helpers
20
21
  */
21
-
22
22
  export const sliceReducerActionsBy = reducer => {
23
23
  const reducerKeys = Object.keys(reducer);
24
24
  const reducerActions = reducerKeys.map(key => ({
@@ -29,7 +29,6 @@ export const sliceReducerActionsBy = reducer => {
29
29
  export const stateHookGenerator = (stateMapper, subState) => {
30
30
  return useSelector(state => {
31
31
  var _stateMapper;
32
-
33
32
  return (_stateMapper = stateMapper == null ? void 0 : stateMapper(state[auditsStoreName][subState])) != null ? _stateMapper : state[auditsStoreName][subState];
34
33
  }, shallowEqual);
35
34
  };
@@ -1,8 +1,7 @@
1
1
  import { acceptInvitationReducers, acceptInvitationActions } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
  const defaultMapper = state => state;
5
-
6
5
  export function useAcceptInvitationState(stateMapper = defaultMapper) {
7
6
  return stateHookGenerator(stateMapper, 'acceptInvitationState');
8
7
  }
@@ -1,8 +1,6 @@
1
1
  import { activateAccountReducers, activateAccountActions } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useActivateAccountState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'activateState');
8
6
  }
package/auth/apiTokens.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { apiTokensActions, apiTokensReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useApiTokensState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'apiTokensState');
8
6
  }
@@ -1,8 +1,6 @@
1
1
  import { forgotPasswordReducers, forgotPasswordActions } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useForgotPasswordState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'forgotPasswordState');
8
6
  }
package/auth/hooks.js CHANGED
@@ -13,6 +13,7 @@ const defaultMapper = {
13
13
  export function useAuth(stateMapper = defaultMapper.state) {
14
14
  return useSelector(state => stateMapper(state[authStoreName]), shallowEqual);
15
15
  }
16
+
16
17
  /**
17
18
  * ```jsx
18
19
  * export const MyFunctionComponent = () => {
@@ -30,7 +31,6 @@ export function useAuth(stateMapper = defaultMapper.state) {
30
31
  *
31
32
  * use this frontegg hook function to get if user is "Authenticated"
32
33
  */
33
-
34
34
  export const useLoginWithRedirect = () => {
35
35
  const dispatch = useDispatch();
36
36
  return useMemo(() => bindActionCreators(authActions.requestHostedLoginAuthorize, dispatch), [authActions.requestHostedLoginAuthorize]);
@@ -41,11 +41,11 @@ export const useAuthActions = () => {
41
41
  };
42
42
  export const useOnRedirectTo = () => {
43
43
  var _context$onRedirectTo;
44
-
45
44
  const context = useContext(ShadowDomContext);
46
45
  return (_context$onRedirectTo = context == null ? void 0 : context.onRedirectTo) != null ? _context$onRedirectTo : ContextHolder.onRedirectTo;
47
46
  };
48
47
  export const useAuthRoutes = () => useAuth(state => _extends({}, state.routes));
48
+
49
49
  /**
50
50
  * ```jsx
51
51
  * export const MyFunctionComponent = () => {
@@ -56,12 +56,12 @@ export const useAuthRoutes = () => useAuth(state => _extends({}, state.routes));
56
56
  *
57
57
  * use this frontegg hook function to get if user is "Authenticated"
58
58
  */
59
-
60
59
  export const useIsAuthenticated = () => useSelector(({
61
60
  [authStoreName]: {
62
61
  isAuthenticated
63
62
  }
64
63
  }) => isAuthenticated, shallowEqual);
64
+
65
65
  /**
66
66
  * ```jsx
67
67
  * export const MyFunctionComponent = () => {
@@ -73,21 +73,18 @@ export const useIsAuthenticated = () => useSelector(({
73
73
  * use this frontegg hook function to get the authenticated user
74
74
  * the return user is null if not authenticated
75
75
  */
76
-
77
76
  export const useAuthUser = () => {
78
77
  const routes = useAuthRoutes();
79
78
  const onRedirectTo = useOnRedirectTo();
80
79
  const user = useAuthUserOrNull();
81
80
  const isSSR = typeof window === 'undefined';
82
81
  const noUser = {};
83
-
84
82
  if (user == null && !isSSR) {
85
83
  onRedirectTo(routes.loginUrl, {
86
84
  refresh: true
87
85
  });
88
86
  return noUser;
89
87
  }
90
-
91
88
  return user || noUser;
92
89
  };
93
90
  export const useAuthUserOrNull = () => {
@@ -102,10 +99,10 @@ export const useAuthUserOrNull = () => {
102
99
  }), shallowEqual);
103
100
  return user || null;
104
101
  };
102
+
105
103
  /**
106
104
  * hooks helpers
107
105
  */
108
-
109
106
  export const sliceReducerActionsBy = reducer => {
110
107
  const reducerKeys = Object.keys(reducer);
111
108
  const reducerActions = reducerKeys.map(key => ({
@@ -116,7 +113,6 @@ export const sliceReducerActionsBy = reducer => {
116
113
  export const stateHookGenerator = (stateMapper, subState) => {
117
114
  return useSelector(state => {
118
115
  var _stateMapper;
119
-
120
116
  return (_stateMapper = stateMapper == null ? void 0 : stateMapper(state[authStoreName][subState])) != null ? _stateMapper : state[authStoreName][subState];
121
117
  }, shallowEqual);
122
118
  };
@@ -1,8 +1,6 @@
1
1
  import { impersonateActions, impersonateReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useImpersonateState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'impersonateState');
8
6
  }
package/auth/login.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { loginReducers, loginActions } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useLoginState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'loginState');
8
6
  }
package/auth/mfa.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { mfaActions, mfaReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useMfaState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'mfaState');
8
6
  }
package/auth/profile.js CHANGED
@@ -12,9 +12,7 @@ export const reloadProfileIfNeeded = () => {
12
12
  !loading && loadProfile();
13
13
  }, []);
14
14
  };
15
-
16
15
  const defaultMapper = state => state;
17
-
18
16
  export function useProfileState(stateMapper = defaultMapper) {
19
17
  return stateHookGenerator(stateMapper, 'profileState');
20
18
  }
@@ -1,8 +1,6 @@
1
1
  import { provisioningActions, provisioningReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useProvisioningState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'provisioningState');
8
6
  }
@@ -1,8 +1,6 @@
1
1
  import { resetPhoneNumberReducers, resetPhoneNumberActions } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useResetPhoneNumberState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'resetPhoneNumberState');
8
6
  }
@@ -1,9 +1,7 @@
1
1
  import { restrictionsReducers, restrictionsActions } from '@frontegg/redux-store';
2
2
  import { useEffect } from 'react';
3
3
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
4
-
5
4
  const defaultMapper = state => state;
6
-
7
5
  export function useRestrictionsState(stateMapper = defaultMapper) {
8
6
  return stateHookGenerator(stateMapper, 'restrictionsState');
9
7
  }
@@ -22,7 +20,8 @@ export const useIpRestrictions = (loadOnMount = false) => {
22
20
  loadIpRestrictions
23
21
  } = useRestrictionsActions();
24
22
  useEffect(() => {
25
- (loadOnMount || !data) && loadIpRestrictions(); // eslint-disable-next-line react-hooks/exhaustive-deps
23
+ (loadOnMount || !data) && loadIpRestrictions();
24
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26
25
  }, [loadOnMount, loadIpRestrictions]);
27
26
  return {
28
27
  loading,
@@ -45,7 +44,8 @@ export const useEmailDomainRestrictions = (loadOnMount = false) => {
45
44
  loadEmailDomainRestrictions
46
45
  } = useRestrictionsActions();
47
46
  useEffect(() => {
48
- (loadOnMount || !data) && loadEmailDomainRestrictions(); // eslint-disable-next-line react-hooks/exhaustive-deps
47
+ (loadOnMount || !data) && loadEmailDomainRestrictions();
48
+ // eslint-disable-next-line react-hooks/exhaustive-deps
49
49
  }, [loadOnMount, loadEmailDomainRestrictions]);
50
50
  return {
51
51
  loading,
package/auth/roles.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { rolesReducers, rolesActions } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useRolesState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'rolesState');
8
6
  }
@@ -1,9 +1,7 @@
1
1
  import { securityPolicyActions, securityPolicyReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
3
  import { useEffect } from 'react';
4
-
5
4
  const defaultMapper = state => state;
6
-
7
5
  export function useSecurityPolicyState(stateMapper = defaultMapper) {
8
6
  return stateHookGenerator(stateMapper, 'securityPolicyState');
9
7
  }
@@ -19,7 +17,8 @@ export const usePublicPolicySettings = (loadOnMount = false) => {
19
17
  loadPublicSecurityPolicy
20
18
  } = useSecurityPolicyActions();
21
19
  useEffect(() => {
22
- (loadOnMount || !policy) && loadPublicSecurityPolicy(); // eslint-disable-next-line react-hooks/exhaustive-deps
20
+ (loadOnMount || !policy) && loadPublicSecurityPolicy();
21
+ // eslint-disable-next-line react-hooks/exhaustive-deps
23
22
  }, [loadOnMount, loadPublicSecurityPolicy]);
24
23
  return {
25
24
  loading,
@@ -39,7 +38,8 @@ export const usePublicAuthStrategiesPolicySettings = (loadOnMount = false) => {
39
38
  loadPublicAuthStrategiesPolicy
40
39
  } = useSecurityPolicyActions();
41
40
  useEffect(() => {
42
- (loadOnMount || !policy) && loadPublicAuthStrategiesPolicy(); // eslint-disable-next-line react-hooks/exhaustive-deps
41
+ (loadOnMount || !policy) && loadPublicAuthStrategiesPolicy();
42
+ // eslint-disable-next-line react-hooks/exhaustive-deps
43
43
  }, [loadOnMount, loadPublicAuthStrategiesPolicy]);
44
44
  return {
45
45
  loading,
package/auth/sessions.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { sessionsActions, sessionsReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useSessionsState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'sessionsState');
8
6
  }
@@ -1,8 +1,6 @@
1
1
  import { sessionsPolicyActions, sessionsPolicyReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useSessionsPolicyState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'sessionsPolicyState');
8
6
  }
package/auth/signup.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { signUpReducers, signUpActions } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useSignUpState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'signUpState');
8
6
  }
@@ -1,8 +1,6 @@
1
1
  import { socialLoginsActions, socialLoginsReducer } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useSocialLoginState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'socialLoginState');
8
6
  }
package/auth/sso.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { ssoActions, ssoReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useSSOState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'ssoState');
8
6
  }
package/auth/team.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { teamActions, teamReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useAuthTeamState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'teamState');
8
6
  }
package/auth/tenants.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { tenantsActions, tenantsReducers } from '@frontegg/redux-store';
2
2
  import { reducerActionsGenerator, stateHookGenerator } from './hooks';
3
-
4
3
  const defaultMapper = state => state;
5
-
6
4
  export function useTenantsState(stateMapper = defaultMapper) {
7
5
  return stateHookGenerator(stateMapper, 'tenantsState');
8
6
  }
package/common/index.d.ts CHANGED
@@ -1,6 +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
+ import type { FronteggState } from '@frontegg/redux-store';
4
4
  interface ShadowDomContextData extends FronteggAppOptions {
5
5
  injector: FronteggAppInstance;
6
6
  iframeRendering: boolean;
package/common/index.js CHANGED
@@ -7,17 +7,15 @@ import { shallowEqual } from 'react-redux';
7
7
  export const ShadowDomContext = /*#__PURE__*/createContext({});
8
8
  export const useShadowDom = () => {
9
9
  const context = useContext(ShadowDomContext);
10
-
11
10
  const {
12
- urlStrategy = 'path',
13
- onRedirectTo = urlStrategy === 'path' ? path => window.history.pushState(null, '', path) : path => window.history.pushState(null, '', `#${path}`),
14
- renderByRoute = false,
15
- customLoader = false,
16
- customStyles,
17
- contextOptions
18
- } = context,
19
- rest = _objectWithoutPropertiesLoose(context, _excluded);
20
-
11
+ urlStrategy = 'path',
12
+ onRedirectTo = urlStrategy === 'path' ? path => window.history.pushState(null, '', path) : path => window.history.pushState(null, '', `#${path}`),
13
+ renderByRoute = false,
14
+ customLoader = false,
15
+ customStyles,
16
+ contextOptions
17
+ } = context,
18
+ rest = _objectWithoutPropertiesLoose(context, _excluded);
21
19
  return _extends({
22
20
  isShadowDom: true,
23
21
  onRedirectTo,
@@ -2,9 +2,7 @@ import { useMemo } from 'react';
2
2
  import { shallowEqual } from 'react-redux';
3
3
  import { useSelector, useDispatch } from '../FronteggStoreContext';
4
4
  import { bindActionCreators, connectivityActions, connectivityStoreName } from '@frontegg/redux-store';
5
-
6
5
  const defaultMapper = state => state;
7
-
8
6
  export function useConnectivityState(stateMapper = defaultMapper) {
9
7
  return useSelector(state => stateMapper(state[connectivityStoreName]), shallowEqual);
10
8
  }
@@ -1,7 +1,6 @@
1
1
  import { useShadowDom } from '../common';
2
2
  export const useFeatureFlags = (...flags) => {
3
3
  var _injector$flags;
4
-
5
4
  const {
6
5
  injector
7
6
  } = useShadowDom();
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.69.0-alpha.0
1
+ /** @license Frontegg v6.70.0-alpha.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.