acsi-core 0.9.28 → 0.9.29

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.
@@ -2228,20 +2228,14 @@ var getMSALInstance = function getMSALInstance(clientId, redirectUri) {
2228
2228
  var finalClientId = clientId || MICROSOFT_CLIENT_ID;
2229
2229
  var finalRedirectUri = redirectUri || MICROSOFT_URL_DIRECT || window.location.origin;
2230
2230
  if (!finalClientId) {
2231
- console.warn('[MSAL] Client ID not configured');
2232
2231
  return null;
2233
2232
  }
2234
2233
  if (!msalInstance) {
2235
- console.log('[MSAL] Creating new MSAL instance with:', {
2236
- clientId: finalClientId ? 'configured' : 'missing',
2237
- redirectUri: finalRedirectUri
2238
- });
2239
2234
  msalInstance = new PublicClientApplication(msalConfig(finalClientId, finalRedirectUri));
2240
2235
  } else {
2241
2236
  var _existingConfig$auth, _existingConfig$auth2;
2242
2237
  var existingConfig = msalInstance.config;
2243
2238
  if ((existingConfig === null || existingConfig === void 0 ? void 0 : (_existingConfig$auth = existingConfig.auth) === null || _existingConfig$auth === void 0 ? void 0 : _existingConfig$auth.clientId) !== finalClientId || (existingConfig === null || existingConfig === void 0 ? void 0 : (_existingConfig$auth2 = existingConfig.auth) === null || _existingConfig$auth2 === void 0 ? void 0 : _existingConfig$auth2.redirectUri) !== finalRedirectUri) {
2244
- console.warn('[MSAL] Config mismatch detected, creating new instance');
2245
2239
  msalInstance = new PublicClientApplication(msalConfig(finalClientId, finalRedirectUri));
2246
2240
  }
2247
2241
  }
@@ -2264,11 +2258,9 @@ var initializeMSAL = function initializeMSAL(clientId, redirectUri) {
2264
2258
  isInitializing = true;
2265
2259
  initPromise = instance.initialize().then(function () {
2266
2260
  isInitializing = false;
2267
- console.log('[MSAL] Instance initialized successfully');
2268
2261
  return instance;
2269
2262
  })["catch"](function (error) {
2270
2263
  isInitializing = false;
2271
- console.error('[MSAL] Initialization error:', error);
2272
2264
  throw error;
2273
2265
  });
2274
2266
  return Promise.resolve(initPromise);
@@ -2279,105 +2271,54 @@ var initializeMSAL = function initializeMSAL(clientId, redirectUri) {
2279
2271
  var handleMSALRedirect = function handleMSALRedirect(clientId, redirectUri) {
2280
2272
  try {
2281
2273
  if (!window.location.hash) {
2282
- console.log('[MSAL] handleMSALRedirect: No hash found in URL');
2283
2274
  return Promise.resolve(null);
2284
2275
  }
2285
- console.log('[MSAL] handleMSALRedirect: Hash found:', window.location.hash.substring(0, 100) + '...');
2286
2276
  var hashParams = new URLSearchParams(window.location.hash.substring(1));
2287
2277
  var hasAccessToken = hashParams.has('access_token');
2288
2278
  var hasIdToken = hashParams.has('id_token');
2289
2279
  var hasError = hashParams.has('error');
2290
2280
  var hasCode = hashParams.has('code');
2291
2281
  var hasMSALParams = hasAccessToken || hasIdToken || hasError || hasCode;
2292
- console.log('[MSAL] handleMSALRedirect: Hash params check:', {
2293
- hasAccessToken: hasAccessToken,
2294
- hasIdToken: hasIdToken,
2295
- hasError: hasError,
2296
- hasCode: hasCode,
2297
- hasMSALParams: hasMSALParams
2298
- });
2299
2282
  if (!hasMSALParams) {
2300
- console.log('[MSAL] handleMSALRedirect: No MSAL parameters found in hash');
2301
2283
  return Promise.resolve(null);
2302
2284
  }
2303
2285
  return Promise.resolve(_catch(function () {
2304
- console.log('[MSAL] handleMSALRedirect: Initializing MSAL with:', {
2305
- clientId: clientId ? 'configured' : 'missing',
2306
- redirectUri: redirectUri
2307
- });
2308
2286
  return Promise.resolve(initializeMSAL(clientId, redirectUri)).then(function (instance) {
2309
- if (!instance) {
2310
- console.error('[MSAL] handleMSALRedirect: Failed to initialize instance');
2311
- return null;
2312
- }
2313
- console.log('[MSAL] handleMSALRedirect: Calling handleRedirectPromise...');
2314
- var accounts = instance.getAllAccounts();
2315
- console.log('[MSAL] handleMSALRedirect: Current accounts:', accounts.length);
2316
- return Promise.resolve(instance.handleRedirectPromise()).then(function (response) {
2287
+ return instance ? Promise.resolve(instance.handleRedirectPromise()).then(function (response) {
2317
2288
  var _exit = false;
2318
2289
  var _temp = function () {
2319
2290
  if (response) {
2320
- var _response$account;
2321
- console.log('[MSAL] handleMSALRedirect: Got response from handleRedirectPromise', {
2322
- account: (_response$account = response.account) === null || _response$account === void 0 ? void 0 : _response$account.username,
2323
- hasAccessToken: !!response.accessToken,
2324
- scopes: response.scopes
2325
- });
2291
+ _exit = true;
2292
+ return response;
2326
2293
  } else {
2327
- console.log('[MSAL] handleMSALRedirect: handleRedirectPromise returned null/undefined');
2328
- console.log('[MSAL] handleMSALRedirect: This might mean the redirect was already processed or state mismatch');
2329
- console.log('[MSAL] handleMSALRedirect: Checking localStorage for interaction state...');
2330
- try {
2331
- var msalCacheKeys = Object.keys(localStorage).filter(function (key) {
2332
- return key.startsWith('msal.');
2333
- });
2334
- console.log('[MSAL] handleMSALRedirect: Found MSAL cache keys:', msalCacheKeys.length);
2335
- var interactionStateKey = msalCacheKeys.find(function (key) {
2336
- return key.includes('interaction');
2337
- });
2338
- if (interactionStateKey) {
2339
- console.log('[MSAL] handleMSALRedirect: Found interaction state key:', interactionStateKey);
2340
- }
2341
- } catch (cacheError) {
2342
- console.error('[MSAL] handleMSALRedirect: Error checking cache:', cacheError);
2343
- }
2344
2294
  return function () {
2345
2295
  if (hashParams.has('code')) {
2346
- console.log('[MSAL] handleMSALRedirect: Attempting to extract account info from client_info...');
2347
2296
  return _catch(function () {
2348
2297
  var clientInfo = hashParams.get('client_info');
2349
2298
  return function () {
2350
2299
  if (clientInfo) {
2351
2300
  var decodedClientInfo = JSON.parse(atob(clientInfo));
2352
- console.log('[MSAL] handleMSALRedirect: Decoded client_info:', decodedClientInfo);
2353
2301
  var allAccounts = instance.getAllAccounts();
2354
- console.log('[MSAL] handleMSALRedirect: Accounts in cache:', allAccounts.length);
2355
2302
  var matchingAccount = allAccounts.find(function (acc) {
2356
2303
  return acc.homeAccountId === decodedClientInfo.uid || acc.username === decodedClientInfo.preferred_username || acc.username === decodedClientInfo.email;
2357
2304
  });
2358
2305
  if (!matchingAccount && allAccounts.length > 0) {
2359
2306
  matchingAccount = allAccounts[0];
2360
- console.log('[MSAL] handleMSALRedirect: Using first available account');
2361
2307
  }
2362
2308
  return function () {
2363
2309
  if (matchingAccount) {
2364
- console.log('[MSAL] handleMSALRedirect: Found matching account, trying silent token acquisition...');
2365
2310
  return _catch(function () {
2366
2311
  return Promise.resolve(instance.acquireTokenSilent({
2367
2312
  scopes: ["openid", "profile", "User.Read"],
2368
2313
  account: matchingAccount
2369
2314
  })).then(function (silentResult) {
2370
2315
  if (silentResult) {
2371
- console.log('[MSAL] handleMSALRedirect: Got token via silent acquisition');
2372
2316
  _exit = true;
2373
2317
  return silentResult;
2374
2318
  }
2375
2319
  });
2376
- }, function (silentError) {
2377
- console.error('[MSAL] handleMSALRedirect: Silent acquisition failed:', silentError);
2378
- });
2320
+ }, function () {});
2379
2321
  } else {
2380
- console.log('[MSAL] handleMSALRedirect: No account in cache, creating account from client_info...');
2381
2322
  var accountInfo = {
2382
2323
  homeAccountId: decodedClientInfo.uid || decodedClientInfo.sub,
2383
2324
  environment: 'login.microsoftonline.com',
@@ -2386,7 +2327,6 @@ var handleMSALRedirect = function handleMSALRedirect(clientId, redirectUri) {
2386
2327
  name: decodedClientInfo.name,
2387
2328
  localAccountId: decodedClientInfo.oid || decodedClientInfo.sub
2388
2329
  };
2389
- console.log('[MSAL] handleMSALRedirect: Created account info:', accountInfo);
2390
2330
  var _account$accessToken$ = {
2391
2331
  account: accountInfo,
2392
2332
  accessToken: '',
@@ -2403,9 +2343,7 @@ var handleMSALRedirect = function handleMSALRedirect(clientId, redirectUri) {
2403
2343
  }();
2404
2344
  }
2405
2345
  }();
2406
- }, function (manualError) {
2407
- console.error('[MSAL] handleMSALRedirect: Manual code processing failed:', manualError);
2408
- });
2346
+ }, function () {});
2409
2347
  }
2410
2348
  }();
2411
2349
  }
@@ -2413,18 +2351,10 @@ var handleMSALRedirect = function handleMSALRedirect(clientId, redirectUri) {
2413
2351
  return _temp && _temp.then ? _temp.then(function (_result6) {
2414
2352
  return _exit ? _result6 : response;
2415
2353
  }) : _exit ? _temp : response;
2416
- });
2354
+ }) : null;
2417
2355
  });
2418
2356
  }, function (error) {
2419
- console.error('[MSAL] handleMSALRedirect: Error during processing:', error);
2420
- if (error instanceof Error) {
2421
- var _error$stack;
2422
- console.error('[MSAL] handleMSALRedirect: Error details:', {
2423
- name: error.name,
2424
- message: error.message,
2425
- stack: (_error$stack = error.stack) === null || _error$stack === void 0 ? void 0 : _error$stack.substring(0, 200)
2426
- });
2427
- }
2357
+ console.error('[MSAL] Error during redirect processing:', error);
2428
2358
  return null;
2429
2359
  }));
2430
2360
  } catch (e) {
@@ -2459,23 +2389,14 @@ var MSALRedirectHandler = function MSALRedirectHandler() {
2459
2389
  try {
2460
2390
  var alreadyProcessed = localStorage.getItem('MSAL_LOGIN_PENDING');
2461
2391
  if (alreadyProcessed === 'true') {
2462
- console.log('[MSAL] RedirectHandler: Already processed by pre-init, skipping');
2463
2392
  return Promise.resolve();
2464
2393
  }
2465
2394
  if (!isMSALRedirect()) {
2466
- console.log('[MSAL] RedirectHandler: No MSAL redirect detected');
2467
2395
  return Promise.resolve();
2468
2396
  }
2469
- console.log('[MSAL] RedirectHandler: Redirect detected, processing...');
2470
- console.log('[MSAL] RedirectHandler: Hash:', window.location.hash);
2471
- console.log('[MSAL] RedirectHandler: Full URL:', window.location.href);
2472
2397
  var _temp = _catch(function () {
2473
2398
  return Promise.resolve(handleMSALRedirect()).then(function (response) {
2474
2399
  if (response && response.account) {
2475
- console.log('[MSAL] Redirect handled successfully', {
2476
- account: response.account.username,
2477
- scopes: response.scopes
2478
- });
2479
2400
  if (window.history.replaceState) {
2480
2401
  window.history.replaceState(null, '', window.location.pathname + window.location.search);
2481
2402
  }
@@ -2500,9 +2421,6 @@ var MSALRedirectHandler = function MSALRedirectHandler() {
2500
2421
  var errorDescription = hashParams.get('error_description');
2501
2422
  if (error) {
2502
2423
  console.error('[MSAL] Authentication error:', error, errorDescription);
2503
- if (error === 'access_denied') {
2504
- console.error('[MSAL] User denied access or scopes not configured in Azure AD');
2505
- }
2506
2424
  }
2507
2425
  if (window.history.replaceState) {
2508
2426
  window.history.replaceState(null, '', window.location.pathname + window.location.search);
@@ -2510,11 +2428,7 @@ var MSALRedirectHandler = function MSALRedirectHandler() {
2510
2428
  }
2511
2429
  });
2512
2430
  }, function (error) {
2513
- var _error$message;
2514
2431
  console.error('[MSAL] Redirect handling error:', error);
2515
- if ((error === null || error === void 0 ? void 0 : error.errorCode) === 'hash_empty_error' || error !== null && error !== void 0 && (_error$message = error.message) !== null && _error$message !== void 0 && _error$message.includes('hash_empty')) {
2516
- console.error('[MSAL] Hash was cleared before MSAL could process it. ' + 'This usually means code is running that clears the URL hash before MSAL handler executes.');
2517
- }
2518
2432
  if (window.history.replaceState) {
2519
2433
  window.history.replaceState(null, '', window.location.pathname + window.location.search);
2520
2434
  }
@@ -2728,32 +2642,21 @@ var BlockLogin = function BlockLogin(_ref) {
2728
2642
  return Promise.reject(e);
2729
2643
  }
2730
2644
  };
2645
+ var isProcessingLogin = React.useRef(false);
2731
2646
  var processMSALLogin = function processMSALLogin(account, accessToken) {
2732
2647
  try {
2648
+ var _exit = false;
2649
+ if (isProcessingLogin.current) {
2650
+ return Promise.resolve();
2651
+ }
2652
+ isProcessingLogin.current = true;
2733
2653
  return Promise.resolve(_catch(function () {
2734
- dispatch(setLoading(true));
2735
- var fullName = (account === null || account === void 0 ? void 0 : account.name) || "";
2736
- var infoLogin = {
2737
- firstName: fullName.split(' ').slice(0, -1).join(' '),
2738
- lastName: fullName.split(' ').slice(-1).join(' '),
2739
- fullName: fullName,
2740
- imageUrl: "",
2741
- email: (account === null || account === void 0 ? void 0 : account.username) || "",
2742
- token: accessToken || "",
2743
- googleId: (account === null || account === void 0 ? void 0 : account.homeAccountId) || "",
2744
- role: role,
2745
- type: TypeLogin.Microsoft
2746
- };
2747
- console.log('[MSAL] BlockLogin: processMSALLogin - Calling apiLoginGoogle...');
2748
- return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
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) {
2654
+ function _temp3(_result) {
2655
+ var _authResult$data;
2656
+ if (_exit) return _result;
2657
+ if (!authResult || !authResult.data || ((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
2755
2658
  dispatch(setLoading(false));
2756
- console.error('[MSAL] BlockLogin: processMSALLogin - Login failed, no user ID');
2659
+ isProcessingLogin.current = false;
2757
2660
  alert("Please contact admin.");
2758
2661
  return;
2759
2662
  }
@@ -2769,7 +2672,7 @@ var BlockLogin = function BlockLogin(_ref) {
2769
2672
  localStorage.setItem(key, msalCache[key]);
2770
2673
  });
2771
2674
  var tokenJWT = authResult.data.token;
2772
- console.log('[MSAL] BlockLogin: processMSALLogin - Got JWT token');
2675
+ isProcessingLogin.current = false;
2773
2676
  trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
2774
2677
  eventName: AmplitudeEvent.LOGIN,
2775
2678
  eventProperties: {
@@ -2803,9 +2706,34 @@ var BlockLogin = function BlockLogin(_ref) {
2803
2706
  onNavigate("/dashboard");
2804
2707
  dispatch(setLoading(false));
2805
2708
  }
2709
+ }
2710
+ dispatch(setLoading(true));
2711
+ var fullName = (account === null || account === void 0 ? void 0 : account.name) || "";
2712
+ var infoLogin = {
2713
+ firstName: fullName.split(' ').slice(0, -1).join(' '),
2714
+ lastName: fullName.split(' ').slice(-1).join(' '),
2715
+ fullName: fullName,
2716
+ imageUrl: "",
2717
+ email: (account === null || account === void 0 ? void 0 : account.username) || "",
2718
+ token: accessToken || "",
2719
+ googleId: (account === null || account === void 0 ? void 0 : account.homeAccountId) || "",
2720
+ role: role,
2721
+ type: TypeLogin.Microsoft
2722
+ };
2723
+ var authResult;
2724
+ var _temp2 = _catch(function () {
2725
+ return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (_apiLoginGoogle) {
2726
+ authResult = _apiLoginGoogle;
2727
+ });
2728
+ }, function () {
2729
+ dispatch(setLoading(false));
2730
+ isProcessingLogin.current = false;
2731
+ alert("Failed to authenticate with server. Please try again.");
2732
+ _exit = true;
2806
2733
  });
2807
- }, function (error) {
2808
- console.error("[MSAL] Error processing login:", error);
2734
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
2735
+ }, function () {
2736
+ isProcessingLogin.current = false;
2809
2737
  dispatch(setLoading(false));
2810
2738
  alert("An error occurred while processing your login. Please try again.");
2811
2739
  }));
@@ -2819,16 +2747,13 @@ var BlockLogin = function BlockLogin(_ref) {
2819
2747
  }
2820
2748
  }, []);
2821
2749
  useEffect(function () {
2822
- console.log('[MSAL] BlockLogin: useEffect mounted, checking for pending MSAL login...');
2823
2750
  var handleMSALLoginSuccess = function handleMSALLoginSuccess(event) {
2824
2751
  try {
2825
- console.log('[MSAL] BlockLogin: Received msal-login-success event', event.detail);
2826
2752
  var _event$detail = event.detail,
2827
2753
  account = _event$detail.account,
2828
2754
  _accessToken = _event$detail.accessToken;
2829
- var _temp2 = function () {
2755
+ var _temp4 = function () {
2830
2756
  if (account && _accessToken) {
2831
- console.log('[MSAL] BlockLogin: Processing login from event...');
2832
2757
  localStorage.removeItem('MSAL_LOGIN_PENDING');
2833
2758
  localStorage.removeItem('MSAL_ACCOUNT');
2834
2759
  localStorage.removeItem('MSAL_ACCESS_TOKEN');
@@ -2836,52 +2761,40 @@ var BlockLogin = function BlockLogin(_ref) {
2836
2761
  sessionStorage.removeItem('MSAL_ACCOUNT');
2837
2762
  sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2838
2763
  return Promise.resolve(processMSALLogin(account, _accessToken)).then(function () {});
2839
- } else {
2840
- console.warn('[MSAL] BlockLogin: Event received but missing account or accessToken');
2841
2764
  }
2842
2765
  }();
2843
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
2766
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
2844
2767
  } catch (e) {
2845
2768
  return Promise.reject(e);
2846
2769
  }
2847
2770
  };
2848
2771
  window.addEventListener('msal-login-success', handleMSALLoginSuccess);
2849
- console.log('[MSAL] BlockLogin: Event listener registered');
2850
2772
  var pendingLogin = localStorage.getItem('MSAL_LOGIN_PENDING');
2851
2773
  var accountStr = localStorage.getItem('MSAL_ACCOUNT');
2852
2774
  var accessToken = localStorage.getItem('MSAL_ACCESS_TOKEN');
2853
2775
  if (!pendingLogin || pendingLogin !== 'true') {
2854
- console.log('[MSAL] BlockLogin: Not found in localStorage, checking sessionStorage...');
2855
2776
  pendingLogin = sessionStorage.getItem('MSAL_LOGIN_PENDING');
2856
2777
  accountStr = sessionStorage.getItem('MSAL_ACCOUNT');
2857
2778
  accessToken = sessionStorage.getItem('MSAL_ACCESS_TOKEN');
2858
2779
  if (pendingLogin === 'true' && accountStr && accessToken) {
2859
- console.log('[MSAL] BlockLogin: Found in sessionStorage, copying to localStorage...');
2860
2780
  localStorage.setItem('MSAL_ACCOUNT', accountStr);
2861
2781
  localStorage.setItem('MSAL_ACCESS_TOKEN', accessToken);
2862
2782
  localStorage.setItem('MSAL_LOGIN_PENDING', pendingLogin);
2863
2783
  }
2864
2784
  }
2865
- console.log('[MSAL] BlockLogin: Pending login check:', pendingLogin);
2866
2785
  if (pendingLogin === 'true') {
2867
- console.log('[MSAL] BlockLogin: Found pending login', {
2868
- hasAccount: !!accountStr,
2869
- hasAccessToken: !!accessToken
2870
- });
2871
2786
  if (accountStr && accessToken) {
2872
2787
  try {
2873
2788
  var account = JSON.parse(accountStr);
2874
- console.log('[MSAL] BlockLogin: Parsed account:', account.username);
2875
2789
  localStorage.removeItem('MSAL_LOGIN_PENDING');
2876
2790
  localStorage.removeItem('MSAL_ACCOUNT');
2877
2791
  localStorage.removeItem('MSAL_ACCESS_TOKEN');
2878
2792
  sessionStorage.removeItem('MSAL_LOGIN_PENDING');
2879
2793
  sessionStorage.removeItem('MSAL_ACCOUNT');
2880
2794
  sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2881
- console.log('[MSAL] BlockLogin: Calling processMSALLogin...');
2882
2795
  processMSALLogin(account, accessToken);
2883
2796
  } catch (error) {
2884
- console.error('[MSAL] BlockLogin: Error parsing stored account:', error);
2797
+ console.error('[MSAL] Error parsing stored account:', error);
2885
2798
  localStorage.removeItem('MSAL_LOGIN_PENDING');
2886
2799
  localStorage.removeItem('MSAL_ACCOUNT');
2887
2800
  localStorage.removeItem('MSAL_ACCESS_TOKEN');
@@ -2889,13 +2802,10 @@ var BlockLogin = function BlockLogin(_ref) {
2889
2802
  sessionStorage.removeItem('MSAL_ACCOUNT');
2890
2803
  sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2891
2804
  }
2892
- } else {
2893
- console.warn('[MSAL] BlockLogin: Pending login flag set but missing account or token');
2894
2805
  }
2895
2806
  }
2896
2807
  return function () {
2897
2808
  window.removeEventListener('msal-login-success', handleMSALLoginSuccess);
2898
- console.log('[MSAL] BlockLogin: Event listener removed');
2899
2809
  };
2900
2810
  }, []);
2901
2811
  var googleLogin = useGoogleLogin({
@@ -2929,8 +2839,8 @@ var BlockLogin = function BlockLogin(_ref) {
2929
2839
  };
2930
2840
  dispatch(setLoading(true));
2931
2841
  return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
2932
- var _authResult$data3;
2933
- if (((_authResult$data3 = authResult.data) === null || _authResult$data3 === void 0 ? void 0 : _authResult$data3.id) == null) {
2842
+ var _authResult$data2;
2843
+ if (((_authResult$data2 = authResult.data) === null || _authResult$data2 === void 0 ? void 0 : _authResult$data2.id) == null) {
2934
2844
  dispatch(setLoading(false));
2935
2845
  alert("Please contact admin.");
2936
2846
  return;
@@ -2984,42 +2894,27 @@ var BlockLogin = function BlockLogin(_ref) {
2984
2894
  var fnLoginMicrosoft = function fnLoginMicrosoft() {
2985
2895
  try {
2986
2896
  return Promise.resolve(_catch(function () {
2987
- console.log('[MSAL] BlockLogin: Starting Microsoft login...');
2988
- console.log('[MSAL] BlockLogin: Client ID:', MICROSOFT_CLIENT_ID ? 'configured' : 'missing');
2989
- console.log('[MSAL] BlockLogin: Redirect URI:', MICROSOFT_URL_DIRECT || window.location.origin);
2990
2897
  var msalInstance = getMSALInstance(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT);
2991
2898
  if (!msalInstance) {
2992
- console.error("[MSAL] BlockLogin: Instance not initialized - check client ID configuration");
2993
2899
  alert("Microsoft login is not configured. Please contact admin.");
2994
2900
  return;
2995
2901
  }
2996
- console.log('[MSAL] BlockLogin: Initializing MSAL instance...');
2997
2902
  return Promise.resolve(initializeMSAL(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT)).then(function (initializedInstance) {
2998
- var _exit = false;
2999
- function _temp4(_result4) {
3000
- if (_exit) return _result4;
3001
- console.log('[MSAL] BlockLogin: Calling loginRedirect with request:', loginRequest);
3002
- console.log('[MSAL] BlockLogin: MSAL instance state:', {
3003
- accounts: initializedInstance.getAllAccounts().length
3004
- });
3005
- return Promise.resolve(initializedInstance.loginRedirect(loginRequest)).then(function () {
3006
- console.log('[MSAL] BlockLogin: loginRedirect called - redirect should happen');
3007
- });
2903
+ var _exit2 = false;
2904
+ function _temp6(_result5) {
2905
+ return _exit2 ? _result5 : Promise.resolve(initializedInstance.loginRedirect(loginRequest)).then(function () {});
3008
2906
  }
3009
2907
  if (!initializedInstance) {
3010
- console.error("[MSAL] BlockLogin: Failed to initialize MSAL instance");
3011
2908
  alert("Failed to initialize Microsoft login. Please try again.");
3012
2909
  return;
3013
2910
  }
3014
- console.log('[MSAL] BlockLogin: MSAL instance initialized successfully');
3015
2911
  var loginRequest = {
3016
2912
  scopes: ["openid", "profile", "User.Read"],
3017
2913
  prompt: "select_account"
3018
2914
  };
3019
- var _temp3 = _catch(function () {
2915
+ var _temp5 = _catch(function () {
3020
2916
  return Promise.resolve(initializedInstance.handleRedirectPromise()).then(function (redirectResponse) {
3021
2917
  if (redirectResponse) {
3022
- console.log('[MSAL] BlockLogin: Found pending redirect response, processing...');
3023
2918
  if (redirectResponse.account) {
3024
2919
  localStorage.setItem('MSAL_ACCOUNT', JSON.stringify(redirectResponse.account));
3025
2920
  localStorage.setItem('MSAL_ACCESS_TOKEN', redirectResponse.accessToken || '');
@@ -3034,44 +2929,27 @@ var BlockLogin = function BlockLogin(_ref) {
3034
2929
  idToken: redirectResponse.idToken
3035
2930
  }
3036
2931
  }));
3037
- _exit = true;
2932
+ _exit2 = true;
3038
2933
  }
3039
2934
  }
3040
2935
  });
3041
- }, function () {
3042
- console.log('[MSAL] BlockLogin: No pending redirect to handle (this is normal)');
3043
- });
3044
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
2936
+ }, function () {});
2937
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
3045
2938
  });
3046
2939
  }, function (error) {
3047
- var _errorObj$stack, _errorObj$toString, _errorObj$message, _errorObj$message2;
2940
+ var _errorObj$message, _errorObj$message2;
3048
2941
  var errorObj = error;
3049
- console.error("[MSAL] BlockLogin: Microsoft login error:", error);
3050
- console.error("[MSAL] BlockLogin: Error type:", typeof error);
3051
- console.error("[MSAL] BlockLogin: Error stringified:", JSON.stringify(error, Object.getOwnPropertyNames(error)));
3052
- console.error("[MSAL] BlockLogin: Error details:", {
3053
- name: errorObj === null || errorObj === void 0 ? void 0 : errorObj.name,
3054
- message: errorObj === null || errorObj === void 0 ? void 0 : errorObj.message,
3055
- errorCode: errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode,
3056
- errorMessage: errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorMessage,
3057
- stack: errorObj === null || errorObj === void 0 ? void 0 : (_errorObj$stack = errorObj.stack) === null || _errorObj$stack === void 0 ? void 0 : _errorObj$stack.substring(0, 500),
3058
- toString: errorObj === null || errorObj === void 0 ? void 0 : (_errorObj$toString = errorObj.toString) === null || _errorObj$toString === void 0 ? void 0 : _errorObj$toString.call(errorObj)
3059
- });
3060
2942
  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')) {
3061
- console.error("[MSAL] BlockLogin: Popup blocked or COOP error - this should not happen with redirect flow");
3062
2943
  alert("Popup was blocked. Please allow popups for this site and try again.");
3063
2944
  return;
3064
2945
  }
3065
2946
  if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'interaction_in_progress') {
3066
- console.warn("[MSAL] BlockLogin: Interaction already in progress, this is normal if redirect is happening");
3067
2947
  return;
3068
2948
  }
3069
2949
  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')) {
3070
- console.error("[MSAL] BlockLogin: Redirect URI mismatch error");
3071
2950
  alert("Configuration error: Redirect URI mismatch. Please contact admin.");
3072
2951
  return;
3073
2952
  }
3074
- console.error("[MSAL] BlockLogin: Full error object:", errorObj);
3075
2953
  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.");
3076
2954
  }));
3077
2955
  } catch (e) {