@frontegg/redux-store 7.74.0-alpha.1 → 7.75.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 (38) hide show
  1. package/auth/LoginState/actions/index.js +13 -32
  2. package/auth/LoginState/helpers.d.ts +1 -2
  3. package/auth/LoginState/helpers.js +0 -3
  4. package/auth/ProfileState/actions.d.ts +7 -0
  5. package/auth/ProfileState/actions.js +58 -1
  6. package/auth/UsersEmailsPolicyState/actions.d.ts +5 -0
  7. package/auth/UsersEmailsPolicyState/actions.js +26 -0
  8. package/auth/UsersEmailsPolicyState/index.d.ts +3 -0
  9. package/auth/UsersEmailsPolicyState/index.js +3 -0
  10. package/auth/UsersEmailsPolicyState/interfaces.d.ts +8 -0
  11. package/auth/UsersEmailsPolicyState/interfaces.js +1 -0
  12. package/auth/UsersEmailsPolicyState/state.d.ts +4 -0
  13. package/auth/UsersEmailsPolicyState/state.js +6 -0
  14. package/auth/index.d.ts +5 -1
  15. package/auth/index.js +7 -2
  16. package/auth/interfaces.d.ts +2 -0
  17. package/index.js +1 -1
  18. package/mocks/auth-mocks/index.js +5 -2
  19. package/mocks/auth-mocks/profileActions.mocks.d.ts +7 -0
  20. package/mocks/auth-mocks/profileActions.mocks.js +30 -0
  21. package/mocks/auth-mocks/usersEmailsPolicyActions.mocks.d.ts +5 -0
  22. package/mocks/auth-mocks/usersEmailsPolicyActions.mocks.js +6 -0
  23. package/node/auth/LoginState/actions/index.js +12 -31
  24. package/node/auth/LoginState/helpers.js +1 -6
  25. package/node/auth/ProfileState/actions.js +58 -1
  26. package/node/auth/UsersEmailsPolicyState/actions.js +33 -0
  27. package/node/auth/UsersEmailsPolicyState/index.js +20 -0
  28. package/node/auth/UsersEmailsPolicyState/interfaces.js +5 -0
  29. package/node/auth/UsersEmailsPolicyState/state.js +14 -0
  30. package/node/auth/index.js +19 -3
  31. package/node/index.js +1 -1
  32. package/node/mocks/auth-mocks/index.js +5 -2
  33. package/node/mocks/auth-mocks/profileActions.mocks.js +30 -0
  34. package/node/mocks/auth-mocks/usersEmailsPolicyActions.mocks.js +13 -0
  35. package/node/toolkit/FronteggNativeModule.js +3 -3
  36. package/package.json +2 -2
  37. package/toolkit/FronteggNativeModule.d.ts +1 -1
  38. package/toolkit/FronteggNativeModule.js +3 -3
@@ -25,7 +25,7 @@ import mfaWithWebAuthnActions from './mfaWithWebAuthn.actions';
25
25
  import { LoginFlow, LoginStep } from '../interfaces';
26
26
  import { base64urlDecode, deepResetState, delay, errorHandler, errorTraceId, GTMEventAction, publicKeyCredentialToJSON, reportGTMEvent, retryIfNeeded, withRetryConfig } from '../../../helpers';
27
27
  import { initialState } from '../state';
28
- import { getSearchParam, isEmailPayload, isUsernamePayload, shouldShowPasswordRotationPromptFunc, TENANT_ID_PARAM_KEY } from '../helpers';
28
+ import { getSearchParam, isEmailPayload, shouldShowPasswordRotationPromptFunc, TENANT_ID_PARAM_KEY } from '../helpers';
29
29
  import { AuthStrategyEnum, ContextHolder, removeTabTenantFromSessionStorage, WebAuthnDeviceType } from '@frontegg/rest-api';
30
30
  import hostedLoginAuthorizeActions from './hostedLoginAuthorize.actions';
31
31
  import { FronteggNativeModule, isEntitlementsDeeplyEqual } from '../../../toolkit';
@@ -347,7 +347,6 @@ export default ((store, api, sharedActions) => {
347
347
  const preLogin = async payload => {
348
348
  const {
349
349
  email,
350
- username,
351
350
  recaptchaToken,
352
351
  invitationToken,
353
352
  callback
@@ -358,13 +357,10 @@ export default ((store, api, sharedActions) => {
358
357
  try {
359
358
  const onRedirectTo = store.auth.onRedirectTo;
360
359
  const tenantId = getSearchParam(TENANT_ID_PARAM_KEY);
361
- const preLoginResult = await api.auth.preLoginV2(_extends({}, email ? {
362
- email
363
- } : {}, username ? {
364
- username
365
- } : {}, {
360
+ const preLoginResult = await api.auth.preLoginV2({
361
+ email,
366
362
  tenantId
367
- }));
363
+ });
368
364
  const {
369
365
  address,
370
366
  idpType
@@ -378,8 +374,7 @@ export default ((store, api, sharedActions) => {
378
374
  ssoRedirectUrl += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
379
375
  }
380
376
  if (FronteggNativeModule.isLoginWithSSOAvailable()) {
381
- var _ref4;
382
- FronteggNativeModule.loginWithSSO((_ref4 = email != null ? email : username) != null ? _ref4 : '');
377
+ FronteggNativeModule.loginWithSSO(email);
383
378
  setLoginState({
384
379
  loading: false
385
380
  });
@@ -397,18 +392,16 @@ export default ((store, api, sharedActions) => {
397
392
  }, 2000);
398
393
  }
399
394
  } else {
400
- var _ref5;
401
395
  await ssoPreloginFailed({
402
- email: (_ref5 = email != null ? email : username) != null ? _ref5 : '',
396
+ email,
403
397
  recaptchaToken,
404
398
  callback,
405
399
  invitationToken
406
400
  });
407
401
  }
408
402
  } catch (e) {
409
- var _ref6;
410
403
  await ssoPreloginFailed({
411
- email: (_ref6 = email != null ? email : username) != null ? _ref6 : '',
404
+ email,
412
405
  recaptchaToken,
413
406
  callback,
414
407
  invitationToken,
@@ -444,7 +437,6 @@ export default ((store, api, sharedActions) => {
444
437
  const login = async payload => {
445
438
  const {
446
439
  email,
447
- username,
448
440
  password,
449
441
  recaptchaToken,
450
442
  invitationToken,
@@ -458,15 +450,12 @@ export default ((store, api, sharedActions) => {
458
450
  user,
459
451
  tenants = [],
460
452
  activeTenant
461
- } = await api.auth.loginv2(_extends({}, email ? {
462
- email
463
- } : {}, username ? {
464
- username
465
- } : {}, {
453
+ } = await api.auth.loginv2({
454
+ email,
466
455
  password,
467
456
  recaptchaToken,
468
457
  invitationToken
469
- }));
458
+ });
470
459
  const {
471
460
  onRedirectTo,
472
461
  routes
@@ -706,7 +695,6 @@ export default ((store, api, sharedActions) => {
706
695
  } = _payload,
707
696
  payload = _objectWithoutPropertiesLoose(_payload, _excluded5);
708
697
  try {
709
- var _username;
710
698
  setLoginState({
711
699
  loading: true
712
700
  });
@@ -714,16 +702,9 @@ export default ((store, api, sharedActions) => {
714
702
  if (isEmailPayload(payload)) {
715
703
  email = payload.email;
716
704
  }
717
- let username;
718
- if (isUsernamePayload(payload)) {
719
- username = payload.username;
720
- }
721
705
  // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
722
706
  // @ts-ignore
723
- const preloginRes = await api.auth.passwordlessPreLogin(_extends({}, payload, {
724
- email,
725
- username: (_username = username) != null ? _username : ''
726
- }));
707
+ const preloginRes = await api.auth.passwordlessPreLogin(payload);
727
708
  // @ts-ignore
728
709
  const step = authStrategyLoginStepMap[payload.type];
729
710
  setLoginState({
@@ -1315,11 +1296,11 @@ export default ((store, api, sharedActions) => {
1315
1296
  preserveQueryParams: true
1316
1297
  });
1317
1298
  } else {
1318
- var _ref7;
1299
+ var _ref4;
1319
1300
  if (user.id) {
1320
1301
  localStorage.setItem('userId', user.id);
1321
1302
  }
1322
- const quickLoginToRegister = (_ref7 = localStorage.getItem('register-quick-login')) != null ? _ref7 : loginState.quickLoginToRegister;
1303
+ const quickLoginToRegister = (_ref4 = localStorage.getItem('register-quick-login')) != null ? _ref4 : loginState.quickLoginToRegister;
1323
1304
  const shouldNavigateToRegisterQuickLogin = __shouldNavigateToRegisterQuickLogin(user);
1324
1305
  actions.afterAuthenticationStateUpdate({
1325
1306
  user: updatedUser,
@@ -1,4 +1,4 @@
1
- import { IEmailPasswordlessPreLogin, ILoginResponse, IPasswordlessPreLogin, IUsernamePasswordlessPreLogin, MFAStrategyEnum, UserMFADevicesResponse } from '@frontegg/rest-api';
1
+ import { IEmailPasswordlessPreLogin, ILoginResponse, IPasswordlessPreLogin, MFAStrategyEnum, UserMFADevicesResponse } from '@frontegg/rest-api';
2
2
  import { FronteggState } from '../../interfaces';
3
3
  import { User } from '../interfaces';
4
4
  import { MFAStep } from '../MfaState/interfaces';
@@ -29,6 +29,5 @@ export declare const getMfaStepForEnrolledUsers: (mfaDevices: UserMFADevicesResp
29
29
  export declare const getMfaStepForNotEnrolledUsers: (mfaStrategies: MFAStrategyEnum[]) => MFAStep.verify | MFAStep.authenticatorApp | MFAStep.smsSetPhoneNumber | MFAStep.emailVerifyCode;
30
30
  export declare const isOauthCallbackRoute: (activeUri: string) => boolean;
31
31
  export declare function isEmailPayload(payload: IPasswordlessPreLogin): payload is IEmailPasswordlessPreLogin;
32
- export declare function isUsernamePayload(payload: IPasswordlessPreLogin): payload is IUsernamePasswordlessPreLogin;
33
32
  export declare const getBaseNameWithoutSlashSuffix: (state: FronteggState) => string | null;
34
33
  export declare const shouldShowPasswordRotationPromptFunc: (user: ILoginResponse | User) => boolean;
@@ -126,9 +126,6 @@ export const isOauthCallbackRoute = activeUri => {
126
126
  export function isEmailPayload(payload) {
127
127
  return 'email' in payload;
128
128
  }
129
- export function isUsernamePayload(payload) {
130
- return 'username' in payload;
131
- }
132
129
  export const getBaseNameWithoutSlashSuffix = state => {
133
130
  const basename = ContextHolder.for(state.root.appName).getBasename();
134
131
  if (basename != null && basename.endsWith('/')) {
@@ -7,5 +7,12 @@ declare const _default: (store: FronteggState, api: RestApi, sharedActions: Shar
7
7
  loadProfile: () => Promise<void>;
8
8
  saveProfile: (_payload: SaveProfilePayload) => Promise<void>;
9
9
  changePassword: (payload: WithCallback<IChangePassword>) => Promise<void>;
10
+ updateEmail: (payload: WithCallback<{
11
+ email: string;
12
+ }, boolean>) => Promise<void>;
13
+ verifyEmail: (payload: WithCallback<{
14
+ email: string;
15
+ code: string;
16
+ }, boolean>) => Promise<void>;
10
17
  };
11
18
  export default _default;
@@ -30,6 +30,61 @@ export default ((store, api, sharedActions) => {
30
30
  });
31
31
  }
32
32
  };
33
+ const updateEmail = async payload => {
34
+ const {
35
+ email,
36
+ callback
37
+ } = payload;
38
+ setProfileState({
39
+ saving: true,
40
+ error: null,
41
+ loading: true
42
+ });
43
+ try {
44
+ await api.teams.updateEmail(email);
45
+ setProfileState({
46
+ saving: false,
47
+ error: null,
48
+ loading: false
49
+ });
50
+ callback == null ? void 0 : callback(true);
51
+ } catch (e) {
52
+ setProfileState({
53
+ saving: false,
54
+ error: errorHandler(e),
55
+ loading: false
56
+ });
57
+ callback == null ? void 0 : callback(null, e);
58
+ }
59
+ };
60
+ const verifyEmail = async payload => {
61
+ const {
62
+ email,
63
+ code,
64
+ callback
65
+ } = payload;
66
+ setProfileState({
67
+ saving: true,
68
+ error: null,
69
+ loading: true
70
+ });
71
+ try {
72
+ await api.teams.verifyEmail(email, code);
73
+ setProfileState({
74
+ saving: false,
75
+ error: null,
76
+ loading: false
77
+ });
78
+ callback == null ? void 0 : callback(true);
79
+ } catch (e) {
80
+ setProfileState({
81
+ saving: false,
82
+ error: errorHandler(e),
83
+ loading: false
84
+ });
85
+ callback == null ? void 0 : callback(null, e);
86
+ }
87
+ };
33
88
  const saveProfile = async _payload => {
34
89
  const {
35
90
  callback,
@@ -107,6 +162,8 @@ export default ((store, api, sharedActions) => {
107
162
  resetProfileState,
108
163
  loadProfile,
109
164
  saveProfile,
110
- changePassword
165
+ changePassword,
166
+ updateEmail,
167
+ verifyEmail
111
168
  };
112
169
  });
@@ -0,0 +1,5 @@
1
+ import type { FronteggState, RestApi, SharedActions } from '../../interfaces';
2
+ declare const _default: (store: FronteggState, api: RestApi, sharedActions: SharedActions) => {
3
+ loadUserEmailPolicyState: () => Promise<void>;
4
+ };
5
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { errorHandler } from '../../helpers';
2
+ export default ((store, api, sharedActions) => {
3
+ const setUserEmailPolicyState = payload => {
4
+ Object.assign(store.auth.userEmailPolicyState, payload);
5
+ };
6
+ const loadUserEmailPolicyState = async () => {
7
+ setUserEmailPolicyState({
8
+ loading: true
9
+ });
10
+ try {
11
+ const userEmailPolicyConfig = await api.userEmailPolicy.getUserEmailPolicyConfig();
12
+ setUserEmailPolicyState({
13
+ loading: false,
14
+ userEmailPolicyConfig
15
+ });
16
+ } catch (e) {
17
+ setUserEmailPolicyState({
18
+ loading: false,
19
+ error: errorHandler(e)
20
+ });
21
+ }
22
+ };
23
+ return {
24
+ loadUserEmailPolicyState
25
+ };
26
+ });
@@ -0,0 +1,3 @@
1
+ import createUserEmailPolicyState from './state';
2
+ import buildUserEmailPolicyActions from './actions';
3
+ export { createUserEmailPolicyState, buildUserEmailPolicyActions };
@@ -0,0 +1,3 @@
1
+ import createUserEmailPolicyState from './state';
2
+ import buildUserEmailPolicyActions from './actions';
3
+ export { createUserEmailPolicyState, buildUserEmailPolicyActions };
@@ -0,0 +1,8 @@
1
+ export interface UserEmailPolicyConfig {
2
+ allowEmailChange: boolean;
3
+ }
4
+ export interface UserEmailPolicyState {
5
+ userEmailPolicyConfig: Partial<UserEmailPolicyConfig> | null;
6
+ loading: boolean;
7
+ error?: any;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { UserEmailPolicyState } from './interfaces';
2
+ export declare const initialState: UserEmailPolicyState;
3
+ declare const _default: (overrideState?: Partial<UserEmailPolicyState>) => UserEmailPolicyState;
4
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { createProxy } from '../../toolkit/proxy';
2
+ export const initialState = {
3
+ userEmailPolicyConfig: null,
4
+ loading: false
5
+ };
6
+ export default (overrideState => createProxy(initialState, overrideState));
package/auth/index.d.ts CHANGED
@@ -32,6 +32,7 @@ import { buildSSOActions } from './SSOState';
32
32
  import { buildStepUpActions } from './StepUpState';
33
33
  import { buildTeamActions } from './TeamState';
34
34
  import { buildTenantsActions } from './TenantsState';
35
+ import { buildUserEmailPolicyActions } from './UsersEmailsPolicyState';
35
36
  import { buildEntitlementsActions } from './Entitlements';
36
37
  export * from './AcceptInvitationState/interfaces';
37
38
  export * from './AccountSettingsState/interfaces';
@@ -67,6 +68,7 @@ export * from './SSOState/interfaces';
67
68
  export * from './StepUpState/interfaces';
68
69
  export * from './TeamState/interfaces';
69
70
  export * from './TenantsState/interfaces';
71
+ export * from './UsersEmailsPolicyState/interfaces';
70
72
  export * from './interfaces';
71
73
  export declare const createAuthState: (_overrideState?: DeepPartial<AuthState>) => AuthState;
72
74
  export declare const buildAuthActions: (store: FronteggState, api: RestApi, actions: FronteggActions, snapshotAuthState: AuthState) => [AuthActions, AuthStateActions];
@@ -104,6 +106,7 @@ export type SSOActions = ReturnType<typeof buildSSOActions>;
104
106
  export type StepUpActions = ReturnType<typeof buildStepUpActions>;
105
107
  export type TeamActions = ReturnType<typeof buildTeamActions>;
106
108
  export type TenantsActions = ReturnType<typeof buildTenantsActions>;
109
+ export type UsersEmailPolicyActions = ReturnType<typeof buildUserEmailPolicyActions>;
107
110
  export type AuthStateActions = {
108
111
  acceptInvitationActions: AcceptInvitationActions;
109
112
  accountSettingsActions: AccountSettingsActions;
@@ -139,6 +142,7 @@ export type AuthStateActions = {
139
142
  stepUpActions: StepUpActions;
140
143
  teamActions: TeamActions;
141
144
  tenantsActions: TenantsActions;
145
+ usersEmailsPolicyActions: UsersEmailPolicyActions;
142
146
  };
143
147
  export type AuthActions = {
144
148
  /** @deprecated use setAuthState instead */
@@ -147,4 +151,4 @@ export type AuthActions = {
147
151
  setErrorByRequestName: (payload: SingleErrorByRequestDataPayload) => void;
148
152
  resetAuthState: (state?: Partial<AuthState>) => void;
149
153
  setUser: (user: User | null) => void;
150
- } & AcceptInvitationActions & AccountSettingsActions & UnlockAccountActions & ActivateAccountActions & ApiTokensActions & ApplicationsActions & CustomLoginActions & EntitlementsActions & ForgotPasswordActions & PasswordRotationActions & GroupsActions & GroupsDialogsActions & ImpersonateActions & LoginActions & MfaActions & AllAccountsActions & AllAccountsDialogActions & PasskeysActions & ProfileActions & ProvisioningActions & ResetPhoneNumberActions & RolesActions & RestrictionsActions & SecurityCenterActions & SecurityPolicyActions & SessionsPolicyActions & SessionsActions & SignUpActions & SmsActions & SocialLoginActions & SSOActions & StepUpActions & TeamActions & TenantsActions;
154
+ } & AcceptInvitationActions & AccountSettingsActions & UnlockAccountActions & ActivateAccountActions & ApiTokensActions & ApplicationsActions & CustomLoginActions & EntitlementsActions & ForgotPasswordActions & PasswordRotationActions & GroupsActions & GroupsDialogsActions & ImpersonateActions & LoginActions & MfaActions & AllAccountsActions & AllAccountsDialogActions & PasskeysActions & ProfileActions & ProvisioningActions & ResetPhoneNumberActions & RolesActions & RestrictionsActions & SecurityCenterActions & SecurityPolicyActions & SessionsPolicyActions & SessionsActions & SignUpActions & SmsActions & SocialLoginActions & SSOActions & StepUpActions & TeamActions & TenantsActions & UsersEmailPolicyActions;
package/auth/index.js CHANGED
@@ -34,6 +34,7 @@ import { buildSSOActions, createSSOState } from './SSOState';
34
34
  import { buildStepUpActions, createStepUpState } from './StepUpState';
35
35
  import { buildTeamActions, createTeamState } from './TeamState';
36
36
  import { buildTenantsActions, createTenantsState } from './TenantsState';
37
+ import { buildUserEmailPolicyActions, createUserEmailPolicyState } from './UsersEmailsPolicyState';
37
38
  import { defaultFronteggRoutes } from './LoginState/consts';
38
39
  import { deepResetState, isProxy } from '../helpers';
39
40
  import { buildEntitlementsActions } from './Entitlements';
@@ -72,6 +73,7 @@ export * from './SSOState/interfaces';
72
73
  export * from './StepUpState/interfaces';
73
74
  export * from './TeamState/interfaces';
74
75
  export * from './TenantsState/interfaces';
76
+ export * from './UsersEmailsPolicyState/interfaces';
75
77
  export * from './interfaces';
76
78
  export const createAuthState = _overrideState => {
77
79
  const _ref = _overrideState != null ? _overrideState : {},
@@ -126,7 +128,8 @@ export const createAuthState = _overrideState => {
126
128
  ssoState: createSSOState(overrideState == null ? void 0 : overrideState.ssoState),
127
129
  stepUpState: createStepUpState(overrideState == null ? void 0 : overrideState.stepUpState),
128
130
  teamState: createTeamState(overrideState == null ? void 0 : overrideState.teamState),
129
- tenantsState: createTenantsState(overrideState == null ? void 0 : overrideState.tenantsState)
131
+ tenantsState: createTenantsState(overrideState == null ? void 0 : overrideState.tenantsState),
132
+ userEmailPolicyState: createUserEmailPolicyState(overrideState == null ? void 0 : overrideState.userEmailPolicyState)
130
133
  }));
131
134
  };
132
135
  export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
@@ -193,6 +196,7 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
193
196
  const stepUpActions = buildStepUpActions(store, api, actions);
194
197
  const teamActions = buildTeamActions(store, api, actions);
195
198
  const tenantsActions = buildTenantsActions(store, api, actions);
199
+ const usersEmailsPolicyActions = buildUserEmailPolicyActions(store, api, actions);
196
200
  const stateActions = {
197
201
  acceptInvitationActions,
198
202
  accountSettingsActions,
@@ -227,7 +231,8 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
227
231
  ssoActions,
228
232
  stepUpActions,
229
233
  teamActions,
230
- tenantsActions
234
+ tenantsActions,
235
+ usersEmailsPolicyActions
231
236
  };
232
237
  return [_extends({
233
238
  setAuthState,
@@ -31,6 +31,7 @@ import type { IAllAccountsDialogsState, IAllAccountsState } from './MSP/interfac
31
31
  import { ApplicationsState } from './ApplicationsState/interfaces';
32
32
  import { UnlockAccountState } from './UnlockAccountState/interfaces';
33
33
  import { PasswordRotationState } from '../toolkit';
34
+ import { UserEmailPolicyState } from './UsersEmailsPolicyState/interfaces';
34
35
  export declare enum REQUEST_NAME {
35
36
  LOAD_FEATURE_FLAGS = "LOAD_FEATURE_FLAGS,",
36
37
  LOAD_ADMIN_BOX_METADATA = "LOAD_ADMIN_BOX_METADATA,",
@@ -107,6 +108,7 @@ export interface AuthState extends Routes, PluginOptions {
107
108
  teamState: TeamState;
108
109
  tenantsState: TenantsState;
109
110
  applicationsState: ApplicationsState;
111
+ userEmailPolicyState: UserEmailPolicyState;
110
112
  }
111
113
  interface Actor {
112
114
  sub?: string;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.74.0-alpha.1
1
+ /** @license Frontegg v7.75.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.
@@ -37,6 +37,7 @@ import buildStepUpActions from './stepUpActions.mocks';
37
37
  import buildTeamActions from './teamActions.mocks';
38
38
  import buildTenantsActions from './tenantsActions.mocks';
39
39
  import buildUnlockAccountActions from './unlockAccountActions.mocks';
40
+ import buildUserEmailPolicyActions from './usersEmailsPolicyActions.mocks';
40
41
  import { deepResetState, isProxy } from '../../helpers';
41
42
  export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
42
43
  const acceptInvitationActions = buildAcceptInvitationActions(store, api, actions);
@@ -73,6 +74,7 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
73
74
  const stepUpActions = buildStepUpActions(store, api, actions);
74
75
  const teamActions = buildTeamActions(store, api, actions);
75
76
  const tenantsActions = buildTenantsActions(store, api, actions);
77
+ const usersEmailsPolicyActions = buildUserEmailPolicyActions(store, api, actions);
76
78
  const authStateActions = {
77
79
  acceptInvitationActions,
78
80
  accountSettingsActions,
@@ -107,7 +109,8 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
107
109
  ssoActions,
108
110
  stepUpActions,
109
111
  teamActions,
110
- tenantsActions
112
+ tenantsActions,
113
+ usersEmailsPolicyActions
111
114
  };
112
115
  const setAuthState = state => {
113
116
  Object.keys(state).forEach(key => {
@@ -145,7 +148,7 @@ export const buildAuthActions = (store, api, actions, snapshotAuthState) => {
145
148
  setErrorByRequestName,
146
149
  resetAuthState,
147
150
  setUser
148
- }, acceptInvitationActions, accountSettingsActions, activateAccountActions, unlockAccountActions, allAccountsActions, allAccountsDialogActions, apiTokensActions, applicationsActions, customLoginActions, entitlementsActions, forgotPasswordActions, passwordRotationActions, groupsActions, groupsDialogsActions, impersonateActions, loginActions, mfaActions, passkeysActions, profileActions, provisioningActions, resetPhoneNumberActions, restrictionsActions, rolesActions, securityCenterActions, securityPolicyActions, sessionsActions, sessionsPolicyActions, signUpActions, smsActions, socialLoginActions, ssoActions, stepUpActions, teamActions, tenantsActions);
151
+ }, acceptInvitationActions, accountSettingsActions, activateAccountActions, unlockAccountActions, allAccountsActions, allAccountsDialogActions, apiTokensActions, applicationsActions, customLoginActions, entitlementsActions, forgotPasswordActions, passwordRotationActions, groupsActions, groupsDialogsActions, impersonateActions, loginActions, mfaActions, passkeysActions, profileActions, provisioningActions, resetPhoneNumberActions, restrictionsActions, rolesActions, securityCenterActions, securityPolicyActions, sessionsActions, sessionsPolicyActions, signUpActions, smsActions, socialLoginActions, ssoActions, stepUpActions, teamActions, tenantsActions, usersEmailsPolicyActions);
149
152
  return {
150
153
  authActions,
151
154
  authStateActions
@@ -7,5 +7,12 @@ declare const _default: (store: FronteggState, api: RestApi, actions: SharedActi
7
7
  loadProfile: () => Promise<void>;
8
8
  saveProfile: (_payload: SaveProfilePayload) => Promise<void>;
9
9
  changePassword: (payload: WithCallback<IChangePassword>) => Promise<void>;
10
+ updateEmail: (payload: WithCallback<{
11
+ email: string;
12
+ }, boolean>) => Promise<void>;
13
+ verifyEmail: (payload: WithCallback<{
14
+ email: string;
15
+ code: string;
16
+ }, boolean>) => Promise<void>;
10
17
  };
11
18
  export default _default;
@@ -63,5 +63,35 @@ export default ((store, api, actions) => {
63
63
  });
64
64
  (_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
65
65
  };
66
+ mockedActions.updateEmail = async payload => {
67
+ var _payload$callback2;
68
+ mockedActions.setProfileState({
69
+ saving: true,
70
+ error: null,
71
+ loading: true
72
+ });
73
+ await delay();
74
+ mockedActions.setProfileState({
75
+ saving: false,
76
+ error: null,
77
+ loading: false
78
+ });
79
+ (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, true);
80
+ };
81
+ mockedActions.verifyEmail = async payload => {
82
+ var _payload$callback3;
83
+ mockedActions.setProfileState({
84
+ saving: true,
85
+ error: null,
86
+ loading: true
87
+ });
88
+ await delay();
89
+ mockedActions.setProfileState({
90
+ saving: false,
91
+ error: null,
92
+ loading: false
93
+ });
94
+ (_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, true);
95
+ };
66
96
  return mockedActions;
67
97
  });
@@ -0,0 +1,5 @@
1
+ import { FronteggState, RestApi, SharedActions } from '../../interfaces';
2
+ declare const _default: (store: FronteggState, api: RestApi, sharedActions: SharedActions) => {
3
+ loadUserEmailPolicyState: () => Promise<void>;
4
+ };
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { buildUserEmailPolicyActions } from '../../auth/UsersEmailsPolicyState';
2
+ import { mockActionsExpect } from '../helpers';
3
+ export default ((store, api, sharedActions) => {
4
+ const originalActions = buildUserEmailPolicyActions(store, api, sharedActions);
5
+ return mockActionsExpect(originalActions, ['loadUserEmailPolicyState']);
6
+ });
@@ -354,7 +354,6 @@ var _default = (store, api, sharedActions) => {
354
354
  const preLogin = async payload => {
355
355
  const {
356
356
  email,
357
- username,
358
357
  recaptchaToken,
359
358
  invitationToken,
360
359
  callback
@@ -365,13 +364,10 @@ var _default = (store, api, sharedActions) => {
365
364
  try {
366
365
  const onRedirectTo = store.auth.onRedirectTo;
367
366
  const tenantId = (0, _helpers2.getSearchParam)(_helpers2.TENANT_ID_PARAM_KEY);
368
- const preLoginResult = await api.auth.preLoginV2((0, _extends2.default)({}, email ? {
369
- email
370
- } : {}, username ? {
371
- username
372
- } : {}, {
367
+ const preLoginResult = await api.auth.preLoginV2({
368
+ email,
373
369
  tenantId
374
- }));
370
+ });
375
371
  const {
376
372
  address,
377
373
  idpType
@@ -385,8 +381,7 @@ var _default = (store, api, sharedActions) => {
385
381
  ssoRedirectUrl += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
386
382
  }
387
383
  if (_toolkit.FronteggNativeModule.isLoginWithSSOAvailable()) {
388
- var _ref4;
389
- _toolkit.FronteggNativeModule.loginWithSSO((_ref4 = email != null ? email : username) != null ? _ref4 : '');
384
+ _toolkit.FronteggNativeModule.loginWithSSO(email);
390
385
  setLoginState({
391
386
  loading: false
392
387
  });
@@ -404,18 +399,16 @@ var _default = (store, api, sharedActions) => {
404
399
  }, 2000);
405
400
  }
406
401
  } else {
407
- var _ref5;
408
402
  await ssoPreloginFailed({
409
- email: (_ref5 = email != null ? email : username) != null ? _ref5 : '',
403
+ email,
410
404
  recaptchaToken,
411
405
  callback,
412
406
  invitationToken
413
407
  });
414
408
  }
415
409
  } catch (e) {
416
- var _ref6;
417
410
  await ssoPreloginFailed({
418
- email: (_ref6 = email != null ? email : username) != null ? _ref6 : '',
411
+ email,
419
412
  recaptchaToken,
420
413
  callback,
421
414
  invitationToken,
@@ -451,7 +444,6 @@ var _default = (store, api, sharedActions) => {
451
444
  const login = async payload => {
452
445
  const {
453
446
  email,
454
- username,
455
447
  password,
456
448
  recaptchaToken,
457
449
  invitationToken,
@@ -465,15 +457,12 @@ var _default = (store, api, sharedActions) => {
465
457
  user,
466
458
  tenants = [],
467
459
  activeTenant
468
- } = await api.auth.loginv2((0, _extends2.default)({}, email ? {
469
- email
470
- } : {}, username ? {
471
- username
472
- } : {}, {
460
+ } = await api.auth.loginv2({
461
+ email,
473
462
  password,
474
463
  recaptchaToken,
475
464
  invitationToken
476
- }));
465
+ });
477
466
  const {
478
467
  onRedirectTo,
479
468
  routes
@@ -713,7 +702,6 @@ var _default = (store, api, sharedActions) => {
713
702
  } = _payload,
714
703
  payload = (0, _objectWithoutPropertiesLoose2.default)(_payload, _excluded5);
715
704
  try {
716
- var _username;
717
705
  setLoginState({
718
706
  loading: true
719
707
  });
@@ -721,16 +709,9 @@ var _default = (store, api, sharedActions) => {
721
709
  if ((0, _helpers2.isEmailPayload)(payload)) {
722
710
  email = payload.email;
723
711
  }
724
- let username;
725
- if ((0, _helpers2.isUsernamePayload)(payload)) {
726
- username = payload.username;
727
- }
728
712
  // TODO: [Typescript 4.8] fix @frontegg/rest-api return value
729
713
  // @ts-ignore
730
- const preloginRes = await api.auth.passwordlessPreLogin((0, _extends2.default)({}, payload, {
731
- email,
732
- username: (_username = username) != null ? _username : ''
733
- }));
714
+ const preloginRes = await api.auth.passwordlessPreLogin(payload);
734
715
  // @ts-ignore
735
716
  const step = _consts.authStrategyLoginStepMap[payload.type];
736
717
  setLoginState({
@@ -1322,11 +1303,11 @@ var _default = (store, api, sharedActions) => {
1322
1303
  preserveQueryParams: true
1323
1304
  });
1324
1305
  } else {
1325
- var _ref7;
1306
+ var _ref4;
1326
1307
  if (user.id) {
1327
1308
  localStorage.setItem('userId', user.id);
1328
1309
  }
1329
- const quickLoginToRegister = (_ref7 = localStorage.getItem('register-quick-login')) != null ? _ref7 : loginState.quickLoginToRegister;
1310
+ const quickLoginToRegister = (_ref4 = localStorage.getItem('register-quick-login')) != null ? _ref4 : loginState.quickLoginToRegister;
1330
1311
  const shouldNavigateToRegisterQuickLogin = __shouldNavigateToRegisterQuickLogin(user);
1331
1312
  actions.afterAuthenticationStateUpdate({
1332
1313
  user: updatedUser,
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isAbsoluteUrl = exports.getSearchParamsFromUrl = exports.getSearchParam = exports.getRedirectUrl = exports.getPathAndSearchParamsFromUrl = exports.getNumberOfMfaDevices = exports.getMfaStepForNotEnrolledUsers = exports.getMfaStepForEnrolledUsers = exports.getBaseNameWithoutSlashSuffix = exports.TENANT_ID_PARAM_KEY = void 0;
7
7
  exports.isEmailPayload = isEmailPayload;
8
- exports.isOauthCallbackRoute = void 0;
9
- exports.isUsernamePayload = isUsernamePayload;
10
- exports.shouldShowPasswordRotationPromptFunc = void 0;
8
+ exports.shouldShowPasswordRotationPromptFunc = exports.isOauthCallbackRoute = void 0;
11
9
  var _restApi = require("@frontegg/rest-api");
12
10
  var _interfaces = require("../MfaState/interfaces");
13
11
  const isAbsoluteUrl = path => {
@@ -146,9 +144,6 @@ exports.isOauthCallbackRoute = isOauthCallbackRoute;
146
144
  function isEmailPayload(payload) {
147
145
  return 'email' in payload;
148
146
  }
149
- function isUsernamePayload(payload) {
150
- return 'username' in payload;
151
- }
152
147
  const getBaseNameWithoutSlashSuffix = state => {
153
148
  const basename = _restApi.ContextHolder.for(state.root.appName).getBasename();
154
149
  if (basename != null && basename.endsWith('/')) {
@@ -37,6 +37,61 @@ var _default = (store, api, sharedActions) => {
37
37
  });
38
38
  }
39
39
  };
40
+ const updateEmail = async payload => {
41
+ const {
42
+ email,
43
+ callback
44
+ } = payload;
45
+ setProfileState({
46
+ saving: true,
47
+ error: null,
48
+ loading: true
49
+ });
50
+ try {
51
+ await api.teams.updateEmail(email);
52
+ setProfileState({
53
+ saving: false,
54
+ error: null,
55
+ loading: false
56
+ });
57
+ callback == null ? void 0 : callback(true);
58
+ } catch (e) {
59
+ setProfileState({
60
+ saving: false,
61
+ error: (0, _helpers.errorHandler)(e),
62
+ loading: false
63
+ });
64
+ callback == null ? void 0 : callback(null, e);
65
+ }
66
+ };
67
+ const verifyEmail = async payload => {
68
+ const {
69
+ email,
70
+ code,
71
+ callback
72
+ } = payload;
73
+ setProfileState({
74
+ saving: true,
75
+ error: null,
76
+ loading: true
77
+ });
78
+ try {
79
+ await api.teams.verifyEmail(email, code);
80
+ setProfileState({
81
+ saving: false,
82
+ error: null,
83
+ loading: false
84
+ });
85
+ callback == null ? void 0 : callback(true);
86
+ } catch (e) {
87
+ setProfileState({
88
+ saving: false,
89
+ error: (0, _helpers.errorHandler)(e),
90
+ loading: false
91
+ });
92
+ callback == null ? void 0 : callback(null, e);
93
+ }
94
+ };
40
95
  const saveProfile = async _payload => {
41
96
  const {
42
97
  callback,
@@ -114,7 +169,9 @@ var _default = (store, api, sharedActions) => {
114
169
  resetProfileState,
115
170
  loadProfile,
116
171
  saveProfile,
117
- changePassword
172
+ changePassword,
173
+ updateEmail,
174
+ verifyEmail
118
175
  };
119
176
  };
120
177
  exports.default = _default;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _helpers = require("../../helpers");
8
+ var _default = (store, api, sharedActions) => {
9
+ const setUserEmailPolicyState = payload => {
10
+ Object.assign(store.auth.userEmailPolicyState, payload);
11
+ };
12
+ const loadUserEmailPolicyState = async () => {
13
+ setUserEmailPolicyState({
14
+ loading: true
15
+ });
16
+ try {
17
+ const userEmailPolicyConfig = await api.userEmailPolicy.getUserEmailPolicyConfig();
18
+ setUserEmailPolicyState({
19
+ loading: false,
20
+ userEmailPolicyConfig
21
+ });
22
+ } catch (e) {
23
+ setUserEmailPolicyState({
24
+ loading: false,
25
+ error: (0, _helpers.errorHandler)(e)
26
+ });
27
+ }
28
+ };
29
+ return {
30
+ loadUserEmailPolicyState
31
+ };
32
+ };
33
+ exports.default = _default;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "buildUserEmailPolicyActions", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _actions.default;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "createUserEmailPolicyState", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _state.default;
17
+ }
18
+ });
19
+ var _state = _interopRequireDefault(require("./state"));
20
+ var _actions = _interopRequireDefault(require("./actions"));
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initialState = exports.default = void 0;
7
+ var _proxy = require("../../toolkit/proxy");
8
+ const initialState = {
9
+ userEmailPolicyConfig: null,
10
+ loading: false
11
+ };
12
+ exports.initialState = initialState;
13
+ var _default = overrideState => (0, _proxy.createProxy)(initialState, overrideState);
14
+ exports.default = _default;
@@ -43,6 +43,7 @@ var _SSOState = require("./SSOState");
43
43
  var _StepUpState = require("./StepUpState");
44
44
  var _TeamState = require("./TeamState");
45
45
  var _TenantsState = require("./TenantsState");
46
+ var _UsersEmailsPolicyState = require("./UsersEmailsPolicyState");
46
47
  var _consts = require("./LoginState/consts");
47
48
  var _helpers = require("../helpers");
48
49
  var _Entitlements = require("./Entitlements");
@@ -455,7 +456,7 @@ Object.keys(_interfaces33).forEach(function (key) {
455
456
  }
456
457
  });
457
458
  });
458
- var _interfaces34 = require("./interfaces");
459
+ var _interfaces34 = require("./UsersEmailsPolicyState/interfaces");
459
460
  Object.keys(_interfaces34).forEach(function (key) {
460
461
  if (key === "default" || key === "__esModule") return;
461
462
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -467,6 +468,18 @@ Object.keys(_interfaces34).forEach(function (key) {
467
468
  }
468
469
  });
469
470
  });
471
+ var _interfaces35 = require("./interfaces");
472
+ Object.keys(_interfaces35).forEach(function (key) {
473
+ if (key === "default" || key === "__esModule") return;
474
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
475
+ if (key in exports && exports[key] === _interfaces35[key]) return;
476
+ Object.defineProperty(exports, key, {
477
+ enumerable: true,
478
+ get: function () {
479
+ return _interfaces35[key];
480
+ }
481
+ });
482
+ });
470
483
  const _excluded = ["routes"],
471
484
  _excluded2 = ["requestName"];
472
485
  const createAuthState = _overrideState => {
@@ -522,7 +535,8 @@ const createAuthState = _overrideState => {
522
535
  ssoState: (0, _SSOState.createSSOState)(overrideState == null ? void 0 : overrideState.ssoState),
523
536
  stepUpState: (0, _StepUpState.createStepUpState)(overrideState == null ? void 0 : overrideState.stepUpState),
524
537
  teamState: (0, _TeamState.createTeamState)(overrideState == null ? void 0 : overrideState.teamState),
525
- tenantsState: (0, _TenantsState.createTenantsState)(overrideState == null ? void 0 : overrideState.tenantsState)
538
+ tenantsState: (0, _TenantsState.createTenantsState)(overrideState == null ? void 0 : overrideState.tenantsState),
539
+ userEmailPolicyState: (0, _UsersEmailsPolicyState.createUserEmailPolicyState)(overrideState == null ? void 0 : overrideState.userEmailPolicyState)
526
540
  }));
527
541
  };
528
542
  exports.createAuthState = createAuthState;
@@ -590,6 +604,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
590
604
  const stepUpActions = (0, _StepUpState.buildStepUpActions)(store, api, actions);
591
605
  const teamActions = (0, _TeamState.buildTeamActions)(store, api, actions);
592
606
  const tenantsActions = (0, _TenantsState.buildTenantsActions)(store, api, actions);
607
+ const usersEmailsPolicyActions = (0, _UsersEmailsPolicyState.buildUserEmailPolicyActions)(store, api, actions);
593
608
  const stateActions = {
594
609
  acceptInvitationActions,
595
610
  accountSettingsActions,
@@ -624,7 +639,8 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
624
639
  ssoActions,
625
640
  stepUpActions,
626
641
  teamActions,
627
- tenantsActions
642
+ tenantsActions,
643
+ usersEmailsPolicyActions
628
644
  };
629
645
  return [(0, _extends2.default)({
630
646
  setAuthState,
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v7.74.0-alpha.1
1
+ /** @license Frontegg v7.75.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.
@@ -41,6 +41,7 @@ var _stepUpActions = _interopRequireDefault(require("./stepUpActions.mocks"));
41
41
  var _teamActions = _interopRequireDefault(require("./teamActions.mocks"));
42
42
  var _tenantsActions = _interopRequireDefault(require("./tenantsActions.mocks"));
43
43
  var _unlockAccountActions = _interopRequireDefault(require("./unlockAccountActions.mocks"));
44
+ var _usersEmailsPolicyActions = _interopRequireDefault(require("./usersEmailsPolicyActions.mocks"));
44
45
  var _helpers = require("../../helpers");
45
46
  const _excluded = ["requestName"];
46
47
  const buildAuthActions = (store, api, actions, snapshotAuthState) => {
@@ -78,6 +79,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
78
79
  const stepUpActions = (0, _stepUpActions.default)(store, api, actions);
79
80
  const teamActions = (0, _teamActions.default)(store, api, actions);
80
81
  const tenantsActions = (0, _tenantsActions.default)(store, api, actions);
82
+ const usersEmailsPolicyActions = (0, _usersEmailsPolicyActions.default)(store, api, actions);
81
83
  const authStateActions = {
82
84
  acceptInvitationActions,
83
85
  accountSettingsActions,
@@ -112,7 +114,8 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
112
114
  ssoActions,
113
115
  stepUpActions,
114
116
  teamActions,
115
- tenantsActions
117
+ tenantsActions,
118
+ usersEmailsPolicyActions
116
119
  };
117
120
  const setAuthState = state => {
118
121
  Object.keys(state).forEach(key => {
@@ -150,7 +153,7 @@ const buildAuthActions = (store, api, actions, snapshotAuthState) => {
150
153
  setErrorByRequestName,
151
154
  resetAuthState,
152
155
  setUser
153
- }, acceptInvitationActions, accountSettingsActions, activateAccountActions, unlockAccountActions, allAccountsActions, allAccountsDialogActions, apiTokensActions, applicationsActions, customLoginActions, entitlementsActions, forgotPasswordActions, passwordRotationActions, groupsActions, groupsDialogsActions, impersonateActions, loginActions, mfaActions, passkeysActions, profileActions, provisioningActions, resetPhoneNumberActions, restrictionsActions, rolesActions, securityCenterActions, securityPolicyActions, sessionsActions, sessionsPolicyActions, signUpActions, smsActions, socialLoginActions, ssoActions, stepUpActions, teamActions, tenantsActions);
156
+ }, acceptInvitationActions, accountSettingsActions, activateAccountActions, unlockAccountActions, allAccountsActions, allAccountsDialogActions, apiTokensActions, applicationsActions, customLoginActions, entitlementsActions, forgotPasswordActions, passwordRotationActions, groupsActions, groupsDialogsActions, impersonateActions, loginActions, mfaActions, passkeysActions, profileActions, provisioningActions, resetPhoneNumberActions, restrictionsActions, rolesActions, securityCenterActions, securityPolicyActions, sessionsActions, sessionsPolicyActions, signUpActions, smsActions, socialLoginActions, ssoActions, stepUpActions, teamActions, tenantsActions, usersEmailsPolicyActions);
154
157
  return {
155
158
  authActions,
156
159
  authStateActions
@@ -70,6 +70,36 @@ var _default = (store, api, actions) => {
70
70
  });
71
71
  (_payload$callback = payload.callback) == null ? void 0 : _payload$callback.call(payload, true);
72
72
  };
73
+ mockedActions.updateEmail = async payload => {
74
+ var _payload$callback2;
75
+ mockedActions.setProfileState({
76
+ saving: true,
77
+ error: null,
78
+ loading: true
79
+ });
80
+ await (0, _helpers.delay)();
81
+ mockedActions.setProfileState({
82
+ saving: false,
83
+ error: null,
84
+ loading: false
85
+ });
86
+ (_payload$callback2 = payload.callback) == null ? void 0 : _payload$callback2.call(payload, true);
87
+ };
88
+ mockedActions.verifyEmail = async payload => {
89
+ var _payload$callback3;
90
+ mockedActions.setProfileState({
91
+ saving: true,
92
+ error: null,
93
+ loading: true
94
+ });
95
+ await (0, _helpers.delay)();
96
+ mockedActions.setProfileState({
97
+ saving: false,
98
+ error: null,
99
+ loading: false
100
+ });
101
+ (_payload$callback3 = payload.callback) == null ? void 0 : _payload$callback3.call(payload, true);
102
+ };
73
103
  return mockedActions;
74
104
  };
75
105
  exports.default = _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _UsersEmailsPolicyState = require("../../auth/UsersEmailsPolicyState");
8
+ var _helpers = require("../helpers");
9
+ var _default = (store, api, sharedActions) => {
10
+ const originalActions = (0, _UsersEmailsPolicyState.buildUserEmailPolicyActions)(store, api, sharedActions);
11
+ return (0, _helpers.mockActionsExpect)(originalActions, ['loadUserEmailPolicyState']);
12
+ };
13
+ exports.default = _default;
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  class FronteggNativeModule {
8
8
  constructor() {
9
- this.loginWithSSO = identifier => {
9
+ this.loginWithSSO = email => {
10
10
  if (this.isIOSNativeBridgeAvailable()) {
11
11
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
12
12
  (_window$webkit = window.webkit) == null ? void 0 : (_window$webkit$messag = _window$webkit.messageHandlers) == null ? void 0 : (_window$webkit$messag2 = _window$webkit$messag.FronteggNativeBridge) == null ? void 0 : _window$webkit$messag2.postMessage(JSON.stringify({
13
13
  action: 'loginWithSSO',
14
- payload: identifier
14
+ payload: email
15
15
  }));
16
16
  } else if (this.isAndroidNativeBridgeAvailable()) {
17
17
  var _window$FronteggNativ;
18
- (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(identifier);
18
+ (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(email);
19
19
  } else {
20
20
  throw new Error('FronteggNativeBridge is not available');
21
21
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@frontegg/redux-store",
3
- "version": "7.74.0-alpha.1",
3
+ "version": "7.75.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
9
  "@frontegg/entitlements-javascript-commons": "1.1.2",
10
- "@frontegg/rest-api": "7.74.0-alpha.1",
10
+ "@frontegg/rest-api": "7.75.0-alpha.0",
11
11
  "fast-deep-equal": "3.1.3",
12
12
  "get-value": "^3.0.1",
13
13
  "proxy-compare": "^3.0.0",
@@ -30,7 +30,7 @@ declare class FronteggNativeModule {
30
30
  isLoginWithSSOAvailable(): boolean;
31
31
  isSuggestSavePasswordAvailable(): boolean;
32
32
  isAvailable(method: string): boolean;
33
- loginWithSSO: (identifier: string) => void;
33
+ loginWithSSO: (email: string) => void;
34
34
  /**
35
35
  *
36
36
  * @deprecated use loginWithSocialLoginProvider instead for pkce flow in mobile
@@ -1,15 +1,15 @@
1
1
  class FronteggNativeModule {
2
2
  constructor() {
3
- this.loginWithSSO = identifier => {
3
+ this.loginWithSSO = email => {
4
4
  if (this.isIOSNativeBridgeAvailable()) {
5
5
  var _window$webkit, _window$webkit$messag, _window$webkit$messag2;
6
6
  (_window$webkit = window.webkit) == null ? void 0 : (_window$webkit$messag = _window$webkit.messageHandlers) == null ? void 0 : (_window$webkit$messag2 = _window$webkit$messag.FronteggNativeBridge) == null ? void 0 : _window$webkit$messag2.postMessage(JSON.stringify({
7
7
  action: 'loginWithSSO',
8
- payload: identifier
8
+ payload: email
9
9
  }));
10
10
  } else if (this.isAndroidNativeBridgeAvailable()) {
11
11
  var _window$FronteggNativ;
12
- (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(identifier);
12
+ (_window$FronteggNativ = window.FronteggNativeBridge) == null ? void 0 : _window$FronteggNativ.loginWithSSO(email);
13
13
  } else {
14
14
  throw new Error('FronteggNativeBridge is not available');
15
15
  }