decord/alpha/source/modules/rewards/ProgramRewardsUtils.tsx

166 lines
5.5 KiB
TypeScript
Raw Normal View History

2026-10-03 08:58:59 +00:00
// Module ID: 13535
// Function ID: 13536
// Name: ProgramRewardsUtils
2026-10-03 08:58:59 +00:00
// Dependencies: [1377, 1379, 4302, 13536, 13539, 558, 13540, 4528, 2]
// Exports: canFetchAnyProgramReward, canFetchNitroProgramReward, canFetchXboxProgramReward, hasNecessaryPremiumSubscriptionStatus, isEligibleForProgramReward, isProgramRewardStale
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
// Module 13535 (ProgramRewardsUtils)
import PremiumConstants from "PremiumConstants" /* 1379 */;
import isPastDefault from "isPast" /* 4302 */;
import PremiumUtils from "PremiumUtils" /* 4528 */;
import ProgramRewardsTypes from "ProgramRewardsTypes" /* 13536 */;
import PremiumRewardsOrbsExperiment from "PremiumRewardsOrbsExperiment" /* 13539 */;
import useHasXboxMonthlyOrbsPerk from "useHasXboxMonthlyOrbsPerk" /* 13540 */;
import UserStore from "UserStore" /* 1377 */;
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const PremiumTypes = PremiumConstants.PremiumTypes;
function canFetchNitroProgramReward(ProgramRewardsUtils) {
2026-10-03 08:58:59 +00:00
let flag;
let str = ProgramRewardsUtils;
if (ProgramRewardsUtils === undefined) {
2026-07-20 16:05:17 +00:00
str = "ProgramRewardsUtils";
}
const NITRO = ProgramRewardsTypes.RewardProgram.NITRO;
2026-07-29 08:29:29 +00:00
if (str === undefined) {
2026-07-20 16:05:17 +00:00
str = "ProgramRewardsUtils";
}
if (ProgramRewardsTypes.RewardProgram.NITRO === NITRO) {
2026-10-03 08:58:59 +00:00
const tmpResult = PremiumRewardsOrbsExperiment;
flag = tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
2026-07-29 08:29:29 +00:00
} else {
flag = false;
2026-10-03 08:58:59 +00:00
if (ProgramRewardsTypes.RewardProgram.XBOX === NITRO) {
flag = true;
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (flag) {
const currentUser = UserStore.getCurrentUser();
2026-10-03 08:58:59 +00:00
const tmpResult2 = PremiumUtils;
flag = tmpResult2.isPremiumExactly(currentUser, PremiumTypes.TIER_2);
2026-07-29 08:29:29 +00:00
}
return flag;
2026-07-20 16:05:17 +00:00
}
function canFetchXboxProgramReward(ProgramRewardsUtils) {
2026-10-03 08:58:59 +00:00
let flag;
let str = ProgramRewardsUtils;
if (ProgramRewardsUtils === undefined) {
2026-07-20 16:05:17 +00:00
str = "ProgramRewardsUtils";
}
const XBOX = ProgramRewardsTypes.RewardProgram.XBOX;
2026-07-29 08:29:29 +00:00
if (str === undefined) {
str = "ProgramRewardsUtils";
2026-07-20 16:05:17 +00:00
}
if (ProgramRewardsTypes.RewardProgram.NITRO === XBOX) {
2026-10-03 08:58:59 +00:00
const tmpResult = PremiumRewardsOrbsExperiment;
flag = tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
2026-07-29 08:29:29 +00:00
} else {
flag = false;
2026-10-03 08:58:59 +00:00
if (ProgramRewardsTypes.RewardProgram.XBOX === XBOX) {
flag = true;
2026-07-29 08:29:29 +00:00
}
}
if (flag) {
2026-10-03 08:58:59 +00:00
const tmpResult2 = useHasXboxMonthlyOrbsPerk;
flag = tmpResult2.hasCrepeMonthlyOrbsPerk(UserStore.getCurrentUser());
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
let obj = {};
const tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0, arg1) => {
let str = "ProgramRewardsUtils";
if (undefined !== arg1) {
str = arg1;
}
obj = PremiumRewardsOrbsExperiment;
const isInTreatment = obj.usePremiumRewardsOrbsExperiment(str).isInTreatment;
if (ProgramRewardsTypes.RewardProgram.NITRO === arg0) {
return isInTreatment;
} else if (ProgramRewardsTypes.RewardProgram.XBOX === arg0) {
2026-07-20 16:05:17 +00:00
return true;
} else {
2026-10-03 08:58:59 +00:00
return false;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
}) : ((arg0) => {
let str = arg1;
if (arg1 === undefined) {
2026-07-29 08:29:29 +00:00
str = "ProgramRewardsUtils";
}
2026-10-03 08:58:59 +00:00
obj = PremiumRewardsOrbsExperiment;
const isInTreatment = obj.usePremiumRewardsOrbsExperiment(str).isInTreatment;
if (ProgramRewardsTypes.RewardProgram.NITRO === arg0) {
2026-10-03 08:58:59 +00:00
return isInTreatment;
} else if (ProgramRewardsTypes.RewardProgram.XBOX === arg0) {
return true;
2026-07-29 08:29:29 +00:00
} else {
return false;
}
2026-10-03 08:58:59 +00:00
});
function isEligibleForProgramReward(arg0, ProgramRewardsUtils) {
let str = ProgramRewardsUtils;
if (ProgramRewardsUtils === undefined) {
2026-07-20 16:05:17 +00:00
str = "ProgramRewardsUtils";
}
if (ProgramRewardsTypes.RewardProgram.NITRO === arg0) {
2026-10-03 08:58:59 +00:00
const tmpResult = PremiumRewardsOrbsExperiment;
return tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
} else if (ProgramRewardsTypes.RewardProgram.XBOX === arg0) {
return true;
2026-07-20 16:05:17 +00:00
} else {
return false;
}
2026-10-03 08:58:59 +00:00
}
function hasNecessaryPremiumSubscriptionStatus(stateFromStores) {
let currentUser = stateFromStores;
if (stateFromStores == null) {
currentUser = UserStore.getCurrentUser();
}
obj = PremiumUtils;
return obj.isPremiumExactly(currentUser, PremiumTypes.TIER_2);
}
obj[ProgramRewardsTypes.RewardProgram.NITRO] = canFetchNitroProgramReward;
obj[ProgramRewardsTypes.RewardProgram.XBOX] = canFetchXboxProgramReward;
const result = size.fileFinishedImporting("modules/rewards/ProgramRewardsUtils.tsx");
export const isProgramRewardStale = function isProgramRewardStale(next_reward_date) {
if (null == next_reward_date) {
return true;
} else {
next_reward_date = next_reward_date.next_reward_date;
let tmp = null != next_reward_date && "" !== next_reward_date;
if (tmp) {
const _Date = Date;
const self = this;
const self2 = this;
const tmp4 = isPastDefault;
const date = new Date(next_reward_date);
tmp = tmp4(date);
}
return tmp;
}
2026-07-20 16:05:17 +00:00
};
2026-10-03 08:58:59 +00:00
export { isEligibleForProgramReward };
export const useIsEligibleForProgramReward = tmp2;
2026-07-20 16:05:17 +00:00
export { canFetchNitroProgramReward };
export { canFetchXboxProgramReward };
export const canFetchAnyProgramReward = function canFetchAnyProgramReward(ProgramRewardsStore) {
let str = ProgramRewardsStore;
if (ProgramRewardsStore === undefined) {
str = "ProgramRewardsUtils";
}
const values = Object.values(ProgramRewardsTypes.RewardProgram);
2026-07-29 08:29:29 +00:00
for (const item10015 of values) {
2026-08-04 21:03:28 +00:00
if (typeof item10015 === "number") {
2026-10-03 08:58:59 +00:00
if (obj[tmp2](str)) {
2026-07-29 08:29:29 +00:00
obj.return();
let flag = true;
return true;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
return false;
};
2026-10-03 08:58:59 +00:00
export { hasNecessaryPremiumSubscriptionStatus };