@frontegg/redux-store 6.201.0-alpha.1 → 6.201.0-alpha.3
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
CHANGED
|
@@ -30,7 +30,7 @@ import { loadVendorPublicInfo } from '../../vendor/saga';
|
|
|
30
30
|
import { createRandomString, generateCodeChallenge, getFeatureFlags } from '../../helpers';
|
|
31
31
|
import { base64urlDecode, publicKeyCredentialToJSON } from '../utils';
|
|
32
32
|
import { loadPublicAuthStrategiesPolicy } from '../Security/SecurityPolicyState/saga';
|
|
33
|
-
import { getSearchParam, TENANT_ID_PARAM_KEY, isMfaRequired, isOauthCallbackRoute, isEmailPayload } from './utils';
|
|
33
|
+
import { getSearchParam, TENANT_ID_PARAM_KEY, isMfaRequired, isOauthCallbackRoute, isEmailPayload, getBaseNameWithoutSlashSuffix } from './utils';
|
|
34
34
|
import { errorHandler, GTMEventAction, reportGTMEvent } from '../../utils';
|
|
35
35
|
import { authStrategyLoginStepMap } from './consts';
|
|
36
36
|
import { isEntitlementsDeeplyEqual } from '../Entitlements';
|
|
@@ -518,7 +518,6 @@ function* refreshOrRequestHostedLoginAuthorizeV2({
|
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
export function* requestHostedLoginAuthorize(additionalParams) {
|
|
521
|
-
var _ContextHolder$getBas;
|
|
522
521
|
const {
|
|
523
522
|
routes,
|
|
524
523
|
context,
|
|
@@ -545,7 +544,8 @@ export function* requestHostedLoginAuthorize(additionalParams) {
|
|
|
545
544
|
|
|
546
545
|
// We are saving the verifier in session storage to be able to validate the response
|
|
547
546
|
localStorage.setItem(HOSTED_LOGIN_VERIFIER_KEY, code_verifier);
|
|
548
|
-
|
|
547
|
+
const basename = getBaseNameWithoutSlashSuffix();
|
|
548
|
+
let redirectUrl = `${window.location.origin}${urlStrategy === 'path' ? '' : '#'}${basename != null ? basename : ''}${routes.hostedLoginRedirectUrl}`;
|
|
549
549
|
yield call(loadCustomLoginRoutes);
|
|
550
550
|
const customLoginSearchParam = yield select(state => {
|
|
551
551
|
var _state$auth$customLog;
|
|
@@ -597,7 +597,8 @@ function* handleHostedLoginCallback({
|
|
|
597
597
|
routes: state.auth.routes,
|
|
598
598
|
urlStrategy: state.root.urlStrategy
|
|
599
599
|
}));
|
|
600
|
-
|
|
600
|
+
const basename = getBaseNameWithoutSlashSuffix();
|
|
601
|
+
let redirectUrl = `${window.location.origin}${urlStrategy === 'path' ? '' : '#'}${basename != null ? basename : ''}${routes.hostedLoginRedirectUrl}`;
|
|
601
602
|
yield call(loadCustomLoginRoutes);
|
|
602
603
|
const customLoginSearchParam = yield select(state => {
|
|
603
604
|
var _state$auth$customLog2;
|
|
@@ -28,3 +28,4 @@ export declare const getMfaStepForEnrolledUsers: (mfaDevices: UserMFADevicesResp
|
|
|
28
28
|
export declare const getMfaStepForNotEnrolledUsers: (mfaStrategies: MFAStrategyEnum[]) => MFAStep.verify | MFAStep.authenticatorApp | MFAStep.smsSetPhoneNumber | MFAStep.emailVerifyCode;
|
|
29
29
|
export declare const isOauthCallbackRoute: (activeUri: string) => boolean;
|
|
30
30
|
export declare function isEmailPayload(payload: IPasswordlessPreLogin): payload is IEmailPasswordlessPreLogin;
|
|
31
|
+
export declare const getBaseNameWithoutSlashSuffix: () => string | null;
|
package/auth/LoginState/utils.js
CHANGED
|
@@ -131,4 +131,11 @@ export const isOauthCallbackRoute = activeUri => {
|
|
|
131
131
|
};
|
|
132
132
|
export function isEmailPayload(payload) {
|
|
133
133
|
return 'email' in payload;
|
|
134
|
-
}
|
|
134
|
+
}
|
|
135
|
+
export const getBaseNameWithoutSlashSuffix = () => {
|
|
136
|
+
const basename = ContextHolder.getBasename();
|
|
137
|
+
if (basename != null && basename.endsWith('/')) {
|
|
138
|
+
return basename.slice(0, -1);
|
|
139
|
+
}
|
|
140
|
+
return basename;
|
|
141
|
+
};
|
package/index.js
CHANGED
|
@@ -544,7 +544,6 @@ function* refreshOrRequestHostedLoginAuthorizeV2({
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
function* requestHostedLoginAuthorize(additionalParams) {
|
|
547
|
-
var _ContextHolder$getBas;
|
|
548
547
|
const {
|
|
549
548
|
routes,
|
|
550
549
|
context,
|
|
@@ -571,7 +570,8 @@ function* requestHostedLoginAuthorize(additionalParams) {
|
|
|
571
570
|
|
|
572
571
|
// We are saving the verifier in session storage to be able to validate the response
|
|
573
572
|
localStorage.setItem(_constants.HOSTED_LOGIN_VERIFIER_KEY, code_verifier);
|
|
574
|
-
|
|
573
|
+
const basename = (0, _utils2.getBaseNameWithoutSlashSuffix)();
|
|
574
|
+
let redirectUrl = `${window.location.origin}${urlStrategy === 'path' ? '' : '#'}${basename != null ? basename : ''}${routes.hostedLoginRedirectUrl}`;
|
|
575
575
|
yield (0, _effects.call)(_saga4.loadCustomLoginRoutes);
|
|
576
576
|
const customLoginSearchParam = yield (0, _effects.select)(state => {
|
|
577
577
|
var _state$auth$customLog;
|
|
@@ -623,7 +623,8 @@ function* handleHostedLoginCallback({
|
|
|
623
623
|
routes: state.auth.routes,
|
|
624
624
|
urlStrategy: state.root.urlStrategy
|
|
625
625
|
}));
|
|
626
|
-
|
|
626
|
+
const basename = (0, _utils2.getBaseNameWithoutSlashSuffix)();
|
|
627
|
+
let redirectUrl = `${window.location.origin}${urlStrategy === 'path' ? '' : '#'}${basename != null ? basename : ''}${routes.hostedLoginRedirectUrl}`;
|
|
627
628
|
yield (0, _effects.call)(_saga4.loadCustomLoginRoutes);
|
|
628
629
|
const customLoginSearchParam = yield (0, _effects.select)(state => {
|
|
629
630
|
var _state$auth$customLog2;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isAbsoluteUrl = exports.getSearchParamsFromUrl = exports.getSearchParam = exports.getRedirectUrl = exports.getPathAndSearchParamsFromUrl = exports.getNumberOfMfaDevices = exports.getMfaStepForNotEnrolledUsers = exports.getMfaStepForEnrolledUsers = exports.TENANT_ID_PARAM_KEY = void 0;
|
|
6
|
+
exports.isAbsoluteUrl = exports.getSearchParamsFromUrl = exports.getSearchParam = exports.getRedirectUrl = exports.getPathAndSearchParamsFromUrl = exports.getNumberOfMfaDevices = exports.getMfaStepForNotEnrolledUsers = exports.getMfaStepForEnrolledUsers = exports.getBaseNameWithoutSlashSuffix = exports.TENANT_ID_PARAM_KEY = void 0;
|
|
7
7
|
exports.isEmailPayload = isEmailPayload;
|
|
8
8
|
exports.isOauthCallbackRoute = exports.isMfaRequired = void 0;
|
|
9
9
|
var _restApi = require("@frontegg/rest-api");
|
|
@@ -150,4 +150,12 @@ const isOauthCallbackRoute = activeUri => {
|
|
|
150
150
|
exports.isOauthCallbackRoute = isOauthCallbackRoute;
|
|
151
151
|
function isEmailPayload(payload) {
|
|
152
152
|
return 'email' in payload;
|
|
153
|
-
}
|
|
153
|
+
}
|
|
154
|
+
const getBaseNameWithoutSlashSuffix = () => {
|
|
155
|
+
const basename = _restApi.ContextHolder.getBasename();
|
|
156
|
+
if (basename != null && basename.endsWith('/')) {
|
|
157
|
+
return basename.slice(0, -1);
|
|
158
|
+
}
|
|
159
|
+
return basename;
|
|
160
|
+
};
|
|
161
|
+
exports.getBaseNameWithoutSlashSuffix = getBaseNameWithoutSlashSuffix;
|
package/node/index.js
CHANGED