@frontegg/redux-store 5.5.0 → 5.8.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/SocialLogins/index.d.ts +10 -8
- package/auth/SocialLogins/interfaces.d.ts +2 -1
- package/auth/SocialLogins/saga.d.ts +5 -1
- package/auth/index.d.ts +1 -0
- package/auth/index.js +20 -2
- package/auth/reducer.d.ts +1 -0
- package/node/auth/index.js +19 -1
- package/node/toolkit/index.js +2 -2
- package/package.json +2 -2
- package/toolkit/index.d.ts +1 -1
- package/toolkit/index.js +2 -2
|
@@ -16,10 +16,6 @@ declare const reducers: {
|
|
|
16
16
|
isLoading: boolean;
|
|
17
17
|
keepSessionAlive?: boolean | undefined;
|
|
18
18
|
user?: import("..").User | null | 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
|
-
*/
|
|
23
19
|
isSSOAuth: boolean;
|
|
24
20
|
ssoACS?: string | undefined;
|
|
25
21
|
loginState: import("..").LoginState;
|
|
@@ -37,6 +33,10 @@ declare const reducers: {
|
|
|
37
33
|
accountSettingsState: import("..").AccountSettingsState;
|
|
38
34
|
tenantsState: import("..").TenantsState;
|
|
39
35
|
rolesState: import("..").RolesState;
|
|
36
|
+
/**
|
|
37
|
+
* To be used for actions types after dispatch, and should contains
|
|
38
|
+
* the reducers and actions as standalone function
|
|
39
|
+
*/
|
|
40
40
|
routes: import("..").AuthPageRoutes;
|
|
41
41
|
header?: any;
|
|
42
42
|
loaderComponent?: any;
|
|
@@ -49,10 +49,6 @@ declare const reducers: {
|
|
|
49
49
|
isLoading: boolean;
|
|
50
50
|
keepSessionAlive?: boolean | undefined;
|
|
51
51
|
user?: import("..").User | null | 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
|
-
*/
|
|
56
52
|
isSSOAuth: boolean;
|
|
57
53
|
ssoACS?: string | undefined;
|
|
58
54
|
loginState: import("..").LoginState;
|
|
@@ -70,6 +66,10 @@ declare const reducers: {
|
|
|
70
66
|
accountSettingsState: import("..").AccountSettingsState;
|
|
71
67
|
tenantsState: import("..").TenantsState;
|
|
72
68
|
rolesState: import("..").RolesState;
|
|
69
|
+
/**
|
|
70
|
+
* To be used for actions types after dispatch, and should contains
|
|
71
|
+
* the reducers and actions as standalone function
|
|
72
|
+
*/
|
|
73
73
|
routes: import("..").AuthPageRoutes;
|
|
74
74
|
header?: any;
|
|
75
75
|
loaderComponent?: any;
|
|
@@ -77,6 +77,7 @@ declare const reducers: {
|
|
|
77
77
|
};
|
|
78
78
|
declare const actions: {
|
|
79
79
|
loadSocialLoginsConfiguration: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
80
|
+
loadSocialLoginsConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
80
81
|
loginViaSocialLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[ILoginViaSocialLogin], ILoginViaSocialLogin, string, never, never>;
|
|
81
82
|
setSocialLoginError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[ISetSocialLoginError], ISetSocialLoginError, string, never, never>;
|
|
82
83
|
};
|
|
@@ -88,6 +89,7 @@ declare type DispatchedActions = {
|
|
|
88
89
|
setSocialLoginsState: (state: Partial<SocialLoginState>) => void;
|
|
89
90
|
resetSocialLoginsState: () => void;
|
|
90
91
|
loadSocialLoginsConfiguration: () => void;
|
|
92
|
+
loadSocialLoginsConfigurationV2: () => void;
|
|
91
93
|
loginViaSocialLogin: (payload: ILoginViaSocialLogin) => void;
|
|
92
94
|
setSocialLoginError: (payload: ISetSocialLoginError) => void;
|
|
93
95
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ISocialLoginProviderConfiguration } from '@frontegg/rest-api';
|
|
1
|
+
import { ISocialLoginProviderConfiguration, ISocialLoginProviderConfigurationV2 } from '@frontegg/rest-api';
|
|
2
2
|
export interface SocialLoginState {
|
|
3
3
|
firstLoad: boolean;
|
|
4
4
|
loading: boolean;
|
|
5
5
|
socialLoginsConfig?: ISocialLoginProviderConfiguration[];
|
|
6
|
+
socialLoginsConfigV2?: ISocialLoginProviderConfigurationV2[];
|
|
6
7
|
error?: string;
|
|
7
8
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { ISocialLoginProviderConfiguration } from '@frontegg/rest-api';
|
|
1
|
+
import { ISocialLoginProviderConfiguration, ISocialLoginProviderConfigurationV2 } from '@frontegg/rest-api';
|
|
2
2
|
export declare function loadSocialLoginsConfigurations(): Generator<import("redux-saga/effects").PutEffect<{
|
|
3
3
|
payload: Partial<import("./interfaces").SocialLoginState>;
|
|
4
4
|
type: string;
|
|
5
5
|
}> | import("redux-saga/effects").CallEffect<ISocialLoginProviderConfiguration[]>, void, ISocialLoginProviderConfiguration[]>;
|
|
6
|
+
export declare function loadSocialLoginsConfigurationsV2(): Generator<import("redux-saga/effects").PutEffect<{
|
|
7
|
+
payload: Partial<import("./interfaces").SocialLoginState>;
|
|
8
|
+
type: string;
|
|
9
|
+
}> | import("redux-saga/effects").CallEffect<ISocialLoginProviderConfigurationV2[]>, void, ISocialLoginProviderConfigurationV2[]>;
|
|
6
10
|
export declare function socialLoginsSaga(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
|
package/auth/index.d.ts
CHANGED
|
@@ -226,6 +226,7 @@ declare const _default: {
|
|
|
226
226
|
getActivateAccountStrategy: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IGetActivateAccountStrategy, import("@frontegg/rest-api").IGetActivateAccountStrategyResponse>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IGetActivateAccountStrategy, import("@frontegg/rest-api").IGetActivateAccountStrategyResponse>, string, never, never>;
|
|
227
227
|
resendActivationEmail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").IResendActivationEmail], import("@frontegg/rest-api").IResendActivationEmail, string, never, never>;
|
|
228
228
|
loadSocialLoginsConfiguration: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
229
|
+
loadSocialLoginsConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
229
230
|
loginViaSocialLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ILoginViaSocialLogin], import("@frontegg/rest-api").ILoginViaSocialLogin, string, never, never>;
|
|
230
231
|
setSocialLoginError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISetSocialLoginError], import("@frontegg/rest-api").ISetSocialLoginError, string, never, never>;
|
|
231
232
|
requestAuthorize: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(boolean | undefined)?], boolean, string, never, never>;
|
package/auth/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { a as authStoreName, F as FRONTEGG_AFTER_AUTH_REDIRECT_URL, H as HOSTED_
|
|
|
3
3
|
export { a as authStoreName } from '../constants-4d9682b2.js';
|
|
4
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
|
-
import { AuthStrategyEnum, api, ContextHolder } from '@frontegg/rest-api';
|
|
6
|
+
import { AuthStrategyEnum, api, ContextHolder, fetch } from '@frontegg/rest-api';
|
|
7
7
|
export { AuthStrategyEnum } from '@frontegg/rest-api';
|
|
8
8
|
import { l as loadVendorPublicInfo } from '../saga-b6529ffb.js';
|
|
9
9
|
import { v4 } from 'uuid';
|
|
@@ -298,6 +298,7 @@ const reducers$6 = {
|
|
|
298
298
|
};
|
|
299
299
|
const actions$7 = {
|
|
300
300
|
loadSocialLoginsConfiguration: createAction(`${authStoreName}/loadSocialLoginsConfiguration`),
|
|
301
|
+
loadSocialLoginsConfigurationV2: createAction(`${authStoreName}/loadSocialLoginsConfigurationV2`),
|
|
301
302
|
loginViaSocialLogin: createAction(`${authStoreName}/loginViaSocialLogin`, (payload) => ({
|
|
302
303
|
payload,
|
|
303
304
|
})),
|
|
@@ -1135,7 +1136,7 @@ function* requestAuthorize({ payload: firstTime }) {
|
|
|
1135
1136
|
if (firstTime) {
|
|
1136
1137
|
yield put(actions.setState({ isLoading: true }));
|
|
1137
1138
|
calls.push(call(refreshMetadata));
|
|
1138
|
-
yield put(actions.
|
|
1139
|
+
yield put(actions.loadSocialLoginsConfigurationV2());
|
|
1139
1140
|
calls.push(call(loadAllowSignUps));
|
|
1140
1141
|
calls.push(call(loadSSOPublicConfigurationFunction));
|
|
1141
1142
|
calls.push(call(loadVendorPublicInfo));
|
|
@@ -2792,6 +2793,22 @@ function* loadSocialLoginsConfigurations() {
|
|
|
2792
2793
|
yield put(actions.setSocialLoginsState({ error: e.message, loading: false, firstLoad: false }));
|
|
2793
2794
|
}
|
|
2794
2795
|
}
|
|
2796
|
+
function* loadSocialLoginsConfigurationsV2() {
|
|
2797
|
+
try {
|
|
2798
|
+
yield put(actions.setSocialLoginsState({ loading: true }));
|
|
2799
|
+
console.log('api.auth.getSocialLoginProvidersV2', api.auth.getSocialLoginProvidersV2);
|
|
2800
|
+
const socialLoginsConfigV2 = yield call(api.auth.getSocialLoginProvidersV2);
|
|
2801
|
+
const baseUrl = fetch.getBaseUrl(ContextHolder.getContext());
|
|
2802
|
+
const socialLoginsConfigWithFullUrl = socialLoginsConfigV2.map((_a) => {
|
|
2803
|
+
var { authorizationUrl } = _a, config = __rest(_a, ["authorizationUrl"]);
|
|
2804
|
+
return (Object.assign(Object.assign({}, config), { authorizationUrl: authorizationUrl ? `${baseUrl}${authorizationUrl}` : null }));
|
|
2805
|
+
});
|
|
2806
|
+
yield put(actions.setSocialLoginsState({ socialLoginsConfigV2: socialLoginsConfigWithFullUrl, loading: false, firstLoad: false }));
|
|
2807
|
+
}
|
|
2808
|
+
catch (e) {
|
|
2809
|
+
yield put(actions.setSocialLoginsState({ error: e.message, loading: false, firstLoad: false }));
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2795
2812
|
function* loginViaSocialLogin({ payload }) {
|
|
2796
2813
|
var _a;
|
|
2797
2814
|
try {
|
|
@@ -2810,6 +2827,7 @@ function* setSocialLoginError({ payload }) {
|
|
|
2810
2827
|
}
|
|
2811
2828
|
function* socialLoginsSaga() {
|
|
2812
2829
|
yield takeLeading(actions.loadSocialLoginsConfiguration, loadSocialLoginsConfigurations);
|
|
2830
|
+
yield takeLeading(actions.loadSocialLoginsConfigurationV2, loadSocialLoginsConfigurationsV2);
|
|
2813
2831
|
yield takeLeading(actions.loginViaSocialLogin, loginViaSocialLogin);
|
|
2814
2832
|
yield takeLatest(actions.setSocialLoginError, setSocialLoginError);
|
|
2815
2833
|
}
|
package/auth/reducer.d.ts
CHANGED
|
@@ -200,6 +200,7 @@ declare const actions: {
|
|
|
200
200
|
getActivateAccountStrategy: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("../interfaces").WithCallback<import("@frontegg/rest-api").IGetActivateAccountStrategy, import("@frontegg/rest-api").IGetActivateAccountStrategyResponse>], import("../interfaces").WithCallback<import("@frontegg/rest-api").IGetActivateAccountStrategy, import("@frontegg/rest-api").IGetActivateAccountStrategyResponse>, string, never, never>;
|
|
201
201
|
resendActivationEmail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").IResendActivationEmail], import("@frontegg/rest-api").IResendActivationEmail, string, never, never>;
|
|
202
202
|
loadSocialLoginsConfiguration: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
203
|
+
loadSocialLoginsConfigurationV2: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
203
204
|
loginViaSocialLogin: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ILoginViaSocialLogin], import("@frontegg/rest-api").ILoginViaSocialLogin, string, never, never>;
|
|
204
205
|
setSocialLoginError: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[import("@frontegg/rest-api").ISetSocialLoginError], import("@frontegg/rest-api").ISetSocialLoginError, string, never, never>;
|
|
205
206
|
requestAuthorize: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[(boolean | undefined)?], boolean, string, never, never>;
|
package/node/auth/index.js
CHANGED
|
@@ -300,6 +300,7 @@ const reducers$6 = {
|
|
|
300
300
|
};
|
|
301
301
|
const actions$7 = {
|
|
302
302
|
loadSocialLoginsConfiguration: toolkit.createAction(`${constants.authStoreName}/loadSocialLoginsConfiguration`),
|
|
303
|
+
loadSocialLoginsConfigurationV2: toolkit.createAction(`${constants.authStoreName}/loadSocialLoginsConfigurationV2`),
|
|
303
304
|
loginViaSocialLogin: toolkit.createAction(`${constants.authStoreName}/loginViaSocialLogin`, (payload) => ({
|
|
304
305
|
payload,
|
|
305
306
|
})),
|
|
@@ -1137,7 +1138,7 @@ function* requestAuthorize({ payload: firstTime }) {
|
|
|
1137
1138
|
if (firstTime) {
|
|
1138
1139
|
yield effects.put(actions.setState({ isLoading: true }));
|
|
1139
1140
|
calls.push(effects.call(refreshMetadata));
|
|
1140
|
-
yield effects.put(actions.
|
|
1141
|
+
yield effects.put(actions.loadSocialLoginsConfigurationV2());
|
|
1141
1142
|
calls.push(effects.call(loadAllowSignUps));
|
|
1142
1143
|
calls.push(effects.call(loadSSOPublicConfigurationFunction));
|
|
1143
1144
|
calls.push(effects.call(saga.loadVendorPublicInfo));
|
|
@@ -2794,6 +2795,22 @@ function* loadSocialLoginsConfigurations() {
|
|
|
2794
2795
|
yield effects.put(actions.setSocialLoginsState({ error: e.message, loading: false, firstLoad: false }));
|
|
2795
2796
|
}
|
|
2796
2797
|
}
|
|
2798
|
+
function* loadSocialLoginsConfigurationsV2() {
|
|
2799
|
+
try {
|
|
2800
|
+
yield effects.put(actions.setSocialLoginsState({ loading: true }));
|
|
2801
|
+
console.log('api.auth.getSocialLoginProvidersV2', restApi.api.auth.getSocialLoginProvidersV2);
|
|
2802
|
+
const socialLoginsConfigV2 = yield effects.call(restApi.api.auth.getSocialLoginProvidersV2);
|
|
2803
|
+
const baseUrl = restApi.fetch.getBaseUrl(restApi.ContextHolder.getContext());
|
|
2804
|
+
const socialLoginsConfigWithFullUrl = socialLoginsConfigV2.map((_a) => {
|
|
2805
|
+
var { authorizationUrl } = _a, config = tslib.__rest(_a, ["authorizationUrl"]);
|
|
2806
|
+
return (Object.assign(Object.assign({}, config), { authorizationUrl: authorizationUrl ? `${baseUrl}${authorizationUrl}` : null }));
|
|
2807
|
+
});
|
|
2808
|
+
yield effects.put(actions.setSocialLoginsState({ socialLoginsConfigV2: socialLoginsConfigWithFullUrl, loading: false, firstLoad: false }));
|
|
2809
|
+
}
|
|
2810
|
+
catch (e) {
|
|
2811
|
+
yield effects.put(actions.setSocialLoginsState({ error: e.message, loading: false, firstLoad: false }));
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2797
2814
|
function* loginViaSocialLogin({ payload }) {
|
|
2798
2815
|
var _a;
|
|
2799
2816
|
try {
|
|
@@ -2812,6 +2829,7 @@ function* setSocialLoginError({ payload }) {
|
|
|
2812
2829
|
}
|
|
2813
2830
|
function* socialLoginsSaga() {
|
|
2814
2831
|
yield effects.takeLeading(actions.loadSocialLoginsConfiguration, loadSocialLoginsConfigurations);
|
|
2832
|
+
yield effects.takeLeading(actions.loadSocialLoginsConfigurationV2, loadSocialLoginsConfigurationsV2);
|
|
2815
2833
|
yield effects.takeLeading(actions.loginViaSocialLogin, loginViaSocialLogin);
|
|
2816
2834
|
yield effects.takeLatest(actions.setSocialLoginError, setSocialLoginError);
|
|
2817
2835
|
}
|
package/node/toolkit/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const { reducer: rootReducer } = toolkit.createSlice({
|
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
|
-
const createFronteggStore = (rootInitialState, storeHolder, previewMode = false, authInitialState, overrideInitialState) => {
|
|
40
|
+
const createFronteggStore = (rootInitialState, storeHolder, previewMode = false, authInitialState, overrideInitialState, builderMode = false) => {
|
|
41
41
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
42
42
|
const isSSR = typeof window === 'undefined';
|
|
43
43
|
let holder = storeHolder;
|
|
@@ -48,7 +48,7 @@ const createFronteggStore = (rootInitialState, storeHolder, previewMode = false,
|
|
|
48
48
|
holder = window;
|
|
49
49
|
}
|
|
50
50
|
if (!holder.store) {
|
|
51
|
-
if (!previewMode) {
|
|
51
|
+
if (!previewMode && !builderMode) {
|
|
52
52
|
restApi.ContextHolder.setContext(rootInitialState.context);
|
|
53
53
|
}
|
|
54
54
|
const sagaMiddleware = createSagaMiddleware__default['default']();
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/redux-store",
|
|
3
3
|
"libName": "FronteggReduxStore",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.8.1",
|
|
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.49",
|
|
11
11
|
"@reduxjs/toolkit": "^1.5.0",
|
|
12
12
|
"redux-saga": "^1.1.0",
|
|
13
13
|
"tslib": "^2.3.1",
|
package/toolkit/index.d.ts
CHANGED
package/toolkit/index.js
CHANGED
|
@@ -32,7 +32,7 @@ const { reducer: rootReducer } = createSlice({
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
});
|
|
35
|
-
const createFronteggStore = (rootInitialState, storeHolder, previewMode = false, authInitialState, overrideInitialState) => {
|
|
35
|
+
const createFronteggStore = (rootInitialState, storeHolder, previewMode = false, authInitialState, overrideInitialState, builderMode = false) => {
|
|
36
36
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
37
37
|
const isSSR = typeof window === 'undefined';
|
|
38
38
|
let holder = storeHolder;
|
|
@@ -43,7 +43,7 @@ const createFronteggStore = (rootInitialState, storeHolder, previewMode = false,
|
|
|
43
43
|
holder = window;
|
|
44
44
|
}
|
|
45
45
|
if (!holder.store) {
|
|
46
|
-
if (!previewMode) {
|
|
46
|
+
if (!previewMode && !builderMode) {
|
|
47
47
|
ContextHolder.setContext(rootInitialState.context);
|
|
48
48
|
}
|
|
49
49
|
const sagaMiddleware = createSagaMiddleware();
|