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