acsi-core 0.9.24 → 0.9.26
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/dist/index.js +71 -7
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +71 -7
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2966,26 +2966,90 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
2966
2966
|
var fnLoginMicrosoft = function fnLoginMicrosoft() {
|
|
2967
2967
|
try {
|
|
2968
2968
|
return Promise.resolve(_catch(function () {
|
|
2969
|
+
console.log('[MSAL] BlockLogin: Starting Microsoft login...');
|
|
2970
|
+
console.log('[MSAL] BlockLogin: Client ID:', MICROSOFT_CLIENT_ID ? 'configured' : 'missing');
|
|
2971
|
+
console.log('[MSAL] BlockLogin: Redirect URI:', MICROSOFT_URL_DIRECT || window.location.origin);
|
|
2969
2972
|
var msalInstance = getMSALInstance(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT);
|
|
2970
2973
|
if (!msalInstance) {
|
|
2971
|
-
console.error("[MSAL] Instance not initialized - check client ID configuration");
|
|
2974
|
+
console.error("[MSAL] BlockLogin: Instance not initialized - check client ID configuration");
|
|
2972
2975
|
alert("Microsoft login is not configured. Please contact admin.");
|
|
2973
2976
|
return;
|
|
2974
2977
|
}
|
|
2978
|
+
console.log('[MSAL] BlockLogin: Initializing MSAL instance...');
|
|
2975
2979
|
return Promise.resolve(initializeMSAL(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT)).then(function () {
|
|
2980
|
+
var _exit = false;
|
|
2981
|
+
function _temp4(_result3) {
|
|
2982
|
+
if (_exit) return _result3;
|
|
2983
|
+
console.log('[MSAL] BlockLogin: Calling loginRedirect with request:', loginRequest);
|
|
2984
|
+
console.log('[MSAL] BlockLogin: MSAL instance state:', {
|
|
2985
|
+
accounts: msalInstance.getAllAccounts().length
|
|
2986
|
+
});
|
|
2987
|
+
return Promise.resolve(msalInstance.loginRedirect(loginRequest)).then(function () {
|
|
2988
|
+
console.log('[MSAL] BlockLogin: loginRedirect called - redirect should happen');
|
|
2989
|
+
});
|
|
2990
|
+
}
|
|
2991
|
+
console.log('[MSAL] BlockLogin: MSAL instance initialized successfully');
|
|
2976
2992
|
var loginRequest = {
|
|
2977
2993
|
scopes: ["openid", "profile", "User.Read"],
|
|
2978
2994
|
prompt: "select_account"
|
|
2979
2995
|
};
|
|
2980
|
-
|
|
2996
|
+
var _temp3 = _catch(function () {
|
|
2997
|
+
return Promise.resolve(msalInstance.handleRedirectPromise()).then(function (redirectResponse) {
|
|
2998
|
+
if (redirectResponse) {
|
|
2999
|
+
console.log('[MSAL] BlockLogin: Found pending redirect response, processing...');
|
|
3000
|
+
if (redirectResponse.account) {
|
|
3001
|
+
localStorage.setItem('MSAL_ACCOUNT', JSON.stringify(redirectResponse.account));
|
|
3002
|
+
localStorage.setItem('MSAL_ACCESS_TOKEN', redirectResponse.accessToken || '');
|
|
3003
|
+
localStorage.setItem('MSAL_LOGIN_PENDING', 'true');
|
|
3004
|
+
sessionStorage.setItem('MSAL_ACCOUNT', JSON.stringify(redirectResponse.account));
|
|
3005
|
+
sessionStorage.setItem('MSAL_ACCESS_TOKEN', redirectResponse.accessToken || '');
|
|
3006
|
+
sessionStorage.setItem('MSAL_LOGIN_PENDING', 'true');
|
|
3007
|
+
window.dispatchEvent(new CustomEvent('msal-login-success', {
|
|
3008
|
+
detail: {
|
|
3009
|
+
account: redirectResponse.account,
|
|
3010
|
+
accessToken: redirectResponse.accessToken,
|
|
3011
|
+
idToken: redirectResponse.idToken
|
|
3012
|
+
}
|
|
3013
|
+
}));
|
|
3014
|
+
_exit = true;
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
});
|
|
3018
|
+
}, function (handleError) {
|
|
3019
|
+
console.log('[MSAL] BlockLogin: No pending redirect to handle:', handleError);
|
|
3020
|
+
});
|
|
3021
|
+
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
2981
3022
|
});
|
|
2982
3023
|
}, function (error) {
|
|
2983
|
-
var
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3024
|
+
var _errorObj$stack, _errorObj$toString, _errorObj$message, _errorObj$message2;
|
|
3025
|
+
var errorObj = error;
|
|
3026
|
+
console.error("[MSAL] BlockLogin: Microsoft login error:", error);
|
|
3027
|
+
console.error("[MSAL] BlockLogin: Error type:", typeof error);
|
|
3028
|
+
console.error("[MSAL] BlockLogin: Error stringified:", JSON.stringify(error, Object.getOwnPropertyNames(error)));
|
|
3029
|
+
console.error("[MSAL] BlockLogin: Error details:", {
|
|
3030
|
+
name: errorObj === null || errorObj === void 0 ? void 0 : errorObj.name,
|
|
3031
|
+
message: errorObj === null || errorObj === void 0 ? void 0 : errorObj.message,
|
|
3032
|
+
errorCode: errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode,
|
|
3033
|
+
errorMessage: errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorMessage,
|
|
3034
|
+
stack: errorObj === null || errorObj === void 0 ? void 0 : (_errorObj$stack = errorObj.stack) === null || _errorObj$stack === void 0 ? void 0 : _errorObj$stack.substring(0, 500),
|
|
3035
|
+
toString: errorObj === null || errorObj === void 0 ? void 0 : (_errorObj$toString = errorObj.toString) === null || _errorObj$toString === void 0 ? void 0 : _errorObj$toString.call(errorObj)
|
|
3036
|
+
});
|
|
3037
|
+
if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'popup_window_error' || errorObj !== null && errorObj !== void 0 && (_errorObj$message = errorObj.message) !== null && _errorObj$message !== void 0 && _errorObj$message.includes('popup')) {
|
|
3038
|
+
console.error("[MSAL] BlockLogin: Popup blocked or COOP error - this should not happen with redirect flow");
|
|
3039
|
+
alert("Popup was blocked. Please allow popups for this site and try again.");
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'interaction_in_progress') {
|
|
3043
|
+
console.warn("[MSAL] BlockLogin: Interaction already in progress, this is normal if redirect is happening");
|
|
3044
|
+
return;
|
|
3045
|
+
}
|
|
3046
|
+
if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'invalid_request' || errorObj !== null && errorObj !== void 0 && (_errorObj$message2 = errorObj.message) !== null && _errorObj$message2 !== void 0 && _errorObj$message2.includes('redirect_uri')) {
|
|
3047
|
+
console.error("[MSAL] BlockLogin: Redirect URI mismatch error");
|
|
3048
|
+
alert("Configuration error: Redirect URI mismatch. Please contact admin.");
|
|
3049
|
+
return;
|
|
2987
3050
|
}
|
|
2988
|
-
|
|
3051
|
+
console.error("[MSAL] BlockLogin: Full error object:", errorObj);
|
|
3052
|
+
alert("An error occurred during Microsoft login: " + ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.message) || (errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) || 'Unknown error') + ". Please try again.");
|
|
2989
3053
|
}));
|
|
2990
3054
|
} catch (e) {
|
|
2991
3055
|
return Promise.reject(e);
|