2026-10-07 22:43:51 +00:00
|
|
|
// Module ID: 6970
|
|
|
|
|
// Function ID: 6971
|
2026-09-18 19:45:33 +00:00
|
|
|
// Name: SessionHeartbeatScheduler
|
2026-10-07 22:43:51 +00:00
|
|
|
// Dependencies: [5, 5436, 502, 5567, 4913, 1085, 1102, 3, 6971, 6972, 6973, 1242, 6974, 6977, 1252, 6978, 510, 6980, 1350, 584, 504, 1266, 2]
|
2026-09-18 19:45:33 +00:00
|
|
|
// Exports: getActiveSessionUnsafe, initSessionHeartbeatScheduler
|
|
|
|
|
|
2026-10-07 22:43:51 +00:00
|
|
|
// Module 6970 (SessionHeartbeatScheduler)
|
2026-09-18 19:45:33 +00:00
|
|
|
import LoggerDefault from "Logger" /* 3 */;
|
|
|
|
|
import Storage2 from "Storage" /* 510 */;
|
2026-10-07 22:43:51 +00:00
|
|
|
import DispatcherDefault from "Dispatcher" /* 584 */;
|
|
|
|
|
import DurationsDefault from "Durations" /* 1102 */;
|
|
|
|
|
import SentryUtilsDefault from "SentryUtils" /* 1242 */;
|
|
|
|
|
import MonotonicClock from "MonotonicClock" /* 6973 */;
|
|
|
|
|
import Clickstream from "Clickstream" /* 6974 */;
|
|
|
|
|
import SkippedClientHeartbeatUtil from "SkippedClientHeartbeatUtil" /* 6978 */;
|
|
|
|
|
import SessionUtils from "SessionUtils" /* 6980 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
|
2026-10-07 22:43:51 +00:00
|
|
|
import GatewayConnectionStore from "GatewayConnectionStore" /* 5436 */;
|
2026-09-18 19:45:33 +00:00
|
|
|
import AuthenticationStore from "AuthenticationStore" /* 502 */;
|
2026-10-07 22:43:51 +00:00
|
|
|
import IdleStore from "IdleStore" /* 5567 */;
|
|
|
|
|
import RTCConnectionStore from "RTCConnectionStore" /* 4913 */;
|
|
|
|
|
import Constants from "Constants" /* 1085 */;
|
|
|
|
|
import react_native from "react-native" /* 6971 */;
|
|
|
|
|
import SessionRouteUtils from "SessionRouteUtils" /* 6972 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import size from "module_2" /* 2 */;
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-10-01 14:13:23 +00:00
|
|
|
const require = globalThis.__r;
|
2026-10-07 22:43:51 +00:00
|
|
|
let c3, closure_21, monotonicNowMsResult;
|
2026-10-01 14:13:23 +00:00
|
|
|
|
|
|
|
|
let c10;
|
|
|
|
|
let c9;
|
|
|
|
|
let metroImportAll;
|
|
|
|
|
let tmp;
|
|
|
|
|
const get_initializedDefault = tmp(504);
|
2026-09-18 19:45:33 +00:00
|
|
|
function trackHeartbeat() {
|
2026-10-01 14:13:23 +00:00
|
|
|
return obj(...arguments);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
let obj = function _trackHeartbeat() {
|
|
|
|
|
obj = _asyncToGenerator(async (arg0, value) => {
|
|
|
|
|
let closure_1;
|
|
|
|
|
let obj12;
|
|
|
|
|
if (c4 === 2) {
|
|
|
|
|
c4 = 3;
|
|
|
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
|
|
|
} else if (tmp3 === 3) {
|
|
|
|
|
if (arg0 === 1) {
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
const obj3 = { value, done: true };
|
|
|
|
|
return obj3;
|
|
|
|
|
} else {
|
2026-10-02 13:37:24 +00:00
|
|
|
return { value: "IconComponent", done: null };
|
2026-10-01 14:13:23 +00:00
|
|
|
}
|
2026-09-18 19:45:33 +00:00
|
|
|
} else {
|
2026-10-01 14:13:23 +00:00
|
|
|
try {
|
|
|
|
|
let tmp;
|
|
|
|
|
let closure_2;
|
|
|
|
|
let closure_3;
|
|
|
|
|
let obj13;
|
|
|
|
|
let closure_0;
|
|
|
|
|
c4 = 2;
|
|
|
|
|
if (0 === c3) {
|
|
|
|
|
if (arg0 === 1) {
|
|
|
|
|
c4 = 3;
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
c4 = 3;
|
|
|
|
|
const obj4 = { value, done: true };
|
|
|
|
|
return obj4;
|
|
|
|
|
} else {
|
|
|
|
|
tmp = undefined;
|
|
|
|
|
closure_2 = undefined;
|
|
|
|
|
closure_3 = undefined;
|
|
|
|
|
obj13 = undefined;
|
|
|
|
|
const _Date2 = Date;
|
|
|
|
|
closure_0 = Date.now();
|
|
|
|
|
c3 = 1;
|
|
|
|
|
c4 = 1;
|
|
|
|
|
const obj5 = { value: getSession(), done: false };
|
|
|
|
|
return obj5;
|
|
|
|
|
}
|
|
|
|
|
} else if (arg0 === 1) {
|
2026-09-18 19:45:33 +00:00
|
|
|
c4 = 3;
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
c4 = 3;
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj7 = { value, done: true };
|
|
|
|
|
return obj7;
|
2026-09-18 19:45:33 +00:00
|
|
|
} else {
|
2026-10-01 14:13:23 +00:00
|
|
|
tmp = value;
|
|
|
|
|
const _Date3 = Date;
|
|
|
|
|
closure_2 = Date.now();
|
|
|
|
|
if (null != tmp) {
|
|
|
|
|
const obj11 = { category, message: "Tracking Heartbeat", data: obj12 };
|
|
|
|
|
obj12 = { initialized: tmp.createdAtTimestamp };
|
|
|
|
|
const obj2 = closure_130_1(closure_130_2[11]);
|
|
|
|
|
obj2.addBreadcrumb(obj11);
|
|
|
|
|
obj13 = { client_heartbeat_initialization_timestamp: tmp.createdAtTimestamp, client_heartbeat_version: 31 };
|
|
|
|
|
obj6 = closure_130_0(closure_130_2[13]);
|
|
|
|
|
const merged = Object.assign(obj6.getClientHeartbeatPiggybackProperties());
|
|
|
|
|
const idleSince = closure_130_6.getIdleSince();
|
|
|
|
|
let c0 = idleSince;
|
|
|
|
|
if (idleSince == null) {
|
|
|
|
|
c0 = 0;
|
|
|
|
|
}
|
|
|
|
|
closure_3 = c0;
|
|
|
|
|
const obj14 = { is_idle: closure_130_6.isIdle(), idle_duration_ms: Date.now() - closure_3, is_afk: closure_130_6.isAFK(), is_system_suspended: closure_130_6.getSystemSuspended(), is_system_locked: closure_130_6.getSystemLocked() };
|
|
|
|
|
const _Date = Date;
|
|
|
|
|
const merged1 = Object.assign(obj14);
|
|
|
|
|
const obj8 = closure_130_1(closure_130_2[14]);
|
|
|
|
|
obj8.track(constants.CLIENT_HEARTBEAT, obj13);
|
|
|
|
|
const obj9 = closure_130_0(closure_130_2[10]);
|
|
|
|
|
let closure_19 = obj9.monotonicNowMs();
|
|
|
|
|
const obj10 = closure_130_0(closure_130_2[12]);
|
|
|
|
|
obj10.drainClickstream();
|
|
|
|
|
} else {
|
|
|
|
|
const _Error = Error;
|
|
|
|
|
const _HermesInternal = HermesInternal;
|
|
|
|
|
obj = closure_130_1(closure_130_2[11]);
|
|
|
|
|
obj.captureException(Error("Null session when tracking session heartbeat. Waited " + closure_2 - closure_0 + "ms"));
|
|
|
|
|
}
|
|
|
|
|
c4 = 3;
|
2026-10-02 13:37:24 +00:00
|
|
|
return { value: "IconComponent", done: null };
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
} catch (tmp49) {
|
2026-09-18 19:45:33 +00:00
|
|
|
c4 = 3;
|
2026-10-01 14:13:23 +00:00
|
|
|
throw tmp49;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
});
|
|
|
|
|
return obj(...arguments);
|
2026-09-18 19:45:33 +00:00
|
|
|
};
|
|
|
|
|
function isActive() {
|
|
|
|
|
const items = [];
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp = null != token && closure_23;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (tmp) {
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp2 = closure_22;
|
|
|
|
|
if (tmp2) {
|
2026-09-18 19:45:33 +00:00
|
|
|
items.push("foregrounded");
|
|
|
|
|
}
|
|
|
|
|
if (closure_21 === constants2.RTC_CONNECTED) {
|
|
|
|
|
items.push("rtc_connected");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return items.length > 0;
|
|
|
|
|
}
|
|
|
|
|
function scheduleHeartbeatTracking() {
|
2026-10-09 10:34:53 +00:00
|
|
|
const f137893 = () => {
|
2026-10-01 14:13:23 +00:00
|
|
|
trackHeartbeat();
|
|
|
|
|
obj = {
|
|
|
|
|
type: "interval",
|
|
|
|
|
id: setInterval(() => {
|
|
|
|
|
closure_1_25();
|
|
|
|
|
}, closure_1_11)
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
obj = SentryUtilsDefault;
|
|
|
|
|
const obj2 = { message: `Heartbeat Track State Parameters Changed. Foregrounded ${closure_22}, Connection State: ${closure_21}` };
|
|
|
|
|
obj.addBreadcrumb(obj2);
|
2026-09-18 19:45:33 +00:00
|
|
|
const items = [];
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp4 = null != token && closure_23;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (tmp4) {
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp5 = closure_22;
|
|
|
|
|
if (tmp5) {
|
2026-09-18 19:45:33 +00:00
|
|
|
items.push("foregrounded");
|
|
|
|
|
}
|
|
|
|
|
if (closure_21 === constants2.RTC_CONNECTED) {
|
|
|
|
|
items.push("rtc_connected");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (items.length > 0) {
|
2026-10-01 14:13:23 +00:00
|
|
|
if (null == user) {
|
2026-09-18 19:45:33 +00:00
|
|
|
let num = 0;
|
|
|
|
|
if (0 !== c19) {
|
2026-10-01 14:13:23 +00:00
|
|
|
obj6 = MonotonicClock;
|
|
|
|
|
num = closure_11 - (obj6.monotonicNowMs() - c19);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
const _HermesInternal = HermesInternal;
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj3 = { message: "Received Last Heartbeat Event Timestamp. Time Until Next Heartbeat: " + num / 1000 + " seconds. Scheduling Heartbeat" };
|
|
|
|
|
const addBreadcrumb = SentryUtilsDefault.addBreadcrumb;
|
|
|
|
|
SentryUtilsDefault;
|
|
|
|
|
addBreadcrumb(obj3);
|
2026-09-18 19:45:33 +00:00
|
|
|
const _setTimeout = setTimeout;
|
2026-10-09 10:34:53 +00:00
|
|
|
user = { type: "timeout", id: setTimeout(f137893, num) };
|
|
|
|
|
const obj4 = { type: "timeout", id: setTimeout(f137893, num) };
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2026-10-01 14:13:23 +00:00
|
|
|
let flag = false;
|
|
|
|
|
if (null != user) {
|
|
|
|
|
const type = user.type;
|
|
|
|
|
if ("timeout" === type) {
|
|
|
|
|
const _clearTimeout = clearTimeout;
|
|
|
|
|
clearTimeout(user.id);
|
|
|
|
|
} else if ("interval" === type) {
|
|
|
|
|
const _clearInterval = clearInterval;
|
|
|
|
|
clearInterval(user.id);
|
|
|
|
|
} else {
|
|
|
|
|
const type2 = user.type;
|
|
|
|
|
}
|
|
|
|
|
user = null;
|
|
|
|
|
flag = true;
|
|
|
|
|
}
|
|
|
|
|
if (flag) {
|
|
|
|
|
const obj7 = { category: user, message: "Stopping Analytics Heartbeat" };
|
|
|
|
|
const tmpResult2 = SentryUtilsDefault;
|
|
|
|
|
tmpResult2.addBreadcrumb(obj7);
|
|
|
|
|
const obj5 = Clickstream;
|
|
|
|
|
obj5.drainClickstream();
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const socket = GatewayConnectionStore.getSocket();
|
|
|
|
|
if (socket != null) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp31 = null != token;
|
|
|
|
|
const handleActiveStateChange = socket.handleActiveStateChange;
|
|
|
|
|
if (tmp31) {
|
|
|
|
|
tmp31 = closure_23;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
const items1 = [];
|
2026-10-01 14:13:23 +00:00
|
|
|
if (tmp31) {
|
|
|
|
|
const tmp32 = closure_22;
|
|
|
|
|
if (tmp32) {
|
2026-09-18 19:45:33 +00:00
|
|
|
items1.push("foregrounded");
|
|
|
|
|
}
|
|
|
|
|
if (closure_21 === constants2.RTC_CONNECTED) {
|
|
|
|
|
items1.push("rtc_connected");
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj8 = { active: items1.length > 0, ver: 31, reasons: items1 };
|
|
|
|
|
const result = handleActiveStateChange(obj8);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function validateClientSession(version) {
|
|
|
|
|
let tmp = null;
|
|
|
|
|
if (null != version) {
|
|
|
|
|
let tmp4 = version;
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp2 = require;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (version.version !== SessionUtils.CLIENT_SESSION_STORAGE_VERSION) {
|
|
|
|
|
const _HermesInternal = HermesInternal;
|
2026-10-07 22:43:51 +00:00
|
|
|
logger.warn("Throwing away client session with invalid version: " + version.version + ", expected " + tmp2(6980).CLIENT_SESSION_STORAGE_VERSION);
|
2026-09-18 19:45:33 +00:00
|
|
|
tmp4 = null;
|
|
|
|
|
}
|
|
|
|
|
tmp = tmp4;
|
|
|
|
|
}
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
|
|
|
|
function forceDispatchSessionIdUpdate() {
|
2026-10-01 14:13:23 +00:00
|
|
|
return obj(...arguments);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
obj = function _forceDispatchSessionIdUpdate() {
|
|
|
|
|
obj = _asyncToGenerator(async (arg0, value) => {
|
|
|
|
|
let createdAtTimestamp;
|
|
|
|
|
let uuid;
|
|
|
|
|
if (c3 === 2) {
|
|
|
|
|
c3 = 3;
|
|
|
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
|
|
|
} else if (tmp3 === 3) {
|
|
|
|
|
if (arg0 === 1) {
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
obj = { value, done: true };
|
|
|
|
|
return obj;
|
|
|
|
|
} else {
|
2026-10-02 13:37:24 +00:00
|
|
|
return { value: "IconComponent", done: null };
|
2026-10-01 14:13:23 +00:00
|
|
|
}
|
2026-09-18 19:45:33 +00:00
|
|
|
} else {
|
2026-10-01 14:13:23 +00:00
|
|
|
try {
|
|
|
|
|
let closure_0;
|
|
|
|
|
c3 = 2;
|
|
|
|
|
if (0 === c2) {
|
|
|
|
|
if (arg0 === 1) {
|
|
|
|
|
c3 = 3;
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
c3 = 3;
|
|
|
|
|
const obj2 = { value, done: true };
|
|
|
|
|
return obj2;
|
|
|
|
|
} else {
|
|
|
|
|
let closure_1 = tmp4;
|
|
|
|
|
closure_0 = undefined;
|
|
|
|
|
c2 = 1;
|
|
|
|
|
c3 = 1;
|
|
|
|
|
const obj3 = { value: getSession(false), done: false };
|
|
|
|
|
return obj3;
|
|
|
|
|
}
|
|
|
|
|
} else if (arg0 === 1) {
|
2026-09-18 19:45:33 +00:00
|
|
|
c3 = 3;
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
c3 = 3;
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj4 = { value, done: true };
|
|
|
|
|
return obj4;
|
2026-09-18 19:45:33 +00:00
|
|
|
} else {
|
2026-10-01 14:13:23 +00:00
|
|
|
closure_0 = value;
|
|
|
|
|
if (null != closure_0) {
|
|
|
|
|
const socket = closure_129_4.getSocket();
|
|
|
|
|
if (socket != null) {
|
|
|
|
|
({ createdAtTimestamp, uuid } = closure_0);
|
|
|
|
|
const result = socket.handleUpdateTimeSpentSessionId(createdAtTimestamp, uuid, closure_129_0(closure_129_2[18]).clientLaunchId);
|
|
|
|
|
}
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
c3 = 3;
|
2026-10-02 13:37:24 +00:00
|
|
|
return { value: "IconComponent", done: null };
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
} catch (tmp15) {
|
2026-09-18 19:45:33 +00:00
|
|
|
c3 = 3;
|
2026-10-01 14:13:23 +00:00
|
|
|
throw tmp15;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
});
|
|
|
|
|
return obj(...arguments);
|
2026-09-18 19:45:33 +00:00
|
|
|
};
|
|
|
|
|
function handleAuthenticationChange() {
|
|
|
|
|
token = AuthenticationStore.getToken();
|
|
|
|
|
if (token !== token) {
|
|
|
|
|
const Storage = Storage2.Storage;
|
|
|
|
|
Storage.remove(LAST_CLIENT_HEARTBEAT_SESSION);
|
|
|
|
|
closure_20 = { state: "loaded", session: null };
|
2026-10-01 14:13:23 +00:00
|
|
|
let flag = false;
|
|
|
|
|
const tmp15 = require;
|
|
|
|
|
if (null != user) {
|
|
|
|
|
const type = user.type;
|
2026-09-18 19:45:33 +00:00
|
|
|
if ("timeout" === type) {
|
|
|
|
|
const _clearTimeout = clearTimeout;
|
2026-10-01 14:13:23 +00:00
|
|
|
clearTimeout(user.id);
|
|
|
|
|
} else if ("interval" === type) {
|
|
|
|
|
const _clearInterval = clearInterval;
|
|
|
|
|
clearInterval(user.id);
|
|
|
|
|
} else {
|
|
|
|
|
const type2 = user.type;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
user = null;
|
|
|
|
|
flag = true;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
if (flag) {
|
|
|
|
|
const obj2 = { category: user, message: "Stopping Analytics Heartbeat" };
|
|
|
|
|
obj = SentryUtilsDefault;
|
|
|
|
|
obj.addBreadcrumb(obj2);
|
2026-10-07 22:43:51 +00:00
|
|
|
const tmp15Result = tmp15(6974);
|
2026-10-01 14:13:23 +00:00
|
|
|
tmp15Result.drainClickstream();
|
|
|
|
|
}
|
|
|
|
|
c19 = 0;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
scheduleHeartbeatTracking();
|
|
|
|
|
}
|
|
|
|
|
function handleRTCStateChange() {
|
2026-09-26 17:57:22 +00:00
|
|
|
const state = RTCConnectionStore.getState();
|
2026-09-18 19:45:33 +00:00
|
|
|
if (closure_21 !== state) {
|
|
|
|
|
closure_21 = state;
|
|
|
|
|
scheduleHeartbeatTracking();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function handleWindowFocus(focused) {
|
|
|
|
|
focused = focused.focused;
|
|
|
|
|
if (closure_22 !== focused) {
|
|
|
|
|
closure_22 = focused;
|
|
|
|
|
scheduleHeartbeatTracking();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function handleLocationChange() {
|
2026-10-01 14:13:23 +00:00
|
|
|
obj = SessionRouteUtils;
|
|
|
|
|
const isActiveUserRouteResult = obj.isActiveUserRoute();
|
2026-09-18 19:45:33 +00:00
|
|
|
if (closure_23 !== isActiveUserRouteResult) {
|
|
|
|
|
closure_23 = isActiveUserRouteResult;
|
|
|
|
|
scheduleHeartbeatTracking();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function handleAppStateUpdate(state) {
|
|
|
|
|
if (closure_22 !== state.state === constants.ACTIVE) {
|
|
|
|
|
closure_22 = tmp;
|
|
|
|
|
scheduleHeartbeatTracking();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function handleFluxInitialized() {
|
2026-09-26 17:57:22 +00:00
|
|
|
const state = RTCConnectionStore.getState();
|
2026-10-01 14:13:23 +00:00
|
|
|
obj = react_native;
|
|
|
|
|
closure_22 = obj.isForegrounded();
|
|
|
|
|
const obj2 = SessionRouteUtils;
|
|
|
|
|
closure_23 = obj2.isActiveUserRoute();
|
2026-09-18 19:45:33 +00:00
|
|
|
handleAuthenticationChange();
|
|
|
|
|
}
|
|
|
|
|
function getSession() {
|
2026-10-01 14:13:23 +00:00
|
|
|
return obj(...arguments);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
obj = function _getSession() {
|
|
|
|
|
obj = _asyncToGenerator(async (arg0, value) => {
|
|
|
|
|
let closure_1;
|
|
|
|
|
let createdAtTimestamp;
|
2026-10-07 22:43:51 +00:00
|
|
|
let lastUsedTimestamp;
|
2026-10-01 14:13:23 +00:00
|
|
|
let obj11;
|
|
|
|
|
let socket;
|
|
|
|
|
let tmp;
|
|
|
|
|
let uuid;
|
2026-10-07 22:43:51 +00:00
|
|
|
let uuid1;
|
2026-10-01 14:13:23 +00:00
|
|
|
function maybeFlushSessionToStorage(c2) {
|
|
|
|
|
obj = closure_1_0(uuid[10]);
|
|
|
|
|
monotonicNowMsResult = obj.monotonicNowMs();
|
|
|
|
|
const tmp = closure_1_0;
|
|
|
|
|
if (monotonicNowMsResult - monotonicNowMsResult >= closure_1_12) {
|
|
|
|
|
try {
|
|
|
|
|
const Storage = tmp(tmp2[16]).Storage;
|
|
|
|
|
const result = Storage.set(closure_1_13, c2);
|
|
|
|
|
} catch (tmp7) {
|
|
|
|
|
const obj2 = closure_1_1(uuid[11]);
|
|
|
|
|
obj2.captureException(tmp7);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let closure_0 = arg0;
|
2026-10-07 22:43:51 +00:00
|
|
|
let closure_3 = tmp;
|
|
|
|
|
let flag = closure_0;
|
|
|
|
|
if (closure_0 === undefined) {
|
|
|
|
|
flag = true;
|
|
|
|
|
}
|
|
|
|
|
await "Reflect";
|
|
|
|
|
if (1 === tmp4) {
|
2026-10-01 14:13:23 +00:00
|
|
|
if (arg0 === 1) {
|
2026-10-07 22:43:51 +00:00
|
|
|
let c7 = 3;
|
2026-10-01 14:13:23 +00:00
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
2026-10-07 22:43:51 +00:00
|
|
|
c7 = 3;
|
|
|
|
|
const obj8 = { value, done: true };
|
|
|
|
|
return obj8;
|
2026-09-18 19:45:33 +00:00
|
|
|
} else {
|
2026-10-07 22:43:51 +00:00
|
|
|
uuid = null;
|
|
|
|
|
let tmp18 = null;
|
|
|
|
|
if ("loaded" === obj11.state) {
|
|
|
|
|
const session = obj11.session;
|
|
|
|
|
uuid1 = undefined;
|
|
|
|
|
if (session != null) {
|
|
|
|
|
uuid1 = session.uuid;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-07 22:43:51 +00:00
|
|
|
tmp18 = uuid1;
|
2026-10-01 14:13:23 +00:00
|
|
|
}
|
2026-10-07 22:43:51 +00:00
|
|
|
uuid1 = tmp18;
|
|
|
|
|
let c4 = 1;
|
|
|
|
|
if ("uninitialized" === obj11.state) {
|
|
|
|
|
lastUsedTimestamp = closure_131_29;
|
|
|
|
|
let Storage = closure_131_0(closure_131_2[16]).Storage;
|
|
|
|
|
let c6 = 3;
|
|
|
|
|
c7 = 1;
|
|
|
|
|
const obj9 = { value: Storage.getAfterRefresh(closure_131_13), done: false };
|
|
|
|
|
return obj9;
|
2026-10-01 14:13:23 +00:00
|
|
|
} else {
|
2026-10-07 22:43:51 +00:00
|
|
|
uuid = obj11.session;
|
|
|
|
|
c4 = 0;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-10-07 22:43:51 +00:00
|
|
|
} else if (2 === tmp4) {
|
|
|
|
|
c4 = 0;
|
|
|
|
|
let closure_4 = closure_5;
|
|
|
|
|
let obj2 = closure_131_1(closure_131_2[11]);
|
|
|
|
|
const captureExceptionResult = obj2.captureException(closure_4);
|
|
|
|
|
} else if (arg0 === 1) {
|
|
|
|
|
c7 = 3;
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
c4 = 0;
|
|
|
|
|
c7 = 3;
|
|
|
|
|
obj = { value, done: true };
|
|
|
|
|
return obj;
|
|
|
|
|
} else {
|
|
|
|
|
lastUsedTimestamp(value);
|
|
|
|
|
}
|
|
|
|
|
const _Date = Date;
|
|
|
|
|
lastUsedTimestamp = Date.now();
|
|
|
|
|
if (closure_131_27()) {
|
|
|
|
|
let isSessionExpiredResult = null == tmp27;
|
|
|
|
|
if (!isSessionExpiredResult) {
|
|
|
|
|
const obj4 = closure_131_0(closure_131_2[17]);
|
|
|
|
|
isSessionExpiredResult = obj4.isSessionExpired(uuid);
|
|
|
|
|
}
|
|
|
|
|
if (isSessionExpiredResult) {
|
|
|
|
|
const obj10 = { uuid: obj6.v4(), createdAtTimestamp: lastUsedTimestamp, lastUsedTimestamp, version: closure_131_0(closure_131_2[17]).CLIENT_SESSION_STORAGE_VERSION };
|
|
|
|
|
obj6 = closure_131_0(closure_131_2[21]);
|
|
|
|
|
uuid = obj10;
|
|
|
|
|
c18 = 0;
|
|
|
|
|
}
|
|
|
|
|
uuid.lastUsedTimestamp = lastUsedTimestamp;
|
|
|
|
|
maybeFlushSessionToStorage(uuid);
|
|
|
|
|
} else {
|
|
|
|
|
let isSessionExpiredResult1 = null != tmp27;
|
|
|
|
|
if (isSessionExpiredResult1) {
|
|
|
|
|
const obj3 = closure_131_0(closure_131_2[17]);
|
|
|
|
|
isSessionExpiredResult1 = obj3.isSessionExpired(uuid);
|
|
|
|
|
}
|
|
|
|
|
if (isSessionExpiredResult1) {
|
|
|
|
|
uuid = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
obj11 = { state: "loaded", session: uuid };
|
|
|
|
|
const tmp58 = null != uuid && uuid1 !== uuid.uuid && flag;
|
|
|
|
|
if (tmp58) {
|
|
|
|
|
socket = socket.getSocket();
|
|
|
|
|
if (socket != null) {
|
|
|
|
|
({ createdAtTimestamp, uuid } = uuid);
|
|
|
|
|
let result = socket.handleUpdateTimeSpentSessionId(createdAtTimestamp, uuid, closure_131_0(closure_131_2[18]).clientLaunchId);
|
|
|
|
|
}
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-07 22:43:51 +00:00
|
|
|
return uuid;
|
2026-10-01 14:13:23 +00:00
|
|
|
});
|
|
|
|
|
return obj(...arguments);
|
2026-09-18 19:45:33 +00:00
|
|
|
};
|
2026-10-01 14:13:23 +00:00
|
|
|
({ AnalyticEvents: metroImportAll, AppStates: c9, RTCConnectionStates: c10 } = Constants);
|
2026-09-18 19:45:33 +00:00
|
|
|
let closure_11 = 15 * DurationsDefault.Millis.MINUTE;
|
|
|
|
|
const SECOND = DurationsDefault.Millis.SECOND;
|
|
|
|
|
const LAST_CLIENT_HEARTBEAT_SESSION = "LAST_CLIENT_HEARTBEAT_SESSION";
|
2026-10-01 14:13:23 +00:00
|
|
|
let user = "user";
|
|
|
|
|
const tmp3 = new LoggerDefault("SessionHeartbeatScheduler");
|
|
|
|
|
const logger = tmp3;
|
2026-09-18 19:45:33 +00:00
|
|
|
let c16 = null;
|
2026-10-01 14:13:23 +00:00
|
|
|
let obj6 = null;
|
2026-09-18 19:45:33 +00:00
|
|
|
let c18 = 0;
|
|
|
|
|
let c19 = 0;
|
|
|
|
|
let closure_20 = { state: "uninitialized" };
|
|
|
|
|
let state = RTCConnectionStore.getState();
|
2026-10-01 14:13:23 +00:00
|
|
|
let closure_22 = react_native.isForegrounded();
|
2026-09-18 19:45:33 +00:00
|
|
|
let closure_23 = SessionRouteUtils.isActiveUserRoute();
|
|
|
|
|
let token = AuthenticationStore.getToken();
|
|
|
|
|
let result = size.fileFinishedImporting("modules/analytics_sessions/SessionHeartbeatScheduler.tsx");
|
|
|
|
|
|
|
|
|
|
export const initSessionHeartbeatScheduler = function initSessionHeartbeatScheduler() {
|
2026-10-01 14:13:23 +00:00
|
|
|
obj = SentryUtilsDefault;
|
|
|
|
|
obj.addBreadcrumb({ message: "Initializing SessionHeartbeatScheduler" });
|
2026-09-18 19:45:33 +00:00
|
|
|
RTCConnectionStore.addChangeListener(handleRTCStateChange);
|
|
|
|
|
AuthenticationStore.addChangeListener(handleAuthenticationChange);
|
2026-10-01 14:13:23 +00:00
|
|
|
let obj2 = DispatcherDefault;
|
|
|
|
|
const subscription = obj2.subscribe("WINDOW_FOCUS", handleWindowFocus);
|
|
|
|
|
let obj3 = DispatcherDefault;
|
|
|
|
|
const subscription1 = obj3.subscribe("APP_STATE_UPDATE", handleAppStateUpdate);
|
|
|
|
|
const obj4 = DispatcherDefault;
|
|
|
|
|
const subscription2 = obj4.subscribe("CONNECTION_OPEN", forceDispatchSessionIdUpdate);
|
|
|
|
|
const obj5 = SessionRouteUtils;
|
|
|
|
|
let result = obj5.subscribeToLocationChanges(handleLocationChange);
|
2026-09-18 19:45:33 +00:00
|
|
|
scheduleHeartbeatTracking();
|
|
|
|
|
if (null == obj6) {
|
|
|
|
|
const _setInterval = setInterval;
|
2026-10-01 14:13:23 +00:00
|
|
|
obj6 = {
|
|
|
|
|
id: setInterval(() => {
|
|
|
|
|
let result = null != token;
|
|
|
|
|
if (result) {
|
|
|
|
|
obj = SkippedClientHeartbeatUtil;
|
|
|
|
|
result = obj.shouldLogClientHeartbeatSkipped();
|
|
|
|
|
}
|
|
|
|
|
if (result) {
|
|
|
|
|
const obj2 = MonotonicClock;
|
|
|
|
|
const tmp5 = dependencyMap;
|
|
|
|
|
if (obj2.monotonicNowMs() - closure_1_19 > closure_1_11) {
|
|
|
|
|
const obj3 = require("AnalyticsUtils");
|
|
|
|
|
obj3.track(constants.CLIENT_HEARTBEAT_SKIPPED, { client_heartbeat_version: 31 });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, closure_11),
|
|
|
|
|
type: "interval"
|
|
|
|
|
};
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
const initialized = get_initializedDefault.initialized;
|
2026-09-18 19:45:33 +00:00
|
|
|
initialized.then(handleFluxInitialized);
|
|
|
|
|
};
|
|
|
|
|
export { getSession };
|
|
|
|
|
export const getActiveSessionUnsafe = function getActiveSessionUnsafe() {
|
2026-10-01 14:13:23 +00:00
|
|
|
let session;
|
2026-09-18 19:45:33 +00:00
|
|
|
if ("uninitialized" === closure_20.state) {
|
|
|
|
|
const Storage = Storage2.Storage;
|
2026-10-01 14:13:23 +00:00
|
|
|
const value = Storage.get(LAST_CLIENT_HEARTBEAT_SESSION);
|
2026-09-18 19:45:33 +00:00
|
|
|
let tmp7 = null;
|
|
|
|
|
if (null != value) {
|
|
|
|
|
let tmp8 = value;
|
2026-10-01 14:13:23 +00:00
|
|
|
if (value.version !== SessionUtils.CLIENT_SESSION_STORAGE_VERSION) {
|
2026-09-18 19:45:33 +00:00
|
|
|
const _HermesInternal = HermesInternal;
|
2026-10-01 14:13:23 +00:00
|
|
|
logger.warn("Throwing away client session with invalid version: " + value.version + ", expected " + SessionUtils.CLIENT_SESSION_STORAGE_VERSION);
|
2026-09-18 19:45:33 +00:00
|
|
|
tmp8 = null;
|
|
|
|
|
}
|
|
|
|
|
tmp7 = tmp8;
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
session = tmp7;
|
2026-09-18 19:45:33 +00:00
|
|
|
} else {
|
|
|
|
|
session = closure_20.session;
|
|
|
|
|
}
|
|
|
|
|
let tmp12 = null;
|
|
|
|
|
if (null != session) {
|
|
|
|
|
tmp12 = null;
|
2026-10-01 14:13:23 +00:00
|
|
|
obj = SessionUtils;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (!obj.isSessionExpired(session)) {
|
|
|
|
|
tmp12 = session;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tmp12;
|
|
|
|
|
};
|