acsi-core 0.9.26 → 0.9.28

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.
@@ -2744,15 +2744,32 @@ var BlockLogin = function BlockLogin(_ref) {
2744
2744
  role: role,
2745
2745
  type: TypeLogin.Microsoft
2746
2746
  };
2747
+ console.log('[MSAL] BlockLogin: processMSALLogin - Calling apiLoginGoogle...');
2747
2748
  return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
2748
- var _authResult$data;
2749
- if (((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
2749
+ var _authResult$data, _authResult$data2;
2750
+ console.log('[MSAL] BlockLogin: processMSALLogin - apiLoginGoogle response:', {
2751
+ hasData: !!authResult.data,
2752
+ userId: (_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id
2753
+ });
2754
+ if (((_authResult$data2 = authResult.data) === null || _authResult$data2 === void 0 ? void 0 : _authResult$data2.id) == null) {
2750
2755
  dispatch(setLoading(false));
2756
+ console.error('[MSAL] BlockLogin: processMSALLogin - Login failed, no user ID');
2751
2757
  alert("Please contact admin.");
2752
2758
  return;
2753
2759
  }
2760
+ var msalCacheKeys = Object.keys(localStorage).filter(function (key) {
2761
+ return key.startsWith('msal.');
2762
+ });
2763
+ var msalCache = {};
2764
+ msalCacheKeys.forEach(function (key) {
2765
+ msalCache[key] = localStorage.getItem(key) || '';
2766
+ });
2754
2767
  localStorage.clear();
2768
+ Object.keys(msalCache).forEach(function (key) {
2769
+ localStorage.setItem(key, msalCache[key]);
2770
+ });
2755
2771
  var tokenJWT = authResult.data.token;
2772
+ console.log('[MSAL] BlockLogin: processMSALLogin - Got JWT token');
2756
2773
  trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
2757
2774
  eventName: AmplitudeEvent.LOGIN,
2758
2775
  eventProperties: {
@@ -2912,8 +2929,8 @@ var BlockLogin = function BlockLogin(_ref) {
2912
2929
  };
2913
2930
  dispatch(setLoading(true));
2914
2931
  return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
2915
- var _authResult$data2;
2916
- if (((_authResult$data2 = authResult.data) === null || _authResult$data2 === void 0 ? void 0 : _authResult$data2.id) == null) {
2932
+ var _authResult$data3;
2933
+ if (((_authResult$data3 = authResult.data) === null || _authResult$data3 === void 0 ? void 0 : _authResult$data3.id) == null) {
2917
2934
  dispatch(setLoading(false));
2918
2935
  alert("Please contact admin.");
2919
2936
  return;
@@ -2977,25 +2994,30 @@ var BlockLogin = function BlockLogin(_ref) {
2977
2994
  return;
2978
2995
  }
2979
2996
  console.log('[MSAL] BlockLogin: Initializing MSAL instance...');
2980
- return Promise.resolve(initializeMSAL(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT)).then(function () {
2997
+ return Promise.resolve(initializeMSAL(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT)).then(function (initializedInstance) {
2981
2998
  var _exit = false;
2982
- function _temp4(_result3) {
2983
- if (_exit) return _result3;
2999
+ function _temp4(_result4) {
3000
+ if (_exit) return _result4;
2984
3001
  console.log('[MSAL] BlockLogin: Calling loginRedirect with request:', loginRequest);
2985
3002
  console.log('[MSAL] BlockLogin: MSAL instance state:', {
2986
- accounts: msalInstance.getAllAccounts().length
3003
+ accounts: initializedInstance.getAllAccounts().length
2987
3004
  });
2988
- return Promise.resolve(msalInstance.loginRedirect(loginRequest)).then(function () {
3005
+ return Promise.resolve(initializedInstance.loginRedirect(loginRequest)).then(function () {
2989
3006
  console.log('[MSAL] BlockLogin: loginRedirect called - redirect should happen');
2990
3007
  });
2991
3008
  }
3009
+ if (!initializedInstance) {
3010
+ console.error("[MSAL] BlockLogin: Failed to initialize MSAL instance");
3011
+ alert("Failed to initialize Microsoft login. Please try again.");
3012
+ return;
3013
+ }
2992
3014
  console.log('[MSAL] BlockLogin: MSAL instance initialized successfully');
2993
3015
  var loginRequest = {
2994
3016
  scopes: ["openid", "profile", "User.Read"],
2995
3017
  prompt: "select_account"
2996
3018
  };
2997
3019
  var _temp3 = _catch(function () {
2998
- return Promise.resolve(msalInstance.handleRedirectPromise()).then(function (redirectResponse) {
3020
+ return Promise.resolve(initializedInstance.handleRedirectPromise()).then(function (redirectResponse) {
2999
3021
  if (redirectResponse) {
3000
3022
  console.log('[MSAL] BlockLogin: Found pending redirect response, processing...');
3001
3023
  if (redirectResponse.account) {
@@ -3016,8 +3038,8 @@ var BlockLogin = function BlockLogin(_ref) {
3016
3038
  }
3017
3039
  }
3018
3040
  });
3019
- }, function (handleError) {
3020
- console.log('[MSAL] BlockLogin: No pending redirect to handle:', handleError);
3041
+ }, function () {
3042
+ console.log('[MSAL] BlockLogin: No pending redirect to handle (this is normal)');
3021
3043
  });
3022
3044
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
3023
3045
  });