decord/source/modules/premium/powerups/utils/getBoostLifecyclePhase.tsx

49 lines
1.5 KiB
TypeScript
Raw Normal View History

// Module ID: 12724
// Function ID: 12725
// Name: getBoostLifecyclePhase
2026-07-29 08:29:29 +00:00
// Dependencies: [11, 2]
2026-07-20 16:05:17 +00:00
// Exports: getBoostLifecycleInfo, getBoostLifecycleTimestamp
// Module 12724 (getBoostLifecyclePhase)
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
2026-07-29 08:29:29 +00:00
let c2 = 259200000;
const result = size.fileFinishedImporting("modules/premium/powerups/utils/getBoostLifecyclePhase.tsx");
2026-07-20 16:05:17 +00:00
export const BOOST_EXPIRING_DISPLAY_WINDOW_DAYS = 3;
export const BOOST_EXPIRING_DISPLAY_WINDOW_MS = 259200000;
export const getBoostLifecycleInfo = function getBoostLifecycleInfo(ended, arg1) {
2026-07-20 16:05:17 +00:00
if (!ended.ended) {
if (null != ended.endsAt) {
const endsAt = ended.endsAt;
2026-07-29 08:29:29 +00:00
return { phase: "expired" };
2026-07-20 16:05:17 +00:00
}
if (null != ended.endsAt) {
const endsAt2 = ended.endsAt;
if (endsAt2.getTime() - arg1 <= c2) {
const obj2 = { phase: "expiring", endsAt: ended.endsAt };
2026-07-20 16:05:17 +00:00
}
}
}
};
export const getBoostLifecycleTimestamp = function getBoostLifecycleTimestamp(id, boostLifecycleInfo) {
const phase = boostLifecycleInfo.phase;
if ("gave" === phase) {
return SnowflakeUtilsDefault.extractTimestamp(id.id);
2026-07-20 16:05:17 +00:00
} else if ("expiring" === phase) {
const endsAt2 = boostLifecycleInfo.endsAt;
2026-07-29 08:29:29 +00:00
return endsAt2.getTime() - c2;
2026-07-20 16:05:17 +00:00
} else if ("expired" === phase) {
const endsAt = id.endsAt;
let time;
2026-07-29 08:29:29 +00:00
if (endsAt != null) {
2026-07-20 16:05:17 +00:00
time = endsAt.getTime();
}
2026-07-29 08:29:29 +00:00
if (time == null) {
time = SnowflakeUtilsDefault.extractTimestamp(id.id);
2026-07-20 16:05:17 +00:00
}
return time;
}
};