decord/source/modules/rewards/ProgramRewardsUtils.tsx
github-actions 67d978d9fb chore: update source for alpha 346.0
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9672_m.js (378.6 MB)
2026-09-07 16:44:02 +00:00

149 lines
5.1 KiB
TypeScript

// Module ID: 13730
// Function ID: 13731
// Name: canFetchNitroProgramReward
// Dependencies: [1371, 1373, 3994, 13731, 13734, 7556, 13735, 4218, 2]
// Exports: canFetchAnyProgramReward, canFetchNitroProgramReward, canFetchXboxProgramReward, hasNecessaryPremiumSubscriptionStatus, isEligibleForProgramReward, isProgramRewardStale, useIsEligibleForProgramReward
// Module 13730 (canFetchNitroProgramReward)
import isPastDefault from "isPast" /* 3994 */;
import getPremiumPlanItem from "getPremiumPlanItem" /* 4218 */;
import apexExperiment from "apexExperiment" /* 7556 */;
import RewardProgram from "RewardProgram" /* 13731 */;
import PremiumRewardsOrbsTreatment from "PremiumRewardsOrbsTreatment" /* 13734 */;
import closure_3 from "mergeGuildAvatar" /* 1371 */;
import { PremiumTypes } from "GuildFeatures" /* 1373 */;
require = arg1;
function canFetchNitroProgramReward(canUseMonthlyOrbs) {
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
const NITRO = RewardProgram.RewardProgram.NITRO;
if (str === undefined) {
str = "ProgramRewardsUtils";
}
if (RewardProgram.RewardProgram.NITRO === NITRO) {
let tmpResult = tmp(13734);
let flag = tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
} else {
flag = false;
if (tmp(13731).RewardProgram.XBOX === NITRO) {
tmpResult = tmp(7556);
flag = tmpResult.getIsXboxGamePassPerksEnabled(str);
}
}
if (flag) {
const currentUser = authStore.getCurrentUser();
flag = tmp(4218).isPremiumExactly(currentUser, PremiumTypes.TIER_2);
const tmpResult1 = tmp(4218);
}
return flag;
}
function canFetchXboxProgramReward(canUseMonthlyOrbs) {
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
const XBOX = RewardProgram.RewardProgram.XBOX;
if (str === undefined) {
str = "ProgramRewardsUtils";
}
if (RewardProgram.RewardProgram.NITRO === XBOX) {
let tmpResult = tmp(13734);
let flag = tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
} else {
flag = false;
if (tmp(13731).RewardProgram.XBOX === XBOX) {
tmpResult = tmp(7556);
flag = tmpResult.getIsXboxGamePassPerksEnabled(str);
}
}
if (flag) {
flag = tmp(13735).hasCrepeMonthlyOrbsPerk(authStore.getCurrentUser());
const tmpResult1 = tmp(13735);
}
return flag;
}
let closure_5 = { [arg1(13731).RewardProgram.NITRO]: canFetchNitroProgramReward, [arg1(13731).RewardProgram.XBOX]: canFetchXboxProgramReward };
const result = require("set").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;
if (tmp) {
tmp = "" !== next_reward_date;
}
if (tmp) {
const _Date = Date;
const date = new Date(next_reward_date);
tmp = isPastDefault(date);
const tmp4 = isPastDefault;
}
return tmp;
}
};
export const isEligibleForProgramReward = function isEligibleForProgramReward(arg0, canUseMonthlyOrbs) {
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
if (RewardProgram.RewardProgram.NITRO === arg0) {
let tmpResult = tmp(13734);
return tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
} else if (tmp(13731).RewardProgram.XBOX === arg0) {
tmpResult = tmp(7556);
return tmpResult.getIsXboxGamePassPerksEnabled(str);
} else {
return false;
}
};
export const useIsEligibleForProgramReward = function useIsEligibleForProgramReward(arg0, location) {
let str = location;
if (location === undefined) {
str = "ProgramRewardsUtils";
}
const obj = PremiumRewardsOrbsTreatment;
const tmp = require;
const isXboxGamePassPerksEnabled = apexExperiment.useIsXboxGamePassPerksEnabled(str);
if (RewardProgram.RewardProgram.NITRO === arg0) {
return obj.usePremiumRewardsOrbsExperiment(str).isInTreatment;
} else if (RewardProgram.RewardProgram.XBOX === arg0) {
return isXboxGamePassPerksEnabled;
} else {
return false;
}
const obj2 = apexExperiment;
};
export { canFetchNitroProgramReward };
export { canFetchXboxProgramReward };
export const canFetchAnyProgramReward = function canFetchAnyProgramReward(ProgramRewardsStore) {
let str = ProgramRewardsStore;
if (ProgramRewardsStore === undefined) {
str = "ProgramRewardsUtils";
}
const values = Object.values(RewardProgram.RewardProgram);
for (const item10015 of values) {
if (typeof item10015 === "number") {
let tmp4 = dependencyMap;
let tmp5 = item10015;
if (dependencyMap[tmp2](str)) {
let tmp3 = obj;
obj.return();
let flag = true;
return true;
}
}
continue;
}
return false;
};
export const hasNecessaryPremiumSubscriptionStatus = function hasNecessaryPremiumSubscriptionStatus(currentUser) {
if (currentUser == null) {
currentUser = authStore.getCurrentUser();
}
return getPremiumPlanItem.isPremiumExactly(currentUser, PremiumTypes.TIER_2);
};