@frontegg/redux-store 6.75.0-alpha.2 → 6.75.0-alpha.4

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 (58) hide show
  1. package/auth/AcceptInvitationState/index.d.ts +2 -0
  2. package/auth/AccountSettingsState/index.d.ts +2 -0
  3. package/auth/ActivateState/index.d.ts +6 -12
  4. package/auth/ApiTokensState/index.d.ts +2 -0
  5. package/auth/ForgotPasswordState/index.d.ts +2 -0
  6. package/auth/GroupsState/groupsDialogsState.d.ts +12 -0
  7. package/auth/GroupsState/index.d.ts +2 -0
  8. package/auth/ImpersonationState/index.d.ts +2 -0
  9. package/auth/LoginState/index.d.ts +2 -0
  10. package/auth/LoginState/interfaces.d.ts +2 -1
  11. package/auth/LoginState/interfaces.js +1 -0
  12. package/auth/LoginState/saga.d.ts +8 -2
  13. package/auth/LoginState/saga.js +124 -29
  14. package/auth/MfaState/index.d.ts +2 -0
  15. package/auth/PasskeysState/helpers.d.ts +2 -0
  16. package/auth/PasskeysState/helpers.js +7 -0
  17. package/auth/PasskeysState/index.d.ts +108 -0
  18. package/auth/PasskeysState/index.js +28 -0
  19. package/auth/PasskeysState/interfaces.d.ts +4 -0
  20. package/auth/PasskeysState/interfaces.js +1 -0
  21. package/auth/PasskeysState/saga.d.ts +6 -0
  22. package/auth/PasskeysState/saga.js +14 -0
  23. package/auth/ProfileState/index.d.ts +2 -0
  24. package/auth/Provisioning/index.d.ts +2 -0
  25. package/auth/ResetPhoneNumberState/index.d.ts +2 -0
  26. package/auth/RestrictionsState/index.d.ts +3 -0
  27. package/auth/RolesState/index.d.ts +2 -0
  28. package/auth/SSOState/index.d.ts +2 -0
  29. package/auth/SecurityPolicyState/index.d.ts +13 -0
  30. package/auth/SessionsPolicyState/index.d.ts +2 -0
  31. package/auth/SessionsState/index.d.ts +2 -0
  32. package/auth/SignUp/index.d.ts +2 -0
  33. package/auth/SocialLogins/index.d.ts +2 -0
  34. package/auth/TeamState/index.d.ts +2 -0
  35. package/auth/TenantsState/index.d.ts +2 -0
  36. package/auth/index.d.ts +5 -0
  37. package/auth/index.js +2 -0
  38. package/auth/initialState.js +3 -1
  39. package/auth/interfaces.d.ts +2 -0
  40. package/auth/reducer.d.ts +5 -1
  41. package/auth/reducer.js +3 -2
  42. package/auth/saga.js +2 -1
  43. package/auth/utils.d.ts +6 -0
  44. package/index.js +1 -1
  45. package/node/auth/LoginState/interfaces.js +1 -0
  46. package/node/auth/LoginState/saga.js +122 -26
  47. package/node/auth/PasskeysState/helpers.js +14 -0
  48. package/node/auth/PasskeysState/index.js +35 -0
  49. package/node/auth/PasskeysState/interfaces.js +5 -0
  50. package/node/auth/PasskeysState/saga.js +21 -0
  51. package/node/auth/index.js +24 -0
  52. package/node/auth/initialState.js +3 -1
  53. package/node/auth/reducer.js +3 -2
  54. package/node/auth/saga.js +4 -3
  55. package/node/index.js +1 -1
  56. package/package.json +2 -2
  57. package/subscriptions/Billing/Information/saga.d.ts +2 -2
  58. package/toolkit/index.d.ts +1 -1
@@ -45,6 +45,7 @@ declare const reducers: {
45
45
  disableSilentRefresh?: boolean | undefined;
46
46
  sessionsPolicyState: import("..").SessionsPolicyState;
47
47
  impersonateState?: import("..").ImpersonateState | undefined;
48
+ passkeysState?: import("..").PasskeysState | undefined;
48
49
  routes: import("..").AuthPageRoutes;
49
50
  header?: any;
50
51
  loaderComponent?: any;
@@ -86,6 +87,7 @@ declare const reducers: {
86
87
  disableSilentRefresh?: boolean | undefined;
87
88
  sessionsPolicyState: import("..").SessionsPolicyState;
88
89
  impersonateState?: import("..").ImpersonateState | undefined;
90
+ passkeysState?: import("..").PasskeysState | undefined;
89
91
  routes: import("..").AuthPageRoutes;
90
92
  header?: any;
91
93
  loaderComponent?: any;
@@ -46,6 +46,7 @@ declare const reducers: {
46
46
  disableSilentRefresh?: boolean | undefined;
47
47
  sessionsPolicyState: import("..").SessionsPolicyState;
48
48
  impersonateState?: import("..").ImpersonateState | undefined;
49
+ passkeysState?: import("..").PasskeysState | undefined;
49
50
  routes: import("..").AuthPageRoutes;
50
51
  header?: any;
51
52
  loaderComponent?: any;
@@ -87,6 +88,7 @@ declare const reducers: {
87
88
  disableSilentRefresh?: boolean | undefined;
88
89
  sessionsPolicyState: import("..").SessionsPolicyState;
89
90
  impersonateState?: import("..").ImpersonateState | undefined;
91
+ passkeysState?: import("..").PasskeysState | undefined;
90
92
  routes: import("..").AuthPageRoutes;
91
93
  header?: any;
92
94
  loaderComponent?: any;
@@ -25,10 +25,7 @@ declare const reducers: {
25
25
  activateState: ActivateAccountState;
26
26
  acceptInvitationState: import("..").AcceptInvitationState;
27
27
  forgotPasswordState: import("..").ForgotPasswordState;
28
- resetPhoneNumberState: import("..").ResetPhoneNumberState; /**
29
- * if you see error in matcher that's mean the DispatchAction does not
30
- * contains the same functions in reducers and actions
31
- */
28
+ resetPhoneNumberState: import("..").ResetPhoneNumberState;
32
29
  ssoState: import("..").SSOState;
33
30
  profileState: import("..").ProfileState;
34
31
  mfaState: import("..").MFAState;
@@ -49,6 +46,7 @@ declare const reducers: {
49
46
  disableSilentRefresh?: boolean | undefined;
50
47
  sessionsPolicyState: import("..").SessionsPolicyState;
51
48
  impersonateState?: import("..").ImpersonateState | undefined;
49
+ passkeysState?: import("..").PasskeysState | undefined;
52
50
  routes: import("..").AuthPageRoutes;
53
51
  header?: any;
54
52
  loaderComponent?: any;
@@ -69,10 +67,7 @@ declare const reducers: {
69
67
  activateState: ActivateAccountState;
70
68
  acceptInvitationState: import("..").AcceptInvitationState;
71
69
  forgotPasswordState: import("..").ForgotPasswordState;
72
- resetPhoneNumberState: import("..").ResetPhoneNumberState; /**
73
- * if you see error in matcher that's mean the DispatchAction does not
74
- * contains the same functions in reducers and actions
75
- */
70
+ resetPhoneNumberState: import("..").ResetPhoneNumberState;
76
71
  ssoState: import("..").SSOState;
77
72
  profileState: import("..").ProfileState;
78
73
  mfaState: import("..").MFAState;
@@ -93,6 +88,7 @@ declare const reducers: {
93
88
  disableSilentRefresh?: boolean | undefined;
94
89
  sessionsPolicyState: import("..").SessionsPolicyState;
95
90
  impersonateState?: import("..").ImpersonateState | undefined;
91
+ passkeysState?: import("..").PasskeysState | undefined;
96
92
  routes: import("..").AuthPageRoutes;
97
93
  header?: any;
98
94
  loaderComponent?: any;
@@ -119,10 +115,7 @@ declare const reducers: {
119
115
  activateState: ActivateAccountState;
120
116
  acceptInvitationState: import("..").AcceptInvitationState;
121
117
  forgotPasswordState: import("..").ForgotPasswordState;
122
- resetPhoneNumberState: import("..").ResetPhoneNumberState; /**
123
- * if you see error in matcher that's mean the DispatchAction does not
124
- * contains the same functions in reducers and actions
125
- */
118
+ resetPhoneNumberState: import("..").ResetPhoneNumberState;
126
119
  ssoState: import("..").SSOState;
127
120
  profileState: import("..").ProfileState;
128
121
  mfaState: import("..").MFAState;
@@ -143,6 +136,7 @@ declare const reducers: {
143
136
  disableSilentRefresh?: boolean | undefined;
144
137
  sessionsPolicyState: import("..").SessionsPolicyState;
145
138
  impersonateState?: import("..").ImpersonateState | undefined;
139
+ passkeysState?: import("..").PasskeysState | undefined;
146
140
  routes: import("..").AuthPageRoutes;
147
141
  header?: any;
148
142
  loaderComponent?: any;
@@ -63,6 +63,7 @@ declare const reducers: {
63
63
  disableSilentRefresh?: boolean | undefined;
64
64
  sessionsPolicyState: import("..").SessionsPolicyState;
65
65
  impersonateState?: import("..").ImpersonateState | undefined;
66
+ passkeysState?: import("..").PasskeysState | undefined;
66
67
  routes: import("..").AuthPageRoutes;
67
68
  header?: any;
68
69
  loaderComponent?: any;
@@ -104,6 +105,7 @@ declare const reducers: {
104
105
  disableSilentRefresh?: boolean | undefined;
105
106
  sessionsPolicyState: import("..").SessionsPolicyState;
106
107
  impersonateState?: import("..").ImpersonateState | undefined;
108
+ passkeysState?: import("..").PasskeysState | undefined;
107
109
  routes: import("..").AuthPageRoutes;
108
110
  header?: any;
109
111
  loaderComponent?: any;
@@ -46,6 +46,7 @@ declare const reducers: {
46
46
  disableSilentRefresh?: boolean | undefined;
47
47
  sessionsPolicyState: import("..").SessionsPolicyState;
48
48
  impersonateState?: import("..").ImpersonateState | undefined;
49
+ passkeysState?: import("..").PasskeysState | undefined;
49
50
  routes: import("..").AuthPageRoutes;
50
51
  header?: any;
51
52
  loaderComponent?: any;
@@ -87,6 +88,7 @@ declare const reducers: {
87
88
  disableSilentRefresh?: boolean | undefined;
88
89
  sessionsPolicyState: import("..").SessionsPolicyState;
89
90
  impersonateState?: import("..").ImpersonateState | undefined;
91
+ passkeysState?: import("..").PasskeysState | undefined;
90
92
  routes: import("..").AuthPageRoutes;
91
93
  header?: any;
92
94
  loaderComponent?: any;
@@ -44,6 +44,7 @@ declare const reducers: {
44
44
  disableSilentRefresh?: boolean | undefined;
45
45
  sessionsPolicyState: import("..").SessionsPolicyState;
46
46
  impersonateState?: import("..").ImpersonateState | undefined;
47
+ passkeysState?: import("..").PasskeysState | undefined;
47
48
  routes: import("..").AuthPageRoutes;
48
49
  header?: any;
49
50
  loaderComponent?: any;
@@ -85,6 +86,7 @@ declare const reducers: {
85
86
  disableSilentRefresh?: boolean | undefined;
86
87
  sessionsPolicyState: import("..").SessionsPolicyState;
87
88
  impersonateState?: import("..").ImpersonateState | undefined;
89
+ passkeysState?: import("..").PasskeysState | undefined;
88
90
  routes: import("..").AuthPageRoutes;
89
91
  header?: any;
90
92
  loaderComponent?: any;
@@ -125,6 +127,7 @@ declare const reducers: {
125
127
  disableSilentRefresh?: boolean | undefined;
126
128
  sessionsPolicyState: import("..").SessionsPolicyState;
127
129
  impersonateState?: import("..").ImpersonateState | undefined;
130
+ passkeysState?: import("..").PasskeysState | undefined;
128
131
  routes: import("..").AuthPageRoutes;
129
132
  header?: any;
130
133
  loaderComponent?: any;
@@ -165,6 +168,7 @@ declare const reducers: {
165
168
  disableSilentRefresh?: boolean | undefined;
166
169
  sessionsPolicyState: import("..").SessionsPolicyState;
167
170
  impersonateState?: import("..").ImpersonateState | undefined;
171
+ passkeysState?: import("..").PasskeysState | undefined;
168
172
  routes: import("..").AuthPageRoutes;
169
173
  header?: any;
170
174
  loaderComponent?: any;
@@ -212,6 +216,7 @@ declare const reducers: {
212
216
  disableSilentRefresh?: boolean | undefined;
213
217
  sessionsPolicyState: import("..").SessionsPolicyState;
214
218
  impersonateState?: import("..").ImpersonateState | undefined;
219
+ passkeysState?: import("..").PasskeysState | undefined;
215
220
  routes: import("..").AuthPageRoutes;
216
221
  header?: any;
217
222
  loaderComponent?: any;
@@ -253,6 +258,7 @@ declare const reducers: {
253
258
  disableSilentRefresh?: boolean | undefined;
254
259
  sessionsPolicyState: import("..").SessionsPolicyState;
255
260
  impersonateState?: import("..").ImpersonateState | undefined;
261
+ passkeysState?: import("..").PasskeysState | undefined;
256
262
  routes: import("..").AuthPageRoutes;
257
263
  header?: any;
258
264
  loaderComponent?: any;
@@ -321,6 +327,7 @@ declare const reducers: {
321
327
  disableSilentRefresh?: boolean | undefined;
322
328
  sessionsPolicyState: import("..").SessionsPolicyState;
323
329
  impersonateState?: import("..").ImpersonateState | undefined;
330
+ passkeysState?: import("..").PasskeysState | undefined;
324
331
  routes: import("..").AuthPageRoutes;
325
332
  header?: any;
326
333
  loaderComponent?: any;
@@ -362,6 +369,7 @@ declare const reducers: {
362
369
  disableSilentRefresh?: boolean | undefined;
363
370
  sessionsPolicyState: import("..").SessionsPolicyState;
364
371
  impersonateState?: import("..").ImpersonateState | undefined;
372
+ passkeysState?: import("..").PasskeysState | undefined;
365
373
  routes: import("..").AuthPageRoutes;
366
374
  header?: any;
367
375
  loaderComponent?: any;
@@ -402,6 +410,7 @@ declare const reducers: {
402
410
  disableSilentRefresh?: boolean | undefined;
403
411
  sessionsPolicyState: import("..").SessionsPolicyState;
404
412
  impersonateState?: import("..").ImpersonateState | undefined;
413
+ passkeysState?: import("..").PasskeysState | undefined;
405
414
  routes: import("..").AuthPageRoutes;
406
415
  header?: any;
407
416
  loaderComponent?: any;
@@ -442,6 +451,7 @@ declare const reducers: {
442
451
  disableSilentRefresh?: boolean | undefined;
443
452
  sessionsPolicyState: import("..").SessionsPolicyState;
444
453
  impersonateState?: import("..").ImpersonateState | undefined;
454
+ passkeysState?: import("..").PasskeysState | undefined;
445
455
  routes: import("..").AuthPageRoutes;
446
456
  header?: any;
447
457
  loaderComponent?: any;
@@ -489,6 +499,7 @@ declare const reducers: {
489
499
  disableSilentRefresh?: boolean | undefined;
490
500
  sessionsPolicyState: import("..").SessionsPolicyState;
491
501
  impersonateState?: import("..").ImpersonateState | undefined;
502
+ passkeysState?: import("..").PasskeysState | undefined;
492
503
  routes: import("..").AuthPageRoutes;
493
504
  header?: any;
494
505
  loaderComponent?: any;
@@ -530,6 +541,7 @@ declare const reducers: {
530
541
  disableSilentRefresh?: boolean | undefined;
531
542
  sessionsPolicyState: import("..").SessionsPolicyState;
532
543
  impersonateState?: import("..").ImpersonateState | undefined;
544
+ passkeysState?: import("..").PasskeysState | undefined;
533
545
  routes: import("..").AuthPageRoutes;
534
546
  header?: any;
535
547
  loaderComponent?: any;
@@ -62,6 +62,7 @@ declare const reducers: {
62
62
  disableSilentRefresh?: boolean | undefined;
63
63
  sessionsPolicyState: import("..").SessionsPolicyState;
64
64
  impersonateState?: import("..").ImpersonateState | undefined;
65
+ passkeysState?: import("..").PasskeysState | undefined;
65
66
  routes: import("..").AuthPageRoutes;
66
67
  header?: any;
67
68
  loaderComponent?: any;
@@ -103,6 +104,7 @@ declare const reducers: {
103
104
  disableSilentRefresh?: boolean | undefined;
104
105
  sessionsPolicyState: import("..").SessionsPolicyState;
105
106
  impersonateState?: import("..").ImpersonateState | undefined;
107
+ passkeysState?: import("..").PasskeysState | undefined;
106
108
  routes: import("..").AuthPageRoutes;
107
109
  header?: any;
108
110
  loaderComponent?: any;
@@ -45,6 +45,7 @@ declare const reducers: {
45
45
  disableSilentRefresh?: boolean | undefined;
46
46
  sessionsPolicyState: import("..").SessionsPolicyState;
47
47
  impersonateState?: ImpersonateState | undefined;
48
+ passkeysState?: import("..").PasskeysState | undefined;
48
49
  routes: import("..").AuthPageRoutes;
49
50
  header?: any;
50
51
  loaderComponent?: any;
@@ -86,6 +87,7 @@ declare const reducers: {
86
87
  disableSilentRefresh?: boolean | undefined;
87
88
  sessionsPolicyState: import("..").SessionsPolicyState;
88
89
  impersonateState?: ImpersonateState | undefined;
90
+ passkeysState?: import("..").PasskeysState | undefined;
89
91
  routes: import("..").AuthPageRoutes;
90
92
  header?: any;
91
93
  loaderComponent?: any;
@@ -47,6 +47,7 @@ declare const reducers: {
47
47
  disableSilentRefresh?: boolean | undefined;
48
48
  sessionsPolicyState: import("..").SessionsPolicyState;
49
49
  impersonateState?: import("..").ImpersonateState | undefined;
50
+ passkeysState?: import("..").PasskeysState | undefined;
50
51
  routes: import("..").AuthPageRoutes;
51
52
  header?: any;
52
53
  loaderComponent?: any;
@@ -88,6 +89,7 @@ declare const reducers: {
88
89
  disableSilentRefresh?: boolean | undefined;
89
90
  sessionsPolicyState: import("..").SessionsPolicyState;
90
91
  impersonateState?: import("..").ImpersonateState | undefined;
92
+ passkeysState?: import("..").PasskeysState | undefined;
91
93
  routes: import("..").AuthPageRoutes;
92
94
  header?: any;
93
95
  loaderComponent?: any;
@@ -13,7 +13,8 @@ export declare enum LoginStep {
13
13
  'loginWithSSOFailed' = "loginWithSSOFailed",
14
14
  'success' = "success",
15
15
  'forceTwoFactor' = "forceTwoFactor",
16
- 'recoverTwoFactor' = "recoverTwoFactor"
16
+ 'recoverTwoFactor' = "recoverTwoFactor",
17
+ 'promptPasskeys' = "promptPasskeys"
17
18
  }
18
19
  export declare enum LoginFlow {
19
20
  Login = "login",
@@ -13,6 +13,7 @@ export let LoginStep;
13
13
  LoginStep["success"] = "success";
14
14
  LoginStep["forceTwoFactor"] = "forceTwoFactor";
15
15
  LoginStep["recoverTwoFactor"] = "recoverTwoFactor";
16
+ LoginStep["promptPasskeys"] = "promptPasskeys";
16
17
  })(LoginStep || (LoginStep = {}));
17
18
  export let LoginFlow;
18
19
  (function (LoginFlow) {
@@ -1,9 +1,9 @@
1
1
  import { CallEffect } from 'redux-saga/effects';
2
- import { ILoginResponse, ISamlMetadata } from '@frontegg/rest-api';
2
+ import { ILoginResponse, ISamlMetadata, IWebAuthnDevices } from '@frontegg/rest-api';
3
3
  import { AuthState } from '../interfaces';
4
4
  import { LoginFlow, LoginStep, QuickLoginStrategy } from './interfaces';
5
5
  import { MFAState } from '../MfaState/interfaces';
6
- export declare function afterAuthNavigation(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<true>, void, {
6
+ export declare function afterAuthNavigation(): Generator<Promise<unknown> | import("redux-saga/effects").SelectEffect, void, {
7
7
  routes: any;
8
8
  includeQueryParam: any;
9
9
  }>;
@@ -50,5 +50,11 @@ export declare function getMfaRequiredState(user: any): Generator<import("redux-
50
50
  }>;
51
51
  export declare function refreshToken(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<any>, void, AuthState>;
52
52
  export declare function refreshTokenForSocialLogins(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<any>, void, AuthState>;
53
+ export declare function shouldShowPromptPasskeys(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<IWebAuthnDevices> | import("redux-saga/effects").PutEffect<{
54
+ payload: Partial<import("../..").PasskeysState>;
55
+ type: string;
56
+ }>, boolean, {
57
+ publicAuthStrategyPolicy: any;
58
+ } & IWebAuthnDevices>;
53
59
  export declare function loginSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
54
60
  export declare function loginSagasMock(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
@@ -18,8 +18,8 @@ const _excluded = ["callback"],
18
18
  _excluded16 = ["callback", "deviceId"],
19
19
  _excluded17 = ["callback", "deviceId"],
20
20
  _excluded18 = ["callback", "deviceId"];
21
- import { all, call, delay, put, select, takeLeading } from 'redux-saga/effects';
22
- import { api, AuthStrategyEnum, ContextHolder, fetch, MFAStrategyEnum } from '@frontegg/rest-api';
21
+ import { all, call, put, select, takeLeading } from 'redux-saga/effects';
22
+ import { api, AuthStrategyEnum, ContextHolder, fetch, MFAStrategyEnum, WebAuthnDeviceType } from '@frontegg/rest-api';
23
23
  import { actions } from '../reducer';
24
24
  import { FRONTEGG_AFTER_AUTH_REDIRECT_URL, HOSTED_LOGIN_VERIFIER_KEY } from '../../constants';
25
25
  import { UserVeirifedOriginTypes } from '../interfaces';
@@ -29,10 +29,11 @@ import { MFAStep } from '../MfaState/interfaces';
29
29
  import { dummyIps, userDemo } from '../dummy';
30
30
  import { SamlVendors } from '../SSOState/interfaces';
31
31
  import { loadVendorPublicInfo } from '../../vendor/saga';
32
- import { createRandomString, generateCodeChallenge } from '../../helpers';
32
+ import { createRandomString, generateCodeChallenge, useFeatureFlags } from '../../helpers';
33
33
  import { ResetPhoneNumberStep } from '../ResetPhoneNumberState/interfaces';
34
- import { base64urlDecode, publicKeyCredentialToJSON } from '../utils';
34
+ import { base64urlDecode, delay, publicKeyCredentialToJSON } from '../utils';
35
35
  import { loadPublicAuthStrategiesPolicy } from '../SecurityPolicyState/saga';
36
+ import { useIsPasskeysEnabled } from '../PasskeysState/helpers';
36
37
  const authStrategyLoginStepMap = {
37
38
  [AuthStrategyEnum.Code]: LoginStep.loginWithOtc,
38
39
  [AuthStrategyEnum.EmailAndPassword]: LoginStep.loginWithPassword,
@@ -361,25 +362,43 @@ function* refreshTokenEmbeddedSocialLogins() {
361
362
  preserveQueryParams: true
362
363
  });
363
364
  } else {
364
- var _ref3;
365
- if (user.id) {
366
- localStorage.setItem('userId', user.id);
365
+ const shouldShowPrompt = yield call(shouldShowPromptPasskeys);
366
+ if (shouldShowPrompt) {
367
+ yield put(actions.setLoginState({
368
+ step: LoginStep.promptPasskeys,
369
+ loading: false
370
+ }));
371
+ yield put(actions.setTenantsState({
372
+ tenants,
373
+ loading: false
374
+ }));
375
+ yield put(actions.setState({
376
+ user
377
+ }));
378
+ onRedirectTo(routes.loginUrl, {
379
+ preserveQueryParams: true
380
+ });
381
+ } else {
382
+ var _ref3;
383
+ if (user.id) {
384
+ localStorage.setItem('userId', user.id);
385
+ }
386
+ const quickLoginToRegister = (_ref3 = localStorage.getItem('register-quick-login')) != null ? _ref3 : loginState.quickLoginToRegister;
387
+ const shouldNavigateToRegisterQuickLogin = yield shouldNevigateToRegisterQuickLogin(user);
388
+ yield put(actions.setTenantsState({
389
+ tenants,
390
+ loading: false
391
+ }));
392
+ yield put(actions.setState({
393
+ user,
394
+ isAuthenticated: true,
395
+ loginState: _extends({}, loginState, {
396
+ quickLoginToRegister,
397
+ flow: shouldNavigateToRegisterQuickLogin ? LoginFlow.RegisterQuickLogin : LoginFlow.Login
398
+ })
399
+ }));
400
+ yield handleRedirectRefreshToken(shouldNavigateToRegisterQuickLogin);
367
401
  }
368
- const quickLoginToRegister = (_ref3 = localStorage.getItem('register-quick-login')) != null ? _ref3 : loginState.quickLoginToRegister;
369
- const shouldNavigateToRegisterQuickLogin = yield shouldNevigateToRegisterQuickLogin(user);
370
- yield put(actions.setTenantsState({
371
- tenants,
372
- loading: false
373
- }));
374
- yield put(actions.setState({
375
- user,
376
- isAuthenticated: true,
377
- loginState: _extends({}, loginState, {
378
- quickLoginToRegister,
379
- flow: shouldNavigateToRegisterQuickLogin ? LoginFlow.RegisterQuickLogin : LoginFlow.Login
380
- })
381
- }));
382
- yield handleRedirectRefreshToken(shouldNavigateToRegisterQuickLogin);
383
402
  }
384
403
  } catch (e) {
385
404
  ContextHolder.setAccessToken(null);
@@ -574,6 +593,13 @@ function* requestHostedLoginAuthorize(additionalParams) {
574
593
  code_challenge_method: 'S256',
575
594
  nonce
576
595
  }, additionalParams);
596
+ if (context.tenantResolver) {
597
+ var _context$tenantResolv;
598
+ const resolvedTenantResult = yield (_context$tenantResolv = context.tenantResolver) == null ? void 0 : _context$tenantResolv.call(context);
599
+ if (resolvedTenantResult != null && resolvedTenantResult.tenant) {
600
+ params['organization'] = resolvedTenantResult.tenant;
601
+ }
602
+ }
577
603
  const searchParams = new URLSearchParams(params);
578
604
  const url = `${oauthUrl}?${searchParams.toString()}`;
579
605
  onRedirectTo(url, {
@@ -748,6 +774,30 @@ function* passwordlessPreLogin(_ref7) {
748
774
  callback == null ? void 0 : callback();
749
775
  }
750
776
  }
777
+ export function* shouldShowPromptPasskeys() {
778
+ const {
779
+ publicAuthStrategyPolicy
780
+ } = yield select(state => state.auth.securityPolicyState);
781
+ const {
782
+ policy
783
+ } = publicAuthStrategyPolicy;
784
+ const isPasskeysEnabledByVendor = useIsPasskeysEnabled(policy);
785
+ const isLoggedInWithPasskeys = localStorage.getItem('preferred-login-method') === 'Passkeys';
786
+ const isMarkedDontShowAgainPrompt = localStorage.getItem('dont-show-again-prompt-passkeys') === 'true';
787
+ const [showPasskeys] = useFeatureFlags(['show-passkeys']);
788
+ if (!showPasskeys || !isPasskeysEnabledByVendor || isLoggedInWithPasskeys || isMarkedDontShowAgainPrompt) {
789
+ return false;
790
+ } else {
791
+ const {
792
+ devices
793
+ } = yield call(api.auth.getWebAuthnDevices);
794
+ yield put(actions.setPasskeysState({
795
+ devices: devices != null ? devices : []
796
+ }));
797
+ const numOfDevices = !(devices != null && devices.length) ? 0 : devices.length;
798
+ return numOfDevices === 0;
799
+ }
800
+ }
751
801
  function* passwordlessPostLogin(_ref8) {
752
802
  let {
753
803
  payload: {
@@ -791,15 +841,31 @@ function* passwordlessPostLogin(_ref8) {
791
841
  localStorage.setItem('userId', user.id);
792
842
  }
793
843
  yield put(actions.setState({
794
- user,
795
- isAuthenticated: true
844
+ user
796
845
  }));
797
846
  yield put(actions.setLoginState({
798
847
  error: undefined
799
848
  }));
800
849
  yield put(actions.loadTenants());
850
+ yield put(actions.setState({
851
+ isLoading: false
852
+ }));
801
853
  if (loginState.flow === LoginFlow.Login) {
802
- yield afterAuthNavigation();
854
+ const shouldShowPrompt = yield call(shouldShowPromptPasskeys);
855
+ if (shouldShowPrompt) {
856
+ yield put(actions.setLoginState({
857
+ step: LoginStep.promptPasskeys,
858
+ loading: false
859
+ }));
860
+ onRedirectTo(routes.loginUrl, {
861
+ preserveQueryParams: true
862
+ });
863
+ } else {
864
+ yield put(actions.setState({
865
+ isAuthenticated: true
866
+ }));
867
+ yield afterAuthNavigation();
868
+ }
803
869
  } else {
804
870
  onRedirectTo(routes.loginUrl, {
805
871
  preserveQueryParams: true
@@ -989,9 +1055,11 @@ function* webAuthnVerifyNewDeviceSession(_ref10) {
989
1055
  loading: true
990
1056
  }));
991
1057
  const publicKey = publicKeyCredentialToJSON(body.publicKey);
1058
+ const deviceType = (publicKey == null ? void 0 : publicKey.authenticatorAttachment) === 'platform' ? WebAuthnDeviceType.Platform : WebAuthnDeviceType.CrossPlatform;
992
1059
  yield call(api.auth.verifyNewDeviceSession, {
993
1060
  id: publicKey.id,
994
- response: publicKey.response
1061
+ response: publicKey.response,
1062
+ deviceType: deviceType
995
1063
  });
996
1064
  callback == null ? void 0 : callback(true);
997
1065
  } catch (e) {
@@ -1191,7 +1259,18 @@ function* login({
1191
1259
  }));
1192
1260
  yield put(actions.loadTenants());
1193
1261
  if (isAuthenticated && loginState.flow === LoginFlow.Login) {
1194
- yield afterAuthNavigation();
1262
+ const shouldShowPrompt = yield call(shouldShowPromptPasskeys);
1263
+ if (shouldShowPrompt) {
1264
+ yield put(actions.setLoginState({
1265
+ step: LoginStep.promptPasskeys,
1266
+ loading: false
1267
+ }));
1268
+ onRedirectTo(routes.loginUrl, {
1269
+ preserveQueryParams: true
1270
+ });
1271
+ } else {
1272
+ yield afterAuthNavigation();
1273
+ }
1195
1274
  }
1196
1275
  }
1197
1276
 
@@ -1251,7 +1330,15 @@ function* loginWithMfa({
1251
1330
  loading: false
1252
1331
  }));
1253
1332
  if (loginState.flow === LoginFlow.Login) {
1254
- yield afterAuthNavigation();
1333
+ const shouldShowPrompt = yield call(shouldShowPromptPasskeys);
1334
+ if (shouldShowPrompt) {
1335
+ yield put(actions.setLoginState({
1336
+ step: LoginStep.promptPasskeys,
1337
+ loading: false
1338
+ }));
1339
+ } else {
1340
+ yield afterAuthNavigation();
1341
+ }
1255
1342
  }
1256
1343
  callback == null ? void 0 : callback(true);
1257
1344
  } catch (e) {
@@ -1357,7 +1444,15 @@ function* handleVerifyMFAResponse({
1357
1444
  localStorage.setItem('userId', user.id);
1358
1445
  }
1359
1446
  if (loginState.flow === LoginFlow.Login) {
1360
- yield afterAuthNavigation();
1447
+ const shouldShowPrompt = yield call(shouldShowPromptPasskeys);
1448
+ if (shouldShowPrompt) {
1449
+ yield put(actions.setLoginState({
1450
+ step: LoginStep.promptPasskeys,
1451
+ loading: false
1452
+ }));
1453
+ } else {
1454
+ yield afterAuthNavigation();
1455
+ }
1361
1456
  }
1362
1457
  yield put(actions.setState({
1363
1458
  isAuthenticated: true
@@ -47,6 +47,7 @@ declare const reducers: {
47
47
  disableSilentRefresh?: boolean | undefined;
48
48
  sessionsPolicyState: import("..").SessionsPolicyState;
49
49
  impersonateState?: import("..").ImpersonateState | undefined;
50
+ passkeysState?: import("..").PasskeysState | undefined;
50
51
  routes: import("..").AuthPageRoutes;
51
52
  header?: any;
52
53
  loaderComponent?: any;
@@ -88,6 +89,7 @@ declare const reducers: {
88
89
  disableSilentRefresh?: boolean | undefined;
89
90
  sessionsPolicyState: import("..").SessionsPolicyState;
90
91
  impersonateState?: import("..").ImpersonateState | undefined;
92
+ passkeysState?: import("..").PasskeysState | undefined;
91
93
  routes: import("..").AuthPageRoutes;
92
94
  header?: any;
93
95
  loaderComponent?: any;
@@ -0,0 +1,2 @@
1
+ import { IAuthStrategiesConfig } from '@frontegg/rest-api';
2
+ export declare const useIsPasskeysEnabled: (policy: IAuthStrategiesConfig) => boolean;
@@ -0,0 +1,7 @@
1
+ import { SecondaryAuthStrategy } from '@frontegg/rest-api';
2
+ export const useIsPasskeysEnabled = policy => {
3
+ return !!(policy != null && policy.secondaryAuthStrategies.some(({
4
+ isActive,
5
+ strategy
6
+ }) => isActive && strategy === SecondaryAuthStrategy.Passkeys));
7
+ };