{"version":3,"sources":["webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Session.js","webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Application.js","webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Device.js","webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Internal.js","webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/User.js","webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Location.js","webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/TelemetryTrace.js","webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/TelemetryContext.js","webpack:///C:/a/2/s/Cognito.Web.Client/node_modules/.pnpm/@microsoft+applicationinsights-properties-js@2.5.4/node_modules/@microsoft/applicationinsights-properties-js/dist-esm/PropertiesPlugin.js"],"names":["Session","_SessionManager","config","logger","_this","this","CoreUtils","isNullOrUndefined","_logger","DiagnosticLogger","sessionExpirationMs","acquisitionSpan","sessionRenewalMs","renewalSpan","_storageNamePrefix","namePrefix","cookieNameConst","automaticSession","prototype","update","id","initializeAutomaticSession","now","Now","acquisitionExpired","acquisitionDate","renewalExpired","renewalDate","renew","cookieUpdatedTimestamp","cookieUpdateInterval","setCookie","backup","setStorage","cookie","Util","getCookie","split","initializeAutomaticSessionWithData","storage","getStorage","sessionData","params","length","acq","Date","renewal","e","throwInternal","CRITICAL","ErrorParsingAISessionCookie","getExceptionName","exception","dump","WARNING","SessionRenewalDateIsZero","newId","canUseLocalStorage","BrowserDoesNotSupportLocalStorage","guid","acquisitionExpiry","renewalExpiry","cookieExpiry","setTime","cookieDomnain","cookieDomain","UTCString","toUTCString","join","Application","Device","deviceClass","Internal","sdkVersion","sdkExtension","User","isNewUser","userCookieName","cookieSeparator","date","acqStr","toISOString","accountAcquisitionDate","getTime","newCookie","undefined","name_1","removeStorage","accountId","authCookie","authUserCookieName","authCookieString","decodeURI","authenticatedId","setAuthenticatedUserContext","authenticatedUserId","storeInCookie","validateUserInput","SetAuthContextFailedAccountName","encodeURI","clearAuthenticatedUserContext","deleteCookie","match","Location","parentId","name","traceID","generateW3CId","parentID","location","pathname","DataSanitizer","sanitizeString","TelemetryContext","defaultConfig","sessionManager","application","device","internal","user","telemetryTrace","session","appId","applySessionContext","event","itemCtx","sessionContext","ext","app","sesId","applyOperatingSystemContxt","os","applyApplicationContext","ver","tags","applicationVersion","build","applicationBuild","applyDeviceContext","localId","ip","model","applyInternalContext","agentVersion","internalAgentVersion","internalSdkVersion","applyLocationContext","locationIp","applyOperationContext","trace","applyWebContext","web","applyUserContext","userAccountId","authId","cleanUp","DeviceExt","objKeys","UserExt","WebExt","OSExt","AppExt","TraceExt","_super","PropertiesPlugin","apply","arguments","priority","identifier","getDefaultConfig","instrumentationKey","samplingPercentage","isBrowserLinkTrackingEnabled","initialize","core","extensions","pluginChain","call","ctx","_getTelCtx","_extensionConfig","_loop_1","field","this_1","getConfig","context","_breezeChannel","getExtension","processTelemetry","PageView","envelopeType","diagLog","resetInternalMessageCount","_processTelemetryInternal","message","SendBrowserInfoOnUserInit","userAg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AQnC,gBAAgB1B,EAAOC,GAC/B4D,EAAQvC,qBAAqBtB,EAAOC,GACpC4D,EAAQ3C,qBAAqBlB,EAAOC,GACpC4D,EAAQ9B,QAAQ/B,EAAOC,IAEpBuC,EAjG0B,CAkGnCmC,EAAA,GACa","file":"npm.microsoft+applicationinsights-properties-js@2.5.4.3f80d58d80f3892569a4.js","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Util, DateTimeUtils } from '@microsoft/applicationinsights-common';\r\nimport { _InternalMessageId, LoggingSeverity, CoreUtils, DiagnosticLogger } from '@microsoft/applicationinsights-core-js';\r\nvar Session = /** @class */ (function () {\r\n function Session() {\r\n }\r\n return Session;\r\n}());\r\nexport { Session };\r\nvar _SessionManager = /** @class */ (function () {\r\n function _SessionManager(config, logger) {\r\n var _this = this;\r\n if (CoreUtils.isNullOrUndefined(logger)) {\r\n this._logger = new DiagnosticLogger();\r\n }\r\n else {\r\n this._logger = logger;\r\n }\r\n if (!config) {\r\n config = {};\r\n }\r\n if (!(typeof config.sessionExpirationMs === \"function\")) {\r\n config.sessionExpirationMs = function () { return _SessionManager.acquisitionSpan; };\r\n }\r\n if (!(typeof config.sessionRenewalMs === \"function\")) {\r\n config.sessionRenewalMs = function () { return _SessionManager.renewalSpan; };\r\n }\r\n this.config = config;\r\n this._storageNamePrefix = function () { return _this.config.namePrefix && _this.config.namePrefix() ? _SessionManager.cookieNameConst + _this.config.namePrefix() : _SessionManager.cookieNameConst; };\r\n this.automaticSession = new Session();\r\n }\r\n _SessionManager.prototype.update = function () {\r\n if (!this.automaticSession.id) {\r\n this.initializeAutomaticSession();\r\n }\r\n var now = DateTimeUtils.Now();\r\n var acquisitionExpired = this.config.sessionExpirationMs() === 0 ? false : now - this.automaticSession.acquisitionDate > this.config.sessionExpirationMs();\r\n var renewalExpired = this.config.sessionExpirationMs() === 0 ? false : now - this.automaticSession.renewalDate > this.config.sessionRenewalMs();\r\n // renew if acquisitionSpan or renewalSpan has ellapsed\r\n if (acquisitionExpired || renewalExpired) {\r\n // update automaticSession so session state has correct id\r\n this.renew();\r\n }\r\n else {\r\n // do not update the cookie more often than cookieUpdateInterval\r\n if (!this.cookieUpdatedTimestamp || now - this.cookieUpdatedTimestamp > _SessionManager.cookieUpdateInterval) {\r\n this.automaticSession.renewalDate = now;\r\n this.setCookie(this.automaticSession.id, this.automaticSession.acquisitionDate, this.automaticSession.renewalDate);\r\n }\r\n }\r\n };\r\n /**\r\n * Record the current state of the automatic session and store it in our cookie string format\r\n * into the browser's local storage. This is used to restore the session data when the cookie\r\n * expires.\r\n */\r\n _SessionManager.prototype.backup = function () {\r\n this.setStorage(this.automaticSession.id, this.automaticSession.acquisitionDate, this.automaticSession.renewalDate);\r\n };\r\n /**\r\n * Use config.namePrefix + ai_session cookie data or local storage data (when the cookie is unavailable) to\r\n * initialize the automatic session.\r\n */\r\n _SessionManager.prototype.initializeAutomaticSession = function () {\r\n var cookie = Util.getCookie(this._logger, this._storageNamePrefix());\r\n if (cookie && typeof cookie.split === \"function\") {\r\n this.initializeAutomaticSessionWithData(cookie);\r\n }\r\n else {\r\n // There's no cookie, but we might have session data in local storage\r\n // This can happen if the session expired or the user actively deleted the cookie\r\n // We only want to recover data if the cookie is missing from expiry. We should respect the user's wishes if the cookie was deleted actively.\r\n // The User class handles this for us and deletes our local storage object if the persistent user cookie was removed.\r\n var storage = Util.getStorage(this._logger, this._storageNamePrefix());\r\n if (storage) {\r\n this.initializeAutomaticSessionWithData(storage);\r\n }\r\n }\r\n if (!this.automaticSession.id) {\r\n this.renew();\r\n }\r\n };\r\n /**\r\n * Extract id, aquisitionDate, and renewalDate from an ai_session payload string and\r\n * use this data to initialize automaticSession.\r\n *\r\n * @param {string} sessionData - The string stored in an ai_session cookie or local storage backup\r\n */\r\n _SessionManager.prototype.initializeAutomaticSessionWithData = function (sessionData) {\r\n var params = sessionData.split(\"|\");\r\n if (params.length > 0) {\r\n this.automaticSession.id = params[0];\r\n }\r\n try {\r\n if (params.length > 1) {\r\n var acq = +params[1];\r\n this.automaticSession.acquisitionDate = +new Date(acq);\r\n this.automaticSession.acquisitionDate = this.automaticSession.acquisitionDate > 0 ? this.automaticSession.acquisitionDate : 0;\r\n }\r\n if (params.length > 2) {\r\n var renewal = +params[2];\r\n this.automaticSession.renewalDate = +new Date(renewal);\r\n this.automaticSession.renewalDate = this.automaticSession.renewalDate > 0 ? this.automaticSession.renewalDate : 0;\r\n }\r\n }\r\n catch (e) {\r\n this._logger.throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.ErrorParsingAISessionCookie, \"Error parsing ai_session cookie, session will be reset: \" + Util.getExceptionName(e), { exception: Util.dump(e) });\r\n }\r\n if (this.automaticSession.renewalDate === 0) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SessionRenewalDateIsZero, \"AI session renewal date is 0, session will be reset.\");\r\n }\r\n };\r\n _SessionManager.prototype.renew = function () {\r\n var now = DateTimeUtils.Now();\r\n this.automaticSession.id = Util.newId();\r\n this.automaticSession.acquisitionDate = now;\r\n this.automaticSession.renewalDate = now;\r\n this.setCookie(this.automaticSession.id, this.automaticSession.acquisitionDate, this.automaticSession.renewalDate);\r\n // If this browser does not support local storage, fire an internal log to keep track of it at this point\r\n if (!Util.canUseLocalStorage()) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserDoesNotSupportLocalStorage, \"Browser does not support local storage. Session durations will be inaccurate.\");\r\n }\r\n };\r\n _SessionManager.prototype.setCookie = function (guid, acq, renewal) {\r\n // Set cookie to expire after the session expiry time passes or the session renewal deadline, whichever is sooner\r\n // Expiring the cookie will cause the session to expire even if the user isn't on the page\r\n var acquisitionExpiry = acq + this.config.sessionExpirationMs();\r\n var renewalExpiry = renewal + this.config.sessionRenewalMs();\r\n var cookieExpiry = new Date();\r\n var cookie = [guid, acq, renewal];\r\n if (acquisitionExpiry < renewalExpiry) {\r\n cookieExpiry.setTime(acquisitionExpiry);\r\n }\r\n else {\r\n cookieExpiry.setTime(renewalExpiry);\r\n }\r\n var cookieDomnain = this.config.cookieDomain ? this.config.cookieDomain() : null;\r\n // if sessionExpirationMs is set to 0, it means the expiry is set to 0 for this session cookie\r\n // A cookie with 0 expiry in the session cookie will never expire for that browser session. If the browser is closed the cookie expires. \r\n // Another browser instance does not inherit this cookie.\r\n var UTCString = this.config.sessionExpirationMs() === 0 ? '0' : cookieExpiry.toUTCString();\r\n Util.setCookie(this._logger, this._storageNamePrefix(), cookie.join('|') + ';expires=' + UTCString, cookieDomnain);\r\n this.cookieUpdatedTimestamp = DateTimeUtils.Now();\r\n };\r\n _SessionManager.prototype.setStorage = function (guid, acq, renewal) {\r\n // Keep data in local storage to retain the last session id, allowing us to cleanly end the session when it expires\r\n // Browsers that don't support local storage won't be able to end sessions cleanly from the client\r\n // The server will notice this and end the sessions itself, with loss of accurate session duration\r\n Util.setStorage(this._logger, this._storageNamePrefix(), [guid, acq, renewal].join('|'));\r\n };\r\n _SessionManager.acquisitionSpan = 86400000; // 24 hours in ms\r\n _SessionManager.renewalSpan = 1800000; // 30 minutes in ms\r\n _SessionManager.cookieUpdateInterval = 60000; // 1 minute in ms\r\n _SessionManager.cookieNameConst = 'ai_session';\r\n return _SessionManager;\r\n}());\r\nexport { _SessionManager };\r\n//# sourceMappingURL=Session.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Application = /** @class */ (function () {\r\n function Application() {\r\n }\r\n return Application;\r\n}());\r\nexport { Application };\r\n//# sourceMappingURL=Application.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Device = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the Device class\r\n */\r\n function Device() {\r\n // don't attempt to fingerprint browsers\r\n this.id = \"browser\";\r\n // Device type is a dimension in our data platform\r\n // Setting it to 'Browser' allows to separate client and server dependencies/exceptions\r\n this.deviceClass = \"Browser\";\r\n }\r\n return Device;\r\n}());\r\nexport { Device };\r\n//# sourceMappingURL=Device.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Version = \"2.5.4\";\r\nvar Internal = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the internal telemetry data class.\r\n */\r\n function Internal(config) {\r\n this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + \"_\" : \"\") + \"javascript:\" + Version;\r\n }\r\n return Internal;\r\n}());\r\nexport { Internal };\r\n//# sourceMappingURL=Internal.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Util } from '@microsoft/applicationinsights-common';\r\nimport { _InternalMessageId, LoggingSeverity, CoreUtils } from '@microsoft/applicationinsights-core-js';\r\nvar User = /** @class */ (function () {\r\n function User(config, logger) {\r\n this.isNewUser = false;\r\n this._logger = logger;\r\n // get userId or create new one if none exists\r\n var cookie = Util.getCookie(this._logger, User.userCookieName);\r\n if (cookie) {\r\n this.isNewUser = false;\r\n var params = cookie.split(User.cookieSeparator);\r\n if (params.length > 0) {\r\n this.id = params[0];\r\n }\r\n }\r\n this.config = config;\r\n if (!this.id) {\r\n this.id = Util.newId();\r\n var date = new Date();\r\n var acqStr = CoreUtils.toISOString(date);\r\n this.accountAcquisitionDate = acqStr;\r\n this.isNewUser = true;\r\n // without expiration, cookies expire at the end of the session\r\n // set it to 365 days from now\r\n // 365 * 24 * 60 * 60 * 1000 = 31536000000 \r\n date.setTime(date.getTime() + 31536000000);\r\n var newCookie = [this.id, acqStr];\r\n var cookieDomain = this.config.cookieDomain ? this.config.cookieDomain() : undefined;\r\n Util.setCookie(this._logger, User.userCookieName, newCookie.join(User.cookieSeparator) + ';expires=' + date.toUTCString(), cookieDomain);\r\n // If we have an config.namePrefix() + ai_session in local storage this means the user actively removed our cookies.\r\n // We should respect their wishes and clear ourselves from local storage\r\n var name_1 = config.namePrefix && config.namePrefix() ? config.namePrefix() + 'ai_session' : 'ai_session';\r\n Util.removeStorage(this._logger, name_1);\r\n }\r\n // We still take the account id from the ctor param for backward compatibility. \r\n // But if the the customer set the accountId through the newer setAuthenticatedUserContext API, we will override it.\r\n this.accountId = config.accountId ? config.accountId() : undefined;\r\n // Get the auth user id and account id from the cookie if exists\r\n // Cookie is in the pattern: |\r\n var authCookie = Util.getCookie(this._logger, User.authUserCookieName);\r\n if (authCookie) {\r\n authCookie = decodeURI(authCookie);\r\n var authCookieString = authCookie.split(User.cookieSeparator);\r\n if (authCookieString[0]) {\r\n this.authenticatedId = authCookieString[0];\r\n }\r\n if (authCookieString.length > 1 && authCookieString[1]) {\r\n this.accountId = authCookieString[1];\r\n }\r\n }\r\n }\r\n /**\r\n * Sets the authenticated user id and the account id in this session.\r\n *\r\n * @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.\r\n * @param accountId {string} - An optional string to represent the account associated with the authenticated user.\r\n */\r\n User.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId, storeInCookie) {\r\n if (storeInCookie === void 0) { storeInCookie = false; }\r\n // Validate inputs to ensure no cookie control characters.\r\n var isInvalidInput = !this.validateUserInput(authenticatedUserId) || (accountId && !this.validateUserInput(accountId));\r\n if (isInvalidInput) {\r\n this._logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.SetAuthContextFailedAccountName, \"Setting auth user context failed. \" +\r\n \"User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.\", true);\r\n return;\r\n }\r\n // Create cookie string.\r\n this.authenticatedId = authenticatedUserId;\r\n var authCookie = this.authenticatedId;\r\n if (accountId) {\r\n this.accountId = accountId;\r\n authCookie = [this.authenticatedId, this.accountId].join(User.cookieSeparator);\r\n }\r\n if (storeInCookie) {\r\n // Set the cookie. No expiration date because this is a session cookie (expires when browser closed).\r\n // Encoding the cookie to handle unexpected unicode characters.\r\n Util.setCookie(this._logger, User.authUserCookieName, encodeURI(authCookie), this.config.cookieDomain());\r\n }\r\n };\r\n /**\r\n * Clears the authenticated user id and the account id from the user context.\r\n * @returns {}\r\n */\r\n User.prototype.clearAuthenticatedUserContext = function () {\r\n this.authenticatedId = null;\r\n this.accountId = null;\r\n Util.deleteCookie(this._logger, User.authUserCookieName);\r\n };\r\n User.prototype.validateUserInput = function (id) {\r\n // Validate:\r\n // 1. Id is a non-empty string.\r\n // 2. It does not contain special characters for cookies.\r\n if (typeof id !== 'string' ||\r\n !id ||\r\n id.match(/,|;|=| |\\|/)) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n User.cookieSeparator = '|';\r\n User.userCookieName = 'ai_user';\r\n User.authUserCookieName = 'ai_authUser';\r\n return User;\r\n}());\r\nexport { User };\r\n//# sourceMappingURL=User.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar Location = /** @class */ (function () {\r\n function Location() {\r\n }\r\n return Location;\r\n}());\r\nexport { Location };\r\n//# sourceMappingURL=Location.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { Util, DataSanitizer } from '@microsoft/applicationinsights-common';\r\nimport { getLocation } from '@microsoft/applicationinsights-core-js';\r\nvar TelemetryTrace = /** @class */ (function () {\r\n function TelemetryTrace(id, parentId, name, logger) {\r\n this.traceID = id || Util.generateW3CId();\r\n this.parentID = parentId;\r\n this.name = name;\r\n var location = getLocation();\r\n if (!name && location && location.pathname) {\r\n this.name = location.pathname;\r\n }\r\n this.name = DataSanitizer.sanitizeString(logger, this.name);\r\n }\r\n return TelemetryTrace;\r\n}());\r\nexport { TelemetryTrace };\r\n//# sourceMappingURL=TelemetryTrace.js.map","/**\r\n * PropertiesPlugin.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport { CoreUtils, hasWindow } from '@microsoft/applicationinsights-core-js';\r\nimport { Session, _SessionManager } from './Context/Session';\r\nimport { Extensions, CtxTagKeys } from '@microsoft/applicationinsights-common';\r\nimport { Application } from './Context/Application';\r\nimport { Device } from './Context/Device';\r\nimport { Internal } from './Context/Internal';\r\nimport { User } from './Context/User';\r\nimport { Location } from './Context/Location';\r\nimport { TelemetryTrace } from './Context/TelemetryTrace';\r\nvar TelemetryContext = /** @class */ (function () {\r\n function TelemetryContext(logger, defaultConfig) {\r\n if (hasWindow()) {\r\n this.sessionManager = new _SessionManager(defaultConfig, logger);\r\n this.application = new Application();\r\n this.device = new Device();\r\n this.internal = new Internal(defaultConfig);\r\n this.location = new Location();\r\n this.user = new User(defaultConfig, logger);\r\n this.telemetryTrace = new TelemetryTrace(undefined, undefined, undefined, logger);\r\n this.session = new Session();\r\n }\r\n this.appId = function () { return null; };\r\n }\r\n TelemetryContext.prototype.applySessionContext = function (event, itemCtx) {\r\n var sessionContext = this.session || (this.sessionManager && this.sessionManager.automaticSession);\r\n if (sessionContext) {\r\n if (typeof sessionContext.id === \"string\") {\r\n event.ext.app.sesId = sessionContext.id;\r\n }\r\n }\r\n if (this.session) {\r\n // If customer set session info, apply his context; otherwise apply context automatically generated\r\n if (typeof this.session.id === \"string\") {\r\n event.ext.app.sesId = this.session.id;\r\n }\r\n else {\r\n event.ext.app.sesId = this.sessionManager.automaticSession.id;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyOperatingSystemContxt = function (event, itemCtx) {\r\n if (this.os && this.os.name) {\r\n event.ext.os = this.os;\r\n }\r\n };\r\n TelemetryContext.prototype.applyApplicationContext = function (event, itemCtx) {\r\n if (this.application) {\r\n if (typeof this.application.ver === \"string\") {\r\n event.tags[CtxTagKeys.applicationVersion] = this.application.ver;\r\n }\r\n if (typeof this.application.build === \"string\") {\r\n event.tags[CtxTagKeys.applicationBuild] = this.application.build;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyDeviceContext = function (event, itemCtx) {\r\n if (this.device) {\r\n if (typeof this.device.id === \"string\") {\r\n event.ext.device.localId = this.device.id;\r\n }\r\n if (typeof this.device.ip === \"string\") {\r\n event.ext.device.ip = this.device.ip;\r\n }\r\n if (typeof this.device.model === \"string\") {\r\n event.ext.device.model = this.device.model;\r\n }\r\n if (typeof this.device.deviceClass === \"string\") {\r\n event.ext.device.deviceClass = this.device.deviceClass;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyInternalContext = function (event, itemCtx) {\r\n if (this.internal) {\r\n if (typeof this.internal.agentVersion === \"string\") {\r\n event.tags[CtxTagKeys.internalAgentVersion] = this.internal.agentVersion; // not mapped in CS 4.0\r\n }\r\n if (typeof this.internal.sdkVersion === \"string\") {\r\n event.tags[CtxTagKeys.internalSdkVersion] = this.internal.sdkVersion;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyLocationContext = function (event, itemCtx) {\r\n if (this.location) {\r\n if (typeof this.location.ip === \"string\") {\r\n event.tags[CtxTagKeys.locationIp] = this.location.ip;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.applyOperationContext = function (event, itemCtx) {\r\n if (this.telemetryTrace) {\r\n var trace = event.ext.trace || { traceID: undefined, parentID: undefined };\r\n if (typeof this.telemetryTrace.traceID === \"string\") {\r\n trace.traceID = this.telemetryTrace.traceID;\r\n }\r\n if (typeof this.telemetryTrace.name === \"string\") {\r\n trace.name = this.telemetryTrace.name;\r\n }\r\n if (typeof this.telemetryTrace.parentID === \"string\") {\r\n trace.parentID = this.telemetryTrace.parentID;\r\n }\r\n event.ext.trace = trace;\r\n }\r\n };\r\n TelemetryContext.prototype.applyWebContext = function (event, itemCtx) {\r\n if (this.web) {\r\n event.ext.web = event.ext.web || {};\r\n event.ext.web = this.web;\r\n }\r\n };\r\n TelemetryContext.prototype.applyUserContext = function (event, itemCtx) {\r\n if (this.user) {\r\n if (!event.tags) {\r\n event.tags = [];\r\n }\r\n // stays in tags\r\n if (typeof this.user.accountId === \"string\") {\r\n var item = {};\r\n event.tags[CtxTagKeys.userAccountId] = this.user.accountId;\r\n }\r\n // CS 4.0\r\n if (typeof this.user.id === \"string\") {\r\n event.ext.user.id = this.user.id;\r\n }\r\n if (typeof this.user.authenticatedId === \"string\") {\r\n event.ext.user.authId = this.user.authenticatedId;\r\n }\r\n }\r\n };\r\n TelemetryContext.prototype.cleanUp = function (event, itemCtx) {\r\n if (event.ext[Extensions.DeviceExt] && CoreUtils.objKeys(event.ext[Extensions.DeviceExt]).length === 0) {\r\n delete event.ext[Extensions.DeviceExt];\r\n }\r\n if (event.ext[Extensions.UserExt] && CoreUtils.objKeys(event.ext[Extensions.UserExt]).length === 0) {\r\n delete event.ext[Extensions.UserExt];\r\n }\r\n if (event.ext[Extensions.WebExt] && CoreUtils.objKeys(event.ext[Extensions.WebExt]).length === 0) {\r\n delete event.ext[Extensions.WebExt];\r\n }\r\n if (event.ext[Extensions.OSExt] && CoreUtils.objKeys(event.ext[Extensions.OSExt]).length === 0) {\r\n delete event.ext[Extensions.OSExt];\r\n }\r\n if (event.ext[Extensions.AppExt] && CoreUtils.objKeys(event.ext[Extensions.AppExt]).length === 0) {\r\n delete event.ext[Extensions.AppExt];\r\n }\r\n if (event.ext[Extensions.TraceExt] && CoreUtils.objKeys(event.ext[Extensions.TraceExt]).length === 0) {\r\n delete event.ext[Extensions.TraceExt];\r\n }\r\n };\r\n return TelemetryContext;\r\n}());\r\nexport { TelemetryContext };\r\n//# sourceMappingURL=TelemetryContext.js.map","/**\r\n * PropertiesPlugin.ts\r\n * @copyright Microsoft 2018\r\n */\r\nimport * as tslib_1 from \"tslib\";\r\nimport { BaseTelemetryPlugin, CoreUtils, _InternalLogMessage, LoggingSeverity, _InternalMessageId, getNavigator } from '@microsoft/applicationinsights-core-js';\r\nimport { TelemetryContext } from './TelemetryContext';\r\nimport { PageView, BreezeChannelIdentifier, PropertiesPluginIdentifier, Extensions, Util } from '@microsoft/applicationinsights-common';\r\nvar PropertiesPlugin = /** @class */ (function (_super) {\r\n tslib_1.__extends(PropertiesPlugin, _super);\r\n function PropertiesPlugin() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.priority = 110;\r\n _this.identifier = PropertiesPluginIdentifier;\r\n return _this;\r\n }\r\n PropertiesPlugin.getDefaultConfig = function () {\r\n var defaultConfig = {\r\n instrumentationKey: function () { return undefined; },\r\n accountId: function () { return null; },\r\n sessionRenewalMs: function () { return 30 * 60 * 1000; },\r\n samplingPercentage: function () { return 100; },\r\n sessionExpirationMs: function () { return 24 * 60 * 60 * 1000; },\r\n cookieDomain: function () { return null; },\r\n sdkExtension: function () { return null; },\r\n isBrowserLinkTrackingEnabled: function () { return false; },\r\n appId: function () { return null; },\r\n namePrefix: function () { return undefined; }\r\n };\r\n return defaultConfig;\r\n };\r\n PropertiesPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n var _this = this;\r\n _super.prototype.initialize.call(this, config, core, extensions, pluginChain);\r\n var ctx = this._getTelCtx();\r\n var identifier = this.identifier;\r\n var defaultConfig = PropertiesPlugin.getDefaultConfig();\r\n this._extensionConfig = this._extensionConfig || PropertiesPlugin.getDefaultConfig();\r\n var _loop_1 = function (field) {\r\n this_1._extensionConfig[field] = function () { return ctx.getConfig(identifier, field, defaultConfig[field]()); };\r\n };\r\n var this_1 = this;\r\n for (var field in defaultConfig) {\r\n _loop_1(field);\r\n }\r\n this.context = new TelemetryContext(core.logger, this._extensionConfig);\r\n this._breezeChannel = Util.getExtension(extensions, BreezeChannelIdentifier);\r\n this.context.appId = function () { return _this._breezeChannel ? _this._breezeChannel[\"_appId\"] : null; };\r\n };\r\n /**\r\n * Add Part A fields to the event\r\n * @param event The event that needs to be processed\r\n */\r\n PropertiesPlugin.prototype.processTelemetry = function (event, itemCtx) {\r\n if (CoreUtils.isNullOrUndefined(event)) {\r\n // TODO(barustum): throw an internal event once we have support for internal logging\r\n }\r\n else {\r\n itemCtx = this._getTelCtx(itemCtx);\r\n // If the envelope is PageView, reset the internal message count so that we can send internal telemetry for the new page.\r\n if (event.name === PageView.envelopeType) {\r\n itemCtx.diagLog().resetInternalMessageCount();\r\n }\r\n if (this.context.session) {\r\n // If customer did not provide custom session id update the session manager\r\n if (typeof this.context.session.id !== \"string\") {\r\n this.context.sessionManager.update();\r\n }\r\n }\r\n this._processTelemetryInternal(event, itemCtx);\r\n if (this.context && this.context.user && this.context.user.isNewUser) {\r\n this.context.user.isNewUser = false;\r\n var message = new _InternalLogMessage(_InternalMessageId.SendBrowserInfoOnUserInit, ((getNavigator() || {}).userAgent || \"\"));\r\n itemCtx.diagLog().logInternalMessage(LoggingSeverity.CRITICAL, message);\r\n }\r\n this.processNext(event, itemCtx);\r\n }\r\n };\r\n PropertiesPlugin.prototype._processTelemetryInternal = function (event, itemCtx) {\r\n // set part A fields\r\n if (!event.tags) {\r\n event.tags = [];\r\n }\r\n if (!event.ext) {\r\n event.ext = {};\r\n }\r\n var ext = event.ext;\r\n ext[Extensions.DeviceExt] = ext[Extensions.DeviceExt] || {};\r\n ext[Extensions.WebExt] = ext[Extensions.WebExt] || {};\r\n ext[Extensions.UserExt] = ext[Extensions.UserExt] || {};\r\n ext[Extensions.OSExt] = ext[Extensions.OSExt] || {};\r\n ext[Extensions.AppExt] = ext[Extensions.AppExt] || {};\r\n ext[Extensions.TraceExt] = ext[Extensions.TraceExt] || {};\r\n var context = this.context;\r\n context.applySessionContext(event, itemCtx);\r\n context.applyApplicationContext(event, itemCtx);\r\n context.applyDeviceContext(event, itemCtx);\r\n context.applyOperationContext(event, itemCtx);\r\n context.applyUserContext(event, itemCtx);\r\n context.applyOperatingSystemContxt(event, itemCtx);\r\n context.applyWebContext(event, itemCtx);\r\n context.applyLocationContext(event, itemCtx); // legacy tags\r\n context.applyInternalContext(event, itemCtx); // legacy tags\r\n context.cleanUp(event, itemCtx);\r\n };\r\n return PropertiesPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport default PropertiesPlugin;\r\n//# sourceMappingURL=PropertiesPlugin.js.map"],"sourceRoot":""}