@frontegg/redux-store 4.37.0 → 4.39.2-dashboard
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/audits/index.js +2 -2
- package/auth/LoginState/index.d.ts +5 -1
- package/auth/LoginState/interfaces.d.ts +5 -0
- package/auth/LoginState/saga.d.ts +16 -8
- package/auth/TenantsState/index.d.ts +14 -0
- package/auth/TenantsState/interfaces.d.ts +3 -1
- package/auth/index.d.ts +7 -0
- package/auth/index.js +98 -19
- package/auth/interfaces.d.ts +4 -0
- package/auth/reducer.d.ts +7 -0
- package/connectivity/index.js +2 -2
- package/{constants-f7891ee3.js → constants-4d9682b2.js} +2 -1
- package/constants.d.ts +1 -0
- package/helpers.d.ts +2 -0
- package/index.d.ts +3 -1
- package/index.js +2 -2
- package/node/audits/index.js +1 -1
- package/node/auth/index.js +96 -17
- package/node/connectivity/index.js +1 -1
- package/node/{constants-b305f261.js → constants-52e37c08.js} +2 -0
- package/node/index.js +2 -2
- package/node/{saga-508b308b.js → saga-633c17d2.js} +1 -1
- package/node/subscriptions/index.js +20 -23
- package/node/toolkit/index.js +2 -2
- package/node/vendor/index.js +2 -2
- package/package.json +3 -3
- package/{saga-afaced62.js → saga-b6529ffb.js} +1 -1
- package/subscriptions/Config/interfaces.d.ts +2 -5
- package/subscriptions/general.interfaces.d.ts +0 -1
- package/subscriptions/index.js +21 -24
- package/toolkit/index.js +2 -2
- package/vendor/index.js +4 -4
package/audits/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as auditsStoreName } from '../constants-
|
|
2
|
-
export { b as auditsStoreName } from '../constants-
|
|
1
|
+
import { b as auditsStoreName } from '../constants-4d9682b2.js';
|
|
2
|
+
export { b as auditsStoreName } from '../constants-4d9682b2.js';
|
|
3
3
|
import { createAction, createSlice } from '@reduxjs/toolkit';
|
|
4
4
|
import { takeEvery, select as select$1, put, call, all } from 'redux-saga/effects';
|
|
5
5
|
import { api } from '@frontegg/rest-api';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILogin, ILoginWithMfa, IPasswordlessPostLogin, IPasswordlessPreLogin, IPostLogin, IPreLogin, IRecoverMFAToken } from '@frontegg/rest-api';
|
|
2
|
-
import { LoginState } from './interfaces';
|
|
2
|
+
import { HostedLoginCallback, LoginState } from './interfaces';
|
|
3
3
|
import { WithCallback } from '../../interfaces';
|
|
4
4
|
import { IVerifyInviteToken } from '@frontegg/rest-api';
|
|
5
5
|
declare const loginState: LoginState;
|
|
@@ -71,6 +71,8 @@ declare const reducers: {
|
|
|
71
71
|
};
|
|
72
72
|
declare const actions: {
|
|
73
73
|
requestAuthorize: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(boolean | undefined)?], boolean, string, never, never>;
|
|
74
|
+
requestHostedLoginAuthorize: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
75
|
+
handleHostedLoginCallback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[HostedLoginCallback], HostedLoginCallback, string, never, never>;
|
|
74
76
|
afterAuthNavigation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
75
77
|
preLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<IPreLogin & {
|
|
76
78
|
recaptchaToken?: string | undefined;
|
|
@@ -100,6 +102,8 @@ declare type DispatchedActions = {
|
|
|
100
102
|
setLoginState: (state: Partial<LoginState>) => void;
|
|
101
103
|
resetLoginState: () => void;
|
|
102
104
|
requestAuthorize: (payload?: boolean) => void;
|
|
105
|
+
requestHostedLoginAuthorize: () => void;
|
|
106
|
+
handleHostedLoginCallback: (payload: HostedLoginCallback) => void;
|
|
103
107
|
afterAuthNavigation: () => void;
|
|
104
108
|
preLogin: (payload: WithCallback<IPreLogin & {
|
|
105
109
|
recaptchaToken?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CallEffect } from 'redux-saga/effects';
|
|
2
|
-
import { ILoginResponse, ISamlMetadata
|
|
2
|
+
import { IAllowedToRememberMfaDevice, ILoginResponse, ISamlMetadata } from '@frontegg/rest-api';
|
|
3
3
|
import { AuthState } from '../interfaces';
|
|
4
4
|
import { LoginStep } from './interfaces';
|
|
5
5
|
export declare function afterAuthNavigation(): Generator<import("redux-saga/effects").SelectEffect | CallEffect<true>, void, {
|
|
@@ -19,7 +19,7 @@ export declare function loadSSOPublicConfigurationFunction(): Generator<import("
|
|
|
19
19
|
isActive: any;
|
|
20
20
|
}>;
|
|
21
21
|
export declare const isMfaRequired: (user: ILoginResponse) => boolean;
|
|
22
|
-
export declare function getMfaRequiredState(user: any): Generator<CallEffect<IAllowedToRememberMfaDevice>, {
|
|
22
|
+
export declare function getMfaRequiredState(user: any): Generator<import("redux-saga/effects").SelectEffect | CallEffect<IAllowedToRememberMfaDevice>, {
|
|
23
23
|
loginState: {
|
|
24
24
|
mfaToken: any;
|
|
25
25
|
mfaRequired: any;
|
|
@@ -30,10 +30,15 @@ export declare function getMfaRequiredState(user: any): Generator<CallEffect<IAl
|
|
|
30
30
|
tenants: never[];
|
|
31
31
|
allowRememberMfaDevice: any;
|
|
32
32
|
mfaDeviceExpiration: any;
|
|
33
|
+
ssoRedirectUrl?: string | undefined;
|
|
34
|
+
email?: string | undefined;
|
|
35
|
+
inviteTokenTenantName?: string | undefined;
|
|
36
|
+
inviteTokenError?: string | undefined;
|
|
37
|
+
isNewUser?: boolean | undefined;
|
|
33
38
|
};
|
|
34
39
|
user: undefined;
|
|
35
40
|
isAuthenticated: boolean;
|
|
36
|
-
}, {
|
|
41
|
+
}, AuthState & {
|
|
37
42
|
isAllowedToRemember: any;
|
|
38
43
|
mfaDeviceExpiration: any;
|
|
39
44
|
}>;
|
|
@@ -43,7 +48,7 @@ export declare function refreshToken(): Generator<import("redux-saga/effects").S
|
|
|
43
48
|
}> | import("redux-saga/effects").PutEffect<{
|
|
44
49
|
payload: Partial<AuthState>;
|
|
45
50
|
type: string;
|
|
46
|
-
}> | Generator<CallEffect<IAllowedToRememberMfaDevice>, {
|
|
51
|
+
}> | Generator<import("redux-saga/effects").SelectEffect | CallEffect<IAllowedToRememberMfaDevice>, {
|
|
47
52
|
loginState: {
|
|
48
53
|
mfaToken: any;
|
|
49
54
|
mfaRequired: any;
|
|
@@ -54,10 +59,15 @@ export declare function refreshToken(): Generator<import("redux-saga/effects").S
|
|
|
54
59
|
tenants: never[];
|
|
55
60
|
allowRememberMfaDevice: any;
|
|
56
61
|
mfaDeviceExpiration: any;
|
|
62
|
+
ssoRedirectUrl?: string | undefined;
|
|
63
|
+
email?: string | undefined;
|
|
64
|
+
inviteTokenTenantName?: string | undefined;
|
|
65
|
+
inviteTokenError?: string | undefined;
|
|
66
|
+
isNewUser?: boolean | undefined;
|
|
57
67
|
};
|
|
58
68
|
user: undefined;
|
|
59
69
|
isAuthenticated: boolean;
|
|
60
|
-
}, {
|
|
70
|
+
}, AuthState & {
|
|
61
71
|
isAllowedToRemember: any;
|
|
62
72
|
mfaDeviceExpiration: any;
|
|
63
73
|
}> | CallEffect<ILoginResponse> | import("redux-saga/effects").PutEffect<{
|
|
@@ -65,9 +75,7 @@ export declare function refreshToken(): Generator<import("redux-saga/effects").S
|
|
|
65
75
|
callback?: ((data: import("@frontegg/rest-api").ITenantsResponse[] | null, error?: string | undefined) => void) | undefined;
|
|
66
76
|
} | undefined;
|
|
67
77
|
type: string;
|
|
68
|
-
}>, void, {
|
|
69
|
-
routes: any;
|
|
70
|
-
} & import("@frontegg/rest-api").IUserProfile & {
|
|
78
|
+
}>, void, AuthState & import("@frontegg/rest-api").IUserProfile & {
|
|
71
79
|
mfaRequired: boolean;
|
|
72
80
|
accessToken: string;
|
|
73
81
|
refreshToken: string;
|
|
@@ -16,6 +16,10 @@ declare const reducers: {
|
|
|
16
16
|
isAuthenticated: boolean;
|
|
17
17
|
isLoading: boolean;
|
|
18
18
|
keepSessionAlive?: boolean | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* if you see error in matcher that's mean the DispatchAction does not
|
|
21
|
+
* contains the same functions in reducers and actions
|
|
22
|
+
*/
|
|
19
23
|
user?: import("..").User | null | undefined;
|
|
20
24
|
isSSOAuth: boolean;
|
|
21
25
|
ssoACS?: string | undefined;
|
|
@@ -45,6 +49,10 @@ declare const reducers: {
|
|
|
45
49
|
isAuthenticated: boolean;
|
|
46
50
|
isLoading: boolean;
|
|
47
51
|
keepSessionAlive?: boolean | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* if you see error in matcher that's mean the DispatchAction does not
|
|
54
|
+
* contains the same functions in reducers and actions
|
|
55
|
+
*/
|
|
48
56
|
user?: import("..").User | null | undefined;
|
|
49
57
|
isSSOAuth: boolean;
|
|
50
58
|
ssoACS?: string | undefined;
|
|
@@ -75,6 +83,11 @@ declare const actions: {
|
|
|
75
83
|
} | undefined)?], {
|
|
76
84
|
callback?: ((data: ITenantsResponse[] | null, error?: string | undefined) => void) | undefined;
|
|
77
85
|
} | undefined, string, never, never>;
|
|
86
|
+
loadSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
87
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
88
|
+
} | undefined)?], {
|
|
89
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
90
|
+
} | undefined, string, never, never>;
|
|
78
91
|
};
|
|
79
92
|
/**
|
|
80
93
|
* To be used for actions types after dispatch, and should contains
|
|
@@ -85,6 +98,7 @@ declare type DispatchedActions = {
|
|
|
85
98
|
resetTenantsState: () => void;
|
|
86
99
|
switchTenant: (payload: WithCallback<ISwitchTenant>) => void;
|
|
87
100
|
loadTenants: (payload?: WithCallback<{}, ITenantsResponse[]>) => void;
|
|
101
|
+
loadSubTenants: (payload?: WithCallback<{}>) => void;
|
|
88
102
|
};
|
|
89
103
|
export declare type TenantsActions = DispatchedActions;
|
|
90
104
|
export { tenantsState, reducers as tenantsReducers, actions as tenantsActions };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ITenantsResponse } from '@frontegg/rest-api';
|
|
1
|
+
import { ISubTenant, ITenantsResponse } from '@frontegg/rest-api';
|
|
2
|
+
export { ISubTenant };
|
|
2
3
|
export interface TenantsState {
|
|
3
4
|
tenants: ITenantsResponse[];
|
|
4
5
|
loading: boolean;
|
|
5
6
|
error?: any;
|
|
7
|
+
subTenants: ISubTenant[];
|
|
6
8
|
}
|
package/auth/index.d.ts
CHANGED
|
@@ -58,6 +58,11 @@ declare const _default: {
|
|
|
58
58
|
} | undefined)?], {
|
|
59
59
|
callback?: ((data: import("@frontegg/rest-api").ITenantsResponse[] | null, error?: string | undefined) => void) | undefined;
|
|
60
60
|
} | undefined, string, never, never>;
|
|
61
|
+
loadSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
62
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
63
|
+
} | undefined)?], {
|
|
64
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
65
|
+
} | undefined, string, never, never>;
|
|
61
66
|
loadAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(import("../interfaces").WithCallback<{
|
|
62
67
|
silentLoading?: boolean | undefined;
|
|
63
68
|
}, boolean> | undefined)?], import("../interfaces").WithCallback<{
|
|
@@ -165,6 +170,8 @@ declare const _default: {
|
|
|
165
170
|
loginViaSocialLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ILoginViaSocialLogin], import("@frontegg/rest-api").ILoginViaSocialLogin, string, never, never>;
|
|
166
171
|
setSocialLoginError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISetSocialLoginError], import("@frontegg/rest-api").ISetSocialLoginError, string, never, never>;
|
|
167
172
|
requestAuthorize: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(boolean | undefined)?], boolean, string, never, never>;
|
|
173
|
+
requestHostedLoginAuthorize: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
174
|
+
handleHostedLoginCallback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("./LoginState/interfaces").HostedLoginCallback], import("./LoginState/interfaces").HostedLoginCallback, string, never, never>;
|
|
168
175
|
afterAuthNavigation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
169
176
|
preLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IPreLogin & {
|
|
170
177
|
recaptchaToken?: string | undefined;
|
package/auth/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createAction, createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { a as authStoreName, F as FRONTEGG_AFTER_AUTH_REDIRECT_URL } from '../constants-
|
|
3
|
-
export { a as authStoreName } from '../constants-
|
|
4
|
-
import { __rest } from 'tslib';
|
|
2
|
+
import { a as authStoreName, F as FRONTEGG_AFTER_AUTH_REDIRECT_URL, H as HOSTED_LOGIN_VERIFIER_KEY } from '../constants-4d9682b2.js';
|
|
3
|
+
export { a as authStoreName } from '../constants-4d9682b2.js';
|
|
4
|
+
import { __awaiter, __rest } from 'tslib';
|
|
5
5
|
import { takeLeading, put, select, call, takeEvery, delay as delay$1, all, retry, takeLatest } from 'redux-saga/effects';
|
|
6
6
|
import { AuthStrategyEnum, api, ContextHolder } from '@frontegg/rest-api';
|
|
7
7
|
export { AuthStrategyEnum } from '@frontegg/rest-api';
|
|
8
|
-
import { l as loadVendorPublicInfo } from '../saga-
|
|
8
|
+
import { l as loadVendorPublicInfo } from '../saga-b6529ffb.js';
|
|
9
9
|
import { v4 } from 'uuid';
|
|
10
10
|
|
|
11
11
|
const resetStateByKey = (key, initialState) => (state) => (Object.assign(Object.assign({}, state), { [key]: initialState[key] }));
|
|
@@ -65,6 +65,8 @@ const reducers$e = {
|
|
|
65
65
|
};
|
|
66
66
|
const actions$f = {
|
|
67
67
|
requestAuthorize: createAction(`${authStoreName}/requestAuthorize`, (payload = false) => ({ payload })),
|
|
68
|
+
requestHostedLoginAuthorize: createAction(`${authStoreName}/requestHostedLoginAuthorize`),
|
|
69
|
+
handleHostedLoginCallback: createAction(`${authStoreName}/handleHostedLoginCallback`, (payload) => ({ payload })),
|
|
68
70
|
afterAuthNavigation: createAction(`${authStoreName}/afterAuthNavigation`),
|
|
69
71
|
preLogin: createAction(`${authStoreName}/preLogin`, (payload) => ({ payload })),
|
|
70
72
|
postLogin: createAction(`${authStoreName}/postLogin`, (payload) => ({ payload })),
|
|
@@ -411,6 +413,7 @@ const actions$3 = {
|
|
|
411
413
|
|
|
412
414
|
const tenantsState = {
|
|
413
415
|
tenants: [],
|
|
416
|
+
subTenants: [],
|
|
414
417
|
loading: true,
|
|
415
418
|
};
|
|
416
419
|
const reducers$1 = {
|
|
@@ -422,6 +425,9 @@ const actions$2 = {
|
|
|
422
425
|
loadTenants: createAction(`${authStoreName}/loadTenants`, (payload) => ({
|
|
423
426
|
payload,
|
|
424
427
|
})),
|
|
428
|
+
loadSubTenants: createAction(`${authStoreName}/loadSubTenants`, (payload) => ({
|
|
429
|
+
payload,
|
|
430
|
+
})),
|
|
425
431
|
};
|
|
426
432
|
|
|
427
433
|
const rolesState = {
|
|
@@ -475,7 +481,8 @@ const initialState = Object.assign({ routes: {
|
|
|
475
481
|
socialLoginCallbackUrl: '/account/social/success',
|
|
476
482
|
signUpUrl: '/account/sign-up',
|
|
477
483
|
oidcRedirectUrl: '/account/oidc/callback',
|
|
478
|
-
magicLinkCallbackUrl: '/account/login/magic-link'
|
|
484
|
+
magicLinkCallbackUrl: '/account/login/magic-link',
|
|
485
|
+
hostedLoginRedirectUrl: '/oauth/callback'
|
|
479
486
|
}, onRedirectTo: () => { } }, reinitializeState);
|
|
480
487
|
|
|
481
488
|
const { reducer, actions: sliceActions } = createSlice({
|
|
@@ -501,6 +508,24 @@ function omitProps(props, keys) {
|
|
|
501
508
|
});
|
|
502
509
|
return newProps;
|
|
503
510
|
}
|
|
511
|
+
function generateCodeChallenge(codeVerifier) {
|
|
512
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
513
|
+
const digest = yield crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
|
|
514
|
+
// @ts-ignore
|
|
515
|
+
return btoa(String.fromCharCode(...new Uint8Array(digest)))
|
|
516
|
+
.replace(/=/g, '')
|
|
517
|
+
.replace(/\+/g, '-')
|
|
518
|
+
.replace(/\//g, '_');
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function createRandomString(length = 16) {
|
|
522
|
+
let text = '';
|
|
523
|
+
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
524
|
+
for (let i = 0; i < length; i++) {
|
|
525
|
+
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
526
|
+
}
|
|
527
|
+
return text;
|
|
528
|
+
}
|
|
504
529
|
const readFileAsText = (file) => new Promise((resolve, reject) => {
|
|
505
530
|
const reader = new FileReader();
|
|
506
531
|
reader.readAsText(file);
|
|
@@ -1024,6 +1049,7 @@ const isMfaRequired = (user) => {
|
|
|
1024
1049
|
function* getMfaRequiredState(user) {
|
|
1025
1050
|
let setMfaState = {};
|
|
1026
1051
|
let step = LoginStep.loginWithTwoFactor;
|
|
1052
|
+
const { loginState } = yield select((state) => state.auth);
|
|
1027
1053
|
const { isAllowedToRemember, mfaDeviceExpiration } = yield call(api.auth.checkIfAllowToRememberMfaDevice, user.mfaToken);
|
|
1028
1054
|
if (user.hasOwnProperty('mfaEnrolled') && !user.mfaEnrolled) {
|
|
1029
1055
|
setMfaState = {
|
|
@@ -1037,22 +1063,12 @@ function* getMfaRequiredState(user) {
|
|
|
1037
1063
|
};
|
|
1038
1064
|
step = LoginStep.forceTwoFactor;
|
|
1039
1065
|
}
|
|
1040
|
-
return Object.assign(Object.assign({ user: undefined, isAuthenticated: false }, setMfaState), { loginState: {
|
|
1041
|
-
mfaToken: user.mfaToken,
|
|
1042
|
-
mfaRequired: user.mfaRequired,
|
|
1043
|
-
loading: false,
|
|
1044
|
-
error: undefined,
|
|
1045
|
-
step,
|
|
1046
|
-
tenantsLoading: true,
|
|
1047
|
-
tenants: [],
|
|
1048
|
-
allowRememberMfaDevice: isAllowedToRemember,
|
|
1049
|
-
mfaDeviceExpiration,
|
|
1050
|
-
} });
|
|
1066
|
+
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 }) });
|
|
1051
1067
|
}
|
|
1052
1068
|
function* refreshToken() {
|
|
1053
1069
|
try {
|
|
1054
1070
|
const onRedirectTo = ContextHolder.onRedirectTo;
|
|
1055
|
-
const { routes } = yield select((state) => state.auth);
|
|
1071
|
+
const { routes, loginState } = yield select((state) => state.auth);
|
|
1056
1072
|
const user = yield call(api.auth.refreshToken);
|
|
1057
1073
|
if (isMfaRequired(user)) {
|
|
1058
1074
|
const mfaRequiredState = yield getMfaRequiredState(user);
|
|
@@ -1062,9 +1078,14 @@ function* refreshToken() {
|
|
|
1062
1078
|
else {
|
|
1063
1079
|
yield put(actions.loadTenants());
|
|
1064
1080
|
yield put(actions.setState({ user, isAuthenticated: true }));
|
|
1065
|
-
if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.
|
|
1081
|
+
if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl].includes(window.location.pathname) ||
|
|
1066
1082
|
(window.location.pathname.endsWith(routes.activateUrl) && user.verified)) {
|
|
1067
|
-
|
|
1083
|
+
if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
|
|
1084
|
+
onRedirectTo(routes.signUpSuccessUrl, { refresh: routes.signUpSuccessUrl.startsWith('http') });
|
|
1085
|
+
}
|
|
1086
|
+
else {
|
|
1087
|
+
yield afterAuthNavigation();
|
|
1088
|
+
}
|
|
1068
1089
|
}
|
|
1069
1090
|
}
|
|
1070
1091
|
}
|
|
@@ -1089,6 +1110,47 @@ function* requestAuthorize({ payload: firstTime }) {
|
|
|
1089
1110
|
yield all(calls);
|
|
1090
1111
|
yield put(actions.setState({ isLoading: false }));
|
|
1091
1112
|
}
|
|
1113
|
+
function* requestHostedLoginAuthorize() {
|
|
1114
|
+
const { routes, baseUrl, clientId, onRedirectTo } = yield select((state) => (Object.assign({ routes: state.auth.routes, onRedirectTo: state.auth.onRedirectTo }, state.root.context)));
|
|
1115
|
+
// Generate the relevant params for the redirect
|
|
1116
|
+
const nonce = createRandomString();
|
|
1117
|
+
const code_verifier = createRandomString();
|
|
1118
|
+
const code_challenge = yield call(generateCodeChallenge, code_verifier);
|
|
1119
|
+
// We are saving the verifier in session storage to be able to validate the response
|
|
1120
|
+
sessionStorage.setItem(HOSTED_LOGIN_VERIFIER_KEY, code_verifier);
|
|
1121
|
+
const redirectUrl = `${window.location.origin}${routes.hostedLoginRedirectUrl}`;
|
|
1122
|
+
// Hard coded for now
|
|
1123
|
+
const oauthUrl = `${baseUrl}/oauth/authorize`;
|
|
1124
|
+
const params = {
|
|
1125
|
+
response_type: 'code',
|
|
1126
|
+
client_id: clientId || 'INVALID-CLIENT-ID',
|
|
1127
|
+
scope: 'openid email profile',
|
|
1128
|
+
redirect_uri: redirectUrl,
|
|
1129
|
+
code_challenge: code_challenge,
|
|
1130
|
+
code_challenge_method: 'S256',
|
|
1131
|
+
nonce,
|
|
1132
|
+
};
|
|
1133
|
+
const searchParams = new URLSearchParams(params);
|
|
1134
|
+
const url = `${oauthUrl}?${searchParams.toString()}`;
|
|
1135
|
+
onRedirectTo(url, { refresh: true });
|
|
1136
|
+
}
|
|
1137
|
+
function* handleHostedLoginCallback({ payload }) {
|
|
1138
|
+
// Hard coded for now
|
|
1139
|
+
const code_verifier = sessionStorage.getItem(HOSTED_LOGIN_VERIFIER_KEY) || 'INVALID-CODE-VERIFIER';
|
|
1140
|
+
const routes = yield select((state) => state.auth.routes);
|
|
1141
|
+
const redirectUrl = `${window.location.origin}${routes.hostedLoginRedirectUrl}`;
|
|
1142
|
+
const body = {
|
|
1143
|
+
code: payload.code,
|
|
1144
|
+
redirect_uri: redirectUrl,
|
|
1145
|
+
code_verifier,
|
|
1146
|
+
grant_type: 'authorization_code',
|
|
1147
|
+
};
|
|
1148
|
+
const user = yield call(api.auth.exchangeOAuthTokens, body);
|
|
1149
|
+
// TODO: Validate nonce and aud
|
|
1150
|
+
yield put(actions.setState({ user, isAuthenticated: true }));
|
|
1151
|
+
yield put(actions.loadTenants());
|
|
1152
|
+
yield afterAuthNavigation();
|
|
1153
|
+
}
|
|
1092
1154
|
function* passwordlessPreLogin(_a) {
|
|
1093
1155
|
var _b = _a.payload, { callback } = _b, payload = __rest(_b, ["callback"]);
|
|
1094
1156
|
try {
|
|
@@ -1321,6 +1383,8 @@ function* silentLogout({ payload }) {
|
|
|
1321
1383
|
}
|
|
1322
1384
|
function* loginSagas() {
|
|
1323
1385
|
yield takeLeading(actions.requestAuthorize, requestAuthorize);
|
|
1386
|
+
yield takeLeading(actions.requestHostedLoginAuthorize, requestHostedLoginAuthorize);
|
|
1387
|
+
yield takeLeading(actions.handleHostedLoginCallback, handleHostedLoginCallback);
|
|
1324
1388
|
yield takeLeading(actions.preLogin, preLogin);
|
|
1325
1389
|
yield takeLeading(actions.postLogin, postLogin);
|
|
1326
1390
|
yield takeLeading(actions.login, login);
|
|
@@ -2444,6 +2508,7 @@ function* loginViaSocialLogin({ payload }) {
|
|
|
2444
2508
|
const { email, isNewUser } = yield call(api.auth.loginViaSocialLogin, payload);
|
|
2445
2509
|
yield put(actions.setLoginState({ email, isNewUser }));
|
|
2446
2510
|
yield refreshToken();
|
|
2511
|
+
yield put(actions.setSocialLoginsState({ loading: false }));
|
|
2447
2512
|
}
|
|
2448
2513
|
catch (e) {
|
|
2449
2514
|
yield put(actions.setSocialLoginsState({ loading: false, error: (_a = e.message) !== null && _a !== void 0 ? _a : 'Failed to authenticate', firstLoad: false }));
|
|
@@ -2762,8 +2827,22 @@ function* loadTenants({ payload }) {
|
|
|
2762
2827
|
yield put(actions.setTenantsState({ loading: false }));
|
|
2763
2828
|
}
|
|
2764
2829
|
}
|
|
2830
|
+
function* loadSubTenants({ payload }) {
|
|
2831
|
+
var _a, _b;
|
|
2832
|
+
yield put(actions.setTenantsState({ loading: true }));
|
|
2833
|
+
try {
|
|
2834
|
+
const subTenants = yield call(api.tenants.getSubTenants);
|
|
2835
|
+
yield put(actions.setTenantsState({ subTenants, loading: false }));
|
|
2836
|
+
(_a = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
|
|
2837
|
+
}
|
|
2838
|
+
catch (e) {
|
|
2839
|
+
yield put(actions.setTenantsState({ loading: false }));
|
|
2840
|
+
(_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2765
2843
|
function* tenantsSagas() {
|
|
2766
2844
|
yield takeEvery(actions.loadTenants, loadTenants);
|
|
2845
|
+
yield takeEvery(actions.loadSubTenants, loadSubTenants);
|
|
2767
2846
|
yield takeEvery(actions.switchTenant, switchTenant);
|
|
2768
2847
|
}
|
|
2769
2848
|
/*********************************
|
package/auth/interfaces.d.ts
CHANGED
package/auth/reducer.d.ts
CHANGED
|
@@ -32,6 +32,11 @@ declare const actions: {
|
|
|
32
32
|
} | undefined)?], {
|
|
33
33
|
callback?: ((data: import("@frontegg/rest-api").ITenantsResponse[] | null, error?: string | undefined) => void) | undefined;
|
|
34
34
|
} | undefined, string, never, never>;
|
|
35
|
+
loadSubTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[({
|
|
36
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
37
|
+
} | undefined)?], {
|
|
38
|
+
callback?: ((data: boolean | null, error?: string | undefined) => void) | undefined;
|
|
39
|
+
} | undefined, string, never, never>;
|
|
35
40
|
loadAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(import("../interfaces").WithCallback<{
|
|
36
41
|
silentLoading?: boolean | undefined;
|
|
37
42
|
}, boolean> | undefined)?], import("../interfaces").WithCallback<{
|
|
@@ -139,6 +144,8 @@ declare const actions: {
|
|
|
139
144
|
loginViaSocialLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ILoginViaSocialLogin], import("@frontegg/rest-api").ILoginViaSocialLogin, string, never, never>;
|
|
140
145
|
setSocialLoginError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISetSocialLoginError], import("@frontegg/rest-api").ISetSocialLoginError, string, never, never>;
|
|
141
146
|
requestAuthorize: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(boolean | undefined)?], boolean, string, never, never>;
|
|
147
|
+
requestHostedLoginAuthorize: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
148
|
+
handleHostedLoginCallback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import(".").HostedLoginCallback], import(".").HostedLoginCallback, string, never, never>;
|
|
142
149
|
afterAuthNavigation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
143
150
|
preLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IPreLogin & {
|
|
144
151
|
recaptchaToken?: string | undefined;
|
package/connectivity/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as connectivityStoreName } from '../constants-
|
|
2
|
-
export { c as connectivityStoreName } from '../constants-
|
|
1
|
+
import { c as connectivityStoreName } from '../constants-4d9682b2.js';
|
|
2
|
+
export { c as connectivityStoreName } from '../constants-4d9682b2.js';
|
|
3
3
|
import { createAction, createSlice } from '@reduxjs/toolkit';
|
|
4
4
|
import { __rest } from 'tslib';
|
|
5
5
|
import { takeEvery, takeLatest, put, all, call, select } from 'redux-saga/effects';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const FRONTEGG_AFTER_AUTH_REDIRECT_URL = 'FRONTEGG_AFTER_AUTH_REDIRECT_URL';
|
|
2
|
+
const HOSTED_LOGIN_VERIFIER_KEY = 'HOSTED_LOGIN_VERIFIER_KEY';
|
|
2
3
|
const authStoreName = 'auth';
|
|
3
4
|
const connectivityStoreName = 'connectivity';
|
|
4
5
|
const auditsStoreName = 'auditLogs';
|
|
5
6
|
const subscriptionsStoreName = 'subscriptions';
|
|
6
7
|
const vendorStoreName = 'vendor';
|
|
7
8
|
|
|
8
|
-
export { FRONTEGG_AFTER_AUTH_REDIRECT_URL as F, authStoreName as a, auditsStoreName as b, connectivityStoreName as c, subscriptionsStoreName as s, vendorStoreName as v };
|
|
9
|
+
export { FRONTEGG_AFTER_AUTH_REDIRECT_URL as F, HOSTED_LOGIN_VERIFIER_KEY as H, authStoreName as a, auditsStoreName as b, connectivityStoreName as c, subscriptionsStoreName as s, vendorStoreName as v };
|
package/constants.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const FRONTEGG_AFTER_AUTH_REDIRECT_URL = "FRONTEGG_AFTER_AUTH_REDIRECT_URL";
|
|
2
|
+
export declare const HOSTED_LOGIN_VERIFIER_KEY = "HOSTED_LOGIN_VERIFIER_KEY";
|
|
2
3
|
export declare const authStoreName = "auth";
|
|
3
4
|
export declare const connectivityStoreName = "connectivity";
|
|
4
5
|
export declare const auditsStoreName = "auditLogs";
|
package/helpers.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare function omitProps<T>(props: any, keys: string[]): T;
|
|
2
2
|
export declare function generateActionCreator(storeName: string): <Payload>(key: string, withPayload?: boolean | undefined) => import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Payload], Payload, string, never, never> | import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
3
|
+
export declare function generateCodeChallenge(codeVerifier: string): Promise<string>;
|
|
4
|
+
export declare function createRandomString(length?: number): string;
|
|
3
5
|
export declare const readFileAsText: (file: File) => Promise<string>;
|
package/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { AuditsState } from './audits/interfaces';
|
|
|
4
4
|
import { IConnectivityState } from './connectivity/interfaces';
|
|
5
5
|
import { SubscriptionsState } from './subscriptions/interfaces';
|
|
6
6
|
import { VendorState } from './vendor/interfaces';
|
|
7
|
+
import { OldAuditsState } from './audits/backward-compatibility';
|
|
7
8
|
export { default as auth } from './auth';
|
|
8
9
|
export { default as audits } from './audits';
|
|
9
10
|
export { default as connectivity } from './connectivity';
|
|
@@ -19,7 +20,8 @@ export * from './toolkit';
|
|
|
19
20
|
export declare type FronteggState = {
|
|
20
21
|
root: RootState;
|
|
21
22
|
auth: AuthState;
|
|
22
|
-
|
|
23
|
+
auditLogs: AuditsState;
|
|
24
|
+
audits: OldAuditsState;
|
|
23
25
|
connectivity: IConnectivityState;
|
|
24
26
|
subscriptions: SubscriptionsState;
|
|
25
27
|
vendor: VendorState;
|
package/index.js
CHANGED
|
@@ -5,9 +5,9 @@ export { CheckoutEvent, CheckoutStatus, PaymentMethodType, PaymentProvider, Subs
|
|
|
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';
|
|
8
|
-
export { b as auditsStoreName, a as authStoreName, c as connectivityStoreName, s as subscriptionsStoreName, v as vendorStoreName } from './constants-
|
|
8
|
+
export { b as auditsStoreName, a as authStoreName, c as connectivityStoreName, s as subscriptionsStoreName, v as vendorStoreName } from './constants-4d9682b2.js';
|
|
9
9
|
export { a as actions, d as defaultItemsPerPage, i as initialState, r as reducer, b as sagas, s as storeName } from './saga-7a267fe0.js';
|
|
10
|
-
export { a as vendorActions, i as vendorInitialState, r as vendorReducers, s as vendorSagas } from './saga-
|
|
10
|
+
export { a as vendorActions, i as vendorInitialState, r as vendorReducers, s as vendorSagas } from './saga-b6529ffb.js';
|
|
11
11
|
export { bindActionCreators, combineReducers, configureStore, createSelector, createSlice, getDefaultMiddleware } from '@reduxjs/toolkit';
|
|
12
12
|
export { all, call, delay, put, select, takeEvery, takeLatest } from 'redux-saga/effects';
|
|
13
13
|
export { default as createSagaMiddleware } from 'redux-saga';
|
package/node/audits/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var constants = require('../constants-
|
|
5
|
+
var constants = require('../constants-52e37c08.js');
|
|
6
6
|
var toolkit = require('@reduxjs/toolkit');
|
|
7
7
|
var effects = require('redux-saga/effects');
|
|
8
8
|
var restApi = require('@frontegg/rest-api');
|
package/node/auth/index.js
CHANGED
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var toolkit = require('@reduxjs/toolkit');
|
|
6
6
|
var restApi = require('@frontegg/rest-api');
|
|
7
|
-
var constants = require('../constants-
|
|
7
|
+
var constants = require('../constants-52e37c08.js');
|
|
8
8
|
var tslib = require('tslib');
|
|
9
9
|
var effects = require('redux-saga/effects');
|
|
10
|
-
var saga = require('../saga-
|
|
10
|
+
var saga = require('../saga-633c17d2.js');
|
|
11
11
|
var uuid = require('uuid');
|
|
12
12
|
|
|
13
13
|
const resetStateByKey = (key, initialState) => (state) => (Object.assign(Object.assign({}, state), { [key]: initialState[key] }));
|
|
@@ -67,6 +67,8 @@ const reducers$e = {
|
|
|
67
67
|
};
|
|
68
68
|
const actions$f = {
|
|
69
69
|
requestAuthorize: toolkit.createAction(`${constants.authStoreName}/requestAuthorize`, (payload = false) => ({ payload })),
|
|
70
|
+
requestHostedLoginAuthorize: toolkit.createAction(`${constants.authStoreName}/requestHostedLoginAuthorize`),
|
|
71
|
+
handleHostedLoginCallback: toolkit.createAction(`${constants.authStoreName}/handleHostedLoginCallback`, (payload) => ({ payload })),
|
|
70
72
|
afterAuthNavigation: toolkit.createAction(`${constants.authStoreName}/afterAuthNavigation`),
|
|
71
73
|
preLogin: toolkit.createAction(`${constants.authStoreName}/preLogin`, (payload) => ({ payload })),
|
|
72
74
|
postLogin: toolkit.createAction(`${constants.authStoreName}/postLogin`, (payload) => ({ payload })),
|
|
@@ -413,6 +415,7 @@ const actions$3 = {
|
|
|
413
415
|
|
|
414
416
|
const tenantsState = {
|
|
415
417
|
tenants: [],
|
|
418
|
+
subTenants: [],
|
|
416
419
|
loading: true,
|
|
417
420
|
};
|
|
418
421
|
const reducers$1 = {
|
|
@@ -424,6 +427,9 @@ const actions$2 = {
|
|
|
424
427
|
loadTenants: toolkit.createAction(`${constants.authStoreName}/loadTenants`, (payload) => ({
|
|
425
428
|
payload,
|
|
426
429
|
})),
|
|
430
|
+
loadSubTenants: toolkit.createAction(`${constants.authStoreName}/loadSubTenants`, (payload) => ({
|
|
431
|
+
payload,
|
|
432
|
+
})),
|
|
427
433
|
};
|
|
428
434
|
|
|
429
435
|
const rolesState = {
|
|
@@ -477,7 +483,8 @@ const initialState = Object.assign({ routes: {
|
|
|
477
483
|
socialLoginCallbackUrl: '/account/social/success',
|
|
478
484
|
signUpUrl: '/account/sign-up',
|
|
479
485
|
oidcRedirectUrl: '/account/oidc/callback',
|
|
480
|
-
magicLinkCallbackUrl: '/account/login/magic-link'
|
|
486
|
+
magicLinkCallbackUrl: '/account/login/magic-link',
|
|
487
|
+
hostedLoginRedirectUrl: '/oauth/callback'
|
|
481
488
|
}, onRedirectTo: () => { } }, reinitializeState);
|
|
482
489
|
|
|
483
490
|
const { reducer, actions: sliceActions } = toolkit.createSlice({
|
|
@@ -503,6 +510,24 @@ function omitProps(props, keys) {
|
|
|
503
510
|
});
|
|
504
511
|
return newProps;
|
|
505
512
|
}
|
|
513
|
+
function generateCodeChallenge(codeVerifier) {
|
|
514
|
+
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
515
|
+
const digest = yield crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
|
|
516
|
+
// @ts-ignore
|
|
517
|
+
return btoa(String.fromCharCode(...new Uint8Array(digest)))
|
|
518
|
+
.replace(/=/g, '')
|
|
519
|
+
.replace(/\+/g, '-')
|
|
520
|
+
.replace(/\//g, '_');
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
function createRandomString(length = 16) {
|
|
524
|
+
let text = '';
|
|
525
|
+
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
526
|
+
for (let i = 0; i < length; i++) {
|
|
527
|
+
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
528
|
+
}
|
|
529
|
+
return text;
|
|
530
|
+
}
|
|
506
531
|
const readFileAsText = (file) => new Promise((resolve, reject) => {
|
|
507
532
|
const reader = new FileReader();
|
|
508
533
|
reader.readAsText(file);
|
|
@@ -1026,6 +1051,7 @@ const isMfaRequired = (user) => {
|
|
|
1026
1051
|
function* getMfaRequiredState(user) {
|
|
1027
1052
|
let setMfaState = {};
|
|
1028
1053
|
let step = exports.LoginStep.loginWithTwoFactor;
|
|
1054
|
+
const { loginState } = yield effects.select((state) => state.auth);
|
|
1029
1055
|
const { isAllowedToRemember, mfaDeviceExpiration } = yield effects.call(restApi.api.auth.checkIfAllowToRememberMfaDevice, user.mfaToken);
|
|
1030
1056
|
if (user.hasOwnProperty('mfaEnrolled') && !user.mfaEnrolled) {
|
|
1031
1057
|
setMfaState = {
|
|
@@ -1039,22 +1065,12 @@ function* getMfaRequiredState(user) {
|
|
|
1039
1065
|
};
|
|
1040
1066
|
step = exports.LoginStep.forceTwoFactor;
|
|
1041
1067
|
}
|
|
1042
|
-
return Object.assign(Object.assign({ user: undefined, isAuthenticated: false }, setMfaState), { loginState: {
|
|
1043
|
-
mfaToken: user.mfaToken,
|
|
1044
|
-
mfaRequired: user.mfaRequired,
|
|
1045
|
-
loading: false,
|
|
1046
|
-
error: undefined,
|
|
1047
|
-
step,
|
|
1048
|
-
tenantsLoading: true,
|
|
1049
|
-
tenants: [],
|
|
1050
|
-
allowRememberMfaDevice: isAllowedToRemember,
|
|
1051
|
-
mfaDeviceExpiration,
|
|
1052
|
-
} });
|
|
1068
|
+
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 }) });
|
|
1053
1069
|
}
|
|
1054
1070
|
function* refreshToken() {
|
|
1055
1071
|
try {
|
|
1056
1072
|
const onRedirectTo = restApi.ContextHolder.onRedirectTo;
|
|
1057
|
-
const { routes } = yield effects.select((state) => state.auth);
|
|
1073
|
+
const { routes, loginState } = yield effects.select((state) => state.auth);
|
|
1058
1074
|
const user = yield effects.call(restApi.api.auth.refreshToken);
|
|
1059
1075
|
if (isMfaRequired(user)) {
|
|
1060
1076
|
const mfaRequiredState = yield getMfaRequiredState(user);
|
|
@@ -1064,9 +1080,14 @@ function* refreshToken() {
|
|
|
1064
1080
|
else {
|
|
1065
1081
|
yield effects.put(actions.loadTenants());
|
|
1066
1082
|
yield effects.put(actions.setState({ user, isAuthenticated: true }));
|
|
1067
|
-
if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.
|
|
1083
|
+
if ([routes.loginUrl, routes.socialLoginCallbackUrl, routes.signUpUrl, routes.oidcRedirectUrl].includes(window.location.pathname) ||
|
|
1068
1084
|
(window.location.pathname.endsWith(routes.activateUrl) && user.verified)) {
|
|
1069
|
-
|
|
1085
|
+
if (loginState.isNewUser && routes.signUpSuccessUrl && routes.socialLoginCallbackUrl === window.location.pathname) {
|
|
1086
|
+
onRedirectTo(routes.signUpSuccessUrl, { refresh: routes.signUpSuccessUrl.startsWith('http') });
|
|
1087
|
+
}
|
|
1088
|
+
else {
|
|
1089
|
+
yield afterAuthNavigation();
|
|
1090
|
+
}
|
|
1070
1091
|
}
|
|
1071
1092
|
}
|
|
1072
1093
|
}
|
|
@@ -1091,6 +1112,47 @@ function* requestAuthorize({ payload: firstTime }) {
|
|
|
1091
1112
|
yield effects.all(calls);
|
|
1092
1113
|
yield effects.put(actions.setState({ isLoading: false }));
|
|
1093
1114
|
}
|
|
1115
|
+
function* requestHostedLoginAuthorize() {
|
|
1116
|
+
const { routes, baseUrl, clientId, onRedirectTo } = yield effects.select((state) => (Object.assign({ routes: state.auth.routes, onRedirectTo: state.auth.onRedirectTo }, state.root.context)));
|
|
1117
|
+
// Generate the relevant params for the redirect
|
|
1118
|
+
const nonce = createRandomString();
|
|
1119
|
+
const code_verifier = createRandomString();
|
|
1120
|
+
const code_challenge = yield effects.call(generateCodeChallenge, code_verifier);
|
|
1121
|
+
// We are saving the verifier in session storage to be able to validate the response
|
|
1122
|
+
sessionStorage.setItem(constants.HOSTED_LOGIN_VERIFIER_KEY, code_verifier);
|
|
1123
|
+
const redirectUrl = `${window.location.origin}${routes.hostedLoginRedirectUrl}`;
|
|
1124
|
+
// Hard coded for now
|
|
1125
|
+
const oauthUrl = `${baseUrl}/oauth/authorize`;
|
|
1126
|
+
const params = {
|
|
1127
|
+
response_type: 'code',
|
|
1128
|
+
client_id: clientId || 'INVALID-CLIENT-ID',
|
|
1129
|
+
scope: 'openid email profile',
|
|
1130
|
+
redirect_uri: redirectUrl,
|
|
1131
|
+
code_challenge: code_challenge,
|
|
1132
|
+
code_challenge_method: 'S256',
|
|
1133
|
+
nonce,
|
|
1134
|
+
};
|
|
1135
|
+
const searchParams = new URLSearchParams(params);
|
|
1136
|
+
const url = `${oauthUrl}?${searchParams.toString()}`;
|
|
1137
|
+
onRedirectTo(url, { refresh: true });
|
|
1138
|
+
}
|
|
1139
|
+
function* handleHostedLoginCallback({ payload }) {
|
|
1140
|
+
// Hard coded for now
|
|
1141
|
+
const code_verifier = sessionStorage.getItem(constants.HOSTED_LOGIN_VERIFIER_KEY) || 'INVALID-CODE-VERIFIER';
|
|
1142
|
+
const routes = yield effects.select((state) => state.auth.routes);
|
|
1143
|
+
const redirectUrl = `${window.location.origin}${routes.hostedLoginRedirectUrl}`;
|
|
1144
|
+
const body = {
|
|
1145
|
+
code: payload.code,
|
|
1146
|
+
redirect_uri: redirectUrl,
|
|
1147
|
+
code_verifier,
|
|
1148
|
+
grant_type: 'authorization_code',
|
|
1149
|
+
};
|
|
1150
|
+
const user = yield effects.call(restApi.api.auth.exchangeOAuthTokens, body);
|
|
1151
|
+
// TODO: Validate nonce and aud
|
|
1152
|
+
yield effects.put(actions.setState({ user, isAuthenticated: true }));
|
|
1153
|
+
yield effects.put(actions.loadTenants());
|
|
1154
|
+
yield afterAuthNavigation();
|
|
1155
|
+
}
|
|
1094
1156
|
function* passwordlessPreLogin(_a) {
|
|
1095
1157
|
var _b = _a.payload, { callback } = _b, payload = tslib.__rest(_b, ["callback"]);
|
|
1096
1158
|
try {
|
|
@@ -1323,6 +1385,8 @@ function* silentLogout({ payload }) {
|
|
|
1323
1385
|
}
|
|
1324
1386
|
function* loginSagas() {
|
|
1325
1387
|
yield effects.takeLeading(actions.requestAuthorize, requestAuthorize);
|
|
1388
|
+
yield effects.takeLeading(actions.requestHostedLoginAuthorize, requestHostedLoginAuthorize);
|
|
1389
|
+
yield effects.takeLeading(actions.handleHostedLoginCallback, handleHostedLoginCallback);
|
|
1326
1390
|
yield effects.takeLeading(actions.preLogin, preLogin);
|
|
1327
1391
|
yield effects.takeLeading(actions.postLogin, postLogin);
|
|
1328
1392
|
yield effects.takeLeading(actions.login, login);
|
|
@@ -2446,6 +2510,7 @@ function* loginViaSocialLogin({ payload }) {
|
|
|
2446
2510
|
const { email, isNewUser } = yield effects.call(restApi.api.auth.loginViaSocialLogin, payload);
|
|
2447
2511
|
yield effects.put(actions.setLoginState({ email, isNewUser }));
|
|
2448
2512
|
yield refreshToken();
|
|
2513
|
+
yield effects.put(actions.setSocialLoginsState({ loading: false }));
|
|
2449
2514
|
}
|
|
2450
2515
|
catch (e) {
|
|
2451
2516
|
yield effects.put(actions.setSocialLoginsState({ loading: false, error: (_a = e.message) !== null && _a !== void 0 ? _a : 'Failed to authenticate', firstLoad: false }));
|
|
@@ -2764,8 +2829,22 @@ function* loadTenants({ payload }) {
|
|
|
2764
2829
|
yield effects.put(actions.setTenantsState({ loading: false }));
|
|
2765
2830
|
}
|
|
2766
2831
|
}
|
|
2832
|
+
function* loadSubTenants({ payload }) {
|
|
2833
|
+
var _a, _b;
|
|
2834
|
+
yield effects.put(actions.setTenantsState({ loading: true }));
|
|
2835
|
+
try {
|
|
2836
|
+
const subTenants = yield effects.call(restApi.api.tenants.getSubTenants);
|
|
2837
|
+
yield effects.put(actions.setTenantsState({ subTenants, loading: false }));
|
|
2838
|
+
(_a = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _a === void 0 ? void 0 : _a.call(payload, true);
|
|
2839
|
+
}
|
|
2840
|
+
catch (e) {
|
|
2841
|
+
yield effects.put(actions.setTenantsState({ loading: false }));
|
|
2842
|
+
(_b = payload === null || payload === void 0 ? void 0 : payload.callback) === null || _b === void 0 ? void 0 : _b.call(payload, null, e);
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2767
2845
|
function* tenantsSagas() {
|
|
2768
2846
|
yield effects.takeEvery(actions.loadTenants, loadTenants);
|
|
2847
|
+
yield effects.takeEvery(actions.loadSubTenants, loadSubTenants);
|
|
2769
2848
|
yield effects.takeEvery(actions.switchTenant, switchTenant);
|
|
2770
2849
|
}
|
|
2771
2850
|
/*********************************
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var constants = require('../constants-
|
|
5
|
+
var constants = require('../constants-52e37c08.js');
|
|
6
6
|
var toolkit = require('@reduxjs/toolkit');
|
|
7
7
|
var tslib = require('tslib');
|
|
8
8
|
var effects = require('redux-saga/effects');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const FRONTEGG_AFTER_AUTH_REDIRECT_URL = 'FRONTEGG_AFTER_AUTH_REDIRECT_URL';
|
|
4
|
+
const HOSTED_LOGIN_VERIFIER_KEY = 'HOSTED_LOGIN_VERIFIER_KEY';
|
|
4
5
|
const authStoreName = 'auth';
|
|
5
6
|
const connectivityStoreName = 'connectivity';
|
|
6
7
|
const auditsStoreName = 'auditLogs';
|
|
@@ -8,6 +9,7 @@ const subscriptionsStoreName = 'subscriptions';
|
|
|
8
9
|
const vendorStoreName = 'vendor';
|
|
9
10
|
|
|
10
11
|
exports.FRONTEGG_AFTER_AUTH_REDIRECT_URL = FRONTEGG_AFTER_AUTH_REDIRECT_URL;
|
|
12
|
+
exports.HOSTED_LOGIN_VERIFIER_KEY = HOSTED_LOGIN_VERIFIER_KEY;
|
|
11
13
|
exports.auditsStoreName = auditsStoreName;
|
|
12
14
|
exports.authStoreName = authStoreName;
|
|
13
15
|
exports.connectivityStoreName = connectivityStoreName;
|
package/node/index.js
CHANGED
|
@@ -10,8 +10,8 @@ var vendor_index = require('./vendor/index.js');
|
|
|
10
10
|
var saga = require('./saga-b0d1a607.js');
|
|
11
11
|
var toolkit_index = require('./toolkit/index.js');
|
|
12
12
|
var restApi = require('@frontegg/rest-api');
|
|
13
|
-
var constants = require('./constants-
|
|
14
|
-
var saga$1 = require('./saga-
|
|
13
|
+
var constants = require('./constants-52e37c08.js');
|
|
14
|
+
var saga$1 = require('./saga-633c17d2.js');
|
|
15
15
|
var toolkit = require('@reduxjs/toolkit');
|
|
16
16
|
var effects = require('redux-saga/effects');
|
|
17
17
|
var createSagaMiddleware = require('redux-saga');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var effects = require('redux-saga/effects');
|
|
4
4
|
var restApi = require('@frontegg/rest-api');
|
|
5
|
-
var constants = require('./constants-
|
|
5
|
+
var constants = require('./constants-52e37c08.js');
|
|
6
6
|
var toolkit = require('@reduxjs/toolkit');
|
|
7
7
|
|
|
8
8
|
const reducers = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var constants = require('../constants-
|
|
5
|
+
var constants = require('../constants-52e37c08.js');
|
|
6
6
|
var toolkit = require('@reduxjs/toolkit');
|
|
7
7
|
var effects = require('redux-saga/effects');
|
|
8
8
|
var restApi = require('@frontegg/rest-api');
|
|
@@ -51,29 +51,10 @@ const { actions: sliceActions$1, reducer: reducer$7, name: name$6 } = toolkit.cr
|
|
|
51
51
|
});
|
|
52
52
|
const actions$7 = Object.assign({ loadPlans: toolkit.createAction(`${name$6}/loadPlans`) }, sliceActions$1);
|
|
53
53
|
|
|
54
|
-
exports.PaymentProvider = void 0;
|
|
55
|
-
(function (PaymentProvider) {
|
|
56
|
-
PaymentProvider["DEFAULT"] = "Default";
|
|
57
|
-
PaymentProvider["STRIPE"] = "Stripe";
|
|
58
|
-
})(exports.PaymentProvider || (exports.PaymentProvider = {}));
|
|
59
|
-
exports.SubscriptionStatus = void 0;
|
|
60
|
-
(function (SubscriptionStatus) {
|
|
61
|
-
SubscriptionStatus["ACTIVE"] = "ACTIVE";
|
|
62
|
-
SubscriptionStatus["CANCELED"] = "CANCELED";
|
|
63
|
-
SubscriptionStatus["INCOMPLETE"] = "INCOMPLETE";
|
|
64
|
-
SubscriptionStatus["EXPIRED"] = "EXPIRED";
|
|
65
|
-
})(exports.SubscriptionStatus || (exports.SubscriptionStatus = {}));
|
|
66
|
-
exports.SubscriptionCancellationPolicy = void 0;
|
|
67
|
-
(function (SubscriptionCancellationPolicy) {
|
|
68
|
-
SubscriptionCancellationPolicy["AT_PERIOD_END"] = "atPeriodEnd";
|
|
69
|
-
})(exports.SubscriptionCancellationPolicy || (exports.SubscriptionCancellationPolicy = {}));
|
|
70
|
-
|
|
71
54
|
const configInitialState = {
|
|
72
55
|
loading: false,
|
|
73
56
|
error: null,
|
|
74
|
-
config:
|
|
75
|
-
paymentProvider: exports.PaymentProvider.DEFAULT,
|
|
76
|
-
},
|
|
57
|
+
config: null,
|
|
77
58
|
};
|
|
78
59
|
const reducers$5 = Object.assign({}, createModuleCaseReducers());
|
|
79
60
|
const { actions: configActions, reducer: reducer$6, name: name$5 } = toolkit.createSlice({
|
|
@@ -237,6 +218,22 @@ const reducer = toolkit.combineReducers({
|
|
|
237
218
|
stripe: reducer$1,
|
|
238
219
|
});
|
|
239
220
|
|
|
221
|
+
exports.PaymentProvider = void 0;
|
|
222
|
+
(function (PaymentProvider) {
|
|
223
|
+
PaymentProvider["STRIPE"] = "Stripe";
|
|
224
|
+
})(exports.PaymentProvider || (exports.PaymentProvider = {}));
|
|
225
|
+
exports.SubscriptionStatus = void 0;
|
|
226
|
+
(function (SubscriptionStatus) {
|
|
227
|
+
SubscriptionStatus["ACTIVE"] = "ACTIVE";
|
|
228
|
+
SubscriptionStatus["CANCELED"] = "CANCELED";
|
|
229
|
+
SubscriptionStatus["INCOMPLETE"] = "INCOMPLETE";
|
|
230
|
+
SubscriptionStatus["EXPIRED"] = "EXPIRED";
|
|
231
|
+
})(exports.SubscriptionStatus || (exports.SubscriptionStatus = {}));
|
|
232
|
+
exports.SubscriptionCancellationPolicy = void 0;
|
|
233
|
+
(function (SubscriptionCancellationPolicy) {
|
|
234
|
+
SubscriptionCancellationPolicy["AT_PERIOD_END"] = "atPeriodEnd";
|
|
235
|
+
})(exports.SubscriptionCancellationPolicy || (exports.SubscriptionCancellationPolicy = {}));
|
|
236
|
+
|
|
240
237
|
function toPrice(amount) {
|
|
241
238
|
return +(amount / 100).toFixed(2);
|
|
242
239
|
}
|
|
@@ -357,7 +354,7 @@ function* subscriptionBillingInformationSagas() {
|
|
|
357
354
|
yield effects.takeEvery(actions$2.checkoutEvent, checkoutEvent$2);
|
|
358
355
|
}
|
|
359
356
|
function* loadBillingInformation() {
|
|
360
|
-
const paymentProvider = yield effects.select((state) => state.subscriptions.config.config.paymentProvider);
|
|
357
|
+
const paymentProvider = yield effects.select((state) => { var _a; return (_a = state.subscriptions.config.config) === null || _a === void 0 ? void 0 : _a.paymentProvider; });
|
|
361
358
|
const tenantId = yield effects.select((state) => { var _a, _b, _c; return (_c = (_b = (_a = state.auth) === null || _a === void 0 ? void 0 : _a.profileState) === null || _b === void 0 ? void 0 : _b.profile) === null || _c === void 0 ? void 0 : _c.tenantId; });
|
|
362
359
|
yield effects.put(actions$5.setLoading(true));
|
|
363
360
|
if (!paymentProvider || !tenantId) {
|
|
@@ -834,12 +831,12 @@ function* loadPaymentConfigurationMock() {
|
|
|
834
831
|
yield effects.put(actions$6.setLoading(true));
|
|
835
832
|
yield effects.delay(500);
|
|
836
833
|
yield effects.put(actions$6.setState({
|
|
834
|
+
loading: false,
|
|
837
835
|
config: {
|
|
838
836
|
paymentProvider: exports.PaymentProvider.STRIPE,
|
|
839
837
|
apiKey: ''
|
|
840
838
|
},
|
|
841
839
|
}));
|
|
842
|
-
yield effects.put(actions$6.setLoading(true));
|
|
843
840
|
}
|
|
844
841
|
function* configSagasMock() {
|
|
845
842
|
yield effects.takeEvery(actions$6.loadPaymentConfiguration, loadPaymentConfigurationMock);
|
package/node/toolkit/index.js
CHANGED
|
@@ -12,9 +12,9 @@ var saga = require('../saga-b0d1a607.js');
|
|
|
12
12
|
var connectivity_index = require('../connectivity/index.js');
|
|
13
13
|
var subscriptions_index = require('../subscriptions/index.js');
|
|
14
14
|
var vendor_index = require('../vendor/index.js');
|
|
15
|
-
require('../constants-
|
|
15
|
+
require('../constants-52e37c08.js');
|
|
16
16
|
require('tslib');
|
|
17
|
-
require('../saga-
|
|
17
|
+
require('../saga-633c17d2.js');
|
|
18
18
|
require('uuid');
|
|
19
19
|
|
|
20
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
package/node/vendor/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var saga = require('../saga-
|
|
6
|
-
var constants = require('../constants-
|
|
5
|
+
var saga = require('../saga-633c17d2.js');
|
|
6
|
+
var constants = require('../constants-52e37c08.js');
|
|
7
7
|
require('redux-saga/effects');
|
|
8
8
|
require('@frontegg/rest-api');
|
|
9
9
|
require('@reduxjs/toolkit');
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
3
|
"libName": "FronteggReduxStore",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.39.2-dashboard",
|
|
5
5
|
"author": "Frontegg LTD",
|
|
6
6
|
"main": "./node/index.js",
|
|
7
7
|
"module": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@frontegg/rest-api": "2.10.
|
|
10
|
+
"@frontegg/rest-api": "2.10.47",
|
|
11
11
|
"@reduxjs/toolkit": "^1.5.0",
|
|
12
12
|
"redux-saga": "^1.1.0",
|
|
13
13
|
"tslib": "^2.3.1",
|
|
14
14
|
"uuid": "^8.3.0"
|
|
15
15
|
}
|
|
16
|
-
}
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { takeEvery, put } from 'redux-saga/effects';
|
|
2
2
|
import { api } from '@frontegg/rest-api';
|
|
3
|
-
import { v as vendorStoreName } from './constants-
|
|
3
|
+
import { v as vendorStoreName } from './constants-4d9682b2.js';
|
|
4
4
|
import { createAction, createSlice } from '@reduxjs/toolkit';
|
|
5
5
|
|
|
6
6
|
const reducers = {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { PaymentProvider } from '../general.interfaces';
|
|
2
|
-
interface DefaultPaymentProviderConfig {
|
|
3
|
-
paymentProvider: PaymentProvider.DEFAULT;
|
|
4
|
-
}
|
|
5
2
|
interface StripePaymentProviderConfig {
|
|
6
3
|
paymentProvider: PaymentProvider.STRIPE;
|
|
7
4
|
apiKey: string;
|
|
8
5
|
}
|
|
9
|
-
declare type PaymentProviderCustomConfig = StripePaymentProviderConfig
|
|
6
|
+
declare type PaymentProviderCustomConfig = StripePaymentProviderConfig;
|
|
10
7
|
export declare type PaymentProviderConfigState = {
|
|
11
8
|
loading: boolean;
|
|
12
9
|
error: string | null;
|
|
13
|
-
config: PaymentProviderCustomConfig;
|
|
10
|
+
config: PaymentProviderCustomConfig | null;
|
|
14
11
|
};
|
|
15
12
|
export interface PaymentProviderConfigActions {
|
|
16
13
|
loadPaymentConfiguration: () => void;
|
package/subscriptions/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as subscriptionsStoreName } from '../constants-
|
|
2
|
-
export { s as subscriptionsStoreName } from '../constants-
|
|
1
|
+
import { s as subscriptionsStoreName } from '../constants-4d9682b2.js';
|
|
2
|
+
export { s as subscriptionsStoreName } from '../constants-4d9682b2.js';
|
|
3
3
|
import { createSlice, createAction, combineReducers } from '@reduxjs/toolkit';
|
|
4
4
|
import { takeEvery, select, put, call, delay, all } from 'redux-saga/effects';
|
|
5
5
|
import { ISubscriptionStatus, PaymentMethodType as PaymentMethodType$1, api, ProviderType } from '@frontegg/rest-api';
|
|
@@ -48,29 +48,10 @@ const { actions: sliceActions$1, reducer: reducer$7, name: name$6 } = createSlic
|
|
|
48
48
|
});
|
|
49
49
|
const actions$7 = Object.assign({ loadPlans: createAction(`${name$6}/loadPlans`) }, sliceActions$1);
|
|
50
50
|
|
|
51
|
-
var PaymentProvider;
|
|
52
|
-
(function (PaymentProvider) {
|
|
53
|
-
PaymentProvider["DEFAULT"] = "Default";
|
|
54
|
-
PaymentProvider["STRIPE"] = "Stripe";
|
|
55
|
-
})(PaymentProvider || (PaymentProvider = {}));
|
|
56
|
-
var SubscriptionStatus;
|
|
57
|
-
(function (SubscriptionStatus) {
|
|
58
|
-
SubscriptionStatus["ACTIVE"] = "ACTIVE";
|
|
59
|
-
SubscriptionStatus["CANCELED"] = "CANCELED";
|
|
60
|
-
SubscriptionStatus["INCOMPLETE"] = "INCOMPLETE";
|
|
61
|
-
SubscriptionStatus["EXPIRED"] = "EXPIRED";
|
|
62
|
-
})(SubscriptionStatus || (SubscriptionStatus = {}));
|
|
63
|
-
var SubscriptionCancellationPolicy;
|
|
64
|
-
(function (SubscriptionCancellationPolicy) {
|
|
65
|
-
SubscriptionCancellationPolicy["AT_PERIOD_END"] = "atPeriodEnd";
|
|
66
|
-
})(SubscriptionCancellationPolicy || (SubscriptionCancellationPolicy = {}));
|
|
67
|
-
|
|
68
51
|
const configInitialState = {
|
|
69
52
|
loading: false,
|
|
70
53
|
error: null,
|
|
71
|
-
config:
|
|
72
|
-
paymentProvider: PaymentProvider.DEFAULT,
|
|
73
|
-
},
|
|
54
|
+
config: null,
|
|
74
55
|
};
|
|
75
56
|
const reducers$5 = Object.assign({}, createModuleCaseReducers());
|
|
76
57
|
const { actions: configActions, reducer: reducer$6, name: name$5 } = createSlice({
|
|
@@ -234,6 +215,22 @@ const reducer = combineReducers({
|
|
|
234
215
|
stripe: reducer$1,
|
|
235
216
|
});
|
|
236
217
|
|
|
218
|
+
var PaymentProvider;
|
|
219
|
+
(function (PaymentProvider) {
|
|
220
|
+
PaymentProvider["STRIPE"] = "Stripe";
|
|
221
|
+
})(PaymentProvider || (PaymentProvider = {}));
|
|
222
|
+
var SubscriptionStatus;
|
|
223
|
+
(function (SubscriptionStatus) {
|
|
224
|
+
SubscriptionStatus["ACTIVE"] = "ACTIVE";
|
|
225
|
+
SubscriptionStatus["CANCELED"] = "CANCELED";
|
|
226
|
+
SubscriptionStatus["INCOMPLETE"] = "INCOMPLETE";
|
|
227
|
+
SubscriptionStatus["EXPIRED"] = "EXPIRED";
|
|
228
|
+
})(SubscriptionStatus || (SubscriptionStatus = {}));
|
|
229
|
+
var SubscriptionCancellationPolicy;
|
|
230
|
+
(function (SubscriptionCancellationPolicy) {
|
|
231
|
+
SubscriptionCancellationPolicy["AT_PERIOD_END"] = "atPeriodEnd";
|
|
232
|
+
})(SubscriptionCancellationPolicy || (SubscriptionCancellationPolicy = {}));
|
|
233
|
+
|
|
237
234
|
function toPrice(amount) {
|
|
238
235
|
return +(amount / 100).toFixed(2);
|
|
239
236
|
}
|
|
@@ -354,7 +351,7 @@ function* subscriptionBillingInformationSagas() {
|
|
|
354
351
|
yield takeEvery(actions$2.checkoutEvent, checkoutEvent$2);
|
|
355
352
|
}
|
|
356
353
|
function* loadBillingInformation() {
|
|
357
|
-
const paymentProvider = yield select((state) => state.subscriptions.config.config.paymentProvider);
|
|
354
|
+
const paymentProvider = yield select((state) => { var _a; return (_a = state.subscriptions.config.config) === null || _a === void 0 ? void 0 : _a.paymentProvider; });
|
|
358
355
|
const tenantId = yield select((state) => { var _a, _b, _c; return (_c = (_b = (_a = state.auth) === null || _a === void 0 ? void 0 : _a.profileState) === null || _b === void 0 ? void 0 : _b.profile) === null || _c === void 0 ? void 0 : _c.tenantId; });
|
|
359
356
|
yield put(actions$5.setLoading(true));
|
|
360
357
|
if (!paymentProvider || !tenantId) {
|
|
@@ -831,12 +828,12 @@ function* loadPaymentConfigurationMock() {
|
|
|
831
828
|
yield put(actions$6.setLoading(true));
|
|
832
829
|
yield delay(500);
|
|
833
830
|
yield put(actions$6.setState({
|
|
831
|
+
loading: false,
|
|
834
832
|
config: {
|
|
835
833
|
paymentProvider: PaymentProvider.STRIPE,
|
|
836
834
|
apiKey: ''
|
|
837
835
|
},
|
|
838
836
|
}));
|
|
839
|
-
yield put(actions$6.setLoading(true));
|
|
840
837
|
}
|
|
841
838
|
function* configSagasMock() {
|
|
842
839
|
yield takeEvery(actions$6.loadPaymentConfiguration, loadPaymentConfigurationMock);
|
package/toolkit/index.js
CHANGED
|
@@ -11,9 +11,9 @@ import connectivityStore from '../connectivity/index.js';
|
|
|
11
11
|
import subscriptionsStore from '../subscriptions/index.js';
|
|
12
12
|
import vendorStore from '../vendor/index.js';
|
|
13
13
|
import { s as storeName, i as initialState$1, r as reducer, b as sagas } from '../saga-7a267fe0.js';
|
|
14
|
-
import '../constants-
|
|
14
|
+
import '../constants-4d9682b2.js';
|
|
15
15
|
import 'tslib';
|
|
16
|
-
import '../saga-
|
|
16
|
+
import '../saga-b6529ffb.js';
|
|
17
17
|
import 'uuid';
|
|
18
18
|
|
|
19
19
|
const initialState = {
|
package/vendor/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as sagas, i as initialState, r as reducer, a as actions } from '../saga-
|
|
2
|
-
export { a as vendorActions, i as vendorInitialState, r as vendorReducers, s as vendorSagas } from '../saga-
|
|
3
|
-
import { v as vendorStoreName } from '../constants-
|
|
4
|
-
export { v as vendorStoreName } from '../constants-
|
|
1
|
+
import { s as sagas, i as initialState, r as reducer, a as actions } from '../saga-b6529ffb.js';
|
|
2
|
+
export { a as vendorActions, i as vendorInitialState, r as vendorReducers, s as vendorSagas } from '../saga-b6529ffb.js';
|
|
3
|
+
import { v as vendorStoreName } from '../constants-4d9682b2.js';
|
|
4
|
+
export { v as vendorStoreName } from '../constants-4d9682b2.js';
|
|
5
5
|
import 'redux-saga/effects';
|
|
6
6
|
import '@frontegg/rest-api';
|
|
7
7
|
import '@reduxjs/toolkit';
|