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

70 lines
2.6 KiB
TypeScript
Raw Permalink Normal View History

2026-10-13 12:43:34 +00:00
// Module ID: 14356
// Function ID: 14357
// Name: ProgramRewardsUtils
2026-10-13 12:43:34 +00:00
// Dependencies: [1390, 1392, 4543, 14357, 14358, 4769, 2]
2026-10-08 09:57:35 +00:00
// Exports: canFetchAnyProgramReward, canFetchNitroProgramReward, canFetchXboxProgramReward, hasNecessaryPremiumSubscriptionStatus, isProgramRewardStale
2026-07-20 16:05:17 +00:00
2026-10-13 12:43:34 +00:00
// Module 14356 (ProgramRewardsUtils)
2026-10-09 10:00:15 +00:00
import PremiumConstants from "PremiumConstants" /* 1392 */;
2026-10-10 08:08:14 +00:00
import isPastDefault from "isPast" /* 4543 */;
import PremiumUtils from "PremiumUtils" /* 4769 */;
2026-10-13 12:43:34 +00:00
import useHasXboxMonthlyOrbsPerk from "useHasXboxMonthlyOrbsPerk" /* 14357 */;
import ProgramRewardsTypes from "ProgramRewardsTypes" /* 14358 */;
2026-10-09 10:00:15 +00:00
import UserStore from "UserStore" /* 1390 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-08 09:57:35 +00:00
function canFetchNitroProgramReward() {
const currentUser = UserStore.getCurrentUser();
const obj = PremiumUtils;
2026-10-03 08:58:59 +00:00
return obj.isPremiumExactly(currentUser, PremiumTypes.TIER_2);
}
2026-10-08 09:57:35 +00:00
function canFetchXboxProgramReward() {
const obj = useHasXboxMonthlyOrbsPerk;
return obj.hasCrepeMonthlyOrbsPerk(UserStore.getCurrentUser());
}
const PremiumTypes = PremiumConstants.PremiumTypes;
let closure_5 = { [ProgramRewardsTypes.RewardProgram.NITRO]: canFetchNitroProgramReward, [ProgramRewardsTypes.RewardProgram.XBOX]: canFetchXboxProgramReward };
2026-10-03 08:58:59 +00:00
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
};
export { canFetchNitroProgramReward };
export { canFetchXboxProgramReward };
2026-10-08 09:57:35 +00:00
export const canFetchAnyProgramReward = function canFetchAnyProgramReward() {
const values = Object.values(ProgramRewardsTypes.RewardProgram);
2026-10-08 09:57:35 +00:00
for (const item10014 of values) {
if (typeof item10014 === "number") {
if (closure_5[tmp2]()) {
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-08 09:57:35 +00:00
export const hasNecessaryPremiumSubscriptionStatus = function hasNecessaryPremiumSubscriptionStatus(stateFromStores) {
let currentUser = stateFromStores;
if (stateFromStores == null) {
currentUser = UserStore.getCurrentUser();
}
const obj = PremiumUtils;
return obj.isPremiumExactly(currentUser, PremiumTypes.TIER_2);
};