decord/source/modules/analytics_sessions/SessionAdGenerator.tsx

58 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 6962
// Function ID: 55641
2026-07-20 16:05:17 +00:00
// Name: isAdSessionExpired
2026-07-23 10:11:24 +00:00
// Dependencies: [664, 491, 6705, 686, 1184, 2]
2026-07-20 16:05:17 +00:00
// Exports: clearAdSession, getCurrentAdSession, getOrRefreshAdSession
2026-07-23 10:11:24 +00:00
// Module 6962 (isAdSessionExpired)
const require = arg1;
function isAdSessionExpired(createdAtTimestamp) {
2026-07-20 16:05:17 +00:00
const timestamp = Date.now();
2026-07-23 10:11:24 +00:00
if (timestamp < createdAtTimestamp.createdAtTimestamp) {
let obj = importDefault(1184);
2026-07-20 16:05:17 +00:00
obj = { category: "ad" };
const _HermesInternal = HermesInternal;
2026-07-23 10:11:24 +00:00
obj.message = "future facing timestamp Date.now(): " + timestamp + ", initialized timestamp: " + createdAtTimestamp.createdAtTimestamp;
2026-07-20 16:05:17 +00:00
obj.addBreadcrumb(obj);
return true;
} else {
2026-07-23 10:11:24 +00:00
const diff = timestamp - createdAtTimestamp.lastUsedTimestamp;
let tmp5 = diff > require(6705) /* result */.SESSION_IDLE_TIMEOUT_MILLIS;
2026-07-20 16:05:17 +00:00
if (!tmp5) {
2026-07-23 10:11:24 +00:00
tmp5 = timestamp - createdAtTimestamp.createdAtTimestamp > closure_3;
2026-07-20 16:05:17 +00:00
}
return tmp5;
}
}
2026-07-23 10:11:24 +00:00
let closure_3 = 12 * require("set").Millis.HOUR;
let c4 = null;
const result = require("result").fileFinishedImporting("modules/analytics_sessions/SessionAdGenerator.tsx");
2026-07-20 16:05:17 +00:00
export const getOrRefreshAdSession = function getOrRefreshAdSession(shouldExtendSession) {
let flag = shouldExtendSession;
if (shouldExtendSession === undefined) {
flag = false;
}
const timestamp = Date.now();
2026-07-23 10:11:24 +00:00
if (null != obj) {
if (!isAdSessionExpired(obj)) {
2026-07-20 16:05:17 +00:00
if (flag) {
2026-07-23 10:11:24 +00:00
obj.lastUsedTimestamp = timestamp;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let tmp5 = obj;
2026-07-20 16:05:17 +00:00
}
return tmp5;
}
2026-07-23 10:11:24 +00:00
obj = { uuid: require(491) /* v1 */.v4(), createdAtTimestamp: timestamp, lastUsedTimestamp: timestamp, version: require(6705) /* result */.CLIENT_SESSION_STORAGE_VERSION };
const obj2 = require(491) /* v1 */;
importDefault(686).dispatch({ type: "AD_SESSION_RESET" });
tmp5 = obj;
2026-07-20 16:05:17 +00:00
};
export function clearAdSession() {
2026-07-23 10:11:24 +00:00
let c4 = null;
2026-07-20 16:05:17 +00:00
}
export function getCurrentAdSession() {
2026-07-23 10:11:24 +00:00
return c4;
2026-07-20 16:05:17 +00:00
}
export { isAdSessionExpired };