decord/alpha/source/modules/billing/hooks/useFPDurationLeft.tsx

161 lines
5.1 KiB
TypeScript
Raw Normal View History

2026-10-08 09:57:35 +00:00
// Module ID: 13587
// Function ID: 13588
// Name: useFPDurationLeft
2026-10-08 09:57:35 +00:00
// Dependencies: [558, 576, 1126, 7150, 4750, 1254, 2]
2026-07-20 16:05:17 +00:00
2026-10-08 09:57:35 +00:00
// Module 13587 (useFPDurationLeft)
2026-10-03 08:58:59 +00:00
import react from "react" /* 576 */;
import intl from "intl" /* 1126 */;
2026-10-08 09:57:35 +00:00
import DateUtils from "DateUtils" /* 4750 */;
import useCountdownDefault from "useCountdown" /* 7150 */;
2026-10-03 08:58:59 +00:00
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
2026-10-03 08:58:59 +00:00
let tmp10;
2026-10-08 09:57:35 +00:00
const SentryUtilsDefault = tmp10(1254);
2026-07-20 16:05:17 +00:00
function roundFPCountdownUnits(arg0) {
2026-10-03 08:58:59 +00:00
let num7;
const time = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(arg0);
if (time.seconds > 0) {
time.minutes = time.minutes + 1;
time.seconds = 0;
2026-07-20 16:05:17 +00:00
}
if (60 === time.minutes) {
time.hours = time.hours + 1;
time.minutes = 0;
2026-07-20 16:05:17 +00:00
}
if (24 === time.hours) {
time.days = time.days + 1;
time.hours = 0;
2026-07-20 16:05:17 +00:00
}
if (time.days > 0) {
2026-10-03 08:58:59 +00:00
let days;
if (time.hours > 0) {
2026-10-03 08:58:59 +00:00
days = time.days + 1;
2026-07-20 16:05:17 +00:00
} else {
days = time.days;
2026-07-20 16:05:17 +00:00
}
const time1 = { days, hours: 0, minutes: 0, seconds: 0 };
return time1;
} else if (time.hours > 0) {
2026-10-03 08:58:59 +00:00
let hours;
let time2;
if (time.minutes > 45) {
2026-10-03 08:58:59 +00:00
hours = time.hours + 1;
2026-07-20 16:05:17 +00:00
} else {
hours = time.hours;
2026-07-20 16:05:17 +00:00
}
if (hours > 11) {
2026-10-03 08:58:59 +00:00
time2 = { days: 1, hours: 0, minutes: 0, seconds: 0 };
2026-07-20 16:05:17 +00:00
} else {
time2 = { days: 0, hours, minutes: 0, seconds: 0 };
2026-07-20 16:05:17 +00:00
}
return time2;
} else if (time.minutes > 0) {
2026-07-20 16:05:17 +00:00
let num5 = 0;
if (time.minutes > 45) {
2026-07-20 16:05:17 +00:00
num5 = 1;
}
2026-10-03 08:58:59 +00:00
const time3 = { days: 0, hours: num5, minutes: num7, seconds: 0 };
num7 = 0;
2026-07-20 16:05:17 +00:00
if (1 !== num5) {
num7 = time.minutes;
2026-07-20 16:05:17 +00:00
}
return time3;
2026-07-20 16:05:17 +00:00
} else {
let time4 = time;
if (time.seconds > 0) {
time4 = { days: 0, hours: 0, minutes: 1, seconds: 0 };
2026-07-20 16:05:17 +00:00
}
return time4;
2026-07-20 16:05:17 +00:00
}
}
const CountDownMessageTypes = { SHORT_TIME_LEFT: 0, [0]: "SHORT_TIME_LEFT", LONG_TIME_LEFT: 1, [1]: "LONG_TIME_LEFT", ENDS_IN: 2, [2]: "ENDS_IN", SHORT_TIME: 3, [3]: "SHORT_TIME", CREDITS_ENDS_IN: 4, [4]: "CREDITS_ENDS_IN" };
2026-10-08 09:57:35 +00:00
const tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? (function useFPDurationLeft(toDate, arg1) {
2026-10-03 08:58:59 +00:00
let time4;
const obj = react;
const cResult = obj.c(2);
2026-07-20 16:05:17 +00:00
if (obj.SHORT_TIME_LEFT === arg1) {
2026-10-03 08:58:59 +00:00
const time = { days: intl.t["/wnvqA"], hours: intl.t.Jsq0XN, minutes: intl.t["SBd+Bs"] };
time4 = time;
} else if (obj.LONG_TIME_LEFT === arg1) {
const time1 = { days: intl.t.UD5nn5, hours: intl.t.Hg8Fee, minutes: intl.t.XSbQZZ };
time4 = time1;
} else if (obj.ENDS_IN === arg1) {
const time2 = { days: intl.t.rLqNad, hours: intl.t.d1LvCA, minutes: intl.t.Z2LX7K };
time4 = time2;
} else if (obj.CREDITS_ENDS_IN === arg1) {
const time3 = { days: intl.t.xQ3zuN, hours: intl.t.SFU7QN, minutes: intl.t.Y4FNdL };
time4 = time3;
} else if (obj.SHORT_TIME === arg1) {
time4 = { days: intl.t.fYmirx, hours: intl.t["C3RO+g"], minutes: intl.t.r77oHc };
2026-07-20 16:05:17 +00:00
} else {
2026-10-03 08:58:59 +00:00
const _Error = Error;
const _HermesInternal = HermesInternal;
const self = this;
const self2 = this;
const error = new Error("Unknown messageType (" + arg1 + ") when rendering time left");
throw error;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
if (cResult[0] !== toDate) {
cResult[0] = toDate;
cResult[1] = toDate.toDate();
const toDateResult = toDate.toDate();
}
let str3 = "";
try {
const tmpResult = DateUtils;
str3 = tmpResult.unitsAsStrings(tmp11, time4);
} catch (err) {
const tmp10Result = SentryUtilsDefault;
tmp10Result.captureMessage("Error trying to format string for fractional nitro duration pill");
}
return str3;
2026-10-08 09:57:35 +00:00
}) : (function useFPDurationLeft(arg0, arg1) {
2026-10-03 08:58:59 +00:00
let time4;
let tmp7;
if (obj.SHORT_TIME_LEFT === arg1) {
const time = { days: intl.t["/wnvqA"], hours: intl.t.Jsq0XN, minutes: intl.t["SBd+Bs"] };
time4 = time;
tmp7 = require;
} else if (obj.LONG_TIME_LEFT === arg1) {
const time1 = { days: intl.t.UD5nn5, hours: intl.t.Hg8Fee, minutes: intl.t.XSbQZZ };
time4 = time1;
tmp7 = require;
} else if (obj.ENDS_IN === arg1) {
const time2 = { days: intl.t.rLqNad, hours: intl.t.d1LvCA, minutes: intl.t.Z2LX7K };
time4 = time2;
tmp7 = require;
} else if (obj.CREDITS_ENDS_IN === arg1) {
const time3 = { days: intl.t.xQ3zuN, hours: intl.t.SFU7QN, minutes: intl.t.Y4FNdL };
time4 = time3;
tmp7 = require;
} else if (obj.SHORT_TIME === arg1) {
time4 = { days: intl.t.fYmirx, hours: intl.t["C3RO+g"], minutes: intl.t.r77oHc };
tmp7 = require;
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const self = this;
const self2 = this;
const error = new Error("Unknown messageType (" + arg1 + ") when rendering time left");
throw error;
}
useCountdownDefault;
let str3 = "";
try {
2026-10-08 09:57:35 +00:00
const tmp7Result = tmp7(4750);
2026-10-03 08:58:59 +00:00
str3 = tmp7Result.unitsAsStrings(tmp18, time4);
} catch (err) {
const tmp16Result = SentryUtilsDefault;
tmp16Result.captureMessage("Error trying to format string for fractional nitro duration pill");
}
return str3;
});
const result = size.fileFinishedImporting("modules/billing/hooks/useFPDurationLeft.tsx");
export default tmp2;
export { CountDownMessageTypes };
2026-07-20 16:05:17 +00:00
export { roundFPCountdownUnits };