@azure/msal-browser 4.1.0 → 4.2.0

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.
Files changed (123) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientNext.mjs +1 -1
  4. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  6. package/dist/cache/AccountManager.mjs +1 -1
  7. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  8. package/dist/cache/BrowserCacheManager.d.ts +10 -3
  9. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  10. package/dist/cache/BrowserCacheManager.mjs +32 -6
  11. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  12. package/dist/cache/CacheHelpers.mjs +1 -1
  13. package/dist/cache/CookieStorage.d.ts +6 -1
  14. package/dist/cache/CookieStorage.d.ts.map +1 -1
  15. package/dist/cache/CookieStorage.mjs +10 -5
  16. package/dist/cache/CookieStorage.mjs.map +1 -1
  17. package/dist/cache/DatabaseStorage.mjs +1 -1
  18. package/dist/cache/LocalStorage.d.ts +2 -0
  19. package/dist/cache/LocalStorage.d.ts.map +1 -1
  20. package/dist/cache/LocalStorage.mjs +52 -4
  21. package/dist/cache/LocalStorage.mjs.map +1 -1
  22. package/dist/cache/MemoryStorage.mjs +1 -1
  23. package/dist/cache/SessionStorage.mjs +1 -1
  24. package/dist/cache/TokenCache.mjs +1 -1
  25. package/dist/config/Configuration.d.ts +2 -1
  26. package/dist/config/Configuration.d.ts.map +1 -1
  27. package/dist/config/Configuration.mjs +1 -1
  28. package/dist/config/Configuration.mjs.map +1 -1
  29. package/dist/controllers/ControllerFactory.mjs +1 -1
  30. package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
  31. package/dist/controllers/NestedAppAuthController.mjs +4 -4
  32. package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
  33. package/dist/controllers/StandardController.d.ts +2 -5
  34. package/dist/controllers/StandardController.d.ts.map +1 -1
  35. package/dist/controllers/StandardController.mjs +16 -63
  36. package/dist/controllers/StandardController.mjs.map +1 -1
  37. package/dist/controllers/UnknownOperatingContextController.d.ts +1 -0
  38. package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -1
  39. package/dist/controllers/UnknownOperatingContextController.mjs +5 -3
  40. package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
  41. package/dist/crypto/BrowserCrypto.mjs +1 -1
  42. package/dist/crypto/CryptoOps.mjs +1 -1
  43. package/dist/crypto/PkceGenerator.mjs +1 -1
  44. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  45. package/dist/encode/Base64Decode.mjs +1 -1
  46. package/dist/encode/Base64Encode.mjs +1 -1
  47. package/dist/error/BrowserAuthError.mjs +1 -1
  48. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  49. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  50. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  51. package/dist/error/NativeAuthError.mjs +1 -1
  52. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  53. package/dist/error/NestedAppAuthError.mjs +1 -1
  54. package/dist/event/EventHandler.d.ts +19 -0
  55. package/dist/event/EventHandler.d.ts.map +1 -1
  56. package/dist/event/EventHandler.mjs +56 -16
  57. package/dist/event/EventHandler.mjs.map +1 -1
  58. package/dist/event/EventMessage.mjs +1 -1
  59. package/dist/event/EventType.mjs +1 -1
  60. package/dist/index.mjs +1 -1
  61. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  62. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  63. package/dist/interaction_client/NativeInteractionClient.mjs +1 -1
  64. package/dist/interaction_client/PopupClient.mjs +1 -1
  65. package/dist/interaction_client/RedirectClient.mjs +1 -1
  66. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  67. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  68. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  69. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  70. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  71. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  72. package/dist/interaction_handler/RedirectHandler.mjs +1 -1
  73. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  74. package/dist/naa/BridgeError.mjs +1 -1
  75. package/dist/naa/BridgeProxy.mjs +1 -1
  76. package/dist/naa/BridgeStatusCode.mjs +1 -1
  77. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  78. package/dist/navigation/NavigationClient.mjs +1 -1
  79. package/dist/network/FetchClient.mjs +1 -1
  80. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  81. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  82. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  83. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  84. package/dist/packageMetadata.d.ts +1 -1
  85. package/dist/packageMetadata.mjs +2 -2
  86. package/dist/request/RequestHelpers.mjs +1 -1
  87. package/dist/response/ResponseHandler.mjs +1 -1
  88. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  89. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  90. package/dist/utils/BrowserConstants.mjs +1 -1
  91. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  92. package/dist/utils/BrowserUtils.mjs +1 -1
  93. package/lib/msal-browser.cjs +261 -188
  94. package/lib/msal-browser.cjs.map +1 -1
  95. package/lib/msal-browser.js +261 -188
  96. package/lib/msal-browser.js.map +1 -1
  97. package/lib/msal-browser.min.js +63 -63
  98. package/lib/types/cache/BrowserCacheManager.d.ts +10 -3
  99. package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
  100. package/lib/types/cache/CookieStorage.d.ts +6 -1
  101. package/lib/types/cache/CookieStorage.d.ts.map +1 -1
  102. package/lib/types/cache/LocalStorage.d.ts +2 -0
  103. package/lib/types/cache/LocalStorage.d.ts.map +1 -1
  104. package/lib/types/config/Configuration.d.ts +2 -1
  105. package/lib/types/config/Configuration.d.ts.map +1 -1
  106. package/lib/types/controllers/NestedAppAuthController.d.ts.map +1 -1
  107. package/lib/types/controllers/StandardController.d.ts +2 -5
  108. package/lib/types/controllers/StandardController.d.ts.map +1 -1
  109. package/lib/types/controllers/UnknownOperatingContextController.d.ts +1 -0
  110. package/lib/types/controllers/UnknownOperatingContextController.d.ts.map +1 -1
  111. package/lib/types/event/EventHandler.d.ts +19 -0
  112. package/lib/types/event/EventHandler.d.ts.map +1 -1
  113. package/lib/types/packageMetadata.d.ts +1 -1
  114. package/package.json +3 -3
  115. package/src/cache/BrowserCacheManager.ts +51 -4
  116. package/src/cache/CookieStorage.ts +12 -3
  117. package/src/cache/LocalStorage.ts +65 -3
  118. package/src/config/Configuration.ts +2 -1
  119. package/src/controllers/NestedAppAuthController.ts +4 -3
  120. package/src/controllers/StandardController.ts +23 -82
  121. package/src/controllers/UnknownOperatingContextController.ts +9 -1
  122. package/src/event/EventHandler.ts +78 -27
  123. package/src/packageMetadata.ts +1 -1
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-browser v4.1.0 2025-02-03 */
1
+ /*! @azure/msal-browser v4.2.0 2025-02-05 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*! @azure/msal-common v15.1.0 2025-02-03 */
5
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -306,7 +306,7 @@ const JsonWebTokenTypes = {
306
306
  // Token renewal offset default in seconds
307
307
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
308
308
 
309
- /*! @azure/msal-common v15.1.0 2025-02-03 */
309
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
310
310
  /*
311
311
  * Copyright (c) Microsoft Corporation. All rights reserved.
312
312
  * Licensed under the MIT License.
@@ -323,7 +323,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
323
323
  unexpectedError: unexpectedError
324
324
  });
325
325
 
326
- /*! @azure/msal-common v15.1.0 2025-02-03 */
326
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
327
327
 
328
328
  /*
329
329
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -372,7 +372,7 @@ function createAuthError(code, additionalMessage) {
372
372
  : AuthErrorMessages[code]);
373
373
  }
374
374
 
375
- /*! @azure/msal-common v15.1.0 2025-02-03 */
375
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
376
376
  /*
377
377
  * Copyright (c) Microsoft Corporation. All rights reserved.
378
378
  * Licensed under the MIT License.
@@ -470,7 +470,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
470
470
  userTimeoutReached: userTimeoutReached
471
471
  });
472
472
 
473
- /*! @azure/msal-common v15.1.0 2025-02-03 */
473
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
474
474
 
475
475
  /*
476
476
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -722,7 +722,7 @@ function createClientAuthError(errorCode, additionalMessage) {
722
722
  return new ClientAuthError(errorCode, additionalMessage);
723
723
  }
724
724
 
725
- /*! @azure/msal-common v15.1.0 2025-02-03 */
725
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
726
726
 
727
727
  /*
728
728
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -761,7 +761,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
761
761
  },
762
762
  };
763
763
 
764
- /*! @azure/msal-common v15.1.0 2025-02-03 */
764
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
765
765
 
766
766
  /*
767
767
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -952,12 +952,12 @@ class Logger {
952
952
  }
953
953
  }
954
954
 
955
- /*! @azure/msal-common v15.1.0 2025-02-03 */
955
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
956
956
  /* eslint-disable header/header */
957
957
  const name$1 = "@azure/msal-common";
958
- const version$1 = "15.1.0";
958
+ const version$1 = "15.1.1";
959
959
 
960
- /*! @azure/msal-common v15.1.0 2025-02-03 */
960
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
961
961
  /*
962
962
  * Copyright (c) Microsoft Corporation. All rights reserved.
963
963
  * Licensed under the MIT License.
@@ -977,7 +977,7 @@ const AzureCloudInstance = {
977
977
  AzureUsGovernment: "https://login.microsoftonline.us",
978
978
  };
979
979
 
980
- /*! @azure/msal-common v15.1.0 2025-02-03 */
980
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
981
981
 
982
982
  /*
983
983
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1038,7 +1038,7 @@ function checkMaxAge(authTime, maxAge) {
1038
1038
  }
1039
1039
  }
1040
1040
 
1041
- /*! @azure/msal-common v15.1.0 2025-02-03 */
1041
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1042
1042
  /*
1043
1043
  * Copyright (c) Microsoft Corporation. All rights reserved.
1044
1044
  * Licensed under the MIT License.
@@ -1075,7 +1075,7 @@ function wasClockTurnedBack(cachedAt) {
1075
1075
  return cachedAtSec > nowSeconds();
1076
1076
  }
1077
1077
 
1078
- /*! @azure/msal-common v15.1.0 2025-02-03 */
1078
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1079
1079
 
1080
1080
  /*
1081
1081
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1402,7 +1402,7 @@ function isAuthorityMetadataExpired(metadata) {
1402
1402
  return metadata.expiresAt <= nowSeconds();
1403
1403
  }
1404
1404
 
1405
- /*! @azure/msal-common v15.1.0 2025-02-03 */
1405
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1406
1406
  /*
1407
1407
  * Copyright (c) Microsoft Corporation. All rights reserved.
1408
1408
  * Licensed under the MIT License.
@@ -1456,7 +1456,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1456
1456
  urlParseError: urlParseError
1457
1457
  });
1458
1458
 
1459
- /*! @azure/msal-common v15.1.0 2025-02-03 */
1459
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1460
1460
 
1461
1461
  /*
1462
1462
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1594,7 +1594,7 @@ function createClientConfigurationError(errorCode) {
1594
1594
  return new ClientConfigurationError(errorCode);
1595
1595
  }
1596
1596
 
1597
- /*! @azure/msal-common v15.1.0 2025-02-03 */
1597
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1598
1598
  /*
1599
1599
  * Copyright (c) Microsoft Corporation. All rights reserved.
1600
1600
  * Licensed under the MIT License.
@@ -1691,7 +1691,7 @@ class StringUtils {
1691
1691
  }
1692
1692
  }
1693
1693
 
1694
- /*! @azure/msal-common v15.1.0 2025-02-03 */
1694
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1695
1695
 
1696
1696
  /*
1697
1697
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1882,7 +1882,7 @@ class ScopeSet {
1882
1882
  }
1883
1883
  }
1884
1884
 
1885
- /*! @azure/msal-common v15.1.0 2025-02-03 */
1885
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1886
1886
 
1887
1887
  /*
1888
1888
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1922,7 +1922,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
1922
1922
  };
1923
1923
  }
1924
1924
 
1925
- /*! @azure/msal-common v15.1.0 2025-02-03 */
1925
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
1926
1926
  /*
1927
1927
  * Copyright (c) Microsoft Corporation. All rights reserved.
1928
1928
  * Licensed under the MIT License.
@@ -2001,7 +2001,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
2001
2001
  return updatedAccountInfo;
2002
2002
  }
2003
2003
 
2004
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2004
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2005
2005
  /*
2006
2006
  * Copyright (c) Microsoft Corporation. All rights reserved.
2007
2007
  * Licensed under the MIT License.
@@ -2016,7 +2016,7 @@ const AuthorityType = {
2016
2016
  Ciam: 3,
2017
2017
  };
2018
2018
 
2019
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2019
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2020
2020
  /*
2021
2021
  * Copyright (c) Microsoft Corporation. All rights reserved.
2022
2022
  * Licensed under the MIT License.
@@ -2038,7 +2038,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2038
2038
  return null;
2039
2039
  }
2040
2040
 
2041
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2041
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2042
2042
  /*
2043
2043
  * Copyright (c) Microsoft Corporation. All rights reserved.
2044
2044
  * Licensed under the MIT License.
@@ -2051,7 +2051,7 @@ const ProtocolMode = {
2051
2051
  OIDC: "OIDC",
2052
2052
  };
2053
2053
 
2054
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2054
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2055
2055
 
2056
2056
  /*
2057
2057
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2294,7 +2294,7 @@ class AccountEntity {
2294
2294
  }
2295
2295
  }
2296
2296
 
2297
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2297
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2298
2298
 
2299
2299
  /*
2300
2300
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2341,7 +2341,7 @@ function getDeserializedResponse(responseString) {
2341
2341
  return null;
2342
2342
  }
2343
2343
 
2344
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2344
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2345
2345
 
2346
2346
  /*
2347
2347
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2505,7 +2505,7 @@ class UrlString {
2505
2505
  }
2506
2506
  }
2507
2507
 
2508
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2508
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2509
2509
 
2510
2510
  /*
2511
2511
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2645,7 +2645,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2645
2645
  return null;
2646
2646
  }
2647
2647
 
2648
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2648
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2649
2649
  /*
2650
2650
  * Copyright (c) Microsoft Corporation. All rights reserved.
2651
2651
  * Licensed under the MIT License.
@@ -2653,7 +2653,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2653
2653
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
2654
2654
  const cacheUnknownErrorCode = "cache_error_unknown";
2655
2655
 
2656
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2656
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2657
2657
 
2658
2658
  /*
2659
2659
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2680,7 +2680,7 @@ class CacheError extends Error {
2680
2680
  }
2681
2681
  }
2682
2682
 
2683
- /*! @azure/msal-common v15.1.0 2025-02-03 */
2683
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
2684
2684
 
2685
2685
  /*
2686
2686
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3865,7 +3865,7 @@ class DefaultStorageClass extends CacheManager {
3865
3865
  }
3866
3866
  }
3867
3867
 
3868
- /*! @azure/msal-common v15.1.0 2025-02-03 */
3868
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
3869
3869
 
3870
3870
  /*
3871
3871
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3964,7 +3964,7 @@ function isOidcProtocolMode(config) {
3964
3964
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
3965
3965
  }
3966
3966
 
3967
- /*! @azure/msal-common v15.1.0 2025-02-03 */
3967
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
3968
3968
  /*
3969
3969
  * Copyright (c) Microsoft Corporation. All rights reserved.
3970
3970
  * Licensed under the MIT License.
@@ -3974,7 +3974,7 @@ const CcsCredentialType = {
3974
3974
  UPN: "UPN",
3975
3975
  };
3976
3976
 
3977
- /*! @azure/msal-common v15.1.0 2025-02-03 */
3977
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
3978
3978
  /*
3979
3979
  * Copyright (c) Microsoft Corporation. All rights reserved.
3980
3980
  * Licensed under the MIT License.
@@ -4024,7 +4024,7 @@ const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
4024
4024
  const BROKER_CLIENT_ID = "brk_client_id";
4025
4025
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
4026
4026
 
4027
- /*! @azure/msal-common v15.1.0 2025-02-03 */
4027
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4028
4028
 
4029
4029
  /*
4030
4030
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4091,7 +4091,7 @@ class RequestValidator {
4091
4091
  }
4092
4092
  }
4093
4093
 
4094
- /*! @azure/msal-common v15.1.0 2025-02-03 */
4094
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4095
4095
 
4096
4096
  /*
4097
4097
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4499,7 +4499,7 @@ class RequestParameterBuilder {
4499
4499
  }
4500
4500
  }
4501
4501
 
4502
- /*! @azure/msal-common v15.1.0 2025-02-03 */
4502
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4503
4503
  /*
4504
4504
  * Copyright (c) Microsoft Corporation. All rights reserved.
4505
4505
  * Licensed under the MIT License.
@@ -4511,7 +4511,7 @@ function isOpenIdConfigResponse(response) {
4511
4511
  response.hasOwnProperty("jwks_uri"));
4512
4512
  }
4513
4513
 
4514
- /*! @azure/msal-common v15.1.0 2025-02-03 */
4514
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4515
4515
  /*
4516
4516
  * Copyright (c) Microsoft Corporation. All rights reserved.
4517
4517
  * Licensed under the MIT License.
@@ -4521,7 +4521,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4521
4521
  response.hasOwnProperty("metadata"));
4522
4522
  }
4523
4523
 
4524
- /*! @azure/msal-common v15.1.0 2025-02-03 */
4524
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4525
4525
  /*
4526
4526
  * Copyright (c) Microsoft Corporation. All rights reserved.
4527
4527
  * Licensed under the MIT License.
@@ -4531,7 +4531,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4531
4531
  response.hasOwnProperty("error_description"));
4532
4532
  }
4533
4533
 
4534
- /*! @azure/msal-common v15.1.0 2025-02-03 */
4534
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
4535
4535
  /*
4536
4536
  * Copyright (c) Microsoft Corporation. All rights reserved.
4537
4537
  * Licensed under the MIT License.
@@ -4769,6 +4769,7 @@ const PerformanceEvents = {
4769
4769
  CacheManagerGetRefreshToken: "cacheManagerGetRefreshToken",
4770
4770
  ImportExistingCache: "importExistingCache",
4771
4771
  SetUserData: "setUserData",
4772
+ LocalStorageUpdated: "localStorageUpdated",
4772
4773
  /**
4773
4774
  * Crypto Operations
4774
4775
  */
@@ -4870,6 +4871,7 @@ const PerformanceEventAbbreviations = new Map([
4870
4871
  [PerformanceEvents.InitializeCache, "InitCache"],
4871
4872
  [PerformanceEvents.ImportExistingCache, "importCache"],
4872
4873
  [PerformanceEvents.SetUserData, "setUserData"],
4874
+ [PerformanceEvents.LocalStorageUpdated, "localStorageUpdated"],
4873
4875
  [PerformanceEvents.SilentIframeClientTokenHelper, "SIClientTHelper"],
4874
4876
  [
4875
4877
  PerformanceEvents.SilentHandlerInitiateAuthRequest,
@@ -5038,7 +5040,7 @@ const IntFields = new Set([
5038
5040
  "encryptedCacheExpiredCount",
5039
5041
  ]);
5040
5042
 
5041
- /*! @azure/msal-common v15.1.0 2025-02-03 */
5043
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
5042
5044
  /*
5043
5045
  * Copyright (c) Microsoft Corporation. All rights reserved.
5044
5046
  * Licensed under the MIT License.
@@ -5134,7 +5136,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
5134
5136
  };
5135
5137
  };
5136
5138
 
5137
- /*! @azure/msal-common v15.1.0 2025-02-03 */
5139
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
5138
5140
 
5139
5141
  /*
5140
5142
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5243,7 +5245,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5243
5245
  },
5244
5246
  };
5245
5247
 
5246
- /*! @azure/msal-common v15.1.0 2025-02-03 */
5248
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
5247
5249
 
5248
5250
  /*
5249
5251
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6082,7 +6084,7 @@ function buildStaticAuthorityOptions(authOptions) {
6082
6084
  };
6083
6085
  }
6084
6086
 
6085
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6087
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6086
6088
 
6087
6089
  /*
6088
6090
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6113,7 +6115,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6113
6115
  }
6114
6116
  }
6115
6117
 
6116
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6118
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6117
6119
 
6118
6120
  /*
6119
6121
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6132,7 +6134,7 @@ class ServerError extends AuthError {
6132
6134
  }
6133
6135
  }
6134
6136
 
6135
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6137
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6136
6138
 
6137
6139
  /*
6138
6140
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6230,7 +6232,7 @@ class ThrottlingUtils {
6230
6232
  }
6231
6233
  }
6232
6234
 
6233
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6235
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6234
6236
 
6235
6237
  /*
6236
6238
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6260,7 +6262,7 @@ function createNetworkError(error, httpStatus, responseHeaders) {
6260
6262
  return new NetworkError(error, httpStatus, responseHeaders);
6261
6263
  }
6262
6264
 
6263
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6265
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6264
6266
 
6265
6267
  /*
6266
6268
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6410,7 +6412,7 @@ class BaseClient {
6410
6412
  }
6411
6413
  }
6412
6414
 
6413
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6415
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6414
6416
  /*
6415
6417
  * Copyright (c) Microsoft Corporation. All rights reserved.
6416
6418
  * Licensed under the MIT License.
@@ -6436,7 +6438,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6436
6438
  refreshTokenExpired: refreshTokenExpired
6437
6439
  });
6438
6440
 
6439
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6441
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6440
6442
 
6441
6443
  /*
6442
6444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6524,7 +6526,7 @@ function createInteractionRequiredAuthError(errorCode) {
6524
6526
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6525
6527
  }
6526
6528
 
6527
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6529
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6528
6530
 
6529
6531
  /*
6530
6532
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6596,7 +6598,7 @@ class ProtocolUtils {
6596
6598
  }
6597
6599
  }
6598
6600
 
6599
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6601
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6600
6602
 
6601
6603
  /*
6602
6604
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6680,7 +6682,7 @@ class PopTokenGenerator {
6680
6682
  }
6681
6683
  }
6682
6684
 
6683
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6685
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6684
6686
  /*
6685
6687
  * Copyright (c) Microsoft Corporation. All rights reserved.
6686
6688
  * Licensed under the MIT License.
@@ -6707,7 +6709,7 @@ class PopTokenGenerator {
6707
6709
  }
6708
6710
  }
6709
6711
 
6710
- /*! @azure/msal-common v15.1.0 2025-02-03 */
6712
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
6711
6713
 
6712
6714
  /*
6713
6715
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7084,7 +7086,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7084
7086
  return baseAccount;
7085
7087
  }
7086
7088
 
7087
- /*! @azure/msal-common v15.1.0 2025-02-03 */
7089
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7088
7090
  /*
7089
7091
  * Copyright (c) Microsoft Corporation. All rights reserved.
7090
7092
  * Licensed under the MIT License.
@@ -7102,7 +7104,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
7102
7104
  }
7103
7105
  }
7104
7106
 
7105
- /*! @azure/msal-common v15.1.0 2025-02-03 */
7107
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7106
7108
 
7107
7109
  /*
7108
7110
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7552,7 +7554,7 @@ class AuthorizationCodeClient extends BaseClient {
7552
7554
  }
7553
7555
  }
7554
7556
 
7555
- /*! @azure/msal-common v15.1.0 2025-02-03 */
7557
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7556
7558
 
7557
7559
  /*
7558
7560
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7775,7 +7777,7 @@ class RefreshTokenClient extends BaseClient {
7775
7777
  }
7776
7778
  }
7777
7779
 
7778
- /*! @azure/msal-common v15.1.0 2025-02-03 */
7780
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7779
7781
 
7780
7782
  /*
7781
7783
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7873,7 +7875,7 @@ class SilentFlowClient extends BaseClient {
7873
7875
  }
7874
7876
  }
7875
7877
 
7876
- /*! @azure/msal-common v15.1.0 2025-02-03 */
7878
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7877
7879
 
7878
7880
  /*
7879
7881
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7888,7 +7890,7 @@ const StubbedNetworkModule = {
7888
7890
  },
7889
7891
  };
7890
7892
 
7891
- /*! @azure/msal-common v15.1.0 2025-02-03 */
7893
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7892
7894
 
7893
7895
  /*
7894
7896
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7946,7 +7948,7 @@ class AuthenticationHeaderParser {
7946
7948
  }
7947
7949
  }
7948
7950
 
7949
- /*! @azure/msal-common v15.1.0 2025-02-03 */
7951
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
7950
7952
 
7951
7953
  /*
7952
7954
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8209,7 +8211,7 @@ class ServerTelemetryManager {
8209
8211
  }
8210
8212
  }
8211
8213
 
8212
- /*! @azure/msal-common v15.1.0 2025-02-03 */
8214
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8213
8215
  /*
8214
8216
  * Copyright (c) Microsoft Corporation. All rights reserved.
8215
8217
  * Licensed under the MIT License.
@@ -8217,7 +8219,7 @@ class ServerTelemetryManager {
8217
8219
  const missingKidError = "missing_kid_error";
8218
8220
  const missingAlgError = "missing_alg_error";
8219
8221
 
8220
- /*! @azure/msal-common v15.1.0 2025-02-03 */
8222
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8221
8223
 
8222
8224
  /*
8223
8225
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8242,7 +8244,7 @@ function createJoseHeaderError(code) {
8242
8244
  return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
8243
8245
  }
8244
8246
 
8245
- /*! @azure/msal-common v15.1.0 2025-02-03 */
8247
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8246
8248
 
8247
8249
  /*
8248
8250
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8282,7 +8284,7 @@ class JoseHeader {
8282
8284
  }
8283
8285
  }
8284
8286
 
8285
- /*! @azure/msal-common v15.1.0 2025-02-03 */
8287
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8286
8288
 
8287
8289
  /*
8288
8290
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8361,7 +8363,7 @@ class StubPerformanceClient {
8361
8363
  }
8362
8364
  }
8363
8365
 
8364
- /*! @azure/msal-common v15.1.0 2025-02-03 */
8366
+ /*! @azure/msal-common v15.1.1 2025-02-05 */
8365
8367
 
8366
8368
  /*
8367
8369
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10398,7 +10400,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
10398
10400
 
10399
10401
  /* eslint-disable header/header */
10400
10402
  const name = "@azure/msal-browser";
10401
- const version = "4.1.0";
10403
+ const version = "4.2.0";
10402
10404
 
10403
10405
  /*
10404
10406
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11331,6 +11333,10 @@ function getSortedObjectString(obj) {
11331
11333
  */
11332
11334
  // Cookie life calculation (hours * minutes * seconds * ms)
11333
11335
  const COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;
11336
+ const SameSiteOptions = {
11337
+ Lax: "Lax",
11338
+ None: "None",
11339
+ };
11334
11340
  class CookieStorage {
11335
11341
  initialize() {
11336
11342
  return Promise.resolve();
@@ -11351,13 +11357,14 @@ class CookieStorage {
11351
11357
  getUserData() {
11352
11358
  throw createClientAuthError(methodNotImplemented);
11353
11359
  }
11354
- setItem(key, value, cookieLifeDays, secure = true) {
11355
- let cookieStr = `${encodeURIComponent(key)}=${encodeURIComponent(value)};path=/;SameSite=Lax;`;
11360
+ setItem(key, value, cookieLifeDays, secure = true, sameSite = SameSiteOptions.Lax) {
11361
+ let cookieStr = `${encodeURIComponent(key)}=${encodeURIComponent(value)};path=/;SameSite=${sameSite};`;
11356
11362
  if (cookieLifeDays) {
11357
11363
  const expireTime = getCookieExpirationTime(cookieLifeDays);
11358
11364
  cookieStr += `expires=${expireTime};`;
11359
11365
  }
11360
- if (secure) {
11366
+ if (secure || sameSite === SameSiteOptions.None) {
11367
+ // SameSite None requires Secure flag
11361
11368
  cookieStr += "Secure;";
11362
11369
  }
11363
11370
  document.cookie = cookieStr;
@@ -11437,6 +11444,7 @@ function getTokenKeys(clientId, storage) {
11437
11444
  * Licensed under the MIT License.
11438
11445
  */
11439
11446
  const ENCRYPTION_KEY = "msal.cache.encryption";
11447
+ const BROADCAST_CHANNEL_NAME$1 = "msal.broadcast.cache";
11440
11448
  class LocalStorage {
11441
11449
  constructor(clientId, logger, performanceClient) {
11442
11450
  if (!window.localStorage) {
@@ -11447,6 +11455,7 @@ class LocalStorage {
11447
11455
  this.clientId = clientId;
11448
11456
  this.logger = logger;
11449
11457
  this.performanceClient = performanceClient;
11458
+ this.broadcast = new BroadcastChannel(BROADCAST_CHANNEL_NAME$1);
11450
11459
  }
11451
11460
  async initialize(correlationId) {
11452
11461
  this.initialized = true;
@@ -11482,8 +11491,13 @@ class LocalStorage {
11482
11491
  id: id,
11483
11492
  key: keyStr,
11484
11493
  };
11485
- cookies.setItem(ENCRYPTION_KEY, JSON.stringify(cookieData));
11494
+ cookies.setItem(ENCRYPTION_KEY, JSON.stringify(cookieData), 0, // Expiration - 0 means cookie will be cleared at the end of the browser session
11495
+ true, // Secure flag
11496
+ SameSiteOptions.None // SameSite must be None to support iframed apps
11497
+ );
11486
11498
  }
11499
+ // Register listener for cache updates in other tabs
11500
+ this.broadcast.addEventListener("message", this.updateCache.bind(this));
11487
11501
  }
11488
11502
  getItem(key) {
11489
11503
  return window.localStorage.getItem(key);
@@ -11509,9 +11523,22 @@ class LocalStorage {
11509
11523
  };
11510
11524
  this.memoryStorage.setItem(key, value);
11511
11525
  this.setItem(key, JSON.stringify(encryptedData));
11526
+ // Notify other frames to update their in-memory cache
11527
+ this.broadcast.postMessage({
11528
+ key: key,
11529
+ value: value,
11530
+ context: this.getContext(key),
11531
+ });
11512
11532
  }
11513
11533
  removeItem(key) {
11514
- this.memoryStorage.removeItem(key);
11534
+ if (this.memoryStorage.containsKey(key)) {
11535
+ this.memoryStorage.removeItem(key);
11536
+ this.broadcast.postMessage({
11537
+ key: key,
11538
+ value: null,
11539
+ context: this.getContext(key),
11540
+ });
11541
+ }
11515
11542
  window.localStorage.removeItem(key);
11516
11543
  }
11517
11544
  getKeys() {
@@ -11628,6 +11655,34 @@ class LocalStorage {
11628
11655
  }
11629
11656
  return context;
11630
11657
  }
11658
+ updateCache(event) {
11659
+ this.logger.trace("Updating internal cache from broadcast event");
11660
+ const perfMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.LocalStorageUpdated);
11661
+ perfMeasurement.add({ isBackground: true });
11662
+ const { key, value, context } = event.data;
11663
+ if (!key) {
11664
+ this.logger.error("Broadcast event missing key");
11665
+ perfMeasurement.end({ success: false, errorCode: "noKey" });
11666
+ return;
11667
+ }
11668
+ if (context && context !== this.clientId) {
11669
+ this.logger.trace(`Ignoring broadcast event from clientId: ${context}`);
11670
+ perfMeasurement.end({
11671
+ success: false,
11672
+ errorCode: "contextMismatch",
11673
+ });
11674
+ return;
11675
+ }
11676
+ if (!value) {
11677
+ this.memoryStorage.removeItem(key);
11678
+ this.logger.verbose("Removed item from internal cache");
11679
+ }
11680
+ else {
11681
+ this.memoryStorage.setItem(key, value);
11682
+ this.logger.verbose("Updated item in internal cache");
11683
+ }
11684
+ perfMeasurement.end({ success: true });
11685
+ }
11631
11686
  }
11632
11687
 
11633
11688
  /*
@@ -11688,6 +11743,39 @@ function extractBrowserRequestState(browserCrypto, state) {
11688
11743
  }
11689
11744
  }
11690
11745
 
11746
+ /*
11747
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11748
+ * Licensed under the MIT License.
11749
+ */
11750
+ const EventType = {
11751
+ INITIALIZE_START: "msal:initializeStart",
11752
+ INITIALIZE_END: "msal:initializeEnd",
11753
+ ACCOUNT_ADDED: "msal:accountAdded",
11754
+ ACCOUNT_REMOVED: "msal:accountRemoved",
11755
+ ACTIVE_ACCOUNT_CHANGED: "msal:activeAccountChanged",
11756
+ LOGIN_START: "msal:loginStart",
11757
+ LOGIN_SUCCESS: "msal:loginSuccess",
11758
+ LOGIN_FAILURE: "msal:loginFailure",
11759
+ ACQUIRE_TOKEN_START: "msal:acquireTokenStart",
11760
+ ACQUIRE_TOKEN_SUCCESS: "msal:acquireTokenSuccess",
11761
+ ACQUIRE_TOKEN_FAILURE: "msal:acquireTokenFailure",
11762
+ ACQUIRE_TOKEN_NETWORK_START: "msal:acquireTokenFromNetworkStart",
11763
+ SSO_SILENT_START: "msal:ssoSilentStart",
11764
+ SSO_SILENT_SUCCESS: "msal:ssoSilentSuccess",
11765
+ SSO_SILENT_FAILURE: "msal:ssoSilentFailure",
11766
+ ACQUIRE_TOKEN_BY_CODE_START: "msal:acquireTokenByCodeStart",
11767
+ ACQUIRE_TOKEN_BY_CODE_SUCCESS: "msal:acquireTokenByCodeSuccess",
11768
+ ACQUIRE_TOKEN_BY_CODE_FAILURE: "msal:acquireTokenByCodeFailure",
11769
+ HANDLE_REDIRECT_START: "msal:handleRedirectStart",
11770
+ HANDLE_REDIRECT_END: "msal:handleRedirectEnd",
11771
+ POPUP_OPENED: "msal:popupOpened",
11772
+ LOGOUT_START: "msal:logoutStart",
11773
+ LOGOUT_SUCCESS: "msal:logoutSuccess",
11774
+ LOGOUT_FAILURE: "msal:logoutFailure",
11775
+ LOGOUT_END: "msal:logoutEnd",
11776
+ RESTORE_FROM_BFCACHE: "msal:restoreFromBFCache",
11777
+ };
11778
+
11691
11779
  /*
11692
11780
  * Copyright (c) Microsoft Corporation. All rights reserved.
11693
11781
  * Licensed under the MIT License.
@@ -11698,7 +11786,7 @@ function extractBrowserRequestState(browserCrypto, state) {
11698
11786
  * parameters such as state and nonce, generally.
11699
11787
  */
11700
11788
  class BrowserCacheManager extends CacheManager {
11701
- constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, staticAuthorityOptions) {
11789
+ constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, eventHandler, staticAuthorityOptions) {
11702
11790
  super(clientId, cryptoImpl, logger, staticAuthorityOptions);
11703
11791
  this.cacheConfig = cacheConfig;
11704
11792
  this.logger = logger;
@@ -11707,6 +11795,7 @@ class BrowserCacheManager extends CacheManager {
11707
11795
  this.temporaryCacheStorage = getStorageImplementation(clientId, cacheConfig.temporaryCacheLocation, logger, performanceClient);
11708
11796
  this.cookieStorage = new CookieStorage();
11709
11797
  this.performanceClient = performanceClient;
11798
+ this.eventHandler = eventHandler;
11710
11799
  }
11711
11800
  async initialize(correlationId) {
11712
11801
  await this.browserStorage.initialize(correlationId);
@@ -11760,7 +11849,15 @@ class BrowserCacheManager extends CacheManager {
11760
11849
  this.logger.trace("BrowserCacheManager.setAccount called");
11761
11850
  const key = account.generateAccountKey();
11762
11851
  await invokeAsync(this.browserStorage.setUserData.bind(this.browserStorage), PerformanceEvents.SetUserData, this.logger, this.performanceClient)(key, JSON.stringify(account), correlationId);
11763
- this.addAccountKeyToMap(key);
11852
+ const wasAdded = this.addAccountKeyToMap(key);
11853
+ /**
11854
+ * @deprecated - Remove this in next major version in favor of more consistent LOGIN event
11855
+ */
11856
+ if (this.cacheConfig.cacheLocation ===
11857
+ BrowserCacheLocation.LocalStorage &&
11858
+ wasAdded) {
11859
+ this.eventHandler.emitEvent(EventType.ACCOUNT_ADDED, undefined, account.getAccountInfo());
11860
+ }
11764
11861
  }
11765
11862
  /**
11766
11863
  * Returns the array of account keys currently cached
@@ -11782,9 +11879,11 @@ class BrowserCacheManager extends CacheManager {
11782
11879
  accountKeys.push(key);
11783
11880
  this.browserStorage.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
11784
11881
  this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added");
11882
+ return true;
11785
11883
  }
11786
11884
  else {
11787
11885
  this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map");
11886
+ return false;
11788
11887
  }
11789
11888
  }
11790
11889
  /**
@@ -11813,6 +11912,19 @@ class BrowserCacheManager extends CacheManager {
11813
11912
  void super.removeAccount(key);
11814
11913
  this.removeAccountKeyFromMap(key);
11815
11914
  }
11915
+ /**
11916
+ * Removes credentials associated with the provided account
11917
+ * @param account
11918
+ */
11919
+ async removeAccountContext(account) {
11920
+ await super.removeAccountContext(account);
11921
+ /**
11922
+ * @deprecated - Remove this in next major version in favor of more consistent LOGOUT event
11923
+ */
11924
+ if (this.cacheConfig.cacheLocation === BrowserCacheLocation.LocalStorage) {
11925
+ this.eventHandler.emitEvent(EventType.ACCOUNT_REMOVED, undefined, account.getAccountInfo());
11926
+ }
11927
+ }
11816
11928
  /**
11817
11929
  * Removes given idToken from the cache and from the key map
11818
11930
  * @param key
@@ -12167,6 +12279,7 @@ class BrowserCacheManager extends CacheManager {
12167
12279
  this.logger.verbose("setActiveAccount: No account passed, active account not set");
12168
12280
  this.browserStorage.removeItem(activeAccountKey);
12169
12281
  }
12282
+ this.eventHandler.emitEvent(EventType.ACTIVE_ACCOUNT_CHANGED);
12170
12283
  }
12171
12284
  /**
12172
12285
  * fetch throttling entity from the platform cache
@@ -12624,7 +12737,7 @@ function getStorageImplementation(clientId, cacheLocation, logger, performanceCl
12624
12737
  }
12625
12738
  return new MemoryStorage();
12626
12739
  }
12627
- const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient) => {
12740
+ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, eventHandler) => {
12628
12741
  const cacheOptions = {
12629
12742
  cacheLocation: BrowserCacheLocation.MemoryStorage,
12630
12743
  temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
@@ -12633,7 +12746,7 @@ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient) => {
12633
12746
  cacheMigrationEnabled: false,
12634
12747
  claimsBasedCachingEnabled: false,
12635
12748
  };
12636
- return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient);
12749
+ return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient, eventHandler);
12637
12750
  };
12638
12751
 
12639
12752
  /*
@@ -12767,43 +12880,13 @@ function getActiveAccount(browserStorage) {
12767
12880
  * Copyright (c) Microsoft Corporation. All rights reserved.
12768
12881
  * Licensed under the MIT License.
12769
12882
  */
12770
- const EventType = {
12771
- INITIALIZE_START: "msal:initializeStart",
12772
- INITIALIZE_END: "msal:initializeEnd",
12773
- ACCOUNT_ADDED: "msal:accountAdded",
12774
- ACCOUNT_REMOVED: "msal:accountRemoved",
12775
- ACTIVE_ACCOUNT_CHANGED: "msal:activeAccountChanged",
12776
- LOGIN_START: "msal:loginStart",
12777
- LOGIN_SUCCESS: "msal:loginSuccess",
12778
- LOGIN_FAILURE: "msal:loginFailure",
12779
- ACQUIRE_TOKEN_START: "msal:acquireTokenStart",
12780
- ACQUIRE_TOKEN_SUCCESS: "msal:acquireTokenSuccess",
12781
- ACQUIRE_TOKEN_FAILURE: "msal:acquireTokenFailure",
12782
- ACQUIRE_TOKEN_NETWORK_START: "msal:acquireTokenFromNetworkStart",
12783
- SSO_SILENT_START: "msal:ssoSilentStart",
12784
- SSO_SILENT_SUCCESS: "msal:ssoSilentSuccess",
12785
- SSO_SILENT_FAILURE: "msal:ssoSilentFailure",
12786
- ACQUIRE_TOKEN_BY_CODE_START: "msal:acquireTokenByCodeStart",
12787
- ACQUIRE_TOKEN_BY_CODE_SUCCESS: "msal:acquireTokenByCodeSuccess",
12788
- ACQUIRE_TOKEN_BY_CODE_FAILURE: "msal:acquireTokenByCodeFailure",
12789
- HANDLE_REDIRECT_START: "msal:handleRedirectStart",
12790
- HANDLE_REDIRECT_END: "msal:handleRedirectEnd",
12791
- POPUP_OPENED: "msal:popupOpened",
12792
- LOGOUT_START: "msal:logoutStart",
12793
- LOGOUT_SUCCESS: "msal:logoutSuccess",
12794
- LOGOUT_FAILURE: "msal:logoutFailure",
12795
- LOGOUT_END: "msal:logoutEnd",
12796
- RESTORE_FROM_BFCACHE: "msal:restoreFromBFCache",
12797
- };
12798
-
12799
- /*
12800
- * Copyright (c) Microsoft Corporation. All rights reserved.
12801
- * Licensed under the MIT License.
12802
- */
12883
+ const BROADCAST_CHANNEL_NAME = "msal.broadcast.event";
12803
12884
  class EventHandler {
12804
12885
  constructor(logger) {
12805
12886
  this.eventCallbacks = new Map();
12806
12887
  this.logger = logger || new Logger({});
12888
+ this.broadcastChannel = new BroadcastChannel(BROADCAST_CHANNEL_NAME);
12889
+ this.invokeCrossTabCallbacks = this.invokeCrossTabCallbacks.bind(this);
12807
12890
  }
12808
12891
  /**
12809
12892
  * Adds event callbacks to array
@@ -12840,23 +12923,59 @@ class EventHandler {
12840
12923
  * @param error
12841
12924
  */
12842
12925
  emitEvent(eventType, interactionType, payload, error) {
12843
- if (typeof window !== "undefined") {
12844
- const message = {
12845
- eventType: eventType,
12846
- interactionType: interactionType || null,
12847
- payload: payload || null,
12848
- error: error || null,
12849
- timestamp: Date.now(),
12850
- };
12851
- this.eventCallbacks.forEach(([callback, eventTypes], callbackId) => {
12852
- if (eventTypes.length === 0 ||
12853
- eventTypes.includes(eventType)) {
12854
- this.logger.verbose(`Emitting event to callback ${callbackId}: ${eventType}`);
12855
- callback.apply(null, [message]);
12856
- }
12857
- });
12926
+ const message = {
12927
+ eventType: eventType,
12928
+ interactionType: interactionType || null,
12929
+ payload: payload || null,
12930
+ error: error || null,
12931
+ timestamp: Date.now(),
12932
+ };
12933
+ switch (eventType) {
12934
+ case EventType.ACCOUNT_ADDED:
12935
+ case EventType.ACCOUNT_REMOVED:
12936
+ case EventType.ACTIVE_ACCOUNT_CHANGED:
12937
+ // Send event to other open tabs / MSAL instances on same domain
12938
+ this.broadcastChannel.postMessage(message);
12939
+ break;
12940
+ default:
12941
+ // Emit event to callbacks registered in this instance
12942
+ this.invokeCallbacks(message);
12943
+ break;
12858
12944
  }
12859
12945
  }
12946
+ /**
12947
+ * Invoke registered callbacks
12948
+ * @param message
12949
+ */
12950
+ invokeCallbacks(message) {
12951
+ this.eventCallbacks.forEach(([callback, eventTypes], callbackId) => {
12952
+ if (eventTypes.length === 0 ||
12953
+ eventTypes.includes(message.eventType)) {
12954
+ this.logger.verbose(`Emitting event to callback ${callbackId}: ${message.eventType}`);
12955
+ callback.apply(null, [message]);
12956
+ }
12957
+ });
12958
+ }
12959
+ /**
12960
+ * Wrapper around invokeCallbacks to handle broadcast events received from other tabs/instances
12961
+ * @param event
12962
+ */
12963
+ invokeCrossTabCallbacks(event) {
12964
+ const message = event.data;
12965
+ this.invokeCallbacks(message);
12966
+ }
12967
+ /**
12968
+ * Listen for events broadcasted from other tabs/instances
12969
+ */
12970
+ subscribeCrossTab() {
12971
+ this.broadcastChannel.addEventListener("message", this.invokeCrossTabCallbacks);
12972
+ }
12973
+ /**
12974
+ * Unsubscribe from broadcast events
12975
+ */
12976
+ unsubscribeCrossTab() {
12977
+ this.broadcastChannel.removeEventListener("message", this.invokeCrossTabCallbacks);
12978
+ }
12860
12979
  }
12861
12980
 
12862
12981
  /*
@@ -16029,8 +16148,8 @@ class StandardController {
16029
16148
  this.eventHandler = new EventHandler(this.logger);
16030
16149
  // Initialize the browser storage class.
16031
16150
  this.browserStorage = this.isBrowserEnvironment
16032
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, buildStaticAuthorityOptions(this.config.auth))
16033
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
16151
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth))
16152
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
16034
16153
  // initialize in memory storage for native flows
16035
16154
  const nativeCacheOptions = {
16036
16155
  cacheLocation: BrowserCacheLocation.MemoryStorage,
@@ -16040,7 +16159,7 @@ class StandardController {
16040
16159
  cacheMigrationEnabled: false,
16041
16160
  claimsBasedCachingEnabled: false,
16042
16161
  };
16043
- this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient);
16162
+ this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler);
16044
16163
  // Initialize the token cache
16045
16164
  this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
16046
16165
  this.activeSilentTokenRequests = new Map();
@@ -16049,10 +16168,6 @@ class StandardController {
16049
16168
  // Register listener functions
16050
16169
  this.trackPageVisibilityWithMeasurement =
16051
16170
  this.trackPageVisibilityWithMeasurement.bind(this);
16052
- // account storage events
16053
- this.listeningToStorageEvents = false;
16054
- this.handleAccountCacheChange =
16055
- this.handleAccountCacheChange.bind(this);
16056
16171
  }
16057
16172
  static async createController(operatingContext, request) {
16058
16173
  const controller = new StandardController(operatingContext);
@@ -16951,70 +17066,27 @@ class StandardController {
16951
17066
  }
16952
17067
  /**
16953
17068
  * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
17069
+ * @deprecated These events will be raised by default and this method will be removed in a future major version.
16954
17070
  */
16955
17071
  enableAccountStorageEvents() {
16956
- if (typeof window === "undefined") {
17072
+ if (this.config.cache.cacheLocation !==
17073
+ BrowserCacheLocation.LocalStorage) {
17074
+ this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");
16957
17075
  return;
16958
17076
  }
16959
- if (!this.listeningToStorageEvents) {
16960
- this.logger.verbose("Adding account storage listener.");
16961
- this.listeningToStorageEvents = true;
16962
- window.addEventListener("storage", this.handleAccountCacheChange);
16963
- }
16964
- else {
16965
- this.logger.verbose("Account storage listener already registered.");
16966
- }
17077
+ this.eventHandler.subscribeCrossTab();
16967
17078
  }
16968
17079
  /**
16969
17080
  * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
17081
+ * @deprecated These events will be raised by default and this method will be removed in a future major version.
16970
17082
  */
16971
17083
  disableAccountStorageEvents() {
16972
- if (typeof window === "undefined") {
16973
- return;
16974
- }
16975
- if (this.listeningToStorageEvents) {
16976
- this.logger.verbose("Removing account storage listener.");
16977
- window.removeEventListener("storage", this.handleAccountCacheChange);
16978
- this.listeningToStorageEvents = false;
16979
- }
16980
- else {
16981
- this.logger.verbose("No account storage listener registered.");
16982
- }
16983
- }
16984
- /**
16985
- * Emit account added/removed events when cached accounts are changed in a different tab or frame
16986
- */
16987
- handleAccountCacheChange(e) {
16988
- try {
16989
- // Handle active account filter change
16990
- if (e.key?.includes(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS)) {
16991
- // This event has no payload, it only signals cross-tab app instances that the results of calling getActiveAccount() will have changed
16992
- this.eventHandler.emitEvent(EventType.ACTIVE_ACCOUNT_CHANGED);
16993
- }
16994
- // Handle account object change
16995
- const cacheValue = e.newValue || e.oldValue;
16996
- if (!cacheValue) {
16997
- return;
16998
- }
16999
- const parsedValue = JSON.parse(cacheValue);
17000
- if (typeof parsedValue !== "object" ||
17001
- !AccountEntity.isAccountEntity(parsedValue)) {
17002
- return;
17003
- }
17004
- const accountEntity = CacheManager.toObject(new AccountEntity(), parsedValue);
17005
- const accountInfo = accountEntity.getAccountInfo();
17006
- if (!e.oldValue && e.newValue) {
17007
- this.logger.info("Account was added to cache in a different window");
17008
- this.eventHandler.emitEvent(EventType.ACCOUNT_ADDED, undefined, accountInfo);
17009
- }
17010
- else if (!e.newValue && e.oldValue) {
17011
- this.logger.info("Account was removed from cache in a different window");
17012
- this.eventHandler.emitEvent(EventType.ACCOUNT_REMOVED, undefined, accountInfo);
17013
- }
17014
- }
17015
- catch (e) {
17084
+ if (this.config.cache.cacheLocation !==
17085
+ BrowserCacheLocation.LocalStorage) {
17086
+ this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");
17016
17087
  return;
17017
17088
  }
17089
+ this.eventHandler.unsubscribeCrossTab();
17018
17090
  }
17019
17091
  /**
17020
17092
  * Gets the token cache for the application.
@@ -17587,11 +17659,11 @@ class NestedAppAuthController {
17587
17659
  this.browserCrypto = operatingContext.isBrowserEnvironment()
17588
17660
  ? new CryptoOps(this.logger, this.performanceClient, true)
17589
17661
  : DEFAULT_CRYPTO_IMPLEMENTATION;
17662
+ this.eventHandler = new EventHandler(this.logger);
17590
17663
  // Initialize the browser storage class.
17591
17664
  this.browserStorage = this.operatingContext.isBrowserEnvironment()
17592
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, buildStaticAuthorityOptions(this.config.auth))
17593
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
17594
- this.eventHandler = new EventHandler(this.logger);
17665
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth))
17666
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
17595
17667
  this.nestedAppAuthAdapter = new NestedAppAuthAdapter(this.config.auth.clientId, this.config.auth.clientCapabilities, this.browserCrypto, this.logger);
17596
17668
  // Set the active account if available
17597
17669
  const accountContext = this.bridgeProxy.getAccountContext();
@@ -18487,10 +18559,11 @@ class UnknownOperatingContextController {
18487
18559
  this.browserCrypto = this.isBrowserEnvironment
18488
18560
  ? new CryptoOps(this.logger, this.performanceClient)
18489
18561
  : DEFAULT_CRYPTO_IMPLEMENTATION;
18562
+ this.eventHandler = new EventHandler(this.logger);
18490
18563
  // Initialize the browser storage class.
18491
18564
  this.browserStorage = this.isBrowserEnvironment
18492
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, undefined)
18493
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
18565
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, undefined)
18566
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
18494
18567
  }
18495
18568
  getBrowserStorage() {
18496
18569
  return this.browserStorage;