@azure/msal-browser 3.2.0 → 3.4.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 (224) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  3. package/dist/app/PublicClientApplication.mjs +3 -4
  4. package/dist/app/PublicClientApplication.mjs.map +1 -1
  5. package/dist/app/PublicClientNext.d.ts +274 -0
  6. package/dist/app/PublicClientNext.d.ts.map +1 -0
  7. package/dist/app/PublicClientNext.mjs +360 -0
  8. package/dist/app/PublicClientNext.mjs.map +1 -0
  9. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  10. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  11. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  12. package/dist/cache/BrowserCacheManager.d.ts +2 -13
  13. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  14. package/dist/cache/BrowserCacheManager.mjs +26 -83
  15. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  16. package/dist/cache/BrowserStorage.mjs +1 -1
  17. package/dist/cache/CryptoKeyStore.mjs +1 -1
  18. package/dist/cache/DatabaseStorage.mjs +1 -1
  19. package/dist/cache/MemoryStorage.mjs +1 -1
  20. package/dist/cache/TokenCache.d.ts.map +1 -1
  21. package/dist/cache/TokenCache.mjs +5 -5
  22. package/dist/cache/TokenCache.mjs.map +1 -1
  23. package/dist/config/Configuration.d.ts +4 -0
  24. package/dist/config/Configuration.d.ts.map +1 -1
  25. package/dist/config/Configuration.mjs +2 -1
  26. package/dist/config/Configuration.mjs.map +1 -1
  27. package/dist/controllers/ControllerFactory.d.ts +2 -7
  28. package/dist/controllers/ControllerFactory.d.ts.map +1 -1
  29. package/dist/controllers/ControllerFactory.mjs +24 -34
  30. package/dist/controllers/ControllerFactory.mjs.map +1 -1
  31. package/dist/controllers/IController.d.ts +1 -2
  32. package/dist/controllers/IController.d.ts.map +1 -1
  33. package/dist/controllers/NestedAppAuthController.d.ts +96 -0
  34. package/dist/controllers/NestedAppAuthController.d.ts.map +1 -0
  35. package/dist/controllers/NestedAppAuthController.mjs +345 -0
  36. package/dist/controllers/NestedAppAuthController.mjs.map +1 -0
  37. package/dist/controllers/StandardController.d.ts +4 -4
  38. package/dist/controllers/StandardController.d.ts.map +1 -1
  39. package/dist/controllers/StandardController.mjs +43 -42
  40. package/dist/controllers/StandardController.mjs.map +1 -1
  41. package/dist/controllers/UnknownOperatingContextController.d.ts +88 -0
  42. package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -0
  43. package/dist/controllers/UnknownOperatingContextController.mjs +275 -0
  44. package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -0
  45. package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
  46. package/dist/crypto/BrowserCrypto.mjs +3 -3
  47. package/dist/crypto/BrowserCrypto.mjs.map +1 -1
  48. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  49. package/dist/crypto/CryptoOps.mjs +8 -5
  50. package/dist/crypto/CryptoOps.mjs.map +1 -1
  51. package/dist/crypto/PkceGenerator.mjs +1 -1
  52. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  53. package/dist/encode/Base64Decode.mjs +1 -1
  54. package/dist/encode/Base64Encode.mjs +1 -1
  55. package/dist/error/BrowserAuthError.mjs +1 -1
  56. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  57. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  58. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  59. package/dist/error/NativeAuthError.mjs +1 -1
  60. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  61. package/dist/error/NestedAppAuthError.d.ts +15 -0
  62. package/dist/error/NestedAppAuthError.d.ts.map +1 -0
  63. package/dist/error/NestedAppAuthError.mjs +30 -0
  64. package/dist/error/NestedAppAuthError.mjs.map +1 -0
  65. package/dist/event/EventHandler.mjs +1 -1
  66. package/dist/event/EventMessage.mjs +1 -1
  67. package/dist/event/EventType.mjs +1 -1
  68. package/dist/index.d.ts +3 -5
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.mjs +4 -2
  71. package/dist/index.mjs.map +1 -1
  72. package/dist/interaction_client/BaseInteractionClient.mjs +4 -4
  73. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  74. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  75. package/dist/interaction_client/NativeInteractionClient.mjs +18 -7
  76. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  77. package/dist/interaction_client/PopupClient.d.ts +1 -2
  78. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  79. package/dist/interaction_client/PopupClient.mjs +13 -25
  80. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  81. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  82. package/dist/interaction_client/RedirectClient.mjs +17 -25
  83. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  84. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  85. package/dist/interaction_client/SilentAuthCodeClient.mjs +6 -8
  86. package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
  87. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  88. package/dist/interaction_client/SilentCacheClient.mjs +4 -3
  89. package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
  90. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  91. package/dist/interaction_client/SilentIframeClient.mjs +28 -19
  92. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  93. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  94. package/dist/interaction_client/SilentRefreshClient.mjs +2 -12
  95. package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
  96. package/dist/interaction_client/StandardInteractionClient.mjs +5 -5
  97. package/dist/interaction_handler/InteractionHandler.d.ts +6 -13
  98. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  99. package/dist/interaction_handler/InteractionHandler.mjs +29 -56
  100. package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
  101. package/dist/interaction_handler/RedirectHandler.d.ts +14 -7
  102. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  103. package/dist/interaction_handler/RedirectHandler.mjs +28 -9
  104. package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
  105. package/dist/interaction_handler/SilentHandler.d.ts +13 -47
  106. package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
  107. package/dist/interaction_handler/SilentHandler.mjs +120 -155
  108. package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
  109. package/dist/naa/AccountInfo.d.ts +13 -0
  110. package/dist/naa/AccountInfo.d.ts.map +1 -0
  111. package/dist/naa/AccountRequests.d.ts +10 -0
  112. package/dist/naa/AccountRequests.d.ts.map +1 -0
  113. package/dist/naa/AuthBridge.d.ts +6 -0
  114. package/dist/naa/AuthBridge.d.ts.map +1 -0
  115. package/dist/naa/BridgeCapabilities.d.ts +4 -0
  116. package/dist/naa/BridgeCapabilities.d.ts.map +1 -0
  117. package/dist/naa/BridgeError.d.ts +10 -0
  118. package/dist/naa/BridgeError.d.ts.map +1 -0
  119. package/dist/naa/BridgeError.mjs +12 -0
  120. package/dist/naa/BridgeError.mjs.map +1 -0
  121. package/dist/naa/BridgeProxy.d.ts +72 -0
  122. package/dist/naa/BridgeProxy.d.ts.map +1 -0
  123. package/dist/naa/BridgeProxy.mjs +154 -0
  124. package/dist/naa/BridgeProxy.mjs.map +1 -0
  125. package/dist/naa/BridgeRequest.d.ts +7 -0
  126. package/dist/naa/BridgeRequest.d.ts.map +1 -0
  127. package/dist/naa/BridgeRequestEnvelope.d.ts +14 -0
  128. package/dist/naa/BridgeRequestEnvelope.d.ts.map +1 -0
  129. package/dist/naa/BridgeResponseEnvelope.d.ts +11 -0
  130. package/dist/naa/BridgeResponseEnvelope.d.ts.map +1 -0
  131. package/dist/naa/BridgeStatusCode.d.ts +11 -0
  132. package/dist/naa/BridgeStatusCode.d.ts.map +1 -0
  133. package/dist/naa/BridgeStatusCode.mjs +20 -0
  134. package/dist/naa/BridgeStatusCode.mjs.map +1 -0
  135. package/dist/naa/IBridgeProxy.d.ts +11 -0
  136. package/dist/naa/IBridgeProxy.d.ts.map +1 -0
  137. package/dist/naa/InitializeBridgeResponse.d.ts +7 -0
  138. package/dist/naa/InitializeBridgeResponse.d.ts.map +1 -0
  139. package/dist/naa/TokenRequest.d.ts +22 -0
  140. package/dist/naa/TokenRequest.d.ts.map +1 -0
  141. package/dist/naa/TokenResponse.d.ts +17 -0
  142. package/dist/naa/TokenResponse.d.ts.map +1 -0
  143. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +26 -0
  144. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -0
  145. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +178 -0
  146. package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -0
  147. package/dist/navigation/NavigationClient.mjs +1 -1
  148. package/dist/network/FetchClient.mjs +1 -1
  149. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  150. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  151. package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +7 -0
  152. package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
  153. package/dist/operatingcontext/TeamsAppOperatingContext.mjs +45 -4
  154. package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
  155. package/dist/operatingcontext/UnknownOperatingContext.d.ts +26 -0
  156. package/dist/operatingcontext/UnknownOperatingContext.d.ts.map +1 -0
  157. package/dist/operatingcontext/UnknownOperatingContext.mjs +49 -0
  158. package/dist/operatingcontext/UnknownOperatingContext.mjs.map +1 -0
  159. package/dist/packageMetadata.d.ts +1 -1
  160. package/dist/packageMetadata.mjs +2 -2
  161. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  162. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  163. package/dist/utils/BrowserConstants.mjs +1 -1
  164. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  165. package/dist/utils/BrowserUtils.d.ts +54 -53
  166. package/dist/utils/BrowserUtils.d.ts.map +1 -1
  167. package/dist/utils/BrowserUtils.mjs +114 -102
  168. package/dist/utils/BrowserUtils.mjs.map +1 -1
  169. package/lib/msal-browser.cjs +13221 -12385
  170. package/lib/msal-browser.cjs.map +1 -1
  171. package/lib/msal-browser.js +13221 -12385
  172. package/lib/msal-browser.js.map +1 -1
  173. package/lib/msal-browser.min.js +67 -68
  174. package/package.json +2 -2
  175. package/src/app/PublicClientApplication.ts +4 -3
  176. package/src/app/PublicClientNext.ts +444 -0
  177. package/src/cache/BrowserCacheManager.ts +33 -140
  178. package/src/cache/TokenCache.ts +5 -4
  179. package/src/config/Configuration.ts +5 -0
  180. package/src/controllers/ControllerFactory.ts +35 -43
  181. package/src/controllers/IController.ts +0 -6
  182. package/src/controllers/NestedAppAuthController.ts +525 -0
  183. package/src/controllers/StandardController.ts +50 -52
  184. package/src/controllers/UnknownOperatingContextController.ts +383 -0
  185. package/src/crypto/BrowserCrypto.ts +2 -2
  186. package/src/crypto/CryptoOps.ts +8 -5
  187. package/src/error/NestedAppAuthError.ts +32 -0
  188. package/src/index.ts +3 -10
  189. package/src/interaction_client/BaseInteractionClient.ts +1 -1
  190. package/src/interaction_client/NativeInteractionClient.ts +23 -6
  191. package/src/interaction_client/PopupClient.ts +41 -61
  192. package/src/interaction_client/RedirectClient.ts +42 -47
  193. package/src/interaction_client/SilentAuthCodeClient.ts +6 -16
  194. package/src/interaction_client/SilentCacheClient.ts +11 -3
  195. package/src/interaction_client/SilentIframeClient.ts +54 -34
  196. package/src/interaction_client/SilentRefreshClient.ts +5 -19
  197. package/src/interaction_client/StandardInteractionClient.ts +1 -1
  198. package/src/interaction_handler/InteractionHandler.ts +34 -104
  199. package/src/interaction_handler/RedirectHandler.ts +48 -22
  200. package/src/interaction_handler/SilentHandler.ts +177 -233
  201. package/src/naa/AccountInfo.ts +17 -0
  202. package/src/naa/AccountRequests.ts +16 -0
  203. package/src/naa/AuthBridge.ts +16 -0
  204. package/src/naa/BridgeCapabilities.ts +8 -0
  205. package/src/naa/BridgeError.ts +18 -0
  206. package/src/naa/BridgeProxy.ts +230 -0
  207. package/src/naa/BridgeRequest.ts +12 -0
  208. package/src/naa/BridgeRequestEnvelope.ts +46 -0
  209. package/src/naa/BridgeResponseEnvelope.ts +21 -0
  210. package/src/naa/BridgeStatusCode.ts +15 -0
  211. package/src/naa/IBridgeProxy.ts +25 -0
  212. package/src/naa/InitializeBridgeResponse.ts +12 -0
  213. package/src/naa/TokenRequest.ts +26 -0
  214. package/src/naa/TokenResponse.ts +61 -0
  215. package/src/naa/mapping/NestedAppAuthAdapter.ts +252 -0
  216. package/src/operatingcontext/TeamsAppOperatingContext.ts +43 -3
  217. package/src/operatingcontext/UnknownOperatingContext.ts +48 -0
  218. package/src/packageMetadata.ts +1 -1
  219. package/src/utils/BrowserUtils.ts +133 -125
  220. package/dist/utils/BrowserStringUtils.d.ts +0 -22
  221. package/dist/utils/BrowserStringUtils.d.ts.map +0 -1
  222. package/dist/utils/BrowserStringUtils.mjs +0 -144
  223. package/dist/utils/BrowserStringUtils.mjs.map +0 -1
  224. package/src/utils/BrowserStringUtils.ts +0 -143
@@ -1,6 +1,6 @@
1
- /*! @azure/msal-browser v3.2.0 2023-10-05 */
1
+ /*! @azure/msal-browser v3.4.0 2023-10-30 */
2
2
  'use strict';
3
- import { Constants, UrlString } from '@azure/msal-common';
3
+ import { UrlString } from '@azure/msal-common';
4
4
  import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
5
5
  import { BrowserConstants, InteractionType } from './BrowserConstants.mjs';
6
6
  import { blockIframeReload, redirectInIframe, blockNestedPopups, nonBrowserEnvironment, uninitializedPublicClientApplication } from '../error/BrowserAuthErrorCodes.mjs';
@@ -10,114 +10,126 @@ import { blockIframeReload, redirectInIframe, blockNestedPopups, nonBrowserEnvir
10
10
  * Licensed under the MIT License.
11
11
  */
12
12
  /**
13
- * Utility class for browser specific functions
13
+ * Clears hash from window url.
14
14
  */
15
- class BrowserUtils {
16
- // #region Window Navigation and URL management
17
- /**
18
- * Clears hash from window url.
19
- */
20
- static clearHash(contentWindow) {
21
- // Office.js sets history.replaceState to null
22
- contentWindow.location.hash = Constants.EMPTY_STRING;
23
- if (typeof contentWindow.history.replaceState === "function") {
24
- // Full removes "#" from url
25
- contentWindow.history.replaceState(null, Constants.EMPTY_STRING, `${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`);
26
- }
27
- }
28
- /**
29
- * Replaces current hash with hash from provided url
30
- */
31
- static replaceHash(url) {
32
- const urlParts = url.split("#");
33
- urlParts.shift(); // Remove part before the hash
34
- window.location.hash =
35
- urlParts.length > 0 ? urlParts.join("#") : Constants.EMPTY_STRING;
36
- }
37
- /**
38
- * Returns boolean of whether the current window is in an iframe or not.
39
- */
40
- static isInIframe() {
41
- return window.parent !== window;
15
+ function clearHash(contentWindow) {
16
+ // Office.js sets history.replaceState to null
17
+ contentWindow.location.hash = "";
18
+ if (typeof contentWindow.history.replaceState === "function") {
19
+ // Full removes "#" from url
20
+ contentWindow.history.replaceState(null, "", `${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`);
42
21
  }
43
- /**
44
- * Returns boolean of whether or not the current window is a popup opened by msal
45
- */
46
- static isInPopup() {
47
- return (typeof window !== "undefined" &&
48
- !!window.opener &&
49
- window.opener !== window &&
50
- typeof window.name === "string" &&
51
- window.name.indexOf(`${BrowserConstants.POPUP_NAME_PREFIX}.`) === 0);
52
- }
53
- // #endregion
54
- /**
55
- * Returns current window URL as redirect uri
56
- */
57
- static getCurrentUri() {
58
- return window.location.href.split("?")[0].split("#")[0];
59
- }
60
- /**
61
- * Gets the homepage url for the current window location.
62
- */
63
- static getHomepage() {
64
- const currentUrl = new UrlString(window.location.href);
65
- const urlComponents = currentUrl.getUrlComponents();
66
- return `${urlComponents.Protocol}//${urlComponents.HostNameAndPort}/`;
22
+ }
23
+ /**
24
+ * Replaces current hash with hash from provided url
25
+ */
26
+ function replaceHash(url) {
27
+ const urlParts = url.split("#");
28
+ urlParts.shift(); // Remove part before the hash
29
+ window.location.hash = urlParts.length > 0 ? urlParts.join("#") : "";
30
+ }
31
+ /**
32
+ * Returns boolean of whether the current window is in an iframe or not.
33
+ */
34
+ function isInIframe() {
35
+ return window.parent !== window;
36
+ }
37
+ /**
38
+ * Returns boolean of whether or not the current window is a popup opened by msal
39
+ */
40
+ function isInPopup() {
41
+ return (typeof window !== "undefined" &&
42
+ !!window.opener &&
43
+ window.opener !== window &&
44
+ typeof window.name === "string" &&
45
+ window.name.indexOf(`${BrowserConstants.POPUP_NAME_PREFIX}.`) === 0);
46
+ }
47
+ // #endregion
48
+ /**
49
+ * Returns current window URL as redirect uri
50
+ */
51
+ function getCurrentUri() {
52
+ return window.location.href.split("?")[0].split("#")[0];
53
+ }
54
+ /**
55
+ * Gets the homepage url for the current window location.
56
+ */
57
+ function getHomepage() {
58
+ const currentUrl = new UrlString(window.location.href);
59
+ const urlComponents = currentUrl.getUrlComponents();
60
+ return `${urlComponents.Protocol}//${urlComponents.HostNameAndPort}/`;
61
+ }
62
+ /**
63
+ * Throws error if we have completed an auth and are
64
+ * attempting another auth request inside an iframe.
65
+ */
66
+ function blockReloadInHiddenIframes() {
67
+ const isResponseHash = UrlString.hashContainsKnownProperties(window.location.hash);
68
+ // return an error if called from the hidden iframe created by the msal js silent calls
69
+ if (isResponseHash && isInIframe()) {
70
+ throw createBrowserAuthError(blockIframeReload);
67
71
  }
68
- /**
69
- * Throws error if we have completed an auth and are
70
- * attempting another auth request inside an iframe.
71
- */
72
- static blockReloadInHiddenIframes() {
73
- const isResponseHash = UrlString.hashContainsKnownProperties(window.location.hash);
74
- // return an error if called from the hidden iframe created by the msal js silent calls
75
- if (isResponseHash && BrowserUtils.isInIframe()) {
76
- throw createBrowserAuthError(blockIframeReload);
77
- }
72
+ }
73
+ /**
74
+ * Block redirect operations in iframes unless explicitly allowed
75
+ * @param interactionType Interaction type for the request
76
+ * @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
77
+ */
78
+ function blockRedirectInIframe(interactionType, allowRedirectInIframe) {
79
+ const isIframedApp = isInIframe();
80
+ if (interactionType === InteractionType.Redirect &&
81
+ isIframedApp &&
82
+ !allowRedirectInIframe) {
83
+ // If we are not in top frame, we shouldn't redirect. This is also handled by the service.
84
+ throw createBrowserAuthError(redirectInIframe);
78
85
  }
79
- /**
80
- * Block redirect operations in iframes unless explicitly allowed
81
- * @param interactionType Interaction type for the request
82
- * @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
83
- */
84
- static blockRedirectInIframe(interactionType, allowRedirectInIframe) {
85
- const isIframedApp = BrowserUtils.isInIframe();
86
- if (interactionType === InteractionType.Redirect &&
87
- isIframedApp &&
88
- !allowRedirectInIframe) {
89
- // If we are not in top frame, we shouldn't redirect. This is also handled by the service.
90
- throw createBrowserAuthError(redirectInIframe);
91
- }
86
+ }
87
+ /**
88
+ * Block redirectUri loaded in popup from calling AcquireToken APIs
89
+ */
90
+ function blockAcquireTokenInPopups() {
91
+ // Popups opened by msal popup APIs are given a name that starts with "msal."
92
+ if (isInPopup()) {
93
+ throw createBrowserAuthError(blockNestedPopups);
92
94
  }
93
- /**
94
- * Block redirectUri loaded in popup from calling AcquireToken APIs
95
- */
96
- static blockAcquireTokenInPopups() {
97
- // Popups opened by msal popup APIs are given a name that starts with "msal."
98
- if (BrowserUtils.isInPopup()) {
99
- throw createBrowserAuthError(blockNestedPopups);
100
- }
95
+ }
96
+ /**
97
+ * Throws error if token requests are made in non-browser environment
98
+ * @param isBrowserEnvironment Flag indicating if environment is a browser.
99
+ */
100
+ function blockNonBrowserEnvironment(isBrowserEnvironment) {
101
+ if (!isBrowserEnvironment) {
102
+ throw createBrowserAuthError(nonBrowserEnvironment);
101
103
  }
102
- /**
103
- * Throws error if token requests are made in non-browser environment
104
- * @param isBrowserEnvironment Flag indicating if environment is a browser.
105
- */
106
- static blockNonBrowserEnvironment(isBrowserEnvironment) {
107
- if (!isBrowserEnvironment) {
108
- throw createBrowserAuthError(nonBrowserEnvironment);
109
- }
104
+ }
105
+ /**
106
+ * Throws error if initialize hasn't been called
107
+ * @param initialized
108
+ */
109
+ function blockAPICallsBeforeInitialize(initialized) {
110
+ if (!initialized) {
111
+ throw createBrowserAuthError(uninitializedPublicClientApplication);
110
112
  }
111
- /**
112
- * Throws error if initialize hasn't been called
113
- * @param initialized
114
- */
115
- static blockAPICallsBeforeInitialize(initialized) {
116
- if (!initialized) {
117
- throw createBrowserAuthError(uninitializedPublicClientApplication);
113
+ }
114
+ /**
115
+ * Adds a preconnect link element to the header which begins DNS resolution and SSL connection in anticipation of the /token request
116
+ * @param loginDomain Authority domain, including https protocol e.g. https://login.microsoftonline.com
117
+ * @returns
118
+ */
119
+ function preconnect(authority) {
120
+ const link = document.createElement("link");
121
+ link.rel = "preconnect";
122
+ link.href = new URL(authority).origin;
123
+ link.crossOrigin = "anonymous";
124
+ document.head.appendChild(link);
125
+ // The browser will close connection if not used within a few seconds, remove element from the header after 10s
126
+ window.setTimeout(() => {
127
+ try {
128
+ document.head.removeChild(link);
118
129
  }
119
- }
130
+ catch { }
131
+ }, 10000); // 10s Timeout
120
132
  }
121
133
 
122
- export { BrowserUtils };
134
+ export { blockAPICallsBeforeInitialize, blockAcquireTokenInPopups, blockNonBrowserEnvironment, blockRedirectInIframe, blockReloadInHiddenIframes, clearHash, getCurrentUri, getHomepage, isInIframe, isInPopup, preconnect, replaceHash };
123
135
  //# sourceMappingURL=BrowserUtils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserUtils.mjs","sources":["../../src/utils/BrowserUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAUA;AAEA;;AAEG;AAMI;AACH;AAaA;;AAEG;A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