decord/source/modules/quests/QuestDecisionRoundtripTracker.tsx

215 lines
7.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10521
// Function ID: 10522
2026-07-20 16:05:17 +00:00
// Name: trackRoundtrip
2026-08-24 06:08:38 +00:00
// Dependencies: [4569, 7491, 676, 7507, 7506, 5057, 698, 7469, 5060, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 10521 (trackRoundtrip)
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import receiveNetworkInfoformation from "receiveNetworkInfoformation" /* 5057 */;
import isForegrounded from "isForegrounded" /* 5060 */;
import getDeviceMetadataDefault from "getDeviceMetadata" /* 7469 */;
import result2 from "result" /* 7506 */;
import AdCreativeType from "AdCreativeType" /* 7507 */;
import closure_3 from "handleConnectionInfoChange" /* 4569 */;
import closure_4 from "initializeState" /* 7491 */;
import { AnalyticEvents } from "ME" /* 676 */;
import set from "set" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
function trackRoundtrip(apiResponseTimestamp, transition_case, fetched_at) {
2026-07-20 16:05:17 +00:00
if (Math.random() <= 0.1) {
let diff = null;
if (null != apiResponseTimestamp.apiResponseTimestamp) {
diff = apiResponseTimestamp.apiResponseTimestamp - apiResponseTimestamp.initialSendTimestamp;
}
2026-08-24 06:08:38 +00:00
let obj = receiveNetworkInfoformation;
2026-07-20 16:05:17 +00:00
const signalStrength = obj.getSignalStrength();
obj = {};
2026-08-24 06:08:38 +00:00
const merged = Object.assign(getDeviceMetadataDefault());
2026-07-29 08:29:29 +00:00
({ endpoint: obj3.endpoint, wasSuccessful: obj3.was_successful } = apiResponseTimestamp);
obj.api_latency_ms = diff;
obj.mobile_network_type = type.getType();
2026-07-20 16:05:17 +00:00
let tmp10 = null != signalStrength;
if (tmp10) {
2026-07-29 08:29:29 +00:00
obj = { mobile_signal_strength_level: null };
obj[0] = signalStrength;
2026-07-20 16:05:17 +00:00
tmp10 = obj;
}
const merged1 = Object.assign(tmp10);
2026-07-29 08:29:29 +00:00
({ callerSource: obj3.caller_source, adRequestId: obj3.ad_request_id } = apiResponseTimestamp);
obj.fetched_at = fetched_at;
2026-07-20 16:05:17 +00:00
const previousAdDecision = apiResponseTimestamp.previousAdDecision;
let decision_id;
2026-07-29 08:29:29 +00:00
if (previousAdDecision != null) {
2026-07-20 16:05:17 +00:00
const adDecisionData = previousAdDecision.adDecisionData;
2026-07-29 08:29:29 +00:00
if (adDecisionData != null) {
2026-07-20 16:05:17 +00:00
decision_id = adDecisionData.decision_id;
}
}
2026-07-29 08:29:29 +00:00
if (decision_id == null) {
decision_id = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.previous_ad_request_id = decision_id;
2026-07-20 16:05:17 +00:00
const previousAdDecision2 = apiResponseTimestamp.previousAdDecision;
let fetchedAt;
2026-07-29 08:29:29 +00:00
if (previousAdDecision2 != null) {
2026-07-20 16:05:17 +00:00
fetchedAt = previousAdDecision2.fetchedAt;
}
2026-07-29 08:29:29 +00:00
if (fetchedAt == null) {
fetchedAt = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.previous_fetched_at = fetchedAt;
obj.transition_case = transition_case;
2026-08-24 06:08:38 +00:00
const obj2 = expandEventPropertiesDefault;
2026-07-29 08:29:29 +00:00
const tmp2 = require;
2026-08-24 06:08:38 +00:00
obj.is_foregrounded = isForegrounded.isForegrounded();
2026-07-20 16:05:17 +00:00
obj2.track(AnalyticEvents.QUEST_DECISION_ROUNDTRIP, obj);
2026-08-24 06:08:38 +00:00
const tmp2Result = isForegrounded;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
class QuestDecisionRoundtripTracker {
constructor() {
obj = Object.create(new.target.prototype);
map = new Map();
obj[0] = map;
return obj;
}
}
const prototype = QuestDecisionRoundtripTracker.prototype;
prototype["recordQuestRequestAttempt"] = function recordQuestRequestAttempt(endpoint, closure_1, closure_0) {
const self = this;
closure_0 = endpoint;
let tmp = closure_0;
if (closure_0 === undefined) {
tmp = null;
}
let tmp2 = null;
2026-08-13 07:00:46 +00:00
if (null != tmp) {
const questAdDecisionByPlacement = obj.questAdDecisionByPlacement;
let value = questAdDecisionByPlacement.get(tmp);
if (value == null) {
value = null;
2026-07-20 16:05:17 +00:00
}
2026-08-13 07:00:46 +00:00
tmp2 = value;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { initialSendTimestamp: Date.now(), endpoint, apiResponseTimestamp: null, wasSuccessful: false, callerSource: closure_1, adRequestId: null, previousAdDecision: tmp2, placement: tmp };
let pendingRequests = this.pendingRequests;
const result = pendingRequests.set(endpoint, obj);
const timerId = setTimeout(() => {
const pendingRequests = self.pendingRequests;
const value = pendingRequests.get(closure_0);
if (null != value) {
2026-08-24 06:08:38 +00:00
closure_1_6(value, "timeout", null);
2026-07-29 08:29:29 +00:00
const pendingRequests2 = self.pendingRequests;
pendingRequests2.delete(closure_0);
}
}, 30000);
};
prototype["recordQuestRequestApiResponse"] = function recordQuestRequestApiResponse(arg0, adRequestId) {
adRequestId = adRequestId.adRequestId;
if (adRequestId === undefined) {
adRequestId = null;
}
2026-08-15 05:55:55 +00:00
let currentCreative = adRequestId.currentCreative;
if (currentCreative === undefined) {
currentCreative = null;
2026-07-29 08:29:29 +00:00
}
let currentFetchedAt = adRequestId.currentFetchedAt;
if (currentFetchedAt === undefined) {
currentFetchedAt = null;
}
2026-08-13 17:34:28 +00:00
const pendingRequests = this.pendingRequests;
2026-08-15 05:55:55 +00:00
const value = pendingRequests.get(arg0);
2026-07-29 08:29:29 +00:00
let tmp5 = null;
2026-08-15 05:55:55 +00:00
if (null != value) {
let tmp7 = null;
2026-08-13 07:00:46 +00:00
if (null !== currentFetchedAt) {
2026-08-15 05:55:55 +00:00
let obj = { creative: null, fetchedAt: null, ttlMillis: 0, adDecisionData: null };
obj[0] = currentCreative;
2026-08-13 17:34:28 +00:00
obj[1] = currentFetchedAt;
2026-08-15 05:55:55 +00:00
let tmp6;
2026-08-13 07:00:46 +00:00
if (tmp5 != adRequestId) {
obj = { decision_id: null };
obj[0] = adRequestId;
2026-08-15 05:55:55 +00:00
tmp6 = obj;
2026-07-20 16:05:17 +00:00
}
2026-08-15 05:55:55 +00:00
obj[3] = tmp6;
tmp7 = obj;
2026-08-13 07:00:46 +00:00
}
2026-08-15 05:55:55 +00:00
const previousAdDecision = value.previousAdDecision;
2026-08-13 07:00:46 +00:00
let str2 = "null";
if (tmp5 != previousAdDecision) {
2026-08-15 05:55:55 +00:00
let str3 = "no_serve";
if (tmp5 != previousAdDecision.creative) {
const type = previousAdDecision.creative.type;
let str4 = "quest";
2026-08-24 06:08:38 +00:00
if (AdCreativeType.AdCreativeType.QUEST !== type) {
2026-08-15 05:55:55 +00:00
str4 = "bounty";
2026-08-24 06:08:38 +00:00
if (tmp8(7507).AdCreativeType.BOUNTY !== type) {
if (tmp8(7507).AdCreativeType.QUEST_HOME_HERO === type) {
2026-08-15 05:55:55 +00:00
str4 = "quest_home_hero";
}
}
}
str3 = str4;
2026-07-29 08:29:29 +00:00
}
2026-08-13 07:00:46 +00:00
str2 = str3;
}
2026-08-15 05:55:55 +00:00
let str5 = "null";
if (tmp5 != tmp7) {
let str6 = "no_serve";
if (tmp5 != tmp7.creative) {
const type2 = tmp7.creative.type;
let str7 = "quest";
2026-08-24 06:08:38 +00:00
if (AdCreativeType.AdCreativeType.QUEST !== type2) {
2026-08-15 05:55:55 +00:00
str7 = "bounty";
2026-08-24 06:08:38 +00:00
if (tmp10(7507).AdCreativeType.BOUNTY !== type2) {
if (tmp10(7507).AdCreativeType.QUEST_HOME_HERO === type2) {
2026-08-15 05:55:55 +00:00
str7 = "quest_home_hero";
}
}
}
str6 = str7;
2026-07-20 16:05:17 +00:00
}
2026-08-15 05:55:55 +00:00
str5 = str6;
2026-08-13 07:00:46 +00:00
}
2026-08-15 05:55:55 +00:00
if (str2 === str5) {
let creative;
if (previousAdDecision != tmp5) {
creative = previousAdDecision.creative;
}
2026-08-24 06:08:38 +00:00
const deliveredAdCreativeId = result2.getDeliveredAdCreativeId(creative);
const obj3 = result2;
2026-08-15 05:55:55 +00:00
const tmp14 = require;
let creative1;
if (tmp7 != tmp5) {
creative1 = tmp7.creative;
}
if (deliveredAdCreativeId === tmp14Result.getDeliveredAdCreativeId(creative1)) {
const _HermesInternal3 = HermesInternal;
let combined = "same_" + str2;
} else {
const _HermesInternal2 = HermesInternal;
combined = "different_" + str2;
}
2026-08-24 06:08:38 +00:00
tmp14Result = result2;
2026-07-20 16:05:17 +00:00
}
2026-08-15 05:55:55 +00:00
const _HermesInternal = HermesInternal;
obj = {};
const combined1 = "" + str2 + "_to_" + str5;
const merged = Object.assign(value);
const _Date = Date;
obj.apiResponseTimestamp = Date.now();
obj.wasSuccessful = adRequestId.wasSuccessful;
obj.adRequestId = adRequestId;
tmp5 = trackRoundtrip(obj, combined1, currentFetchedAt);
const pendingRequests2 = this.pendingRequests;
pendingRequests2.delete(arg0);
2026-07-29 08:29:29 +00:00
}
};
let set = Object.create(QuestDecisionRoundtripTracker.prototype);
set[0] = new Map();
let result = set.fileFinishedImporting("modules/quests/QuestDecisionRoundtripTracker.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default set;