decord/source/modules/quests/EarnedDecisionRoundtripTracker.tsx

97 lines
3.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10541
// Function ID: 10542
2026-07-20 16:05:17 +00:00
// Name: trackRoundtrip
2026-08-24 06:08:38 +00:00
// Dependencies: [4569, 676, 5057, 698, 7469, 5060, 2]
2026-07-22 07:54:56 +00:00
2026-08-24 06:08:38 +00:00
// Module 10541 (trackRoundtrip)
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import receiveNetworkInfoformation from "receiveNetworkInfoformation" /* 5057 */;
import isForegrounded from "isForegrounded" /* 5060 */;
import getDeviceMetadataDefault from "getDeviceMetadata" /* 7469 */;
import closure_3 from "handleConnectionInfoChange" /* 4569 */;
import { AnalyticEvents } from "ME" /* 676 */;
import set from "set" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function trackRoundtrip(apiResponseTimestamp) {
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, requestId: obj3.request_id, fetchedAt: obj3.fetched_at } = apiResponseTimestamp);
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.EARNED_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 EarnedDecisionRoundtripTracker {
constructor() {
obj = Object.create(new.target.prototype);
map = new Map();
obj[0] = map;
return obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
const prototype = EarnedDecisionRoundtripTracker.prototype;
prototype["recordEarnedRequestAttempt"] = function recordEarnedRequestAttempt(arg0, callerSource) {
const self = this;
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
let pendingRequests = this.pendingRequests;
const result = pendingRequests.set(arg0, { initialSendTimestamp: Date.now(), endpoint: "/quests/earned-decision", apiResponseTimestamp: null, wasSuccessful: false, callerSource, requestId: null, fetchedAt: null });
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_5(value);
2026-07-29 08:29:29 +00:00
const pendingRequests2 = self.pendingRequests;
pendingRequests2.delete(closure_0);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}, 30000);
};
prototype["recordEarnedRequestApiResponse"] = function recordEarnedRequestApiResponse(closure_0, requestId) {
requestId = requestId.requestId;
if (requestId === undefined) {
requestId = null;
}
let fetchedAt = requestId.fetchedAt;
if (fetchedAt === undefined) {
fetchedAt = null;
}
const pendingRequests = this.pendingRequests;
const value = pendingRequests.get(closure_0);
if (null != value) {
const obj = {};
const merged = Object.assign(value);
const _Date = Date;
obj.apiResponseTimestamp = Date.now();
obj.wasSuccessful = requestId.wasSuccessful;
obj.requestId = requestId;
obj.fetchedAt = fetchedAt;
trackRoundtrip(obj);
const pendingRequests2 = this.pendingRequests;
pendingRequests2.delete(closure_0);
}
};
let set = Object.create(EarnedDecisionRoundtripTracker.prototype);
set[0] = new Map();
let result = set.fileFinishedImporting("modules/quests/EarnedDecisionRoundtripTracker.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default set;