@frontegg/redux-store 7.10.0 → 7.11.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 (108) hide show
  1. package/audits/AuditLogsState/actions.js +2 -2
  2. package/audits/AuditsMetadataState/actions.js +2 -2
  3. package/auth/AcceptInvitationState/actions.js +2 -2
  4. package/auth/AccountSettingsState/actions.js +2 -2
  5. package/auth/ActivateAccountState/actions.js +2 -2
  6. package/auth/ApiTokensState/actions.js +2 -2
  7. package/auth/ApplicationsState/actions.js +2 -2
  8. package/auth/CustomLoginState/actions.js +2 -2
  9. package/auth/ForgotPasswordState/actions.js +2 -2
  10. package/auth/GroupsDialogsState/actions.js +2 -2
  11. package/auth/GroupsState/actions.js +2 -2
  12. package/auth/ImpersonateState/actions.js +2 -2
  13. package/auth/LoginState/actions/index.js +2 -2
  14. package/auth/LoginState/actions/mfaRequiredState.actions.js +7 -4
  15. package/auth/MSP/actions.js +3 -3
  16. package/auth/MSP/dialogs/actions.js +11 -12
  17. package/auth/MfaState/actions.js +2 -2
  18. package/auth/PasskeysState/actions.js +2 -2
  19. package/auth/ProfileState/actions.js +2 -2
  20. package/auth/ProvisioningState/actions.js +2 -2
  21. package/auth/ResetPhoneNumberState/actions.js +2 -2
  22. package/auth/RolesState/actions.js +2 -2
  23. package/auth/SSOState/actions/actions.v1.js +2 -2
  24. package/auth/Security/SecurityCenterState/actions.js +2 -2
  25. package/auth/Security/SecurityPolicyState/actions.js +2 -2
  26. package/auth/Security/SessionsPolicyState/actions.js +2 -2
  27. package/auth/SessionsState/actions.js +2 -2
  28. package/auth/SignUpState/actions.js +2 -2
  29. package/auth/SmsState/actions.js +2 -2
  30. package/auth/SocialLoginState/actions.js +2 -2
  31. package/auth/StepUpState/actions/index.js +2 -2
  32. package/auth/TeamState/actions/index.js +2 -2
  33. package/auth/TenantsState/actions.js +2 -2
  34. package/auth/UnlockAccountState/actions.js +2 -2
  35. package/auth/index.js +2 -2
  36. package/connectivity/actions.js +2 -2
  37. package/helpers/common.d.ts +9 -1
  38. package/helpers/common.js +27 -4
  39. package/index.js +1 -1
  40. package/mocks/auth-mocks/index.d.ts +2 -2
  41. package/mocks/auth-mocks/index.js +5 -3
  42. package/mocks/index.d.ts +4 -3
  43. package/mocks/index.js +2 -2
  44. package/mocks/subscriptions-mocks/stripeActions.mocks.d.ts +2 -0
  45. package/node/audits/AuditLogsState/actions.js +1 -1
  46. package/node/audits/AuditsMetadataState/actions.js +1 -1
  47. package/node/auth/AcceptInvitationState/actions.js +1 -1
  48. package/node/auth/AccountSettingsState/actions.js +1 -1
  49. package/node/auth/ActivateAccountState/actions.js +1 -1
  50. package/node/auth/ApiTokensState/actions.js +1 -1
  51. package/node/auth/ApplicationsState/actions.js +1 -1
  52. package/node/auth/CustomLoginState/actions.js +1 -1
  53. package/node/auth/ForgotPasswordState/actions.js +1 -1
  54. package/node/auth/GroupsDialogsState/actions.js +1 -1
  55. package/node/auth/GroupsState/actions.js +1 -1
  56. package/node/auth/ImpersonateState/actions.js +1 -1
  57. package/node/auth/LoginState/actions/index.js +1 -1
  58. package/node/auth/LoginState/actions/mfaRequiredState.actions.js +7 -4
  59. package/node/auth/MSP/actions.js +2 -2
  60. package/node/auth/MSP/dialogs/actions.js +10 -11
  61. package/node/auth/MfaState/actions.js +1 -1
  62. package/node/auth/PasskeysState/actions.js +1 -1
  63. package/node/auth/ProfileState/actions.js +1 -1
  64. package/node/auth/ProvisioningState/actions.js +1 -1
  65. package/node/auth/ResetPhoneNumberState/actions.js +1 -1
  66. package/node/auth/RolesState/actions.js +1 -1
  67. package/node/auth/SSOState/actions/actions.v1.js +1 -1
  68. package/node/auth/Security/SecurityCenterState/actions.js +1 -1
  69. package/node/auth/Security/SecurityPolicyState/actions.js +1 -1
  70. package/node/auth/Security/SessionsPolicyState/actions.js +1 -1
  71. package/node/auth/SessionsState/actions.js +1 -1
  72. package/node/auth/SignUpState/actions.js +1 -1
  73. package/node/auth/SmsState/actions.js +1 -1
  74. package/node/auth/SocialLoginState/actions.js +1 -1
  75. package/node/auth/StepUpState/actions/index.js +1 -1
  76. package/node/auth/TeamState/actions/index.js +1 -1
  77. package/node/auth/TenantsState/actions.js +1 -1
  78. package/node/auth/UnlockAccountState/actions.js +1 -1
  79. package/node/auth/index.js +1 -1
  80. package/node/connectivity/actions.js +1 -1
  81. package/node/helpers/common.js +30 -6
  82. package/node/index.js +1 -1
  83. package/node/mocks/auth-mocks/index.js +4 -2
  84. package/node/mocks/index.js +2 -2
  85. package/node/subscriptions/Billing/Information/actions.js +1 -1
  86. package/node/subscriptions/Billing/Invoices/actions.js +1 -1
  87. package/node/subscriptions/Billing/PaymentMethod/actions.js +1 -1
  88. package/node/subscriptions/Billing/Subscription/actions.js +1 -1
  89. package/node/subscriptions/Checkout/actions.js +1 -1
  90. package/node/subscriptions/Config/actions.js +1 -1
  91. package/node/subscriptions/Plans/actions.js +1 -1
  92. package/node/subscriptions/Stripe/actions.js +4 -2
  93. package/node/subscriptions/VendorPublicConfig/actions.js +1 -1
  94. package/node/toolkit/store.js +4 -3
  95. package/node/vendor/actions.js +1 -1
  96. package/package.json +2 -1
  97. package/subscriptions/Billing/Information/actions.js +2 -2
  98. package/subscriptions/Billing/Invoices/actions.js +2 -2
  99. package/subscriptions/Billing/PaymentMethod/actions.js +2 -2
  100. package/subscriptions/Billing/Subscription/actions.js +2 -2
  101. package/subscriptions/Checkout/actions.js +2 -2
  102. package/subscriptions/Config/actions.js +2 -2
  103. package/subscriptions/Plans/actions.js +2 -2
  104. package/subscriptions/Stripe/actions.d.ts +3 -1
  105. package/subscriptions/Stripe/actions.js +5 -3
  106. package/subscriptions/VendorPublicConfig/actions.js +2 -2
  107. package/toolkit/store.js +4 -3
  108. package/vendor/actions.js +2 -2
@@ -1,13 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { initialState } from './state';
3
- import { deepClone, errorHandler } from '../../helpers';
3
+ import { deepResetState, errorHandler } from '../../helpers';
4
4
  export default ((store, api, sharedActions) => {
5
5
  const actions = sharedActions;
6
6
  const setAuditLogsState = state => {
7
7
  Object.assign(store.auditLogs.auditLogsState, state);
8
8
  };
9
9
  const resetAuditLogsState = () => {
10
- store.auditLogs.auditLogsState = deepClone(initialState);
10
+ deepResetState(store, ['auditLogs', 'auditLogsState'], initialState);
11
11
  };
12
12
  const exportAuditsCsv = async () => {
13
13
  const state = store.auditLogs.auditLogsState;
@@ -1,12 +1,12 @@
1
1
  import { initialState } from './state';
2
- import { deepClone } from '../../helpers';
2
+ import { deepResetState } from '../../helpers';
3
3
  export default ((store, api, sharedActions) => {
4
4
  const actions = sharedActions;
5
5
  const setAuditsMetadataState = state => {
6
6
  Object.assign(store.auditLogs.auditsMetadataState, state);
7
7
  };
8
8
  const resetAuditsMetadataState = () => {
9
- store.auditLogs.auditsMetadataState = deepClone(initialState);
9
+ deepResetState(store, ['auditLogs', 'auditsMetadataState'], initialState);
10
10
  };
11
11
  const loadAuditsMetadata = async () => {
12
12
  setAuditsMetadataState({
@@ -1,13 +1,13 @@
1
1
  import { AcceptInvitationStep } from './interfaces';
2
2
  import { initialState } from './state';
3
- import { deepClone, errorHandler } from '../../helpers';
3
+ import { deepResetState, errorHandler } from '../../helpers';
4
4
  export default ((store, api, sharedActions) => {
5
5
  const actions = sharedActions;
6
6
  const setAcceptInvitationState = state => {
7
7
  Object.assign(store.auth.acceptInvitationState, state);
8
8
  };
9
9
  const resetAcceptInvitationState = () => {
10
- store.auth.acceptInvitationState = deepClone(initialState);
10
+ deepResetState(store, ['auth', 'acceptInvitationState'], initialState);
11
11
  };
12
12
  const acceptInvitation = async payload => {
13
13
  if (!payload.token || !payload.userId) {
@@ -2,14 +2,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["activeTenant", "tenants"];
4
4
  import { initialState } from './state';
5
- import { errorHandler, deepClone } from '../../helpers';
5
+ import { errorHandler, deepResetState } from '../../helpers';
6
6
  export default ((store, api, sharedActions) => {
7
7
  const actions = sharedActions;
8
8
  const setAccountSettingsState = state => {
9
9
  Object.assign(store.auth.accountSettingsState, state);
10
10
  };
11
11
  const resetAccountSettingsState = () => {
12
- store.auth.accountSettingsState = deepClone(initialState);
12
+ deepResetState(store, ['auth', 'accountSettingsState'], initialState);
13
13
  };
14
14
  const updateTenantState = ({
15
15
  newSettingValues
@@ -6,7 +6,7 @@ const _excluded = ["callback", "events"],
6
6
  _excluded4 = ["callback"];
7
7
  import { initialState } from './state';
8
8
  import { ContextHolder } from '@frontegg/rest-api';
9
- import { errorHandler, deepClone, delay } from '../../helpers';
9
+ import { errorHandler, delay, deepResetState } from '../../helpers';
10
10
  import { ActivateAccountStep } from './interfaces';
11
11
  import { UserVeirifedOriginTypes } from '../interfaces';
12
12
  import { GTMEventAction, reportGTMEvent } from '../../helpers/gtm';
@@ -18,7 +18,7 @@ export default ((store, api, sharedActions) => {
18
18
  Object.assign(store.auth.activateAccountState, state);
19
19
  };
20
20
  const resetActivateState = () => {
21
- store.auth.activateAccountState = deepClone(initialState);
21
+ deepResetState(store, ['auth', 'activateAccountState'], initialState);
22
22
  };
23
23
  const setActivateStrategyState = state => {
24
24
  Object.assign(store.auth.activateAccountState.activationStrategy, state);
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { initialState } from './state';
3
3
  import { MachineToMachineAuthStrategy } from '@frontegg/rest-api';
4
- import { errorHandler, deepClone, delay } from '../../helpers';
4
+ import { errorHandler, delay, deepResetState } from '../../helpers';
5
5
  import { ApiStateKeys } from './interfaces';
6
6
  export default ((store, api, sharedActions) => {
7
7
  const actions = sharedActions;
@@ -26,7 +26,7 @@ export default ((store, api, sharedActions) => {
26
26
  Object.assign(store.auth.apiTokensState, state);
27
27
  };
28
28
  const resetApiTokensState = () => {
29
- store.auth.apiTokensState = deepClone(initialState);
29
+ deepResetState(store, ['auth', 'apiTokensState'], initialState);
30
30
  };
31
31
  const loadApiTokens = async payload => {
32
32
  if (!(payload != null && payload.silentLoading)) {
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { ApplicationAccessType } from '@frontegg/rest-api';
3
- import { deepClone, errorHandler } from '../../helpers';
3
+ import { deepResetState, errorHandler } from '../../helpers';
4
4
  import { initialState } from './state';
5
5
  import { getFlattenAppIds } from './helpers';
6
6
  export default ((store, api, sharedActions) => {
@@ -9,7 +9,7 @@ export default ((store, api, sharedActions) => {
9
9
  Object.assign(store.auth.applicationsState, payload);
10
10
  };
11
11
  const resetApplicationsState = () => {
12
- store.auth.applicationsState = deepClone(initialState);
12
+ deepResetState(store, ['auth', 'applicationsState'], initialState);
13
13
  };
14
14
  const loadUserApplications = async () => {
15
15
  setApplicationsState({
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["callback"];
4
4
  import { initialState } from './state';
5
- import { errorHandler, deepClone } from '../../helpers';
5
+ import { errorHandler, deepResetState } from '../../helpers';
6
6
  import { mapMetaDataObjectToActions } from '../helpers';
7
7
  import { ContextHolder } from '@frontegg/rest-api';
8
8
  import { getSearchParamsFromUrl } from '../LoginState/helpers';
@@ -12,7 +12,7 @@ export default ((store, api, sharedActions) => {
12
12
  Object.assign(store.auth.customLoginState, payload);
13
13
  };
14
14
  const resetCustomLoginState = () => {
15
- store.auth.customLoginState = deepClone(initialState);
15
+ deepResetState(store, ['auth', 'customLoginState'], initialState);
16
16
  };
17
17
  const loadTenantMetadata = async () => {
18
18
  setCustomLoginState({
@@ -2,14 +2,14 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  const _excluded = ["callback"];
3
3
  import { ForgotPasswordStep } from './interfaces';
4
4
  import { initialState } from './state';
5
- import { errorHandler, deepClone } from '../../helpers';
5
+ import { errorHandler, deepResetState } from '../../helpers';
6
6
  export default ((store, api, sharedActions) => {
7
7
  const actions = sharedActions;
8
8
  const setForgotPasswordState = payload => {
9
9
  Object.assign(store.auth.forgotPasswordState, payload);
10
10
  };
11
11
  const resetForgotPasswordState = () => {
12
- store.auth.forgotPasswordState = deepClone(initialState);
12
+ deepResetState(store, ['auth', 'forgotPasswordState'], initialState);
13
13
  };
14
14
  const forgotPassword = async payload => {
15
15
  setForgotPasswordState({
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { deepClone } from '../../helpers';
2
+ import { deepResetState } from '../../helpers';
3
3
  import { initialState } from './state';
4
4
  export default ((store, api, sharedActions) => {
5
5
  const setGroupsDialogsState = payload => {
6
6
  Object.assign(store.auth.groupsDialogsState, payload);
7
7
  };
8
8
  const resetGroupsDialogsState = () => {
9
- store.auth.groupsDialogsState = deepClone(initialState);
9
+ deepResetState(store, ['auth', 'groupsDialogsState'], initialState);
10
10
  };
11
11
  const openAddGroupDialog = () => {
12
12
  store.auth.groupsDialogsState.addGroupDialogState.open = true;
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["roleIds", "userIds"];
4
4
  import { GroupRelations, GroupsStateKeys } from './interfaces';
5
- import { errorHandler, deepClone } from '../../helpers';
5
+ import { errorHandler, deepResetState } from '../../helpers';
6
6
  import { initialState } from './state';
7
7
  export default ((store, api, sharedActions) => {
8
8
  const setUsersGroupsLoader = payload => {
@@ -26,7 +26,7 @@ export default ((store, api, sharedActions) => {
26
26
  Object.assign(store.auth.groupsState, payload);
27
27
  };
28
28
  const resetUsersGroupsState = () => {
29
- store.auth.groupsState = deepClone(initialState);
29
+ deepResetState(store, ['auth', 'groupsState'], initialState);
30
30
  };
31
31
  const loadGroups = async () => {
32
32
  const key = GroupsStateKeys.GET_GROUPS;
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  const _excluded = ["callback", "events"];
3
3
  import { ImpersonateStep } from './interfaces';
4
- import { errorHandler, deepClone, delay } from '../../helpers';
4
+ import { errorHandler, delay, deepResetState } from '../../helpers';
5
5
  import { initialState } from './state';
6
6
  export default ((store, api, sharedActions) => {
7
7
  const actions = sharedActions;
@@ -9,7 +9,7 @@ export default ((store, api, sharedActions) => {
9
9
  Object.assign(store.auth.impersonateState, state);
10
10
  };
11
11
  const resetImpersonateState = () => {
12
- store.auth.impersonateState = deepClone(initialState);
12
+ deepResetState(store, ['auth', 'impersonateState'], initialState);
13
13
  };
14
14
  const impersonate = async _payload => {
15
15
  const {
@@ -23,7 +23,7 @@ import mfaWithEmailCodeActions from './mfaWithEmailCode.actions';
23
23
  import mfaWithSMSActions from './mfaWithSMS.actions';
24
24
  import mfaWithWebAuthnActions from './mfaWithWebAuthn.actions';
25
25
  import { LoginFlow, LoginStep } from '../interfaces';
26
- import { base64urlDecode, deepClone, errorHandler, publicKeyCredentialToJSON } from '../../../helpers';
26
+ import { base64urlDecode, deepResetState, errorHandler, publicKeyCredentialToJSON } from '../../../helpers';
27
27
  import { initialState } from '../state';
28
28
  import { getSearchParam, isEmailPayload, TENANT_ID_PARAM_KEY } from '../helpers';
29
29
  import { AuthStrategyEnum, ContextHolder, WebAuthnDeviceType } from '@frontegg/rest-api';
@@ -248,7 +248,7 @@ export default ((store, api, sharedActions) => {
248
248
  Object.assign(store.auth.loginState, state);
249
249
  };
250
250
  const resetLoginState = () => {
251
- store.auth.loginState = deepClone(initialState);
251
+ deepResetState(store, ['auth', 'loginState'], initialState);
252
252
  };
253
253
  const requestAuthorize = async firstTime => {
254
254
  const calls = [];
@@ -1,19 +1,22 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { getMfaStepForEnrolledUsers, getMfaStepForNotEnrolledUsers } from '../helpers';
3
3
  import { LoginStep, LoginFlow } from '../interfaces';
4
- import { deepClone } from '../../../helpers';
5
- import { initialState as mfaInitialState } from '../../MfaState/state';
4
+ import { MFAStep } from '../../MfaState/interfaces';
6
5
  export default ((store, api, sharedActions) => {
7
6
  const actions = sharedActions;
8
7
  const getMfaRequiredState = async user => {
9
8
  let step = LoginStep.loginWithTwoFactor;
10
- const mfaState = deepClone(mfaInitialState);
9
+ const mfaState = {
10
+ step: MFAStep.verify,
11
+ loading: false,
12
+ saving: false
13
+ };
11
14
  const loginState = store.auth.loginState;
12
15
  const {
13
16
  isAllowedToRemember,
14
17
  mfaDeviceExpiration
15
18
  } = await api.auth.checkIfAllowToRememberMfaDevice(user.mfaToken);
16
- const isEnrolled = !(user.hasOwnProperty('mfaEnrolled') && !user.mfaEnrolled);
19
+ const isEnrolled = !('mfaEnrolled' in user && !user.mfaEnrolled);
17
20
  if (isEnrolled) {
18
21
  Object.assign(mfaState, {
19
22
  mfaDevices: user.mfaDevices,
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { AllAccountsStateKeys } from './interfaces';
3
- import { deepClone, errorHandler } from '../../helpers';
3
+ import { deepResetState, errorHandler } from '../../helpers';
4
4
  import { initialState } from './state';
5
5
  import { updateNodeSubAccountAccessType, appendChildrenToNode, getAccountsWithUsersCount, removeNodeFromTree, updateNodeName } from './helpers';
6
6
  import { updateNodeIsReseller } from './helpers/updateNodeIsReseller';
@@ -29,10 +29,10 @@ export default ((store, api, sharedActions) => {
29
29
  Object.assign(store.auth.allAccountsState.selectedAccount, payload);
30
30
  };
31
31
  const resetAllAccountsState = () => {
32
- store.auth.allAccountsState = deepClone(initialState);
32
+ deepResetState(store, ['auth', 'allAccountsState'], initialState);
33
33
  };
34
34
  const clearSelectedAccount = () => {
35
- store.auth.allAccountsState.selectedAccount = deepClone(initialState.selectedAccount);
35
+ deepResetState(store, ['auth', 'allAccountsState', 'selectedAccount'], initialState.selectedAccount);
36
36
  };
37
37
  const selectAllAccountsState = () => {
38
38
  return store.auth.allAccountsState;
@@ -1,13 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { deepClone } from '../../../helpers';
2
+ import { deepResetState } from '../../../helpers';
3
3
  import { initialState } from './state';
4
4
  export default ((store, api, sharedActions) => {
5
- const dialogsInitialState = deepClone(initialState);
6
5
  const setAllAccountDialogsState = payload => {
7
6
  Object.assign(store.auth.allAccountsDialogsState, payload);
8
7
  };
9
8
  const resetAllAccountDialogsState = () => {
10
- store.auth.allAccountsDialogsState = deepClone(initialState);
9
+ deepResetState(store, ['auth', 'allAccountsDialogsState'], initialState);
11
10
  };
12
11
 
13
12
  // Create new account dialog
@@ -17,7 +16,7 @@ export default ((store, api, sharedActions) => {
17
16
  }));
18
17
  };
19
18
  const closeCreateSubAccountDialog = () => {
20
- store.auth.allAccountsDialogsState.createSubAccountDialog = dialogsInitialState.createSubAccountDialog;
19
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'createSubAccountDialog'], initialState.createSubAccountDialog);
21
20
  };
22
21
 
23
22
  // Update account dialog
@@ -27,7 +26,7 @@ export default ((store, api, sharedActions) => {
27
26
  }));
28
27
  };
29
28
  const closeUpdateSubAccountDialog = () => {
30
- store.auth.allAccountsDialogsState.updateSubAccountDialog = dialogsInitialState.updateSubAccountDialog;
29
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'updateSubAccountDialog'], initialState.updateSubAccountDialog);
31
30
  };
32
31
 
33
32
  // Enable sub account management dialog
@@ -37,7 +36,7 @@ export default ((store, api, sharedActions) => {
37
36
  }));
38
37
  };
39
38
  const closeEnableSubAccountManagementDialog = () => {
40
- store.auth.allAccountsDialogsState.enableSubAccountManagementDialog = dialogsInitialState.enableSubAccountManagementDialog;
39
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'enableSubAccountManagementDialog'], initialState.enableSubAccountManagementDialog);
41
40
  };
42
41
 
43
42
  // Enable sub account management dialog
@@ -47,7 +46,7 @@ export default ((store, api, sharedActions) => {
47
46
  }));
48
47
  };
49
48
  const closeUpdateSubAccountHierarchySettingsDialog = () => {
50
- store.auth.allAccountsDialogsState.updateSubAccountHierarchySettingsDialog = dialogsInitialState.updateSubAccountHierarchySettingsDialog;
49
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'updateSubAccountHierarchySettingsDialog'], initialState.updateSubAccountHierarchySettingsDialog);
51
50
  };
52
51
 
53
52
  // Disable sub account management dialog
@@ -57,7 +56,7 @@ export default ((store, api, sharedActions) => {
57
56
  }));
58
57
  };
59
58
  const closeDisableSubAccountManagementDialog = () => {
60
- store.auth.allAccountsDialogsState.disableSubAccountManagementDialog = dialogsInitialState.disableSubAccountManagementDialog;
59
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'disableSubAccountManagementDialog'], initialState.disableSubAccountManagementDialog);
61
60
  };
62
61
 
63
62
  // Delete account dialog
@@ -67,7 +66,7 @@ export default ((store, api, sharedActions) => {
67
66
  }));
68
67
  };
69
68
  const closeDeleteSubAccountDialog = () => {
70
- store.auth.allAccountsDialogsState.deleteSubAccountDialog = dialogsInitialState.deleteSubAccountDialog;
69
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'deleteSubAccountDialog'], initialState.deleteSubAccountDialog);
71
70
  };
72
71
 
73
72
  // Add users to account dialog
@@ -77,7 +76,7 @@ export default ((store, api, sharedActions) => {
77
76
  }));
78
77
  };
79
78
  const closeAddUsersToAccountDialog = () => {
80
- store.auth.allAccountsDialogsState.addUsersToAccountDialog = dialogsInitialState.addUsersToAccountDialog;
79
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'addUsersToAccountDialog'], initialState.addUsersToAccountDialog);
81
80
  };
82
81
 
83
82
  // Delete user from account dialog
@@ -87,7 +86,7 @@ export default ((store, api, sharedActions) => {
87
86
  }));
88
87
  };
89
88
  const closeDeleteUserFromAccountDialog = () => {
90
- store.auth.allAccountsDialogsState.deleteUserFromAccountDialog = dialogsInitialState.deleteUserFromAccountDialog;
89
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'deleteUserFromAccountDialog'], initialState.deleteUserFromAccountDialog);
91
90
  };
92
91
 
93
92
  // Edit user roles dialog
@@ -97,7 +96,7 @@ export default ((store, api, sharedActions) => {
97
96
  }));
98
97
  };
99
98
  const closeEditUserRolesDialog = () => {
100
- store.auth.allAccountsDialogsState.editUserRolesDialog = dialogsInitialState.editUserRolesDialog;
99
+ deepResetState(store, ['auth', 'allAccountsDialogsState', 'editUserRolesDialog'], initialState.editUserRolesDialog);
101
100
  };
102
101
  return {
103
102
  setAllAccountDialogsState,
@@ -9,7 +9,7 @@ const _excluded = ["callback"],
9
9
  _excluded7 = ["callback"],
10
10
  _excluded8 = ["deviceId", "callback"];
11
11
  import { MFAStep } from './interfaces';
12
- import { errorHandler, base64urlDecode, deepClone, publicKeyCredentialToJSON } from '../../helpers';
12
+ import { errorHandler, base64urlDecode, publicKeyCredentialToJSON, deepResetState } from '../../helpers';
13
13
  import { initialState } from './state';
14
14
  export default ((store, api, sharedActions) => {
15
15
  const actions = sharedActions;
@@ -32,7 +32,7 @@ export default ((store, api, sharedActions) => {
32
32
  Object.assign(store.auth.mfaState, state);
33
33
  };
34
34
  const resetMfaState = () => {
35
- store.auth.mfaState = deepClone(initialState);
35
+ deepResetState(store, ['auth', 'mfaState'], initialState);
36
36
  };
37
37
  const getMFADevices = async () => {
38
38
  setMfaState({
@@ -1,4 +1,4 @@
1
- import { deepClone, errorHandler } from '../../helpers';
1
+ import { deepResetState, errorHandler } from '../../helpers';
2
2
  import { initialState } from './state';
3
3
  import { SecondaryAuthStrategy } from '@frontegg/rest-api';
4
4
  export default ((store, api, sharedActions) => {
@@ -7,7 +7,7 @@ export default ((store, api, sharedActions) => {
7
7
  Object.assign(store.auth.passkeysState, payload);
8
8
  };
9
9
  const resetPasskeysState = () => {
10
- store.auth.passkeysState = deepClone(initialState);
10
+ deepResetState(store, ['auth', 'passkeysState'], initialState);
11
11
  };
12
12
  const loadWebAuthnDevices = async () => {
13
13
  setPasskeysState({
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["callback", "profilePictureUrl"];
4
- import { base64ToFormData, deepClone, errorHandler, retry } from '../../helpers';
4
+ import { base64ToFormData, deepResetState, errorHandler, retry } from '../../helpers';
5
5
  import { initialState } from './state';
6
6
  export default ((store, api, sharedActions) => {
7
7
  const actions = sharedActions;
@@ -9,7 +9,7 @@ export default ((store, api, sharedActions) => {
9
9
  Object.assign(store.auth.profileState, state);
10
10
  };
11
11
  const resetProfileState = () => {
12
- store.auth.profileState = deepClone(initialState);
12
+ deepResetState(store, ['auth', 'profileState'], initialState);
13
13
  };
14
14
  const loadProfile = async () => {
15
15
  setProfileState({
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["callback"],
4
4
  _excluded2 = ["id"];
5
- import { deepClone, errorHandler } from '../../helpers';
5
+ import { deepResetState, errorHandler } from '../../helpers';
6
6
  import { initialState } from './state';
7
7
  export default ((store, api, sharedActions) => {
8
8
  const actions = sharedActions;
@@ -10,7 +10,7 @@ export default ((store, api, sharedActions) => {
10
10
  Object.assign(store.auth.provisioningState, state);
11
11
  };
12
12
  const resetProvisioningState = () => {
13
- store.auth.provisioningState = deepClone(initialState);
13
+ deepResetState(store, ['auth', 'provisioningState'], initialState);
14
14
  };
15
15
 
16
16
  /**
@@ -4,7 +4,7 @@ const _excluded = ["callback"],
4
4
  _excluded3 = ["callback"];
5
5
  import { AuthStrategyEnum } from '@frontegg/rest-api';
6
6
  import { ResetPhoneNumberStep } from './interfaces';
7
- import { deepClone, errorHandler } from '../../helpers';
7
+ import { deepResetState, errorHandler } from '../../helpers';
8
8
  import { initialState } from './state';
9
9
  import { LoginStep } from '../LoginState/interfaces';
10
10
  export default ((store, api, sharedActions) => {
@@ -13,7 +13,7 @@ export default ((store, api, sharedActions) => {
13
13
  Object.assign(store.auth.resetPhoneNumberState, state);
14
14
  };
15
15
  const resetResetPhoneNumberState = () => {
16
- store.auth.resetPhoneNumberState = deepClone(initialState);
16
+ deepResetState(store, ['auth', 'resetPhoneNumberState'], initialState);
17
17
  };
18
18
  const resetPhoneNumber = async payload => {
19
19
  const {
@@ -8,14 +8,14 @@ const _excluded = ["callback"],
8
8
  _excluded6 = ["callback"];
9
9
  import { RolesStateKeys } from './interfaces';
10
10
  import { initialState } from './state';
11
- import { deepClone, errorHandler } from '../../helpers';
11
+ import { deepResetState, errorHandler } from '../../helpers';
12
12
  export default ((store, api, sharedActions) => {
13
13
  const actions = sharedActions;
14
14
  const setRolesState = state => {
15
15
  Object.assign(store.auth.rolesState, state);
16
16
  };
17
17
  const resetRolesState = () => {
18
- store.auth.rolesState = deepClone(initialState);
18
+ deepResetState(store, ['auth', 'rolesState'], initialState);
19
19
  };
20
20
  const setRolesStateLoader = payload => {
21
21
  Object.assign(store.auth.rolesState, {
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["callback", "samlVendor"];
4
4
  import { SamlVendors } from '../interfaces';
5
- import { deepClone, errorHandler, omitProps, readFileAsText } from '../../../helpers';
5
+ import { deepResetState, errorHandler, omitProps, readFileAsText } from '../../../helpers';
6
6
  import { initialState } from '../state';
7
7
  export default ((store, api, sharedActions) => {
8
8
  const actions = sharedActions;
@@ -47,7 +47,7 @@ export default ((store, api, sharedActions) => {
47
47
  Object.assign(store.auth.ssoState, state);
48
48
  };
49
49
  const resetSSOState = () => {
50
- store.auth.ssoState = deepClone(initialState);
50
+ deepResetState(store, ['auth', 'ssoState'], initialState);
51
51
  };
52
52
  const setSSOLoader = payload => {
53
53
  Object.assign(store.auth.ssoState, {
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["callback"];
4
4
  import { SecurityCenterStateKeys } from './interfaces';
5
5
  import { GetUsersFilterPreset } from '@frontegg/rest-api';
6
- import { deepClone, errorHandler } from '../../../helpers';
6
+ import { deepResetState, errorHandler } from '../../../helpers';
7
7
  import { initialState } from './state';
8
8
  export default ((store, api, sharedActions) => {
9
9
  const actions = sharedActions;
@@ -128,7 +128,7 @@ export default ((store, api, sharedActions) => {
128
128
  Object.assign(store.auth.securityCenterState, state);
129
129
  };
130
130
  const resetSecurityCenterState = () => {
131
- store.auth.securityCenterState = deepClone(initialState);
131
+ deepResetState(store, ['auth', 'securityCenterState'], initialState);
132
132
  };
133
133
  const setSecurityCenterStateLoader = payload => {
134
134
  Object.assign(store.auth.securityCenterState, {
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["callback"],
4
4
  _excluded2 = ["callback"],
5
5
  _excluded3 = ["callback"];
6
- import { deepClone, errorHandler } from '../../../helpers';
6
+ import { deepResetState, errorHandler } from '../../../helpers';
7
7
  import { initialState } from './state';
8
8
  export default ((store, api, sharedActions) => {
9
9
  const actions = sharedActions;
@@ -98,7 +98,7 @@ export default ((store, api, sharedActions) => {
98
98
  Object.assign(store.auth.securityPolicyState.publicAuthStrategyPolicy, state);
99
99
  };
100
100
  const resetSecurityPolicyState = () => {
101
- store.auth.securityPolicyState = deepClone(initialState);
101
+ deepResetState(store, ['auth', 'securityPolicyState'], initialState);
102
102
  };
103
103
  const loadSecurityPolicy = async () => {
104
104
  await Promise.all([loadGlobalSecurityPolicy(), loadSecurityPolicyMfa(), loadSecurityPolicyVendorMfa(), loadSecurityPolicyLockout(), loadSecurityPolicyVendorLockout(), loadSecurityPolicyVendorPasswordHistory(), loadSecurityPolicyCaptcha(), loadPublicAuthStrategiesPolicy()]);
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  const _excluded = ["callback"];
3
- import { deepClone } from '../../../helpers';
3
+ import { deepResetState } from '../../../helpers';
4
4
  import { initialState } from './state';
5
5
  export default ((store, api, sharedActions) => {
6
6
  const actions = sharedActions;
@@ -8,7 +8,7 @@ export default ((store, api, sharedActions) => {
8
8
  Object.assign(store.auth.sessionsPolicyState, state);
9
9
  };
10
10
  const resetSessionsPolicyState = () => {
11
- store.auth.sessionsPolicyState = deepClone(initialState);
11
+ deepResetState(store, ['auth', 'sessionsPolicyState'], initialState);
12
12
  };
13
13
  const loadSessionsPolicy = async () => {
14
14
  setSessionsPolicyState({
@@ -1,11 +1,11 @@
1
- import { deepClone, errorHandler } from '../../helpers';
1
+ import { deepResetState, errorHandler } from '../../helpers';
2
2
  import { initialState } from './state';
3
3
  export default ((store, api, sharedActions) => {
4
4
  const setSessionsState = state => {
5
5
  Object.assign(store.auth.sessionsState, state);
6
6
  };
7
7
  const resetSessionsState = () => {
8
- store.auth.sessionsState = deepClone(initialState);
8
+ deepResetState(store, ['auth', 'sessionsState'], initialState);
9
9
  };
10
10
  const loadUserSessions = async () => {
11
11
  setSessionsState({
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["events", "url"];
4
4
  import { SignUpStage } from './interfaces';
5
- import { deepClone, errorHandler } from '../../helpers';
5
+ import { deepResetState, errorHandler } from '../../helpers';
6
6
  import { initialState } from './state';
7
7
  import { ContextHolder } from '@frontegg/rest-api';
8
8
  import { extractPhoneNumber, isMfaRequired } from '../helpers';
@@ -15,7 +15,7 @@ export default ((store, api, sharedActions) => {
15
15
  Object.assign(store.auth.signUpState, state);
16
16
  };
17
17
  const resetSignUpState = () => {
18
- store.auth.signUpState = deepClone(initialState);
18
+ deepResetState(store, ['auth', 'signUpState'], initialState);
19
19
  };
20
20
  const resetSignUpStateSoft = () => {
21
21
  const {
@@ -4,14 +4,14 @@ const _excluded = ["callback"],
4
4
  _excluded3 = ["callback", "phoneId"],
5
5
  _excluded4 = ["callback", "phoneId"],
6
6
  _excluded5 = ["callback"];
7
- import { deepClone, errorHandler } from '../../helpers';
7
+ import { deepResetState, errorHandler } from '../../helpers';
8
8
  import { initialState } from './state';
9
9
  export default ((store, api, sharedActions) => {
10
10
  const setSmsState = state => {
11
11
  Object.assign(store.auth.smsState, state);
12
12
  };
13
13
  const resetSmsState = () => {
14
- store.auth.smsState = deepClone(initialState);
14
+ deepResetState(store, ['auth', 'smsState'], initialState);
15
15
  };
16
16
  const loadPhoneNumbers = async () => {
17
17
  setSmsState({
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["authorizationUrl"],
4
4
  _excluded2 = ["events", "url"];
5
- import { deepClone, errorHandler } from '../../helpers';
5
+ import { deepResetState, errorHandler } from '../../helpers';
6
6
  import { initialState } from './state';
7
7
  import { AuthenticationTypes, UserVeirifedOriginTypes } from '../interfaces';
8
8
  import { GTMEventAction, reportGTMEvent } from '../../helpers/gtm';
@@ -26,7 +26,7 @@ export default ((store, api, sharedActions) => {
26
26
  Object.assign(store.auth.socialLoginState, state);
27
27
  };
28
28
  const resetSocialLoginsState = () => {
29
- store.auth.socialLoginState = deepClone(initialState);
29
+ deepResetState(store, ['auth', 'socialLoginState'], initialState);
30
30
  };
31
31
  const setSocialLoginError = payload => {
32
32
  setSocialLoginsState({