@frontegg/redux-store 5.60.0 → 5.62.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.
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var toolkit = require('@reduxjs/toolkit');
4
+ var vendor_index = require('./index-6906e508.js');
4
5
  var restApi = require('@frontegg/rest-api');
5
6
  var constants = require('./constants-52e37c08.js');
6
7
  var tslib = require('tslib');
7
8
  var effects = require('redux-saga/effects');
8
- var vendor_index = require('./index-2ab7009b.js');
9
9
  var uuid = require('uuid');
10
10
  var audits_index = require('./audits/index.js');
11
11
  var connectivity_index = require('./connectivity/index.js');
@@ -17,37 +17,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
17
17
 
18
18
  var createSagaMiddleware__default = /*#__PURE__*/_interopDefaultLegacy(createSagaMiddleware);
19
19
 
20
- const resetStateByKey = (key, initialState) => (state) => (Object.assign(Object.assign({}, state), { [key]: initialState[key] }));
21
- const typeReducer = (key) => (state, { payload }) => (Object.assign(Object.assign({}, state), { [key]: payload }));
22
- const typeReducerForKey = (key) => ({
23
- prepare: (payload) => ({ payload }),
24
- reducer: (state, { payload }) => {
25
- return Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), payload) });
26
- },
27
- });
28
- const typeReducerNestedKey = (key, nestedKey) => ({
29
- prepare: (payload) => ({ payload }),
30
- reducer: (state, { payload }) => {
31
- var _a;
32
- return Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { [nestedKey]: Object.assign(Object.assign({}, (_a = state === null || state === void 0 ? void 0 : state[key]) === null || _a === void 0 ? void 0 : _a[nestedKey]), payload) }) });
33
- },
34
- });
35
- const loadersReducerForKey = (key) => ({
36
- prepare: (payload) => ({ payload }),
37
- reducer: (state, { payload }) => {
38
- var _a;
39
- return (Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { loaders: Object.assign(Object.assign({}, state[key].loaders), { [payload.key]: (_a = payload.value) !== null && _a !== void 0 ? _a : true }) }) }));
40
- },
41
- });
42
- const errorsReducerForKey = (key) => ({
43
- prepare: (payload) => ({ payload }),
44
- reducer: (state, { payload }) => {
45
- var _a;
46
- return (Object.assign(Object.assign({}, state), { [key]: Object.assign(Object.assign({}, state[key]), { errors: Object.assign(Object.assign({}, state[key].errors), { [payload.key]: (_a = payload.value) !== null && _a !== void 0 ? _a : true }) }) }));
47
- },
48
- });
49
- const delay = (delayTime = 500) => new Promise((resolve) => setTimeout(resolve, delayTime));
50
-
51
20
  exports.LoginStep = void 0;
52
21
  (function (LoginStep) {
53
22
  LoginStep["preLogin"] = "preLogin";
@@ -61,17 +30,30 @@ exports.LoginStep = void 0;
61
30
  LoginStep["success"] = "success";
62
31
  LoginStep["forceTwoFactor"] = "forceTwoFactor";
63
32
  LoginStep["recoverTwoFactor"] = "recoverTwoFactor";
64
- })(exports.LoginStep || (exports.LoginStep = {}));
33
+ })(exports.LoginStep || (exports.LoginStep = {}));
34
+ exports.LoginFlow = void 0;
35
+ (function (LoginFlow) {
36
+ LoginFlow["Login"] = "login";
37
+ LoginFlow["RegisterQuickLogin"] = "registerQuickLogin";
38
+ })(exports.LoginFlow || (exports.LoginFlow = {}));
39
+ exports.QuickLoginStrategy = void 0;
40
+ (function (QuickLoginStrategy) {
41
+ QuickLoginStrategy["Internal"] = "internal";
42
+ QuickLoginStrategy["UsbKey"] = "usb-key";
43
+ QuickLoginStrategy["Android"] = "android";
44
+ QuickLoginStrategy["Sms"] = "sms";
45
+ })(exports.QuickLoginStrategy || (exports.QuickLoginStrategy = {}));
65
46
 
66
47
  const loginState = {
48
+ flow: exports.LoginFlow.Login,
67
49
  step: exports.LoginStep.preLogin,
68
50
  loading: false,
69
51
  email: '',
70
52
  tenants: [],
71
53
  };
72
54
  const reducers$f = {
73
- setLoginState: typeReducerForKey('loginState'),
74
- resetLoginState: resetStateByKey('loginState', { loginState }),
55
+ setLoginState: vendor_index.typeReducerForKey('loginState'),
56
+ resetLoginState: vendor_index.resetStateByKey('loginState', { loginState }),
75
57
  };
76
58
  const actions$g = {
77
59
  requestAuthorize: toolkit.createAction(`${constants.authStoreName}/requestAuthorize`, (payload = false) => ({ payload })),
@@ -90,6 +72,10 @@ const actions$g = {
90
72
  passwordlessPreLogin: toolkit.createAction(`${constants.authStoreName}/passwordlessPreLogin`, (payload) => ({ payload })),
91
73
  passwordlessPostLogin: toolkit.createAction(`${constants.authStoreName}/passwordlessPostLogin`, (payload) => ({ payload })),
92
74
  verifyInviteToken: toolkit.createAction(`${constants.authStoreName}/verifyInviteToken`, (payload) => ({ payload })),
75
+ webAuthnPrelogin: toolkit.createAction(`${constants.authStoreName}/webAuthnPrelogin`, (payload) => ({ payload })),
76
+ webAuthnPostLogin: toolkit.createAction(`${constants.authStoreName}/webAuthnPostLogin`, (payload) => ({ payload })),
77
+ webAuthnCreateNewDeviceSession: toolkit.createAction(`${constants.authStoreName}/webAuthnCreateNewDeviceSession`, (payload) => ({ payload })),
78
+ webAuthnVerifyNewDeviceSession: toolkit.createAction(`${constants.authStoreName}/webAuthnVerifyNewDeviceSession`, (payload) => ({ payload })),
93
79
  };
94
80
 
95
81
  exports.ActivateAccountStep = void 0;
@@ -109,9 +95,9 @@ const activateState = {
109
95
  },
110
96
  };
111
97
  const reducers$e = {
112
- setActivateState: typeReducerForKey('activateState'),
113
- resetActivateState: resetStateByKey('activateState', { activateState }),
114
- setActivateStrategyState: typeReducerNestedKey('activateState', 'activationStrategy'),
98
+ setActivateState: vendor_index.typeReducerForKey('activateState'),
99
+ resetActivateState: vendor_index.resetStateByKey('activateState', { activateState }),
100
+ setActivateStrategyState: vendor_index.typeReducerNestedKey('activateState', 'activationStrategy'),
115
101
  };
116
102
  const actions$f = {
117
103
  activateAccount: toolkit.createAction(`${constants.authStoreName}/activateAccount`, (payload) => ({ payload })),
@@ -135,8 +121,8 @@ const acceptInvitationState = {
135
121
  step: exports.AcceptInvitationStep.validate,
136
122
  };
137
123
  const reducers$d = {
138
- setAcceptInvitationState: typeReducerForKey('acceptInvitationState'),
139
- resetAcceptInvitationState: resetStateByKey('acceptInvitationState', {
124
+ setAcceptInvitationState: vendor_index.typeReducerForKey('acceptInvitationState'),
125
+ resetAcceptInvitationState: vendor_index.resetStateByKey('acceptInvitationState', {
140
126
  acceptInvitationState,
141
127
  }),
142
128
  };
@@ -157,8 +143,8 @@ const forgotPasswordState = {
157
143
  passwordConfig: null,
158
144
  };
159
145
  const reducers$c = {
160
- setForgotPasswordState: typeReducerForKey('forgotPasswordState'),
161
- resetForgotPasswordState: resetStateByKey('forgotPasswordState', { forgotPasswordState }),
146
+ setForgotPasswordState: vendor_index.typeReducerForKey('forgotPasswordState'),
147
+ resetForgotPasswordState: vendor_index.resetStateByKey('forgotPasswordState', { forgotPasswordState }),
162
148
  };
163
149
  const actions$d = {
164
150
  forgotPassword: toolkit.createAction(`${constants.authStoreName}/forgotPassword`, (payload) => ({ payload })),
@@ -180,8 +166,8 @@ const resetPhoneNumberState = {
180
166
  loading: false,
181
167
  };
182
168
  const reducers$b = {
183
- setResetPhoneNumberState: typeReducerForKey('resetPhoneNumberState'),
184
- resetResetPhoneNumberState: resetStateByKey('resetPhoneNumberState', { resetPhoneNumberState }),
169
+ setResetPhoneNumberState: vendor_index.typeReducerForKey('resetPhoneNumberState'),
170
+ resetResetPhoneNumberState: vendor_index.resetStateByKey('resetPhoneNumberState', { resetPhoneNumberState }),
185
171
  };
186
172
  const actions$c = {
187
173
  resetPhoneNumber: toolkit.createAction(`${constants.authStoreName}/resetPhoneNumber`, (payload) => ({ payload })),
@@ -198,10 +184,10 @@ const ssoState = {
198
184
  ssoConfigurations: []
199
185
  };
200
186
  const reducers$a = {
201
- setSSOLoader: loadersReducerForKey('ssoState'),
202
- setSSOError: errorsReducerForKey('ssoState'),
203
- setSSOState: typeReducerForKey('ssoState'),
204
- resetSSOState: resetStateByKey('ssoState', { ssoState }),
187
+ setSSOLoader: vendor_index.loadersReducerForKey('ssoState'),
188
+ setSSOError: vendor_index.errorsReducerForKey('ssoState'),
189
+ setSSOState: vendor_index.typeReducerForKey('ssoState'),
190
+ resetSSOState: vendor_index.resetStateByKey('ssoState', { ssoState }),
205
191
  };
206
192
  const actions$b = {
207
193
  loadSSOConfigurationsV2: toolkit.createAction(`${constants.authStoreName}/loadSSOConfigurationsV2`),
@@ -238,8 +224,8 @@ const profileState = {
238
224
  error: null,
239
225
  };
240
226
  const reducers$9 = {
241
- setProfileState: typeReducerForKey('profileState'),
242
- resetProfileState: resetStateByKey('profileState', { profileState }),
227
+ setProfileState: vendor_index.typeReducerForKey('profileState'),
228
+ resetProfileState: vendor_index.resetStateByKey('profileState', { profileState }),
243
229
  };
244
230
  const actions$a = {
245
231
  loadProfile: toolkit.createAction(`${constants.authStoreName}/loadProfile`),
@@ -260,8 +246,8 @@ const mfaState = {
260
246
  loading: false,
261
247
  };
262
248
  const reducers$8 = {
263
- setMfaState: typeReducerForKey('mfaState'),
264
- resetMfaState: resetStateByKey('mfaState', { mfaState }),
249
+ setMfaState: vendor_index.typeReducerForKey('mfaState'),
250
+ resetMfaState: vendor_index.resetStateByKey('mfaState', { mfaState }),
265
251
  };
266
252
  const actions$9 = {
267
253
  enrollMfa: toolkit.createAction(`${constants.authStoreName}/enrollMfa`),
@@ -307,10 +293,10 @@ const teamState = {
307
293
  },
308
294
  };
309
295
  const reducers$7 = {
310
- setTeamLoader: loadersReducerForKey('teamState'),
311
- setTeamError: errorsReducerForKey('teamState'),
312
- setTeamState: typeReducerForKey('teamState'),
313
- resetTeamState: resetStateByKey('teamState', { teamState }),
296
+ setTeamLoader: vendor_index.loadersReducerForKey('teamState'),
297
+ setTeamError: vendor_index.errorsReducerForKey('teamState'),
298
+ setTeamState: vendor_index.typeReducerForKey('teamState'),
299
+ resetTeamState: vendor_index.resetStateByKey('teamState', { teamState }),
314
300
  };
315
301
  const actions$8 = {
316
302
  loadUsers: toolkit.createAction(`${constants.authStoreName}/loadUsers`, (payload) => ({ payload })),
@@ -349,8 +335,8 @@ const socialLoginState = {
349
335
  error: '',
350
336
  };
351
337
  const reducers$6 = {
352
- setSocialLoginsState: typeReducerForKey('socialLoginState'),
353
- resetSocialLoginsState: resetStateByKey('socialLoginState', { socialLoginState }),
338
+ setSocialLoginsState: vendor_index.typeReducerForKey('socialLoginState'),
339
+ resetSocialLoginsState: vendor_index.resetStateByKey('socialLoginState', { socialLoginState }),
354
340
  };
355
341
  const actions$7 = {
356
342
  loadSocialLoginsConfiguration: toolkit.createAction(`${constants.authStoreName}/loadSocialLoginsConfiguration`),
@@ -377,8 +363,8 @@ const signUpState = {
377
363
  stage: exports.SignUpStage.SignUp,
378
364
  };
379
365
  const reducers$5 = {
380
- setSignUpState: typeReducerForKey('signUpState'),
381
- resetSignUpState: resetStateByKey('signUpState', { signUpState }),
366
+ setSignUpState: vendor_index.typeReducerForKey('signUpState'),
367
+ resetSignUpState: vendor_index.resetStateByKey('signUpState', { signUpState }),
382
368
  };
383
369
  const actions$6 = {
384
370
  signUpUser: toolkit.createAction(`${constants.authStoreName}/signUpUser`, (payload) => ({ payload })),
@@ -407,10 +393,10 @@ const apiTokensState = {
407
393
  errors: {},
408
394
  };
409
395
  const reducers$4 = {
410
- setApiTokensLoader: loadersReducerForKey('apiTokensState'),
411
- setApiTokensError: errorsReducerForKey('apiTokensState'),
412
- setApiTokensState: typeReducerForKey('apiTokensState'),
413
- resetApiTokensState: resetStateByKey('apiTokensState', { apiTokensState }),
396
+ setApiTokensLoader: vendor_index.loadersReducerForKey('apiTokensState'),
397
+ setApiTokensError: vendor_index.errorsReducerForKey('apiTokensState'),
398
+ setApiTokensState: vendor_index.typeReducerForKey('apiTokensState'),
399
+ resetApiTokensState: vendor_index.resetStateByKey('apiTokensState', { apiTokensState }),
414
400
  };
415
401
  const actions$5 = {
416
402
  loadApiTokens: toolkit.createAction(`${constants.authStoreName}/loadApiTokens`, (payload) => ({
@@ -450,18 +436,22 @@ const securityPolicyState = {
450
436
  passwordPolicy: {
451
437
  loading: true,
452
438
  },
439
+ publicAuthStrategyPolicy: {
440
+ loading: true,
441
+ },
453
442
  };
454
443
  const reducers$3 = {
455
- setSecurityPolicyState: typeReducerForKey('securityPolicyState'),
456
- setSecurityPolicyGlobalState: typeReducerNestedKey('securityPolicyState', 'globalPolicy'),
457
- setSecurityPolicyPublicState: typeReducerNestedKey('securityPolicyState', 'publicPolicy'),
458
- setSecurityPolicyMfaState: typeReducerNestedKey('securityPolicyState', 'mfaPolicy'),
459
- setSecurityPolicyVendorMfaState: typeReducerNestedKey('securityPolicyState', 'vendorMfaPolicy'),
460
- setSecurityPolicyLockoutState: typeReducerNestedKey('securityPolicyState', 'lockoutPolicy'),
461
- setSecurityPolicyCaptchaState: typeReducerNestedKey('securityPolicyState', 'captchaPolicy'),
462
- setSecurityPolicyPasswordHistoryState: typeReducerNestedKey('securityPolicyState', 'passwordHistoryPolicy'),
463
- setSecurityPolicyPasswordState: typeReducerNestedKey('securityPolicyState', 'passwordPolicy'),
464
- resetSecurityPolicyState: resetStateByKey('securityPolicyState', { securityPolicyState }),
444
+ setSecurityPolicyState: vendor_index.typeReducerForKey('securityPolicyState'),
445
+ setSecurityPolicyGlobalState: vendor_index.typeReducerNestedKey('securityPolicyState', 'globalPolicy'),
446
+ setSecurityPolicyPublicState: vendor_index.typeReducerNestedKey('securityPolicyState', 'publicPolicy'),
447
+ setSecurityPolicyAuthStrategyPublicState: vendor_index.typeReducerNestedKey('securityPolicyState', 'publicAuthStrategyPolicy'),
448
+ setSecurityPolicyMfaState: vendor_index.typeReducerNestedKey('securityPolicyState', 'mfaPolicy'),
449
+ setSecurityPolicyVendorMfaState: vendor_index.typeReducerNestedKey('securityPolicyState', 'vendorMfaPolicy'),
450
+ setSecurityPolicyLockoutState: vendor_index.typeReducerNestedKey('securityPolicyState', 'lockoutPolicy'),
451
+ setSecurityPolicyCaptchaState: vendor_index.typeReducerNestedKey('securityPolicyState', 'captchaPolicy'),
452
+ setSecurityPolicyPasswordHistoryState: vendor_index.typeReducerNestedKey('securityPolicyState', 'passwordHistoryPolicy'),
453
+ setSecurityPolicyPasswordState: vendor_index.typeReducerNestedKey('securityPolicyState', 'passwordPolicy'),
454
+ resetSecurityPolicyState: vendor_index.resetStateByKey('securityPolicyState', { securityPolicyState }),
465
455
  };
466
456
  const actions$4 = {
467
457
  loadSecurityPolicy: toolkit.createAction(`${constants.authStoreName}/loadSecurityPolicy`),
@@ -475,14 +465,15 @@ const actions$4 = {
475
465
  loadSecurityPolicyPasswordHistory: toolkit.createAction(`${constants.authStoreName}/loadSecurityPolicyPasswordHistory`),
476
466
  saveSecurityPolicyPasswordHistory: toolkit.createAction(`${constants.authStoreName}/saveSecurityPolicyPasswordHistory`, (payload) => ({ payload })),
477
467
  loadVendorPasswordConfig: toolkit.createAction(`${constants.authStoreName}/loadVendorPasswordConfig`),
468
+ loadPublicAuthStrategiesPolicy: toolkit.createAction(`${constants.authStoreName}/loadPublicAuthStrategiesPolicy`),
478
469
  };
479
470
 
480
471
  const accountSettingsState = {
481
472
  loading: false,
482
473
  };
483
474
  const reducers$2 = {
484
- setAccountSettingsState: typeReducerForKey('accountSettingsState'),
485
- resetAccountSettingsState: resetStateByKey('accountSettingsState', { accountSettingsState }),
475
+ setAccountSettingsState: vendor_index.typeReducerForKey('accountSettingsState'),
476
+ resetAccountSettingsState: vendor_index.resetStateByKey('accountSettingsState', { accountSettingsState }),
486
477
  };
487
478
  const actions$3 = {
488
479
  loadAccountSettings: toolkit.createAction(`${constants.authStoreName}/loadAccountSettings`, (payload) => ({ payload })),
@@ -496,8 +487,8 @@ const tenantsState = {
496
487
  tenantTree: null,
497
488
  };
498
489
  const reducers$1 = {
499
- setTenantsState: typeReducerForKey('tenantsState'),
500
- resetTenantsState: resetStateByKey('tenantsState', { tenantsState }),
490
+ setTenantsState: vendor_index.typeReducerForKey('tenantsState'),
491
+ resetTenantsState: vendor_index.resetStateByKey('tenantsState', { tenantsState }),
501
492
  };
502
493
  const actions$2 = {
503
494
  switchTenant: toolkit.createAction(`${constants.authStoreName}/switchTenant`, (payload) => ({ payload })),
@@ -519,8 +510,8 @@ const rolesState = {
519
510
  permissionCategories: [],
520
511
  };
521
512
  const reducers = {
522
- setRolesState: typeReducerForKey('rolesState'),
523
- resetRolesState: resetStateByKey('rolesState', { rolesState }),
513
+ setRolesState: vendor_index.typeReducerForKey('rolesState'),
514
+ resetRolesState: vendor_index.resetStateByKey('rolesState', { rolesState }),
524
515
  };
525
516
  const actions$1 = {
526
517
  loadRolesAndPermissions: toolkit.createAction(`${constants.authStoreName}/loadRoles`, (payload) => ({ payload })),
@@ -573,7 +564,7 @@ const initialState$1 = Object.assign({ routes: {
573
564
  const { reducer, actions: sliceActions } = toolkit.createSlice({
574
565
  name: constants.authStoreName,
575
566
  initialState: initialState$1,
576
- reducers: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ resetState: (state) => (Object.assign(Object.assign({}, state), reinitializeState)), setState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)), setUser: typeReducer('user') }, reducers$f), reducers$6), reducers$e), reducers$d), reducers$c), reducers$b), reducers$5), reducers$9), reducers$a), reducers$8), reducers$7), reducers$4), reducers$3), reducers$2), reducers$1), reducers),
567
+ reducers: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ resetState: (state) => (Object.assign(Object.assign({}, state), reinitializeState)), setState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)), setUser: vendor_index.typeReducer('user') }, reducers$f), reducers$6), reducers$e), reducers$d), reducers$c), reducers$b), reducers$5), reducers$9), reducers$a), reducers$8), reducers$7), reducers$4), reducers$3), reducers$2), reducers$1), reducers),
577
568
  });
578
569
  const actions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sliceActions), actions$g), actions$7), actions$f), actions$e), actions$d), actions$c), actions$6), actions$a), actions$b), actions$9), actions$8), actions$5), actions$4), actions$3), actions$2), actions$1);
579
570
 
@@ -1047,9 +1038,10 @@ function* getMfaRequiredState(user) {
1047
1038
  };
1048
1039
  step = exports.LoginStep.forceTwoFactor;
1049
1040
  }
1050
- return Object.assign(Object.assign({ user: undefined, isAuthenticated: false }, setMfaState), { loginState: Object.assign(Object.assign({}, loginState), { mfaToken: user.mfaToken, mfaRequired: user.mfaRequired, loading: false, error: undefined, step, tenantsLoading: true, tenants: [], allowRememberMfaDevice: isAllowedToRemember, mfaDeviceExpiration }) });
1041
+ return Object.assign(Object.assign({ user: undefined, isAuthenticated: false }, setMfaState), { loginState: Object.assign(Object.assign({}, loginState), { mfaToken: user.mfaToken, mfaRequired: user.mfaRequired, loading: false, error: undefined, step, tenantsLoading: true, email: user.userEmail, tenants: [], allowRememberMfaDevice: isAllowedToRemember, mfaDeviceExpiration }) });
1051
1042
  }
1052
1043
  function* refreshToken() {
1044
+ var _a;
1053
1045
  try {
1054
1046
  const onRedirectTo = restApi.ContextHolder.onRedirectTo;
1055
1047
  const { routes, loginState } = yield effects.select((state) => state.auth);
@@ -1060,18 +1052,23 @@ function* refreshToken() {
1060
1052
  onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1061
1053
  }
1062
1054
  else {
1055
+ if (user.email) {
1056
+ localStorage.setItem('email', user.email);
1057
+ }
1058
+ const quickLoginToRegister = (_a = localStorage.getItem('register-quick-login')) !== null && _a !== void 0 ? _a : loginState.quickLoginToRegister;
1059
+ const shouldNavigateToRegisterQuicKLogin = quickLoginToRegister && localStorage.getItem(`${user.email}-${quickLoginToRegister}`) !== 'true';
1063
1060
  yield effects.put(actions.setTenantsState({ tenants, loading: false }));
1064
- yield effects.put(actions.setState({ user, isAuthenticated: true }));
1065
- if ([
1066
- routes.loginUrl,
1067
- routes.socialLoginCallbackUrl,
1068
- routes.signUpUrl,
1069
- routes.oidcRedirectUrl,
1070
- routes.samlCallbackUrl,
1071
- ].some((url) => url && window.location.pathname.endsWith(url))) {
1072
- if (loginState.isNewUser &&
1073
- routes.signUpSuccessUrl &&
1074
- routes.socialLoginCallbackUrl === window.location.pathname) {
1061
+ yield effects.put(actions.setState({
1062
+ user,
1063
+ isAuthenticated: true,
1064
+ loginState: Object.assign(Object.assign({}, loginState), { quickLoginToRegister, flow: shouldNavigateToRegisterQuicKLogin ? exports.LoginFlow.RegisterQuickLogin : exports.LoginFlow.Login })
1065
+ }));
1066
+ if (shouldNavigateToRegisterQuicKLogin) {
1067
+ onRedirectTo(routes.loginUrl);
1068
+ }
1069
+ else if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl, routes.samlCallbackUrl]
1070
+ .some(url => url && window.location.pathname.endsWith(url))) {
1071
+ if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
1075
1072
  onRedirectTo(routes.signUpSuccessUrl, { refresh: routes.signUpSuccessUrl.startsWith('http') });
1076
1073
  }
1077
1074
  else {
@@ -1219,14 +1216,15 @@ function* passwordlessPostLogin(_a) {
1219
1216
  try {
1220
1217
  yield effects.put(actions.setLoginState({ loading: true }));
1221
1218
  const data = yield effects.call(restApi.api.auth.passwordlessPostLogin, payload);
1219
+ const onRedirectTo = restApi.ContextHolder.onRedirectTo;
1220
+ const { routes } = yield effects.select((state) => state.auth);
1222
1221
  if (isMfaRequired(data)) {
1223
- const onRedirectTo = restApi.ContextHolder.onRedirectTo;
1224
- const { routes } = yield effects.select((state) => state.auth);
1225
1222
  const mfaRequiredState = yield getMfaRequiredState(data);
1226
1223
  yield effects.put(actions.setState(mfaRequiredState));
1227
1224
  onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1228
1225
  }
1229
1226
  else {
1227
+ const { loginState } = yield effects.select((state) => state.auth);
1230
1228
  const user = yield effects.call(restApi.api.auth.generateLoginResponse, data);
1231
1229
  if (data.emailVerified) {
1232
1230
  (_b = events === null || events === void 0 ? void 0 : events.userVerified) === null || _b === void 0 ? void 0 : _b.call(events, {
@@ -1238,9 +1236,17 @@ function* passwordlessPostLogin(_a) {
1238
1236
  name: user.name,
1239
1237
  });
1240
1238
  }
1241
- yield effects.put(actions.loadTenants());
1239
+ if (user.email) {
1240
+ localStorage.setItem('email', user.email);
1241
+ }
1242
1242
  yield effects.put(actions.setState({ user, isAuthenticated: true }));
1243
- yield afterAuthNavigation();
1243
+ yield effects.put(actions.loadTenants());
1244
+ if (loginState.flow === exports.LoginFlow.Login) {
1245
+ yield afterAuthNavigation();
1246
+ }
1247
+ else {
1248
+ onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1249
+ }
1244
1250
  }
1245
1251
  callback === null || callback === void 0 ? void 0 : callback(true);
1246
1252
  }
@@ -1266,14 +1272,14 @@ function* verifyInviteToken({ payload }) {
1266
1272
  yield effects.put(actions.setLoginState({ loading: false }));
1267
1273
  }
1268
1274
  }
1269
- function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback }, }) {
1275
+ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback, }, }) {
1270
1276
  yield effects.put(actions.setLoginState({ loading: true }));
1271
1277
  try {
1272
1278
  const onRedirectTo = yield effects.select(({ auth: { onRedirectTo } }) => onRedirectTo);
1273
1279
  let { address, idpType } = yield effects.call(restApi.api.auth.preLoginV2, { email });
1274
1280
  if (address) {
1275
1281
  if (idpType === exports.SamlVendors.Oidc && !address.includes('redirect_uri')) {
1276
- const { routes: { oidcRedirectUrl }, } = yield effects.select(({ auth: { routes } }) => ({ routes }));
1282
+ const { routes: { oidcRedirectUrl } } = yield effects.select(({ auth: { routes } }) => ({ routes }));
1277
1283
  address += `&redirect_uri=${window.location.origin}${oidcRedirectUrl}`;
1278
1284
  }
1279
1285
  yield effects.put(actions.setLoginState({ step: exports.LoginStep.redirectToSSO, loading: false, ssoRedirectUrl: address }));
@@ -1291,7 +1297,7 @@ function* preLogin({ payload: { email, recaptchaToken, invitationToken, callback
1291
1297
  }
1292
1298
  function* ssoPreloginFailed(_a) {
1293
1299
  var { callback } = _a, body = tslib.__rest(_a, ["callback"]);
1294
- const publicPolicy = yield effects.select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy }, }, }, }) => publicPolicy);
1300
+ const publicPolicy = yield effects.select(({ auth: { securityPolicyState: { publicPolicy: { policy: publicPolicy } } } }) => publicPolicy);
1295
1301
  if (!(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
1296
1302
  yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithPassword, loading: false }));
1297
1303
  callback === null || callback === void 0 ? void 0 : callback();
@@ -1309,6 +1315,90 @@ function* ssoPreloginFailed(_a) {
1309
1315
  callback === null || callback === void 0 ? void 0 : callback();
1310
1316
  }
1311
1317
  }
1318
+ function* webAuthnCreateNewDeviceSession({ payload: { callback } }) {
1319
+ try {
1320
+ yield effects.put(actions.setLoginState({ loading: true }));
1321
+ const { options } = yield effects.call(restApi.api.auth.webAuthnCreateNewDeviceSession);
1322
+ options.user.id = vendor_index.base64urlDecode(options.user.id);
1323
+ options.challenge = vendor_index.base64urlDecode(options.challenge);
1324
+ options.excludeCredentials = [];
1325
+ callback === null || callback === void 0 ? void 0 : callback(options);
1326
+ }
1327
+ catch (e) {
1328
+ yield effects.put(actions.setLoginState({ error: e.message }));
1329
+ callback === null || callback === void 0 ? void 0 : callback(null);
1330
+ }
1331
+ finally {
1332
+ yield effects.put(actions.setLoginState({ loading: false }));
1333
+ }
1334
+ }
1335
+ function* webAuthnVerifyNewDeviceSession(_a) {
1336
+ var _b = _a.payload, { callback } = _b, body = tslib.__rest(_b, ["callback"]);
1337
+ try {
1338
+ yield effects.put(actions.setLoginState({ loading: true }));
1339
+ const publicKey = vendor_index.publicKeyCredentialToJSON(body.publicKey);
1340
+ yield effects.call(restApi.api.auth.verifyNewDeviceSession, {
1341
+ id: publicKey.id,
1342
+ response: publicKey.response
1343
+ });
1344
+ callback === null || callback === void 0 ? void 0 : callback(true);
1345
+ }
1346
+ catch (e) {
1347
+ yield effects.put(actions.setLoginState({ error: e.message }));
1348
+ callback === null || callback === void 0 ? void 0 : callback(null);
1349
+ }
1350
+ finally {
1351
+ yield effects.put(actions.setLoginState({ loading: false }));
1352
+ }
1353
+ }
1354
+ function* webAuthnPrelogin(_a) {
1355
+ var _b;
1356
+ var _c = _a.payload, { callback } = _c, body = tslib.__rest(_c, ["callback"]);
1357
+ try {
1358
+ yield effects.put(actions.setLoginState({ loading: true }));
1359
+ const { options } = yield effects.call(restApi.api.auth.webAuthnPreLogin, body);
1360
+ options.challenge = vendor_index.base64urlDecode(options.challenge);
1361
+ options.allowCredentials = (_b = options.allowCredentials) === null || _b === void 0 ? void 0 : _b.map((credentials) => (Object.assign(Object.assign({}, credentials), { id: vendor_index.base64urlDecode(credentials.id) })));
1362
+ callback === null || callback === void 0 ? void 0 : callback(options);
1363
+ }
1364
+ catch (e) {
1365
+ yield effects.put(actions.setLoginState({ error: e.message }));
1366
+ callback === null || callback === void 0 ? void 0 : callback(null);
1367
+ }
1368
+ finally {
1369
+ yield effects.put(actions.setLoginState({ loading: false }));
1370
+ }
1371
+ }
1372
+ function* webAuthnPostLogin(_a) {
1373
+ var _b;
1374
+ var _c = _a.payload, { callback } = _c, body = tslib.__rest(_c, ["callback"]);
1375
+ try {
1376
+ yield effects.put(actions.setLoginState({ loading: true }));
1377
+ const publicKey = vendor_index.publicKeyCredentialToJSON(body.publicKey);
1378
+ const data = yield effects.call(restApi.api.auth.webAuthnPostLogin, Object.assign(Object.assign({}, publicKey), { response: Object.assign(Object.assign({}, publicKey.response), { userHandle: (_b = publicKey.response.userHandle) !== null && _b !== void 0 ? _b : undefined }), recaptchaToken: body.recaptchaToken, invitationToken: body.invitationToken }));
1379
+ if (isMfaRequired(data)) {
1380
+ const onRedirectTo = restApi.ContextHolder.onRedirectTo;
1381
+ const { routes } = yield effects.select((state) => state.auth);
1382
+ const mfaRequiredState = yield getMfaRequiredState(data);
1383
+ yield effects.put(actions.setState(mfaRequiredState));
1384
+ onRedirectTo(routes.loginUrl, { preserveQueryParams: true });
1385
+ }
1386
+ else {
1387
+ const user = yield effects.call(restApi.api.auth.generateLoginResponse, data);
1388
+ yield effects.put(actions.loadTenants());
1389
+ yield effects.put(actions.setState({ user, isAuthenticated: true }));
1390
+ yield afterAuthNavigation();
1391
+ }
1392
+ callback === null || callback === void 0 ? void 0 : callback(true);
1393
+ }
1394
+ catch (e) {
1395
+ yield effects.put(actions.setLoginState({ error: e.message }));
1396
+ callback === null || callback === void 0 ? void 0 : callback(null);
1397
+ }
1398
+ finally {
1399
+ yield effects.put(actions.setLoginState({ loading: false }));
1400
+ }
1401
+ }
1312
1402
  function* postLogin({ payload }) {
1313
1403
  const { onRedirectTo, routes } = yield effects.select(({ auth: { onRedirectTo, routes } }) => ({ onRedirectTo, routes }));
1314
1404
  yield effects.put(actions.setLoginState({ loading: true }));
@@ -1329,7 +1419,7 @@ function* postLogin({ payload }) {
1329
1419
  yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithSSOFailed, loading: false }));
1330
1420
  }
1331
1421
  }
1332
- function* login({ payload: { email, password, recaptchaToken, invitationToken, callback }, }) {
1422
+ function* login({ payload: { email, password, recaptchaToken, invitationToken, callback, }, }) {
1333
1423
  yield effects.put(actions.setLoginState({ loading: true }));
1334
1424
  try {
1335
1425
  const user = yield effects.call(restApi.api.auth.login, {
@@ -1357,26 +1447,35 @@ function* login({ payload: { email, password, recaptchaToken, invitationToken, c
1357
1447
  step = exports.LoginStep.forceTwoFactor;
1358
1448
  }
1359
1449
  }
1360
- const isAuthenticated = step === exports.LoginStep.success && !!user.accessToken;
1361
- const loggedInUser = step === exports.LoginStep.success && step === exports.LoginStep.success ? user : undefined;
1450
+ const { loginState } = yield effects.select((state) => state.auth);
1451
+ const isLoginSucceeded = step === exports.LoginStep.success;
1452
+ const isAuthenticated = isLoginSucceeded && !!user.accessToken;
1453
+ const loggedInUser = isLoginSucceeded ? user : undefined;
1362
1454
  let allowRememberDevice = { isAllowedToRemember: false, mfaDeviceExpiration: 0 };
1363
1455
  if (user.mfaRequired && user.mfaToken) {
1364
1456
  allowRememberDevice = yield effects.call(restApi.api.auth.checkIfAllowToRememberMfaDevice, user.mfaToken);
1365
1457
  }
1366
1458
  const { isAllowedToRemember, mfaDeviceExpiration } = allowRememberDevice;
1459
+ if (user.email) {
1460
+ localStorage.setItem('email', user.email);
1461
+ }
1367
1462
  yield effects.put(actions.setState(Object.assign(Object.assign({ user: loggedInUser, isAuthenticated }, setMfaState), { loginState: {
1463
+ flow: loginState.flow,
1464
+ quickLoginToRegister: loginState.quickLoginToRegister,
1368
1465
  email,
1369
1466
  loading: false,
1370
1467
  error: undefined,
1371
1468
  mfaToken: user.mfaToken,
1372
- step,
1469
+ step: (!isLoginSucceeded || loginState.flow === exports.LoginFlow.Login) ? step : loginState.step,
1373
1470
  tenants: [],
1374
1471
  tenantsLoading: true,
1375
1472
  allowRememberMfaDevice: isAllowedToRemember,
1376
1473
  mfaDeviceExpiration,
1377
1474
  } })));
1378
- if (step === exports.LoginStep.success) {
1475
+ if (isLoginSucceeded) {
1379
1476
  yield effects.put(actions.loadTenants());
1477
+ }
1478
+ if (isAuthenticated && loginState.flow === exports.LoginFlow.Login) {
1380
1479
  yield afterAuthNavigation();
1381
1480
  }
1382
1481
  callback === null || callback === void 0 ? void 0 : callback(true);
@@ -1395,17 +1494,21 @@ function* loginWithMfa({ payload: { mfaToken, value, rememberDevice, callback },
1395
1494
  yield effects.put(actions.setLoginState({ loading: true }));
1396
1495
  try {
1397
1496
  const user = yield effects.call(restApi.api.auth.loginWithMfa, { mfaToken, value, rememberDevice });
1398
- const step = exports.LoginStep.success;
1497
+ const { loginState } = yield effects.select((state) => state.auth);
1498
+ const step = loginState.flow === exports.LoginFlow.Login ? exports.LoginStep.success : loginState.step;
1399
1499
  yield effects.put(actions.setState({
1400
- loginState: { loading: false, error: undefined, step, tenantsLoading: true, tenants: [] },
1500
+ loginState: { flow: loginState.flow, quickLoginToRegister: loginState.quickLoginToRegister, loading: false, step, error: undefined, tenantsLoading: true, tenants: [] },
1401
1501
  user,
1402
1502
  isAuthenticated: true,
1403
1503
  }));
1504
+ if (user.email) {
1505
+ localStorage.setItem('email', user.email);
1506
+ }
1404
1507
  yield effects.put(actions.loadTenants());
1405
- callback === null || callback === void 0 ? void 0 : callback(true);
1406
- if (step === exports.LoginStep.success) {
1508
+ if (loginState.flow === exports.LoginFlow.Login) {
1407
1509
  yield afterAuthNavigation();
1408
1510
  }
1511
+ callback === null || callback === void 0 ? void 0 : callback(true);
1409
1512
  }
1410
1513
  catch (e) {
1411
1514
  yield effects.put(actions.setLoginState({ error: e.message, loading: false }));
@@ -1428,7 +1531,8 @@ function* logout({ payload }) {
1428
1531
  try {
1429
1532
  yield effects.call(restApi.api.auth.logout);
1430
1533
  }
1431
- catch (_a) { }
1534
+ catch (_a) {
1535
+ }
1432
1536
  yield effects.put(actions.resetState());
1433
1537
  yield effects.put(actions.requestAuthorize(true));
1434
1538
  payload === null || payload === void 0 ? void 0 : payload();
@@ -1437,7 +1541,8 @@ function* silentLogout({ payload }) {
1437
1541
  try {
1438
1542
  yield effects.call(restApi.api.auth.logout);
1439
1543
  }
1440
- catch (_a) { }
1544
+ catch (_a) {
1545
+ }
1441
1546
  setTimeout(() => payload === null || payload === void 0 ? void 0 : payload(), 500);
1442
1547
  }
1443
1548
  function* loginSagas() {
@@ -1455,6 +1560,11 @@ function* loginSagas() {
1455
1560
  yield effects.takeLeading(actions.passwordlessPreLogin, passwordlessPreLogin);
1456
1561
  yield effects.takeLeading(actions.passwordlessPostLogin, passwordlessPostLogin);
1457
1562
  yield effects.takeLeading(actions.verifyInviteToken, verifyInviteToken);
1563
+ yield effects.takeLeading(actions.webAuthnPrelogin, webAuthnPrelogin);
1564
+ yield effects.takeLeading(actions.webAuthnPostLogin, webAuthnPostLogin);
1565
+ yield effects.takeLeading(actions.webAuthnCreateNewDeviceSession, webAuthnCreateNewDeviceSession);
1566
+ yield effects.takeLeading(actions.webAuthnVerifyNewDeviceSession, webAuthnVerifyNewDeviceSession);
1567
+ yield effects.takeLeading(actions.afterAuthNavigation, afterAuthNavigation);
1458
1568
  }
1459
1569
  /*********************************
1460
1570
  * Preview Sagas
@@ -1692,7 +1802,7 @@ function* ssoSagas$1() {
1692
1802
  *********************************/
1693
1803
  function* loadSSOConfigurationsMock() {
1694
1804
  yield effects.put(actions.setSSOState({ loading: true }));
1695
- yield delay();
1805
+ yield vendor_index.delay();
1696
1806
  yield effects.put(actions.setSSOState({ samlConfiguration: samlConfigurationDemo, loading: false, firstLoad: false }));
1697
1807
  }
1698
1808
  function* saveSSOConfigurationsFileMock({ payload: configFile }) {
@@ -1719,7 +1829,7 @@ function* saveSSOConfigurationsMock({ payload }) {
1719
1829
  else {
1720
1830
  yield effects.put(actions.setSSOState({ error: undefined, [loaderKey]: true }));
1721
1831
  }
1722
- yield delay();
1832
+ yield vendor_index.delay();
1723
1833
  samlConfiguration.acsUrl = (_a = samlMetadataDemo === null || samlMetadataDemo === void 0 ? void 0 : samlMetadataDemo.configuration) === null || _a === void 0 ? void 0 : _a.acsUrl;
1724
1834
  samlConfiguration.spEntityId = (_b = samlMetadataDemo === null || samlMetadataDemo === void 0 ? void 0 : samlMetadataDemo.configuration) === null || _b === void 0 ? void 0 : _b.spEntityId;
1725
1835
  const updateSamlConfiguration = omitProps(samlConfiguration, [
@@ -1734,14 +1844,14 @@ function* saveSSOConfigurationsMock({ payload }) {
1734
1844
  updateSamlConfiguration.signRequest = false;
1735
1845
  }
1736
1846
  updateSamlConfiguration.type = samlVendor === null || samlVendor === void 0 ? void 0 : samlVendor.toLowerCase();
1737
- yield delay();
1847
+ yield vendor_index.delay();
1738
1848
  yield effects.put(actions.setSSOState({ samlConfiguration: updateSamlConfiguration, error: undefined, [loaderKey]: false }));
1739
1849
  callback === null || callback === void 0 ? void 0 : callback(true);
1740
1850
  }
1741
1851
  function* validateSSODomainMock({ payload: { callback } = {} }) {
1742
1852
  const samlConfiguration = ssoStateDemo.samlConfiguration;
1743
1853
  yield effects.put(actions.setSSOState({ error: undefined, saving: true }));
1744
- yield delay();
1854
+ yield vendor_index.delay();
1745
1855
  yield effects.put(actions.setSSOState({
1746
1856
  samlConfiguration: Object.assign(Object.assign({}, samlConfiguration), { validated: true }),
1747
1857
  error: undefined,
@@ -1750,7 +1860,7 @@ function* validateSSODomainMock({ payload: { callback } = {} }) {
1750
1860
  callback === null || callback === void 0 ? void 0 : callback(true);
1751
1861
  }
1752
1862
  function* getAuthorizationRolesMock() {
1753
- yield delay();
1863
+ yield vendor_index.delay();
1754
1864
  const data = { roleIds: ['1', '2', '3'] };
1755
1865
  yield effects.put(actions.setSSOState({
1756
1866
  authorizationRoles: data.roleIds,
@@ -1759,7 +1869,7 @@ function* getAuthorizationRolesMock() {
1759
1869
  }
1760
1870
  function* updateAuthorizationRolesMock({ payload: { callback, authorizationRoles }, }) {
1761
1871
  yield effects.put(actions.setSSOState({ error: undefined, saving: true }));
1762
- yield delay();
1872
+ yield vendor_index.delay();
1763
1873
  yield effects.put(actions.setSSOState({ authorizationRoles, error: undefined, saving: false }));
1764
1874
  callback === null || callback === void 0 ? void 0 : callback(true);
1765
1875
  }
@@ -2137,7 +2247,7 @@ function* profileSagas() {
2137
2247
  *********************************/
2138
2248
  function* loadProfileMock() {
2139
2249
  yield effects.put(actions.setProfileState({ loading: true }));
2140
- yield delay();
2250
+ yield vendor_index.delay();
2141
2251
  yield effects.put(actions.setUser(Object.assign(Object.assign({}, (userDemo)), userProfileDemo)));
2142
2252
  yield effects.put(actions.setProfileState({ loading: false, profile: userProfileDemo }));
2143
2253
  }
@@ -2154,7 +2264,7 @@ function* saveProfileMock(_a) {
2154
2264
  }
2155
2265
  const newProfileData = Object.assign(Object.assign(Object.assign({}, oldProfileData.profile), payload), { profilePictureUrl: newProfilePictureUrl });
2156
2266
  const currentUser = userDemo;
2157
- yield delay();
2267
+ yield vendor_index.delay();
2158
2268
  yield effects.put(actions.setUser(Object.assign(Object.assign({}, currentUser), newProfileData)));
2159
2269
  yield effects.put(actions.setProfileState({ loading: false, error: null, saving: false, profile: newProfileData }));
2160
2270
  callback === null || callback === void 0 ? void 0 : callback(newProfileData);
@@ -2162,7 +2272,7 @@ function* saveProfileMock(_a) {
2162
2272
  function* changePasswordMock({ payload }) {
2163
2273
  var _a;
2164
2274
  yield effects.put(actions.setProfileState({ loading: true }));
2165
- yield delay();
2275
+ yield vendor_index.delay();
2166
2276
  yield effects.put(actions.setProfileState({ loading: false, error: undefined }));
2167
2277
  (_a = payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
2168
2278
  }
@@ -2259,7 +2369,7 @@ function* enrollMfaMock() {
2259
2369
  }
2260
2370
  function* verifyMfaMock({ payload: { callback }, }) {
2261
2371
  yield effects.put(actions.setMfaState({ loading: true }));
2262
- yield delay();
2372
+ yield vendor_index.delay();
2263
2373
  const data = { token: 'token', recoveryCode: 'recoveryCode' };
2264
2374
  const mfaState = {
2265
2375
  step: exports.MFAStep.recoveryCode,
@@ -2276,7 +2386,7 @@ function* verifyMfaMock({ payload: { callback }, }) {
2276
2386
  function* verifyMfaAfterForceMock(_a) {
2277
2387
  var _b = _a.payload, { callback } = _b, payload = tslib.__rest(_b, ["callback"]);
2278
2388
  yield effects.put(actions.setMfaState({ loading: true }));
2279
- yield delay();
2389
+ yield vendor_index.delay();
2280
2390
  const data = Object.assign(Object.assign({}, payload), { recoveryCode: 'recoveryCode' });
2281
2391
  const mfaState = {
2282
2392
  step: exports.MFAStep.recoveryCode,
@@ -2287,14 +2397,14 @@ function* verifyMfaAfterForceMock(_a) {
2287
2397
  mfaState.recoveryCode = data.recoveryCode;
2288
2398
  }
2289
2399
  yield effects.put(actions.setMfaState(mfaState));
2290
- yield delay();
2400
+ yield vendor_index.delay();
2291
2401
  yield effects.put(actions.setUser(Object.assign(Object.assign({}, userDemo), { mfaEnrolled: true })));
2292
2402
  callback === null || callback === void 0 ? void 0 : callback(mfaState.recoveryCode);
2293
2403
  }
2294
2404
  function* disableMfaMock({ payload }) {
2295
2405
  var _a;
2296
2406
  yield effects.put(actions.setMfaState({ loading: true }));
2297
- yield delay();
2407
+ yield vendor_index.delay();
2298
2408
  yield effects.put(actions.setMfaState({ loading: false, error: undefined }));
2299
2409
  yield effects.put(actions.setUser(Object.assign(Object.assign({}, userDemo), { mfaEnrolled: false })));
2300
2410
  (_a = payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
@@ -2881,7 +2991,7 @@ function* loadUsersMock({ payload }) {
2881
2991
  }));
2882
2992
  const totalPages = 2;
2883
2993
  const totalItems = 10;
2884
- yield delay();
2994
+ yield vendor_index.delay();
2885
2995
  yield effects.put(actions.setTeamState({ users: usersDemo, totalPages, totalItems, roles: rolesDemo, permissions: permissionsDemo }));
2886
2996
  yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.USERS, value: false }));
2887
2997
  callback === null || callback === void 0 ? void 0 : callback(usersDemo);
@@ -2907,7 +3017,7 @@ function* loadAllSubTenantsUsersMock({ payload, }) {
2907
3017
  }));
2908
3018
  const totalPages = 2;
2909
3019
  const totalItems = 10;
2910
- yield delay();
3020
+ yield vendor_index.delay();
2911
3021
  yield effects.put(actions.setTeamState({
2912
3022
  allUsers: allUsersDemo,
2913
3023
  totalPages,
@@ -2921,7 +3031,7 @@ function* loadAllSubTenantsUsersMock({ payload, }) {
2921
3031
  function* loadRolesMock({ payload }) {
2922
3032
  var _a;
2923
3033
  yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
2924
- yield delay();
3034
+ yield vendor_index.delay();
2925
3035
  yield effects.put(actions.setTeamState({ roles: rolesDemo, permissions: permissionsDemo }));
2926
3036
  yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.ROLES_AND_PERMISSIONS, value: true }));
2927
3037
  (_a = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, { roles: rolesDemo, permissions: permissionsDemo });
@@ -2930,7 +3040,7 @@ function* addUserMock({ payload }) {
2930
3040
  const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
2931
3041
  const teamState = yield selectTeamState();
2932
3042
  yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
2933
- yield delay();
3043
+ yield vendor_index.delay();
2934
3044
  const newUser = Object.assign(Object.assign(Object.assign({}, userTeamDemo), body), { id: `${uuid.v4()}` });
2935
3045
  callback === null || callback === void 0 ? void 0 : callback(newUser);
2936
3046
  yield effects.put(actions.setTeamState({
@@ -2942,7 +3052,7 @@ function* addUserToSubTenantsMock({ payload }) {
2942
3052
  const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
2943
3053
  const teamState = yield selectTeamState();
2944
3054
  yield effects.put(actions.setTeamState({ addUserDialogState: Object.assign(Object.assign({}, teamState.addUserDialogState), { loading: true }) }));
2945
- yield delay();
3055
+ yield vendor_index.delay();
2946
3056
  const newUser = Object.assign(Object.assign(Object.assign({}, userTeamDemo), body), { id: `${uuid.v4()}` });
2947
3057
  yield effects.put(actions.setTeamState({
2948
3058
  users: [newUser, ...teamState.users],
@@ -2970,7 +3080,7 @@ function* updateUserMock({ payload }) {
2970
3080
  if (oldUserData.roleIds.length > 0 && ((_a = body.roleIds) === null || _a === void 0 ? void 0 : _a.length) === 0) {
2971
3081
  body.roleIds = [''];
2972
3082
  }
2973
- yield delay();
3083
+ yield vendor_index.delay();
2974
3084
  const newUser = Object.assign(Object.assign({}, oldUserData), body);
2975
3085
  callback === null || callback === void 0 ? void 0 : callback(newUser);
2976
3086
  yield effects.put(actions.setTeamState({
@@ -2983,7 +3093,7 @@ function* deleteUserMock({ payload }) {
2983
3093
  const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
2984
3094
  const teamState = yield selectTeamState();
2985
3095
  yield effects.put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
2986
- yield delay();
3096
+ yield vendor_index.delay();
2987
3097
  callback === null || callback === void 0 ? void 0 : callback(true);
2988
3098
  yield effects.put(actions.setTeamState({
2989
3099
  users: teamState.users.filter((user) => user.id !== body.userId),
@@ -2994,7 +3104,7 @@ function* deleteUserFromSubTenantsMock({ payload }) {
2994
3104
  const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
2995
3105
  const teamState = yield selectTeamState();
2996
3106
  yield effects.put(actions.setTeamState({ deleteUserDialogState: Object.assign(Object.assign({}, teamState.deleteUserDialogState), { loading: true }) }));
2997
- yield delay();
3107
+ yield vendor_index.delay();
2998
3108
  callback === null || callback === void 0 ? void 0 : callback(true);
2999
3109
  yield effects.put(actions.setTeamState({
3000
3110
  allUsers: teamState.allUsers.filter((user) => user.id !== body.userId),
@@ -3004,14 +3114,14 @@ function* deleteUserFromSubTenantsMock({ payload }) {
3004
3114
  function* resendActivationLinkMock({ payload }) {
3005
3115
  const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
3006
3116
  yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_ACTIVATE_LINK, value: body.userId }));
3007
- yield delay();
3117
+ yield vendor_index.delay();
3008
3118
  callback === null || callback === void 0 ? void 0 : callback(true);
3009
3119
  yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_ACTIVATE_LINK, value: false }));
3010
3120
  }
3011
3121
  function* resendInvitationLinkMock({ payload }) {
3012
3122
  const { callback } = payload, body = tslib.__rest(payload, ["callback"]);
3013
3123
  yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_INVITATION_LINK, value: body.email }));
3014
- yield delay();
3124
+ yield vendor_index.delay();
3015
3125
  callback === null || callback === void 0 ? void 0 : callback(true);
3016
3126
  yield effects.put(actions.setTeamLoader({ key: exports.TeamStateKeys.RESEND_INVITATION_LINK, value: false }));
3017
3127
  }
@@ -3084,6 +3194,9 @@ function* loginViaSocialLogin(_a) {
3084
3194
  name,
3085
3195
  });
3086
3196
  }
3197
+ if (email) {
3198
+ localStorage.setItem('email', email);
3199
+ }
3087
3200
  yield effects.put(actions.setLoginState({ email, isNewUser }));
3088
3201
  yield refreshToken();
3089
3202
  yield effects.put(actions.setSocialLoginsState({ loading: false }));
@@ -3322,6 +3435,7 @@ function* loadSecurityPolicy() {
3322
3435
  yield effects.put(actions.loadSecurityPolicyVendorMfa());
3323
3436
  yield effects.put(actions.loadSecurityPolicyLockout());
3324
3437
  yield effects.put(actions.loadSecurityPolicyCaptcha());
3438
+ yield effects.put(actions.loadPublicAuthStrategiesPolicy());
3325
3439
  }
3326
3440
  function* loadPublicSecurityPolicy() {
3327
3441
  yield effects.put(actions.setSecurityPolicyPublicState({ loading: true, error: null }));
@@ -3333,6 +3447,16 @@ function* loadPublicSecurityPolicy() {
3333
3447
  yield effects.put(actions.setSecurityPolicyPublicState({ error: e.message, loading: false }));
3334
3448
  }
3335
3449
  }
3450
+ function* loadPublicAuthStrategiesPolicy() {
3451
+ yield effects.put(actions.setSecurityPolicyAuthStrategyPublicState({ loading: true, error: null }));
3452
+ try {
3453
+ const policy = yield effects.call(restApi.api.auth.getVendorPublicAuthStrategiesConfig);
3454
+ yield effects.put(actions.setSecurityPolicyAuthStrategyPublicState({ policy, loading: false }));
3455
+ }
3456
+ catch (e) {
3457
+ yield effects.put(actions.setSecurityPolicyAuthStrategyPublicState({ error: e.message, loading: false }));
3458
+ }
3459
+ }
3336
3460
  function* loadSecurityPolicyMfa() {
3337
3461
  yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
3338
3462
  try {
@@ -3444,6 +3568,7 @@ function* securityPolicySagas() {
3444
3568
  yield effects.takeEvery(actions.loadSecurityPolicyPasswordHistory, loadSecurityPolicyPasswordHistory);
3445
3569
  yield effects.takeEvery(actions.loadVendorPasswordConfig, loadVendorPasswordConfig);
3446
3570
  yield effects.takeEvery(actions.loadPublicSecurityPolicy, loadPublicSecurityPolicy);
3571
+ yield effects.takeEvery(actions.loadPublicAuthStrategiesPolicy, loadPublicAuthStrategiesPolicy);
3447
3572
  }
3448
3573
  /*********************************
3449
3574
  * Preview Sagas
@@ -3459,7 +3584,7 @@ function* loadPublicSecurityPolicyMock() {
3459
3584
  }
3460
3585
  function* loadSecurityPolicyMock() {
3461
3586
  yield effects.put(actions.setSecurityPolicyGlobalState({ loading: true, error: null }));
3462
- yield delay();
3587
+ yield vendor_index.delay();
3463
3588
  yield effects.put(actions.setSecurityPolicyGlobalState({ policy: policyDemo, loading: false }));
3464
3589
  yield effects.put(actions.loadSecurityPolicyMfa());
3465
3590
  yield effects.put(actions.loadSecurityPolicyVendorMfa());
@@ -3468,12 +3593,12 @@ function* loadSecurityPolicyMock() {
3468
3593
  }
3469
3594
  function* loadSecurityPolicyMfaMock() {
3470
3595
  yield effects.put(actions.setSecurityPolicyMfaState({ loading: true, error: null }));
3471
- yield delay();
3596
+ yield vendor_index.delay();
3472
3597
  yield effects.put(actions.setSecurityPolicyMfaState({ policy: policyMfaDemo, loading: false }));
3473
3598
  }
3474
3599
  function* loadSecurityPolicyVendorMfaMock() {
3475
3600
  yield effects.put(actions.setSecurityPolicyVendorMfaState({ loading: true, error: null }));
3476
- yield delay();
3601
+ yield vendor_index.delay();
3477
3602
  yield effects.put(actions.setSecurityPolicyVendorMfaState({ policy: policyMfaDemo, loading: false }));
3478
3603
  }
3479
3604
  function* saveSecurityPolicyMfaMock(_a) {
@@ -3481,37 +3606,37 @@ function* saveSecurityPolicyMfaMock(_a) {
3481
3606
  var _c = _a.payload, { callback } = _c, newSecurityPolicy = tslib.__rest(_c, ["callback"]);
3482
3607
  yield effects.put(actions.setSecurityPolicyMfaState({ saving: true, error: null }));
3483
3608
  const policy = Object.assign(Object.assign({}, policyLockoutDemo), { id: (_b = newSecurityPolicy.id) !== null && _b !== void 0 ? _b : policyLockoutDemo.id, enforceMFAType: newSecurityPolicy.enforceMFAType });
3484
- yield delay();
3609
+ yield vendor_index.delay();
3485
3610
  yield effects.put(actions.setSecurityPolicyMfaState({ policy, saving: false }));
3486
3611
  callback === null || callback === void 0 ? void 0 : callback(policy);
3487
3612
  }
3488
3613
  function* loadSecurityPolicyLockoutMock() {
3489
3614
  yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
3490
- yield delay();
3615
+ yield vendor_index.delay();
3491
3616
  yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
3492
3617
  }
3493
3618
  function* saveSecurityPolicyLockoutMock(_a) {
3494
3619
  var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
3495
3620
  yield effects.put(actions.setSecurityPolicyLockoutState({ saving: true, error: null }));
3496
- yield delay();
3621
+ yield vendor_index.delay();
3497
3622
  const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyLockoutDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyLockoutDemo.id });
3498
3623
  callback === null || callback === void 0 ? void 0 : callback(policy);
3499
3624
  yield effects.put(actions.setSecurityPolicyLockoutState({ policy, saving: false }));
3500
3625
  }
3501
3626
  function* loadSecurityPolicyCaptchaMock() {
3502
3627
  yield effects.put(actions.setSecurityPolicyLockoutState({ loading: true, error: null }));
3503
- yield delay();
3628
+ yield vendor_index.delay();
3504
3629
  yield effects.put(actions.setSecurityPolicyLockoutState({ policy: policyLockoutDemo, loading: false }));
3505
3630
  }
3506
3631
  function* loadSecurityPolicyPasswordHistoryMock() {
3507
3632
  yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ loading: true, error: null }));
3508
- yield delay();
3633
+ yield vendor_index.delay();
3509
3634
  yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy: policyPasswordHistoryDemo, loading: false }));
3510
3635
  }
3511
3636
  function* saveSecurityPolicyPasswordHistoryMock(_a) {
3512
3637
  var _b = _a.payload, { callback } = _b, newSecurityPolicy = tslib.__rest(_b, ["callback"]);
3513
3638
  yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ saving: true, error: null }));
3514
- yield delay();
3639
+ yield vendor_index.delay();
3515
3640
  const policy = Object.assign(Object.assign(Object.assign({}, newSecurityPolicy), policyPasswordHistoryDemo), { id: newSecurityPolicy.id ? newSecurityPolicy.id : policyPasswordHistoryDemo.id });
3516
3641
  callback === null || callback === void 0 ? void 0 : callback(policy);
3517
3642
  yield effects.put(actions.setSecurityPolicyPasswordHistoryState({ policy, saving: false }));
@@ -3569,7 +3694,7 @@ function* accountSettingsSaga() {
3569
3694
  function* saveAccountSettingsMock({ payload }) {
3570
3695
  var _a;
3571
3696
  yield effects.put(actions.setAccountSettingsState({ loading: true }));
3572
- yield delay();
3697
+ yield vendor_index.delay();
3573
3698
  const { accountSettingsState } = yield effects.select((state) => state.auth);
3574
3699
  const { address, timezone, dateFormat, timeFormat, currency, logo } = accountSettingsState;
3575
3700
  const body = Object.assign({ address,
@@ -3583,7 +3708,7 @@ function* saveAccountSettingsMock({ payload }) {
3583
3708
  }
3584
3709
  function* loadAccountSettingsMock({ payload }) {
3585
3710
  yield effects.put(actions.setAccountSettingsState({ loading: !(payload === null || payload === void 0 ? void 0 : payload.silentLoading), error: null }));
3586
- yield delay();
3711
+ yield vendor_index.delay();
3587
3712
  yield effects.put(actions.setAccountSettingsState({
3588
3713
  address: 'Tel-aviv',
3589
3714
  timezone: 'Asia/Jerusalem',
@@ -3663,7 +3788,7 @@ function* tenantsSagas() {
3663
3788
  *********************************/
3664
3789
  function* loadTenantsMock({}) {
3665
3790
  yield effects.put(actions.setTenantsState({ loading: true }));
3666
- yield delay();
3791
+ yield vendor_index.delay();
3667
3792
  yield effects.put(actions.setTenantsState({ tenants: tenantsDemo, loading: false }));
3668
3793
  }
3669
3794
  function* tenantsSagasMock() {