@frontegg/redux-store 6.96.0-alpha.0 → 6.96.0-alpha.1
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/CustomLoginState/index.d.ts +113 -0
- package/auth/CustomLoginState/index.js +32 -0
- package/auth/CustomLoginState/interfaces.d.ts +27 -1
- package/auth/CustomLoginState/saga.d.ts +7 -0
- package/auth/CustomLoginState/saga.js +150 -0
- package/auth/ProfileState/saga.d.ts +1 -0
- package/auth/ProfileState/saga.js +1 -1
- package/auth/index.d.ts +5 -0
- package/auth/index.js +1 -0
- package/auth/initialState.js +2 -0
- package/auth/reducer.d.ts +6 -1
- package/auth/reducer.js +3 -2
- package/auth/saga.js +2 -1
- package/index.js +1 -1
- package/node/auth/CustomLoginState/index.js +39 -0
- package/node/auth/CustomLoginState/saga.js +159 -0
- package/node/auth/ProfileState/saga.js +1 -0
- package/node/auth/index.js +12 -0
- package/node/auth/initialState.js +2 -0
- package/node/auth/reducer.js +3 -2
- package/node/auth/saga.js +2 -1
- package/node/index.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { CustomLoginState, UpdateTenantMetadataRequest } from './interfaces';
|
|
2
|
+
import { WithCallback } from '../../interfaces';
|
|
3
|
+
declare const customLoginState: CustomLoginState;
|
|
4
|
+
declare const reducers: {
|
|
5
|
+
setCustomLoginState: {
|
|
6
|
+
prepare: (payload: Partial<CustomLoginState>) => {
|
|
7
|
+
payload: Partial<CustomLoginState>;
|
|
8
|
+
};
|
|
9
|
+
reducer: (state: import("..").AuthState, { payload }: {
|
|
10
|
+
payload: Partial<CustomLoginState>;
|
|
11
|
+
type: string;
|
|
12
|
+
}) => {
|
|
13
|
+
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
14
|
+
error?: any;
|
|
15
|
+
isAuthenticated: boolean;
|
|
16
|
+
userIp?: string | undefined;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
keepSessionAlive?: boolean | undefined;
|
|
19
|
+
user?: import("..").User | null | undefined;
|
|
20
|
+
isSSOAuth: boolean;
|
|
21
|
+
ssoACS?: string | undefined;
|
|
22
|
+
includeQueryParam?: boolean | undefined;
|
|
23
|
+
loginState: import("..").LoginState;
|
|
24
|
+
activateState: import("..").ActivateAccountState;
|
|
25
|
+
acceptInvitationState: import("..").AcceptInvitationState;
|
|
26
|
+
forgotPasswordState: import("..").ForgotPasswordState;
|
|
27
|
+
resetPhoneNumberState: import("..").ResetPhoneNumberState;
|
|
28
|
+
ssoState: import("..").SSOState;
|
|
29
|
+
profileState: import("..").ProfileState;
|
|
30
|
+
mfaState: import("..").MFAState;
|
|
31
|
+
teamState: import("..").TeamState;
|
|
32
|
+
groupsState: import("..").GroupsState;
|
|
33
|
+
groupsDialogsState: import("..").GroupsDialogsState;
|
|
34
|
+
socialLoginState: import("..").SocialLoginState;
|
|
35
|
+
signUpState: import("..").SignUpState;
|
|
36
|
+
apiTokensState: import("..").ApiTokensState;
|
|
37
|
+
securityPolicyState: import("..").SecurityPolicyState;
|
|
38
|
+
restrictionsState: import("..").RestrictionsState;
|
|
39
|
+
provisioningState: import("..").ProvisioningState;
|
|
40
|
+
accountSettingsState: import("..").AccountSettingsState;
|
|
41
|
+
tenantsState: import("..").TenantsState;
|
|
42
|
+
rolesState: import("..").RolesState;
|
|
43
|
+
sessionsState: import("..").SessionsState;
|
|
44
|
+
hostedLoginBox?: boolean | undefined;
|
|
45
|
+
disableSilentRefresh?: boolean | undefined;
|
|
46
|
+
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
47
|
+
impersonateState?: import("..").ImpersonateState | undefined;
|
|
48
|
+
passkeysState?: import("..").PasskeysState | undefined;
|
|
49
|
+
customLoginState?: CustomLoginState | undefined;
|
|
50
|
+
routes: import("..").AuthPageRoutes;
|
|
51
|
+
header?: any;
|
|
52
|
+
loaderComponent?: any;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
resetCustomLoginState: (state: import("..").AuthState) => {
|
|
56
|
+
onRedirectTo: (path: string, opts?: import("@frontegg/rest-api").RedirectOptions | undefined) => void;
|
|
57
|
+
error?: any;
|
|
58
|
+
isAuthenticated: boolean;
|
|
59
|
+
userIp?: string | undefined;
|
|
60
|
+
isLoading: boolean;
|
|
61
|
+
keepSessionAlive?: boolean | undefined;
|
|
62
|
+
user?: import("..").User | null | undefined;
|
|
63
|
+
isSSOAuth: boolean;
|
|
64
|
+
ssoACS?: string | undefined;
|
|
65
|
+
includeQueryParam?: boolean | undefined;
|
|
66
|
+
loginState: import("..").LoginState;
|
|
67
|
+
activateState: import("..").ActivateAccountState;
|
|
68
|
+
acceptInvitationState: import("..").AcceptInvitationState;
|
|
69
|
+
forgotPasswordState: import("..").ForgotPasswordState;
|
|
70
|
+
resetPhoneNumberState: import("..").ResetPhoneNumberState;
|
|
71
|
+
ssoState: import("..").SSOState;
|
|
72
|
+
profileState: import("..").ProfileState;
|
|
73
|
+
mfaState: import("..").MFAState;
|
|
74
|
+
teamState: import("..").TeamState;
|
|
75
|
+
groupsState: import("..").GroupsState;
|
|
76
|
+
groupsDialogsState: import("..").GroupsDialogsState;
|
|
77
|
+
socialLoginState: import("..").SocialLoginState;
|
|
78
|
+
signUpState: import("..").SignUpState;
|
|
79
|
+
apiTokensState: import("..").ApiTokensState;
|
|
80
|
+
securityPolicyState: import("..").SecurityPolicyState;
|
|
81
|
+
restrictionsState: import("..").RestrictionsState;
|
|
82
|
+
provisioningState: import("..").ProvisioningState;
|
|
83
|
+
accountSettingsState: import("..").AccountSettingsState;
|
|
84
|
+
tenantsState: import("..").TenantsState;
|
|
85
|
+
rolesState: import("..").RolesState;
|
|
86
|
+
sessionsState: import("..").SessionsState;
|
|
87
|
+
hostedLoginBox?: boolean | undefined;
|
|
88
|
+
disableSilentRefresh?: boolean | undefined;
|
|
89
|
+
sessionsPolicyState: import("..").SessionsPolicyState;
|
|
90
|
+
impersonateState?: import("..").ImpersonateState | undefined;
|
|
91
|
+
passkeysState?: import("..").PasskeysState | undefined;
|
|
92
|
+
customLoginState?: CustomLoginState | undefined;
|
|
93
|
+
routes: import("..").AuthPageRoutes;
|
|
94
|
+
header?: any;
|
|
95
|
+
loaderComponent?: any;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
declare const actions: {
|
|
99
|
+
loadTenantMetadata: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
100
|
+
updateTenantMetadata: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[WithCallback<Partial<UpdateTenantMetadataRequest>, boolean>], WithCallback<Partial<UpdateTenantMetadataRequest>, boolean>, string, never, never>;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* To be used for actions types after dispatch, and should contains
|
|
104
|
+
* the reducers and actions as standalone function
|
|
105
|
+
*/
|
|
106
|
+
declare type DispatchedActions = {
|
|
107
|
+
setCustomLoginState: (state: Partial<CustomLoginState>) => void;
|
|
108
|
+
resetCustomLoginState: () => void;
|
|
109
|
+
loadTenantMetadata: () => void;
|
|
110
|
+
updateTenantMetadata: (payload: WithCallback<Partial<UpdateTenantMetadataRequest>>) => void;
|
|
111
|
+
};
|
|
112
|
+
export declare type CustomLoginActions = DispatchedActions;
|
|
113
|
+
export { customLoginState, reducers as customLoginReducers, actions as customLoginActions };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { resetStateByKey, typeReducerForKey } from '../utils';
|
|
3
|
+
import { authStoreName } from '../../constants';
|
|
4
|
+
const customLoginState = {
|
|
5
|
+
loading: false,
|
|
6
|
+
error: null
|
|
7
|
+
};
|
|
8
|
+
const reducers = {
|
|
9
|
+
setCustomLoginState: typeReducerForKey('customLoginState'),
|
|
10
|
+
resetCustomLoginState: resetStateByKey('customLoginState', {
|
|
11
|
+
customLoginState
|
|
12
|
+
})
|
|
13
|
+
};
|
|
14
|
+
const actions = {
|
|
15
|
+
loadTenantMetadata: createAction(`${authStoreName}/loadTenantMetadata`),
|
|
16
|
+
updateTenantMetadata: createAction(`${authStoreName}/updateTenantMetadata`, payload => ({
|
|
17
|
+
payload
|
|
18
|
+
}))
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* To be used for actions types after dispatch, and should contains
|
|
23
|
+
* the reducers and actions as standalone function
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// noinspection JSUnusedLocalSymbols
|
|
27
|
+
/**
|
|
28
|
+
* if you see error in matcher that's mean the DispatchAction does not
|
|
29
|
+
* contains the same functions in reducers and actions
|
|
30
|
+
*/
|
|
31
|
+
const Matcher = {};
|
|
32
|
+
export { customLoginState, reducers as customLoginReducers, actions as customLoginActions };
|
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
export interface CustomLoginState {
|
|
2
|
-
|
|
2
|
+
error?: string | null;
|
|
3
|
+
loading?: boolean;
|
|
4
|
+
saving?: boolean;
|
|
5
|
+
customLoginEnabled?: boolean;
|
|
6
|
+
tenantMetadata?: any;
|
|
7
|
+
}
|
|
8
|
+
export interface UpdateTenantMetadataRequest {
|
|
9
|
+
loginBox: {
|
|
10
|
+
logo?: {
|
|
11
|
+
image: string;
|
|
12
|
+
};
|
|
13
|
+
palette?: {
|
|
14
|
+
primary?: {
|
|
15
|
+
main: string;
|
|
16
|
+
dark: string;
|
|
17
|
+
light: string;
|
|
18
|
+
hover: string;
|
|
19
|
+
active: string;
|
|
20
|
+
contrastText: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
socialLogins?: {
|
|
24
|
+
socialLoginsLayout: {
|
|
25
|
+
placement: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
3
29
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CustomLoginState } from './interfaces';
|
|
2
|
+
export declare function loadTenantMetadata(): Generator<import("redux-saga/effects").CallEffect<any> | import("redux-saga/effects").PutEffect<{
|
|
3
|
+
payload: Partial<CustomLoginState>;
|
|
4
|
+
type: string;
|
|
5
|
+
}>, void, any>;
|
|
6
|
+
export declare function customLoginSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
7
|
+
export declare function customLoginSagasMock(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["callback"],
|
|
4
|
+
_excluded2 = ["callback"];
|
|
5
|
+
import { api } from '@frontegg/rest-api';
|
|
6
|
+
import { getAdminBoxMetadata, updateAdminBoxMetadata } from '@frontegg/rest-api/metadata';
|
|
7
|
+
import { call, put, takeLeading } from 'redux-saga/effects';
|
|
8
|
+
import { actions } from '../reducer';
|
|
9
|
+
import { delay } from '../utils';
|
|
10
|
+
import { base64ToFormData } from '../ProfileState/saga';
|
|
11
|
+
export function* loadTenantMetadata() {
|
|
12
|
+
yield put(actions.setCustomLoginState({
|
|
13
|
+
loading: true
|
|
14
|
+
}));
|
|
15
|
+
try {
|
|
16
|
+
const tenantMetadata = yield call(getAdminBoxMetadata);
|
|
17
|
+
yield put(actions.setCustomLoginState({
|
|
18
|
+
tenantMetadata,
|
|
19
|
+
loading: false
|
|
20
|
+
}));
|
|
21
|
+
} catch (e) {
|
|
22
|
+
yield put(actions.setCustomLoginState({
|
|
23
|
+
loading: false,
|
|
24
|
+
error: e.message
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const mapObjectToActions = (obj, path = []) => {
|
|
29
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
30
|
+
if (typeof value === 'object') {
|
|
31
|
+
return [...acc, ...mapObjectToActions(value, [...path, key])];
|
|
32
|
+
}
|
|
33
|
+
return [...acc, {
|
|
34
|
+
type: [...path, key].join('/'),
|
|
35
|
+
payload: value
|
|
36
|
+
}];
|
|
37
|
+
}, []);
|
|
38
|
+
};
|
|
39
|
+
function* uploadLogo(logo) {
|
|
40
|
+
const isLogoInBase64 = logo.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);
|
|
41
|
+
if (isLogoInBase64) {
|
|
42
|
+
const logoFormData = base64ToFormData(logo, 'image');
|
|
43
|
+
if (logoFormData) {
|
|
44
|
+
// TODO: replace updateProfileImage with new backend upload logo route (not implemented yet)
|
|
45
|
+
let logoUrl = yield call(api.teams.updateProfileImage, logoFormData);
|
|
46
|
+
if (logoUrl) {
|
|
47
|
+
const imageTimeStamp = Date.now().toString();
|
|
48
|
+
const urlTemplate = new URL(logoUrl);
|
|
49
|
+
urlTemplate.searchParams.set('t', imageTimeStamp);
|
|
50
|
+
logoUrl = urlTemplate.href;
|
|
51
|
+
return logoUrl;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function* updateTenantMetadata(_ref) {
|
|
57
|
+
let {
|
|
58
|
+
payload: {
|
|
59
|
+
callback
|
|
60
|
+
}
|
|
61
|
+
} = _ref,
|
|
62
|
+
state = _objectWithoutPropertiesLoose(_ref.payload, _excluded);
|
|
63
|
+
try {
|
|
64
|
+
var _loginBox$logo;
|
|
65
|
+
yield put(actions.setCustomLoginState({
|
|
66
|
+
error: null,
|
|
67
|
+
saving: true
|
|
68
|
+
}));
|
|
69
|
+
const {
|
|
70
|
+
loginBox
|
|
71
|
+
} = state;
|
|
72
|
+
if (!loginBox) {
|
|
73
|
+
throw new Error('no changes to update');
|
|
74
|
+
}
|
|
75
|
+
let calculatedState = state;
|
|
76
|
+
if ((_loginBox$logo = loginBox.logo) != null && _loginBox$logo.image) {
|
|
77
|
+
const logoUrl = yield uploadLogo(loginBox.logo.image);
|
|
78
|
+
if (logoUrl) {
|
|
79
|
+
calculatedState = {
|
|
80
|
+
loginBox: _extends({}, calculatedState.loginBox, {
|
|
81
|
+
logo: {
|
|
82
|
+
image: logoUrl
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
} else {
|
|
87
|
+
throw new Error('could not upload logo');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const requestActions = mapObjectToActions(calculatedState);
|
|
91
|
+
if (requestActions.length === 0) {
|
|
92
|
+
throw new Error('no changes to update');
|
|
93
|
+
}
|
|
94
|
+
yield call(updateAdminBoxMetadata, {
|
|
95
|
+
actions: requestActions
|
|
96
|
+
});
|
|
97
|
+
const tenantMetadata = yield call(getAdminBoxMetadata);
|
|
98
|
+
yield put(actions.setCustomLoginState({
|
|
99
|
+
tenantMetadata,
|
|
100
|
+
saving: false
|
|
101
|
+
}));
|
|
102
|
+
callback == null ? void 0 : callback(true);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
yield put(actions.setCustomLoginState({
|
|
105
|
+
error: e.message,
|
|
106
|
+
saving: false
|
|
107
|
+
}));
|
|
108
|
+
callback == null ? void 0 : callback(null, e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export function* customLoginSagas() {
|
|
112
|
+
yield takeLeading(actions.loadTenantMetadata, loadTenantMetadata);
|
|
113
|
+
yield takeLeading(actions.updateTenantMetadata, updateTenantMetadata);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// /*********************************
|
|
117
|
+
// * Preview Sagas
|
|
118
|
+
// *********************************/
|
|
119
|
+
|
|
120
|
+
function* loadCustomLoginStateMock() {
|
|
121
|
+
yield put(actions.setCustomLoginState({
|
|
122
|
+
loading: true
|
|
123
|
+
}));
|
|
124
|
+
yield delay();
|
|
125
|
+
yield put(actions.setCustomLoginState({
|
|
126
|
+
loading: false
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
function* updateCustomLoginMetadataMock(_ref2) {
|
|
130
|
+
let {
|
|
131
|
+
payload: {
|
|
132
|
+
callback
|
|
133
|
+
}
|
|
134
|
+
} = _ref2,
|
|
135
|
+
payload = _objectWithoutPropertiesLoose(_ref2.payload, _excluded2);
|
|
136
|
+
yield put(actions.setCustomLoginState({
|
|
137
|
+
loading: true,
|
|
138
|
+
error: null
|
|
139
|
+
}));
|
|
140
|
+
yield delay();
|
|
141
|
+
yield put(actions.setCustomLoginState({
|
|
142
|
+
loading: false,
|
|
143
|
+
error: null
|
|
144
|
+
}));
|
|
145
|
+
callback == null ? void 0 : callback(true);
|
|
146
|
+
}
|
|
147
|
+
export function* customLoginSagasMock() {
|
|
148
|
+
yield takeLeading(actions.loadTenantMetadata, loadCustomLoginStateMock);
|
|
149
|
+
yield takeLeading(actions.updateTenantMetadata, updateCustomLoginMetadataMock);
|
|
150
|
+
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
export declare function base64ToFormData(base64: string, key?: string): FormData | null;
|
|
1
2
|
export declare function profileSagas(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
2
3
|
export declare function profileSagasMock(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
|
@@ -42,7 +42,7 @@ function b64toBlob(base64, contentType) {
|
|
|
42
42
|
type: contentType
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
function base64ToFormData(base64, key = 'file') {
|
|
45
|
+
export function base64ToFormData(base64, key = 'file') {
|
|
46
46
|
const matchResult = base64.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);
|
|
47
47
|
if (matchResult == null) {
|
|
48
48
|
return null;
|
package/auth/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export * from './Provisioning';
|
|
|
50
50
|
export * from './Provisioning/interfaces';
|
|
51
51
|
export * from './PasskeysState';
|
|
52
52
|
export * from './PasskeysState/interfaces';
|
|
53
|
+
export * from './CustomLoginState';
|
|
53
54
|
export * from './CustomLoginState/interfaces';
|
|
54
55
|
export * from './Helpers';
|
|
55
56
|
export type { AuthActions } from './reducer';
|
|
@@ -398,6 +399,8 @@ declare const _default: {
|
|
|
398
399
|
}, boolean>, string, never, never>;
|
|
399
400
|
createSamlGroup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").ICreateSamlGroup, boolean>], import("..").WithCallback<import("@frontegg/rest-api").ICreateSamlGroup, boolean>, string, never, never>;
|
|
400
401
|
oidcPostlogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").IOidcPostLogin], import("@frontegg/rest-api").IOidcPostLogin, string, never, never>;
|
|
402
|
+
loadTenantMetadata: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
403
|
+
updateTenantMetadata: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<import("./CustomLoginState/interfaces").UpdateTenantMetadataRequest>, boolean>], import("..").WithCallback<Partial<import("./CustomLoginState/interfaces").UpdateTenantMetadataRequest>, boolean>, string, never, never>;
|
|
401
404
|
loadProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
402
405
|
saveProfile: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("..").WithCallback<import("@frontegg/rest-api").IUserProfile, import("@frontegg/rest-api").IUserProfile>>], Partial<import("..").WithCallback<import("@frontegg/rest-api").IUserProfile, import("@frontegg/rest-api").IUserProfile>>, string, never, never>;
|
|
403
406
|
changePassword: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IChangePassword, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IChangePassword, boolean>, string, never, never>;
|
|
@@ -597,6 +600,8 @@ declare const _default: {
|
|
|
597
600
|
setSSOError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("./SSOState/interfaces").SSOStateIndicator], import("./SSOState/interfaces").SSOStateIndicator, string, never, never>;
|
|
598
601
|
setSSOState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./SSOState/interfaces").SSOState>], Partial<import("./SSOState/interfaces").SSOState>, string, never, never>;
|
|
599
602
|
resetSSOState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
603
|
+
setCustomLoginState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./CustomLoginState/interfaces").CustomLoginState>], Partial<import("./CustomLoginState/interfaces").CustomLoginState>, string, never, never>;
|
|
604
|
+
resetCustomLoginState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
600
605
|
setProfileState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./ProfileState/interfaces").ProfileState>], Partial<import("./ProfileState/interfaces").ProfileState>, string, never, never>;
|
|
601
606
|
resetProfileState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
602
607
|
setSignUpState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("./SignUp/interfaces").SignUpState>], Partial<import("./SignUp/interfaces").SignUpState>, string, never, never>;
|
package/auth/index.js
CHANGED
|
@@ -52,6 +52,7 @@ export * from './Provisioning';
|
|
|
52
52
|
export * from './Provisioning/interfaces';
|
|
53
53
|
export * from './PasskeysState';
|
|
54
54
|
export * from './PasskeysState/interfaces';
|
|
55
|
+
export * from './CustomLoginState';
|
|
55
56
|
export * from './CustomLoginState/interfaces';
|
|
56
57
|
export * from './Helpers';
|
|
57
58
|
export { sagas as authSagas, mockSagas as authMockSagas, reducer as authReducers, actions as authActions, initialState as authInitialState, storeName as authStoreName };
|
package/auth/initialState.js
CHANGED
|
@@ -22,6 +22,7 @@ import { provisioningState } from './Provisioning';
|
|
|
22
22
|
import { passkeysState } from './PasskeysState';
|
|
23
23
|
import { groupsState } from './GroupsState';
|
|
24
24
|
import { groupsDialogsState } from './GroupsState/groupsDialogsState';
|
|
25
|
+
import { customLoginState } from './CustomLoginState';
|
|
25
26
|
export const reinitializeState = {
|
|
26
27
|
isAuthenticated: false,
|
|
27
28
|
isLoading: true,
|
|
@@ -34,6 +35,7 @@ export const reinitializeState = {
|
|
|
34
35
|
forgotPasswordState,
|
|
35
36
|
ssoState,
|
|
36
37
|
profileState,
|
|
38
|
+
customLoginState,
|
|
37
39
|
mfaState,
|
|
38
40
|
teamState,
|
|
39
41
|
groupsState,
|
package/auth/reducer.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { ImpersonateActions } from './ImpersonationState';
|
|
|
22
22
|
import { PasskeysActions } from './PasskeysState';
|
|
23
23
|
import { GroupsActions } from './GroupsState';
|
|
24
24
|
import { GroupsDialogsActions } from './GroupsState/groupsDialogsState';
|
|
25
|
+
import { CustomLoginActions } from './CustomLoginState';
|
|
25
26
|
declare const reducer: import("redux").Reducer<AuthState, import("redux").AnyAction>;
|
|
26
27
|
declare const actions: {
|
|
27
28
|
loadWebAuthnDevices: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
@@ -361,6 +362,8 @@ declare const actions: {
|
|
|
361
362
|
}, boolean>, string, never, never>;
|
|
362
363
|
createSamlGroup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").ICreateSamlGroup, boolean>], import("..").WithCallback<import("@frontegg/rest-api").ICreateSamlGroup, boolean>, string, never, never>;
|
|
363
364
|
oidcPostlogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").IOidcPostLogin], import("@frontegg/rest-api").IOidcPostLogin, string, never, never>;
|
|
365
|
+
loadTenantMetadata: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
366
|
+
updateTenantMetadata: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<Partial<import(".").UpdateTenantMetadataRequest>, boolean>], import("..").WithCallback<Partial<import(".").UpdateTenantMetadataRequest>, boolean>, string, never, never>;
|
|
364
367
|
loadProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
365
368
|
saveProfile: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import("..").WithCallback<import("@frontegg/rest-api").IUserProfile, import("@frontegg/rest-api").IUserProfile>>], Partial<import("..").WithCallback<import("@frontegg/rest-api").IUserProfile, import("@frontegg/rest-api").IUserProfile>>, string, never, never>;
|
|
366
369
|
changePassword: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("..").WithCallback<import("@frontegg/rest-api").IChangePassword, boolean>], import("..").WithCallback<import("@frontegg/rest-api").IChangePassword, boolean>, string, never, never>;
|
|
@@ -560,6 +563,8 @@ declare const actions: {
|
|
|
560
563
|
setSSOError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import(".").SSOStateIndicator], import(".").SSOStateIndicator, string, never, never>;
|
|
561
564
|
setSSOState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import(".").SSOState>], Partial<import(".").SSOState>, string, never, never>;
|
|
562
565
|
resetSSOState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
566
|
+
setCustomLoginState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import(".").CustomLoginState>], Partial<import(".").CustomLoginState>, string, never, never>;
|
|
567
|
+
resetCustomLoginState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
563
568
|
setProfileState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import(".").ProfileState>], Partial<import(".").ProfileState>, string, never, never>;
|
|
564
569
|
resetProfileState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
565
570
|
setSignUpState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[Partial<import(".").SignUpState>], Partial<import(".").SignUpState>, string, never, never>;
|
|
@@ -588,5 +593,5 @@ export declare type RootActions = {
|
|
|
588
593
|
resetState: () => void;
|
|
589
594
|
setUser: (user: User) => void;
|
|
590
595
|
};
|
|
591
|
-
export declare type AuthActions = RootActions & LoginActions & SocialLoginActions & ActivateAccountActions & ImpersonateActions & AcceptInvitationActions & ForgotPasswordActions & ResetPhoneNumberActions & SignUpActions & ProfileActions & SSOActions & MfaActions & TeamActions & GroupsActions & GroupsDialogsActions & ApiTokensActions & SecurityPolicyActions & AccountSettingsActions & TenantsActions & RolesActions & SessionsActions & RestrictionsActions & ProvisioningActions & PasskeysActions;
|
|
596
|
+
export declare type AuthActions = RootActions & LoginActions & SocialLoginActions & ActivateAccountActions & ImpersonateActions & AcceptInvitationActions & ForgotPasswordActions & ResetPhoneNumberActions & SignUpActions & ProfileActions & CustomLoginActions & SSOActions & MfaActions & TeamActions & GroupsActions & GroupsDialogsActions & ApiTokensActions & SecurityPolicyActions & AccountSettingsActions & TenantsActions & RolesActions & SessionsActions & RestrictionsActions & ProvisioningActions & PasskeysActions;
|
|
592
597
|
export { reducer, actions };
|
package/auth/reducer.js
CHANGED
|
@@ -27,6 +27,7 @@ import { impersonateActions, impersonateReducers } from './ImpersonationState';
|
|
|
27
27
|
import { passkeysActions, passkeysReducers } from './PasskeysState';
|
|
28
28
|
import { groupsActions, groupsReducers } from './GroupsState';
|
|
29
29
|
import { groupsDialogsActions, groupsDialogsReducers } from './GroupsState/groupsDialogsState';
|
|
30
|
+
import { customLoginActions, customLoginReducers } from './CustomLoginState';
|
|
30
31
|
const {
|
|
31
32
|
reducer,
|
|
32
33
|
actions: sliceActions
|
|
@@ -39,7 +40,7 @@ const {
|
|
|
39
40
|
payload
|
|
40
41
|
}) => _extends({}, state, payload),
|
|
41
42
|
setUser: typeReducer('user')
|
|
42
|
-
}, loginReducers, socialLoginsReducer, activateAccountReducers, impersonateReducers, acceptInvitationReducers, forgotPasswordReducers, resetPhoneNumberReducers, signUpReducers, profileReducers, ssoReducers, mfaReducers, teamReducers, groupsReducers, groupsDialogsReducers, apiTokensReducers, securityPolicyReducers, accountSettingsReducers, tenantsReducers, rolesReducers, sessionsReducers, sessionsPolicyReducers, restrictionsReducers, provisioningReducers, passkeysReducers)
|
|
43
|
+
}, loginReducers, socialLoginsReducer, activateAccountReducers, impersonateReducers, acceptInvitationReducers, forgotPasswordReducers, resetPhoneNumberReducers, signUpReducers, profileReducers, customLoginReducers, ssoReducers, mfaReducers, teamReducers, groupsReducers, groupsDialogsReducers, apiTokensReducers, securityPolicyReducers, accountSettingsReducers, tenantsReducers, rolesReducers, sessionsReducers, sessionsPolicyReducers, restrictionsReducers, provisioningReducers, passkeysReducers)
|
|
43
44
|
});
|
|
44
|
-
const actions = _extends({}, sliceActions, loginActions, socialLoginsActions, activateAccountActions, acceptInvitationActions, forgotPasswordActions, resetPhoneNumberActions, signUpActions, profileActions, ssoActions, mfaActions, teamActions, groupsActions, groupsDialogsActions, apiTokensActions, securityPolicyActions, accountSettingsActions, tenantsActions, rolesActions, sessionsActions, sessionsPolicyActions, restrictionsActions, provisioningActions, impersonateActions, passkeysActions);
|
|
45
|
+
const actions = _extends({}, sliceActions, loginActions, socialLoginsActions, activateAccountActions, acceptInvitationActions, forgotPasswordActions, resetPhoneNumberActions, signUpActions, profileActions, customLoginActions, ssoActions, mfaActions, teamActions, groupsActions, groupsDialogsActions, apiTokensActions, securityPolicyActions, accountSettingsActions, tenantsActions, rolesActions, sessionsActions, sessionsPolicyActions, restrictionsActions, provisioningActions, impersonateActions, passkeysActions);
|
|
45
46
|
export { reducer, actions };
|
package/auth/saga.js
CHANGED
|
@@ -23,8 +23,9 @@ import { provisionSagas } from './Provisioning/saga';
|
|
|
23
23
|
import { impersonateSagas } from './ImpersonationState/saga';
|
|
24
24
|
import { passkeysSagas } from './PasskeysState/saga';
|
|
25
25
|
import { groupsSagas, groupsSagasMock } from './GroupsState/saga';
|
|
26
|
+
import { customLoginSagas } from './CustomLoginState/saga';
|
|
26
27
|
export function* sagas() {
|
|
27
|
-
yield all([call(loginSagas), call(activateSagas), call(acceptInvitationSagas), call(forgotPasswordSagas), call(resetPhoneNumberSagas), call(ssoSagas), call(ssoSagasV2), call(profileSagas), call(mfaSagas), call(teamSagas), call(groupsSagas), call(socialLoginsSaga), call(signUpSaga), call(apiTokensSaga), call(securityPolicySagas), call(accountSettingsSaga), call(tenantsSagas), call(rolesSagas), call(sessionsSaga), call(sessionsPolicySaga), call(restrictionsSagas), call(provisionSagas), call(impersonateSagas), call(passkeysSagas)]);
|
|
28
|
+
yield all([call(loginSagas), call(activateSagas), call(acceptInvitationSagas), call(forgotPasswordSagas), call(resetPhoneNumberSagas), call(ssoSagas), call(ssoSagasV2), call(profileSagas), call(customLoginSagas), call(mfaSagas), call(teamSagas), call(groupsSagas), call(socialLoginsSaga), call(signUpSaga), call(apiTokensSaga), call(securityPolicySagas), call(accountSettingsSaga), call(tenantsSagas), call(rolesSagas), call(sessionsSaga), call(sessionsPolicySaga), call(restrictionsSagas), call(provisionSagas), call(impersonateSagas), call(passkeysSagas)]);
|
|
28
29
|
}
|
|
29
30
|
export function* mockSagas() {
|
|
30
31
|
yield all([call(loginSagasMock),
|
package/index.js
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.customLoginState = exports.customLoginReducers = exports.customLoginActions = void 0;
|
|
7
|
+
var _toolkit = require("@reduxjs/toolkit");
|
|
8
|
+
var _utils = require("../utils");
|
|
9
|
+
var _constants = require("../../constants");
|
|
10
|
+
const customLoginState = {
|
|
11
|
+
loading: false,
|
|
12
|
+
error: null
|
|
13
|
+
};
|
|
14
|
+
exports.customLoginState = customLoginState;
|
|
15
|
+
const reducers = {
|
|
16
|
+
setCustomLoginState: (0, _utils.typeReducerForKey)('customLoginState'),
|
|
17
|
+
resetCustomLoginState: (0, _utils.resetStateByKey)('customLoginState', {
|
|
18
|
+
customLoginState
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
exports.customLoginReducers = reducers;
|
|
22
|
+
const actions = {
|
|
23
|
+
loadTenantMetadata: (0, _toolkit.createAction)(`${_constants.authStoreName}/loadTenantMetadata`),
|
|
24
|
+
updateTenantMetadata: (0, _toolkit.createAction)(`${_constants.authStoreName}/updateTenantMetadata`, payload => ({
|
|
25
|
+
payload
|
|
26
|
+
}))
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* To be used for actions types after dispatch, and should contains
|
|
31
|
+
* the reducers and actions as standalone function
|
|
32
|
+
*/
|
|
33
|
+
exports.customLoginActions = actions;
|
|
34
|
+
// noinspection JSUnusedLocalSymbols
|
|
35
|
+
/**
|
|
36
|
+
* if you see error in matcher that's mean the DispatchAction does not
|
|
37
|
+
* contains the same functions in reducers and actions
|
|
38
|
+
*/
|
|
39
|
+
const Matcher = {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.customLoginSagas = customLoginSagas;
|
|
8
|
+
exports.customLoginSagasMock = customLoginSagasMock;
|
|
9
|
+
exports.loadTenantMetadata = loadTenantMetadata;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var _restApi = require("@frontegg/rest-api");
|
|
13
|
+
var _metadata = require("@frontegg/rest-api/metadata");
|
|
14
|
+
var _effects = require("redux-saga/effects");
|
|
15
|
+
var _reducer = require("../reducer");
|
|
16
|
+
var _utils = require("../utils");
|
|
17
|
+
var _saga = require("../ProfileState/saga");
|
|
18
|
+
const _excluded = ["callback"],
|
|
19
|
+
_excluded2 = ["callback"];
|
|
20
|
+
function* loadTenantMetadata() {
|
|
21
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
22
|
+
loading: true
|
|
23
|
+
}));
|
|
24
|
+
try {
|
|
25
|
+
const tenantMetadata = yield (0, _effects.call)(_metadata.getAdminBoxMetadata);
|
|
26
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
27
|
+
tenantMetadata,
|
|
28
|
+
loading: false
|
|
29
|
+
}));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
32
|
+
loading: false,
|
|
33
|
+
error: e.message
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const mapObjectToActions = (obj, path = []) => {
|
|
38
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
39
|
+
if (typeof value === 'object') {
|
|
40
|
+
return [...acc, ...mapObjectToActions(value, [...path, key])];
|
|
41
|
+
}
|
|
42
|
+
return [...acc, {
|
|
43
|
+
type: [...path, key].join('/'),
|
|
44
|
+
payload: value
|
|
45
|
+
}];
|
|
46
|
+
}, []);
|
|
47
|
+
};
|
|
48
|
+
function* uploadLogo(logo) {
|
|
49
|
+
const isLogoInBase64 = logo.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);
|
|
50
|
+
if (isLogoInBase64) {
|
|
51
|
+
const logoFormData = (0, _saga.base64ToFormData)(logo, 'image');
|
|
52
|
+
if (logoFormData) {
|
|
53
|
+
// TODO: replace updateProfileImage with new backend upload logo route (not implemented yet)
|
|
54
|
+
let logoUrl = yield (0, _effects.call)(_restApi.api.teams.updateProfileImage, logoFormData);
|
|
55
|
+
if (logoUrl) {
|
|
56
|
+
const imageTimeStamp = Date.now().toString();
|
|
57
|
+
const urlTemplate = new URL(logoUrl);
|
|
58
|
+
urlTemplate.searchParams.set('t', imageTimeStamp);
|
|
59
|
+
logoUrl = urlTemplate.href;
|
|
60
|
+
return logoUrl;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function* updateTenantMetadata(_ref) {
|
|
66
|
+
let {
|
|
67
|
+
payload: {
|
|
68
|
+
callback
|
|
69
|
+
}
|
|
70
|
+
} = _ref,
|
|
71
|
+
state = (0, _objectWithoutPropertiesLoose2.default)(_ref.payload, _excluded);
|
|
72
|
+
try {
|
|
73
|
+
var _loginBox$logo;
|
|
74
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
75
|
+
error: null,
|
|
76
|
+
saving: true
|
|
77
|
+
}));
|
|
78
|
+
const {
|
|
79
|
+
loginBox
|
|
80
|
+
} = state;
|
|
81
|
+
if (!loginBox) {
|
|
82
|
+
throw new Error('no changes to update');
|
|
83
|
+
}
|
|
84
|
+
let calculatedState = state;
|
|
85
|
+
if ((_loginBox$logo = loginBox.logo) != null && _loginBox$logo.image) {
|
|
86
|
+
const logoUrl = yield uploadLogo(loginBox.logo.image);
|
|
87
|
+
if (logoUrl) {
|
|
88
|
+
calculatedState = {
|
|
89
|
+
loginBox: (0, _extends2.default)({}, calculatedState.loginBox, {
|
|
90
|
+
logo: {
|
|
91
|
+
image: logoUrl
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
};
|
|
95
|
+
} else {
|
|
96
|
+
throw new Error('could not upload logo');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const requestActions = mapObjectToActions(calculatedState);
|
|
100
|
+
if (requestActions.length === 0) {
|
|
101
|
+
throw new Error('no changes to update');
|
|
102
|
+
}
|
|
103
|
+
yield (0, _effects.call)(_metadata.updateAdminBoxMetadata, {
|
|
104
|
+
actions: requestActions
|
|
105
|
+
});
|
|
106
|
+
const tenantMetadata = yield (0, _effects.call)(_metadata.getAdminBoxMetadata);
|
|
107
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
108
|
+
tenantMetadata,
|
|
109
|
+
saving: false
|
|
110
|
+
}));
|
|
111
|
+
callback == null ? void 0 : callback(true);
|
|
112
|
+
} catch (e) {
|
|
113
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
114
|
+
error: e.message,
|
|
115
|
+
saving: false
|
|
116
|
+
}));
|
|
117
|
+
callback == null ? void 0 : callback(null, e);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function* customLoginSagas() {
|
|
121
|
+
yield (0, _effects.takeLeading)(_reducer.actions.loadTenantMetadata, loadTenantMetadata);
|
|
122
|
+
yield (0, _effects.takeLeading)(_reducer.actions.updateTenantMetadata, updateTenantMetadata);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// /*********************************
|
|
126
|
+
// * Preview Sagas
|
|
127
|
+
// *********************************/
|
|
128
|
+
|
|
129
|
+
function* loadCustomLoginStateMock() {
|
|
130
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
131
|
+
loading: true
|
|
132
|
+
}));
|
|
133
|
+
yield (0, _utils.delay)();
|
|
134
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
135
|
+
loading: false
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
function* updateCustomLoginMetadataMock(_ref2) {
|
|
139
|
+
let {
|
|
140
|
+
payload: {
|
|
141
|
+
callback
|
|
142
|
+
}
|
|
143
|
+
} = _ref2,
|
|
144
|
+
payload = (0, _objectWithoutPropertiesLoose2.default)(_ref2.payload, _excluded2);
|
|
145
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
146
|
+
loading: true,
|
|
147
|
+
error: null
|
|
148
|
+
}));
|
|
149
|
+
yield (0, _utils.delay)();
|
|
150
|
+
yield (0, _effects.put)(_reducer.actions.setCustomLoginState({
|
|
151
|
+
loading: false,
|
|
152
|
+
error: null
|
|
153
|
+
}));
|
|
154
|
+
callback == null ? void 0 : callback(true);
|
|
155
|
+
}
|
|
156
|
+
function* customLoginSagasMock() {
|
|
157
|
+
yield (0, _effects.takeLeading)(_reducer.actions.loadTenantMetadata, loadCustomLoginStateMock);
|
|
158
|
+
yield (0, _effects.takeLeading)(_reducer.actions.updateTenantMetadata, updateCustomLoginMetadataMock);
|
|
159
|
+
}
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.base64ToFormData = base64ToFormData;
|
|
7
8
|
exports.profileSagas = profileSagas;
|
|
8
9
|
exports.profileSagasMock = profileSagasMock;
|
|
9
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
package/node/auth/index.js
CHANGED
|
@@ -628,6 +628,18 @@ Object.keys(_interfaces24).forEach(function (key) {
|
|
|
628
628
|
}
|
|
629
629
|
});
|
|
630
630
|
});
|
|
631
|
+
var _CustomLoginState = require("./CustomLoginState");
|
|
632
|
+
Object.keys(_CustomLoginState).forEach(function (key) {
|
|
633
|
+
if (key === "default" || key === "__esModule") return;
|
|
634
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
635
|
+
if (key in exports && exports[key] === _CustomLoginState[key]) return;
|
|
636
|
+
Object.defineProperty(exports, key, {
|
|
637
|
+
enumerable: true,
|
|
638
|
+
get: function () {
|
|
639
|
+
return _CustomLoginState[key];
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
});
|
|
631
643
|
var _interfaces25 = require("./CustomLoginState/interfaces");
|
|
632
644
|
Object.keys(_interfaces25).forEach(function (key) {
|
|
633
645
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -29,6 +29,7 @@ var _Provisioning = require("./Provisioning");
|
|
|
29
29
|
var _PasskeysState = require("./PasskeysState");
|
|
30
30
|
var _GroupsState = require("./GroupsState");
|
|
31
31
|
var _groupsDialogsState = require("./GroupsState/groupsDialogsState");
|
|
32
|
+
var _CustomLoginState = require("./CustomLoginState");
|
|
32
33
|
const reinitializeState = {
|
|
33
34
|
isAuthenticated: false,
|
|
34
35
|
isLoading: true,
|
|
@@ -41,6 +42,7 @@ const reinitializeState = {
|
|
|
41
42
|
forgotPasswordState: _ForgotPasswordState.forgotPasswordState,
|
|
42
43
|
ssoState: _SSOState.ssoState,
|
|
43
44
|
profileState: _ProfileState.profileState,
|
|
45
|
+
customLoginState: _CustomLoginState.customLoginState,
|
|
44
46
|
mfaState: _MfaState.mfaState,
|
|
45
47
|
teamState: _TeamState.teamState,
|
|
46
48
|
groupsState: _GroupsState.groupsState,
|
package/node/auth/reducer.js
CHANGED
|
@@ -34,6 +34,7 @@ var _ImpersonationState = require("./ImpersonationState");
|
|
|
34
34
|
var _PasskeysState = require("./PasskeysState");
|
|
35
35
|
var _GroupsState = require("./GroupsState");
|
|
36
36
|
var _groupsDialogsState = require("./GroupsState/groupsDialogsState");
|
|
37
|
+
var _CustomLoginState = require("./CustomLoginState");
|
|
37
38
|
const {
|
|
38
39
|
reducer,
|
|
39
40
|
actions: sliceActions
|
|
@@ -46,8 +47,8 @@ const {
|
|
|
46
47
|
payload
|
|
47
48
|
}) => (0, _extends2.default)({}, state, payload),
|
|
48
49
|
setUser: (0, _utils.typeReducer)('user')
|
|
49
|
-
}, _LoginState.loginReducers, _SocialLogins.socialLoginsReducer, _ActivateState.activateAccountReducers, _ImpersonationState.impersonateReducers, _AcceptInvitationState.acceptInvitationReducers, _ForgotPasswordState.forgotPasswordReducers, _ResetPhoneNumberState.resetPhoneNumberReducers, _SignUp.signUpReducers, _ProfileState.profileReducers, _SSOState.ssoReducers, _MfaState.mfaReducers, _TeamState.teamReducers, _GroupsState.groupsReducers, _groupsDialogsState.groupsDialogsReducers, _ApiTokensState.apiTokensReducers, _SecurityPolicyState.securityPolicyReducers, _AccountSettingsState.accountSettingsReducers, _TenantsState.tenantsReducers, _RolesState.rolesReducers, _SessionsState.sessionsReducers, _SessionsPolicyState.sessionsPolicyReducers, _RestrictionsState.restrictionsReducers, _Provisioning.provisioningReducers, _PasskeysState.passkeysReducers)
|
|
50
|
+
}, _LoginState.loginReducers, _SocialLogins.socialLoginsReducer, _ActivateState.activateAccountReducers, _ImpersonationState.impersonateReducers, _AcceptInvitationState.acceptInvitationReducers, _ForgotPasswordState.forgotPasswordReducers, _ResetPhoneNumberState.resetPhoneNumberReducers, _SignUp.signUpReducers, _ProfileState.profileReducers, _CustomLoginState.customLoginReducers, _SSOState.ssoReducers, _MfaState.mfaReducers, _TeamState.teamReducers, _GroupsState.groupsReducers, _groupsDialogsState.groupsDialogsReducers, _ApiTokensState.apiTokensReducers, _SecurityPolicyState.securityPolicyReducers, _AccountSettingsState.accountSettingsReducers, _TenantsState.tenantsReducers, _RolesState.rolesReducers, _SessionsState.sessionsReducers, _SessionsPolicyState.sessionsPolicyReducers, _RestrictionsState.restrictionsReducers, _Provisioning.provisioningReducers, _PasskeysState.passkeysReducers)
|
|
50
51
|
});
|
|
51
52
|
exports.reducer = reducer;
|
|
52
|
-
const actions = (0, _extends2.default)({}, sliceActions, _LoginState.loginActions, _SocialLogins.socialLoginsActions, _ActivateState.activateAccountActions, _AcceptInvitationState.acceptInvitationActions, _ForgotPasswordState.forgotPasswordActions, _ResetPhoneNumberState.resetPhoneNumberActions, _SignUp.signUpActions, _ProfileState.profileActions, _SSOState.ssoActions, _MfaState.mfaActions, _TeamState.teamActions, _GroupsState.groupsActions, _groupsDialogsState.groupsDialogsActions, _ApiTokensState.apiTokensActions, _SecurityPolicyState.securityPolicyActions, _AccountSettingsState.accountSettingsActions, _TenantsState.tenantsActions, _RolesState.rolesActions, _SessionsState.sessionsActions, _SessionsPolicyState.sessionsPolicyActions, _RestrictionsState.restrictionsActions, _Provisioning.provisioningActions, _ImpersonationState.impersonateActions, _PasskeysState.passkeysActions);
|
|
53
|
+
const actions = (0, _extends2.default)({}, sliceActions, _LoginState.loginActions, _SocialLogins.socialLoginsActions, _ActivateState.activateAccountActions, _AcceptInvitationState.acceptInvitationActions, _ForgotPasswordState.forgotPasswordActions, _ResetPhoneNumberState.resetPhoneNumberActions, _SignUp.signUpActions, _ProfileState.profileActions, _CustomLoginState.customLoginActions, _SSOState.ssoActions, _MfaState.mfaActions, _TeamState.teamActions, _GroupsState.groupsActions, _groupsDialogsState.groupsDialogsActions, _ApiTokensState.apiTokensActions, _SecurityPolicyState.securityPolicyActions, _AccountSettingsState.accountSettingsActions, _TenantsState.tenantsActions, _RolesState.rolesActions, _SessionsState.sessionsActions, _SessionsPolicyState.sessionsPolicyActions, _RestrictionsState.restrictionsActions, _Provisioning.provisioningActions, _ImpersonationState.impersonateActions, _PasskeysState.passkeysActions);
|
|
53
54
|
exports.actions = actions;
|
package/node/auth/saga.js
CHANGED
|
@@ -30,8 +30,9 @@ var _saga21 = require("./Provisioning/saga");
|
|
|
30
30
|
var _saga22 = require("./ImpersonationState/saga");
|
|
31
31
|
var _saga23 = require("./PasskeysState/saga");
|
|
32
32
|
var _saga24 = require("./GroupsState/saga");
|
|
33
|
+
var _saga25 = require("./CustomLoginState/saga");
|
|
33
34
|
function* sagas() {
|
|
34
|
-
yield (0, _effects.all)([(0, _effects.call)(_saga8.loginSagas), (0, _effects.call)(_saga6.activateSagas), (0, _effects.call)(_saga7.acceptInvitationSagas), (0, _effects.call)(_saga5.forgotPasswordSagas), (0, _effects.call)(_saga17.resetPhoneNumberSagas), (0, _effects.call)(_saga.ssoSagas), (0, _effects.call)(_saga2.ssoSagas), (0, _effects.call)(_saga3.profileSagas), (0, _effects.call)(_saga4.mfaSagas), (0, _effects.call)(_saga9.teamSagas), (0, _effects.call)(_saga24.groupsSagas), (0, _effects.call)(_saga10.socialLoginsSaga), (0, _effects.call)(_saga11.signUpSaga), (0, _effects.call)(_saga12.apiTokensSaga), (0, _effects.call)(_saga13.securityPolicySagas), (0, _effects.call)(_saga14.accountSettingsSaga), (0, _effects.call)(_saga15.tenantsSagas), (0, _effects.call)(_saga16.rolesSagas), (0, _effects.call)(_saga18.sessionsSaga), (0, _effects.call)(_saga19.sessionsPolicySaga), (0, _effects.call)(_saga20.restrictionsSagas), (0, _effects.call)(_saga21.provisionSagas), (0, _effects.call)(_saga22.impersonateSagas), (0, _effects.call)(_saga23.passkeysSagas)]);
|
|
35
|
+
yield (0, _effects.all)([(0, _effects.call)(_saga8.loginSagas), (0, _effects.call)(_saga6.activateSagas), (0, _effects.call)(_saga7.acceptInvitationSagas), (0, _effects.call)(_saga5.forgotPasswordSagas), (0, _effects.call)(_saga17.resetPhoneNumberSagas), (0, _effects.call)(_saga.ssoSagas), (0, _effects.call)(_saga2.ssoSagas), (0, _effects.call)(_saga3.profileSagas), (0, _effects.call)(_saga25.customLoginSagas), (0, _effects.call)(_saga4.mfaSagas), (0, _effects.call)(_saga9.teamSagas), (0, _effects.call)(_saga24.groupsSagas), (0, _effects.call)(_saga10.socialLoginsSaga), (0, _effects.call)(_saga11.signUpSaga), (0, _effects.call)(_saga12.apiTokensSaga), (0, _effects.call)(_saga13.securityPolicySagas), (0, _effects.call)(_saga14.accountSettingsSaga), (0, _effects.call)(_saga15.tenantsSagas), (0, _effects.call)(_saga16.rolesSagas), (0, _effects.call)(_saga18.sessionsSaga), (0, _effects.call)(_saga19.sessionsPolicySaga), (0, _effects.call)(_saga20.restrictionsSagas), (0, _effects.call)(_saga21.provisionSagas), (0, _effects.call)(_saga22.impersonateSagas), (0, _effects.call)(_saga23.passkeysSagas)]);
|
|
35
36
|
}
|
|
36
37
|
function* mockSagas() {
|
|
37
38
|
yield (0, _effects.all)([(0, _effects.call)(_saga8.loginSagasMock),
|
package/node/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
|
-
"version": "6.96.0-alpha.
|
|
3
|
+
"version": "6.96.0-alpha.1",
|
|
4
4
|
"main": "./node/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontegg LTD",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@babel/runtime": "^7.18.6",
|
|
9
|
-
"@frontegg/rest-api": "^3.0.
|
|
9
|
+
"@frontegg/rest-api": "^3.0.98",
|
|
10
10
|
"@reduxjs/toolkit": "1.8.5",
|
|
11
11
|
"redux-saga": "^1.2.1",
|
|
12
12
|
"uuid": "^8.3.2"
|