/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/attribution/helpers.js" /*!**********************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/attribution/helpers.js ***! \**********************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ KNOWN_2LDS: () => (/* binding */ KNOWN_2LDS), /* harmony export */ createCampaignEvent: () => (/* binding */ createCampaignEvent), /* harmony export */ getDefaultExcludedReferrers: () => (/* binding */ getDefaultExcludedReferrers), /* harmony export */ getDomain: () => (/* binding */ getDomain), /* harmony export */ isExcludedReferrer: () => (/* binding */ isExcludedReferrer), /* harmony export */ isNewCampaign: () => (/* binding */ isNewCampaign), /* harmony export */ isSubdomainOf: () => (/* binding */ isSubdomainOf) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/identify.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../types */ "./node_modules/@amplitude/analytics-core/lib/esm/types/config/browser-config.js"); var domainWithoutSubdomain = function (domain) { var parts = domain.split('.'); if (parts.length <= 2) { return domain; } return parts.slice(parts.length - 2, parts.length).join('.'); }; //Direct traffic mean no external referral, no UTMs, no click-ids, and no other customer identified marketing campaign url params. var isDirectTraffic = function (current) { return Object.values(current).every(function (value) { return !value; }); }; var isEmptyCampaign = function (campaign) { var campaignWithoutReferrer = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, campaign), { referring_domain: undefined, referrer: undefined }); return Object.values(campaignWithoutReferrer).every(function (value) { return !value; }); }; var isNewCampaign = function (current, previous, options, logger, isNewSession, topLevelDomain) { if (isNewSession === void 0) { isNewSession = true; } var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__rest)(current, ["referrer", "referring_domain"]); var _a = previous || {}, _previous_referrer = _a.referrer, prevReferringDomain = _a.referring_domain, previousCampaign = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__rest)(_a, ["referrer", "referring_domain"]); var excludeInternalReferrers = options.excludeInternalReferrers; if (excludeInternalReferrers) { var condition = getExcludeInternalReferrersCondition(excludeInternalReferrers, logger); if (!(condition instanceof TypeError) && current.referring_domain && isInternalReferrer(current.referring_domain, topLevelDomain)) { if (condition === 'always') { debugLogInternalReferrerExclude(condition, current.referring_domain, logger); return false; } else if (condition === 'ifEmptyCampaign' && isEmptyCampaign(current)) { debugLogInternalReferrerExclude(condition, current.referring_domain, logger); return false; } } } if (isExcludedReferrer(options.excludeReferrers, current.referring_domain)) { // eslint-disable-next-line @typescript-eslint/restrict-template-expressions logger.debug("This is not a new campaign because ".concat(current.referring_domain, " is in the exclude referrer list.")); return false; } //In the same session, direct traffic should not override or unset any persisting query params if (!isNewSession && isDirectTraffic(current) && previous) { logger.debug('This is not a new campaign because this is a direct traffic in the same session.'); return false; } var hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign); var hasNewDomain = domainWithoutSubdomain(referring_domain || '') !== domainWithoutSubdomain(prevReferringDomain || ''); var result = !previous || hasNewCampaign || hasNewDomain; if (!result) { logger.debug("This is not a new campaign because it's the same as the previous one."); } else { logger.debug("This is a new campaign. An $identify event will be sent."); } return result; }; var isExcludedReferrer = function (excludeReferrers, referringDomain) { if (excludeReferrers === void 0) { excludeReferrers = []; } if (referringDomain === void 0) { referringDomain = ''; } return excludeReferrers.some(function (value) { return value instanceof RegExp ? value.test(referringDomain) : value === referringDomain; }); }; var isSubdomainOf = function (subDomain, domain) { var cookieDomainWithLeadingDot = domain.startsWith('.') ? domain : ".".concat(domain); var subDomainWithLeadingDot = subDomain.startsWith('.') ? subDomain : ".".concat(subDomain); if (subDomainWithLeadingDot.endsWith(cookieDomainWithLeadingDot)) return true; return false; }; var createCampaignEvent = function (campaign, options) { var campaignParameters = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__.BASE_CAMPAIGN), campaign); var identifyEvent = Object.entries(campaignParameters).reduce(function (identify, _a) { var _b; var _c = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(_a, 2), key = _c[0], value = _c[1]; identify.setOnce("initial_".concat(key), (_b = value !== null && value !== void 0 ? value : options.initialEmptyValue) !== null && _b !== void 0 ? _b : 'EMPTY'); if (value) { return identify.set(key, value); } return identify.unset(key); }, new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.Identify()); return (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__.createIdentifyEvent)(identifyEvent); }; var getDefaultExcludedReferrers = function (cookieDomain) { var domain = cookieDomain; if (domain) { if (domain.startsWith('.')) { domain = domain.substring(1); } return [new RegExp("".concat(domain.replace('.', '\\.'), "$"))]; } return []; }; /** * Parses the excludeInternalReferrers configuration to determine the condition on which to * exclude internal referrers for campaign attribution. * * If the config is invalid type, log and return a TypeError. * * (this does explicit type checking so don't have to rely on TS compiler to catch invalid types) * * @param excludeInternalReferrers - attribution.excludeInternalReferrers configuration * @param logger - logger instance to log error when TypeError * @returns The condition if the config is valid, TypeError if the config is invalid. */ var getExcludeInternalReferrersCondition = function (excludeInternalReferrers, logger) { if (excludeInternalReferrers === true) { return _types__WEBPACK_IMPORTED_MODULE_5__.EXCLUDE_INTERNAL_REFERRERS_CONDITIONS.always; } if (typeof excludeInternalReferrers === 'object') { var condition = excludeInternalReferrers.condition; if (typeof condition === 'string' && Object.keys(_types__WEBPACK_IMPORTED_MODULE_5__.EXCLUDE_INTERNAL_REFERRERS_CONDITIONS).includes(condition)) { return condition; } else if (typeof condition === 'undefined') { return _types__WEBPACK_IMPORTED_MODULE_5__.EXCLUDE_INTERNAL_REFERRERS_CONDITIONS.always; } } var errorMessage = "Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(excludeInternalReferrers)); logger.error(errorMessage); return new TypeError(errorMessage); }; // helper function to log debug message when internal referrer is excluded // (added this to prevent code duplication and improve readability) function debugLogInternalReferrerExclude(condition, referringDomain, logger) { var baseMessage = "This is not a new campaign because referring_domain=".concat(referringDomain, " is on the same domain as the current page and it is configured to exclude internal referrers"); if (condition === 'always') { logger.debug(baseMessage); } else if (condition === 'ifEmptyCampaign') { logger.debug("".concat(baseMessage, " with empty campaign parameters")); } } // list of domains that are known ccTLDs that are commonly used // and are in the Public Suffix List (https://publicsuffix.org/) var KNOWN_2LDS = [ 'ac.in', 'ac.jp', 'ac.kr', 'ac.th', 'ac.uk', 'ac.za', 'appspot.com', 'asn.au', 'azurewebsites.net', 'cloudfront.net', 'myshopify.com', 'blogspot.com', 'co.ca', 'co.in', 'co.jp', 'co.kr', 'co.nz', 'co.th', 'co.uk', 'co.za', 'com.ar', 'com.au', 'com.br', 'com.cn', 'com.hk', 'com.in', 'com.jp', 'com.kr', 'com.mx', 'com.pl', 'com.sg', 'com.tr', 'com.tw', 'ed.jp', 'edu.au', 'edu.br', 'edu.cn', 'edu.hk', 'edu.sg', 'edu.th', 'edu.tr', 'edu.tw', 'firebaseapp.com', 'fly.dev', 'gc.ca', 'geek.nz', 'github.io', 'gitlab.io', 'go.jp', 'go.kr', 'go.th', 'gob.ar', 'gob.mx', 'gov.au', 'gov.br', 'gov.cn', 'gov.hk', 'gov.in', 'gov.pl', 'gov.sg', 'gov.tr', 'gov.tw', 'gov.uk', 'gov.za', 'govt.nz', 'gr.jp', 'herokuapp.com', 'id.au', 'idv.hk', 'iwi.nz', 'lg.jp', 'ltd.uk', 'maori.nz', 'me.uk', 'mil.kr', 'ne.jp', 'ne.kr', 'net.au', 'net.br', 'net.cn', 'net.hk', 'net.in', 'net.nz', 'net.pl', 'net.sg', 'net.tr', 'net.tw', 'net.za', 'onrender.com', 'or.jp', 'or.kr', 'or.th', 'org.ar', 'org.au', 'org.br', 'org.cn', 'org.hk', 'org.in', 'org.mx', 'org.nz', 'org.pl', 'org.sg', 'org.tw', 'org.uk', 'org.za', 'pages.dev', 'pe.kr', 'plc.uk', 're.kr', 'res.in', 'sch.uk', 'vercel.app', 'netlify.app', 'workers.dev', ]; var getDomain = function (hostnameParam) { var _a, _b; /* istanbul ignore next */ var hostname = hostnameParam || ((_b = (_a = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.hostname); if (!hostname) { return ''; } var parts = hostname.split('.'); var tld = parts[parts.length - 1]; var name = parts[parts.length - 2]; if (KNOWN_2LDS.find(function (tld) { return hostname.endsWith(".".concat(tld)); })) { tld = parts[parts.length - 2] + '.' + parts[parts.length - 1]; name = parts[parts.length - 3]; } if (!name) return tld; return "".concat(name, ".").concat(tld); }; var isInternalReferrer = function (referringDomain, topLevelDomain) { var globalScope = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.getGlobalScope)(); /* istanbul ignore if */ if (!globalScope) return false; // if referring domain is subdomain of config.cookieDomain, return true var internalDomain = (topLevelDomain || '').trim() || getDomain(globalScope.location.hostname); return isSubdomainOf(referringDomain, internalDomain); }; //# sourceMappingURL=helpers.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/attribution/web-attribution.js" /*!******************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/attribution/web-attribution.js ***! \******************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ WebAttribution: () => (/* binding */ WebAttribution) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/session.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/storage/helpers.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/campaign/campaign-parser.js"); /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers */ "./node_modules/@amplitude/analytics-browser/lib/esm/attribution/helpers.js"); var WebAttribution = /** @class */ (function () { function WebAttribution(options, config) { var _a; this.shouldTrackNewCampaign = false; this.options = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({ initialEmptyValue: 'EMPTY', resetSessionOnNewCampaign: false, excludeReferrers: (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.getDefaultExcludedReferrers)(((_a = config.cookieOptions) === null || _a === void 0 ? void 0 : _a.domain) || config.topLevelDomain), optOut: config.optOut }, options); this.storage = config.cookieStorage; this.storageKey = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.getStorageKey)(config.apiKey, 'MKTG'); this.webExpStorageKey = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.getStorageKey)(config.apiKey, 'MKTG_ORIGINAL'); this.currentCampaign = _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__.BASE_CAMPAIGN; this.sessionTimeout = config.sessionTimeout; this.lastEventTime = config.lastEventTime; this.logger = config.loggerProvider; this.topLevelDomain = config.topLevelDomain; config.loggerProvider.log('Installing web attribution tracking.'); } WebAttribution.prototype.init = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var isEventInNewSession; var _a; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) { switch (_b.label) { case 0: // skip attribution if optOut is true if (this.options.optOut) { return [2 /*return*/]; } return [4 /*yield*/, this.fetchCampaign()]; case 1: _a = tslib__WEBPACK_IMPORTED_MODULE_0__.__read.apply(void 0, [_b.sent(), 2]), this.currentCampaign = _a[0], this.previousCampaign = _a[1]; isEventInNewSession = !this.lastEventTime ? true : (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.isNewSession)(this.sessionTimeout, this.lastEventTime); if (!(0,_helpers__WEBPACK_IMPORTED_MODULE_5__.isNewCampaign)(this.currentCampaign, this.previousCampaign, this.options, this.logger, isEventInNewSession, this.topLevelDomain)) return [3 /*break*/, 3]; this.shouldTrackNewCampaign = true; return [4 /*yield*/, this.storage.set(this.storageKey, this.currentCampaign)]; case 2: _b.sent(); _b.label = 3; case 3: return [2 /*return*/]; } }); }); }; WebAttribution.prototype.fetchCampaign = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var originalCampaign; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.storage.get(this.webExpStorageKey)]; case 1: originalCampaign = _a.sent(); if (!originalCampaign) return [3 /*break*/, 3]; return [4 /*yield*/, this.storage.remove(this.webExpStorageKey)]; case 2: _a.sent(); _a.label = 3; case 3: return [4 /*yield*/, Promise.all([originalCampaign || new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__.CampaignParser().parse(), this.storage.get(this.storageKey)])]; case 4: return [2 /*return*/, _a.sent()]; } }); }); }; /** * This can be called when enable web attribution and either * 1. set a new session * 2. has new campaign and enable resetSessionOnNewCampaign */ WebAttribution.prototype.generateCampaignEvent = function (event_id) { // Mark this campaign has been tracked this.shouldTrackNewCampaign = false; var campaignEvent = (0,_helpers__WEBPACK_IMPORTED_MODULE_5__.createCampaignEvent)(this.currentCampaign, this.options); if (event_id) { campaignEvent.event_id = event_id; } return campaignEvent; }; WebAttribution.prototype.shouldSetSessionIdOnNewCampaign = function () { return this.shouldTrackNewCampaign && !!this.options.resetSessionOnNewCampaign; }; return WebAttribution; }()); //# sourceMappingURL=web-attribution.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js" /*!*************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js ***! \*************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ createInstance: () => (/* binding */ createInstance), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js"); /* harmony import */ var _browser_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./browser-client */ "./node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js"); var createInstance = function () { var client = new _browser_client__WEBPACK_IMPORTED_MODULE_1__.AmplitudeBrowser(); return { init: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.init.bind(client), 'init', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), add: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.add.bind(client), 'add', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.plugins'])), remove: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.remove.bind(client), 'remove', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.plugins'])), track: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.track.bind(client), 'track', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])), logEvent: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.logEvent.bind(client), 'logEvent', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])), identify: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.identify.bind(client), 'identify', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])), groupIdentify: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.groupIdentify.bind(client), 'groupIdentify', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])), setGroup: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.setGroup.bind(client), 'setGroup', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])), revenue: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.revenue.bind(client), 'revenue', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])), flush: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.flush.bind(client), 'flush', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config.apiKey', 'timeline.queue.length'])), getUserId: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.getUserId.bind(client), 'getUserId', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config', 'config.userId'])), setUserId: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.setUserId.bind(client), 'setUserId', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config', 'config.userId'])), getDeviceId: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.getDeviceId.bind(client), 'getDeviceId', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config', 'config.deviceId'])), setDeviceId: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.setDeviceId.bind(client), 'setDeviceId', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config', 'config.deviceId'])), reset: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.reset.bind(client), 'reset', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config', 'config.userId', 'config.deviceId'])), getSessionId: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.getSessionId.bind(client), 'getSessionId', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), setSessionId: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.setSessionId.bind(client), 'setSessionId', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), extendSession: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.extendSession.bind(client), 'extendSession', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), setOptOut: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.setOptOut.bind(client), 'setOptOut', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), setTransport: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.setTransport.bind(client), 'setTransport', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), getIdentity: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.getIdentity.bind(client), 'getIdentity', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), setIdentity: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.setIdentity.bind(client), 'setIdentity', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config', 'config.userId', 'config.deviceId'])), getOptOut: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client.getOptOut.bind(client), 'getOptOut', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), _setDiagnosticsSampleRate: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client._setDiagnosticsSampleRate.bind(client), '_setDiagnosticsSampleRate', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), _enableRequestBodyCompressionExperimental: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.debugWrapper)(client._enableRequestBodyCompressionExperimental.bind(client), '_enableRequestBodyCompressionExperimental', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientLogConfig)(client), (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.getClientStates)(client, ['config'])), }; }; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (createInstance()); //# sourceMappingURL=browser-client-factory.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js" /*!*****************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js ***! \*****************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AmplitudeBrowser: () => (/* binding */ AmplitudeBrowser) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/core-client.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/identify.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/revenue.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/plugins/identity.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/logger.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/analytics-connector.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/session.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/query-params.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/diagnostics-client.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/remote-config/remote-config.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/offline.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/safe-stringify.js"); /* harmony import */ var _default_tracking__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./default-tracking */ "./node_modules/@amplitude/analytics-browser/lib/esm/default-tracking.js"); /* harmony import */ var _utils_snippet_helper__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./utils/snippet-helper */ "./node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js"); /* harmony import */ var _plugins_context__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./plugins/context */ "./node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./config */ "./node_modules/@amplitude/analytics-browser/lib/esm/config.js"); /* harmony import */ var _amplitude_plugin_page_view_tracking_browser__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! @amplitude/plugin-page-view-tracking-browser */ "./node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/page-view-tracking.js"); /* harmony import */ var _plugins_form_interaction_tracking__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./plugins/form-interaction-tracking */ "./node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js"); /* harmony import */ var _plugins_file_download_tracking__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./plugins/file-download-tracking */ "./node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js"); /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./constants */ "./node_modules/@amplitude/analytics-browser/lib/esm/constants.js"); /* harmony import */ var _det_notification__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./det-notification */ "./node_modules/@amplitude/analytics-browser/lib/esm/det-notification.js"); /* harmony import */ var _plugins_network_connectivity_checker__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./plugins/network-connectivity-checker */ "./node_modules/@amplitude/analytics-browser/lib/esm/plugins/network-connectivity-checker.js"); /* harmony import */ var _config_joined_config__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./config/joined-config */ "./node_modules/@amplitude/analytics-browser/lib/esm/config/joined-config.js"); /* harmony import */ var _amplitude_plugin_autocapture_browser__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! @amplitude/plugin-autocapture-browser */ "./node_modules/@amplitude/plugin-autocapture-browser/lib/esm/autocapture-plugin.js"); /* harmony import */ var _amplitude_plugin_autocapture_browser__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! @amplitude/plugin-autocapture-browser */ "./node_modules/@amplitude/plugin-autocapture-browser/lib/esm/frustration-plugin.js"); /* harmony import */ var _amplitude_plugin_network_capture_browser__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! @amplitude/plugin-network-capture-browser */ "./node_modules/@amplitude/plugin-network-capture-browser/lib/esm/network-capture-plugin.js"); /* harmony import */ var _amplitude_plugin_web_vitals_browser__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! @amplitude/plugin-web-vitals-browser */ "./node_modules/@amplitude/plugin-web-vitals-browser/lib/esm/web-vitals-plugin.js"); /* harmony import */ var _attribution_web_attribution__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./attribution/web-attribution */ "./node_modules/@amplitude/analytics-browser/lib/esm/attribution/web-attribution.js"); /* harmony import */ var _lib_prefix__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./lib-prefix */ "./node_modules/@amplitude/analytics-browser/lib/esm/lib-prefix.js"); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./version */ "./node_modules/@amplitude/analytics-browser/lib/esm/version.js"); /* harmony import */ var _amplitude_plugin_page_url_enrichment_browser__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! @amplitude/plugin-page-url-enrichment-browser */ "./node_modules/@amplitude/plugin-page-url-enrichment-browser/lib/esm/page-url-enrichment.js"); /* harmony import */ var _amplitude_plugin_custom_enrichment_browser__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! @amplitude/plugin-custom-enrichment-browser */ "./node_modules/@amplitude/plugin-custom-enrichment-browser/lib/esm/custom-enrichment.js"); var UNSPECIFIED_SESSION_ID = -1; /** * Exported for `@amplitude/unified` or integration with blade plugins. * If you only use `@amplitude/analytics-browser`, use `amplitude.init()` or `amplitude.createInstance()` instead. */ var AmplitudeBrowser = /** @class */ (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(AmplitudeBrowser, _super); function AmplitudeBrowser() { var _this = _super !== null && _super.apply(this, arguments) || this; // Backdoor to set diagnostics sample rate // by calling amplitude._setDiagnosticsSampleRate(1); before amplitude.init() _this._diagnosticsSampleRate = 0; // Backdoor to test request body compression // by calling amplitude._enableRequestBodyCompressionExperimental(true); before amplitude.init() _this._enableRequestBodyCompressionExperimentalValue = false; return _this; } AmplitudeBrowser.prototype.init = function (apiKey, userIdOrOptions, maybeOptions) { if (apiKey === void 0) { apiKey = ''; } var userId; var options; if (arguments.length > 2) { userId = userIdOrOptions; options = maybeOptions; } else { if (typeof userIdOrOptions === 'string') { userId = userIdOrOptions; options = undefined; } else { userId = userIdOrOptions === null || userIdOrOptions === void 0 ? void 0 : userIdOrOptions.userId; options = userIdOrOptions; } } return (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_10__.returnWrapper)(this._init((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, options), { userId: userId, apiKey: apiKey }))); }; AmplitudeBrowser.prototype._init = function (options) { var _a, _b, _c, _d, _e, _f, _g, _h; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var fetchRemoteConfig, loggerProvider, serverZone, remoteConfigClient, diagnosticsSampleRate, enableDiagnostics, diagnosticsClient, browserOptions, attributionTrackingOptions, queryParams, ampTimestamp, isWithinTimeLimit, querySessionId, deferredSessionId, connector; var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_j) { switch (_j.label) { case 0: // Step 1: Block concurrent initialization if (this.initializing) { return [2 /*return*/]; } this.initializing = true; fetchRemoteConfig = (0,_config__WEBPACK_IMPORTED_MODULE_21__.shouldFetchRemoteConfig)(options); loggerProvider = (_a = options.loggerProvider) !== null && _a !== void 0 ? _a : new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_6__.Logger(); if (!options.loggerProvider) { loggerProvider.enable((_b = options.logLevel) !== null && _b !== void 0 ? _b : _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_15__.LogLevel.Warn); } serverZone = (_c = options.serverZone) !== null && _c !== void 0 ? _c : _constants__WEBPACK_IMPORTED_MODULE_25__.DEFAULT_SERVER_ZONE; diagnosticsSampleRate = this._diagnosticsSampleRate; enableDiagnostics = (_d = options.enableDiagnostics) !== null && _d !== void 0 ? _d : true; if (!fetchRemoteConfig) return [3 /*break*/, 2]; remoteConfigClient = new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_14__.RemoteConfigClient(options.apiKey, loggerProvider, serverZone, /* istanbul ignore next */ (_e = options.remoteConfig) === null || _e === void 0 ? void 0 : _e.serverUrl); // Fetch diagnostics config first to get sample rate return [4 /*yield*/, new Promise(function (resolve) { // Disable coverage for this line because remote config client will always be defined in this case. // istanbul ignore next remoteConfigClient === null || remoteConfigClient === void 0 ? void 0 : remoteConfigClient.subscribe('configs.diagnostics.browserSDK', 'all', function (remoteConfig, source, lastFetch) { loggerProvider.debug('Diagnostics remote configuration received:', JSON.stringify({ remoteConfig: remoteConfig, source: source, lastFetch: lastFetch, }, null, 2)); if (remoteConfig) { // Validate and set sampleRate (must be a valid number) var sampleRate = remoteConfig.sampleRate; if (typeof sampleRate === 'number' && !isNaN(sampleRate)) { diagnosticsSampleRate = sampleRate; } // Validate and set enabled (must be a boolean) var enabled = remoteConfig.enabled; if (typeof enabled === 'boolean') { enableDiagnostics = enabled; } } resolve(); }); })]; case 1: // Fetch diagnostics config first to get sample rate _j.sent(); _j.label = 2; case 2: diagnosticsClient = new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_13__.DiagnosticsClient(options.apiKey, loggerProvider, serverZone, { enabled: enableDiagnostics, sampleRate: diagnosticsSampleRate, }); diagnosticsClient.setTag('library', "".concat(_lib_prefix__WEBPACK_IMPORTED_MODULE_34__.LIBPREFIX, "/").concat(_version__WEBPACK_IMPORTED_MODULE_35__.VERSION)); if (typeof navigator !== 'undefined') { diagnosticsClient.setTag('user_agent', navigator.userAgent); } return [4 /*yield*/, (0,_config__WEBPACK_IMPORTED_MODULE_21__.useBrowserConfig)(options.apiKey, options, this, diagnosticsClient, { loggerProvider: loggerProvider, serverZone: serverZone, enableDiagnostics: enableDiagnostics, diagnosticsSampleRate: diagnosticsSampleRate, })]; case 3: browserOptions = _j.sent(); if (!(fetchRemoteConfig && remoteConfigClient)) return [3 /*break*/, 5]; return [4 /*yield*/, new Promise(function (resolve) { // Disable coverage for this line because remote config client will always be defined in this case. // istanbul ignore next remoteConfigClient === null || remoteConfigClient === void 0 ? void 0 : remoteConfigClient.subscribe('configs.analyticsSDK.browserSDK', 'all', function (remoteConfig, source, lastFetch) { browserOptions.loggerProvider.debug('Remote configuration received:', JSON.stringify({ remoteConfig: remoteConfig, source: source, lastFetch: lastFetch, }, null, 2)); if (remoteConfig) { (0,_config_joined_config__WEBPACK_IMPORTED_MODULE_28__.updateBrowserConfigWithRemoteConfig)(remoteConfig, browserOptions); } // Resolve the promise on first callback (initial config) resolve(); }); })]; case 4: _j.sent(); _j.label = 5; case 5: return [4 /*yield*/, _super.prototype._init.call(this, browserOptions)]; case 6: _j.sent(); this.logBrowserOptions(browserOptions); this.config.remoteConfigClient = remoteConfigClient; if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isAttributionTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 8]; if (this.config.optOut) { this.timeline.addOptOutListener(function (optOut) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(_this, void 0, void 0, function () { var attributionTrackingOptions_1; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: if (!!optOut) return [3 /*break*/, 2]; attributionTrackingOptions_1 = (0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.getAttributionTrackingConfig)(this.config); this.webAttribution = new _attribution_web_attribution__WEBPACK_IMPORTED_MODULE_33__.WebAttribution(attributionTrackingOptions_1, this.config); return [4 /*yield*/, this.webAttribution.init()]; case 1: _a.sent(); _a.label = 2; case 2: return [2 /*return*/]; } }); }); }); } attributionTrackingOptions = (0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.getAttributionTrackingConfig)(this.config); this.webAttribution = new _attribution_web_attribution__WEBPACK_IMPORTED_MODULE_33__.WebAttribution(attributionTrackingOptions, this.config); // Fetch the current campaign, check if need to track web attribution later return [4 /*yield*/, this.webAttribution.init()]; case 7: // Fetch the current campaign, check if need to track web attribution later _j.sent(); _j.label = 8; case 8: queryParams = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_9__.getQueryParams)(); ampTimestamp = queryParams.ampTimestamp ? Number(queryParams.ampTimestamp) : undefined; isWithinTimeLimit = ampTimestamp ? Date.now() < ampTimestamp : true; querySessionId = isWithinTimeLimit && !Number.isNaN(Number(queryParams.ampSessionId)) ? Number(queryParams.ampSessionId) : undefined; deferredSessionId = this.config.deferredSessionId; if (deferredSessionId === UNSPECIFIED_SESSION_ID && !this.config.optOut) { deferredSessionId = Date.now(); } this.setSessionId((_h = (_g = (_f = options.sessionId) !== null && _f !== void 0 ? _f : querySessionId) !== null && _g !== void 0 ? _g : deferredSessionId) !== null && _h !== void 0 ? _h : this.config.sessionId); if (this.config.optOut) { this.timeline.addOptOutListener(function (optOut) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(_this, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { if (!optOut && this.config.deferredSessionId) { if (this.config.deferredSessionId === UNSPECIFIED_SESSION_ID) { this.setSessionId(undefined); } else { this.setSessionId(this.config.deferredSessionId); } } return [2 /*return*/]; }); }); }); } connector = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.getAnalyticsConnector)(options.instanceName); connector.identityStore.setIdentity({ userId: this.config.userId, deviceId: this.config.deviceId, }); if (!(this.config.offline !== _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_16__.OfflineDisabled)) return [3 /*break*/, 10]; return [4 /*yield*/, this.add((0,_plugins_network_connectivity_checker__WEBPACK_IMPORTED_MODULE_27__.networkConnectivityCheckerPlugin)()).promise]; case 9: _j.sent(); _j.label = 10; case 10: return [4 /*yield*/, this.add(new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__.Destination({ diagnosticsClient: diagnosticsClient })).promise]; case 11: _j.sent(); return [4 /*yield*/, this.add(new _plugins_context__WEBPACK_IMPORTED_MODULE_20__.Context()).promise]; case 12: _j.sent(); return [4 /*yield*/, this.add(new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_5__.IdentityEventSender()).promise]; case 13: _j.sent(); // Notify if DET is enabled (0,_det_notification__WEBPACK_IMPORTED_MODULE_26__.detNotify)(this.config); if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isFileDownloadTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 15]; this.config.loggerProvider.debug('Adding file download tracking plugin'); return [4 /*yield*/, this.add((0,_plugins_file_download_tracking__WEBPACK_IMPORTED_MODULE_24__.fileDownloadTracking)()).promise]; case 14: _j.sent(); _j.label = 15; case 15: if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isFormInteractionTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 17]; this.config.loggerProvider.debug('Adding form interaction plugin'); return [4 /*yield*/, this.add((0,_plugins_form_interaction_tracking__WEBPACK_IMPORTED_MODULE_23__.formInteractionTracking)()).promise]; case 16: _j.sent(); _j.label = 17; case 17: if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isPageViewTrackingEnabled)(this.config.defaultTracking)) return [3 /*break*/, 20]; if (!!this.config.optOut) return [3 /*break*/, 19]; this.config.loggerProvider.debug('Adding page view tracking plugin'); return [4 /*yield*/, this.add((0,_amplitude_plugin_page_view_tracking_browser__WEBPACK_IMPORTED_MODULE_22__.pageViewTrackingPlugin)((0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.getPageViewTrackingConfig)(this.config))).promise]; case 18: _j.sent(); return [3 /*break*/, 20]; case 19: this.timeline.addOptOutListener(function (optOut) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(_this, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: /* istanbul ignore if */ if (optOut) { return [2 /*return*/]; } this.config.loggerProvider.debug('Adding page view tracking plugin'); return [4 /*yield*/, this.add((0,_amplitude_plugin_page_view_tracking_browser__WEBPACK_IMPORTED_MODULE_22__.pageViewTrackingPlugin)((0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.getPageViewTrackingConfig)(this.config))).promise]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }); _j.label = 20; case 20: if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isElementInteractionsEnabled)(this.config.autocapture)) return [3 /*break*/, 22]; this.config.loggerProvider.debug('Adding user interactions plugin (autocapture plugin)'); return [4 /*yield*/, this.add((0,_amplitude_plugin_autocapture_browser__WEBPACK_IMPORTED_MODULE_29__.autocapturePlugin)((0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.getElementInteractionsConfig)(this.config), { diagnosticsClient: diagnosticsClient })).promise]; case 21: _j.sent(); _j.label = 22; case 22: if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isFrustrationInteractionsEnabled)(this.config.autocapture)) return [3 /*break*/, 24]; this.config.loggerProvider.debug('Adding frustration interactions plugin'); return [4 /*yield*/, this.add((0,_amplitude_plugin_autocapture_browser__WEBPACK_IMPORTED_MODULE_30__.frustrationPlugin)((0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.getFrustrationInteractionsConfig)(this.config))).promise]; case 23: _j.sent(); _j.label = 24; case 24: if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isNetworkTrackingEnabled)(this.config.autocapture)) return [3 /*break*/, 26]; this.config.loggerProvider.debug('Adding network tracking plugin'); return [4 /*yield*/, this.add((0,_amplitude_plugin_network_capture_browser__WEBPACK_IMPORTED_MODULE_31__.networkCapturePlugin)((0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.getNetworkTrackingConfig)(this.config))).promise]; case 25: _j.sent(); _j.label = 26; case 26: if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isWebVitalsEnabled)(this.config.autocapture)) return [3 /*break*/, 28]; this.config.loggerProvider.debug('Adding web vitals plugin'); return [4 /*yield*/, this.add((0,_amplitude_plugin_web_vitals_browser__WEBPACK_IMPORTED_MODULE_32__.webVitalsPlugin)()).promise]; case 27: _j.sent(); _j.label = 28; case 28: if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isPageUrlEnrichmentEnabled)(this.config.autocapture)) return [3 /*break*/, 30]; this.config.loggerProvider.debug('Adding referrer page url plugin'); return [4 /*yield*/, this.add((0,_amplitude_plugin_page_url_enrichment_browser__WEBPACK_IMPORTED_MODULE_36__.pageUrlEnrichmentPlugin)()).promise]; case 29: _j.sent(); _j.label = 30; case 30: if (!(0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isCustomEnrichmentEnabled)(this.config.customEnrichment)) return [3 /*break*/, 32]; this.config.loggerProvider.debug('Adding custom enrichment plugin'); return [4 /*yield*/, this.add((0,_amplitude_plugin_custom_enrichment_browser__WEBPACK_IMPORTED_MODULE_37__.customEnrichmentPlugin)()).promise]; case 31: _j.sent(); _j.label = 32; case 32: this.initializing = false; // Step 6: Run queued dispatch functions return [4 /*yield*/, this.runQueuedFunctions('dispatchQ')]; case 33: // Step 6: Run queued dispatch functions _j.sent(); // Step 7: Add the event receiver after running remaining queued functions. connector.eventBridge.setEventReceiver(function (event) { var _a = event.eventProperties || {}, time = _a.time, cleanEventProperties = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__rest)(_a, ["time"]); var eventOptions = typeof time === 'number' ? { time: time } : undefined; void _this.track(event.eventType, cleanEventProperties, eventOptions); }); return [2 /*return*/]; } }); }); }; AmplitudeBrowser.prototype.getUserId = function () { var _a; return (_a = this.config) === null || _a === void 0 ? void 0 : _a.userId; }; AmplitudeBrowser.prototype.setUserId = function (userId) { if (!this.config) { this.q.push(this.setUserId.bind(this, userId)); return; } this.config.loggerProvider.debug('function setUserId: ', userId); if (userId !== this.config.userId || userId === undefined) { this.config.userId = userId; // eslint-disable-next-line @typescript-eslint/no-unsafe-call this.timeline.onIdentityChanged({ userId: userId }); (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.setConnectorUserId)(userId, this.config.instanceName); } }; AmplitudeBrowser.prototype.getDeviceId = function () { var _a; return (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceId; }; AmplitudeBrowser.prototype.setDeviceId = function (deviceId) { if (!this.config) { this.q.push(this.setDeviceId.bind(this, deviceId)); return; } this.config.loggerProvider.debug('function setDeviceId: ', deviceId); if (deviceId !== this.config.deviceId) { this.config.deviceId = deviceId; // eslint-disable-next-line @typescript-eslint/no-unsafe-call this.timeline.onIdentityChanged({ deviceId: deviceId }); (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.setConnectorDeviceId)(deviceId, this.config.instanceName); } }; AmplitudeBrowser.prototype.reset = function () { this.setDeviceId((0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_11__.UUID)()); this.setUserId(undefined); this.timeline.onReset(); }; AmplitudeBrowser.prototype.getIdentity = function () { var _a, _b; return { deviceId: (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceId, userId: (_b = this.config) === null || _b === void 0 ? void 0 : _b.userId, userProperties: this.userProperties, }; }; AmplitudeBrowser.prototype.setIdentity = function (identity) { var e_1, _a; var _b; // Handle userId change if ('userId' in identity) { this.setUserId(identity.userId); } // Handle deviceId change if ('deviceId' in identity && identity.deviceId) { this.setDeviceId(identity.deviceId); } // Handle userProperties change - auto-send identify if ('userProperties' in identity) { this.userProperties = identity.userProperties; // Auto-send identify event with $set operations var identifyObj = new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.Identify(); // istanbul ignore next var userProperties = (_b = identity.userProperties) !== null && _b !== void 0 ? _b : {}; try { for (var _c = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(Object.entries(userProperties)), _d = _c.next(); !_d.done; _d = _c.next()) { var _e = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(_d.value, 2), key = _e[0], value = _e[1]; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment // eslint-disable-next-line @typescript-eslint/no-unsafe-argument identifyObj.set(key, value); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_1) throw e_1.error; } } // The identify event processing in core-client already calls onIdentityChanged, // so we don't need to call it explicitly here to avoid duplicate notifications. this.identify(identifyObj); } }; AmplitudeBrowser.prototype.getOptOut = function () { var _a; return (_a = this.config) === null || _a === void 0 ? void 0 : _a.optOut; }; AmplitudeBrowser.prototype.getSessionId = function () { var _a; return (_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionId; }; AmplitudeBrowser.prototype.setSessionId = function (sessionId) { var _a; var promises = []; if (!this.config) { this.q.push(this.setSessionId.bind(this, sessionId)); return (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_10__.returnWrapper)(Promise.resolve()); } // do not start a new session if optOut is true if (this.config.optOut) { // save the sessionId to storage to be used when optOut is false this.config.deferredSessionId = sessionId !== null && sessionId !== void 0 ? sessionId : UNSPECIFIED_SESSION_ID; return (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_10__.returnWrapper)(Promise.resolve()); } // default sessionId to current time if (sessionId === undefined) { sessionId = Date.now(); } // Prevents starting a new session with the same session ID if (sessionId === this.config.sessionId) { return (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_10__.returnWrapper)(Promise.resolve()); } this.config.loggerProvider.debug('function setSessionId: ', sessionId); var previousSessionId = this.getSessionId(); if (previousSessionId !== sessionId) { // eslint-disable-next-line @typescript-eslint/no-unsafe-call this.timeline.onSessionIdChanged(sessionId); } var lastEventTime = this.config.lastEventTime; var lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1; this.config.sessionId = sessionId; this.config.lastEventTime = undefined; this.config.pageCounter = 0; if ((0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isSessionTrackingEnabled)(this.config.defaultTracking)) { if (previousSessionId && lastEventTime) { promises.push(this.track(_constants__WEBPACK_IMPORTED_MODULE_25__.DEFAULT_SESSION_END_EVENT, undefined, { device_id: this.previousSessionDeviceId, event_id: ++lastEventId, session_id: previousSessionId, time: lastEventTime + 1, user_id: this.previousSessionUserId, }).promise); } this.config.lastEventTime = this.config.sessionId; } // Fire web attribution event when enable webAttribution tracking // 1. has new campaign (call setSessionId from init function) // 2. or shouldTrackNewCampaign (call setSessionId from async process(event) when there has new campaign and resetSessionOnNewCampaign = true ) var isCampaignEventTracked = this.trackCampaignEventIfNeeded(++lastEventId, promises); // track the identify event if an Identify object is provided in the config if (this.config.identify) { promises.push(this.track((0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_12__.createIdentifyEvent)(this.config.identify)).promise); } if ((0,_default_tracking__WEBPACK_IMPORTED_MODULE_18__.isSessionTrackingEnabled)(this.config.defaultTracking)) { promises.push(this.track(_constants__WEBPACK_IMPORTED_MODULE_25__.DEFAULT_SESSION_START_EVENT, undefined, { event_id: isCampaignEventTracked ? ++lastEventId : lastEventId, session_id: this.config.sessionId, time: this.config.lastEventTime, }).promise); } this.previousSessionDeviceId = this.config.deviceId; this.previousSessionUserId = this.config.userId; return (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_10__.returnWrapper)(Promise.all(promises)); }; AmplitudeBrowser.prototype.extendSession = function () { if (!this.config) { this.q.push(this.extendSession.bind(this)); return; } this.config.lastEventTime = Date.now(); }; AmplitudeBrowser.prototype.setTransport = function (transport) { if (!this.config) { this.q.push(this.setTransport.bind(this, transport)); return; } this.config.transportProvider = (0,_config__WEBPACK_IMPORTED_MODULE_21__.createTransport)(transport); }; AmplitudeBrowser.prototype.identify = function (identify, eventOptions) { if ((0,_utils_snippet_helper__WEBPACK_IMPORTED_MODULE_19__.isInstanceProxy)(identify)) { var queue = identify._q; identify._q = []; identify = (0,_utils_snippet_helper__WEBPACK_IMPORTED_MODULE_19__.convertProxyObjectToRealObject)(new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.Identify(), queue); } if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.user_id) { this.setUserId(eventOptions.user_id); } if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.device_id) { this.setDeviceId(eventOptions.device_id); } return _super.prototype.identify.call(this, identify, eventOptions); }; AmplitudeBrowser.prototype.groupIdentify = function (groupType, groupName, identify, eventOptions) { if ((0,_utils_snippet_helper__WEBPACK_IMPORTED_MODULE_19__.isInstanceProxy)(identify)) { var queue = identify._q; identify._q = []; identify = (0,_utils_snippet_helper__WEBPACK_IMPORTED_MODULE_19__.convertProxyObjectToRealObject)(new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.Identify(), queue); } return _super.prototype.groupIdentify.call(this, groupType, groupName, identify, eventOptions); }; AmplitudeBrowser.prototype.revenue = function (revenue, eventOptions) { if ((0,_utils_snippet_helper__WEBPACK_IMPORTED_MODULE_19__.isInstanceProxy)(revenue)) { var queue = revenue._q; revenue._q = []; revenue = (0,_utils_snippet_helper__WEBPACK_IMPORTED_MODULE_19__.convertProxyObjectToRealObject)(new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__.Revenue(), queue); } return _super.prototype.revenue.call(this, revenue, eventOptions); }; AmplitudeBrowser.prototype.trackCampaignEventIfNeeded = function (lastEventId, promises) { if (!this.webAttribution || !this.webAttribution.shouldTrackNewCampaign) { return false; } var campaignEvent = this.webAttribution.generateCampaignEvent(lastEventId); if (promises) { promises.push(this.track(campaignEvent).promise); } else { this.track(campaignEvent); } this.config.loggerProvider.log('Tracking attribution.'); return true; }; AmplitudeBrowser.prototype.process = function (event) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var currentTime, isEventInNewSession, shouldSetSessionIdOnNewCampaign; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { currentTime = Date.now(); isEventInNewSession = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_8__.isNewSession)(this.config.sessionTimeout, this.config.lastEventTime); shouldSetSessionIdOnNewCampaign = this.webAttribution && this.webAttribution.shouldSetSessionIdOnNewCampaign(); if (event.event_type !== _constants__WEBPACK_IMPORTED_MODULE_25__.DEFAULT_SESSION_START_EVENT && event.event_type !== _constants__WEBPACK_IMPORTED_MODULE_25__.DEFAULT_SESSION_END_EVENT && (!event.session_id || event.session_id === this.getSessionId())) { if (isEventInNewSession || shouldSetSessionIdOnNewCampaign) { this.setSessionId(currentTime); if (shouldSetSessionIdOnNewCampaign) { this.config.loggerProvider.log('Created a new session for new campaign.'); } } else if (!isEventInNewSession) { // Web attribution should be tracked during the middle of a session // if there has been a chance in the campaign information. this.trackCampaignEventIfNeeded(); } } return [2 /*return*/, _super.prototype.process.call(this, event)]; }); }); }; AmplitudeBrowser.prototype.logBrowserOptions = function (browserConfig) { try { var browserConfigCopy = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, browserConfig), { apiKey: browserConfig.apiKey.substring(0, 10) + '********' }); this.config.loggerProvider.debug('Initialized Amplitude with BrowserConfig:', (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_17__.safeJsonStringify)(browserConfigCopy)); } catch (e) { /* istanbul ignore next */ this.config.loggerProvider.error('Error logging browser config', e); } }; /** * @experimental * WARNING: This method is for internal testing only and is not part of the public API. * It may be changed or removed at any time without notice. * * Sets the diagnostics sample rate before amplitude.init() * @param sampleRate - The sample rate to set */ AmplitudeBrowser.prototype._setDiagnosticsSampleRate = function (sampleRate) { if (sampleRate > 1 || sampleRate < 0) { return; } // Set diagnostics sample rate before initializing the config if (!this.config) { this._diagnosticsSampleRate = sampleRate; return; } }; /** * @experimental * WARNING: This method is for internal testing only and is not part of the public API. * It may be changed or removed at any time without notice. */ AmplitudeBrowser.prototype._enableRequestBodyCompressionExperimental = function (enabled) { // Set request body compression experimental config before initializing the config if (!this.config) { this._enableRequestBodyCompressionExperimentalValue = enabled; return; } }; return AmplitudeBrowser; }(_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.AmplitudeCore)); //# sourceMappingURL=browser-client.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/config.js" /*!*********************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/config.js ***! \*********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ BrowserConfig: () => (/* binding */ BrowserConfig), /* harmony export */ createCookieStorage: () => (/* binding */ createCookieStorage), /* harmony export */ createTransport: () => (/* binding */ createTransport), /* harmony export */ getTopLevelDomain: () => (/* binding */ getTopLevelDomain), /* harmony export */ shouldFetchRemoteConfig: () => (/* binding */ shouldFetchRemoteConfig), /* harmony export */ useBrowserConfig: () => (/* binding */ useBrowserConfig) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/config.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/logger.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/cookie-name.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/query-params.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/storage/memory.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/storage/cookie.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"); /* harmony import */ var _storage_local_storage__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./storage/local-storage */ "./node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js"); /* harmony import */ var _storage_session_storage__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./storage/session-storage */ "./node_modules/@amplitude/analytics-browser/lib/esm/storage/session-storage.js"); /* harmony import */ var _transports_xhr__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./transports/xhr */ "./node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js"); /* harmony import */ var _transports_fetch__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transports/fetch */ "./node_modules/@amplitude/analytics-browser/lib/esm/transports/fetch.js"); /* harmony import */ var _transports_send_beacon__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./transports/send-beacon */ "./node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js"); /* harmony import */ var _cookie_migration__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./cookie-migration */ "./node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js"); /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./constants */ "./node_modules/@amplitude/analytics-browser/lib/esm/constants.js"); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./version */ "./node_modules/@amplitude/analytics-browser/lib/esm/version.js"); /* harmony import */ var _attribution_helpers__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./attribution/helpers */ "./node_modules/@amplitude/analytics-browser/lib/esm/attribution/helpers.js"); // Exported for testing purposes only. Do not expose to public interface. var BrowserConfig = /** @class */ (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(BrowserConfig, _super); function BrowserConfig(apiKey, appVersion, cookieStorage, cookieOptions, defaultTracking, autocapture, deviceId, flushIntervalMillis, flushMaxRetries, flushQueueSize, identityStorage, ingestionMetadata, instanceName, lastEventId, lastEventTime, loggerProvider, logLevel, minIdLength, offline, optOut, partnerId, plan, serverUrl, serverZone, sessionId, deferredSessionId, sessionTimeout, storageProvider, trackingOptions, transport, useBatch, fetchRemoteConfig, userId, pageCounter, debugLogsEnabled, networkTrackingOptions, identify, enableDiagnostics, diagnosticsSampleRate, diagnosticsClient, remoteConfig, topLevelDomain, enableRequestBodyCompression, _enableRequestBodyCompressionExperimental, customEnrichment) { if (cookieStorage === void 0) { cookieStorage = new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_6__.MemoryStorage(); } if (cookieOptions === void 0) { cookieOptions = { domain: '', expiration: 365, sameSite: 'Lax', secure: false, upgrade: true, }; } if (flushIntervalMillis === void 0) { flushIntervalMillis = 1000; } if (flushMaxRetries === void 0) { flushMaxRetries = 5; } if (flushQueueSize === void 0) { flushQueueSize = 30; } if (identityStorage === void 0) { identityStorage = _constants__WEBPACK_IMPORTED_MODULE_15__.DEFAULT_IDENTITY_STORAGE; } if (loggerProvider === void 0) { loggerProvider = new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.Logger(); } if (logLevel === void 0) { logLevel = _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_8__.LogLevel.Warn; } if (offline === void 0) { offline = false; } if (optOut === void 0) { optOut = false; } if (serverUrl === void 0) { serverUrl = ''; } if (serverZone === void 0) { serverZone = _constants__WEBPACK_IMPORTED_MODULE_15__.DEFAULT_SERVER_ZONE; } if (sessionTimeout === void 0) { sessionTimeout = 30 * 60 * 1000; } if (storageProvider === void 0) { storageProvider = new _storage_local_storage__WEBPACK_IMPORTED_MODULE_9__.LocalStorage({ loggerProvider: loggerProvider }); } if (trackingOptions === void 0) { trackingOptions = { ipAddress: true, language: true, platform: true, }; } if (transport === void 0) { transport = 'fetch'; } if (useBatch === void 0) { useBatch = false; } if (fetchRemoteConfig === void 0) { fetchRemoteConfig = true; } if (enableDiagnostics === void 0) { enableDiagnostics = true; } if (diagnosticsSampleRate === void 0) { diagnosticsSampleRate = 0; } if (enableRequestBodyCompression === void 0) { enableRequestBodyCompression = false; } if (_enableRequestBodyCompressionExperimental === void 0) { _enableRequestBodyCompressionExperimental = false; } var _this = this; var _a; _this = _super.call(this, { apiKey: apiKey, storageProvider: storageProvider, transportProvider: createTransport(transport) }) || this; _this.apiKey = apiKey; _this.appVersion = appVersion; _this.cookieOptions = cookieOptions; _this.defaultTracking = defaultTracking; _this.autocapture = autocapture; _this.flushIntervalMillis = flushIntervalMillis; _this.flushMaxRetries = flushMaxRetries; _this.flushQueueSize = flushQueueSize; _this.identityStorage = identityStorage; _this.ingestionMetadata = ingestionMetadata; _this.instanceName = instanceName; _this.loggerProvider = loggerProvider; _this.logLevel = logLevel; _this.minIdLength = minIdLength; _this.offline = offline; _this.partnerId = partnerId; _this.plan = plan; _this.serverUrl = serverUrl; _this.serverZone = serverZone; _this.sessionTimeout = sessionTimeout; _this.storageProvider = storageProvider; _this.trackingOptions = trackingOptions; _this.transport = transport; _this.useBatch = useBatch; _this.fetchRemoteConfig = fetchRemoteConfig; _this.networkTrackingOptions = networkTrackingOptions; _this.identify = identify; _this.enableDiagnostics = enableDiagnostics; _this.diagnosticsSampleRate = diagnosticsSampleRate; _this.diagnosticsClient = diagnosticsClient; _this.remoteConfig = remoteConfig; _this.topLevelDomain = topLevelDomain; _this.enableRequestBodyCompression = enableRequestBodyCompression; _this._enableRequestBodyCompressionExperimental = _enableRequestBodyCompressionExperimental; _this.customEnrichment = customEnrichment; _this.version = _version__WEBPACK_IMPORTED_MODULE_16__.VERSION; _this._optOut = false; _this._cookieStorage = cookieStorage; _this.deviceId = deviceId; _this.lastEventId = lastEventId; _this.lastEventTime = lastEventTime; _this.optOut = optOut; _this.deferredSessionId = deferredSessionId; _this.sessionId = sessionId; _this.pageCounter = pageCounter; _this.userId = userId; _this.debugLogsEnabled = debugLogsEnabled; _this.loggerProvider.enable(debugLogsEnabled ? _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_8__.LogLevel.Debug : _this.logLevel); _this.networkTrackingOptions = networkTrackingOptions; _this.identify = identify; _this.enableDiagnostics = enableDiagnostics; _this.diagnosticsSampleRate = diagnosticsSampleRate; _this.diagnosticsClient = diagnosticsClient; // Note: The canonical logic for determining fetchRemoteConfig is in shouldFetchRemoteConfig(). // This logic is duplicated here to maintain the BrowserConfig constructor contract and ensure // the config object has the correct fetchRemoteConfig value set on its properties. // The value passed to this constructor should already be computed via shouldFetchRemoteConfig(). var _fetchRemoteConfig = (_a = remoteConfig === null || remoteConfig === void 0 ? void 0 : remoteConfig.fetchRemoteConfig) !== null && _a !== void 0 ? _a : fetchRemoteConfig; _this.remoteConfig = _this.remoteConfig || {}; _this.remoteConfig.fetchRemoteConfig = _fetchRemoteConfig; _this.fetchRemoteConfig = _fetchRemoteConfig; _this.topLevelDomain = topLevelDomain || (0,_attribution_helpers__WEBPACK_IMPORTED_MODULE_17__.getDomain)(); return _this; } Object.defineProperty(BrowserConfig.prototype, "cookieStorage", { get: function () { return this._cookieStorage; }, set: function (cookieStorage) { if (this._cookieStorage !== cookieStorage) { this._cookieStorage = cookieStorage; this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "deviceId", { get: function () { return this._deviceId; }, set: function (deviceId) { if (this._deviceId !== deviceId) { this._deviceId = deviceId; this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "userId", { get: function () { return this._userId; }, set: function (userId) { if (this._userId !== userId) { this._userId = userId; this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "sessionId", { get: function () { return this._sessionId; }, set: function (sessionId) { if (this._sessionId !== sessionId) { this._sessionId = sessionId; // Clear deferredSessionId when sessionId is set to prevent stale values // from overriding legitimate sessionIds on subsequent page loads if (sessionId !== undefined && this._deferredSessionId !== undefined) { this._deferredSessionId = undefined; } this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "deferredSessionId", { get: function () { return this._deferredSessionId; }, set: function (deferredSessionId) { if (this._deferredSessionId !== deferredSessionId && deferredSessionId !== this.sessionId) { this._deferredSessionId = deferredSessionId; this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "optOut", { get: function () { return this._optOut; }, set: function (optOut) { if (this._optOut !== optOut) { this._optOut = optOut; this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "lastEventTime", { get: function () { return this._lastEventTime; }, set: function (lastEventTime) { if (this._lastEventTime !== lastEventTime) { this._lastEventTime = lastEventTime; this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "lastEventId", { get: function () { return this._lastEventId; }, set: function (lastEventId) { if (this._lastEventId !== lastEventId) { this._lastEventId = lastEventId; this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "pageCounter", { get: function () { return this._pageCounter; }, set: function (pageCounter) { if (this._pageCounter !== pageCounter) { this._pageCounter = pageCounter; this.updateStorage(); } }, enumerable: false, configurable: true }); Object.defineProperty(BrowserConfig.prototype, "debugLogsEnabled", { set: function (debugLogsEnabled) { if (this._debugLogsEnabled !== debugLogsEnabled) { this._debugLogsEnabled = debugLogsEnabled; this.updateStorage(); } }, enumerable: false, configurable: true }); BrowserConfig.prototype.updateStorage = function () { var cache = { deviceId: this._deviceId, userId: this._userId, sessionId: this._sessionId, deferredSessionId: this._deferredSessionId, optOut: this._optOut, lastEventTime: this._lastEventTime, lastEventId: this._lastEventId, pageCounter: this._pageCounter, debugLogsEnabled: this._debugLogsEnabled, cookieDomain: undefined, }; if (this.cookieStorage instanceof _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.CookieStorage) { cache.cookieDomain = this.cookieStorage.options.domain; } void this.cookieStorage.set((0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__.getCookieName)(this.apiKey), cache); }; return BrowserConfig; }(_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.Config)); var useBrowserConfig = function (apiKey, options, amplitudeInstance, diagnosticsClient, earlyConfig) { if (options === void 0) { options = {}; } return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { var identityStorage, defaultCookieDomain, cookieOptions, cookieConfig, cookieStorage, legacyCookies, previousCookies, queryParams, ampTimestamp, isWithinTimeLimit, deviceId, lastEventId, lastEventTime, optOut, sessionId, deferredSessionId, userId, trackingOptions, pageCounter, debugLogsEnabled, browserConfig; var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_6) { switch (_6.label) { case 0: identityStorage = options.identityStorage || _constants__WEBPACK_IMPORTED_MODULE_15__.DEFAULT_IDENTITY_STORAGE; defaultCookieDomain = ''; if (!(identityStorage === _constants__WEBPACK_IMPORTED_MODULE_15__.DEFAULT_IDENTITY_STORAGE && !((_a = options.cookieOptions) === null || _a === void 0 ? void 0 : _a.domain) && ((_b = options.cookieOptions) === null || _b === void 0 ? void 0 : _b.domain) !== '')) return [3 /*break*/, 2]; return [4 /*yield*/, getTopLevelDomain(undefined, diagnosticsClient)]; case 1: defaultCookieDomain = _6.sent(); _6.label = 2; case 2: cookieOptions = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({ domain: (_d = (_c = options.cookieOptions) === null || _c === void 0 ? void 0 : _c.domain) !== null && _d !== void 0 ? _d : defaultCookieDomain, expiration: 365, sameSite: 'Lax', secure: false, upgrade: true }, options.cookieOptions); cookieConfig = { // if more than one cookie with the same key exists, // look for the cookie that has the domain attribute set to cookieOptions.domain duplicateResolverFn: function (value) { var decodedValue = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.decodeCookieValue)(value); if (!decodedValue) { return false; } var parsed = JSON.parse(decodedValue); return (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.isDomainEqual)(parsed.cookieDomain, cookieOptions.domain); }, diagnosticsClient: diagnosticsClient, }; cookieStorage = createCookieStorage(options.identityStorage, cookieOptions, cookieConfig); return [4 /*yield*/, (0,_cookie_migration__WEBPACK_IMPORTED_MODULE_14__.parseLegacyCookies)(apiKey, cookieStorage, (_f = (_e = options.cookieOptions) === null || _e === void 0 ? void 0 : _e.upgrade) !== null && _f !== void 0 ? _f : true)]; case 3: legacyCookies = _6.sent(); return [4 /*yield*/, cookieStorage.get((0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__.getCookieName)(apiKey))]; case 4: previousCookies = _6.sent(); queryParams = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__.getQueryParams)(); ampTimestamp = queryParams.ampTimestamp ? Number(queryParams.ampTimestamp) : undefined; isWithinTimeLimit = ampTimestamp ? Date.now() < ampTimestamp : true; deviceId = (_l = (_k = (_j = (_g = options.deviceId) !== null && _g !== void 0 ? _g : (isWithinTimeLimit ? (_h = queryParams.ampDeviceId) !== null && _h !== void 0 ? _h : queryParams.deviceId : undefined)) !== null && _j !== void 0 ? _j : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _k !== void 0 ? _k : legacyCookies.deviceId) !== null && _l !== void 0 ? _l : (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_5__.UUID)(); lastEventId = (_m = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventId) !== null && _m !== void 0 ? _m : legacyCookies.lastEventId; lastEventTime = (_o = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventTime) !== null && _o !== void 0 ? _o : legacyCookies.lastEventTime; optOut = (_q = (_p = options.optOut) !== null && _p !== void 0 ? _p : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.optOut) !== null && _q !== void 0 ? _q : legacyCookies.optOut; sessionId = (_r = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.sessionId) !== null && _r !== void 0 ? _r : legacyCookies.sessionId; deferredSessionId = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deferredSessionId; userId = (_t = (_s = options.userId) !== null && _s !== void 0 ? _s : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _t !== void 0 ? _t : legacyCookies.userId; amplitudeInstance.previousSessionDeviceId = (_u = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _u !== void 0 ? _u : legacyCookies.deviceId; amplitudeInstance.previousSessionUserId = (_v = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _v !== void 0 ? _v : legacyCookies.userId; trackingOptions = { ipAddress: (_x = (_w = options.trackingOptions) === null || _w === void 0 ? void 0 : _w.ipAddress) !== null && _x !== void 0 ? _x : true, language: (_z = (_y = options.trackingOptions) === null || _y === void 0 ? void 0 : _y.language) !== null && _z !== void 0 ? _z : true, platform: (_1 = (_0 = options.trackingOptions) === null || _0 === void 0 ? void 0 : _0.platform) !== null && _1 !== void 0 ? _1 : true, }; pageCounter = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.pageCounter; debugLogsEnabled = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.debugLogsEnabled; // Override default tracking options if autocapture is set if (options.autocapture !== undefined) { options.defaultTracking = options.autocapture; } browserConfig = new BrowserConfig(apiKey, options.appVersion, cookieStorage, cookieOptions, options.defaultTracking, options.autocapture, deviceId, options.flushIntervalMillis, options.flushMaxRetries, options.flushQueueSize, identityStorage, options.ingestionMetadata, options.instanceName, lastEventId, lastEventTime, // Use earlyConfig.loggerProvider to ensure consistent logger across DiagnosticsClient/RemoteConfigClient/BrowserConfig (_2 = earlyConfig === null || earlyConfig === void 0 ? void 0 : earlyConfig.loggerProvider) !== null && _2 !== void 0 ? _2 : options.loggerProvider, options.logLevel, options.minIdLength, options.offline, optOut, options.partnerId, options.plan, options.serverUrl, // Use earlyConfig.serverZone to ensure consistent serverZone (_3 = earlyConfig === null || earlyConfig === void 0 ? void 0 : earlyConfig.serverZone) !== null && _3 !== void 0 ? _3 : options.serverZone, sessionId, deferredSessionId, options.sessionTimeout, options.storageProvider, trackingOptions, options.transport, options.useBatch, options.fetchRemoteConfig, userId, pageCounter, debugLogsEnabled, options.networkTrackingOptions, options.identify, // Use earlyConfig values (already has remote config applied), otherwise fall back to options (_4 = earlyConfig === null || earlyConfig === void 0 ? void 0 : earlyConfig.enableDiagnostics) !== null && _4 !== void 0 ? _4 : options.enableDiagnostics, (_5 = earlyConfig === null || earlyConfig === void 0 ? void 0 : earlyConfig.diagnosticsSampleRate) !== null && _5 !== void 0 ? _5 : amplitudeInstance._diagnosticsSampleRate, diagnosticsClient, options.remoteConfig, defaultCookieDomain, options.enableRequestBodyCompression, amplitudeInstance._enableRequestBodyCompressionExperimentalValue, options.customEnrichment); return [4 /*yield*/, browserConfig.storageProvider.isEnabled()]; case 5: if (!(_6.sent())) { browserConfig.loggerProvider.warn("Storage provider ".concat(browserConfig.storageProvider.constructor.name, " is not enabled. Falling back to MemoryStorage.")); browserConfig.storageProvider = new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_6__.MemoryStorage(); } return [2 /*return*/, browserConfig]; } }); }); }; var createCookieStorage = function (identityStorage, cookieOptions, cookieConfig) { if (identityStorage === void 0) { identityStorage = _constants__WEBPACK_IMPORTED_MODULE_15__.DEFAULT_IDENTITY_STORAGE; } if (cookieOptions === void 0) { cookieOptions = {}; } switch (identityStorage) { case 'localStorage': return new _storage_local_storage__WEBPACK_IMPORTED_MODULE_9__.LocalStorage(); case 'sessionStorage': return new _storage_session_storage__WEBPACK_IMPORTED_MODULE_10__.SessionStorage(); case 'none': return new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_6__.MemoryStorage(); case 'cookie': default: return new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.CookieStorage((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, cookieOptions), { expirationDays: cookieOptions.expiration }), cookieConfig); } }; /** * Determines whether to fetch remote config based on options. * Extracted to allow early determination before useBrowserConfig is called. */ var shouldFetchRemoteConfig = function (options) { var _a, _b; if (options === void 0) { options = {}; } if (((_a = options.remoteConfig) === null || _a === void 0 ? void 0 : _a.fetchRemoteConfig) === true) { // set to true if remoteConfig explicitly set to true return true; } else if (((_b = options.remoteConfig) === null || _b === void 0 ? void 0 : _b.fetchRemoteConfig) === false || options.fetchRemoteConfig === false) { // set to false if either are set to false explicitly return false; } else { // default to true if both undefined return true; } }; var createTransport = function (transport) { var type = typeof transport === 'object' ? transport.type : transport; var headers = typeof transport === 'object' ? transport.headers : undefined; if (type === 'xhr') { return new _transports_xhr__WEBPACK_IMPORTED_MODULE_11__.XHRTransport(headers); } if (type === 'beacon') { // SendBeacon does not support custom headers return new _transports_send_beacon__WEBPACK_IMPORTED_MODULE_13__.SendBeaconTransport(); } // Keep a browser-local fetch transport for gzip support. // TODO: Merge back to core FetchTransport after React Native supports gzip. return new _transports_fetch__WEBPACK_IMPORTED_MODULE_12__.FetchTransport(headers); }; var getTopLevelDomain = function (url, diagnosticsClient) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { var host, parts, levels, skipLevel, i, i, domain, result, e_1; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, new _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.CookieStorage(undefined, { diagnosticsClient: diagnosticsClient }).isEnabled()]; case 1: if (!(_a.sent()) || (!url && (typeof location === 'undefined' || !location.hostname))) { return [2 /*return*/, '']; } host = url !== null && url !== void 0 ? url : location.hostname; parts = host.split('.'); // if hostname has less than 2 parts, it's not a registrable domain // and the browser won't allow setting domain-scoped cookies for it so return empty string if (parts.length === 1) { return [2 /*return*/, '']; } levels = []; skipLevel = 1; // if the hostname ends with a TLD we know is in the Public Suffix List // then the last two parts are definitely not writable as a domain if (_attribution_helpers__WEBPACK_IMPORTED_MODULE_17__.KNOWN_2LDS.find(function (tld) { return host.endsWith(".".concat(tld)); })) { skipLevel = 2; } for (i = parts.length - skipLevel - 1; i >= 0; --i) { levels.push(parts.slice(i).join('.')); } i = 0; _a.label = 2; case 2: if (!(i < levels.length)) return [3 /*break*/, 7]; domain = levels[i]; _a.label = 3; case 3: _a.trys.push([3, 5, , 6]); return [4 /*yield*/, _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_7__.CookieStorage.isDomainWritable(domain)]; case 4: result = _a.sent(); // if the transaction succeeded, the domain is valid if (result) { return [2 /*return*/, '.' + domain]; } return [3 /*break*/, 6]; case 5: e_1 = _a.sent(); /* istanbul ignore if */ if (diagnosticsClient) { diagnosticsClient.recordEvent('cookies.tld.failure', { reason: "Unexpected exception checking domain is writable: ".concat(domain), error: e_1 instanceof Error ? e_1.message : String(e_1), }); } return [3 /*break*/, 6]; case 6: i++; return [3 /*break*/, 2]; case 7: // if the transaction failed, the domain is invalid // record a diagnostic event if (diagnosticsClient) { diagnosticsClient.recordEvent('cookies.tld.failure', { reason: "Could not determine TLD for host ".concat(host), }); } // return an empty string to indicate that we couldn't determine the TLD // so fallback to host-only cookies (scoped to the current host) return [2 /*return*/, '']; } }); }); }; //# sourceMappingURL=config.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/config/joined-config.js" /*!***********************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/config/joined-config.js ***! \***********************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ translateRemoteConfigToLocal: () => (/* binding */ translateRemoteConfigToLocal), /* harmony export */ updateBrowserConfigWithRemoteConfig: () => (/* binding */ updateBrowserConfigWithRemoteConfig) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"); /** * Performs a deep transformation of a remote config object so that * it matches the expected schema of the local config. * * Specifically, it normalizes nested `enabled` flags into concise union types. * * ### Transformation Rules: * - If an object has `enabled: true`, it is replaced by the same object without the `enabled` field. * - If it has only `enabled: true`, it is replaced with `true`. * - If it has `enabled: false`, it is replaced with `false` regardless of other fields. * * ### Examples: * Input: { prop: { enabled: true, hello: 'world' }} * Output: { prop: { hello: 'world' } } * * Input: { prop: { enabled: true }} * Output: { prop: true } * * Input: { prop: { enabled: false, hello: 'world' }} * Output: { prop: false } * * Input: { prop: { hello: 'world' }} * Output: { prop: { hello: 'world' } } // No change * * @param config Remote config object to be transformed * @returns Transformed config object compatible with local schema */ function translateRemoteConfigToLocal(config) { var e_1, _a, e_2, _b, e_3, _c; var _d, _e, _f, _g, _h; // Disabling type checking rules because remote config comes from a remote source // and this function needs to handle any unexpected values /* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument */ if (typeof config !== 'object' || config === null) { return; } // translations are not applied on array properties if (Array.isArray(config)) { return; } var propertyNames = Object.keys(config); try { for (var propertyNames_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) { var propertyName = propertyNames_1_1.value; try { var value = config[propertyName]; // transform objects with { enabled } property to boolean | object if (typeof (value === null || value === void 0 ? void 0 : value.enabled) === 'boolean') { if (value.enabled) { // if enabled is true, set the value to the rest of the object // or true if the object has no other properties delete value.enabled; if (Object.keys(value).length === 0) { config[propertyName] = true; } } else { // If enabled is false, set the value to false config[propertyName] = false; } } // recursively translate properties of the value translateRemoteConfigToLocal(value); } catch (e) { // a failure here means that an accessor threw an error // so don't translate it // TODO(diagnostics): add a diagnostic event for this } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1); } finally { if (e_1) throw e_1.error; } } // translate remote responseHeaders and requestHeaders to local responseHeaders and requestHeaders try { if ((_f = (_e = (_d = config.autocapture) === null || _d === void 0 ? void 0 : _d.networkTracking) === null || _e === void 0 ? void 0 : _e.captureRules) === null || _f === void 0 ? void 0 : _f.length) { try { for (var _j = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(config.autocapture.networkTracking.captureRules), _k = _j.next(); !_k.done; _k = _j.next()) { var rule = _k.value; try { for (var _l = (e_3 = void 0, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(['responseHeaders', 'requestHeaders'])), _m = _l.next(); !_m.done; _m = _l.next()) { var header = _m.value; var _o = (_g = rule[header]) !== null && _g !== void 0 ? _g : {}, captureSafeHeaders = _o.captureSafeHeaders, allowlist = _o.allowlist; if (!captureSafeHeaders && !allowlist) { continue; } // if allowlist is not an array, remote config contract is violated, remove it if (allowlist !== undefined && !Array.isArray(allowlist)) { delete rule[header]; continue; } rule[header] = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)([], (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)((captureSafeHeaders ? _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.SAFE_HEADERS : [])), false), (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)((allowlist !== null && allowlist !== void 0 ? allowlist : [])), false); } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_m && !_m.done && (_c = _l.return)) _c.call(_l); } finally { if (e_3) throw e_3.error; } } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_k && !_k.done && (_b = _j.return)) _b.call(_j); } finally { if (e_2) throw e_2.error; } } } } catch (e) { /* istanbul ignore next */ // surprise exception, so don't translate it } // translate frustrationInteractions pluralization var frustrationInteractions = (_h = config.autocapture) === null || _h === void 0 ? void 0 : _h.frustrationInteractions; if (frustrationInteractions) { if (frustrationInteractions.rageClick) { frustrationInteractions.rageClicks = frustrationInteractions.rageClick; delete frustrationInteractions.rageClick; } if (frustrationInteractions.deadClick) { frustrationInteractions.deadClicks = frustrationInteractions.deadClick; delete frustrationInteractions.deadClick; } } } function mergeUrls(urlsExact, urlsRegex, browserConfig) { var e_4, _a; // Convert string patterns to RegExp objects, warn on invalid patterns and skip them var regexList = []; try { for (var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(urlsRegex !== null && urlsRegex !== void 0 ? urlsRegex : []), _c = _b.next(); !_c.done; _c = _b.next()) { var pattern = _c.value; try { regexList.push(new RegExp(pattern)); } catch (regexError) { browserConfig.loggerProvider.warn("Invalid regex pattern: ".concat(pattern), regexError); } } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_4) throw e_4.error; } } return urlsExact.concat(regexList); } /** * Updates the browser config in place by applying remote configuration settings. * Primarily merges autocapture settings from the remote config into the browser config. * * @param remoteConfig - The remote configuration to apply, or null if none available * @param browserConfig - The browser config object to update (modified in place) */ function updateBrowserConfigWithRemoteConfig(remoteConfig, browserConfig) { var e_5, _a; var _b, _c, _d, _e, _f; if (!remoteConfig) { return; } // translate remote config to local compatible format translateRemoteConfigToLocal(remoteConfig); try { browserConfig.loggerProvider.debug('Update browser config with remote configuration:', JSON.stringify(remoteConfig)); // type cast error will be thrown if remoteConfig is not a valid RemoteConfigBrowserSDK // and it will be caught by the try-catch block var typedRemoteConfig = remoteConfig; // merge remoteConfig.autocapture and browserConfig.autocapture // if a field is in remoteConfig.autocapture, use that value // if a field is not in remoteConfig.autocapture, use the value from browserConfig.autocapture if (typedRemoteConfig && 'autocapture' in typedRemoteConfig) { if (typeof typedRemoteConfig.autocapture === 'boolean') { browserConfig.autocapture = typedRemoteConfig.autocapture; } if (typeof typedRemoteConfig.autocapture === 'object' && typedRemoteConfig.autocapture !== null) { var transformedAutocaptureRemoteConfig = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, typedRemoteConfig.autocapture); if (browserConfig.autocapture === undefined) { browserConfig.autocapture = typedRemoteConfig.autocapture; } // Handle Element Interactions config initialization if (typeof typedRemoteConfig.autocapture.elementInteractions === 'object' && typedRemoteConfig.autocapture.elementInteractions !== null && ((_b = typedRemoteConfig.autocapture.elementInteractions.pageUrlAllowlistRegex) === null || _b === void 0 ? void 0 : _b.length)) { transformedAutocaptureRemoteConfig.elementInteractions = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, typedRemoteConfig.autocapture.elementInteractions); var transformedRcElementInteractions = transformedAutocaptureRemoteConfig.elementInteractions; // combine exact allow list and regex allow list into just 'pageUrlAllowlist' var exactAllowList = (_c = transformedRcElementInteractions.pageUrlAllowlist) !== null && _c !== void 0 ? _c : []; var urlsRegex = typedRemoteConfig.autocapture.elementInteractions.pageUrlAllowlistRegex; transformedRcElementInteractions.pageUrlAllowlist = mergeUrls(exactAllowList, urlsRegex, browserConfig); // clean up the regex allow list delete transformedRcElementInteractions.pageUrlAllowlistRegex; } // Handle Network Tracking config initialization if (typeof typedRemoteConfig.autocapture.networkTracking === 'object' && typedRemoteConfig.autocapture.networkTracking !== null && ((_d = typedRemoteConfig.autocapture.networkTracking.captureRules) === null || _d === void 0 ? void 0 : _d.length)) { transformedAutocaptureRemoteConfig.networkTracking = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, typedRemoteConfig.autocapture.networkTracking); var transformedRcNetworkTracking = transformedAutocaptureRemoteConfig.networkTracking; /* istanbul ignore next */ var captureRules = (_e = transformedRcNetworkTracking.captureRules) !== null && _e !== void 0 ? _e : []; try { for (var captureRules_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(captureRules), captureRules_1_1 = captureRules_1.next(); !captureRules_1_1.done; captureRules_1_1 = captureRules_1.next()) { var rule = captureRules_1_1.value; rule.urls = mergeUrls((_f = rule.urls) !== null && _f !== void 0 ? _f : [], rule.urlsRegex, browserConfig); delete rule.urlsRegex; } } catch (e_5_1) { e_5 = { error: e_5_1 }; } finally { try { if (captureRules_1_1 && !captureRules_1_1.done && (_a = captureRules_1.return)) _a.call(captureRules_1); } finally { if (e_5) throw e_5.error; } } } if (typeof browserConfig.autocapture === 'boolean') { browserConfig.autocapture = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({ attribution: browserConfig.autocapture, fileDownloads: browserConfig.autocapture, formInteractions: browserConfig.autocapture, pageViews: browserConfig.autocapture, sessions: browserConfig.autocapture, elementInteractions: browserConfig.autocapture, webVitals: browserConfig.autocapture, frustrationInteractions: browserConfig.autocapture }, transformedAutocaptureRemoteConfig); } if (typeof browserConfig.autocapture === 'object') { browserConfig.autocapture = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, browserConfig.autocapture), transformedAutocaptureRemoteConfig); } } // Override default tracking options if autocapture is updated by remote config browserConfig.defaultTracking = browserConfig.autocapture; } if ('customEnrichment' in typedRemoteConfig && typedRemoteConfig.customEnrichment !== null) { browserConfig.customEnrichment = typedRemoteConfig.customEnrichment; } browserConfig.loggerProvider.debug('Browser config after remote config update:', JSON.stringify(browserConfig)); } catch (e) { browserConfig.loggerProvider.error('Failed to apply remote configuration because of error: ', e); } } //# sourceMappingURL=joined-config.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/constants.js" /*!************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/constants.js ***! \************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ DEFAULT_EVENT_PREFIX: () => (/* binding */ DEFAULT_EVENT_PREFIX), /* harmony export */ DEFAULT_FILE_DOWNLOAD_EVENT: () => (/* binding */ DEFAULT_FILE_DOWNLOAD_EVENT), /* harmony export */ DEFAULT_FORM_START_EVENT: () => (/* binding */ DEFAULT_FORM_START_EVENT), /* harmony export */ DEFAULT_FORM_SUBMIT_EVENT: () => (/* binding */ DEFAULT_FORM_SUBMIT_EVENT), /* harmony export */ DEFAULT_IDENTITY_STORAGE: () => (/* binding */ DEFAULT_IDENTITY_STORAGE), /* harmony export */ DEFAULT_PAGE_VIEW_EVENT: () => (/* binding */ DEFAULT_PAGE_VIEW_EVENT), /* harmony export */ DEFAULT_SERVER_ZONE: () => (/* binding */ DEFAULT_SERVER_ZONE), /* harmony export */ DEFAULT_SESSION_END_EVENT: () => (/* binding */ DEFAULT_SESSION_END_EVENT), /* harmony export */ DEFAULT_SESSION_START_EVENT: () => (/* binding */ DEFAULT_SESSION_START_EVENT), /* harmony export */ FILE_EXTENSION: () => (/* binding */ FILE_EXTENSION), /* harmony export */ FILE_NAME: () => (/* binding */ FILE_NAME), /* harmony export */ FORM_DESTINATION: () => (/* binding */ FORM_DESTINATION), /* harmony export */ FORM_ID: () => (/* binding */ FORM_ID), /* harmony export */ FORM_NAME: () => (/* binding */ FORM_NAME), /* harmony export */ LINK_ID: () => (/* binding */ LINK_ID), /* harmony export */ LINK_TEXT: () => (/* binding */ LINK_TEXT), /* harmony export */ LINK_URL: () => (/* binding */ LINK_URL) /* harmony export */ }); var DEFAULT_EVENT_PREFIX = '[Amplitude]'; var DEFAULT_PAGE_VIEW_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Page Viewed"); var DEFAULT_FORM_START_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Started"); var DEFAULT_FORM_SUBMIT_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Submitted"); var DEFAULT_FILE_DOWNLOAD_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " File Downloaded"); var DEFAULT_SESSION_START_EVENT = 'session_start'; var DEFAULT_SESSION_END_EVENT = 'session_end'; var FILE_EXTENSION = "".concat(DEFAULT_EVENT_PREFIX, " File Extension"); var FILE_NAME = "".concat(DEFAULT_EVENT_PREFIX, " File Name"); var LINK_ID = "".concat(DEFAULT_EVENT_PREFIX, " Link ID"); var LINK_TEXT = "".concat(DEFAULT_EVENT_PREFIX, " Link Text"); var LINK_URL = "".concat(DEFAULT_EVENT_PREFIX, " Link URL"); var FORM_ID = "".concat(DEFAULT_EVENT_PREFIX, " Form ID"); var FORM_NAME = "".concat(DEFAULT_EVENT_PREFIX, " Form Name"); var FORM_DESTINATION = "".concat(DEFAULT_EVENT_PREFIX, " Form Destination"); var DEFAULT_IDENTITY_STORAGE = 'cookie'; var DEFAULT_SERVER_ZONE = 'US'; //# sourceMappingURL=constants.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js" /*!*************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js ***! \*************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ decode: () => (/* binding */ decode), /* harmony export */ parseLegacyCookies: () => (/* binding */ parseLegacyCookies), /* harmony export */ parseTime: () => (/* binding */ parseTime) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/cookie-name.js"); var parseLegacyCookies = function (apiKey, cookieStorage, deleteLegacyCookies) { if (deleteLegacyCookies === void 0) { deleteLegacyCookies = true; } return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { var cookieName, cookies, _a, deviceId, userId, optOut, sessionId, lastEventTime, lastEventId; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) { switch (_b.label) { case 0: cookieName = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.getOldCookieName)(apiKey); return [4 /*yield*/, cookieStorage.getRaw(cookieName)]; case 1: cookies = _b.sent(); if (!cookies) { return [2 /*return*/, { optOut: false, }]; } if (!deleteLegacyCookies) return [3 /*break*/, 3]; return [4 /*yield*/, cookieStorage.remove(cookieName)]; case 2: _b.sent(); _b.label = 3; case 3: _a = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(cookies.split('.'), 6), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4], lastEventId = _a[5]; return [2 /*return*/, { deviceId: deviceId, userId: decode(userId), sessionId: parseTime(sessionId), lastEventId: parseTime(lastEventId), lastEventTime: parseTime(lastEventTime), optOut: Boolean(optOut), }]; } }); }); }; var parseTime = function (num) { var integer = parseInt(num, 32); if (isNaN(integer)) { return undefined; } return integer; }; var decode = function (value) { if (!atob || !escape || !value) { return undefined; } try { return decodeURIComponent(escape(atob(value))); } catch (_a) { return undefined; } }; //# sourceMappingURL=index.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/default-tracking.js" /*!*******************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/default-tracking.js ***! \*******************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ getAttributionTrackingConfig: () => (/* binding */ getAttributionTrackingConfig), /* harmony export */ getElementInteractionsConfig: () => (/* binding */ getElementInteractionsConfig), /* harmony export */ getFormInteractionsConfig: () => (/* binding */ getFormInteractionsConfig), /* harmony export */ getFrustrationInteractionsConfig: () => (/* binding */ getFrustrationInteractionsConfig), /* harmony export */ getNetworkTrackingConfig: () => (/* binding */ getNetworkTrackingConfig), /* harmony export */ getPageViewTrackingConfig: () => (/* binding */ getPageViewTrackingConfig), /* harmony export */ isAttributionTrackingEnabled: () => (/* binding */ isAttributionTrackingEnabled), /* harmony export */ isCustomEnrichmentEnabled: () => (/* binding */ isCustomEnrichmentEnabled), /* harmony export */ isElementInteractionsEnabled: () => (/* binding */ isElementInteractionsEnabled), /* harmony export */ isFileDownloadTrackingEnabled: () => (/* binding */ isFileDownloadTrackingEnabled), /* harmony export */ isFormInteractionTrackingEnabled: () => (/* binding */ isFormInteractionTrackingEnabled), /* harmony export */ isFrustrationInteractionsEnabled: () => (/* binding */ isFrustrationInteractionsEnabled), /* harmony export */ isNetworkTrackingEnabled: () => (/* binding */ isNetworkTrackingEnabled), /* harmony export */ isPageUrlEnrichmentEnabled: () => (/* binding */ isPageUrlEnrichmentEnabled), /* harmony export */ isPageViewTrackingEnabled: () => (/* binding */ isPageViewTrackingEnabled), /* harmony export */ isSessionTrackingEnabled: () => (/* binding */ isSessionTrackingEnabled), /* harmony export */ isWebVitalsEnabled: () => (/* binding */ isWebVitalsEnabled) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /** * Returns false if autocapture === false or if autocapture[event], * otherwise returns true (even if "config.autocapture === undefined") */ var isTrackingEnabled = function (autocapture, event) { if (typeof autocapture === 'boolean') { return autocapture; } if ((autocapture === null || autocapture === void 0 ? void 0 : autocapture[event]) === false) { return false; } return true; }; var isAttributionTrackingEnabled = function (autocapture) { return isTrackingEnabled(autocapture, 'attribution'); }; var isFileDownloadTrackingEnabled = function (autocapture) { return isTrackingEnabled(autocapture, 'fileDownloads'); }; var isFormInteractionTrackingEnabled = function (autocapture) { return isTrackingEnabled(autocapture, 'formInteractions'); }; var isPageViewTrackingEnabled = function (autocapture) { return isTrackingEnabled(autocapture, 'pageViews'); }; var isSessionTrackingEnabled = function (autocapture) { return isTrackingEnabled(autocapture, 'sessions'); }; var isPageUrlEnrichmentEnabled = function (autocapture) { return isTrackingEnabled(autocapture, 'pageUrlEnrichment'); }; /** * Returns true if * 1. if autocapture.networkTracking === true * 2. if autocapture.networkTracking === object * otherwise returns false */ var isNetworkTrackingEnabled = function (autocapture) { if (typeof autocapture === 'boolean') { return autocapture; } if (typeof autocapture === 'object' && (autocapture.networkTracking === true || typeof autocapture.networkTracking === 'object')) { return true; } return false; }; /** * Returns true if * 1. autocapture === true * 2. if autocapture.elementInteractions === true * 3. if autocapture.elementInteractions === object * otherwise returns false */ var isElementInteractionsEnabled = function (autocapture) { if (typeof autocapture === 'boolean') { return autocapture; } if (typeof autocapture === 'object' && (autocapture.elementInteractions === true || typeof autocapture.elementInteractions === 'object')) { return true; } return false; }; /** * Returns true if * 1. autocapture === true * 2. if autocapture.webVitals === true * otherwise returns false */ var isWebVitalsEnabled = function (autocapture) { if (typeof autocapture === 'boolean') { return autocapture; } if (typeof autocapture === 'object' && autocapture.webVitals === true) { return true; } return false; }; var isFrustrationInteractionsEnabled = function (autocapture) { if (typeof autocapture === 'boolean') { return autocapture; } if (typeof autocapture === 'object' && (autocapture.frustrationInteractions === true || typeof autocapture.frustrationInteractions === 'object')) { return true; } return false; }; var isCustomEnrichmentEnabled = function (customEnrichment) { if (typeof customEnrichment === 'boolean') { return customEnrichment; } if (typeof customEnrichment === 'object' && customEnrichment !== null && customEnrichment.enabled !== false) { return true; } return false; }; var getElementInteractionsConfig = function (config) { if (isElementInteractionsEnabled(config.autocapture) && typeof config.autocapture === 'object' && typeof config.autocapture.elementInteractions === 'object') { return config.autocapture.elementInteractions; } return undefined; }; var getFrustrationInteractionsConfig = function (config) { if (isFrustrationInteractionsEnabled(config.autocapture) && typeof config.autocapture === 'object' && typeof config.autocapture.frustrationInteractions === 'object') { return config.autocapture.frustrationInteractions; } return undefined; }; var getNetworkTrackingConfig = function (config) { var _a; if (isNetworkTrackingEnabled(config.autocapture)) { var networkTrackingConfig = void 0; if (typeof config.autocapture === 'object' && typeof config.autocapture.networkTracking === 'object') { networkTrackingConfig = config.autocapture.networkTracking; } else if (config.networkTrackingOptions) { networkTrackingConfig = config.networkTrackingOptions; } return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, networkTrackingConfig), { captureRules: (_a = networkTrackingConfig === null || networkTrackingConfig === void 0 ? void 0 : networkTrackingConfig.captureRules) === null || _a === void 0 ? void 0 : _a.map(function (rule) { var _a, _b, _c; // if URLs and hosts are both set, URLs take precedence over hosts if (((_a = rule.urls) === null || _a === void 0 ? void 0 : _a.length) && ((_b = rule.hosts) === null || _b === void 0 ? void 0 : _b.length)) { var hostsString = JSON.stringify(rule.hosts); var urlsString = JSON.stringify(rule.urls); /* istanbul ignore next */ (_c = config.loggerProvider) === null || _c === void 0 ? void 0 : _c.warn("Found network capture rule with both urls='".concat(urlsString, "' and hosts='").concat(hostsString, "' set. ") + "Definition of urls takes precedence over hosts, so ignoring hosts."); return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, rule), { hosts: undefined }); } return rule; }) }); } return; }; var getPageViewTrackingConfig = function (config) { var trackOn = function () { return false; }; var trackHistoryChanges = undefined; var eventType; var pageCounter = config.pageCounter; var isDefaultPageViewTrackingEnabled = isPageViewTrackingEnabled(config.defaultTracking); if (isDefaultPageViewTrackingEnabled) { trackOn = undefined; eventType = undefined; if (config.defaultTracking && typeof config.defaultTracking === 'object' && config.defaultTracking.pageViews && typeof config.defaultTracking.pageViews === 'object') { if ('trackOn' in config.defaultTracking.pageViews) { trackOn = config.defaultTracking.pageViews.trackOn; } if ('trackHistoryChanges' in config.defaultTracking.pageViews) { trackHistoryChanges = config.defaultTracking.pageViews.trackHistoryChanges; } if ('eventType' in config.defaultTracking.pageViews && config.defaultTracking.pageViews.eventType) { eventType = config.defaultTracking.pageViews.eventType; } } } return { trackOn: trackOn, trackHistoryChanges: trackHistoryChanges, eventType: eventType, pageCounter: pageCounter, }; }; var getAttributionTrackingConfig = function (config) { if (isAttributionTrackingEnabled(config.defaultTracking) && config.defaultTracking && typeof config.defaultTracking === 'object' && config.defaultTracking.attribution && typeof config.defaultTracking.attribution === 'object') { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, config.defaultTracking.attribution); } return {}; }; var getFormInteractionsConfig = function (config) { if (isFormInteractionTrackingEnabled(config.defaultTracking) && config.defaultTracking && typeof config.defaultTracking === 'object' && typeof config.defaultTracking.formInteractions === 'object') { return config.defaultTracking.formInteractions; } return undefined; }; //# sourceMappingURL=default-tracking.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/det-notification.js" /*!*******************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/det-notification.js ***! \*******************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ detNotify: () => (/* binding */ detNotify), /* harmony export */ resetNotify: () => (/* binding */ resetNotify) /* harmony export */ }); var notified = false; var detNotify = function (config) { if (notified || config.defaultTracking !== undefined) { return; } var message = "`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."; config.loggerProvider.warn(message); notified = true; }; /** * @private * This function is meant for testing purposes only */ var resetNotify = function () { notified = false; }; //# sourceMappingURL=det-notification.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/index.js" /*!********************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/index.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AmplitudeBrowser: () => (/* reexport safe */ _browser_client__WEBPACK_IMPORTED_MODULE_1__.AmplitudeBrowser), /* harmony export */ Identify: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__.Identify), /* harmony export */ Revenue: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__.Revenue), /* harmony export */ Types: () => (/* reexport module object */ _types__WEBPACK_IMPORTED_MODULE_5__), /* harmony export */ _enableRequestBodyCompressionExperimental: () => (/* binding */ _enableRequestBodyCompressionExperimental), /* harmony export */ _setDiagnosticsSampleRate: () => (/* binding */ _setDiagnosticsSampleRate), /* harmony export */ add: () => (/* binding */ add), /* harmony export */ createInstance: () => (/* reexport safe */ _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__.createInstance), /* harmony export */ extendSession: () => (/* binding */ extendSession), /* harmony export */ flush: () => (/* binding */ flush), /* harmony export */ getDeviceId: () => (/* binding */ getDeviceId), /* harmony export */ getIdentity: () => (/* binding */ getIdentity), /* harmony export */ getOptOut: () => (/* binding */ getOptOut), /* harmony export */ getSessionId: () => (/* binding */ getSessionId), /* harmony export */ getUserId: () => (/* binding */ getUserId), /* harmony export */ groupIdentify: () => (/* binding */ groupIdentify), /* harmony export */ identify: () => (/* binding */ identify), /* harmony export */ init: () => (/* binding */ init), /* harmony export */ logEvent: () => (/* binding */ logEvent), /* harmony export */ remove: () => (/* binding */ remove), /* harmony export */ reset: () => (/* binding */ reset), /* harmony export */ revenue: () => (/* binding */ revenue), /* harmony export */ runQueuedFunctions: () => (/* reexport safe */ _utils_snippet_helper__WEBPACK_IMPORTED_MODULE_2__.runQueuedFunctions), /* harmony export */ setDeviceId: () => (/* binding */ setDeviceId), /* harmony export */ setGroup: () => (/* binding */ setGroup), /* harmony export */ setIdentity: () => (/* binding */ setIdentity), /* harmony export */ setOptOut: () => (/* binding */ setOptOut), /* harmony export */ setSessionId: () => (/* binding */ setSessionId), /* harmony export */ setTransport: () => (/* binding */ setTransport), /* harmony export */ setUserId: () => (/* binding */ setUserId), /* harmony export */ track: () => (/* binding */ track) /* harmony export */ }); /* harmony import */ var _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./browser-client-factory */ "./node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js"); /* harmony import */ var _browser_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./browser-client */ "./node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js"); /* harmony import */ var _utils_snippet_helper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/snippet-helper */ "./node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/identify.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/revenue.js"); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./types */ "./node_modules/@amplitude/analytics-browser/lib/esm/types.js"); /* eslint-disable @typescript-eslint/unbound-method */ var add = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].add, extendSession = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].extendSession, flush = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].flush, getDeviceId = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].getDeviceId, getIdentity = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].getIdentity, getOptOut = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].getOptOut, getSessionId = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].getSessionId, getUserId = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].getUserId, groupIdentify = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].groupIdentify, identify = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].identify, init = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].init, logEvent = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].logEvent, remove = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].remove, reset = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].reset, revenue = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].revenue, setDeviceId = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].setDeviceId, setGroup = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].setGroup, setIdentity = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].setIdentity, setOptOut = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].setOptOut, setSessionId = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].setSessionId, setTransport = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].setTransport, setUserId = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].setUserId, track = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"].track, _setDiagnosticsSampleRate = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"]._setDiagnosticsSampleRate, _enableRequestBodyCompressionExperimental = _browser_client_factory__WEBPACK_IMPORTED_MODULE_0__["default"]._enableRequestBodyCompressionExperimental; //# sourceMappingURL=index.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/lib-prefix.js" /*!*************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/lib-prefix.js ***! \*************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ LIBPREFIX: () => (/* binding */ LIBPREFIX) /* harmony export */ }); var LIBPREFIX = 'amplitude-ts'; //# sourceMappingURL=lib-prefix.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js" /*!******************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js ***! \******************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Context: () => (/* binding */ Context) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/language.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js"); /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../version */ "./node_modules/@amplitude/analytics-browser/lib/esm/version.js"); /* harmony import */ var _lib_prefix__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib-prefix */ "./node_modules/@amplitude/analytics-browser/lib/esm/lib-prefix.js"); var BROWSER_PLATFORM = 'Web'; var IP_ADDRESS = '$remote'; var Context = /** @class */ (function () { function Context() { this.name = '@amplitude/plugin-context-browser'; this.type = 'before'; this.library = "".concat(_lib_prefix__WEBPACK_IMPORTED_MODULE_4__.LIBPREFIX, "/").concat(_version__WEBPACK_IMPORTED_MODULE_3__.VERSION); /* istanbul ignore else */ if (typeof navigator !== 'undefined') { this.userAgent = navigator.userAgent; } } Context.prototype.setup = function (config) { this.config = config; return Promise.resolve(undefined); }; Context.prototype.execute = function (context) { var _a, _b; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var time, lastEventId, nextEventId, event; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_c) { time = new Date().getTime(); lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1; nextEventId = (_b = context.event_id) !== null && _b !== void 0 ? _b : lastEventId + 1; this.config.lastEventId = nextEventId; if (!context.time) { this.config.lastEventTime = time; } event = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time: time }, (this.config.appVersion && { app_version: this.config.appVersion })), (this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM })), (this.config.trackingOptions.language && { language: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.getLanguage)() })), (this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS })), { insert_id: (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.UUID)(), partner_id: this.config.partnerId, plan: this.config.plan }), (this.config.ingestionMetadata && { ingestion_metadata: { source_name: this.config.ingestionMetadata.sourceName, source_version: this.config.ingestionMetadata.sourceVersion, }, })), context), { event_id: nextEventId, library: this.library, user_agent: this.userAgent }); return [2 /*return*/, event]; }); }); }; return Context; }()); //# sourceMappingURL=context.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js" /*!*********************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js ***! \*********************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ fileDownloadTracking: () => (/* binding */ fileDownloadTracking) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants */ "./node_modules/@amplitude/analytics-browser/lib/esm/constants.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); var fileDownloadTracking = function () { var observer; var eventListeners = []; var addEventListener = function (element, type, handler) { element.addEventListener(type, handler); eventListeners.push({ element: element, type: type, handler: handler, }); }; var removeClickListeners = function () { eventListeners.forEach(function (_a) { var element = _a.element, type = _a.type, handler = _a.handler; /* istanbul ignore next */ element === null || element === void 0 ? void 0 : element.removeEventListener(type, handler); }); eventListeners = []; }; var name = '@amplitude/plugin-file-download-tracking-browser'; var type = 'enrichment'; var setup = function (config, amplitude) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { var initializeFileDownloadTracking, window_1; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { initializeFileDownloadTracking = function () { /* istanbul ignore if */ if (!amplitude) { // TODO: Add required minimum version of @amplitude/analytics-browser config.loggerProvider.warn('File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.'); return; } /* istanbul ignore if */ if (typeof document === 'undefined') { return; } var addFileDownloadListener = function (a) { var url; try { // eslint-disable-next-line no-restricted-globals url = new URL(a.href, window.location.href); } catch (_a) { /* istanbul ignore next */ return; } var result = ext.exec(url.href); var fileExtension = result === null || result === void 0 ? void 0 : result[1]; if (fileExtension) { addEventListener(a, 'click', function () { var _a; if (fileExtension) { amplitude.track(_constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_FILE_DOWNLOAD_EVENT, (_a = {}, _a[_constants__WEBPACK_IMPORTED_MODULE_1__.FILE_EXTENSION] = fileExtension, _a[_constants__WEBPACK_IMPORTED_MODULE_1__.FILE_NAME] = url.pathname, _a[_constants__WEBPACK_IMPORTED_MODULE_1__.LINK_ID] = a.id, _a[_constants__WEBPACK_IMPORTED_MODULE_1__.LINK_TEXT] = a.text, _a[_constants__WEBPACK_IMPORTED_MODULE_1__.LINK_URL] = a.href, _a)); } }); } }; var ext = /\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/; // Adds listener to existing anchor tags var links = Array.from(document.getElementsByTagName('a')); links.forEach(addFileDownloadListener); // Adds listener to anchor tags added after initial load /* istanbul ignore else */ if (typeof MutationObserver !== 'undefined') { observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { mutation.addedNodes.forEach(function (node) { if (node.nodeName === 'A') { addFileDownloadListener(node); } if ('querySelectorAll' in node && typeof node.querySelectorAll === 'function') { Array.from(node.querySelectorAll('a')).map(addFileDownloadListener); } }); }); }); observer.observe(document.body, { subtree: true, childList: true, }); } }; // If the document is already loaded, initialize immediately. /* istanbul ignore else*/ if (document.readyState === 'complete') { initializeFileDownloadTracking(); } else { window_1 = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.getGlobalScope)(); /* istanbul ignore else*/ if (window_1) { window_1.addEventListener('load', initializeFileDownloadTracking); } else { config.loggerProvider.debug('File download tracking is not installed because global is undefined.'); } } return [2 /*return*/]; }); }); }; var execute = function (event) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { return [2 /*return*/, event]; }); }); }; var teardown = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { observer === null || observer === void 0 ? void 0 : observer.disconnect(); removeClickListeners(); return [2 /*return*/]; }); }); }; return { name: name, type: type, setup: setup, execute: execute, teardown: teardown, }; }; //# sourceMappingURL=file-download-tracking.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js" /*!************************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js ***! \************************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ extractFormAction: () => (/* binding */ extractFormAction), /* harmony export */ formInteractionTracking: () => (/* binding */ formInteractionTracking), /* harmony export */ stringOrUndefined: () => (/* binding */ stringOrUndefined) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants */ "./node_modules/@amplitude/analytics-browser/lib/esm/constants.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); /* harmony import */ var _default_tracking__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../default-tracking */ "./node_modules/@amplitude/analytics-browser/lib/esm/default-tracking.js"); var formInteractionTracking = function () { var observer; var eventListeners = []; var addEventListener = function (element, type, handler) { element.addEventListener(type, handler); eventListeners.push({ element: element, type: type, handler: handler, }); }; var removeClickListeners = function () { eventListeners.forEach(function (_a) { var element = _a.element, type = _a.type, handler = _a.handler; /* istanbul ignore next */ element === null || element === void 0 ? void 0 : element.removeEventListener(type, handler); }); eventListeners = []; }; var formInteractionsConfig; var name = '@amplitude/plugin-form-interaction-tracking-browser'; var type = 'enrichment'; var setup = function (config, amplitude) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { var initializeFormTracking, window_1; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { formInteractionsConfig = (0,_default_tracking__WEBPACK_IMPORTED_MODULE_3__.getFormInteractionsConfig)(config); initializeFormTracking = function () { /* istanbul ignore if */ if (!amplitude) { // TODO: Add required minimum version of @amplitude/analytics-browser config.loggerProvider.warn('Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.'); return; } /* istanbul ignore if */ if (typeof document === 'undefined') { return; } var addedFormNodes = new WeakSet(); var addFormInteractionListener = function (form) { if (addedFormNodes.has(form)) { return; } addedFormNodes.add(form); var hasFormChanged = false; addEventListener(form, 'change', function () { var _a; var formDestination = extractFormAction(form); if (!hasFormChanged) { amplitude.track(_constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_FORM_START_EVENT, (_a = {}, _a[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_ID] = stringOrUndefined(form.id), _a[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_NAME] = stringOrUndefined(form.name), _a[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_DESTINATION] = formDestination, _a)); } hasFormChanged = true; }); addEventListener(form, 'submit', function (event) { var _a, _b; var formDestination = extractFormAction(form); if (!hasFormChanged) { amplitude.track(_constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_FORM_START_EVENT, (_a = {}, _a[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_ID] = stringOrUndefined(form.id), _a[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_NAME] = stringOrUndefined(form.name), _a[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_DESTINATION] = formDestination, _a)); } hasFormChanged = true; // Check if shouldTrackSubmit callback is provided and use it to determine whether to track form_submit if ((formInteractionsConfig === null || formInteractionsConfig === void 0 ? void 0 : formInteractionsConfig.shouldTrackSubmit) !== undefined) { if (typeof formInteractionsConfig.shouldTrackSubmit === 'function' && typeof SubmitEvent !== 'undefined' && event instanceof SubmitEvent) { try { var shouldTrack = formInteractionsConfig.shouldTrackSubmit(event); if (!shouldTrack) { return; } } catch (e) { config.loggerProvider.warn('shouldTrackSubmit callback threw an error, proceeding with tracking.'); } } else { config.loggerProvider.warn('shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.'); } } amplitude.track(_constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_FORM_SUBMIT_EVENT, (_b = {}, _b[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_ID] = stringOrUndefined(form.id), _b[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_NAME] = stringOrUndefined(form.name), _b[_constants__WEBPACK_IMPORTED_MODULE_1__.FORM_DESTINATION] = formDestination, _b)); hasFormChanged = false; }); }; // Adds listener to existing anchor tags var forms = Array.from(document.getElementsByTagName('form')); forms.forEach(addFormInteractionListener); // Adds listener to anchor tags added after initial load /* istanbul ignore else */ if (typeof MutationObserver !== 'undefined') { observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { mutation.addedNodes.forEach(function (node) { if (node.nodeName === 'FORM') { addFormInteractionListener(node); } if ('querySelectorAll' in node && typeof node.querySelectorAll === 'function') { Array.from(node.querySelectorAll('form')).map(addFormInteractionListener); } }); }); }); observer.observe(document.body, { subtree: true, childList: true, }); } }; // If the document is already loaded, initialize immediately. if (document.readyState === 'complete') { initializeFormTracking(); } else { window_1 = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.getGlobalScope)(); /* istanbul ignore else*/ if (window_1) { window_1.addEventListener('load', initializeFormTracking); } else { config.loggerProvider.debug('Form interaction tracking is not installed because global is undefined.'); } } return [2 /*return*/]; }); }); }; var execute = function (event) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { return [2 /*return*/, event]; }); }); }; var teardown = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { observer === null || observer === void 0 ? void 0 : observer.disconnect(); removeClickListeners(); return [2 /*return*/]; }); }); }; return { name: name, type: type, setup: setup, execute: execute, teardown: teardown, }; }; var stringOrUndefined = function (name) { /* istanbul ignore if */ if (typeof name !== 'string') { // We found instances where the value of `name` is an Element and not a string. // Elements may have circular references and would throw an error when passed to `JSON.stringify(...)`. // If a non-string value is seen, assume there is no value. return undefined; } return name; }; // Extracts the form action attribute, and normalizes it to a valid URL to preserve the previous behavior of accessing the action property directly. var extractFormAction = function (form) { var formDestination = form.getAttribute('action'); try { // eslint-disable-next-line no-restricted-globals formDestination = new URL(encodeURI(formDestination !== null && formDestination !== void 0 ? formDestination : ''), window.location.href).href; } catch (_a) { // } return formDestination; }; //# sourceMappingURL=form-interaction-tracking.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/plugins/network-connectivity-checker.js" /*!***************************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/plugins/network-connectivity-checker.js ***! \***************************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ networkConnectivityCheckerPlugin: () => (/* binding */ networkConnectivityCheckerPlugin) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); var networkConnectivityCheckerPlugin = function () { var name = '@amplitude/plugin-network-checker-browser'; var type = 'before'; var globalScope = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)(); var eventListeners = []; var addNetworkListener = function (type, handler) { /* istanbul ignore next */ if (globalScope === null || globalScope === void 0 ? void 0 : globalScope.addEventListener) { globalScope === null || globalScope === void 0 ? void 0 : globalScope.addEventListener(type, handler); eventListeners.push({ type: type, handler: handler, }); } }; var removeNetworkListeners = function () { eventListeners.forEach(function (_a) { var type = _a.type, handler = _a.handler; /* istanbul ignore next */ globalScope === null || globalScope === void 0 ? void 0 : globalScope.removeEventListener(type, handler); }); eventListeners = []; }; var setup = function (config, amplitude) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { if (typeof navigator === 'undefined') { config.loggerProvider.debug('Network connectivity checker plugin is disabled because navigator is not available.'); config.offline = false; return [2 /*return*/]; } config.offline = !navigator.onLine; addNetworkListener('online', function () { config.loggerProvider.debug('Network connectivity changed to online.'); config.offline = false; // Flush immediately will cause ERR_NETWORK_CHANGED setTimeout(function () { amplitude.flush(); }, config.flushIntervalMillis); }); addNetworkListener('offline', function () { config.loggerProvider.debug('Network connectivity changed to offline.'); config.offline = true; }); return [2 /*return*/]; }); }); }; var teardown = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(void 0, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { removeNetworkListeners(); return [2 /*return*/]; }); }); }; return { name: name, type: type, setup: setup, teardown: teardown, }; }; //# sourceMappingURL=network-connectivity-checker.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js" /*!************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js ***! \************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ LocalStorage: () => (/* binding */ LocalStorage) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/storage/browser-storage.js"); var MAX_ARRAY_LENGTH = 1000; var LocalStorage = /** @class */ (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(LocalStorage, _super); function LocalStorage(config) { var _this = this; var _a, _b; var localStorage; try { localStorage = (_a = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.localStorage; } catch (e) { (_b = config === null || config === void 0 ? void 0 : config.loggerProvider) === null || _b === void 0 ? void 0 : _b.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))); localStorage = undefined; } _this = _super.call(this, localStorage) || this; _this.loggerProvider = config === null || config === void 0 ? void 0 : config.loggerProvider; return _this; } LocalStorage.prototype.set = function (key, value) { var _a; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var droppedEventsCount; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) { switch (_b.label) { case 0: if (!(Array.isArray(value) && value.length > MAX_ARRAY_LENGTH)) return [3 /*break*/, 2]; droppedEventsCount = value.length - MAX_ARRAY_LENGTH; return [4 /*yield*/, _super.prototype.set.call(this, key, value.slice(0, MAX_ARRAY_LENGTH))]; case 1: _b.sent(); (_a = this.loggerProvider) === null || _a === void 0 ? void 0 : _a.error("Failed to save ".concat(droppedEventsCount, " events because the queue length exceeded ").concat(MAX_ARRAY_LENGTH, ".")); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, _super.prototype.set.call(this, key, value)]; case 3: _b.sent(); _b.label = 4; case 4: return [2 /*return*/]; } }); }); }; return LocalStorage; }(_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.BrowserStorage)); //# sourceMappingURL=local-storage.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/storage/session-storage.js" /*!**************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/storage/session-storage.js ***! \**************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ SessionStorage: () => (/* binding */ SessionStorage) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/storage/browser-storage.js"); var SessionStorage = /** @class */ (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(SessionStorage, _super); function SessionStorage() { var _a; return _super.call(this, (_a = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.sessionStorage) || this; } return SessionStorage; }(_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.BrowserStorage)); //# sourceMappingURL=session-storage.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/transports/fetch.js" /*!*******************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/transports/fetch.js ***! \*******************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ FetchTransport: () => (/* binding */ FetchTransport) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/transports/base.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/transports/gzip.js"); // Temporary browser-specific fetch transport with gzip support. // TODO: Merge this implementation back into @amplitude/analytics-core FetchTransport // once React Native SDK supports request body gzip. var FetchTransport = /** @class */ (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(FetchTransport, _super); function FetchTransport(customHeaders) { if (customHeaders === void 0) { customHeaders = {}; } var _this = _super.call(this) || this; _this.customHeaders = customHeaders; return _this; } FetchTransport.prototype.send = function (serverUrl, payload, shouldCompressUploadBody) { if (shouldCompressUploadBody === void 0) { shouldCompressUploadBody = false; } return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var bodyString, shouldCompressBody, body, headers, compressed, options, response, responseText; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: /* istanbul ignore if */ if (typeof fetch === 'undefined') { throw new Error('FetchTransport is not supported'); } bodyString = JSON.stringify(payload); shouldCompressBody = shouldCompressUploadBody && bodyString.length >= _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.MIN_GZIP_UPLOAD_BODY_SIZE_BYTES && (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.isCompressionStreamAvailable)(); body = bodyString; headers = { 'Content-Type': 'application/json', Accept: '*/*', }; if (!shouldCompressBody) return [3 /*break*/, 2]; return [4 /*yield*/, (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.compressToGzipArrayBuffer)(bodyString)]; case 1: compressed = _a.sent(); if (compressed) { headers['Content-Encoding'] = 'gzip'; body = compressed; } _a.label = 2; case 2: headers = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, this.customHeaders), headers); options = { headers: headers, body: body, method: 'POST', }; return [4 /*yield*/, fetch(serverUrl, options)]; case 3: response = _a.sent(); return [4 /*yield*/, response.text()]; case 4: responseText = _a.sent(); try { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument return [2 /*return*/, this.buildResponse(JSON.parse(responseText))]; } catch (_b) { return [2 /*return*/, this.buildResponse({ code: response.status })]; } // removed by dead control flow } }); }); }; return FetchTransport; }(_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.BaseTransport)); //# sourceMappingURL=fetch.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js" /*!*************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js ***! \*************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ SendBeaconTransport: () => (/* binding */ SendBeaconTransport) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/transports/base.js"); /** * SendBeacon does not support custom headers (e.g. Content-Encoding: gzip), * so request body compression is not applied even when enableRequestBodyCompression is true. */ var SendBeaconTransport = /** @class */ (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(SendBeaconTransport, _super); function SendBeaconTransport() { return _super.call(this) || this; } SendBeaconTransport.prototype.send = function (serverUrl, payload, _enableRequestBodyCompression) { if (_enableRequestBodyCompression === void 0) { _enableRequestBodyCompression = false; } return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { return [2 /*return*/, new Promise(function (resolve, reject) { var globalScope = (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)(); /* istanbul ignore if */ if (!(globalScope === null || globalScope === void 0 ? void 0 : globalScope.navigator.sendBeacon)) { throw new Error('SendBeaconTransport is not supported'); } try { var data = JSON.stringify(payload); // SendBeacon cannot set Content-Encoding, so we always send uncompressed var success = globalScope.navigator.sendBeacon(serverUrl, data); if (success) { return resolve(_this.buildResponse({ code: 200, events_ingested: payload.events.length, payload_size_bytes: data.length, server_upload_time: Date.now(), })); } return resolve(_this.buildResponse({ code: 500 })); } catch (e) { reject(e); } })]; }); }); }; return SendBeaconTransport; }(_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.BaseTransport)); //# sourceMappingURL=send-beacon.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js" /*!*****************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js ***! \*****************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ XHRTransport: () => (/* binding */ XHRTransport) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/transports/base.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/transports/gzip.js"); var XHRTransport = /** @class */ (function (_super) { (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(XHRTransport, _super); function XHRTransport(customHeaders) { if (customHeaders === void 0) { customHeaders = {}; } var _this = _super.call(this) || this; _this.state = { done: 4, }; _this.customHeaders = customHeaders; return _this; } XHRTransport.prototype.send = function (serverUrl, payload, shouldCompressUploadBody) { if (shouldCompressUploadBody === void 0) { shouldCompressUploadBody = false; } return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { return [2 /*return*/, new Promise(function (resolve, reject) { /* istanbul ignore if */ if (typeof XMLHttpRequest === 'undefined') { reject(new Error('XHRTransport is not supported.')); } var xhr = new XMLHttpRequest(); xhr.open('POST', serverUrl, true); xhr.onreadystatechange = function () { if (xhr.readyState === _this.state.done) { var responseText = xhr.responseText; try { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument resolve(_this.buildResponse(JSON.parse(responseText))); } catch (_a) { resolve(_this.buildResponse({ code: xhr.status })); } } }; var headers = { 'Content-Type': 'application/json', Accept: '*/*', }; var bodyString = JSON.stringify(payload); var shouldCompressBody = shouldCompressUploadBody && bodyString.length >= _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.MIN_GZIP_UPLOAD_BODY_SIZE_BYTES && (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.isCompressionStreamAvailable)(); var sendBody = function (body) { var e_1, _a; headers = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, _this.customHeaders), headers); try { for (var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(Object.entries(headers)), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(_c.value, 2), key = _d[0], value = _d[1]; xhr.setRequestHeader(key, value); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } xhr.send(body); }; var doSend = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(_this, void 0, void 0, function () { var compressed; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: if (!shouldCompressBody) return [3 /*break*/, 2]; return [4 /*yield*/, (0,_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.compressToGzipArrayBuffer)(bodyString)]; case 1: compressed = _a.sent(); if (compressed) { headers['Content-Encoding'] = 'gzip'; sendBody(compressed); } else { sendBody(bodyString); } return [3 /*break*/, 3]; case 2: sendBody(bodyString); _a.label = 3; case 3: return [2 /*return*/]; } }); }); }; doSend().catch(reject); })]; }); }); }; return XHRTransport; }(_amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.BaseTransport)); //# sourceMappingURL=xhr.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/types.js" /*!********************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/types.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ DEFAULT_ACTION_CLICK_ALLOWLIST: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_ACTION_CLICK_ALLOWLIST), /* harmony export */ DEFAULT_CSS_SELECTOR_ALLOWLIST: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_CSS_SELECTOR_ALLOWLIST), /* harmony export */ DEFAULT_DATA_ATTRIBUTE_PREFIX: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_5__.DEFAULT_DATA_ATTRIBUTE_PREFIX), /* harmony export */ EXCLUDE_INTERNAL_REFERRERS_CONDITIONS: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_6__.EXCLUDE_INTERNAL_REFERRERS_CONDITIONS), /* harmony export */ IdentifyOperation: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.IdentifyOperation), /* harmony export */ LogLevel: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__.LogLevel), /* harmony export */ OfflineDisabled: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__.OfflineDisabled), /* harmony export */ RevenueProperty: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__.RevenueProperty), /* harmony export */ ServerZone: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__.ServerZone), /* harmony export */ SpecialEventType: () => (/* reexport safe */ _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__.SpecialEventType) /* harmony export */ }); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/revenue.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/offline.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/element-interactions.js"); /* harmony import */ var _amplitude_analytics_core__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @amplitude/analytics-core */ "./node_modules/@amplitude/analytics-core/lib/esm/types/config/browser-config.js"); /* eslint-disable @typescript-eslint/unbound-method */ //# sourceMappingURL=types.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js" /*!***********************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js ***! \***********************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ convertProxyObjectToRealObject: () => (/* binding */ convertProxyObjectToRealObject), /* harmony export */ isInstanceProxy: () => (/* binding */ isInstanceProxy), /* harmony export */ runQueuedFunctions: () => (/* binding */ runQueuedFunctions) /* harmony export */ }); /** * Applies the proxied functions on the proxied amplitude snippet to an instance of the real object. * @ignore */ var runQueuedFunctions = function (instance, queue) { convertProxyObjectToRealObject(instance, queue); }; /** * Applies the proxied functions on the proxied object to an instance of the real object. * Used to convert proxied Identify and Revenue objects. */ var convertProxyObjectToRealObject = function (instance, queue) { for (var i = 0; i < queue.length; i++) { var _a = queue[i], name_1 = _a.name, args = _a.args, resolve = _a.resolve; var fn = instance && instance[name_1]; if (typeof fn === 'function') { var result = fn.apply(instance, args); if (typeof resolve === 'function') { resolve(result === null || result === void 0 ? void 0 : result.promise); } } } return instance; }; /** * Check if the param is snippet proxy */ var isInstanceProxy = function (instance) { var instanceProxy = instance; return instanceProxy && instanceProxy._q !== undefined; }; //# sourceMappingURL=snippet-helper.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-browser/lib/esm/version.js" /*!**********************************************************************!*\ !*** ./node_modules/@amplitude/analytics-browser/lib/esm/version.js ***! \**********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ VERSION: () => (/* binding */ VERSION) /* harmony export */ }); var VERSION = '2.37.0'; //# sourceMappingURL=version.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js" /*!*************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js ***! \*************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AnalyticsConnector: () => (/* binding */ AnalyticsConnector) /* harmony export */ }); var ApplicationContextProviderImpl = /** @class */ (function () { function ApplicationContextProviderImpl() { } ApplicationContextProviderImpl.prototype.getApplicationContext = function () { return { versionName: this.versionName, language: getLanguage(), platform: 'Web', os: undefined, deviceModel: undefined, }; }; return ApplicationContextProviderImpl; }()); var getLanguage = function () { return ((typeof navigator !== 'undefined' && ((navigator.languages && navigator.languages[0]) || navigator.language)) || ''); }; var EventBridgeImpl = /** @class */ (function () { function EventBridgeImpl() { this.queue = []; } EventBridgeImpl.prototype.logEvent = function (event) { if (!this.receiver) { if (this.queue.length < 512) { this.queue.push(event); } } else { this.receiver(event); } }; EventBridgeImpl.prototype.setEventReceiver = function (receiver) { this.receiver = receiver; if (this.queue.length > 0) { this.queue.forEach(function (event) { receiver(event); }); this.queue = []; } }; return EventBridgeImpl; }()); /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; // eslint-disable-next-line @typescript-eslint/no-explicit-any var isEqual = function (obj1, obj2) { var e_1, _a; var primitive = ['string', 'number', 'boolean', 'undefined']; var typeA = typeof obj1; var typeB = typeof obj2; if (typeA !== typeB) { return false; } try { for (var primitive_1 = __values(primitive), primitive_1_1 = primitive_1.next(); !primitive_1_1.done; primitive_1_1 = primitive_1.next()) { var p = primitive_1_1.value; if (p === typeA) { return obj1 === obj2; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (primitive_1_1 && !primitive_1_1.done && (_a = primitive_1.return)) _a.call(primitive_1); } finally { if (e_1) throw e_1.error; } } // check null if (obj1 == null && obj2 == null) { return true; } else if (obj1 == null || obj2 == null) { return false; } // if got here - objects if (obj1.length !== obj2.length) { return false; } //check if arrays var isArrayA = Array.isArray(obj1); var isArrayB = Array.isArray(obj2); if (isArrayA !== isArrayB) { return false; } if (isArrayA && isArrayB) { //arrays for (var i = 0; i < obj1.length; i++) { if (!isEqual(obj1[i], obj2[i])) { return false; } } } else { //objects var sorted1 = Object.keys(obj1).sort(); var sorted2 = Object.keys(obj2).sort(); if (!isEqual(sorted1, sorted2)) { return false; } //compare object values var result_1 = true; Object.keys(obj1).forEach(function (key) { if (!isEqual(obj1[key], obj2[key])) { result_1 = false; } }); return result_1; } return true; }; var ID_OP_SET = '$set'; var ID_OP_UNSET = '$unset'; var ID_OP_CLEAR_ALL = '$clearAll'; // Polyfill for Object.entries if (!Object.entries) { Object.entries = function (obj) { var ownProps = Object.keys(obj); var i = ownProps.length; var resArray = new Array(i); while (i--) { resArray[i] = [ownProps[i], obj[ownProps[i]]]; } return resArray; }; } var IdentityStoreImpl = /** @class */ (function () { function IdentityStoreImpl() { this.identity = { userProperties: {} }; this.listeners = new Set(); } IdentityStoreImpl.prototype.editIdentity = function () { // eslint-disable-next-line @typescript-eslint/no-this-alias var self = this; var actingUserProperties = __assign({}, this.identity.userProperties); var actingIdentity = __assign(__assign({}, this.identity), { userProperties: actingUserProperties }); return { setUserId: function (userId) { actingIdentity.userId = userId; return this; }, setDeviceId: function (deviceId) { actingIdentity.deviceId = deviceId; return this; }, setUserProperties: function (userProperties) { actingIdentity.userProperties = userProperties; return this; }, setOptOut: function (optOut) { actingIdentity.optOut = optOut; return this; }, updateUserProperties: function (actions) { var e_1, _a, e_2, _b, e_3, _c; var actingProperties = actingIdentity.userProperties || {}; try { for (var _d = __values(Object.entries(actions)), _e = _d.next(); !_e.done; _e = _d.next()) { var _f = __read(_e.value, 2), action = _f[0], properties = _f[1]; switch (action) { case ID_OP_SET: try { for (var _g = (e_2 = void 0, __values(Object.entries(properties))), _h = _g.next(); !_h.done; _h = _g.next()) { var _j = __read(_h.value, 2), key = _j[0], value = _j[1]; actingProperties[key] = value; } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_h && !_h.done && (_b = _g.return)) _b.call(_g); } finally { if (e_2) throw e_2.error; } } break; case ID_OP_UNSET: try { for (var _k = (e_3 = void 0, __values(Object.keys(properties))), _l = _k.next(); !_l.done; _l = _k.next()) { var key = _l.value; delete actingProperties[key]; } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_l && !_l.done && (_c = _k.return)) _c.call(_k); } finally { if (e_3) throw e_3.error; } } break; case ID_OP_CLEAR_ALL: actingProperties = {}; break; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_e && !_e.done && (_a = _d.return)) _a.call(_d); } finally { if (e_1) throw e_1.error; } } actingIdentity.userProperties = actingProperties; return this; }, commit: function () { self.setIdentity(actingIdentity); return this; }, }; }; IdentityStoreImpl.prototype.getIdentity = function () { return __assign({}, this.identity); }; IdentityStoreImpl.prototype.setIdentity = function (identity) { var originalIdentity = __assign({}, this.identity); this.identity = __assign({}, identity); if (!isEqual(originalIdentity, this.identity)) { this.listeners.forEach(function (listener) { listener(identity); }); } }; IdentityStoreImpl.prototype.addIdentityListener = function (listener) { this.listeners.add(listener); }; IdentityStoreImpl.prototype.removeIdentityListener = function (listener) { this.listeners.delete(listener); }; return IdentityStoreImpl; }()); var safeGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : self; var AnalyticsConnector = /** @class */ (function () { function AnalyticsConnector() { this.identityStore = new IdentityStoreImpl(); this.eventBridge = new EventBridgeImpl(); this.applicationContextProvider = new ApplicationContextProviderImpl(); } AnalyticsConnector.getInstance = function (instanceName) { if (!safeGlobal['analyticsConnectorInstances']) { safeGlobal['analyticsConnectorInstances'] = {}; } if (!safeGlobal['analyticsConnectorInstances'][instanceName]) { safeGlobal['analyticsConnectorInstances'][instanceName] = new AnalyticsConnector(); } return safeGlobal['analyticsConnectorInstances'][instanceName]; }; return AnalyticsConnector; }()); /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/analytics-connector.js" /*!*******************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/analytics-connector.js ***! \*******************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ getAnalyticsConnector: () => (/* binding */ getAnalyticsConnector), /* harmony export */ setConnectorDeviceId: () => (/* binding */ setConnectorDeviceId), /* harmony export */ setConnectorUserId: () => (/* binding */ setConnectorUserId) /* harmony export */ }); /* harmony import */ var _amplitude_analytics_connector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @amplitude/analytics-connector */ "./node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js"); /* harmony import */ var _types_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types/constants */ "./node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"); var getAnalyticsConnector = function (instanceName) { if (instanceName === void 0) { instanceName = _types_constants__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_INSTANCE_NAME; } return _amplitude_analytics_connector__WEBPACK_IMPORTED_MODULE_0__.AnalyticsConnector.getInstance(instanceName); }; var setConnectorUserId = function (userId, instanceName) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore getAnalyticsConnector(instanceName).identityStore.editIdentity().setUserId(userId).commit(); }; var setConnectorDeviceId = function (deviceId, instanceName) { getAnalyticsConnector(instanceName).identityStore.editIdentity().setDeviceId(deviceId).commit(); }; //# sourceMappingURL=analytics-connector.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/campaign/campaign-parser.js" /*!************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/campaign/campaign-parser.js ***! \************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ CampaignParser: () => (/* binding */ CampaignParser) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _query_params__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../query-params */ "./node_modules/@amplitude/analytics-core/lib/esm/query-params.js"); /* harmony import */ var _types_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../types/constants */ "./node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"); var CampaignParser = /** @class */ (function () { function CampaignParser() { } CampaignParser.prototype.parse = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { return [2 /*return*/, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)((0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, _types_constants__WEBPACK_IMPORTED_MODULE_2__.BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())]; }); }); }; CampaignParser.prototype.getUtmParam = function () { var params = (0,_query_params__WEBPACK_IMPORTED_MODULE_1__.getQueryParams)(); var utmCampaign = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.UTM_CAMPAIGN]; var utmContent = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.UTM_CONTENT]; var utmId = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.UTM_ID]; var utmMedium = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.UTM_MEDIUM]; var utmSource = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.UTM_SOURCE]; var utmTerm = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.UTM_TERM]; return { utm_campaign: utmCampaign, utm_content: utmContent, utm_id: utmId, utm_medium: utmMedium, utm_source: utmSource, utm_term: utmTerm, }; }; CampaignParser.prototype.getReferrer = function () { var _a, _b; var data = { referrer: undefined, referring_domain: undefined, }; try { data.referrer = document.referrer || undefined; data.referring_domain = (_b = (_a = data.referrer) === null || _a === void 0 ? void 0 : _a.split('/')[2]) !== null && _b !== void 0 ? _b : undefined; } catch (_c) { // nothing to track } return data; }; CampaignParser.prototype.getClickIds = function () { var _a; var params = (0,_query_params__WEBPACK_IMPORTED_MODULE_1__.getQueryParams)(); return _a = {}, _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.DCLID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.DCLID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.FBCLID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.FBCLID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.GBRAID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.GBRAID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.GCLID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.GCLID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.KO_CLICK_ID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.KO_CLICK_ID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.LI_FAT_ID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.LI_FAT_ID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.MSCLKID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.MSCLKID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.RDT_CID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.RDT_CID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.TTCLID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.TTCLID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.TWCLID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.TWCLID], _a[_types_constants__WEBPACK_IMPORTED_MODULE_2__.WBRAID] = params[_types_constants__WEBPACK_IMPORTED_MODULE_2__.WBRAID], _a; }; return CampaignParser; }()); //# sourceMappingURL=campaign-parser.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/config.js" /*!******************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/config.js ***! \******************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Config: () => (/* binding */ Config), /* harmony export */ RequestMetadata: () => (/* binding */ RequestMetadata), /* harmony export */ createServerConfig: () => (/* binding */ createServerConfig), /* harmony export */ getDefaultConfig: () => (/* binding */ getDefaultConfig), /* harmony export */ getServerUrl: () => (/* binding */ getServerUrl) /* harmony export */ }); /* harmony import */ var _types_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types/constants */ "./node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./node_modules/@amplitude/analytics-core/lib/esm/logger.js"); /* harmony import */ var _types_loglevel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types/loglevel */ "./node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"); var getDefaultConfig = function () { return ({ flushMaxRetries: 12, flushQueueSize: 200, flushIntervalMillis: 10000, instanceName: _types_constants__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_INSTANCE_NAME, logLevel: _types_loglevel__WEBPACK_IMPORTED_MODULE_2__.LogLevel.Warn, loggerProvider: new _logger__WEBPACK_IMPORTED_MODULE_1__.Logger(), offline: false, optOut: false, serverUrl: _types_constants__WEBPACK_IMPORTED_MODULE_0__.AMPLITUDE_SERVER_URL, serverZone: 'US', useBatch: false, }); }; var Config = /** @class */ (function () { function Config(options) { var _a, _b, _c, _d; this._optOut = false; var defaultConfig = getDefaultConfig(); this.apiKey = options.apiKey; this.flushIntervalMillis = (_a = options.flushIntervalMillis) !== null && _a !== void 0 ? _a : defaultConfig.flushIntervalMillis; this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries; this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize; this.instanceName = options.instanceName || defaultConfig.instanceName; this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider; this.logLevel = (_b = options.logLevel) !== null && _b !== void 0 ? _b : defaultConfig.logLevel; this.minIdLength = options.minIdLength; this.plan = options.plan; this.ingestionMetadata = options.ingestionMetadata; this.offline = options.offline !== undefined ? options.offline : defaultConfig.offline; this.optOut = (_c = options.optOut) !== null && _c !== void 0 ? _c : defaultConfig.optOut; this.serverUrl = options.serverUrl; this.serverZone = options.serverZone || defaultConfig.serverZone; this.storageProvider = options.storageProvider; this.transportProvider = options.transportProvider; this.useBatch = (_d = options.useBatch) !== null && _d !== void 0 ? _d : defaultConfig.useBatch; this.loggerProvider.enable(this.logLevel); var serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch); this.serverZone = serverConfig.serverZone; this.serverUrl = serverConfig.serverUrl; } Object.defineProperty(Config.prototype, "optOut", { get: function () { return this._optOut; }, set: function (optOut) { this._optOut = optOut; }, enumerable: false, configurable: true }); return Config; }()); var getServerUrl = function (serverZone, useBatch) { if (serverZone === 'EU') { return useBatch ? _types_constants__WEBPACK_IMPORTED_MODULE_0__.EU_AMPLITUDE_BATCH_SERVER_URL : _types_constants__WEBPACK_IMPORTED_MODULE_0__.EU_AMPLITUDE_SERVER_URL; } return useBatch ? _types_constants__WEBPACK_IMPORTED_MODULE_0__.AMPLITUDE_BATCH_SERVER_URL : _types_constants__WEBPACK_IMPORTED_MODULE_0__.AMPLITUDE_SERVER_URL; }; var createServerConfig = function (serverUrl, serverZone, useBatch) { if (serverUrl === void 0) { serverUrl = ''; } if (serverZone === void 0) { serverZone = getDefaultConfig().serverZone; } if (useBatch === void 0) { useBatch = getDefaultConfig().useBatch; } if (serverUrl) { return { serverUrl: serverUrl, serverZone: undefined }; } var _serverZone = ['US', 'EU'].includes(serverZone) ? serverZone : getDefaultConfig().serverZone; return { serverZone: _serverZone, serverUrl: getServerUrl(_serverZone, useBatch), }; }; var RequestMetadata = /** @class */ (function () { function RequestMetadata() { this.sdk = { metrics: { histogram: {}, }, }; } RequestMetadata.prototype.recordHistogram = function (key, value) { this.sdk.metrics.histogram[key] = value; }; return RequestMetadata; }()); var HistogramOptions = /** @class */ (function () { function HistogramOptions() { } return HistogramOptions; }()); //# sourceMappingURL=config.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/cookie-name.js" /*!***********************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/cookie-name.js ***! \***********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ getCookieName: () => (/* binding */ getCookieName), /* harmony export */ getOldCookieName: () => (/* binding */ getOldCookieName) /* harmony export */ }); /* harmony import */ var _types_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types/constants */ "./node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"); var getCookieName = function (apiKey, postKey, limit) { if (postKey === void 0) { postKey = ''; } if (limit === void 0) { limit = 10; } return [_types_constants__WEBPACK_IMPORTED_MODULE_0__.AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join('_'); }; var getOldCookieName = function (apiKey) { return "".concat(_types_constants__WEBPACK_IMPORTED_MODULE_0__.AMPLITUDE_PREFIX.toLowerCase(), "_").concat(apiKey.substring(0, 6)); }; //# sourceMappingURL=cookie-name.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/core-client.js" /*!***********************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/core-client.js ***! \***********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AmplitudeCore: () => (/* binding */ AmplitudeCore) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _types_event_event__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types/event/event */ "./node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js"); /* harmony import */ var _identify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./identify */ "./node_modules/@amplitude/analytics-core/lib/esm/identify.js"); /* harmony import */ var _types_messages__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types/messages */ "./node_modules/@amplitude/analytics-core/lib/esm/types/messages.js"); /* harmony import */ var _timeline__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./timeline */ "./node_modules/@amplitude/analytics-core/lib/esm/timeline.js"); /* harmony import */ var _utils_event_builder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/event-builder */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js"); /* harmony import */ var _utils_result_builder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/result-builder */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js"); /* harmony import */ var _utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/return-wrapper */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js"); var AmplitudeCore = /** @class */ (function () { function AmplitudeCore(name) { if (name === void 0) { name = '$default'; } this.initializing = false; this.isReady = false; this.q = []; this.dispatchQ = []; this.logEvent = this.track.bind(this); this.timeline = new _timeline__WEBPACK_IMPORTED_MODULE_4__.Timeline(this); this.name = name; } AmplitudeCore.prototype._init = function (config) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: this.config = config; this.timeline.reset(this); this.timeline.loggerProvider = this.config.loggerProvider; return [4 /*yield*/, this.runQueuedFunctions('q')]; case 1: _a.sent(); this.isReady = true; return [2 /*return*/]; } }); }); }; AmplitudeCore.prototype.runQueuedFunctions = function (queueName) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, val, e_1_1; var e_1, _a; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) { switch (_b.label) { case 0: queuedFunctions = this[queueName]; this[queueName] = []; _b.label = 1; case 1: _b.trys.push([1, 8, 9, 10]); queuedFunctions_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(queuedFunctions), queuedFunctions_1_1 = queuedFunctions_1.next(); _b.label = 2; case 2: if (!!queuedFunctions_1_1.done) return [3 /*break*/, 7]; queuedFunction = queuedFunctions_1_1.value; val = queuedFunction(); if (!(val && 'promise' in val)) return [3 /*break*/, 4]; return [4 /*yield*/, val.promise]; case 3: _b.sent(); return [3 /*break*/, 6]; case 4: return [4 /*yield*/, val]; case 5: _b.sent(); _b.label = 6; case 6: queuedFunctions_1_1 = queuedFunctions_1.next(); return [3 /*break*/, 2]; case 7: return [3 /*break*/, 10]; case 8: e_1_1 = _b.sent(); e_1 = { error: e_1_1 }; return [3 /*break*/, 10]; case 9: try { if (queuedFunctions_1_1 && !queuedFunctions_1_1.done && (_a = queuedFunctions_1.return)) _a.call(queuedFunctions_1); } finally { if (e_1) throw e_1.error; } return [7 /*endfinally*/]; case 10: if (!this[queueName].length) return [3 /*break*/, 12]; return [4 /*yield*/, this.runQueuedFunctions(queueName)]; case 11: _b.sent(); _b.label = 12; case 12: return [2 /*return*/]; } }); }); }; AmplitudeCore.prototype.track = function (eventInput, eventProperties, eventOptions) { var event = (0,_utils_event_builder__WEBPACK_IMPORTED_MODULE_5__.createTrackEvent)(eventInput, eventProperties, eventOptions); // Update client user properties immediately and synchronously this.userProperties = this.getOperationAppliedUserProperties(event.user_properties); return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(this.dispatch(event)); }; AmplitudeCore.prototype.identify = function (identify, eventOptions) { var event = (0,_utils_event_builder__WEBPACK_IMPORTED_MODULE_5__.createIdentifyEvent)(identify, eventOptions); // Update client user properties immediately and synchronously this.userProperties = this.getOperationAppliedUserProperties(event.user_properties); return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(this.dispatch(event)); }; AmplitudeCore.prototype.groupIdentify = function (groupType, groupName, identify, eventOptions) { var event = (0,_utils_event_builder__WEBPACK_IMPORTED_MODULE_5__.createGroupIdentifyEvent)(groupType, groupName, identify, eventOptions); return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(this.dispatch(event)); }; AmplitudeCore.prototype.setGroup = function (groupType, groupName, eventOptions) { var event = (0,_utils_event_builder__WEBPACK_IMPORTED_MODULE_5__.createGroupEvent)(groupType, groupName, eventOptions); // Update client user properties immediately and synchronously this.userProperties = this.getOperationAppliedUserProperties(event.user_properties); return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(this.dispatch(event)); }; AmplitudeCore.prototype.revenue = function (revenue, eventOptions) { var event = (0,_utils_event_builder__WEBPACK_IMPORTED_MODULE_5__.createRevenueEvent)(revenue, eventOptions); return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(this.dispatch(event)); }; AmplitudeCore.prototype.add = function (plugin) { if (!this.isReady) { this.q.push(this._addPlugin.bind(this, plugin)); return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(); } return this._addPlugin(plugin); }; AmplitudeCore.prototype._addPlugin = function (plugin) { return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(this.timeline.register(plugin, this.config)); }; AmplitudeCore.prototype.remove = function (pluginName) { if (!this.isReady) { this.q.push(this._removePlugin.bind(this, pluginName)); return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(); } return this._removePlugin(pluginName); }; AmplitudeCore.prototype._removePlugin = function (pluginName) { return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(this.timeline.deregister(pluginName, this.config)); }; AmplitudeCore.prototype.dispatchWithCallback = function (event, callback) { if (!this.isReady) { return callback((0,_utils_result_builder__WEBPACK_IMPORTED_MODULE_6__.buildResult)(event, 0, _types_messages__WEBPACK_IMPORTED_MODULE_3__.CLIENT_NOT_INITIALIZED)); } void this.process(event).then(callback); }; AmplitudeCore.prototype.dispatch = function (event) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { if (!this.isReady) { return [2 /*return*/, new Promise(function (resolve) { _this.dispatchQ.push(_this.dispatchWithCallback.bind(_this, event, resolve)); })]; } return [2 /*return*/, this.process(event)]; }); }); }; /** * * This method applies identify operations to user properties and * returns a single object representing the final user property state. * * This is a best-effort api that only supports $set, $clearAll, and $unset. * Other operations are not supported and are ignored. * * Operations are applied on top of current client state (this.userProperties). * * @param userProperties The new user properties object from identify() or setIdentity(). * @returns A key-value object user properties without operations. * * @example * Input: * { * $set: { plan: 'premium' }, * custom_flag: true * } * * Output: * { * plan: 'premium', * custom_flag: true * } */ AmplitudeCore.prototype.getOperationAppliedUserProperties = function (userProperties) { var _a; var base = (_a = this.userProperties) !== null && _a !== void 0 ? _a : {}; var updatedProperties = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, base); if (userProperties === undefined) { return updatedProperties; } // Keep non-operation keys for later merge var nonOpProperties = {}; Object.keys(userProperties).forEach(function (key) { if (!Object.values(_types_event_event__WEBPACK_IMPORTED_MODULE_1__.IdentifyOperation).includes(key)) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment nonOpProperties[key] = userProperties[key]; } }); _identify__WEBPACK_IMPORTED_MODULE_2__.OrderedIdentifyOperations.forEach(function (operation) { // Skip when key is an operation. if (!Object.keys(userProperties).includes(operation)) return; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment var opProperties = userProperties[operation]; switch (operation) { case _types_event_event__WEBPACK_IMPORTED_MODULE_1__.IdentifyOperation.CLEAR_ALL: // Due to operation order, the following line will never execute. /* istanbul ignore next */ Object.keys(updatedProperties).forEach(function (prop) { delete updatedProperties[prop]; }); break; case _types_event_event__WEBPACK_IMPORTED_MODULE_1__.IdentifyOperation.UNSET: Object.keys(opProperties).forEach(function (prop) { delete updatedProperties[prop]; }); break; case _types_event_event__WEBPACK_IMPORTED_MODULE_1__.IdentifyOperation.SET: Object.assign(updatedProperties, opProperties); break; } }); // Merge non-operation properties. // Custom properties should not be affected by operations. // https://github.com/amplitude/nova/blob/343f678ded83c032e83b189796b3c2be161b48f5/src/main/java/com/amplitude/userproperty/model/ModifyUserPropertiesIdent.java#L79-L83 Object.assign(updatedProperties, nonOpProperties); return updatedProperties; }; AmplitudeCore.prototype.process = function (event) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var result, e_2, message, result; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); // skip event processing if opt out if (this.config.optOut) { return [2 /*return*/, (0,_utils_result_builder__WEBPACK_IMPORTED_MODULE_6__.buildResult)(event, 0, _types_messages__WEBPACK_IMPORTED_MODULE_3__.OPT_OUT_MESSAGE)]; } if (event.event_type === _types_event_event__WEBPACK_IMPORTED_MODULE_1__.SpecialEventType.IDENTIFY) { // Do not update this.userProperties here. // It is only set synchronously in identify() or setIdentity() this.timeline.onIdentityChanged({ userProperties: this.userProperties }); } return [4 /*yield*/, this.timeline.push(event)]; case 1: result = _a.sent(); result.code === 200 ? this.config.loggerProvider.log(result.message) : result.code === 100 ? this.config.loggerProvider.warn(result.message) : this.config.loggerProvider.error(result.message); return [2 /*return*/, result]; case 2: e_2 = _a.sent(); message = String(e_2); this.config.loggerProvider.error(message); result = (0,_utils_result_builder__WEBPACK_IMPORTED_MODULE_6__.buildResult)(event, 0, message); return [2 /*return*/, result]; case 3: return [2 /*return*/]; } }); }); }; AmplitudeCore.prototype.setOptOut = function (optOut) { if (!this.isReady) { this.q.push(this._setOptOut.bind(this, Boolean(optOut))); return; } this._setOptOut(optOut); }; AmplitudeCore.prototype._setOptOut = function (optOut) { if (this.config.optOut !== optOut) { this.config.optOut = Boolean(optOut); this.timeline.onOptOutChanged(optOut); } }; AmplitudeCore.prototype.flush = function () { return (0,_utils_return_wrapper__WEBPACK_IMPORTED_MODULE_7__.returnWrapper)(this.timeline.flush()); }; AmplitudeCore.prototype.plugin = function (name) { var plugin = this.timeline.plugins.find(function (plugin) { return plugin.name === name; }); if (plugin === undefined) { this.config.loggerProvider.debug("Cannot find plugin with name ".concat(name)); return undefined; } return plugin; }; AmplitudeCore.prototype.plugins = function (pluginClass) { return this.timeline.plugins.filter(function (plugin) { return plugin instanceof pluginClass; }); }; return AmplitudeCore; }()); //# sourceMappingURL=core-client.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/diagnostics-client.js" /*!******************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/diagnostics-client.js ***! \******************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ DIAGNOSTICS_EU_SERVER_URL: () => (/* binding */ DIAGNOSTICS_EU_SERVER_URL), /* harmony export */ DIAGNOSTICS_US_SERVER_URL: () => (/* binding */ DIAGNOSTICS_US_SERVER_URL), /* harmony export */ DiagnosticsClient: () => (/* binding */ DiagnosticsClient), /* harmony export */ FLUSH_INTERVAL_MS: () => (/* binding */ FLUSH_INTERVAL_MS), /* harmony export */ MAX_MEMORY_STORAGE_COUNT: () => (/* binding */ MAX_MEMORY_STORAGE_COUNT), /* harmony export */ MAX_MEMORY_STORAGE_EVENTS_COUNT: () => (/* binding */ MAX_MEMORY_STORAGE_EVENTS_COUNT), /* harmony export */ SAVE_INTERVAL_MS: () => (/* binding */ SAVE_INTERVAL_MS) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _diagnostics_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./diagnostics-storage */ "./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/diagnostics-storage.js"); /* harmony import */ var _global_scope__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../global-scope */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); /* harmony import */ var _utils_sampling__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/sampling */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/sampling.js"); /* harmony import */ var _uncaught_sdk_errors__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./uncaught-sdk-errors */ "./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/uncaught-sdk-errors.js"); var SAVE_INTERVAL_MS = 1000; // 1 second var FLUSH_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes var DIAGNOSTICS_US_SERVER_URL = 'https://diagnostics.prod.us-west-2.amplitude.com/v1/capture'; var DIAGNOSTICS_EU_SERVER_URL = 'https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture'; // In-memory storage limits var MAX_MEMORY_STORAGE_COUNT = 10000; // for tags, counters, histograms separately var MAX_MEMORY_STORAGE_EVENTS_COUNT = 10; var DiagnosticsClient = /** @class */ (function () { function DiagnosticsClient(apiKey, logger, serverZone, options) { if (serverZone === void 0) { serverZone = 'US'; } // In-memory storages this.inMemoryTags = {}; this.inMemoryCounters = {}; this.inMemoryHistograms = {}; this.inMemoryEvents = []; // Timer for 1-second persistence this.saveTimer = null; // Timer for flush interval this.flushTimer = null; this.apiKey = apiKey; this.logger = logger; this.serverUrl = serverZone === 'US' ? DIAGNOSTICS_US_SERVER_URL : DIAGNOSTICS_EU_SERVER_URL; this.logger.debug('DiagnosticsClient: Initializing with options', JSON.stringify(options, null, 2)); // Diagnostics is enabled by default with sample rate of 0 (no sampling) this.config = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({ enabled: true, sampleRate: 0 }, options); this.startTimestamp = Date.now(); this.shouldTrack = (0,_utils_sampling__WEBPACK_IMPORTED_MODULE_3__.isTimestampInSampleTemp)(this.startTimestamp, this.config.sampleRate) && this.config.enabled; if (_diagnostics_storage__WEBPACK_IMPORTED_MODULE_1__.DiagnosticsStorage.isSupported()) { this.storage = new _diagnostics_storage__WEBPACK_IMPORTED_MODULE_1__.DiagnosticsStorage(apiKey, logger); } else { this.logger.debug('DiagnosticsClient: IndexedDB is not supported'); } void this.initializeFlushInterval(); // Track internal diagnostics metrics for sampling if (this.shouldTrack) { this.increment('sdk.diagnostics.sampled.in.and.enabled'); (0,_uncaught_sdk_errors__WEBPACK_IMPORTED_MODULE_4__.enableSdkErrorListeners)(this); } } /** * Check if storage is available and tracking is enabled */ DiagnosticsClient.prototype.isStorageAndTrackEnabled = function () { return Boolean(this.storage) && Boolean(this.shouldTrack); }; DiagnosticsClient.prototype.setTag = function (name, value) { if (!this.isStorageAndTrackEnabled()) { return; } if (Object.keys(this.inMemoryTags).length >= MAX_MEMORY_STORAGE_COUNT) { this.logger.debug('DiagnosticsClient: Early return setTags as reaching memory limit'); return; } this.inMemoryTags[name] = value; this.startTimersIfNeeded(); }; DiagnosticsClient.prototype.increment = function (name, size) { if (size === void 0) { size = 1; } if (!this.isStorageAndTrackEnabled()) { return; } if (Object.keys(this.inMemoryCounters).length >= MAX_MEMORY_STORAGE_COUNT) { this.logger.debug('DiagnosticsClient: Early return increment as reaching memory limit'); return; } this.inMemoryCounters[name] = (this.inMemoryCounters[name] || 0) + size; this.startTimersIfNeeded(); }; DiagnosticsClient.prototype.recordHistogram = function (name, value) { if (!this.isStorageAndTrackEnabled()) { return; } if (Object.keys(this.inMemoryHistograms).length >= MAX_MEMORY_STORAGE_COUNT) { this.logger.debug('DiagnosticsClient: Early return recordHistogram as reaching memory limit'); return; } var existing = this.inMemoryHistograms[name]; if (existing) { // Update existing stats incrementally existing.count += 1; existing.min = Math.min(existing.min, value); existing.max = Math.max(existing.max, value); existing.sum += value; } else { // Create new stats this.inMemoryHistograms[name] = { count: 1, min: value, max: value, sum: value, }; } this.startTimersIfNeeded(); }; DiagnosticsClient.prototype.recordEvent = function (name, properties) { if (!this.isStorageAndTrackEnabled()) { return; } if (this.inMemoryEvents.length >= MAX_MEMORY_STORAGE_EVENTS_COUNT) { this.logger.debug('DiagnosticsClient: Early return recordEvent as reaching memory limit'); return; } this.inMemoryEvents.push({ event_name: name, time: Date.now(), event_properties: properties, }); this.startTimersIfNeeded(); }; DiagnosticsClient.prototype.startTimersIfNeeded = function () { var _this = this; if (!this.saveTimer) { this.saveTimer = setTimeout(function () { _this.saveAllDataToStorage() .catch(function (error) { _this.logger.debug('DiagnosticsClient: Failed to save all data to storage', error); }) .finally(function () { _this.saveTimer = null; }); }, SAVE_INTERVAL_MS); } if (!this.flushTimer) { this.flushTimer = setTimeout(function () { _this._flush() .catch(function (error) { _this.logger.debug('DiagnosticsClient: Failed to flush', error); }) .finally(function () { _this.flushTimer = null; }); }, FLUSH_INTERVAL_MS); } }; DiagnosticsClient.prototype.saveAllDataToStorage = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var tagsToSave, countersToSave, histogramsToSave, eventsToSave; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: if (!this.storage) { return [2 /*return*/]; } tagsToSave = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, this.inMemoryTags); countersToSave = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, this.inMemoryCounters); histogramsToSave = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, this.inMemoryHistograms); eventsToSave = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spreadArray)([], (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(this.inMemoryEvents), false); this.inMemoryEvents = []; this.inMemoryTags = {}; this.inMemoryCounters = {}; this.inMemoryHistograms = {}; return [4 /*yield*/, Promise.all([ this.storage.setTags(tagsToSave), this.storage.incrementCounters(countersToSave), this.storage.setHistogramStats(histogramsToSave), this.storage.addEventRecords(eventsToSave), ])]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; DiagnosticsClient.prototype._flush = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var _a, tagRecords, counterRecords, histogramStatsRecords, eventRecords, tags, counters, histogram, events, payload; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) { switch (_b.label) { case 0: if (!this.storage) { return [2 /*return*/]; } return [4 /*yield*/, this.saveAllDataToStorage()]; case 1: _b.sent(); this.saveTimer = null; this.flushTimer = null; return [4 /*yield*/, this.storage.getAllAndClear()]; case 2: _a = _b.sent(), tagRecords = _a.tags, counterRecords = _a.counters, histogramStatsRecords = _a.histogramStats, eventRecords = _a.events; // Update the last flush timestamp void this.storage.setLastFlushTimestamp(Date.now()); tags = {}; tagRecords.forEach(function (record) { tags[record.key] = record.value; }); counters = {}; counterRecords.forEach(function (record) { counters[record.key] = record.value; }); histogram = {}; histogramStatsRecords.forEach(function (stats) { histogram[stats.key] = { count: stats.count, min: stats.min, max: stats.max, avg: Math.round((stats.sum / stats.count) * 100) / 100, // round the average to 2 decimal places. }; }); events = eventRecords.map(function (record) { return ({ event_name: record.event_name, time: record.time, event_properties: record.event_properties, }); }); // Early return if all data collections are empty if (Object.keys(counters).length === 0 && Object.keys(histogram).length === 0 && events.length === 0) { return [2 /*return*/]; } payload = { tags: tags, histogram: histogram, counters: counters, events: events, }; // Send payload to diagnostics server void this.fetch(payload); return [2 /*return*/]; } }); }); }; /** * Send diagnostics data to the server */ DiagnosticsClient.prototype.fetch = function (payload) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var response, error_1; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); if (!(0,_global_scope__WEBPACK_IMPORTED_MODULE_2__.getGlobalScope)()) { throw new Error('DiagnosticsClient: Fetch is not supported'); } return [4 /*yield*/, fetch(this.serverUrl, { method: 'POST', headers: { 'X-ApiKey': this.apiKey, 'Content-Type': 'application/json', }, body: JSON.stringify(payload), })]; case 1: response = _a.sent(); if (!response.ok) { this.logger.debug('DiagnosticsClient: Failed to send diagnostics data.'); return [2 /*return*/]; } this.logger.debug('DiagnosticsClient: Successfully sent diagnostics data'); return [3 /*break*/, 3]; case 2: error_1 = _a.sent(); this.logger.debug('DiagnosticsClient: Failed to send diagnostics data. ', error_1); return [3 /*break*/, 3]; case 3: return [2 /*return*/]; } }); }); }; /** * Initialize flush interval logic. * Check if 5 minutes has passed since last flush, if so flush immediately. * Otherwise set a timer to flush when the interval is reached. */ DiagnosticsClient.prototype.initializeFlushInterval = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var now, lastFlushTimestamp, timeSinceLastFlush; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: if (!this.storage) { return [2 /*return*/]; } now = Date.now(); return [4 /*yield*/, this.storage.getLastFlushTimestamp()]; case 1: lastFlushTimestamp = (_a.sent()) || -1; // If last flush timestamp is -1, it means this is a new client // Save current timestamp as the initial "last flush timestamp" // and schedule the flush timer if (lastFlushTimestamp === -1) { void this.storage.setLastFlushTimestamp(now); this._setFlushTimer(FLUSH_INTERVAL_MS); return [2 /*return*/]; } timeSinceLastFlush = now - lastFlushTimestamp; if (timeSinceLastFlush >= FLUSH_INTERVAL_MS) { // More than 5 minutes has passed, flush immediately void this._flush(); return [2 /*return*/]; } else { // Set timer for remaining time this._setFlushTimer(FLUSH_INTERVAL_MS - timeSinceLastFlush); } return [2 /*return*/]; } }); }); }; /** * Helper method to set flush timer with consistent error handling */ DiagnosticsClient.prototype._setFlushTimer = function (delay) { var _this = this; this.flushTimer = setTimeout(function () { _this._flush() .catch(function (error) { _this.logger.debug('DiagnosticsClient: Failed to flush', error); }) .finally(function () { _this.flushTimer = null; }); }, delay); }; DiagnosticsClient.prototype._setSampleRate = function (sampleRate) { this.logger.debug('DiagnosticsClient: Setting sample rate to', sampleRate); this.config.sampleRate = sampleRate; this.shouldTrack = (0,_utils_sampling__WEBPACK_IMPORTED_MODULE_3__.isTimestampInSampleTemp)(this.startTimestamp, this.config.sampleRate) && this.config.enabled; this.logger.debug('DiagnosticsClient: Should track is', this.shouldTrack); }; return DiagnosticsClient; }()); //# sourceMappingURL=diagnostics-client.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/diagnostics-storage.js" /*!*******************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/diagnostics-storage.js ***! \*******************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ DiagnosticsStorage: () => (/* binding */ DiagnosticsStorage), /* harmony export */ INTERNAL_KEYS: () => (/* binding */ INTERNAL_KEYS), /* harmony export */ TABLE_NAMES: () => (/* binding */ TABLE_NAMES) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _global_scope__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../global-scope */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); var MAX_PERSISTENT_STORAGE_EVENTS_COUNT = 10; // Database configuration var DB_VERSION = 1; // Table names for different diagnostics types var TABLE_NAMES = { TAGS: 'tags', COUNTERS: 'counters', HISTOGRAMS: 'histograms', EVENTS: 'events', INTERNAL: 'internal', // New table for internal storage like flush timestamps }; // Keys for internal storage table var INTERNAL_KEYS = { LAST_FLUSH_TIMESTAMP: 'last_flush_timestamp', }; /** * Purpose-specific IndexedDB storage for diagnostics data * Provides optimized methods for each type of diagnostics data */ var DiagnosticsStorage = /** @class */ (function () { function DiagnosticsStorage(apiKey, logger) { this.dbPromise = null; this.logger = logger; this.dbName = "AMP_diagnostics_".concat(apiKey.substring(0, 10)); } /** * Check if IndexedDB is supported in the current environment * @returns true if IndexedDB is available, false otherwise */ DiagnosticsStorage.isSupported = function () { var _a; return ((_a = (0,_global_scope__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.indexedDB) !== undefined; }; DiagnosticsStorage.prototype.getDB = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { if (!this.dbPromise) { this.dbPromise = this.openDB(); } return [2 /*return*/, this.dbPromise]; }); }); }; DiagnosticsStorage.prototype.openDB = function () { var _this = this; return new Promise(function (resolve, reject) { var request = indexedDB.open(_this.dbName, DB_VERSION); request.onerror = function () { // Clear dbPromise when it rejects for the first time _this.dbPromise = null; reject(new Error('Failed to open IndexedDB')); }; request.onsuccess = function () { var db = request.result; // Clear dbPromise when connection was on but went off later db.onclose = function () { _this.dbPromise = null; _this.logger.debug('DiagnosticsStorage: DB connection closed.'); }; db.onerror = function (event) { _this.logger.debug('DiagnosticsStorage: A global database error occurred.', event); db.close(); }; resolve(db); }; request.onupgradeneeded = function (event) { var db = event.target.result; _this.createTables(db); }; }); }; DiagnosticsStorage.prototype.createTables = function (db) { // Create tags table if (!db.objectStoreNames.contains(TABLE_NAMES.TAGS)) { db.createObjectStore(TABLE_NAMES.TAGS, { keyPath: 'key' }); } // Create counters table if (!db.objectStoreNames.contains(TABLE_NAMES.COUNTERS)) { db.createObjectStore(TABLE_NAMES.COUNTERS, { keyPath: 'key' }); } // Create histograms table for storing histogram stats (count, min, max, sum) if (!db.objectStoreNames.contains(TABLE_NAMES.HISTOGRAMS)) { db.createObjectStore(TABLE_NAMES.HISTOGRAMS, { keyPath: 'key', }); } // Create events table if (!db.objectStoreNames.contains(TABLE_NAMES.EVENTS)) { var eventsStore = db.createObjectStore(TABLE_NAMES.EVENTS, { keyPath: 'id', autoIncrement: true, }); // Create index on time for chronological queries eventsStore.createIndex('time_idx', 'time', { unique: false }); } // Create internal table for storing internal data like flush timestamps if (!db.objectStoreNames.contains(TABLE_NAMES.INTERNAL)) { db.createObjectStore(TABLE_NAMES.INTERNAL, { keyPath: 'key' }); } }; DiagnosticsStorage.prototype.setTags = function (tags) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var db, transaction_1, store_1, error_1; var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); if (Object.entries(tags).length === 0) { return [2 /*return*/]; } return [4 /*yield*/, this.getDB()]; case 1: db = _a.sent(); transaction_1 = db.transaction([TABLE_NAMES.TAGS], 'readwrite'); store_1 = transaction_1.objectStore(TABLE_NAMES.TAGS); return [2 /*return*/, new Promise(function (resolve) { var entries = Object.entries(tags); transaction_1.oncomplete = function () { resolve(); }; transaction_1.onabort = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to set tags', event); resolve(); }; entries.forEach(function (_a) { var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(_a, 2), key = _b[0], value = _b[1]; var putRequest = store_1.put({ key: key, value: value }); putRequest.onerror = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to set tag', key, value, event); }; }); })]; case 2: error_1 = _a.sent(); this.logger.debug('DiagnosticsStorage: Failed to set tags', error_1); return [3 /*break*/, 3]; case 3: return [2 /*return*/]; } }); }); }; DiagnosticsStorage.prototype.incrementCounters = function (counters) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var db, transaction_2, store_2, error_2; var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); if (Object.entries(counters).length === 0) { return [2 /*return*/]; } return [4 /*yield*/, this.getDB()]; case 1: db = _a.sent(); transaction_2 = db.transaction([TABLE_NAMES.COUNTERS], 'readwrite'); store_2 = transaction_2.objectStore(TABLE_NAMES.COUNTERS); return [2 /*return*/, new Promise(function (resolve) { var entries = Object.entries(counters); transaction_2.oncomplete = function () { resolve(); }; transaction_2.onabort = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to increment counters', event); resolve(); }; // Read existing values and update them entries.forEach(function (_a) { var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(_a, 2), key = _b[0], incrementValue = _b[1]; var getRequest = store_2.get(key); getRequest.onsuccess = function () { var existingRecord = getRequest.result; /* istanbul ignore next */ var existingValue = existingRecord ? existingRecord.value : 0; var putRequest = store_2.put({ key: key, value: existingValue + incrementValue }); putRequest.onerror = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to update counter', key, event); }; }; getRequest.onerror = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to read existing counter', key, event); }; }); })]; case 2: error_2 = _a.sent(); this.logger.debug('DiagnosticsStorage: Failed to increment counters', error_2); return [3 /*break*/, 3]; case 3: return [2 /*return*/]; } }); }); }; DiagnosticsStorage.prototype.setHistogramStats = function (histogramStats) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var db, transaction_3, store_3, error_3; var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); if (Object.entries(histogramStats).length === 0) { return [2 /*return*/]; } return [4 /*yield*/, this.getDB()]; case 1: db = _a.sent(); transaction_3 = db.transaction([TABLE_NAMES.HISTOGRAMS], 'readwrite'); store_3 = transaction_3.objectStore(TABLE_NAMES.HISTOGRAMS); return [2 /*return*/, new Promise(function (resolve) { var entries = Object.entries(histogramStats); transaction_3.oncomplete = function () { resolve(); }; transaction_3.onabort = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to set histogram stats', event); resolve(); }; // Read existing values and update them entries.forEach(function (_a) { var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(_a, 2), key = _b[0], newStats = _b[1]; var getRequest = store_3.get(key); getRequest.onsuccess = function () { var existingRecord = getRequest.result; var updatedStats; /* istanbul ignore next */ if (existingRecord) { // Accumulate with existing stats updatedStats = { key: key, count: existingRecord.count + newStats.count, min: Math.min(existingRecord.min, newStats.min), max: Math.max(existingRecord.max, newStats.max), sum: existingRecord.sum + newStats.sum, }; } else { // Create new stats updatedStats = { key: key, count: newStats.count, min: newStats.min, max: newStats.max, sum: newStats.sum, }; } var putRequest = store_3.put(updatedStats); putRequest.onerror = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to set histogram stats', key, event); }; }; getRequest.onerror = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to read existing histogram stats', key, event); }; }); })]; case 2: error_3 = _a.sent(); this.logger.debug('DiagnosticsStorage: Failed to set histogram stats', error_3); return [3 /*break*/, 3]; case 3: return [2 /*return*/]; } }); }); }; DiagnosticsStorage.prototype.addEventRecords = function (events) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var db, transaction_4, store_4, error_4; var _this = this; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); if (events.length === 0) { return [2 /*return*/]; } return [4 /*yield*/, this.getDB()]; case 1: db = _a.sent(); transaction_4 = db.transaction([TABLE_NAMES.EVENTS], 'readwrite'); store_4 = transaction_4.objectStore(TABLE_NAMES.EVENTS); return [2 /*return*/, new Promise(function (resolve) { transaction_4.oncomplete = function () { resolve(); }; /* istanbul ignore next */ transaction_4.onabort = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to add event records', event); resolve(); }; // First, check how many events are currently stored var countRequest = store_4.count(); countRequest.onsuccess = function () { var currentCount = countRequest.result; // Calculate how many events we can add var availableSlots = Math.max(0, MAX_PERSISTENT_STORAGE_EVENTS_COUNT - currentCount); if (availableSlots < events.length) { _this.logger.debug("DiagnosticsStorage: Only added ".concat(availableSlots, " of ").concat(events.length, " events due to storage limit")); } // Only add events up to the available slots (take the least recent ones) events.slice(0, availableSlots).forEach(function (event) { var request = store_4.add(event); request.onerror = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to add event record', event); }; }); }; countRequest.onerror = function (event) { _this.logger.debug('DiagnosticsStorage: Failed to count existing events', event); }; })]; case 2: error_4 = _a.sent(); this.logger.debug('DiagnosticsStorage: Failed to add event records', error_4); return [3 /*break*/, 3]; case 3: return [2 /*return*/]; } }); }); }; DiagnosticsStorage.prototype.setInternal = function (key, value) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var db, transaction_5, store_5, error_5; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.getDB()]; case 1: db = _a.sent(); transaction_5 = db.transaction([TABLE_NAMES.INTERNAL], 'readwrite'); store_5 = transaction_5.objectStore(TABLE_NAMES.INTERNAL); return [2 /*return*/, new Promise(function (resolve, reject) { /* istanbul ignore next */ transaction_5.onabort = function () { return reject(new Error('Failed to set internal value')); }; var request = store_5.put({ key: key, value: value }); request.onsuccess = function () { return resolve(); }; /* istanbul ignore next */ request.onerror = function () { return reject(new Error('Failed to set internal value')); }; })]; case 2: error_5 = _a.sent(); /* istanbul ignore next */ this.logger.debug('DiagnosticsStorage: Failed to set internal value', error_5); return [3 /*break*/, 3]; case 3: return [2 /*return*/]; } }); }); }; DiagnosticsStorage.prototype.getInternal = function (key) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var db, transaction_6, store_6, error_6; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.getDB()]; case 1: db = _a.sent(); transaction_6 = db.transaction([TABLE_NAMES.INTERNAL], 'readonly'); store_6 = transaction_6.objectStore(TABLE_NAMES.INTERNAL); return [2 /*return*/, new Promise(function (resolve, reject) { /* istanbul ignore next */ transaction_6.onabort = function () { return reject(new Error('Failed to get internal value')); }; var request = store_6.get(key); request.onsuccess = function () { return resolve(request.result); }; /* istanbul ignore next */ request.onerror = function () { return reject(new Error('Failed to get internal value')); }; })]; case 2: error_6 = _a.sent(); this.logger.debug('DiagnosticsStorage: Failed to get internal value', error_6); return [2 /*return*/, undefined]; case 3: return [2 /*return*/]; } }); }); }; DiagnosticsStorage.prototype.getLastFlushTimestamp = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var record, error_7; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.getInternal(INTERNAL_KEYS.LAST_FLUSH_TIMESTAMP)]; case 1: record = _a.sent(); return [2 /*return*/, record ? parseInt(record.value, 10) : undefined]; case 2: error_7 = _a.sent(); /* istanbul ignore next */ this.logger.debug('DiagnosticsStorage: Failed to get last flush timestamp', error_7); /* istanbul ignore next */ return [2 /*return*/, undefined]; case 3: return [2 /*return*/]; } }); }); }; DiagnosticsStorage.prototype.setLastFlushTimestamp = function (timestamp) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var error_8; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.setInternal(INTERNAL_KEYS.LAST_FLUSH_TIMESTAMP, timestamp.toString())]; case 1: _a.sent(); return [3 /*break*/, 3]; case 2: error_8 = _a.sent(); /* istanbul ignore next */ this.logger.debug('DiagnosticsStorage: Failed to set last flush timestamp', error_8); return [3 /*break*/, 3]; case 3: return [2 /*return*/]; } }); }); }; /* istanbul ignore next */ DiagnosticsStorage.prototype.clearTable = function (transaction, tableName) { return new Promise(function (resolve, reject) { var store = transaction.objectStore(tableName); var request = store.clear(); request.onsuccess = function () { return resolve(); }; request.onerror = function () { return reject(new Error("Failed to clear table ".concat(tableName))); }; }); }; /* istanbul ignore next */ DiagnosticsStorage.prototype.getAllAndClear = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var db, transaction, _a, tags, counters, histogramStats, events, error_9; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) { switch (_b.label) { case 0: _b.trys.push([0, 4, , 5]); return [4 /*yield*/, this.getDB()]; case 1: db = _b.sent(); transaction = db.transaction([TABLE_NAMES.TAGS, TABLE_NAMES.COUNTERS, TABLE_NAMES.HISTOGRAMS, TABLE_NAMES.EVENTS], 'readwrite'); return [4 /*yield*/, Promise.all([ this.getAllFromStore(transaction, TABLE_NAMES.TAGS), this.getAllFromStore(transaction, TABLE_NAMES.COUNTERS), this.getAllFromStore(transaction, TABLE_NAMES.HISTOGRAMS), this.getAllFromStore(transaction, TABLE_NAMES.EVENTS), ])]; case 2: _a = tslib__WEBPACK_IMPORTED_MODULE_0__.__read.apply(void 0, [_b.sent(), 4]), tags = _a[0], counters = _a[1], histogramStats = _a[2], events = _a[3]; // Clear all data in the same transaction return [4 /*yield*/, Promise.all([ this.clearTable(transaction, TABLE_NAMES.COUNTERS), this.clearTable(transaction, TABLE_NAMES.HISTOGRAMS), this.clearTable(transaction, TABLE_NAMES.EVENTS), ])]; case 3: // Clear all data in the same transaction _b.sent(); return [2 /*return*/, { tags: tags, counters: counters, histogramStats: histogramStats, events: events }]; case 4: error_9 = _b.sent(); this.logger.debug('DiagnosticsStorage: Failed to get all and clear data', error_9); return [2 /*return*/, { tags: [], counters: [], histogramStats: [], events: [] }]; case 5: return [2 /*return*/]; } }); }); }; /** * Helper method to get all records from a store within a transaction */ /* istanbul ignore next */ DiagnosticsStorage.prototype.getAllFromStore = function (transaction, tableName) { return new Promise(function (resolve, reject) { var store = transaction.objectStore(tableName); var request = store.getAll(); request.onsuccess = function () { return resolve(request.result); }; request.onerror = function () { return reject(new Error("Failed to get all from ".concat(tableName))); }; }); }; return DiagnosticsStorage; }()); //# sourceMappingURL=diagnostics-storage.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/uncaught-sdk-errors.js" /*!*******************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/diagnostics/uncaught-sdk-errors.js ***! \*******************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ EVENT_NAME_ERROR_UNCAUGHT: () => (/* binding */ EVENT_NAME_ERROR_UNCAUGHT), /* harmony export */ GLOBAL_KEY: () => (/* binding */ GLOBAL_KEY), /* harmony export */ enableSdkErrorListeners: () => (/* binding */ enableSdkErrorListeners), /* harmony export */ registerSdkLoaderMetadata: () => (/* binding */ registerSdkLoaderMetadata) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _global_scope__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../global-scope */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); var GLOBAL_KEY = '__AMPLITUDE_SCRIPT_URL__'; var EVENT_NAME_ERROR_UNCAUGHT = 'sdk.error.uncaught'; var getNormalizedScriptUrls = function () { var scope = (0,_global_scope__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)(); /* istanbul ignore next */ if (!scope) { return []; } var value = scope[GLOBAL_KEY]; if (Array.isArray(value)) { return value; } /* istanbul ignore next - legacy single URL stored as string */ if (typeof value === 'string') { return [value]; } return []; }; var addNormalizedScriptUrl = function (url) { var scope = (0,_global_scope__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)(); /* istanbul ignore next */ if (!scope) { return; } var urls = getNormalizedScriptUrls(); if (!urls.includes(url)) { urls.push(url); scope[GLOBAL_KEY] = urls; } }; var registerSdkLoaderMetadata = function (metadata) { if (metadata.scriptUrl) { var normalized = normalizeUrl(metadata.scriptUrl); if (normalized) { addNormalizedScriptUrl(normalized); } } }; var enableSdkErrorListeners = function (client) { var scope = (0,_global_scope__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)(); if (!scope || typeof scope.addEventListener !== 'function') { return; } var handleError = function (event) { var error = event.error instanceof Error ? event.error : undefined; var stack = error === null || error === void 0 ? void 0 : error.stack; var match = detectSdkOrigin({ filename: event.filename, stack: stack }); if (!match) { return; } capture({ type: 'error', message: event.message, stack: stack, filename: event.filename, errorName: error === null || error === void 0 ? void 0 : error.name, metadata: { colno: event.colno, lineno: event.lineno, isTrusted: event.isTrusted, matchReason: match, }, }); }; var handleRejection = function (event) { var _a; var error = event.reason instanceof Error ? event.reason : undefined; var stack = error === null || error === void 0 ? void 0 : error.stack; var filename = extractFilenameFromStack(stack); var match = detectSdkOrigin({ filename: filename, stack: stack }); if (!match) { return; } /* istanbul ignore next */ capture({ type: 'unhandledrejection', message: (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : stringifyReason(event.reason), stack: stack, filename: filename, errorName: error === null || error === void 0 ? void 0 : error.name, metadata: { isTrusted: event.isTrusted, matchReason: match, }, }); }; var capture = function (context) { client.recordEvent(EVENT_NAME_ERROR_UNCAUGHT, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({ type: context.type, message: context.message, filename: context.filename, error_name: context.errorName, stack: context.stack }, context.metadata)); }; scope.addEventListener('error', handleError, true); scope.addEventListener('unhandledrejection', handleRejection, true); }; var detectSdkOrigin = function (payload) { var e_1, _a; var normalizedScriptUrls = getNormalizedScriptUrls(); if (normalizedScriptUrls.length === 0) { return undefined; } try { for (var normalizedScriptUrls_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(normalizedScriptUrls), normalizedScriptUrls_1_1 = normalizedScriptUrls_1.next(); !normalizedScriptUrls_1_1.done; normalizedScriptUrls_1_1 = normalizedScriptUrls_1.next()) { var normalizedScriptUrl = normalizedScriptUrls_1_1.value; if (payload.filename && payload.filename.includes(normalizedScriptUrl)) { return 'filename'; } if (payload.stack && payload.stack.includes(normalizedScriptUrl)) { return 'stack'; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (normalizedScriptUrls_1_1 && !normalizedScriptUrls_1_1.done && (_a = normalizedScriptUrls_1.return)) _a.call(normalizedScriptUrls_1); } finally { if (e_1) throw e_1.error; } } return undefined; }; var normalizeUrl = function (value) { var _a, _b; try { /* istanbul ignore next */ var url = new URL(value, (_b = (_a = (0,_global_scope__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.origin); return url.origin + url.pathname; } catch (_c) { return undefined; } }; var extractFilenameFromStack = function (stack) { if (!stack) { return undefined; } var match = stack.match(/(https?:\/\/\S+?)(?=[)\s]|$)/); /* istanbul ignore next */ return match ? match[1] : undefined; }; /* istanbul ignore next */ var stringifyReason = function (reason) { if (typeof reason === 'string') { return reason; } try { return JSON.stringify(reason); } catch (_a) { return '[object Object]'; } }; //# sourceMappingURL=uncaught-sdk-errors.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js" /*!************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js ***! \************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ getGlobalScope: () => (/* binding */ getGlobalScope) /* harmony export */ }); /* eslint-disable no-restricted-globals */ /* Only file allowed to access to globalThis, window, self */ var getGlobalScope = function () { // This should only be used for integrations with Amplitude that are not running in a browser environment // We need to specify the name of the global variable as a string to prevent it from being minified var ampIntegrationContextName = 'ampIntegrationContext'; if (typeof globalThis !== 'undefined' && typeof globalThis[ampIntegrationContextName] !== 'undefined') { return globalThis[ampIntegrationContextName]; } if (typeof globalThis !== 'undefined') { return globalThis; } if (typeof window !== 'undefined') { return window; } if (typeof self !== 'undefined') { return self; } if (typeof __webpack_require__.g !== 'undefined') { return __webpack_require__.g; } return undefined; }; //# sourceMappingURL=global-scope.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/identify.js" /*!********************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/identify.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Identify: () => (/* binding */ Identify), /* harmony export */ IdentifyOperation: () => (/* binding */ IdentifyOperation), /* harmony export */ OrderedIdentifyOperations: () => (/* binding */ OrderedIdentifyOperations) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _types_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types/constants */ "./node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"); /* harmony import */ var _utils_valid_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/valid-properties */ "./node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js"); var Identify = /** @class */ (function () { function Identify() { this._propertySet = new Set(); this._properties = {}; } Identify.prototype.getUserProperties = function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__assign)({}, this._properties); }; Identify.prototype.set = function (property, value) { this._safeSet(IdentifyOperation.SET, property, value); return this; }; Identify.prototype.setOnce = function (property, value) { this._safeSet(IdentifyOperation.SET_ONCE, property, value); return this; }; Identify.prototype.append = function (property, value) { this._safeSet(IdentifyOperation.APPEND, property, value); return this; }; Identify.prototype.prepend = function (property, value) { this._safeSet(IdentifyOperation.PREPEND, property, value); return this; }; Identify.prototype.postInsert = function (property, value) { this._safeSet(IdentifyOperation.POSTINSERT, property, value); return this; }; Identify.prototype.preInsert = function (property, value) { this._safeSet(IdentifyOperation.PREINSERT, property, value); return this; }; Identify.prototype.remove = function (property, value) { this._safeSet(IdentifyOperation.REMOVE, property, value); return this; }; Identify.prototype.add = function (property, value) { this._safeSet(IdentifyOperation.ADD, property, value); return this; }; Identify.prototype.unset = function (property) { this._safeSet(IdentifyOperation.UNSET, property, _types_constants__WEBPACK_IMPORTED_MODULE_1__.UNSET_VALUE); return this; }; Identify.prototype.clearAll = function () { // When clear all happens, all properties are unset. Reset the entire object. this._properties = {}; this._properties[IdentifyOperation.CLEAR_ALL] = _types_constants__WEBPACK_IMPORTED_MODULE_1__.UNSET_VALUE; return this; }; // Returns whether or not this set actually worked. Identify.prototype._safeSet = function (operation, property, value) { if (this._validate(operation, property, value)) { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment var userPropertyMap = this._properties[operation]; if (userPropertyMap === undefined) { userPropertyMap = {}; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this._properties[operation] = userPropertyMap; } // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access userPropertyMap[property] = value; this._propertySet.add(property); return true; } return false; }; Identify.prototype._validate = function (operation, property, value) { if (this._properties[IdentifyOperation.CLEAR_ALL] !== undefined) { // clear all already set. Skipping operation; return false; } if (this._propertySet.has(property)) { // Property already used. Skipping operation return false; } if (operation === IdentifyOperation.ADD) { return typeof value === 'number'; } if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) { return (0,_utils_valid_properties__WEBPACK_IMPORTED_MODULE_2__.isValidProperties)(property, value); } return true; }; return Identify; }()); var IdentifyOperation; (function (IdentifyOperation) { // Base Operations to set values IdentifyOperation["SET"] = "$set"; IdentifyOperation["SET_ONCE"] = "$setOnce"; // Operations around modifying existing values IdentifyOperation["ADD"] = "$add"; IdentifyOperation["APPEND"] = "$append"; IdentifyOperation["PREPEND"] = "$prepend"; IdentifyOperation["REMOVE"] = "$remove"; // Operations around appending values *if* they aren't present IdentifyOperation["PREINSERT"] = "$preInsert"; IdentifyOperation["POSTINSERT"] = "$postInsert"; // Operations around removing properties/values IdentifyOperation["UNSET"] = "$unset"; IdentifyOperation["CLEAR_ALL"] = "$clearAll"; })(IdentifyOperation || (IdentifyOperation = {})); /** * Note that the order of operations should align with https://github.com/amplitude/nova/blob/7701b5986b565d4b2fb53b99a9f2175df055dea8/src/main/java/com/amplitude/ingestion/core/UserPropertyUtils.java#L210 */ var OrderedIdentifyOperations = [ IdentifyOperation.CLEAR_ALL, IdentifyOperation.UNSET, IdentifyOperation.SET, IdentifyOperation.SET_ONCE, IdentifyOperation.ADD, IdentifyOperation.APPEND, IdentifyOperation.PREPEND, IdentifyOperation.PREINSERT, IdentifyOperation.POSTINSERT, IdentifyOperation.REMOVE, ]; //# sourceMappingURL=identify.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/language.js" /*!********************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/language.js ***! \********************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ getLanguage: () => (/* binding */ getLanguage) /* harmony export */ }); var getLanguage = function () { var _a, _b, _c, _d; if (typeof navigator === 'undefined') return ''; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access var userLanguage = navigator.userLanguage; return (_d = (_c = (_b = (_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : navigator.language) !== null && _c !== void 0 ? _c : userLanguage) !== null && _d !== void 0 ? _d : ''; }; //# sourceMappingURL=language.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/logger.js" /*!******************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/logger.js ***! \******************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Logger: () => (/* binding */ Logger) /* harmony export */ }); /* harmony import */ var _types_loglevel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types/loglevel */ "./node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"); var PREFIX = 'Amplitude Logger '; var Logger = /** @class */ (function () { function Logger() { this.logLevel = _types_loglevel__WEBPACK_IMPORTED_MODULE_0__.LogLevel.None; } Logger.prototype.disable = function () { this.logLevel = _types_loglevel__WEBPACK_IMPORTED_MODULE_0__.LogLevel.None; }; Logger.prototype.enable = function (logLevel) { if (logLevel === void 0) { logLevel = _types_loglevel__WEBPACK_IMPORTED_MODULE_0__.LogLevel.Warn; } this.logLevel = logLevel; }; Logger.prototype.log = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (this.logLevel < _types_loglevel__WEBPACK_IMPORTED_MODULE_0__.LogLevel.Verbose) { return; } console.log("".concat(PREFIX, "[Log]: ").concat(args.join(' '))); }; Logger.prototype.warn = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (this.logLevel < _types_loglevel__WEBPACK_IMPORTED_MODULE_0__.LogLevel.Warn) { return; } console.warn("".concat(PREFIX, "[Warn]: ").concat(args.join(' '))); }; Logger.prototype.error = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (this.logLevel < _types_loglevel__WEBPACK_IMPORTED_MODULE_0__.LogLevel.Error) { return; } console.error("".concat(PREFIX, "[Error]: ").concat(args.join(' '))); }; Logger.prototype.debug = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (this.logLevel < _types_loglevel__WEBPACK_IMPORTED_MODULE_0__.LogLevel.Debug) { return; } // console.debug output is hidden by default in chrome console.log("".concat(PREFIX, "[Debug]: ").concat(args.join(' '))); }; return Logger; }()); //# sourceMappingURL=logger.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/messenger/background-capture.js" /*!****************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/messenger/background-capture.js ***! \****************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ enableBackgroundCapture: () => (/* binding */ enableBackgroundCapture) /* harmony export */ }); /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./node_modules/@amplitude/analytics-core/lib/esm/messenger/constants.js"); /** * Brand key set on the messenger instance to track whether background capture * has been enabled. */ var BG_CAPTURE_BRAND = '__AMPLITUDE_BACKGROUND_CAPTURE__'; /** * Enable background capture on a messenger instance. * Plugins can call this on a shared messenger instance. * The first call registers the handlers; subsequent calls are no-ops. * * @param messenger - The messenger to enable background capture on * @param options.scriptUrl - Override the background capture script URL (optional) */ function enableBackgroundCapture(messenger, options) { var _a; // Check the brand on the messenger object itself — works across bundle boundaries var branded = messenger; if (branded[BG_CAPTURE_BRAND] === true) { return; } branded[BG_CAPTURE_BRAND] = true; var scriptUrl = (_a = options === null || options === void 0 ? void 0 : options.scriptUrl) !== null && _a !== void 0 ? _a : _constants__WEBPACK_IMPORTED_MODULE_0__.AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL; var backgroundCaptureInstance = null; var onBackgroundCapture = function (type, backgroundCaptureData) { var _a, _b; if (type === 'background-capture-complete') { (_b = (_a = messenger.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, 'Background capture complete'); messenger.notify({ action: 'background-capture-complete', data: backgroundCaptureData }); } }; messenger.registerActionHandler('initialize-background-capture', function () { var _a, _b; (_b = (_a = messenger.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, 'Initializing background capture (external script)'); var resolvedUrl = new URL(scriptUrl, messenger.endpoint).toString(); messenger .loadScriptOnce(resolvedUrl) .then(function () { var _a, _b, _c; (_b = (_a = messenger.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, 'Background capture script loaded (external)'); // eslint-disable-next-line backgroundCaptureInstance = /* istanbul ignore next -- window is always defined in browser */ (_c = window === null || window === void 0 ? void 0 : window.amplitudeBackgroundCapture) === null || _c === void 0 ? void 0 : _c.call(window, { messenger: messenger, onBackgroundCapture: onBackgroundCapture, }); messenger.notify({ action: 'background-capture-loaded' }); }) .catch(function () { var _a; (_a = messenger.logger) === null || _a === void 0 ? void 0 : _a.warn('Failed to initialize background capture'); }); }); messenger.registerActionHandler('close-background-capture', function () { var _a; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call (_a = backgroundCaptureInstance === null || backgroundCaptureInstance === void 0 ? void 0 : backgroundCaptureInstance.close) === null || _a === void 0 ? void 0 : _a.call(backgroundCaptureInstance); backgroundCaptureInstance = null; }); } //# sourceMappingURL=background-capture.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/messenger/base-window-messenger.js" /*!*******************************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/messenger/base-window-messenger.js ***! \*******************************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ getOrCreateWindowMessenger: () => (/* binding */ getOrCreateWindowMessenger) /* harmony export */ }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs"); /* harmony import */ var _global_scope__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../global-scope */ "./node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"); /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@amplitude/analytics-core/lib/esm/messenger/constants.js"); /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./node_modules/@amplitude/analytics-core/lib/esm/messenger/utils.js"); var _a; /** * Brand key used to identify BaseWindowMessenger instances across bundle boundaries. */ var MESSENGER_BRAND = '__AMPLITUDE_MESSENGER_INSTANCE__'; /** Global scope key where the singleton messenger is stored. */ var MESSENGER_GLOBAL_KEY = '__AMPLITUDE_MESSENGER__'; /** * BaseWindowMessenger provides generic cross-window communication via postMessage. * Singleton access via getOrCreateWindowMessenger() to prevent duplicate instances */ var BaseWindowMessenger = /** @class */ (function () { function BaseWindowMessenger(_b) { var _c = _b === void 0 ? {} : _b, _d = _c.origin, origin = _d === void 0 ? _constants__WEBPACK_IMPORTED_MODULE_2__.AMPLITUDE_ORIGIN : _d; /** Brand property for cross-bundle instanceof checks. */ this[_a] = true; this.isSetup = false; this.messageHandler = null; this.requestCallbacks = {}; this.actionHandlers = new Map(); /** * Messages received for actions that had no registered handler yet. * Drained automatically when the corresponding handler is registered via * registerActionHandler(), solving startup race conditions between * independently-initialized plugins. */ this.pendingMessages = new Map(); /** * Tracks in-flight and completed script loads by URL. * Using a map, this prevents duplicate loads before the first resolves. */ this.scriptLoadPromises = new Map(); this.endpoint = origin; } /** * Send a message to the parent window (window.opener). */ BaseWindowMessenger.prototype.notify = function (message) { var _b, _c, _d, _e; (_c = (_b = this.logger) === null || _b === void 0 ? void 0 : _b.debug) === null || _c === void 0 ? void 0 : _c.call(_b, 'Message sent: ', JSON.stringify(message)); (_e = (_d = window.opener) === null || _d === void 0 ? void 0 : _d.postMessage) === null || _e === void 0 ? void 0 : _e.call(_d, message, this.endpoint); }; /** * Send an async request to the parent window with a unique ID. * Returns a Promise that resolves when the parent responds. */ BaseWindowMessenger.prototype.sendRequest = function (action, args, options) { var _this = this; if (options === void 0) { options = { timeout: 15000 }; } var id = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.generateUniqueId)(); var request = { id: id, action: action, args: args }; var promise = new Promise(function (resolve, reject) { _this.requestCallbacks[id] = { resolve: resolve, reject: reject }; _this.notify(request); if (options.timeout > 0) { setTimeout(function () { reject(new Error("".concat(action, " timed out (id: ").concat(id, ")"))); delete _this.requestCallbacks[id]; }, options.timeout); } }); return promise; }; /** * Handle a response to a previous request by resolving its Promise. */ BaseWindowMessenger.prototype.handleResponse = function (response) { var _b; if (!this.requestCallbacks[response.id]) { (_b = this.logger) === null || _b === void 0 ? void 0 : _b.warn("No callback found for request id: ".concat(response.id)); return; } this.requestCallbacks[response.id].resolve(response.responseData); delete this.requestCallbacks[response.id]; }; /** * Register a handler for a specific action type. * Logs a warning if overwriting an existing handler. */ BaseWindowMessenger.prototype.registerActionHandler = function (action, handler) { var e_1, _b; var _c, _d; if (this.actionHandlers.has(action)) { (_d = (_c = this.logger) === null || _c === void 0 ? void 0 : _c.warn) === null || _d === void 0 ? void 0 : _d.call(_c, "Overwriting existing action handler for: ".concat(action)); } this.actionHandlers.set(action, handler); // Replay any messages that arrived before this handler was registered var queued = this.pendingMessages.get(action); if (queued) { this.pendingMessages.delete(action); try { for (var queued_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(queued), queued_1_1 = queued_1.next(); !queued_1_1.done; queued_1_1 = queued_1.next()) { var data = queued_1_1.value; handler(data); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (queued_1_1 && !queued_1_1.done && (_b = queued_1.return)) _b.call(queued_1); } finally { if (e_1) throw e_1.error; } } } }; /** * Load a script once, deduplicating by URL. * Safe against concurrent calls — the second call awaits the first's in-flight Promise * rather than triggering a duplicate load. */ BaseWindowMessenger.prototype.loadScriptOnce = function (url) { return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { var existing, loadPromise, error_1; return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_b) { switch (_b.label) { case 0: existing = this.scriptLoadPromises.get(url); if (existing) { return [2 /*return*/, existing]; } loadPromise = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.asyncLoadScript)(url).then(function () { // Resolve to void }); this.scriptLoadPromises.set(url, loadPromise); _b.label = 1; case 1: _b.trys.push([1, 3, , 4]); return [4 /*yield*/, loadPromise]; case 2: _b.sent(); return [3 /*break*/, 4]; case 3: error_1 = _b.sent(); // Remove failed loads so they can be retried this.scriptLoadPromises.delete(url); throw error_1; case 4: return [2 /*return*/]; } }); }); }; /** * Set up the message listener. Idempotent — safe to call multiple times. * Subclasses should call super.setup() and then register their own action handlers. */ BaseWindowMessenger.prototype.setup = function (_b) { var _this = this; var _c, _d; var _e = _b === void 0 ? {} : _b, logger = _e.logger, endpoint = _e.endpoint; if (logger) { this.logger = logger; } // If endpoint is customized, don't override a previously customized endpoint. if (endpoint && this.endpoint === _constants__WEBPACK_IMPORTED_MODULE_2__.AMPLITUDE_ORIGIN) { this.endpoint = endpoint; } // Only attach the message listener once if (this.isSetup) { return; } this.isSetup = true; (_d = (_c = this.logger) === null || _c === void 0 ? void 0 : _c.debug) === null || _d === void 0 ? void 0 : _d.call(_c, 'Setting up messenger'); // Attach Event Listener to listen for messages from the parent window this.messageHandler = function (event) { var _b, _c, _d, _e, _f; (_c = (_b = _this.logger) === null || _b === void 0 ? void 0 : _b.debug) === null || _c === void 0 ? void 0 : _c.call(_b, 'Message received: ', JSON.stringify(event)); // Only accept messages from the specified origin if (_this.endpoint !== event.origin) { return; } var eventData = event.data; var action = eventData === null || eventData === void 0 ? void 0 : eventData.action; // Ignore messages without action if (!action) { return; } // If id exists, handle responses to previous requests if ('id' in eventData && eventData.id) { (_e = (_d = _this.logger) === null || _d === void 0 ? void 0 : _d.debug) === null || _e === void 0 ? void 0 : _e.call(_d, 'Received Response to previous request: ', JSON.stringify(event)); _this.handleResponse(eventData); } else { if (action === 'ping') { _this.notify({ action: 'pong' }); return; } // Dispatch to registered action handlers, or buffer for late registration var handler = _this.actionHandlers.get(action); if (handler) { handler(eventData.data); } else { var queue = (_f = _this.pendingMessages.get(action)) !== null && _f !== void 0 ? _f : []; queue.push(eventData.data); _this.pendingMessages.set(action, queue); } } }; window.addEventListener('message', this.messageHandler); this.notify({ action: 'page-loaded' }); }; /** * Tear down the messenger: remove the message listener, clear all state. */ BaseWindowMessenger.prototype.destroy = function () { if (this.messageHandler) { window.removeEventListener('message', this.messageHandler); this.messageHandler = null; } this.isSetup = false; this.actionHandlers.clear(); this.pendingMessages.clear(); this.requestCallbacks = {}; this.scriptLoadPromises.clear(); // Remove from global scope if this is the singleton var globalScope = (0,_global_scope__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)(); if ((globalScope === null || globalScope === void 0 ? void 0 : globalScope[MESSENGER_GLOBAL_KEY]) === this) { delete globalScope[MESSENGER_GLOBAL_KEY]; } }; return BaseWindowMessenger; }()); _a = MESSENGER_BRAND; /** * Type guard: checks whether a value is a BaseWindowMessenger instance. */ function isWindowMessenger(value) { return (typeof value === 'object' && value !== null && MESSENGER_BRAND in value && value[MESSENGER_BRAND] === true); } /** * Get or create a singleton BaseWindowMessenger instance. * Ensures only one messenger (and one message listener) exists per page, * preventing duplicate script loads and double notifications. * * The singleton is stored on globalScope under the same MESSENGER_KEY. * The branded property check verifies the stored value is actually a messenger. */ function getOrCreateWindowMessenger(options) { var globalScope = (0,_global_scope__WEBPACK_IMPORTED_MODULE_1__.getGlobalScope)(); var existing = globalScope === null || globalScope === void 0 ? void 0 : globalScope[MESSENGER_GLOBAL_KEY]; if (isWindowMessenger(existing)) { return existing; } var messenger = new BaseWindowMessenger(options); if (globalScope) { globalScope[MESSENGER_GLOBAL_KEY] = messenger; } return messenger; } //# sourceMappingURL=base-window-messenger.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/messenger/constants.js" /*!*******************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/messenger/constants.js ***! \*******************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL: () => (/* binding */ AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL), /* harmony export */ AMPLITUDE_ORIGIN: () => (/* binding */ AMPLITUDE_ORIGIN), /* harmony export */ AMPLITUDE_ORIGINS_MAP: () => (/* binding */ AMPLITUDE_ORIGINS_MAP), /* harmony export */ AMPLITUDE_ORIGIN_EU: () => (/* binding */ AMPLITUDE_ORIGIN_EU), /* harmony export */ AMPLITUDE_ORIGIN_STAGING: () => (/* binding */ AMPLITUDE_ORIGIN_STAGING) /* harmony export */ }); // Shared origin constants for Amplitude cross-window communication var AMPLITUDE_ORIGIN = 'https://app.amplitude.com'; var AMPLITUDE_ORIGIN_EU = 'https://app.eu.amplitude.com'; var AMPLITUDE_ORIGIN_STAGING = 'https://apps.stag2.amplitude.com'; var AMPLITUDE_ORIGINS_MAP = { US: AMPLITUDE_ORIGIN, EU: AMPLITUDE_ORIGIN_EU, STAGING: AMPLITUDE_ORIGIN_STAGING, }; // Background capture script URL (shared between autocapture and session-replay) var AMPLITUDE_BACKGROUND_CAPTURE_SCRIPT_URL = 'https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.2.js.gz'; //# sourceMappingURL=constants.js.map /***/ }, /***/ "./node_modules/@amplitude/analytics-core/lib/esm/messenger/utils.js" /*!***************************************************************************!*\ !*** ./node_modules/@amplitude/analytics-core/lib/esm/messenger/utils.js ***! \***************************************************************************/ (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ asyncLoadScript: () => (/* binding */ asyncLoadScript), /* harmony export */ generateUniqueId: () => (/* binding */ generateUniqueId) /* harmony export */ }); /* eslint-disable no-restricted-globals */ /** * Dynamically loads an external script by appending a