// Module ID: 15439 // Function ID: 15440 // Name: QuestHomeRoundtripTracker // Dependencies: [1074, 1241, 5116, 5121, 11592, 2] // Module 15439 (QuestHomeRoundtripTracker) import Constants from "Constants" /* 1074 */; import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1241 */; import MonitoringAgentDefault from "MonitoringAgent" /* 5116 */; import MetricEvents from "MetricEvents" /* 5121 */; import DiscordAppStateDefault from "DiscordAppState" /* 11592 */; import size from "module_2" /* 2 */; const AnalyticEvents = Constants.AnalyticEvents; let c4 = 30000; class QuestHomeRoundtripTracker { constructor() { return Object.assign({ startTime: null, timeoutTimer: null }); } } const prototype = QuestHomeRoundtripTracker.prototype; prototype["clearTimeoutTimer"] = function clearTimeoutTimer() { const self = this; if (null != this.timeoutTimer) { const _clearTimeout = clearTimeout; clearTimeout(self.timeoutTimer); self.timeoutTimer = null; } }; prototype["sendMetric"] = function sendMetric(timeout, duration, arg2) { AnalyticsUtilsDefault.track(AnalyticEvents.QUEST_HOME_ROUNDTRIP, { timeout, duration }); if (Math.random() <= 0.1) { const obj3 = { name: MetricEvents.MetricEvents.QUEST_HOME_ROUNDTRIP, tags: null }; const _HermesInternal = HermesInternal; const items = ["includes_bounties:" + arg2, ]; const _HermesInternal2 = HermesInternal; items[1] = "timeout:" + timeout; obj3.tags = items; MonitoringAgentDefault.distribution(obj3, duration); const tmpResult = MonitoringAgentDefault; } }; prototype["startTracking"] = function startTracking() { const self = this; let obj = arg0; if (arg0 === undefined) { obj = {}; } let flag = obj.includesBounties; if (flag === undefined) { flag = false; } self.clearTracking(); self.startTime = performance.now(); self.timeoutTimer = setTimeout(() => { self.stopTracking({ includesBounties: flag, timeout: true }); }, c4); }; prototype["stopTracking"] = function stopTracking() { let obj = arg0; if (arg0 === undefined) { obj = {}; } let flag = obj.includesBounties; if (flag === undefined) { flag = false; } let flag2 = obj.timeout; if (flag2 === undefined) { flag2 = false; } const self = this; if (null != this.startTime) { if ("active" !== obj2.getState()) { self.clearTracking(); } else { if (flag2) { let rounded = c4; } else { const _Math = Math; const _performance = performance; rounded = Math.round(performance.now() - self.startTime); } const _Math2 = Math; self.sendMetric(flag2, Math.min(rounded, c4), flag); } obj2 = DiscordAppStateDefault; } }; prototype["clearTracking"] = function clearTracking() { this.clearTimeoutTimer(); this.startTime = null; }; const result = size.fileFinishedImporting("modules/quests/QuestHomeRoundtripTracker.tsx"); export default Object.assign({ startTime: null, timeoutTimer: null });