decord/source/modules/premium/hooks/useDiscountOffer.tsx

145 lines
4.9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 7664
// Function ID: 7665
2026-07-20 16:05:17 +00:00
// Name: useDiscountOffer
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 19, 1922, 7459, 1924, 589, 4042, 4263, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 7664 (useDiscountOffer)
import closure_2 from "_slicedToArray" /* 32 */;
import closure_3 from "noop" /* 19 */;
import closure_4 from "mergeGuildAvatar" /* 1922 */;
import closure_5 from "emitChanges" /* 7459 */;
import GuildFeatures from "GuildFeatures" /* 1924 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ PREMIUM_TIER_2_CHURN_1_MONTH_DISCOUNT_ID: closure_6, PREMIUM_TIER_2_CHURN_3_MONTH_DISCOUNT_ID: error } = GuildFeatures);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/premium/hooks/useDiscountOffer.tsx");
2026-07-20 16:05:17 +00:00
export default function useDiscountOffer(arg0, arg1) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-08-24 06:08:38 +00:00
const items = [closure_5];
stateFromStores = _require(stateFromStores[5]).useStateFromStores(items, () => closure_1_5.getUserDiscountOffer(closure_0));
2026-07-29 08:29:29 +00:00
let flag;
if (stateFromStores != null) {
flag = stateFromStores.hasExpired();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (flag == null) {
flag = false;
}
const tmp3 = first(React.useState(flag), 2);
first = tmp3[0];
React = tmp3[1];
2026-07-23 10:11:24 +00:00
const obj = _require(stateFromStores[5]);
2026-07-29 08:29:29 +00:00
const obj3 = React;
const tmp = _require;
const tmp2 = stateFromStores;
2026-08-24 06:08:38 +00:00
const items1 = [closure_4];
2026-07-20 16:05:17 +00:00
const items2 = [first, stateFromStores];
2026-07-29 08:29:29 +00:00
const stateFromStores1 = _require(stateFromStores[5]).useStateFromStores(items1, () => callback(stateFromStores[6]).isPremium(currentUser.getCurrentUser()));
const effect = obj3.useEffect(() => {
let hasAcknowledgedResult;
if (stateFromStores != null) {
hasAcknowledgedResult = obj.hasAcknowledged();
}
if (hasAcknowledgedResult) {
const timeout = new callback(stateFromStores[7]).Timeout();
let hasAcknowledgedResult1;
if (obj != null) {
hasAcknowledgedResult1 = obj.hasAcknowledged();
}
if (hasAcknowledgedResult1) {
let num = 0;
if (null != obj.expiresAt) {
const expiresAt = obj.expiresAt;
const _Date = Date;
const time = expiresAt.getTime();
num = time - Date.now();
}
timeout.start(num, () => {
2026-08-24 06:08:38 +00:00
if (!closure_1_2) {
if (closure_1_1.hasExpired()) {
closure_1_3(true);
2026-07-29 08:29:29 +00:00
}
}
let hasAcknowledgedResult;
2026-08-24 06:08:38 +00:00
if (closure_1_1 != null) {
2026-07-29 08:29:29 +00:00
hasAcknowledgedResult = obj.hasAcknowledged();
}
if (hasAcknowledgedResult) {
let num = 0;
if (null != obj.expiresAt) {
let expiresAt = obj.expiresAt;
let _Date = Date;
let time = expiresAt.getTime();
num = time - Date.now();
}
if (closure_0 != null) {
obj2.start(num, () => {
2026-08-24 06:08:38 +00:00
if (!closure_1_2) {
if (closure_1_1.hasExpired()) {
closure_1_3(true);
2026-07-29 08:29:29 +00:00
}
}
let hasAcknowledgedResult;
2026-08-24 06:08:38 +00:00
if (closure_1_1 != null) {
2026-07-29 08:29:29 +00:00
hasAcknowledgedResult = obj.hasAcknowledged();
}
if (hasAcknowledgedResult) {
let num = 0;
if (null != obj.expiresAt) {
let expiresAt = obj.expiresAt;
let _Date = Date;
let time = expiresAt.getTime();
num = time - Date.now();
}
if (closure_0 != null) {
obj2.start(num, () => {
2026-08-24 06:08:38 +00:00
if (!closure_1_2) {
if (closure_1_1.hasExpired()) {
closure_1_3(true);
2026-07-29 08:29:29 +00:00
}
}
let hasAcknowledgedResult;
2026-08-24 06:08:38 +00:00
if (closure_1_1 != null) {
2026-07-29 08:29:29 +00:00
hasAcknowledgedResult = obj.hasAcknowledged();
}
if (hasAcknowledgedResult) {
let num = 0;
if (null != obj.expiresAt) {
let expiresAt = obj.expiresAt;
let _Date = Date;
let time = expiresAt.getTime();
num = time - Date.now();
}
if (closure_0 != null) {
obj2.start(num, () => { ... });
}
obj2 = closure_0;
}
});
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj2 = closure_0;
}
});
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj2 = closure_0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
});
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return () => timeout.stop();
2026-07-20 16:05:17 +00:00
}
}, items2);
2026-07-29 08:29:29 +00:00
let tmp7 = null;
2026-07-20 16:05:17 +00:00
if (!first) {
if (stateFromStores1) {
if (!arg1) {
if (arg0 !== closure_6) {
2026-07-29 08:29:29 +00:00
tmp7 = null;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
tmp7 = stateFromStores;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp7;
2026-07-20 16:05:17 +00:00
};