decord/source/modules/rewards/ProgramRewardsUtils.tsx

117 lines
4.2 KiB
TypeScript
Raw Normal View History

2026-07-28 08:39:19 +00:00
// Module ID: 12759
// Function ID: 99106
2026-07-20 16:05:17 +00:00
// Name: isEligibleForProgramReward
2026-07-28 08:39:19 +00:00
// Dependencies: [1850, 1852, 3588, 12756, 12760, 5794, 12761, 3811, 2]
2026-07-20 16:05:17 +00:00
// Exports: canFetchAnyProgramReward, canFetchNitroProgramReward, canFetchXboxProgramReward, isProgramRewardStale, useIsEligibleForProgramReward
2026-07-28 08:39:19 +00:00
// Module 12759 (isEligibleForProgramReward)
2026-07-23 10:11:24 +00:00
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import { PremiumTypes } from "GuildFeatures";
const require = arg1;
2026-07-20 16:05:17 +00:00
function isEligibleForProgramReward(NITRO, canUseMonthlyOrbs) {
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
2026-07-28 08:39:19 +00:00
if (require(12756) /* RewardProgram */.RewardProgram.NITRO === NITRO) {
return require(12760) /* PremiumRewardsOrbsTreatment */.getPremiumRewardsOrbsExperiment(str).isInTreatment;
} else if (require(12756) /* RewardProgram */.RewardProgram.XBOX === NITRO) {
return require(5794) /* apexExperiment */.getIsCrepeEnabled(str);
2026-07-20 16:05:17 +00:00
} else {
return false;
}
}
function canFetchNitroProgramReward(canUseMonthlyOrbs) {
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
2026-07-28 08:39:19 +00:00
let tmp = isEligibleForProgramReward(require(12756) /* RewardProgram */.RewardProgram.NITRO, str);
2026-07-20 16:05:17 +00:00
if (tmp) {
tmp = hasNecessaryPremiumSubscriptionStatus();
}
return tmp;
}
function canFetchXboxProgramReward(canUseMonthlyOrbs) {
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
2026-07-28 08:39:19 +00:00
let result = isEligibleForProgramReward(require(12756) /* RewardProgram */.RewardProgram.XBOX, str);
2026-07-20 16:05:17 +00:00
if (result) {
2026-07-28 08:39:19 +00:00
result = require(12761) /* hasCrepeMonthlyOrbsPerk */.hasCrepeMonthlyOrbsPerk(authStore.getCurrentUser());
const obj = require(12761) /* hasCrepeMonthlyOrbsPerk */;
2026-07-20 16:05:17 +00:00
}
return result;
}
function hasNecessaryPremiumSubscriptionStatus(currentUser) {
if (null == currentUser) {
currentUser = authStore.getCurrentUser();
}
2026-07-28 08:39:19 +00:00
return require(3811) /* _createForOfIteratorHelperLoose */.isPremiumExactly(currentUser, PremiumTypes.TIER_2);
2026-07-20 16:05:17 +00:00
}
2026-07-28 08:39:19 +00:00
let closure_5 = { [arg1(12756).RewardProgram.NITRO]: canFetchNitroProgramReward, [arg1(12756).RewardProgram.XBOX]: canFetchXboxProgramReward };
2026-07-23 10:11:24 +00:00
let result = require("isPast").fileFinishedImporting("modules/rewards/ProgramRewardsUtils.tsx");
2026-07-20 16:05:17 +00:00
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;
if (tmp) {
tmp = "" !== next_reward_date;
}
if (tmp) {
const _Date = Date;
const date = new Date(next_reward_date);
2026-07-28 08:39:19 +00:00
tmp = importDefault(3588)(date);
const tmp4 = importDefault(3588);
2026-07-20 16:05:17 +00:00
}
return tmp;
}
};
export { isEligibleForProgramReward };
export const useIsEligibleForProgramReward = function useIsEligibleForProgramReward(arg0, location) {
let str = location;
if (location === undefined) {
str = "ProgramRewardsUtils";
}
2026-07-28 08:39:19 +00:00
const obj = require(12760) /* PremiumRewardsOrbsTreatment */;
const isCrepeEnabled = require(5794) /* apexExperiment */.useIsCrepeEnabled(str);
if (require(12756) /* RewardProgram */.RewardProgram.NITRO === arg0) {
2026-07-20 16:05:17 +00:00
return obj.usePremiumRewardsOrbsExperiment(str).isInTreatment;
2026-07-28 08:39:19 +00:00
} else if (require(12756) /* RewardProgram */.RewardProgram.XBOX === arg0) {
2026-07-20 16:05:17 +00:00
return isCrepeEnabled;
} else {
return false;
}
2026-07-28 08:39:19 +00:00
const obj2 = require(5794) /* apexExperiment */;
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";
}
2026-07-28 08:39:19 +00:00
const values = Object.values(require(12756) /* RewardProgram */.RewardProgram);
2026-07-20 16:05:17 +00:00
let num = 0;
if (0 < values.length) {
while (true) {
let tmp = values[num];
if ("number" === typeof tmp) {
2026-07-23 10:11:24 +00:00
let tmp2 = dependencyMap;
if (dependencyMap[tmp](str)) {
2026-07-20 16:05:17 +00:00
break;
}
}
num = num + 1;
}
return true;
}
return false;
};
export { hasNecessaryPremiumSubscriptionStatus };