acsi-core 0.9.22 → 0.9.23

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
@@ -2267,19 +2267,62 @@ var initializeMSAL = function initializeMSAL(clientId, redirectUri) {
2267
2267
  var handleMSALRedirect = function handleMSALRedirect(clientId, redirectUri) {
2268
2268
  try {
2269
2269
  if (!window.location.hash) {
2270
+ console.log('[MSAL] handleMSALRedirect: No hash found in URL');
2270
2271
  return Promise.resolve(null);
2271
2272
  }
2273
+ console.log('[MSAL] handleMSALRedirect: Hash found:', window.location.hash.substring(0, 100) + '...');
2272
2274
  var hashParams = new URLSearchParams(window.location.hash.substring(1));
2273
- var hasMSALParams = hashParams.has('access_token') || hashParams.has('id_token') || hashParams.has('error') || hashParams.has('code');
2275
+ var hasAccessToken = hashParams.has('access_token');
2276
+ var hasIdToken = hashParams.has('id_token');
2277
+ var hasError = hashParams.has('error');
2278
+ var hasCode = hashParams.has('code');
2279
+ var hasMSALParams = hasAccessToken || hasIdToken || hasError || hasCode;
2280
+ console.log('[MSAL] handleMSALRedirect: Hash params check:', {
2281
+ hasAccessToken: hasAccessToken,
2282
+ hasIdToken: hasIdToken,
2283
+ hasError: hasError,
2284
+ hasCode: hasCode,
2285
+ hasMSALParams: hasMSALParams
2286
+ });
2274
2287
  if (!hasMSALParams) {
2288
+ console.log('[MSAL] handleMSALRedirect: No MSAL parameters found in hash');
2275
2289
  return Promise.resolve(null);
2276
2290
  }
2277
2291
  return Promise.resolve(_catch(function () {
2292
+ console.log('[MSAL] handleMSALRedirect: Initializing MSAL with:', {
2293
+ clientId: clientId ? 'configured' : 'missing',
2294
+ redirectUri: redirectUri
2295
+ });
2278
2296
  return Promise.resolve(initializeMSAL(clientId, redirectUri)).then(function (instance) {
2279
- return instance ? Promise.resolve(instance.handleRedirectPromise()) : null;
2297
+ if (!instance) {
2298
+ console.error('[MSAL] handleMSALRedirect: Failed to initialize instance');
2299
+ return null;
2300
+ }
2301
+ console.log('[MSAL] handleMSALRedirect: Calling handleRedirectPromise...');
2302
+ return Promise.resolve(instance.handleRedirectPromise()).then(function (response) {
2303
+ if (response) {
2304
+ var _response$account;
2305
+ console.log('[MSAL] handleMSALRedirect: Got response from handleRedirectPromise', {
2306
+ account: (_response$account = response.account) === null || _response$account === void 0 ? void 0 : _response$account.username,
2307
+ hasAccessToken: !!response.accessToken,
2308
+ scopes: response.scopes
2309
+ });
2310
+ } else {
2311
+ console.log('[MSAL] handleMSALRedirect: handleRedirectPromise returned null/undefined');
2312
+ }
2313
+ return response;
2314
+ });
2280
2315
  });
2281
2316
  }, function (error) {
2282
- console.error('[MSAL] Redirect handling error:', error);
2317
+ console.error('[MSAL] handleMSALRedirect: Error during processing:', error);
2318
+ if (error instanceof Error) {
2319
+ var _error$stack;
2320
+ console.error('[MSAL] handleMSALRedirect: Error details:', {
2321
+ name: error.name,
2322
+ message: error.message,
2323
+ stack: (_error$stack = error.stack) === null || _error$stack === void 0 ? void 0 : _error$stack.substring(0, 200)
2324
+ });
2325
+ }
2283
2326
  return null;
2284
2327
  }));
2285
2328
  } catch (e) {
@@ -2312,12 +2355,18 @@ var MSALRedirectHandler = function MSALRedirectHandler() {
2312
2355
  React.useLayoutEffect(function () {
2313
2356
  var handleRedirect = function handleRedirect() {
2314
2357
  try {
2358
+ var alreadyProcessed = localStorage.getItem('MSAL_LOGIN_PENDING');
2359
+ if (alreadyProcessed === 'true') {
2360
+ console.log('[MSAL] RedirectHandler: Already processed by pre-init, skipping');
2361
+ return Promise.resolve();
2362
+ }
2315
2363
  if (!isMSALRedirect()) {
2364
+ console.log('[MSAL] RedirectHandler: No MSAL redirect detected');
2316
2365
  return Promise.resolve();
2317
2366
  }
2318
- console.log('[MSAL] Redirect detected, processing...');
2319
- console.log('[MSAL] Hash:', window.location.hash);
2320
- console.log('[MSAL] Full URL:', window.location.href);
2367
+ console.log('[MSAL] RedirectHandler: Redirect detected, processing...');
2368
+ console.log('[MSAL] RedirectHandler: Hash:', window.location.hash);
2369
+ console.log('[MSAL] RedirectHandler: Full URL:', window.location.href);
2321
2370
  var _temp = _catch(function () {
2322
2371
  return Promise.resolve(handleMSALRedirect()).then(function (response) {
2323
2372
  if (response && response.account) {