decord/source/modules/analytics_sessions/SessionAdGenerator.tsx
github-actions 7450227d0b chore: update source for alpha 345.4
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9596_m.js (380.6 MB)
2026-09-04 17:41:35 +00:00

71 lines
2.6 KiB
TypeScript

// Module ID: 7654
// Function ID: 7655
// Name: getOrRefreshAdSession
// Dependencies: [684, 511, 7405, 706, 1205, 2]
// Exports: clearAdSession, getCurrentAdSession, getOrRefreshAdSession, isAdSessionExpired
// Module 7654 (getOrRefreshAdSession)
import v1 from "v1" /* 511 */;
import setDefault from "set" /* 684 */;
import dispatcherDefault from "dispatcher" /* 706 */;
import _modDef1205 from "module_1205" /* 1205 */;
import result2 from "result" /* 7405 */;
require = arg1;
let closure_3 = 12 * setDefault.Millis.HOUR;
let c4 = null;
const result = require("set").fileFinishedImporting("modules/analytics_sessions/SessionAdGenerator.tsx");
export const getOrRefreshAdSession = function getOrRefreshAdSession(shouldExtendSession) {
let flag = shouldExtendSession;
if (shouldExtendSession === undefined) {
flag = false;
}
const timestamp = Date.now();
if (null != obj) {
const _Date = Date;
const timestamp1 = Date.now();
if (timestamp1 < obj.createdAtTimestamp) {
obj = _modDef1205;
obj = { category: "ad", message: null };
const _HermesInternal = HermesInternal;
obj[1] = "future facing timestamp Date.now(): " + timestamp1 + ", initialized timestamp: " + tmp11.createdAtTimestamp;
obj.addBreadcrumb(obj);
let flag2 = true;
} else {
const diff = timestamp1 - tmp11.lastUsedTimestamp;
flag2 = diff > result2.SESSION_IDLE_TIMEOUT_MILLIS || timestamp1 - tmp11.createdAtTimestamp > closure_3;
}
if (!flag2) {
if (flag) {
obj.lastUsedTimestamp = timestamp;
}
let tmp9 = obj;
}
return tmp9;
}
obj = { uuid: v1.v4(), createdAtTimestamp: timestamp, lastUsedTimestamp: timestamp, version: result2.CLIENT_SESSION_STORAGE_VERSION };
const obj4 = v1;
dispatcherDefault.dispatch({ type: "AD_SESSION_RESET" });
tmp9 = obj;
};
export function clearAdSession() {
c4 = null;
}
export function getCurrentAdSession() {
return c4;
}
export const isAdSessionExpired = function isAdSessionExpired(createdAtTimestamp) {
const timestamp = Date.now();
if (timestamp < createdAtTimestamp.createdAtTimestamp) {
let obj = _modDef1205;
obj = { category: "ad", message: null };
const _HermesInternal = HermesInternal;
obj[1] = "future facing timestamp Date.now(): " + timestamp + ", initialized timestamp: " + createdAtTimestamp.createdAtTimestamp;
obj.addBreadcrumb(obj);
return true;
} else {
const diff = timestamp - createdAtTimestamp.lastUsedTimestamp;
return diff > result2.SESSION_IDLE_TIMEOUT_MILLIS || timestamp - createdAtTimestamp.createdAtTimestamp > closure_3;
}
};