{"version":3,"file":"PopupClient.js","sources":["../../src/interaction_client/PopupClient.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthenticationResult, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ThrottlingUtils, CommonEndSessionRequest, UrlString, AuthError, OIDC_DEFAULT_SCOPES, Constants, ProtocolUtils, ServerAuthorizationCodeResponse, PerformanceEvents, StringUtils, IPerformanceClient, Logger, ICrypto } from \"@azure/msal-common\";\r\nimport { StandardInteractionClient } from \"./StandardInteractionClient\";\r\nimport { EventType } from \"../event/EventType\";\r\nimport { InteractionType, ApiId, BrowserConstants } from \"../utils/BrowserConstants\";\r\nimport { EndSessionPopupRequest } from \"../request/EndSessionPopupRequest\";\r\nimport { NavigationOptions } from \"../navigation/NavigationOptions\";\r\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\r\nimport { PopupRequest } from \"../request/PopupRequest\";\r\nimport { NativeInteractionClient } from \"./NativeInteractionClient\";\r\nimport { NativeMessageHandler } from \"../broker/nativeBroker/NativeMessageHandler\";\r\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\r\nimport { INavigationClient } from \"../navigation/INavigationClient\";\r\nimport { EventHandler } from \"../event/EventHandler\";\r\nimport { BrowserCacheManager } from \"../cache/BrowserCacheManager\";\r\nimport { BrowserConfiguration } from \"../config/Configuration\";\r\nimport { InteractionHandler, InteractionParams } from \"../interaction_handler/InteractionHandler\";\r\nimport { PopupWindowAttributes } from \"../request/PopupWindowAttributes\";\r\n\r\nexport type PopupParams = InteractionParams & {\r\n popup?: Window|null;\r\n popupName: string;\r\n popupWindowAttributes: PopupWindowAttributes\r\n};\r\n\r\nexport class PopupClient extends StandardInteractionClient {\r\n private currentWindow: Window | undefined;\r\n protected nativeStorage: BrowserCacheManager;\r\n\r\n constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, performanceClient: IPerformanceClient, nativeStorageImpl: BrowserCacheManager, nativeMessageHandler?: NativeMessageHandler, correlationId?: string) {\r\n super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);\r\n // Properly sets this reference for the unload event.\r\n this.unloadWindow = this.unloadWindow.bind(this);\r\n this.nativeStorage = nativeStorageImpl;\r\n }\r\n\r\n /**\r\n * Acquires tokens by opening a popup window to the /authorize endpoint of the authority\r\n * @param request\r\n */\r\n acquireToken(request: PopupRequest): Promise {\r\n try {\r\n const popupName = this.generatePopupName(request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority);\r\n const popupWindowAttributes = request.popupWindowAttributes || {};\r\n\r\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\r\n if (this.config.system.asyncPopups) {\r\n this.logger.verbose(\"asyncPopups set to true, acquiring token\");\r\n // Passes on popup position and dimensions if in request\r\n return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);\r\n } else {\r\n // asyncPopups flag is set to false. Opens popup before acquiring token.\r\n this.logger.verbose(\"asyncPopup set to false, opening popup before acquiring token\");\r\n const popup = this.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes);\r\n return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);\r\n }\r\n } catch (e) {\r\n return Promise.reject(e);\r\n }\r\n }\r\n\r\n /**\r\n * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server\r\n * @param logoutRequest\r\n */\r\n logout(logoutRequest?: EndSessionPopupRequest): Promise {\r\n try {\r\n this.logger.verbose(\"logoutPopup called\");\r\n const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);\r\n\r\n const popupName = this.generateLogoutPopupName(validLogoutRequest);\r\n const authority = logoutRequest && logoutRequest.authority;\r\n const mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;\r\n const popupWindowAttributes = logoutRequest?.popupWindowAttributes || {};\r\n\r\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\r\n if (this.config.system.asyncPopups) {\r\n this.logger.verbose(\"asyncPopups set to true\");\r\n // Passes on popup position and dimensions if in request\r\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, undefined, mainWindowRedirectUri);\r\n } else {\r\n // asyncPopups flag is set to false. Opens popup before logging out.\r\n this.logger.verbose(\"asyncPopup set to false, opening popup\");\r\n const popup = this.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes);\r\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, popup, mainWindowRedirectUri);\r\n }\r\n } catch (e) {\r\n // Since this function is synchronous we need to reject\r\n return Promise.reject(e);\r\n }\r\n }\r\n\r\n /**\r\n * Helper which obtains an access_token for your API via opening a popup window in the user's browser\r\n * @param validRequest\r\n * @param popupName\r\n * @param popup\r\n * @param popupWindowAttributes\r\n *\r\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\r\n */\r\n protected async acquireTokenPopupAsync(request: PopupRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, popup?: Window|null): Promise {\r\n this.logger.verbose(\"acquireTokenPopupAsync called\");\r\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);\r\n\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);\r\n const validRequest = await this.initializeAuthorizationRequest(request, InteractionType.Popup);\r\n this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);\r\n\r\n try {\r\n // Create auth code request and generate PKCE params\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);\r\n const authCodeRequest: CommonAuthorizationCodeRequest = await this.initializeAuthorizationCodeRequest(validRequest);\r\n\r\n // Initialize the client\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);\r\n const authClient: AuthorizationCodeClient = await this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);\r\n this.logger.verbose(\"Auth code client created\");\r\n\r\n const isNativeBroker = NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);\r\n // Start measurement for server calls with native brokering enabled\r\n let fetchNativeAccountIdMeasurement;\r\n if (isNativeBroker) {\r\n fetchNativeAccountIdMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.FetchAccountIdWithNativeBroker, request.correlationId);\r\n }\r\n\r\n // Create acquire token url.\r\n const navigateUrl = await authClient.getAuthCodeUrl({\r\n ...validRequest,\r\n nativeBroker: isNativeBroker\r\n });\r\n\r\n // Create popup interaction handler.\r\n const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);\r\n\r\n // Show the UI once the url has been created. Get the window handle for the popup.\r\n const popupParameters: PopupParams = {\r\n popup,\r\n popupName,\r\n popupWindowAttributes\r\n };\r\n const popupWindow: Window = this.initiateAuthRequest(navigateUrl, popupParameters);\r\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, {popupWindow}, null);\r\n\r\n // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.\r\n const hash = await this.monitorPopupForHash(popupWindow);\r\n // Deserialize hash fragment response parameters.\r\n const serverParams: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hash);\r\n const state = this.validateAndExtractStateFromHash(serverParams, InteractionType.Popup, validRequest.correlationId);\r\n // Remove throttle if it exists\r\n ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);\r\n\r\n if (serverParams.accountId) {\r\n this.logger.verbose(\"Account id found in hash, calling WAM for token\");\r\n // end measurement for server call with native brokering enabled\r\n if (fetchNativeAccountIdMeasurement) {\r\n fetchNativeAccountIdMeasurement.endMeasurement({\r\n success: true,\r\n isNativeBroker: true\r\n });\r\n }\r\n\r\n if (!this.nativeMessageHandler) {\r\n throw BrowserAuthError.createNativeConnectionNotEstablishedError();\r\n }\r\n const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, validRequest.correlationId);\r\n const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, state);\r\n return nativeInteractionClient.acquireToken({\r\n ...validRequest,\r\n state: userRequestState,\r\n prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently\r\n }).finally(() => {\r\n this.browserStorage.cleanRequestByState(state);\r\n });\r\n }\r\n\r\n // Handle response from hash string.\r\n const result = await interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient);\r\n\r\n return result;\r\n } catch (e) {\r\n if (popup) {\r\n // Close the synchronous popup if an error is thrown before the window unload event is registered\r\n popup.close();\r\n }\r\n\r\n if (e instanceof AuthError) {\r\n (e as AuthError).setCorrelationId(this.correlationId);\r\n }\r\n\r\n serverTelemetryManager.cacheFailedRequest(e);\r\n this.browserStorage.cleanRequestByState(validRequest.state);\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n *\r\n * @param validRequest\r\n * @param popupName\r\n * @param requestAuthority\r\n * @param popup\r\n * @param mainWindowRedirectUri\r\n * @param popupWindowAttributes\r\n */\r\n protected async logoutPopupAsync(validRequest: CommonEndSessionRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, requestAuthority?: string, popup?: Window|null, mainWindowRedirectUri?: string): Promise {\r\n this.logger.verbose(\"logoutPopupAsync called\");\r\n this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Popup, validRequest);\r\n\r\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);\r\n\r\n try {\r\n // Clear cache on logout\r\n await this.clearCacheOnLogout(validRequest.account);\r\n\r\n // Initialize the client\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validRequest.correlationId);\r\n const authClient = await this.createAuthCodeClient(serverTelemetryManager, requestAuthority);\r\n this.logger.verbose(\"Auth code client created\");\r\n\r\n // Create logout string and navigate user window to logout.\r\n const logoutUri: string = authClient.getLogoutUri(validRequest);\r\n\r\n this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);\r\n\r\n // Open the popup window to requestUrl.\r\n const popupWindow = this.openPopup(logoutUri, {popupName, popupWindowAttributes, popup});\r\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, {popupWindow}, null);\r\n\r\n await this.waitForLogoutPopup(popupWindow);\r\n\r\n if (mainWindowRedirectUri) {\r\n const navigationOptions: NavigationOptions = {\r\n apiId: ApiId.logoutPopup,\r\n timeout: this.config.system.redirectNavigationTimeout,\r\n noHistory: false\r\n };\r\n const absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());\r\n\r\n this.logger.verbose(\"Redirecting main window to url specified in the request\");\r\n this.logger.verbosePii(`Redirecting main window to: ${absoluteUrl}`);\r\n this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);\r\n } else {\r\n this.logger.verbose(\"No main window navigation requested\");\r\n }\r\n } catch (e) {\r\n if (popup) {\r\n // Close the synchronous popup if an error is thrown before the window unload event is registered\r\n popup.close();\r\n }\r\n\r\n if (e instanceof AuthError) {\r\n (e as AuthError).setCorrelationId(this.correlationId);\r\n }\r\n\r\n this.browserStorage.setInteractionInProgress(false);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\r\n serverTelemetryManager.cacheFailedRequest(e);\r\n throw e;\r\n }\r\n\r\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\r\n }\r\n\r\n /**\r\n * Opens a popup window with given request Url.\r\n * @param requestUrl\r\n */\r\n initiateAuthRequest(requestUrl: string, params: PopupParams): Window {\r\n // Check that request url is not empty.\r\n if (!StringUtils.isEmpty(requestUrl)) {\r\n this.logger.infoPii(`Navigate to: ${requestUrl}`);\r\n // Open the popup window to requestUrl.\r\n return this.openPopup(requestUrl, params);\r\n } else {\r\n // Throw error if request URL is empty.\r\n this.logger.error(\"Navigate url is empty\");\r\n throw BrowserAuthError.createEmptyNavigationUriError();\r\n }\r\n }\r\n\r\n /**\r\n * Monitors a window until it loads a url with the same origin.\r\n * @param popupWindow - window that is being monitored\r\n * @param timeout - timeout for processing hash once popup is redirected back to application\r\n */\r\n monitorPopupForHash(popupWindow: Window): Promise {\r\n return new Promise((resolve, reject) => {\r\n /*\r\n * Polling for popups needs to be tick-based,\r\n * since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).\r\n */\r\n const maxTicks = this.config.system.windowHashTimeout / this.config.system.pollIntervalMilliseconds;\r\n let ticks = 0;\r\n\r\n this.logger.verbose(\"PopupHandler.monitorPopupForHash - polling started\");\r\n\r\n const intervalId = setInterval(() => {\r\n // Window is closed\r\n if (popupWindow.closed) {\r\n this.logger.error(\"PopupHandler.monitorPopupForHash - window closed\");\r\n this.cleanPopup();\r\n clearInterval(intervalId);\r\n reject(BrowserAuthError.createUserCancelledError());\r\n return;\r\n }\r\n\r\n let href: string = Constants.EMPTY_STRING;\r\n let hash: string = Constants.EMPTY_STRING;\r\n try {\r\n /*\r\n * Will throw if cross origin,\r\n * which should be caught and ignored\r\n * since we need the interval to keep running while on STS UI.\r\n */\r\n href = popupWindow.location.href;\r\n hash = popupWindow.location.hash;\r\n } catch (e) {}\r\n\r\n // Don't process blank pages or cross domain\r\n if (StringUtils.isEmpty(href) || href === \"about:blank\") {\r\n return;\r\n }\r\n\r\n this.logger.verbose(\"PopupHandler.monitorPopupForHash - popup window is on same origin as caller\");\r\n\r\n /*\r\n * Only run clock when we are on same domain for popups\r\n * as popup operations can take a long time.\r\n */\r\n ticks++;\r\n\r\n if (hash) {\r\n this.logger.verbose(\"PopupHandler.monitorPopupForHash - found hash in url\");\r\n clearInterval(intervalId);\r\n this.cleanPopup(popupWindow);\r\n\r\n if (UrlString.hashContainsKnownProperties(hash)) {\r\n this.logger.verbose(\"PopupHandler.monitorPopupForHash - hash contains known properties, returning.\");\r\n resolve(hash);\r\n } else {\r\n this.logger.error(\"PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely.\");\r\n this.logger.errorPii(`PopupHandler.monitorPopupForHash - hash found: ${hash}`);\r\n reject(BrowserAuthError.createHashDoesNotContainKnownPropertiesError());\r\n }\r\n } else if (ticks > maxTicks) {\r\n this.logger.error(\"PopupHandler.monitorPopupForHash - unable to find hash in url, timing out\");\r\n clearInterval(intervalId);\r\n reject(BrowserAuthError.createMonitorPopupTimeoutError());\r\n }\r\n }, this.config.system.pollIntervalMilliseconds);\r\n });\r\n }\r\n\r\n /**\r\n * Waits for user interaction in logout popup window\r\n * @param popupWindow\r\n * @returns\r\n */\r\n waitForLogoutPopup(popupWindow: Window): Promise {\r\n return new Promise((resolve) => {\r\n this.logger.verbose(\"PopupHandler.waitForLogoutPopup - polling started\");\r\n\r\n const intervalId = setInterval(() => {\r\n // Window is closed\r\n if (popupWindow.closed) {\r\n this.logger.error(\"PopupHandler.waitForLogoutPopup - window closed\");\r\n this.cleanPopup();\r\n clearInterval(intervalId);\r\n resolve();\r\n }\r\n\r\n let href: string = Constants.EMPTY_STRING;\r\n try {\r\n /*\r\n * Will throw if cross origin,\r\n * which should be caught and ignored\r\n * since we need the interval to keep running while on STS UI.\r\n */\r\n href = popupWindow.location.href;\r\n } catch (e) {}\r\n\r\n // Don't process blank pages or cross domain\r\n if (StringUtils.isEmpty(href) || href === \"about:blank\") {\r\n return;\r\n }\r\n\r\n this.logger.verbose(\"PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing.\");\r\n\r\n clearInterval(intervalId);\r\n this.cleanPopup(popupWindow);\r\n resolve();\r\n }, this.config.system.pollIntervalMilliseconds);\r\n });\r\n }\r\n\r\n /**\r\n * @hidden\r\n *\r\n * Configures popup window for login.\r\n *\r\n * @param urlNavigate\r\n * @param title\r\n * @param popUpWidth\r\n * @param popUpHeight\r\n * @param popupWindowAttributes\r\n * @ignore\r\n * @hidden\r\n */\r\n openPopup(urlNavigate: string, popupParams: PopupParams): Window {\r\n try {\r\n let popupWindow;\r\n // Popup window passed in, setting url to navigate to\r\n if (popupParams.popup) {\r\n popupWindow = popupParams.popup;\r\n this.logger.verbosePii(`Navigating popup window to: ${urlNavigate}`);\r\n popupWindow.location.assign(urlNavigate);\r\n } else if (typeof popupParams.popup === \"undefined\") {\r\n // Popup will be undefined if it was not passed in\r\n this.logger.verbosePii(`Opening popup window to: ${urlNavigate}`);\r\n popupWindow = this.openSizedPopup(urlNavigate, popupParams.popupName, popupParams.popupWindowAttributes);\r\n }\r\n\r\n // Popup will be null if popups are blocked\r\n if (!popupWindow) {\r\n throw BrowserAuthError.createEmptyWindowCreatedError();\r\n }\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n this.currentWindow = popupWindow;\r\n window.addEventListener(\"beforeunload\", this.unloadWindow);\r\n\r\n return popupWindow;\r\n } catch (e) {\r\n this.logger.error(\"error opening popup \" + (e as AuthError).message);\r\n this.browserStorage.setInteractionInProgress(false);\r\n throw BrowserAuthError.createPopupWindowError((e as AuthError).toString());\r\n }\r\n }\r\n\r\n /**\r\n * Helper function to set popup window dimensions and position\r\n * @param urlNavigate\r\n * @param popupName\r\n * @param popupWindowAttributes\r\n * @returns\r\n */\r\n openSizedPopup(urlNavigate: string, popupName: string, popupWindowAttributes: PopupWindowAttributes): Window|null {\r\n /**\r\n * adding winLeft and winTop to account for dual monitor\r\n * using screenLeft and screenTop for IE8 and earlier\r\n */\r\n const winLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n const winTop = window.screenTop ? window.screenTop : window.screenY;\r\n /**\r\n * window.innerWidth displays browser window\"s height and width excluding toolbars\r\n * using document.documentElement.clientWidth for IE8 and earlier\r\n */\r\n const winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r\n const winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r\n\r\n let width = popupWindowAttributes.popupSize?.width;\r\n let height = popupWindowAttributes.popupSize?.height;\r\n let top = popupWindowAttributes.popupPosition?.top;\r\n let left = popupWindowAttributes.popupPosition?.left;\r\n\r\n if (!width || width < 0 || width > winWidth) {\r\n this.logger.verbose(\"Default popup window width used. Window width not configured or invalid.\");\r\n width = BrowserConstants.POPUP_WIDTH;\r\n }\r\n\r\n if (!height || height < 0 || height > winHeight) {\r\n this.logger.verbose(\"Default popup window height used. Window height not configured or invalid.\");\r\n height = BrowserConstants.POPUP_HEIGHT;\r\n }\r\n\r\n if (!top || top < 0 || top > winHeight) {\r\n this.logger.verbose(\"Default popup window top position used. Window top not configured or invalid.\");\r\n top = Math.max(0, ((winHeight / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop);\r\n }\r\n\r\n if (!left || left < 0 || left > winWidth) {\r\n this.logger.verbose(\"Default popup window left position used. Window left not configured or invalid.\");\r\n left = Math.max(0, ((winWidth / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft);\r\n }\r\n\r\n return window.open(urlNavigate, popupName, `width=${width}, height=${height}, top=${top}, left=${left}, scrollbars=yes`);\r\n }\r\n\r\n /**\r\n * Event callback to unload main window.\r\n */\r\n unloadWindow(e: Event): void {\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Popup);\r\n if (this.currentWindow) {\r\n this.currentWindow.close();\r\n }\r\n // Guarantees browser unload will happen, so no other errors will be thrown.\r\n e.preventDefault();\r\n }\r\n\r\n /**\r\n * Closes popup, removes any state vars created during popup calls.\r\n * @param popupWindow\r\n */\r\n cleanPopup(popupWindow?: Window): void {\r\n if (popupWindow) {\r\n // Close window.\r\n popupWindow.close();\r\n }\r\n // Remove window unload function\r\n window.removeEventListener(\"beforeunload\", this.unloadWindow);\r\n\r\n // Interaction is completed - remove interaction status.\r\n this.browserStorage.setInteractionInProgress(false);\r\n }\r\n\r\n /**\r\n * Generates the name for the popup based on the client id and request\r\n * @param clientId\r\n * @param request\r\n */\r\n generatePopupName(scopes: Array, authority: string): string {\r\n return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${scopes.join(\"-\")}.${authority}.${this.correlationId}`;\r\n }\r\n\r\n /**\r\n * Generates the name for the popup based on the client id and request for logouts\r\n * @param clientId\r\n * @param request\r\n */\r\n generateLogoutPopupName(request: CommonEndSessionRequest): string {\r\n const homeAccountId = request.account && request.account.homeAccountId;\r\n return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${homeAccountId}.${this.correlationId}`;\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;IA6BiC,+BAAyB;IAItD,qBAAY,MAA4B,EAAE,WAAgC,EAAE,aAAsB,EAAE,MAAc,EAAE,YAA0B,EAAE,gBAAmC,EAAE,iBAAqC,EAAE,iBAAsC,EAAE,oBAA2C,EAAE,aAAsB;QAAvU,YACI,kBAAM,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,aAAa,CAAC,SAI5I;;QAFG,KAAI,CAAC,YAAY,GAAG,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;QACjD,KAAI,CAAC,aAAa,GAAG,iBAAiB,CAAC;;KAC1C;;;;;IAMD,kCAAY,GAAZ,UAAa,OAAqB;QAC9B,IAAI;YACA,IAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,MAAM,IAAI,mBAAmB,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI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