@frontegg/redux-store 5.20.1 → 5.23.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.
- package/auth/AcceptInvitationState/index.d.ts +2 -0
- package/auth/AccountSettingsState/index.d.ts +10 -0
- package/auth/ActivateState/index.d.ts +3 -0
- package/auth/ApiTokensState/index.d.ts +2 -0
- package/auth/ForgotPasswordState/index.d.ts +2 -0
- package/auth/LoginState/index.d.ts +2 -0
- package/auth/LoginState/interfaces.d.ts +2 -0
- package/auth/LoginState/saga.d.ts +2 -0
- package/auth/MfaState/index.d.ts +6 -6
- package/auth/ProfileState/index.d.ts +2 -0
- package/auth/ResetPhoneNumberState/index.d.ts +96 -0
- package/auth/ResetPhoneNumberState/interfaces.d.ts +18 -0
- package/auth/ResetPhoneNumberState/saga.d.ts +17 -0
- package/auth/RolesState/index.d.ts +2 -0
- package/auth/SSOState/index.d.ts +2 -0
- package/auth/SecurityPolicyState/index.d.ts +9 -0
- package/auth/SignUp/index.d.ts +2 -0
- package/auth/SocialLogins/index.d.ts +2 -8
- package/auth/TeamState/index.d.ts +2 -0
- package/auth/TenantsState/index.d.ts +2 -8
- package/auth/index.d.ts +13 -0
- package/auth/index.js +105 -15
- package/auth/interfaces.d.ts +15 -1
- package/auth/reducer.d.ts +13 -1
- package/auth/utils.d.ts +4 -0
- package/index.js +2 -2
- package/node/auth/index.js +115 -22
- package/node/index.js +15 -0
- package/node/subscriptions/index.js +182 -138
- package/package.json +2 -2
- package/subscriptions/ManagedSubscriptions/index.d.ts +10 -0
- package/subscriptions/ManagedSubscriptions/interfaces.d.ts +28 -0
- package/subscriptions/ManagedSubscriptions/saga.d.ts +1 -0
- package/subscriptions/index.d.ts +7 -0
- package/subscriptions/index.js +183 -139
- package/subscriptions/interfaces.d.ts +4 -0
- package/subscriptions/reducer.d.ts +7 -0
- package/toolkit/index.d.ts +1 -1
package/auth/index.js
CHANGED
|
@@ -43,6 +43,7 @@ var LoginStep;
|
|
|
43
43
|
(function (LoginStep) {
|
|
44
44
|
LoginStep["preLogin"] = "preLogin";
|
|
45
45
|
LoginStep["magicLinkPreLoginSuccess"] = "magicLinkPreLoginSuccess";
|
|
46
|
+
LoginStep["loginWithSmsOtc"] = "loginWithSmsOtc";
|
|
46
47
|
LoginStep["loginWithOtc"] = "loginWithOtc";
|
|
47
48
|
LoginStep["loginWithPassword"] = "loginWithPassword";
|
|
48
49
|
LoginStep["loginWithTwoFactor"] = "loginWithTwoFactor";
|
|
@@ -59,11 +60,11 @@ const loginState = {
|
|
|
59
60
|
email: '',
|
|
60
61
|
tenants: [],
|
|
61
62
|
};
|
|
62
|
-
const reducers$
|
|
63
|
+
const reducers$f = {
|
|
63
64
|
setLoginState: typeReducerForKey('loginState'),
|
|
64
65
|
resetLoginState: resetStateByKey('loginState', { loginState }),
|
|
65
66
|
};
|
|
66
|
-
const actions$
|
|
67
|
+
const actions$g = {
|
|
67
68
|
requestAuthorize: createAction(`${authStoreName}/requestAuthorize`, (payload = false) => ({ payload })),
|
|
68
69
|
requestHostedLoginAuthorize: createAction(`${authStoreName}/requestHostedLoginAuthorize`),
|
|
69
70
|
handleHostedLoginCallback: createAction(`${authStoreName}/handleHostedLoginCallback`, (payload) => ({ payload })),
|
|
@@ -97,12 +98,12 @@ const activateState = {
|
|
|
97
98
|
loading: false,
|
|
98
99
|
},
|
|
99
100
|
};
|
|
100
|
-
const reducers$
|
|
101
|
+
const reducers$e = {
|
|
101
102
|
setActivateState: typeReducerForKey('activateState'),
|
|
102
103
|
resetActivateState: resetStateByKey('activateState', { activateState }),
|
|
103
104
|
setActivateStrategyState: typeReducerNestedKey('activateState', 'activationStrategy'),
|
|
104
105
|
};
|
|
105
|
-
const actions$
|
|
106
|
+
const actions$f = {
|
|
106
107
|
activateAccount: createAction(`${authStoreName}/activateAccount`, (payload) => ({ payload })),
|
|
107
108
|
preActivateAccount: createAction(`${authStoreName}/preActivateAccount`, (payload) => ({ payload })),
|
|
108
109
|
getActivateAccountStrategy: createAction(`${authStoreName}/getActivateAccountStrategy`, (payload) => ({ payload })),
|
|
@@ -123,13 +124,13 @@ var AcceptInvitationStep;
|
|
|
123
124
|
const acceptInvitationState = {
|
|
124
125
|
step: AcceptInvitationStep.validate,
|
|
125
126
|
};
|
|
126
|
-
const reducers$
|
|
127
|
+
const reducers$d = {
|
|
127
128
|
setAcceptInvitationState: typeReducerForKey('acceptInvitationState'),
|
|
128
129
|
resetAcceptInvitationState: resetStateByKey('acceptInvitationState', {
|
|
129
130
|
acceptInvitationState,
|
|
130
131
|
}),
|
|
131
132
|
};
|
|
132
|
-
const actions$
|
|
133
|
+
const actions$e = {
|
|
133
134
|
acceptInvitation: createAction(`${authStoreName}/acceptInvitation`, (payload) => ({ payload })),
|
|
134
135
|
};
|
|
135
136
|
|
|
@@ -145,11 +146,11 @@ const forgotPasswordState = {
|
|
|
145
146
|
email: '',
|
|
146
147
|
passwordConfig: null,
|
|
147
148
|
};
|
|
148
|
-
const reducers$
|
|
149
|
+
const reducers$c = {
|
|
149
150
|
setForgotPasswordState: typeReducerForKey('forgotPasswordState'),
|
|
150
151
|
resetForgotPasswordState: resetStateByKey('forgotPasswordState', { forgotPasswordState }),
|
|
151
152
|
};
|
|
152
|
-
const actions$
|
|
153
|
+
const actions$d = {
|
|
153
154
|
forgotPassword: createAction(`${authStoreName}/forgotPassword`, (payload) => ({ payload })),
|
|
154
155
|
resetPassword: createAction(`${authStoreName}/resetPassword`, (payload) => ({ payload })),
|
|
155
156
|
loadPasswordConfig: createAction(`${authStoreName}/loadPasswordConfig`, (payload) => ({
|
|
@@ -157,6 +158,27 @@ const actions$c = {
|
|
|
157
158
|
})),
|
|
158
159
|
};
|
|
159
160
|
|
|
161
|
+
var ResetPhoneNumberStep;
|
|
162
|
+
(function (ResetPhoneNumberStep) {
|
|
163
|
+
ResetPhoneNumberStep["ResetPhoneNumber"] = "ResetPhoneNumber";
|
|
164
|
+
ResetPhoneNumberStep["VerifyResetPhoneNumber"] = "VerifyResetPhoneNumber";
|
|
165
|
+
ResetPhoneNumberStep["ChangePhoneNumber"] = "ChangePhoneNumber";
|
|
166
|
+
})(ResetPhoneNumberStep || (ResetPhoneNumberStep = {}));
|
|
167
|
+
|
|
168
|
+
const resetPhoneNumberState = {
|
|
169
|
+
step: ResetPhoneNumberStep.ResetPhoneNumber,
|
|
170
|
+
loading: false,
|
|
171
|
+
};
|
|
172
|
+
const reducers$b = {
|
|
173
|
+
setResetPhoneNumberState: typeReducerForKey('resetPhoneNumberState'),
|
|
174
|
+
resetResetPhoneNumberState: resetStateByKey('resetPhoneNumberState', { resetPhoneNumberState }),
|
|
175
|
+
};
|
|
176
|
+
const actions$c = {
|
|
177
|
+
resetPhoneNumber: createAction(`${authStoreName}/resetPhoneNumber`, (payload) => ({ payload })),
|
|
178
|
+
verifyResetPhoneNumber: createAction(`${authStoreName}/verifyResetPhoneNumber`, (payload) => ({ payload })),
|
|
179
|
+
changePhoneNumber: createAction(`${authStoreName}/changePhoneNumber`, (payload) => ({ payload })),
|
|
180
|
+
};
|
|
181
|
+
|
|
160
182
|
const ssoState = {
|
|
161
183
|
firstLoad: true,
|
|
162
184
|
loading: true,
|
|
@@ -488,6 +510,7 @@ const reinitializeState = {
|
|
|
488
510
|
accountSettingsState,
|
|
489
511
|
tenantsState,
|
|
490
512
|
rolesState,
|
|
513
|
+
resetPhoneNumberState
|
|
491
514
|
};
|
|
492
515
|
const initialState = Object.assign({ routes: {
|
|
493
516
|
authenticatedUrl: '/',
|
|
@@ -496,6 +519,7 @@ const initialState = Object.assign({ routes: {
|
|
|
496
519
|
activateUrl: '/account/activate',
|
|
497
520
|
acceptInvitationUrl: '/account/invitation/accept',
|
|
498
521
|
forgetPasswordUrl: '/account/forget-password',
|
|
522
|
+
resetPhoneNumberUrl: '/account/reset-phone-number',
|
|
499
523
|
resetPasswordUrl: '/account/reset-password',
|
|
500
524
|
socialLoginCallbackUrl: '/account/social/success',
|
|
501
525
|
signUpUrl: '/account/sign-up',
|
|
@@ -508,9 +532,9 @@ const initialState = Object.assign({ routes: {
|
|
|
508
532
|
const { reducer, actions: sliceActions } = createSlice({
|
|
509
533
|
name: authStoreName,
|
|
510
534
|
initialState,
|
|
511
|
-
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({ resetState: (state) => (Object.assign(Object.assign({}, state), reinitializeState)), setState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)), setUser: typeReducer('user') }, reducers$
|
|
535
|
+
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),
|
|
512
536
|
});
|
|
513
|
-
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({}, sliceActions), actions$
|
|
537
|
+
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);
|
|
514
538
|
|
|
515
539
|
var SSOStateKeys;
|
|
516
540
|
(function (SSOStateKeys) {
|
|
@@ -830,6 +854,12 @@ function* signUpSaga() {
|
|
|
830
854
|
yield takeLeading(actions.resetSignUpStateSoft, resetSignUpStateSoft);
|
|
831
855
|
}
|
|
832
856
|
|
|
857
|
+
const authStrategyLoginStepMap = {
|
|
858
|
+
[AuthStrategyEnum.Code]: LoginStep.loginWithOtc,
|
|
859
|
+
[AuthStrategyEnum.EmailAndPassword]: LoginStep.loginWithPassword,
|
|
860
|
+
[AuthStrategyEnum.MagicLink]: LoginStep.magicLinkPreLoginSuccess,
|
|
861
|
+
[AuthStrategyEnum.SmsCode]: LoginStep.loginWithSmsOtc,
|
|
862
|
+
};
|
|
833
863
|
function* afterAuthNavigation() {
|
|
834
864
|
var _a;
|
|
835
865
|
const onRedirectTo = ContextHolder.onRedirectTo;
|
|
@@ -993,10 +1023,16 @@ function* handleHostedLoginCallback({ payload }) {
|
|
|
993
1023
|
function* passwordlessPreLogin(_a) {
|
|
994
1024
|
var _b = _a.payload, { callback } = _b, payload = __rest(_b, ["callback"]);
|
|
995
1025
|
try {
|
|
1026
|
+
const { onRedirectTo, routes } = yield select(({ auth: { onRedirectTo, routes } }) => ({ onRedirectTo, routes }));
|
|
996
1027
|
yield put(actions.setLoginState({ loading: true }));
|
|
997
|
-
yield call(api.auth.passwordlessPreLogin, payload);
|
|
998
|
-
const step = payload.type
|
|
999
|
-
|
|
1028
|
+
const preloginRes = yield call(api.auth.passwordlessPreLogin, payload);
|
|
1029
|
+
const step = authStrategyLoginStepMap[payload.type];
|
|
1030
|
+
if (step === LoginStep.loginWithSmsOtc && preloginRes.resetPhoneNumberToken) {
|
|
1031
|
+
yield put(actions.setResetPhoneNumberState({ resetPhoneNumberToken: preloginRes.resetPhoneNumberToken, step: ResetPhoneNumberStep.VerifyResetPhoneNumber }));
|
|
1032
|
+
onRedirectTo(routes.resetPhoneNumberUrl);
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
yield put(actions.setLoginState({ step, loading: false, email: payload.email, phoneNumber: preloginRes === null || preloginRes === void 0 ? void 0 : preloginRes.phoneNumber }));
|
|
1000
1036
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
1001
1037
|
}
|
|
1002
1038
|
catch (e) {
|
|
@@ -1082,7 +1118,7 @@ function* ssoPreloginFailed(_a) {
|
|
|
1082
1118
|
yield put(actions.setLoginState({ step: LoginStep.loginWithPassword, loading: false }));
|
|
1083
1119
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
1084
1120
|
}
|
|
1085
|
-
else if ([AuthStrategyEnum.MagicLink, AuthStrategyEnum.Code].includes(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
|
|
1121
|
+
else if ([AuthStrategyEnum.MagicLink, AuthStrategyEnum.Code, AuthStrategyEnum.SmsCode].includes(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
|
|
1086
1122
|
yield put(actions.passwordlessPreLogin(Object.assign(Object.assign({}, body), { type: publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy, callback })));
|
|
1087
1123
|
}
|
|
1088
1124
|
else {
|
|
@@ -3293,12 +3329,66 @@ function* rolesSagas() {
|
|
|
3293
3329
|
yield takeEvery(actions.attachPermissionToRoles, attachPermissionToRoles);
|
|
3294
3330
|
}
|
|
3295
3331
|
|
|
3332
|
+
function* resetPhoneNumber(_a) {
|
|
3333
|
+
var _b = _a.payload, { callback } = _b, body = __rest(_b, ["callback"]);
|
|
3334
|
+
yield put(actions.setResetPhoneNumberState({ loading: true }));
|
|
3335
|
+
try {
|
|
3336
|
+
const res = yield call(api.auth.resetPhoneNumber, body);
|
|
3337
|
+
yield put(actions.setResetPhoneNumberState({ loading: false, error: undefined, resetPhoneNumberToken: res.resetPhoneNumberToken, step: ResetPhoneNumberStep.VerifyResetPhoneNumber }));
|
|
3338
|
+
yield put(actions.setLoginState({ email: body.email }));
|
|
3339
|
+
}
|
|
3340
|
+
catch (e) {
|
|
3341
|
+
yield put(actions.setResetPhoneNumberState({ loading: false, error: e.message }));
|
|
3342
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
function* verifyResetPhoneNumber(_a) {
|
|
3346
|
+
var _b = _a.payload, { callback } = _b, body = __rest(_b, ["callback"]);
|
|
3347
|
+
yield put(actions.setResetPhoneNumberState({ loading: true }));
|
|
3348
|
+
try {
|
|
3349
|
+
const res = yield call(api.auth.verifyResetPhoneNumber, body);
|
|
3350
|
+
yield put(actions.setResetPhoneNumberState({ loading: false, error: undefined, changePhoneNumberToken: res.changePhoneNumberToken, step: ResetPhoneNumberStep.ChangePhoneNumber }));
|
|
3351
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
3352
|
+
}
|
|
3353
|
+
catch (e) {
|
|
3354
|
+
yield put(actions.setResetPhoneNumberState({ loading: false, error: e.message }));
|
|
3355
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
function* changePhoneNumber(_a) {
|
|
3359
|
+
var _b = _a.payload, { callback } = _b, body = __rest(_b, ["callback"]);
|
|
3360
|
+
yield put(actions.setResetPhoneNumberState({ loading: true }));
|
|
3361
|
+
try {
|
|
3362
|
+
const { onRedirectTo, routes } = yield select(({ auth: { onRedirectTo, routes } }) => ({ onRedirectTo, routes }));
|
|
3363
|
+
yield call(api.auth.changePhoneNumber, { phoneNumber: body.phoneNumber, changePhoneNumberToken: body.changePhoneNumberToken });
|
|
3364
|
+
yield put(actions.setLoginState({ step: LoginStep.loginWithSmsOtc }));
|
|
3365
|
+
yield put(actions.passwordlessPreLogin({
|
|
3366
|
+
type: AuthStrategyEnum.SmsCode,
|
|
3367
|
+
email: body.email,
|
|
3368
|
+
recaptchaToken: body.recaptchaToken,
|
|
3369
|
+
}));
|
|
3370
|
+
onRedirectTo(routes.loginUrl);
|
|
3371
|
+
yield put(actions.setResetPhoneNumberState({ loading: false }));
|
|
3372
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
3373
|
+
}
|
|
3374
|
+
catch (e) {
|
|
3375
|
+
yield put(actions.setResetPhoneNumberState({ loading: false, error: e.message }));
|
|
3376
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
function* resetPhoneNumberSagas() {
|
|
3380
|
+
yield takeLeading(actions.resetPhoneNumber, resetPhoneNumber);
|
|
3381
|
+
yield takeLeading(actions.verifyResetPhoneNumber, verifyResetPhoneNumber);
|
|
3382
|
+
yield takeLeading(actions.changePhoneNumber, changePhoneNumber);
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3296
3385
|
function* sagas() {
|
|
3297
3386
|
yield all([
|
|
3298
3387
|
call(loginSagas),
|
|
3299
3388
|
call(activateSagas),
|
|
3300
3389
|
call(acceptInvitationSagas),
|
|
3301
3390
|
call(forgotPasswordSagas),
|
|
3391
|
+
call(resetPhoneNumberSagas),
|
|
3302
3392
|
call(ssoSagas$1),
|
|
3303
3393
|
call(ssoSagas),
|
|
3304
3394
|
call(profileSagas),
|
|
@@ -3342,4 +3432,4 @@ var authStore = {
|
|
|
3342
3432
|
actions,
|
|
3343
3433
|
};
|
|
3344
3434
|
|
|
3345
|
-
export { AcceptInvitationStep, ActivateAccountStep, ApiStateKeys, ForgotPasswordStep, LoginStep, MFAStep, SSOStateKeys, SamlVendors, SignUpStage, TeamStateKeys, actions$
|
|
3435
|
+
export { AcceptInvitationStep, ActivateAccountStep, ApiStateKeys, ForgotPasswordStep, LoginStep, MFAStep, ResetPhoneNumberStep, SSOStateKeys, SamlVendors, SignUpStage, TeamStateKeys, actions$e as acceptInvitationActions, reducers$d as acceptInvitationReducers, acceptInvitationState, actions$3 as accountSettingsActions, reducers$2 as accountSettingsReducers, accountSettingsState, actions$f as activateAccountActions, reducers$e as activateAccountReducers, activateState, actions$5 as apiTokensActions, reducers$4 as apiTokensReducers, apiTokensState, actions as authActions, initialState as authInitialState, mockSagas as authMockSagas, reducer as authReducers, sagas as authSagas, authStore as default, actions$d as forgotPasswordActions, reducers$c as forgotPasswordReducers, forgotPasswordState, actions$g as loginActions, reducers$f as loginReducers, loginState, actions$9 as mfaActions, reducers$8 as mfaReducers, mfaState, actions$a as profileActions, reducers$9 as profileReducers, profileState, actions$c as resetPhoneNumberActions, reducers$b as resetPhoneNumberReducers, resetPhoneNumberState, actions$1 as rolesActions, reducers as rolesReducers, rolesState, actions$4 as securityPolicyActions, reducers$3 as securityPolicyReducers, securityPolicyState, actions$6 as signUpActions, reducers$5 as signUpReducers, signUpState, socialLoginState, actions$7 as socialLoginsActions, reducers$6 as socialLoginsReducer, actions$b as ssoActions, reducers$a as ssoReducers, ssoState, actions$8 as teamActions, reducers$7 as teamReducers, teamState, actions$2 as tenantsActions, reducers$1 as tenantsReducers, tenantsState };
|
package/auth/interfaces.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { SecurityPolicyState } from './SecurityPolicyState/interfaces';
|
|
|
14
14
|
import { AccountSettingsState } from './AccountSettingsState/interfaces';
|
|
15
15
|
import { TenantsState } from './TenantsState/interfaces';
|
|
16
16
|
import { RolesState } from './RolesState/interfaces';
|
|
17
|
+
import { ResetPhoneNumberState } from './ResetPhoneNumberState/interfaces';
|
|
17
18
|
export interface User extends IUserProfile {
|
|
18
19
|
accessToken: string;
|
|
19
20
|
refreshToken: string;
|
|
@@ -40,6 +41,7 @@ export interface AuthState extends Routes, PluginOptions {
|
|
|
40
41
|
activateState: ActivateAccountState;
|
|
41
42
|
acceptInvitationState: AcceptInvitationState;
|
|
42
43
|
forgotPasswordState: ForgotPasswordState;
|
|
44
|
+
resetPhoneNumberState: ResetPhoneNumberState;
|
|
43
45
|
ssoState: SSOState;
|
|
44
46
|
profileState: ProfileState;
|
|
45
47
|
mfaState: MFAState;
|
|
@@ -78,6 +80,10 @@ export declare type AuthPageRoutes = {
|
|
|
78
80
|
* the page in the case a user forgot his account password
|
|
79
81
|
*/
|
|
80
82
|
forgetPasswordUrl: string;
|
|
83
|
+
/**
|
|
84
|
+
* the page in the case a user wants to reset his account phone number
|
|
85
|
+
*/
|
|
86
|
+
resetPhoneNumberUrl: string;
|
|
81
87
|
/**
|
|
82
88
|
* the page whither need to redirect in the case when a user redirected from reset password url
|
|
83
89
|
*/
|
|
@@ -103,9 +109,17 @@ export declare type AuthPageRoutes = {
|
|
|
103
109
|
*/
|
|
104
110
|
magicLinkCallbackUrl?: string;
|
|
105
111
|
/**
|
|
106
|
-
* after sign up success url
|
|
112
|
+
* after sign up success url, the order of urls read: (accountSignUpSuccessUrl or userSignUpSuccessUrl) / signupSuccessUrl / authenticationUrl
|
|
107
113
|
*/
|
|
108
114
|
signUpSuccessUrl?: string;
|
|
115
|
+
/**
|
|
116
|
+
* after account sign up success url, the order of urls read: accountSignUpSuccessUrl / signupSuccessUrl / authenticationUrl
|
|
117
|
+
*/
|
|
118
|
+
accountSignUpSuccessUrl?: string;
|
|
119
|
+
/**
|
|
120
|
+
* after user (tenant) sign up success url, the order of urls read: userSignUpSuccessUrl / signupSuccessUrl / authenticationUrl
|
|
121
|
+
*/
|
|
122
|
+
userSignUpSuccessUrl?: string;
|
|
109
123
|
/**
|
|
110
124
|
* hosted login callback redirect url
|
|
111
125
|
*/
|
package/auth/reducer.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { SecurityPolicyActions } from './SecurityPolicyState';
|
|
|
14
14
|
import { AccountSettingsActions } from './AccountSettingsState';
|
|
15
15
|
import { TenantsActions } from './TenantsState';
|
|
16
16
|
import { RolesActions } from './RolesState';
|
|
17
|
+
import { ResetPhoneNumberActions } from './ResetPhoneNumberState';
|
|
17
18
|
declare const reducer: import("redux").Reducer<AuthState, import("redux").AnyAction>;
|
|
18
19
|
declare const actions: {
|
|
19
20
|
loadRolesAndPermissions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
@@ -192,6 +193,15 @@ declare const actions: {
|
|
|
192
193
|
changePassword: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IChangePassword, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IChangePassword, boolean>, string, never, never>;
|
|
193
194
|
signUpUser: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISignUpUser], import("@frontegg/rest-api").ISignUpUser, string, never, never>;
|
|
194
195
|
resetSignUpStateSoft: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
196
|
+
resetPhoneNumber: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IResetPhoneNumber, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IResetPhoneNumber, boolean>, string, never, never>;
|
|
197
|
+
verifyResetPhoneNumber: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IVerifyResetPhoneNumber, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IVerifyResetPhoneNumber, boolean>, string, never, never>;
|
|
198
|
+
changePhoneNumber: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IChangePhoneNumber & {
|
|
199
|
+
recaptchaToken: string;
|
|
200
|
+
email: string;
|
|
201
|
+
}, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IChangePhoneNumber & {
|
|
202
|
+
recaptchaToken: string;
|
|
203
|
+
email: string;
|
|
204
|
+
}, boolean>, string, never, never>;
|
|
195
205
|
forgotPassword: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").IForgotPassword], import("@frontegg/rest-api").IForgotPassword, string, never, never>;
|
|
196
206
|
resetPassword: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IResetPassword, boolean>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IResetPassword, boolean>, string, never, never>;
|
|
197
207
|
loadPasswordConfig: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(import("@frontegg/rest-api").IGetUserPasswordConfig | undefined)?], import("@frontegg/rest-api").IGetUserPasswordConfig | undefined, string, never, never>;
|
|
@@ -290,6 +300,8 @@ declare const actions: {
|
|
|
290
300
|
resetProfileState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
291
301
|
setSignUpState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import(".").SignUpState>], Partial<import(".").SignUpState>, string, never, never>;
|
|
292
302
|
resetSignUpState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
303
|
+
setResetPhoneNumberState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import(".").ResetPhoneNumberState>], Partial<import(".").ResetPhoneNumberState>, string, never, never>;
|
|
304
|
+
resetResetPhoneNumberState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
293
305
|
setForgotPasswordState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import(".").ForgotPasswordState>], Partial<import(".").ForgotPasswordState>, string, never, never>;
|
|
294
306
|
resetForgotPasswordState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
295
307
|
setAcceptInvitationState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import(".").AcceptInvitationState>], Partial<import(".").AcceptInvitationState>, string, never, never>;
|
|
@@ -310,5 +322,5 @@ export declare type RootActions = {
|
|
|
310
322
|
resetState: () => void;
|
|
311
323
|
setUser: (user: User) => void;
|
|
312
324
|
};
|
|
313
|
-
export declare type AuthActions = RootActions & LoginActions & SocialLoginActions & ActivateAccountActions & AcceptInvitationActions & ForgotPasswordActions & SignUpActions & ProfileActions & SSOActions & MfaActions & TeamActions & ApiTokensActions & SecurityPolicyActions & AccountSettingsActions & TenantsActions & RolesActions;
|
|
325
|
+
export declare type AuthActions = RootActions & LoginActions & SocialLoginActions & ActivateAccountActions & AcceptInvitationActions & ForgotPasswordActions & ResetPhoneNumberActions & SignUpActions & ProfileActions & SSOActions & MfaActions & TeamActions & ApiTokensActions & SecurityPolicyActions & AccountSettingsActions & TenantsActions & RolesActions;
|
|
314
326
|
export { reducer, actions };
|
package/auth/utils.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const resetStateByKey: <T>(key: keyof AuthState, initialState: Pa
|
|
|
13
13
|
activateState: import(".").ActivateAccountState;
|
|
14
14
|
acceptInvitationState: import(".").AcceptInvitationState;
|
|
15
15
|
forgotPasswordState: import(".").ForgotPasswordState;
|
|
16
|
+
resetPhoneNumberState: import(".").ResetPhoneNumberState;
|
|
16
17
|
ssoState: import(".").SSOState;
|
|
17
18
|
profileState: import(".").ProfileState;
|
|
18
19
|
mfaState: import(".").MFAState;
|
|
@@ -44,6 +45,7 @@ export declare const typeReducer: <T>(key: keyof AuthState) => (state: AuthState
|
|
|
44
45
|
activateState: import(".").ActivateAccountState;
|
|
45
46
|
acceptInvitationState: import(".").AcceptInvitationState;
|
|
46
47
|
forgotPasswordState: import(".").ForgotPasswordState;
|
|
48
|
+
resetPhoneNumberState: import(".").ResetPhoneNumberState;
|
|
47
49
|
ssoState: import(".").SSOState;
|
|
48
50
|
profileState: import(".").ProfileState;
|
|
49
51
|
mfaState: import(".").MFAState;
|
|
@@ -79,6 +81,7 @@ export declare const typeReducerForKey: <T>(key: keyof AuthState) => {
|
|
|
79
81
|
activateState: import(".").ActivateAccountState;
|
|
80
82
|
acceptInvitationState: import(".").AcceptInvitationState;
|
|
81
83
|
forgotPasswordState: import(".").ForgotPasswordState;
|
|
84
|
+
resetPhoneNumberState: import(".").ResetPhoneNumberState;
|
|
82
85
|
ssoState: import(".").SSOState;
|
|
83
86
|
profileState: import(".").ProfileState;
|
|
84
87
|
mfaState: import(".").MFAState;
|
|
@@ -115,6 +118,7 @@ export declare const typeReducerNestedKey: <T, K>(key: keyof AuthState, nestedKe
|
|
|
115
118
|
activateState: import(".").ActivateAccountState;
|
|
116
119
|
acceptInvitationState: import(".").AcceptInvitationState;
|
|
117
120
|
forgotPasswordState: import(".").ForgotPasswordState;
|
|
121
|
+
resetPhoneNumberState: import(".").ResetPhoneNumberState;
|
|
118
122
|
ssoState: import(".").SSOState;
|
|
119
123
|
profileState: import(".").ProfileState;
|
|
120
124
|
mfaState: import(".").MFAState;
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { AcceptInvitationStep, ActivateAccountStep, ApiStateKeys, ForgotPasswordStep, LoginStep, MFAStep, SSOStateKeys, SamlVendors, SignUpStage, TeamStateKeys, acceptInvitationActions, acceptInvitationReducers, acceptInvitationState, accountSettingsActions, accountSettingsReducers, accountSettingsState, activateAccountActions, activateAccountReducers, activateState, apiTokensActions, apiTokensReducers, apiTokensState, default as auth, authActions, authInitialState, authMockSagas, authReducers, authSagas, forgotPasswordActions, forgotPasswordReducers, forgotPasswordState, loginActions, loginReducers, loginState, mfaActions, mfaReducers, mfaState, profileActions, profileReducers, profileState, rolesActions, rolesReducers, rolesState, securityPolicyActions, securityPolicyReducers, securityPolicyState, signUpActions, signUpReducers, signUpState, socialLoginState, socialLoginsActions, socialLoginsReducer, ssoActions, ssoReducers, ssoState, teamActions, teamReducers, teamState, tenantsActions, tenantsReducers, tenantsState } from './auth/index.js';
|
|
1
|
+
export { AcceptInvitationStep, ActivateAccountStep, ApiStateKeys, ForgotPasswordStep, LoginStep, MFAStep, ResetPhoneNumberStep, SSOStateKeys, SamlVendors, SignUpStage, TeamStateKeys, acceptInvitationActions, acceptInvitationReducers, acceptInvitationState, accountSettingsActions, accountSettingsReducers, accountSettingsState, activateAccountActions, activateAccountReducers, activateState, apiTokensActions, apiTokensReducers, apiTokensState, default as auth, authActions, authInitialState, authMockSagas, authReducers, authSagas, forgotPasswordActions, forgotPasswordReducers, forgotPasswordState, loginActions, loginReducers, loginState, mfaActions, mfaReducers, mfaState, profileActions, profileReducers, profileState, resetPhoneNumberActions, resetPhoneNumberReducers, resetPhoneNumberState, rolesActions, rolesReducers, rolesState, securityPolicyActions, securityPolicyReducers, securityPolicyState, signUpActions, signUpReducers, signUpState, socialLoginState, socialLoginsActions, socialLoginsReducer, ssoActions, ssoReducers, ssoState, teamActions, teamReducers, teamState, tenantsActions, tenantsReducers, tenantsState } from './auth/index.js';
|
|
2
2
|
export { auditLogsActions, auditLogsReducers, auditLogsState, default as audits, auditsActions, auditsInitialState, auditsMetadataActions, auditsMetadataReducers, auditsMetadataState, auditsMockSagas, auditsReducers, auditsSagas } from './audits/index.js';
|
|
3
3
|
export { default as connectivity, connectivityActions, connectivityInitialState, connectivityReducers, connectivitySagas } from './connectivity/index.js';
|
|
4
|
-
export { CheckoutEvent, CheckoutStatus, PaymentMethodType, PaymentProvider, SubscriptionCancellationPolicy, SubscriptionStatus, subscriptionActions, subscriptionInitialState, subscriptionReducers, subscriptionSagas, subscriptionSagasMock, default as subscriptions } from './subscriptions/index.js';
|
|
4
|
+
export { CheckoutEvent, CheckoutStatus, ManagedSubscriptionStatus, PaymentMethodType, PaymentProvider, SubscriptionCancellationPolicy, SubscriptionStatus, subscriptionActions, subscriptionInitialState, subscriptionReducers, subscriptionSagas, subscriptionSagasMock, default as subscriptions } from './subscriptions/index.js';
|
|
5
5
|
export { default as vendor } from './vendor/index.js';
|
|
6
6
|
export { createFronteggStore } from './toolkit/index.js';
|
|
7
7
|
export { AuthStrategyEnum } from '@frontegg/rest-api';
|
package/node/auth/index.js
CHANGED
|
@@ -45,6 +45,7 @@ exports.LoginStep = void 0;
|
|
|
45
45
|
(function (LoginStep) {
|
|
46
46
|
LoginStep["preLogin"] = "preLogin";
|
|
47
47
|
LoginStep["magicLinkPreLoginSuccess"] = "magicLinkPreLoginSuccess";
|
|
48
|
+
LoginStep["loginWithSmsOtc"] = "loginWithSmsOtc";
|
|
48
49
|
LoginStep["loginWithOtc"] = "loginWithOtc";
|
|
49
50
|
LoginStep["loginWithPassword"] = "loginWithPassword";
|
|
50
51
|
LoginStep["loginWithTwoFactor"] = "loginWithTwoFactor";
|
|
@@ -61,11 +62,11 @@ const loginState = {
|
|
|
61
62
|
email: '',
|
|
62
63
|
tenants: [],
|
|
63
64
|
};
|
|
64
|
-
const reducers$
|
|
65
|
+
const reducers$f = {
|
|
65
66
|
setLoginState: typeReducerForKey('loginState'),
|
|
66
67
|
resetLoginState: resetStateByKey('loginState', { loginState }),
|
|
67
68
|
};
|
|
68
|
-
const actions$
|
|
69
|
+
const actions$g = {
|
|
69
70
|
requestAuthorize: toolkit.createAction(`${constants.authStoreName}/requestAuthorize`, (payload = false) => ({ payload })),
|
|
70
71
|
requestHostedLoginAuthorize: toolkit.createAction(`${constants.authStoreName}/requestHostedLoginAuthorize`),
|
|
71
72
|
handleHostedLoginCallback: toolkit.createAction(`${constants.authStoreName}/handleHostedLoginCallback`, (payload) => ({ payload })),
|
|
@@ -99,12 +100,12 @@ const activateState = {
|
|
|
99
100
|
loading: false,
|
|
100
101
|
},
|
|
101
102
|
};
|
|
102
|
-
const reducers$
|
|
103
|
+
const reducers$e = {
|
|
103
104
|
setActivateState: typeReducerForKey('activateState'),
|
|
104
105
|
resetActivateState: resetStateByKey('activateState', { activateState }),
|
|
105
106
|
setActivateStrategyState: typeReducerNestedKey('activateState', 'activationStrategy'),
|
|
106
107
|
};
|
|
107
|
-
const actions$
|
|
108
|
+
const actions$f = {
|
|
108
109
|
activateAccount: toolkit.createAction(`${constants.authStoreName}/activateAccount`, (payload) => ({ payload })),
|
|
109
110
|
preActivateAccount: toolkit.createAction(`${constants.authStoreName}/preActivateAccount`, (payload) => ({ payload })),
|
|
110
111
|
getActivateAccountStrategy: toolkit.createAction(`${constants.authStoreName}/getActivateAccountStrategy`, (payload) => ({ payload })),
|
|
@@ -125,13 +126,13 @@ exports.AcceptInvitationStep = void 0;
|
|
|
125
126
|
const acceptInvitationState = {
|
|
126
127
|
step: exports.AcceptInvitationStep.validate,
|
|
127
128
|
};
|
|
128
|
-
const reducers$
|
|
129
|
+
const reducers$d = {
|
|
129
130
|
setAcceptInvitationState: typeReducerForKey('acceptInvitationState'),
|
|
130
131
|
resetAcceptInvitationState: resetStateByKey('acceptInvitationState', {
|
|
131
132
|
acceptInvitationState,
|
|
132
133
|
}),
|
|
133
134
|
};
|
|
134
|
-
const actions$
|
|
135
|
+
const actions$e = {
|
|
135
136
|
acceptInvitation: toolkit.createAction(`${constants.authStoreName}/acceptInvitation`, (payload) => ({ payload })),
|
|
136
137
|
};
|
|
137
138
|
|
|
@@ -147,11 +148,11 @@ const forgotPasswordState = {
|
|
|
147
148
|
email: '',
|
|
148
149
|
passwordConfig: null,
|
|
149
150
|
};
|
|
150
|
-
const reducers$
|
|
151
|
+
const reducers$c = {
|
|
151
152
|
setForgotPasswordState: typeReducerForKey('forgotPasswordState'),
|
|
152
153
|
resetForgotPasswordState: resetStateByKey('forgotPasswordState', { forgotPasswordState }),
|
|
153
154
|
};
|
|
154
|
-
const actions$
|
|
155
|
+
const actions$d = {
|
|
155
156
|
forgotPassword: toolkit.createAction(`${constants.authStoreName}/forgotPassword`, (payload) => ({ payload })),
|
|
156
157
|
resetPassword: toolkit.createAction(`${constants.authStoreName}/resetPassword`, (payload) => ({ payload })),
|
|
157
158
|
loadPasswordConfig: toolkit.createAction(`${constants.authStoreName}/loadPasswordConfig`, (payload) => ({
|
|
@@ -159,6 +160,27 @@ const actions$c = {
|
|
|
159
160
|
})),
|
|
160
161
|
};
|
|
161
162
|
|
|
163
|
+
exports.ResetPhoneNumberStep = void 0;
|
|
164
|
+
(function (ResetPhoneNumberStep) {
|
|
165
|
+
ResetPhoneNumberStep["ResetPhoneNumber"] = "ResetPhoneNumber";
|
|
166
|
+
ResetPhoneNumberStep["VerifyResetPhoneNumber"] = "VerifyResetPhoneNumber";
|
|
167
|
+
ResetPhoneNumberStep["ChangePhoneNumber"] = "ChangePhoneNumber";
|
|
168
|
+
})(exports.ResetPhoneNumberStep || (exports.ResetPhoneNumberStep = {}));
|
|
169
|
+
|
|
170
|
+
const resetPhoneNumberState = {
|
|
171
|
+
step: exports.ResetPhoneNumberStep.ResetPhoneNumber,
|
|
172
|
+
loading: false,
|
|
173
|
+
};
|
|
174
|
+
const reducers$b = {
|
|
175
|
+
setResetPhoneNumberState: typeReducerForKey('resetPhoneNumberState'),
|
|
176
|
+
resetResetPhoneNumberState: resetStateByKey('resetPhoneNumberState', { resetPhoneNumberState }),
|
|
177
|
+
};
|
|
178
|
+
const actions$c = {
|
|
179
|
+
resetPhoneNumber: toolkit.createAction(`${constants.authStoreName}/resetPhoneNumber`, (payload) => ({ payload })),
|
|
180
|
+
verifyResetPhoneNumber: toolkit.createAction(`${constants.authStoreName}/verifyResetPhoneNumber`, (payload) => ({ payload })),
|
|
181
|
+
changePhoneNumber: toolkit.createAction(`${constants.authStoreName}/changePhoneNumber`, (payload) => ({ payload })),
|
|
182
|
+
};
|
|
183
|
+
|
|
162
184
|
const ssoState = {
|
|
163
185
|
firstLoad: true,
|
|
164
186
|
loading: true,
|
|
@@ -490,6 +512,7 @@ const reinitializeState = {
|
|
|
490
512
|
accountSettingsState,
|
|
491
513
|
tenantsState,
|
|
492
514
|
rolesState,
|
|
515
|
+
resetPhoneNumberState
|
|
493
516
|
};
|
|
494
517
|
const initialState = Object.assign({ routes: {
|
|
495
518
|
authenticatedUrl: '/',
|
|
@@ -498,6 +521,7 @@ const initialState = Object.assign({ routes: {
|
|
|
498
521
|
activateUrl: '/account/activate',
|
|
499
522
|
acceptInvitationUrl: '/account/invitation/accept',
|
|
500
523
|
forgetPasswordUrl: '/account/forget-password',
|
|
524
|
+
resetPhoneNumberUrl: '/account/reset-phone-number',
|
|
501
525
|
resetPasswordUrl: '/account/reset-password',
|
|
502
526
|
socialLoginCallbackUrl: '/account/social/success',
|
|
503
527
|
signUpUrl: '/account/sign-up',
|
|
@@ -510,9 +534,9 @@ const initialState = Object.assign({ routes: {
|
|
|
510
534
|
const { reducer, actions: sliceActions } = toolkit.createSlice({
|
|
511
535
|
name: constants.authStoreName,
|
|
512
536
|
initialState,
|
|
513
|
-
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({ resetState: (state) => (Object.assign(Object.assign({}, state), reinitializeState)), setState: (state, { payload }) => (Object.assign(Object.assign({}, state), payload)), setUser: typeReducer('user') }, reducers$
|
|
537
|
+
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),
|
|
514
538
|
});
|
|
515
|
-
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({}, sliceActions), actions$
|
|
539
|
+
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);
|
|
516
540
|
|
|
517
541
|
exports.SSOStateKeys = void 0;
|
|
518
542
|
(function (SSOStateKeys) {
|
|
@@ -832,6 +856,12 @@ function* signUpSaga() {
|
|
|
832
856
|
yield effects.takeLeading(actions.resetSignUpStateSoft, resetSignUpStateSoft);
|
|
833
857
|
}
|
|
834
858
|
|
|
859
|
+
const authStrategyLoginStepMap = {
|
|
860
|
+
[restApi.AuthStrategyEnum.Code]: exports.LoginStep.loginWithOtc,
|
|
861
|
+
[restApi.AuthStrategyEnum.EmailAndPassword]: exports.LoginStep.loginWithPassword,
|
|
862
|
+
[restApi.AuthStrategyEnum.MagicLink]: exports.LoginStep.magicLinkPreLoginSuccess,
|
|
863
|
+
[restApi.AuthStrategyEnum.SmsCode]: exports.LoginStep.loginWithSmsOtc,
|
|
864
|
+
};
|
|
835
865
|
function* afterAuthNavigation() {
|
|
836
866
|
var _a;
|
|
837
867
|
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
@@ -995,10 +1025,16 @@ function* handleHostedLoginCallback({ payload }) {
|
|
|
995
1025
|
function* passwordlessPreLogin(_a) {
|
|
996
1026
|
var _b = _a.payload, { callback } = _b, payload = tslib.__rest(_b, ["callback"]);
|
|
997
1027
|
try {
|
|
1028
|
+
const { onRedirectTo, routes } = yield effects.select(({ auth: { onRedirectTo, routes } }) => ({ onRedirectTo, routes }));
|
|
998
1029
|
yield effects.put(actions.setLoginState({ loading: true }));
|
|
999
|
-
yield effects.call(restApi.api.auth.passwordlessPreLogin, payload);
|
|
1000
|
-
const step = payload.type
|
|
1001
|
-
|
|
1030
|
+
const preloginRes = yield effects.call(restApi.api.auth.passwordlessPreLogin, payload);
|
|
1031
|
+
const step = authStrategyLoginStepMap[payload.type];
|
|
1032
|
+
if (step === exports.LoginStep.loginWithSmsOtc && preloginRes.resetPhoneNumberToken) {
|
|
1033
|
+
yield effects.put(actions.setResetPhoneNumberState({ resetPhoneNumberToken: preloginRes.resetPhoneNumberToken, step: exports.ResetPhoneNumberStep.VerifyResetPhoneNumber }));
|
|
1034
|
+
onRedirectTo(routes.resetPhoneNumberUrl);
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
yield effects.put(actions.setLoginState({ step, loading: false, email: payload.email, phoneNumber: preloginRes === null || preloginRes === void 0 ? void 0 : preloginRes.phoneNumber }));
|
|
1002
1038
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
1003
1039
|
}
|
|
1004
1040
|
catch (e) {
|
|
@@ -1084,7 +1120,7 @@ function* ssoPreloginFailed(_a) {
|
|
|
1084
1120
|
yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithPassword, loading: false }));
|
|
1085
1121
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
1086
1122
|
}
|
|
1087
|
-
else if ([restApi.AuthStrategyEnum.MagicLink, restApi.AuthStrategyEnum.Code].includes(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
|
|
1123
|
+
else if ([restApi.AuthStrategyEnum.MagicLink, restApi.AuthStrategyEnum.Code, restApi.AuthStrategyEnum.SmsCode].includes(publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy)) {
|
|
1088
1124
|
yield effects.put(actions.passwordlessPreLogin(Object.assign(Object.assign({}, body), { type: publicPolicy === null || publicPolicy === void 0 ? void 0 : publicPolicy.authStrategy, callback })));
|
|
1089
1125
|
}
|
|
1090
1126
|
else {
|
|
@@ -3295,12 +3331,66 @@ function* rolesSagas() {
|
|
|
3295
3331
|
yield effects.takeEvery(actions.attachPermissionToRoles, attachPermissionToRoles);
|
|
3296
3332
|
}
|
|
3297
3333
|
|
|
3334
|
+
function* resetPhoneNumber(_a) {
|
|
3335
|
+
var _b = _a.payload, { callback } = _b, body = tslib.__rest(_b, ["callback"]);
|
|
3336
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: true }));
|
|
3337
|
+
try {
|
|
3338
|
+
const res = yield effects.call(restApi.api.auth.resetPhoneNumber, body);
|
|
3339
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: false, error: undefined, resetPhoneNumberToken: res.resetPhoneNumberToken, step: exports.ResetPhoneNumberStep.VerifyResetPhoneNumber }));
|
|
3340
|
+
yield effects.put(actions.setLoginState({ email: body.email }));
|
|
3341
|
+
}
|
|
3342
|
+
catch (e) {
|
|
3343
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: false, error: e.message }));
|
|
3344
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
function* verifyResetPhoneNumber(_a) {
|
|
3348
|
+
var _b = _a.payload, { callback } = _b, body = tslib.__rest(_b, ["callback"]);
|
|
3349
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: true }));
|
|
3350
|
+
try {
|
|
3351
|
+
const res = yield effects.call(restApi.api.auth.verifyResetPhoneNumber, body);
|
|
3352
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: false, error: undefined, changePhoneNumberToken: res.changePhoneNumberToken, step: exports.ResetPhoneNumberStep.ChangePhoneNumber }));
|
|
3353
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
3354
|
+
}
|
|
3355
|
+
catch (e) {
|
|
3356
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: false, error: e.message }));
|
|
3357
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
function* changePhoneNumber(_a) {
|
|
3361
|
+
var _b = _a.payload, { callback } = _b, body = tslib.__rest(_b, ["callback"]);
|
|
3362
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: true }));
|
|
3363
|
+
try {
|
|
3364
|
+
const { onRedirectTo, routes } = yield effects.select(({ auth: { onRedirectTo, routes } }) => ({ onRedirectTo, routes }));
|
|
3365
|
+
yield effects.call(restApi.api.auth.changePhoneNumber, { phoneNumber: body.phoneNumber, changePhoneNumberToken: body.changePhoneNumberToken });
|
|
3366
|
+
yield effects.put(actions.setLoginState({ step: exports.LoginStep.loginWithSmsOtc }));
|
|
3367
|
+
yield effects.put(actions.passwordlessPreLogin({
|
|
3368
|
+
type: restApi.AuthStrategyEnum.SmsCode,
|
|
3369
|
+
email: body.email,
|
|
3370
|
+
recaptchaToken: body.recaptchaToken,
|
|
3371
|
+
}));
|
|
3372
|
+
onRedirectTo(routes.loginUrl);
|
|
3373
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: false }));
|
|
3374
|
+
callback === null || callback === void 0 ? void 0 : callback(true);
|
|
3375
|
+
}
|
|
3376
|
+
catch (e) {
|
|
3377
|
+
yield effects.put(actions.setResetPhoneNumberState({ loading: false, error: e.message }));
|
|
3378
|
+
callback === null || callback === void 0 ? void 0 : callback(null, e);
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
function* resetPhoneNumberSagas() {
|
|
3382
|
+
yield effects.takeLeading(actions.resetPhoneNumber, resetPhoneNumber);
|
|
3383
|
+
yield effects.takeLeading(actions.verifyResetPhoneNumber, verifyResetPhoneNumber);
|
|
3384
|
+
yield effects.takeLeading(actions.changePhoneNumber, changePhoneNumber);
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3298
3387
|
function* sagas() {
|
|
3299
3388
|
yield effects.all([
|
|
3300
3389
|
effects.call(loginSagas),
|
|
3301
3390
|
effects.call(activateSagas),
|
|
3302
3391
|
effects.call(acceptInvitationSagas),
|
|
3303
3392
|
effects.call(forgotPasswordSagas),
|
|
3393
|
+
effects.call(resetPhoneNumberSagas),
|
|
3304
3394
|
effects.call(ssoSagas$1),
|
|
3305
3395
|
effects.call(ssoSagas),
|
|
3306
3396
|
effects.call(profileSagas),
|
|
@@ -3351,14 +3441,14 @@ Object.defineProperty(exports, 'AuthStrategyEnum', {
|
|
|
3351
3441
|
}
|
|
3352
3442
|
});
|
|
3353
3443
|
exports.authStoreName = constants.authStoreName;
|
|
3354
|
-
exports.acceptInvitationActions = actions$
|
|
3355
|
-
exports.acceptInvitationReducers = reducers$
|
|
3444
|
+
exports.acceptInvitationActions = actions$e;
|
|
3445
|
+
exports.acceptInvitationReducers = reducers$d;
|
|
3356
3446
|
exports.acceptInvitationState = acceptInvitationState;
|
|
3357
3447
|
exports.accountSettingsActions = actions$3;
|
|
3358
3448
|
exports.accountSettingsReducers = reducers$2;
|
|
3359
3449
|
exports.accountSettingsState = accountSettingsState;
|
|
3360
|
-
exports.activateAccountActions = actions$
|
|
3361
|
-
exports.activateAccountReducers = reducers$
|
|
3450
|
+
exports.activateAccountActions = actions$f;
|
|
3451
|
+
exports.activateAccountReducers = reducers$e;
|
|
3362
3452
|
exports.activateState = activateState;
|
|
3363
3453
|
exports.apiTokensActions = actions$5;
|
|
3364
3454
|
exports.apiTokensReducers = reducers$4;
|
|
@@ -3369,11 +3459,11 @@ exports.authMockSagas = mockSagas;
|
|
|
3369
3459
|
exports.authReducers = reducer;
|
|
3370
3460
|
exports.authSagas = sagas;
|
|
3371
3461
|
exports['default'] = authStore;
|
|
3372
|
-
exports.forgotPasswordActions = actions$
|
|
3373
|
-
exports.forgotPasswordReducers = reducers$
|
|
3462
|
+
exports.forgotPasswordActions = actions$d;
|
|
3463
|
+
exports.forgotPasswordReducers = reducers$c;
|
|
3374
3464
|
exports.forgotPasswordState = forgotPasswordState;
|
|
3375
|
-
exports.loginActions = actions$
|
|
3376
|
-
exports.loginReducers = reducers$
|
|
3465
|
+
exports.loginActions = actions$g;
|
|
3466
|
+
exports.loginReducers = reducers$f;
|
|
3377
3467
|
exports.loginState = loginState;
|
|
3378
3468
|
exports.mfaActions = actions$9;
|
|
3379
3469
|
exports.mfaReducers = reducers$8;
|
|
@@ -3381,6 +3471,9 @@ exports.mfaState = mfaState;
|
|
|
3381
3471
|
exports.profileActions = actions$a;
|
|
3382
3472
|
exports.profileReducers = reducers$9;
|
|
3383
3473
|
exports.profileState = profileState;
|
|
3474
|
+
exports.resetPhoneNumberActions = actions$c;
|
|
3475
|
+
exports.resetPhoneNumberReducers = reducers$b;
|
|
3476
|
+
exports.resetPhoneNumberState = resetPhoneNumberState;
|
|
3384
3477
|
exports.rolesActions = actions$1;
|
|
3385
3478
|
exports.rolesReducers = reducers;
|
|
3386
3479
|
exports.rolesState = rolesState;
|