acsi-core 0.9.28 → 0.9.30

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
@@ -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 msalBrowser.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 msalBrowser.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
  }
@@ -2727,32 +2641,21 @@ var BlockLogin = function BlockLogin(_ref) {
2727
2641
  return Promise.reject(e);
2728
2642
  }
2729
2643
  };
2644
+ var isProcessingLogin = React__default.useRef(false);
2730
2645
  var processMSALLogin = function processMSALLogin(account, accessToken) {
2731
2646
  try {
2647
+ var _exit = false;
2648
+ if (isProcessingLogin.current) {
2649
+ return Promise.resolve();
2650
+ }
2651
+ isProcessingLogin.current = true;
2732
2652
  return Promise.resolve(_catch(function () {
2733
- dispatch(setLoading(true));
2734
- var fullName = (account === null || account === void 0 ? void 0 : account.name) || "";
2735
- var infoLogin = {
2736
- firstName: fullName.split(' ').slice(0, -1).join(' '),
2737
- lastName: fullName.split(' ').slice(-1).join(' '),
2738
- fullName: fullName,
2739
- imageUrl: "",
2740
- email: (account === null || account === void 0 ? void 0 : account.username) || "",
2741
- token: accessToken || "",
2742
- googleId: (account === null || account === void 0 ? void 0 : account.homeAccountId) || "",
2743
- role: role,
2744
- type: TypeLogin.Microsoft
2745
- };
2746
- console.log('[MSAL] BlockLogin: processMSALLogin - Calling apiLoginGoogle...');
2747
- return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
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) {
2653
+ function _temp3(_result) {
2654
+ var _authResult$data;
2655
+ if (_exit) return _result;
2656
+ if (!authResult || !authResult.data || ((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
2754
2657
  dispatch(setLoading(false));
2755
- console.error('[MSAL] BlockLogin: processMSALLogin - Login failed, no user ID');
2658
+ isProcessingLogin.current = false;
2756
2659
  alert("Please contact admin.");
2757
2660
  return;
2758
2661
  }
@@ -2768,7 +2671,7 @@ var BlockLogin = function BlockLogin(_ref) {
2768
2671
  localStorage.setItem(key, msalCache[key]);
2769
2672
  });
2770
2673
  var tokenJWT = authResult.data.token;
2771
- console.log('[MSAL] BlockLogin: processMSALLogin - Got JWT token');
2674
+ isProcessingLogin.current = false;
2772
2675
  trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
2773
2676
  eventName: exports.AmplitudeEvent.LOGIN,
2774
2677
  eventProperties: {
@@ -2802,9 +2705,33 @@ var BlockLogin = function BlockLogin(_ref) {
2802
2705
  onNavigate("/dashboard");
2803
2706
  dispatch(setLoading(false));
2804
2707
  }
2708
+ }
2709
+ dispatch(setLoading(true));
2710
+ var fullName = (account === null || account === void 0 ? void 0 : account.name) || "";
2711
+ var infoLogin = {
2712
+ firstName: fullName.split(' ').slice(0, -1).join(' '),
2713
+ lastName: fullName.split(' ').slice(-1).join(' '),
2714
+ fullName: fullName,
2715
+ imageUrl: "",
2716
+ email: (account === null || account === void 0 ? void 0 : account.username) || "",
2717
+ token: accessToken || "",
2718
+ googleId: (account === null || account === void 0 ? void 0 : account.homeAccountId) || "",
2719
+ role: role,
2720
+ type: TypeLogin.Microsoft
2721
+ };
2722
+ var authResult;
2723
+ var _temp2 = _catch(function () {
2724
+ return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (_apiLoginGoogle) {
2725
+ authResult = _apiLoginGoogle;
2726
+ });
2727
+ }, function () {
2728
+ dispatch(setLoading(false));
2729
+ isProcessingLogin.current = false;
2730
+ _exit = true;
2805
2731
  });
2806
- }, function (error) {
2807
- console.error("[MSAL] Error processing login:", error);
2732
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
2733
+ }, function () {
2734
+ isProcessingLogin.current = false;
2808
2735
  dispatch(setLoading(false));
2809
2736
  alert("An error occurred while processing your login. Please try again.");
2810
2737
  }));
@@ -2818,16 +2745,13 @@ var BlockLogin = function BlockLogin(_ref) {
2818
2745
  }
2819
2746
  }, []);
2820
2747
  React.useEffect(function () {
2821
- console.log('[MSAL] BlockLogin: useEffect mounted, checking for pending MSAL login...');
2822
2748
  var handleMSALLoginSuccess = function handleMSALLoginSuccess(event) {
2823
2749
  try {
2824
- console.log('[MSAL] BlockLogin: Received msal-login-success event', event.detail);
2825
2750
  var _event$detail = event.detail,
2826
2751
  account = _event$detail.account,
2827
2752
  _accessToken = _event$detail.accessToken;
2828
- var _temp2 = function () {
2753
+ var _temp4 = function () {
2829
2754
  if (account && _accessToken) {
2830
- console.log('[MSAL] BlockLogin: Processing login from event...');
2831
2755
  localStorage.removeItem('MSAL_LOGIN_PENDING');
2832
2756
  localStorage.removeItem('MSAL_ACCOUNT');
2833
2757
  localStorage.removeItem('MSAL_ACCESS_TOKEN');
@@ -2835,52 +2759,40 @@ var BlockLogin = function BlockLogin(_ref) {
2835
2759
  sessionStorage.removeItem('MSAL_ACCOUNT');
2836
2760
  sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2837
2761
  return Promise.resolve(processMSALLogin(account, _accessToken)).then(function () {});
2838
- } else {
2839
- console.warn('[MSAL] BlockLogin: Event received but missing account or accessToken');
2840
2762
  }
2841
2763
  }();
2842
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
2764
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
2843
2765
  } catch (e) {
2844
2766
  return Promise.reject(e);
2845
2767
  }
2846
2768
  };
2847
2769
  window.addEventListener('msal-login-success', handleMSALLoginSuccess);
2848
- console.log('[MSAL] BlockLogin: Event listener registered');
2849
2770
  var pendingLogin = localStorage.getItem('MSAL_LOGIN_PENDING');
2850
2771
  var accountStr = localStorage.getItem('MSAL_ACCOUNT');
2851
2772
  var accessToken = localStorage.getItem('MSAL_ACCESS_TOKEN');
2852
2773
  if (!pendingLogin || pendingLogin !== 'true') {
2853
- console.log('[MSAL] BlockLogin: Not found in localStorage, checking sessionStorage...');
2854
2774
  pendingLogin = sessionStorage.getItem('MSAL_LOGIN_PENDING');
2855
2775
  accountStr = sessionStorage.getItem('MSAL_ACCOUNT');
2856
2776
  accessToken = sessionStorage.getItem('MSAL_ACCESS_TOKEN');
2857
2777
  if (pendingLogin === 'true' && accountStr && accessToken) {
2858
- console.log('[MSAL] BlockLogin: Found in sessionStorage, copying to localStorage...');
2859
2778
  localStorage.setItem('MSAL_ACCOUNT', accountStr);
2860
2779
  localStorage.setItem('MSAL_ACCESS_TOKEN', accessToken);
2861
2780
  localStorage.setItem('MSAL_LOGIN_PENDING', pendingLogin);
2862
2781
  }
2863
2782
  }
2864
- console.log('[MSAL] BlockLogin: Pending login check:', pendingLogin);
2865
2783
  if (pendingLogin === 'true') {
2866
- console.log('[MSAL] BlockLogin: Found pending login', {
2867
- hasAccount: !!accountStr,
2868
- hasAccessToken: !!accessToken
2869
- });
2870
2784
  if (accountStr && accessToken) {
2871
2785
  try {
2872
2786
  var account = JSON.parse(accountStr);
2873
- console.log('[MSAL] BlockLogin: Parsed account:', account.username);
2874
2787
  localStorage.removeItem('MSAL_LOGIN_PENDING');
2875
2788
  localStorage.removeItem('MSAL_ACCOUNT');
2876
2789
  localStorage.removeItem('MSAL_ACCESS_TOKEN');
2877
2790
  sessionStorage.removeItem('MSAL_LOGIN_PENDING');
2878
2791
  sessionStorage.removeItem('MSAL_ACCOUNT');
2879
2792
  sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2880
- console.log('[MSAL] BlockLogin: Calling processMSALLogin...');
2881
2793
  processMSALLogin(account, accessToken);
2882
2794
  } catch (error) {
2883
- console.error('[MSAL] BlockLogin: Error parsing stored account:', error);
2795
+ console.error('[MSAL] Error parsing stored account:', error);
2884
2796
  localStorage.removeItem('MSAL_LOGIN_PENDING');
2885
2797
  localStorage.removeItem('MSAL_ACCOUNT');
2886
2798
  localStorage.removeItem('MSAL_ACCESS_TOKEN');
@@ -2888,13 +2800,10 @@ var BlockLogin = function BlockLogin(_ref) {
2888
2800
  sessionStorage.removeItem('MSAL_ACCOUNT');
2889
2801
  sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2890
2802
  }
2891
- } else {
2892
- console.warn('[MSAL] BlockLogin: Pending login flag set but missing account or token');
2893
2803
  }
2894
2804
  }
2895
2805
  return function () {
2896
2806
  window.removeEventListener('msal-login-success', handleMSALLoginSuccess);
2897
- console.log('[MSAL] BlockLogin: Event listener removed');
2898
2807
  };
2899
2808
  }, []);
2900
2809
  var googleLogin = google.useGoogleLogin({
@@ -2928,8 +2837,8 @@ var BlockLogin = function BlockLogin(_ref) {
2928
2837
  };
2929
2838
  dispatch(setLoading(true));
2930
2839
  return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
2931
- var _authResult$data3;
2932
- if (((_authResult$data3 = authResult.data) === null || _authResult$data3 === void 0 ? void 0 : _authResult$data3.id) == null) {
2840
+ var _authResult$data2;
2841
+ if (((_authResult$data2 = authResult.data) === null || _authResult$data2 === void 0 ? void 0 : _authResult$data2.id) == null) {
2933
2842
  dispatch(setLoading(false));
2934
2843
  alert("Please contact admin.");
2935
2844
  return;
@@ -2983,42 +2892,27 @@ var BlockLogin = function BlockLogin(_ref) {
2983
2892
  var fnLoginMicrosoft = function fnLoginMicrosoft() {
2984
2893
  try {
2985
2894
  return Promise.resolve(_catch(function () {
2986
- console.log('[MSAL] BlockLogin: Starting Microsoft login...');
2987
- console.log('[MSAL] BlockLogin: Client ID:', MICROSOFT_CLIENT_ID ? 'configured' : 'missing');
2988
- console.log('[MSAL] BlockLogin: Redirect URI:', MICROSOFT_URL_DIRECT || window.location.origin);
2989
2895
  var msalInstance = getMSALInstance(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT);
2990
2896
  if (!msalInstance) {
2991
- console.error("[MSAL] BlockLogin: Instance not initialized - check client ID configuration");
2992
2897
  alert("Microsoft login is not configured. Please contact admin.");
2993
2898
  return;
2994
2899
  }
2995
- console.log('[MSAL] BlockLogin: Initializing MSAL instance...');
2996
2900
  return Promise.resolve(initializeMSAL(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT)).then(function (initializedInstance) {
2997
- var _exit = false;
2998
- function _temp4(_result4) {
2999
- if (_exit) return _result4;
3000
- console.log('[MSAL] BlockLogin: Calling loginRedirect with request:', loginRequest);
3001
- console.log('[MSAL] BlockLogin: MSAL instance state:', {
3002
- accounts: initializedInstance.getAllAccounts().length
3003
- });
3004
- return Promise.resolve(initializedInstance.loginRedirect(loginRequest)).then(function () {
3005
- console.log('[MSAL] BlockLogin: loginRedirect called - redirect should happen');
3006
- });
2901
+ var _exit2 = false;
2902
+ function _temp6(_result5) {
2903
+ return _exit2 ? _result5 : Promise.resolve(initializedInstance.loginRedirect(loginRequest)).then(function () {});
3007
2904
  }
3008
2905
  if (!initializedInstance) {
3009
- console.error("[MSAL] BlockLogin: Failed to initialize MSAL instance");
3010
2906
  alert("Failed to initialize Microsoft login. Please try again.");
3011
2907
  return;
3012
2908
  }
3013
- console.log('[MSAL] BlockLogin: MSAL instance initialized successfully');
3014
2909
  var loginRequest = {
3015
2910
  scopes: ["openid", "profile", "User.Read"],
3016
2911
  prompt: "select_account"
3017
2912
  };
3018
- var _temp3 = _catch(function () {
2913
+ var _temp5 = _catch(function () {
3019
2914
  return Promise.resolve(initializedInstance.handleRedirectPromise()).then(function (redirectResponse) {
3020
2915
  if (redirectResponse) {
3021
- console.log('[MSAL] BlockLogin: Found pending redirect response, processing...');
3022
2916
  if (redirectResponse.account) {
3023
2917
  localStorage.setItem('MSAL_ACCOUNT', JSON.stringify(redirectResponse.account));
3024
2918
  localStorage.setItem('MSAL_ACCESS_TOKEN', redirectResponse.accessToken || '');
@@ -3033,44 +2927,27 @@ var BlockLogin = function BlockLogin(_ref) {
3033
2927
  idToken: redirectResponse.idToken
3034
2928
  }
3035
2929
  }));
3036
- _exit = true;
2930
+ _exit2 = true;
3037
2931
  }
3038
2932
  }
3039
2933
  });
3040
- }, function () {
3041
- console.log('[MSAL] BlockLogin: No pending redirect to handle (this is normal)');
3042
- });
3043
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
2934
+ }, function () {});
2935
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
3044
2936
  });
3045
2937
  }, function (error) {
3046
- var _errorObj$stack, _errorObj$toString, _errorObj$message, _errorObj$message2;
2938
+ var _errorObj$message, _errorObj$message2;
3047
2939
  var errorObj = error;
3048
- console.error("[MSAL] BlockLogin: Microsoft login error:", error);
3049
- console.error("[MSAL] BlockLogin: Error type:", typeof error);
3050
- console.error("[MSAL] BlockLogin: Error stringified:", JSON.stringify(error, Object.getOwnPropertyNames(error)));
3051
- console.error("[MSAL] BlockLogin: Error details:", {
3052
- name: errorObj === null || errorObj === void 0 ? void 0 : errorObj.name,
3053
- message: errorObj === null || errorObj === void 0 ? void 0 : errorObj.message,
3054
- errorCode: errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode,
3055
- errorMessage: errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorMessage,
3056
- stack: errorObj === null || errorObj === void 0 ? void 0 : (_errorObj$stack = errorObj.stack) === null || _errorObj$stack === void 0 ? void 0 : _errorObj$stack.substring(0, 500),
3057
- toString: errorObj === null || errorObj === void 0 ? void 0 : (_errorObj$toString = errorObj.toString) === null || _errorObj$toString === void 0 ? void 0 : _errorObj$toString.call(errorObj)
3058
- });
3059
2940
  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')) {
3060
- console.error("[MSAL] BlockLogin: Popup blocked or COOP error - this should not happen with redirect flow");
3061
2941
  alert("Popup was blocked. Please allow popups for this site and try again.");
3062
2942
  return;
3063
2943
  }
3064
2944
  if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'interaction_in_progress') {
3065
- console.warn("[MSAL] BlockLogin: Interaction already in progress, this is normal if redirect is happening");
3066
2945
  return;
3067
2946
  }
3068
2947
  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')) {
3069
- console.error("[MSAL] BlockLogin: Redirect URI mismatch error");
3070
2948
  alert("Configuration error: Redirect URI mismatch. Please contact admin.");
3071
2949
  return;
3072
2950
  }
3073
- console.error("[MSAL] BlockLogin: Full error object:", errorObj);
3074
2951
  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.");
3075
2952
  }));
3076
2953
  } catch (e) {