@frontegg/redux-store 6.80.0 → 6.81.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.
@@ -52,11 +52,11 @@ export declare function getMfaRequiredState(user: any): Generator<import("redux-
52
52
  }>;
53
53
  export declare function refreshToken(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<any>, void, AuthState>;
54
54
  export declare function refreshTokenForSocialLogins(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<any>, void, AuthState>;
55
- export declare function shouldShowPromptPasskeys(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<IWebAuthnDevices> | import("redux-saga/effects").PutEffect<{
55
+ export declare function shouldShowPromptPasskeys(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<boolean[]> | CallEffect<IWebAuthnDevices> | import("redux-saga/effects").PutEffect<{
56
56
  payload: Partial<import("../..").PasskeysState>;
57
57
  type: string;
58
58
  }>, boolean, {
59
59
  publicAuthStrategyPolicy: any;
60
- } & IWebAuthnDevices>;
60
+ } & boolean[] & IWebAuthnDevices>;
61
61
  export declare function loginSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
62
62
  export declare function loginSagasMock(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
@@ -29,7 +29,7 @@ import { MFAStep } from '../MfaState/interfaces';
29
29
  import { dummyIps, userDemo } from '../dummy';
30
30
  import { SamlVendors } from '../SSOState/interfaces';
31
31
  import { loadVendorPublicInfo } from '../../vendor/saga';
32
- import { createRandomString, generateCodeChallenge, useFeatureFlags } from '../../helpers';
32
+ import { createRandomString, generateCodeChallenge, getFeatureFlags } from '../../helpers';
33
33
  import { ResetPhoneNumberStep } from '../ResetPhoneNumberState/interfaces';
34
34
  import { base64urlDecode, delay, publicKeyCredentialToJSON } from '../utils';
35
35
  import { loadPublicAuthStrategiesPolicy } from '../SecurityPolicyState/saga';
@@ -784,7 +784,7 @@ export function* shouldShowPromptPasskeys() {
784
784
  const isPasskeysEnabledByVendor = useIsPasskeysEnabled(policy);
785
785
  const isLoggedInWithPasskeys = localStorage.getItem('preferred-login-method') === 'Passkeys';
786
786
  const isMarkedDontShowAgainPrompt = localStorage.getItem('dont-show-again-prompt-passkeys') === 'true';
787
- const [showPasskeys] = useFeatureFlags(['show-passkeys']);
787
+ const [showPasskeys] = yield call(getFeatureFlags, ['show-passkeys']);
788
788
  if (!showPasskeys || !isPasskeysEnabledByVendor || isLoggedInWithPasskeys || isMarkedDontShowAgainPrompt) {
789
789
  return false;
790
790
  } else {
@@ -1,11 +1,11 @@
1
1
  import { IVendorConfig } from '@frontegg/rest-api';
2
2
  import { IAuthStrategiesConfig } from '@frontegg/rest-api';
3
- export declare function loadPublicSecurityPolicy(): Generator<import("redux-saga/effects").CallEffect<IVendorConfig> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | import("redux-saga/effects").PutEffect<{
3
+ export declare function loadPublicSecurityPolicy(): Generator<import("redux-saga/effects").CallEffect<IVendorConfig> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | import("redux-saga/effects").CallEffect<boolean[]> | import("redux-saga/effects").PutEffect<{
4
4
  payload: Partial<import("../../interfaces").WithStatus & {
5
5
  policy?: IVendorConfig | undefined;
6
6
  }>;
7
7
  type: string;
8
- }>, void, IVendorConfig & IAuthStrategiesConfig>;
8
+ }>, void, IVendorConfig & boolean[] & IAuthStrategiesConfig>;
9
9
  export declare function loadPublicAuthStrategiesPolicy(): Generator<import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | import("redux-saga/effects").PutEffect<{
10
10
  payload: Partial<import("../../interfaces").WithStatus & {
11
11
  policy?: IAuthStrategiesConfig | undefined;
@@ -11,7 +11,7 @@ import { api } from '@frontegg/rest-api';
11
11
  import { actions } from '../reducer';
12
12
  import { delay } from '../utils';
13
13
  import { policyDemo, policyMfaDemo, policyLockoutDemo, policyPasswordHistoryDemo, publicSecurityPolicy } from '../dummy';
14
- import { useFeatureFlags } from '../../helpers';
14
+ import { getFeatureFlags } from '../../helpers';
15
15
  function* loadSecurityPolicy() {
16
16
  yield put(actions.setSecurityPolicyGlobalState({
17
17
  loading: true,
@@ -44,7 +44,7 @@ export function* loadPublicSecurityPolicy() {
44
44
  }));
45
45
  try {
46
46
  const policy = yield call(api.auth.getVendorConfig);
47
- const [withLoginPerTenant] = useFeatureFlags(['admin_portal_login_per_tenant']);
47
+ const [withLoginPerTenant] = yield call(getFeatureFlags, ['admin_portal_login_per_tenant']);
48
48
  if (withLoginPerTenant) {
49
49
  const authStrategies = yield call(api.auth.getVendorPublicAuthStrategiesConfig);
50
50
  if (authStrategies.mainAuthStrategies.length > 0) {
@@ -5,37 +5,37 @@ import { AuthState } from '../interfaces';
5
5
  export declare function loadAllowSignUps(): Generator<import("redux-saga/effects").PutEffect<{
6
6
  payload: Partial<import("./interfaces").SignUpState>;
7
7
  type: string;
8
- }> | import("redux-saga/effects").CallEffect<IVendorConfig> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | import("redux-saga/effects").PutEffect<{
8
+ }> | import("redux-saga/effects").CallEffect<IVendorConfig> | import("redux-saga/effects").CallEffect<IAuthStrategiesConfig> | import("redux-saga/effects").CallEffect<boolean[]> | import("redux-saga/effects").PutEffect<{
9
9
  payload: Partial<import("../../interfaces").WithStatus & {
10
10
  policy?: IVendorConfig | undefined;
11
11
  }>;
12
12
  type: string;
13
- }>, void, IVendorConfig & IAuthStrategiesConfig>;
13
+ }>, void, IVendorConfig & IAuthStrategiesConfig & boolean[]>;
14
14
  export declare function signUpUser({ payload: { events, url, ...payload } }: PayloadAction<ISignUpUserPayload>): Generator<import("redux-saga/effects").PutEffect<{
15
15
  payload: Partial<import("./interfaces").SignUpState>;
16
16
  type: string;
17
17
  }> | import("redux-saga/effects").SelectEffect | import("redux-saga/effects").CallEffect<import("@frontegg/rest-api").ISignUpResponse> | Generator<import("redux-saga/effects").SelectEffect | import("redux-saga/effects").CallEffect<import("@frontegg/rest-api").IAllowedToRememberMfaDevice>, {
18
18
  user: undefined;
19
19
  isAuthenticated: boolean;
20
- mfaState: Partial<import("..").MFAState>;
20
+ mfaState: Partial<import("../..").MFAState>;
21
21
  loginState: {
22
22
  mfaToken: any;
23
23
  mfaRequired: any;
24
24
  loading: boolean;
25
25
  error: undefined;
26
- step: import("..").LoginStep.loginWithTwoFactor | import("..").LoginStep.forceTwoFactor;
26
+ step: import("../..").LoginStep.loginWithTwoFactor | import("../..").LoginStep.forceTwoFactor;
27
27
  tenantsLoading: boolean;
28
28
  email: any;
29
29
  tenants: never[];
30
30
  allowRememberMfaDevice: any;
31
31
  mfaDeviceExpiration: any;
32
- flow: import("..").LoginFlow;
32
+ flow: import("../..").LoginFlow;
33
33
  ssoRedirectUrl?: string | undefined;
34
34
  inviteTokenTenantName?: string | undefined;
35
35
  inviteTokenError?: string | undefined;
36
36
  isNewUser?: boolean | undefined;
37
37
  phoneNumber?: string | undefined;
38
- quickLoginToRegister?: import("..").QuickLoginStrategy | undefined;
38
+ quickLoginToRegister?: import("../..").QuickLoginStrategy | undefined;
39
39
  changePhoneId?: string | undefined;
40
40
  };
41
41
  }, AuthState & {
@@ -6,7 +6,7 @@ import { actions } from '../reducer';
6
6
  import { SignUpStage } from './interfaces';
7
7
  import { AuthenticationTypes } from '../interfaces';
8
8
  import { getMfaRequiredState, isMfaRequired } from '../LoginState/saga';
9
- import { useFeatureFlags } from '../../helpers';
9
+ import { getFeatureFlags } from '../../helpers';
10
10
  export function* loadAllowSignUps() {
11
11
  yield put(actions.setSignUpState({
12
12
  loading: true
@@ -14,7 +14,7 @@ export function* loadAllowSignUps() {
14
14
  try {
15
15
  const policy = yield call(api.auth.getVendorConfig);
16
16
  const authStrategies = yield call(api.auth.getVendorPublicAuthStrategiesConfig);
17
- const [withLoginPerTenant] = useFeatureFlags(['admin_portal_login_per_tenant']);
17
+ const [withLoginPerTenant] = yield call(getFeatureFlags, ['admin_portal_login_per_tenant']);
18
18
  if (withLoginPerTenant) {
19
19
  const authStrategies = yield call(api.auth.getVendorPublicAuthStrategiesConfig);
20
20
  if (authStrategies.mainAuthStrategies.length > 0) {
package/helpers.d.ts CHANGED
@@ -1,6 +1,7 @@
1
+ import { SelectEffect } from 'redux-saga/effects';
1
2
  export declare function omitProps<T>(props: any, keys: string[]): T;
2
- export declare function generateActionCreator(storeName: string): <Payload>(key: string, withPayload?: boolean | undefined) => import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Payload], Payload, string, never, never> | import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
3
+ export declare function generateActionCreator(storeName: string): <Payload>(key: string, withPayload?: boolean | undefined) => import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string> | import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Payload], Payload, string, never, never>;
3
4
  export declare function generateCodeChallenge(codeVerifier: string): Promise<string>;
4
5
  export declare function createRandomString(length?: number): string;
5
6
  export declare const readFileAsText: (file: File) => Promise<string>;
6
- export declare const useFeatureFlags: (flags: string[]) => boolean[];
7
+ export declare function getFeatureFlags(flags: string[]): Generator<SelectEffect, boolean[], string>;
package/helpers.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { FeatureFlags } from '@frontegg/rest-api';
3
3
  import { createAction } from '@reduxjs/toolkit';
4
-
4
+ import { select } from 'redux-saga/effects';
5
5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
6
  export function omitProps(props, keys) {
7
7
  const newProps = _extends({}, props);
@@ -35,6 +35,7 @@ export const readFileAsText = file => new Promise((resolve, reject) => {
35
35
  reader.onload = () => resolve(reader.result);
36
36
  reader.onerror = reject;
37
37
  });
38
- export const useFeatureFlags = flags => {
39
- return FeatureFlags.getFeatureFlags(flags);
40
- };
38
+ export function* getFeatureFlags(flags) {
39
+ const appName = yield select(state => state.root.appName);
40
+ return FeatureFlags.getFeatureFlags(flags, appName);
41
+ }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.80.0
1
+ /** @license Frontegg v6.81.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.
@@ -801,7 +801,7 @@ function* shouldShowPromptPasskeys() {
801
801
  const isPasskeysEnabledByVendor = (0, _helpers2.useIsPasskeysEnabled)(policy);
802
802
  const isLoggedInWithPasskeys = localStorage.getItem('preferred-login-method') === 'Passkeys';
803
803
  const isMarkedDontShowAgainPrompt = localStorage.getItem('dont-show-again-prompt-passkeys') === 'true';
804
- const [showPasskeys] = (0, _helpers.useFeatureFlags)(['show-passkeys']);
804
+ const [showPasskeys] = yield (0, _effects.call)(_helpers.getFeatureFlags, ['show-passkeys']);
805
805
  if (!showPasskeys || !isPasskeysEnabledByVendor || isLoggedInWithPasskeys || isMarkedDontShowAgainPrompt) {
806
806
  return false;
807
807
  } else {
@@ -55,7 +55,7 @@ function* loadPublicSecurityPolicy() {
55
55
  }));
56
56
  try {
57
57
  const policy = yield (0, _effects.call)(_restApi.api.auth.getVendorConfig);
58
- const [withLoginPerTenant] = (0, _helpers.useFeatureFlags)(['admin_portal_login_per_tenant']);
58
+ const [withLoginPerTenant] = yield (0, _effects.call)(_helpers.getFeatureFlags, ['admin_portal_login_per_tenant']);
59
59
  if (withLoginPerTenant) {
60
60
  const authStrategies = yield (0, _effects.call)(_restApi.api.auth.getVendorPublicAuthStrategiesConfig);
61
61
  if (authStrategies.mainAuthStrategies.length > 0) {
@@ -24,7 +24,7 @@ function* loadAllowSignUps() {
24
24
  try {
25
25
  const policy = yield (0, _effects.call)(_restApi.api.auth.getVendorConfig);
26
26
  const authStrategies = yield (0, _effects.call)(_restApi.api.auth.getVendorPublicAuthStrategiesConfig);
27
- const [withLoginPerTenant] = (0, _helpers.useFeatureFlags)(['admin_portal_login_per_tenant']);
27
+ const [withLoginPerTenant] = yield (0, _effects.call)(_helpers.getFeatureFlags, ['admin_portal_login_per_tenant']);
28
28
  if (withLoginPerTenant) {
29
29
  const authStrategies = yield (0, _effects.call)(_restApi.api.auth.getVendorPublicAuthStrategiesConfig);
30
30
  if (authStrategies.mainAuthStrategies.length > 0) {
package/node/helpers.js CHANGED
@@ -7,11 +7,13 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.createRandomString = createRandomString;
8
8
  exports.generateActionCreator = generateActionCreator;
9
9
  exports.generateCodeChallenge = generateCodeChallenge;
10
+ exports.getFeatureFlags = getFeatureFlags;
10
11
  exports.omitProps = omitProps;
11
- exports.useFeatureFlags = exports.readFileAsText = void 0;
12
+ exports.readFileAsText = void 0;
12
13
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
14
  var _restApi = require("@frontegg/rest-api");
14
15
  var _toolkit = require("@reduxjs/toolkit");
16
+ var _effects = require("redux-saga/effects");
15
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
18
  function omitProps(props, keys) {
17
19
  const newProps = (0, _extends2.default)({}, props);
@@ -46,7 +48,7 @@ const readFileAsText = file => new Promise((resolve, reject) => {
46
48
  reader.onerror = reject;
47
49
  });
48
50
  exports.readFileAsText = readFileAsText;
49
- const useFeatureFlags = flags => {
50
- return _restApi.FeatureFlags.getFeatureFlags(flags);
51
- };
52
- exports.useFeatureFlags = useFeatureFlags;
51
+ function* getFeatureFlags(flags) {
52
+ const appName = yield (0, _effects.select)(state => state.root.appName);
53
+ return _restApi.FeatureFlags.getFeatureFlags(flags, appName);
54
+ }
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v6.80.0
1
+ /** @license Frontegg v6.81.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.
@@ -55,7 +55,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
55
55
  const initialState = {
56
56
  context: undefined,
57
57
  urlStrategy: 'path',
58
- previewMode: false
58
+ previewMode: false,
59
+ appName: 'default'
59
60
  };
60
61
  const {
61
62
  reducer: rootReducer
@@ -88,7 +89,7 @@ const createFronteggStore = (rootInitialState, storeHolder, previewMode = false,
88
89
  holder = window;
89
90
  }
90
91
  if (!holder.store) {
91
- var _overrideInitialState, _authInitialState$rou, _overrideInitialState2, _overrideInitialState3, _overrideInitialState4, _overrideInitialState5, _overrideInitialState6, _overrideInitialState7, _overrideInitialState8, _overrideInitialState9;
92
+ var _storeHolder$name, _overrideInitialState, _authInitialState$rou, _overrideInitialState2, _overrideInitialState3, _overrideInitialState4, _overrideInitialState5, _overrideInitialState6, _overrideInitialState7, _overrideInitialState8, _overrideInitialState9;
92
93
  if (!previewMode && !builderMode) {
93
94
  _restApi.ContextHolder.setContext(rootInitialState.context);
94
95
  }
@@ -104,7 +105,8 @@ const createFronteggStore = (rootInitialState, storeHolder, previewMode = false,
104
105
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
106
  root: (0, _extends2.default)({}, rootInitialState, {
106
107
  previewMode,
107
- urlStrategy: urlStrategy
108
+ urlStrategy: urlStrategy,
109
+ appName: (_storeHolder$name = storeHolder == null ? void 0 : storeHolder.name) != null ? _storeHolder$name : 'default'
108
110
  }),
109
111
  [_auth.default.storeName]: (0, _extends2.default)({}, _auth.default.initialState, authInitialState, (_overrideInitialState = overrideInitialState == null ? void 0 : overrideInitialState.auth) != null ? _overrideInitialState : {}, {
110
112
  routes: (0, _extends2.default)({}, _auth.default.initialState.routes, (_authInitialState$rou = authInitialState == null ? void 0 : authInitialState.routes) != null ? _authInitialState$rou : {}, (_overrideInitialState2 = overrideInitialState == null ? void 0 : (_overrideInitialState3 = overrideInitialState.auth) == null ? void 0 : _overrideInitialState3.routes) != null ? _overrideInitialState2 : {})
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "6.80.0",
3
+ "version": "6.81.0-alpha.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/rest-api": "3.0.90",
9
+ "@frontegg/rest-api": "^3.0.92",
10
10
  "@reduxjs/toolkit": "^1.8.5",
11
11
  "redux-saga": "^1.2.1",
12
12
  "uuid": "^8.3.2"
@@ -7,6 +7,7 @@ export * from './redux';
7
7
  export * from './redux-saga';
8
8
  declare type InitialState = {
9
9
  context: ContextOptions;
10
+ appName: string;
10
11
  };
11
12
  export { bindActionCreators } from '@reduxjs/toolkit';
12
13
  export type { CaseReducerActions, SliceCaseReducers } from '@reduxjs/toolkit';
@@ -14,6 +15,7 @@ export interface RootState {
14
15
  context?: ContextOptions;
15
16
  urlStrategy: 'hash' | 'path';
16
17
  previewMode?: boolean;
18
+ appName: string;
17
19
  }
18
20
  export declare const createFronteggStore: (rootInitialState: InitialState, storeHolder?: any, previewMode?: boolean, authInitialState?: (Partial<Pick<AuthState, "user" | "error" | "onRedirectTo" | "isAuthenticated" | "userIp" | "isLoading" | "keepSessionAlive" | "isSSOAuth" | "ssoACS" | "includeQueryParam" | "loginState" | "activateState" | "acceptInvitationState" | "forgotPasswordState" | "resetPhoneNumberState" | "ssoState" | "profileState" | "mfaState" | "teamState" | "groupsState" | "groupsDialogsState" | "socialLoginState" | "signUpState" | "apiTokensState" | "securityPolicyState" | "restrictionsState" | "provisioningState" | "accountSettingsState" | "tenantsState" | "rolesState" | "sessionsState" | "hostedLoginBox" | "disableSilentRefresh" | "sessionsPolicyState" | "impersonateState" | "passkeysState" | "header" | "loaderComponent">> & {
19
21
  routes?: Partial<AuthPageRoutes> | undefined;
package/toolkit/index.js CHANGED
@@ -16,7 +16,8 @@ export { bindActionCreators } from '@reduxjs/toolkit';
16
16
  const initialState = {
17
17
  context: undefined,
18
18
  urlStrategy: 'path',
19
- previewMode: false
19
+ previewMode: false,
20
+ appName: 'default'
20
21
  };
21
22
  const {
22
23
  reducer: rootReducer
@@ -49,7 +50,7 @@ export const createFronteggStore = (rootInitialState, storeHolder, previewMode =
49
50
  holder = window;
50
51
  }
51
52
  if (!holder.store) {
52
- var _overrideInitialState, _authInitialState$rou, _overrideInitialState2, _overrideInitialState3, _overrideInitialState4, _overrideInitialState5, _overrideInitialState6, _overrideInitialState7, _overrideInitialState8, _overrideInitialState9;
53
+ var _storeHolder$name, _overrideInitialState, _authInitialState$rou, _overrideInitialState2, _overrideInitialState3, _overrideInitialState4, _overrideInitialState5, _overrideInitialState6, _overrideInitialState7, _overrideInitialState8, _overrideInitialState9;
53
54
  if (!previewMode && !builderMode) {
54
55
  ContextHolder.setContext(rootInitialState.context);
55
56
  }
@@ -65,7 +66,8 @@ export const createFronteggStore = (rootInitialState, storeHolder, previewMode =
65
66
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
67
  root: _extends({}, rootInitialState, {
67
68
  previewMode,
68
- urlStrategy: urlStrategy
69
+ urlStrategy: urlStrategy,
70
+ appName: (_storeHolder$name = storeHolder == null ? void 0 : storeHolder.name) != null ? _storeHolder$name : 'default'
69
71
  }),
70
72
  [authStore.storeName]: _extends({}, authStore.initialState, authInitialState, (_overrideInitialState = overrideInitialState == null ? void 0 : overrideInitialState.auth) != null ? _overrideInitialState : {}, {
71
73
  routes: _extends({}, authStore.initialState.routes, (_authInitialState$rou = authInitialState == null ? void 0 : authInitialState.routes) != null ? _authInitialState$rou : {}, (_overrideInitialState2 = overrideInitialState == null ? void 0 : (_overrideInitialState3 = overrideInitialState.auth) == null ? void 0 : _overrideInitialState3.routes) != null ? _overrideInitialState2 : {})