@frontegg/redux-store 6.116.0 → 6.117.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/LoginState/saga.js +8 -2
- package/auth/LoginState/utils.d.ts +7 -0
- package/auth/LoginState/utils.js +13 -1
- package/index.js +1 -1
- package/node/auth/LoginState/saga.js +7 -1
- package/node/auth/LoginState/utils.js +16 -2
- package/node/index.js +1 -1
- package/package.json +1 -1
package/auth/LoginState/saga.js
CHANGED
|
@@ -36,7 +36,7 @@ import { ResetPhoneNumberStep } from '../ResetPhoneNumberState/interfaces';
|
|
|
36
36
|
import { base64urlDecode, delay, publicKeyCredentialToJSON } from '../utils';
|
|
37
37
|
import { loadPublicAuthStrategiesPolicy } from '../SecurityPolicyState/saga';
|
|
38
38
|
import { getPasskeysVendorPolicy } from '../PasskeysState/helpers';
|
|
39
|
-
import { getPathAndSearchParamsFromUrl, getRedirectUrl, getSearchParamsFromUrl } from './utils';
|
|
39
|
+
import { getPathAndSearchParamsFromUrl, getRedirectUrl, getSearchParamsFromUrl, getSearchParam, TENANT_ID_PARAM_KEY } from './utils';
|
|
40
40
|
import { getPublicSettings } from '@frontegg/rest-api/account-settings';
|
|
41
41
|
import { errorHandler } from '../../utils';
|
|
42
42
|
import { loadEntitlements } from '../EntitlementsState/saga';
|
|
@@ -685,6 +685,10 @@ function* requestHostedLoginAuthorize(additionalParams) {
|
|
|
685
685
|
params['organization'] = resolvedTenantResult.tenant;
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
|
+
const tenantId = getSearchParam(TENANT_ID_PARAM_KEY);
|
|
689
|
+
if (tenantId) {
|
|
690
|
+
params['tenantId'] = tenantId;
|
|
691
|
+
}
|
|
688
692
|
const searchParams = new URLSearchParams(params);
|
|
689
693
|
const url = `${oauthUrl}?${searchParams.toString()}`;
|
|
690
694
|
onRedirectTo(url, {
|
|
@@ -1016,11 +1020,13 @@ function* preLogin({
|
|
|
1016
1020
|
onRedirectTo
|
|
1017
1021
|
}
|
|
1018
1022
|
}) => onRedirectTo);
|
|
1023
|
+
const tenantId = getSearchParam(TENANT_ID_PARAM_KEY);
|
|
1019
1024
|
const {
|
|
1020
1025
|
address,
|
|
1021
1026
|
idpType
|
|
1022
1027
|
} = yield call(api.auth.preLoginV2, {
|
|
1023
|
-
email
|
|
1028
|
+
email,
|
|
1029
|
+
tenantId
|
|
1024
1030
|
});
|
|
1025
1031
|
if (address) {
|
|
1026
1032
|
let ssoRedirectUrl = address;
|
|
@@ -6,3 +6,10 @@ export declare const getRedirectUrl: ({ authenticatedUrl, enforceRedirectToSameS
|
|
|
6
6
|
}) => string;
|
|
7
7
|
export declare const getSearchParamsFromUrl: (url: string) => string | undefined;
|
|
8
8
|
export declare const getPathAndSearchParamsFromUrl: (url: string) => string;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param key
|
|
12
|
+
* @returns the value of the param as string or undefined if it does not exist
|
|
13
|
+
*/
|
|
14
|
+
export declare const getSearchParam: (key: string) => string | undefined;
|
|
15
|
+
export declare const TENANT_ID_PARAM_KEY = "tenantId";
|
package/auth/LoginState/utils.js
CHANGED
|
@@ -55,4 +55,16 @@ export const getPathAndSearchParamsFromUrl = url => {
|
|
|
55
55
|
return pathname + searchParams;
|
|
56
56
|
}
|
|
57
57
|
return pathname;
|
|
58
|
-
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param key
|
|
63
|
+
* @returns the value of the param as string or undefined if it does not exist
|
|
64
|
+
*/
|
|
65
|
+
export const getSearchParam = key => {
|
|
66
|
+
const params = new URLSearchParams(window.location.search);
|
|
67
|
+
const param = params.get(key);
|
|
68
|
+
return param != null ? param : undefined;
|
|
69
|
+
};
|
|
70
|
+
export const TENANT_ID_PARAM_KEY = 'tenantId';
|
package/index.js
CHANGED
|
@@ -702,6 +702,10 @@ function* requestHostedLoginAuthorize(additionalParams) {
|
|
|
702
702
|
params['organization'] = resolvedTenantResult.tenant;
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
+
const tenantId = (0, _utils2.getSearchParam)(_utils2.TENANT_ID_PARAM_KEY);
|
|
706
|
+
if (tenantId) {
|
|
707
|
+
params['tenantId'] = tenantId;
|
|
708
|
+
}
|
|
705
709
|
const searchParams = new URLSearchParams(params);
|
|
706
710
|
const url = `${oauthUrl}?${searchParams.toString()}`;
|
|
707
711
|
onRedirectTo(url, {
|
|
@@ -1033,11 +1037,13 @@ function* preLogin({
|
|
|
1033
1037
|
onRedirectTo
|
|
1034
1038
|
}
|
|
1035
1039
|
}) => onRedirectTo);
|
|
1040
|
+
const tenantId = (0, _utils2.getSearchParam)(_utils2.TENANT_ID_PARAM_KEY);
|
|
1036
1041
|
const {
|
|
1037
1042
|
address,
|
|
1038
1043
|
idpType
|
|
1039
1044
|
} = yield (0, _effects.call)(_restApi.api.auth.preLoginV2, {
|
|
1040
|
-
email
|
|
1045
|
+
email,
|
|
1046
|
+
tenantId
|
|
1041
1047
|
});
|
|
1042
1048
|
if (address) {
|
|
1043
1049
|
let ssoRedirectUrl = address;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getSearchParamsFromUrl = exports.getRedirectUrl = exports.getPathAndSearchParamsFromUrl = void 0;
|
|
6
|
+
exports.getSearchParamsFromUrl = exports.getSearchParam = exports.getRedirectUrl = exports.getPathAndSearchParamsFromUrl = exports.TENANT_ID_PARAM_KEY = void 0;
|
|
7
7
|
const isAbsoluteUrl = path => {
|
|
8
8
|
try {
|
|
9
9
|
new URL(path);
|
|
@@ -64,4 +64,18 @@ const getPathAndSearchParamsFromUrl = url => {
|
|
|
64
64
|
}
|
|
65
65
|
return pathname;
|
|
66
66
|
};
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @param key
|
|
71
|
+
* @returns the value of the param as string or undefined if it does not exist
|
|
72
|
+
*/
|
|
73
|
+
exports.getPathAndSearchParamsFromUrl = getPathAndSearchParamsFromUrl;
|
|
74
|
+
const getSearchParam = key => {
|
|
75
|
+
const params = new URLSearchParams(window.location.search);
|
|
76
|
+
const param = params.get(key);
|
|
77
|
+
return param != null ? param : undefined;
|
|
78
|
+
};
|
|
79
|
+
exports.getSearchParam = getSearchParam;
|
|
80
|
+
const TENANT_ID_PARAM_KEY = 'tenantId';
|
|
81
|
+
exports.TENANT_ID_PARAM_KEY = TENANT_ID_PARAM_KEY;
|
package/node/index.js
CHANGED