// Metro module 9478 (f9479). import NetworkStore from "../../stores/NetworkStore"; import { AnalyticEvents } from "../../Constants"; import { getSignalStrength } from "../network/NetStats.android"; import AnalyticsUtils from "../../utils/AnalyticsUtils"; import getDeviceMetadata_native from "../device/getDeviceMetadata.native"; import { isForegrounded } from "../analytics_sessions/SessionForegroundUtils.native"; const trackRoundtrip = function trackRoundtrip(a0) { if (!(Math.random() > 0.1)) { const api_latency_ms = a0.apiResponseTimestamp == null ? null : a0.apiResponseTimestamp - a0.initialSendTimestamp; const signalStrength = getSignalStrength(); AnalyticsUtils.track(AnalyticEvents.EARNED_DECISION_ROUNDTRIP, { ...getDeviceMetadata_native(), endpoint: a0.endpoint, was_successful: a0.wasSuccessful, api_latency_ms, mobile_network_type: NetworkStore.getType(), ...signalStrength != null && { mobile_signal_strength_level: signalStrength }, caller_source: a0.callerSource, request_id: a0.requestId, fetched_at: a0.fetchedAt, is_foregrounded: isForegrounded() }); } }; class EarnedDecisionRoundtripTracker { constructor() { return { __proto__: new.target.prototype, pendingRequests: new Map() }; } recordEarnedRequestAttempt(a0, a1) { this.pendingRequests.set(a0, { initialSendTimestamp: Date.now(), endpoint: "/quests/earned-decision", apiResponseTimestamp: null, wasSuccessful: false, callerSource: a1, requestId: null, fetchedAt: null }); setTimeout(() => { const pendingRequests = this.pendingRequests; const r7 = pendingRequests.get(a0); if (r7 != null) { trackRoundtrip(r7); this.pendingRequests.delete(a0); } }, 30000); } recordEarnedRequestApiResponse(a0, { wasSuccessful, requestId = null, fetchedAt = null }) { const r10 = this.pendingRequests.get(a0); if (r10 != null) { trackRoundtrip({ ...r10, apiResponseTimestamp: Date.now(), wasSuccessful, requestId, fetchedAt }); this.pendingRequests.delete(a0); } } } const r34 = { __proto__: EarnedDecisionRoundtripTracker.prototype, pendingRequests: new Map() }; export default r34;