decord/source/modules/rewards/ProgramRewardsUtils.tsx

145 lines
5 KiB
TypeScript
Raw Normal View History

2026-08-12 06:57:52 +00:00
// Module ID: 13052
// Function ID: 13053
2026-07-29 08:29:29 +00:00
// Name: canFetchNitroProgramReward
2026-08-13 07:00:46 +00:00
// Dependencies: [1922, 1924, 3784, 13053, 13056, 7063, 13057, 4007, 2]
2026-07-29 08:29:29 +00:00
// Exports: canFetchAnyProgramReward, canFetchNitroProgramReward, canFetchXboxProgramReward, hasNecessaryPremiumSubscriptionStatus, isEligibleForProgramReward, isProgramRewardStale, useIsEligibleForProgramReward
2026-07-20 16:05:17 +00:00
2026-08-12 06:57:52 +00:00
// Module 13052 (canFetchNitroProgramReward)
2026-07-29 08:29:29 +00:00
import mergeGuildAvatar from "mergeGuildAvatar";
2026-07-23 10:11:24 +00:00
import { PremiumTypes } from "GuildFeatures";
const require = arg1;
2026-07-29 08:29:29 +00:00
function canFetchNitroProgramReward(canUseMonthlyOrbs) {
2026-07-20 16:05:17 +00:00
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
2026-08-12 06:57:52 +00:00
const NITRO = require(13053) /* RewardProgram */.RewardProgram.NITRO;
2026-07-29 08:29:29 +00:00
if (str === undefined) {
2026-07-20 16:05:17 +00:00
str = "ProgramRewardsUtils";
}
2026-08-12 06:57:52 +00:00
if (require(13053) /* RewardProgram */.RewardProgram.NITRO === NITRO) {
let tmpResult = tmp(13056);
2026-07-29 08:29:29 +00:00
let flag = tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
} else {
flag = false;
2026-08-12 06:57:52 +00:00
if (tmp(13053).RewardProgram.XBOX === NITRO) {
2026-08-13 07:00:46 +00:00
tmpResult = tmp(7063);
2026-07-29 08:29:29 +00:00
flag = tmpResult.getIsCrepeEnabled(str);
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (flag) {
const currentUser = authStore.getCurrentUser();
2026-08-12 06:57:52 +00:00
flag = tmp(4007).isPremiumExactly(currentUser, PremiumTypes.TIER_2);
const tmpResult1 = tmp(4007);
2026-07-29 08:29:29 +00:00
}
return flag;
2026-07-20 16:05:17 +00:00
}
function canFetchXboxProgramReward(canUseMonthlyOrbs) {
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
2026-08-12 06:57:52 +00:00
const XBOX = require(13053) /* RewardProgram */.RewardProgram.XBOX;
2026-07-29 08:29:29 +00:00
if (str === undefined) {
str = "ProgramRewardsUtils";
2026-07-20 16:05:17 +00:00
}
2026-08-12 06:57:52 +00:00
if (require(13053) /* RewardProgram */.RewardProgram.NITRO === XBOX) {
let tmpResult = tmp(13056);
2026-07-29 08:29:29 +00:00
let flag = tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
} else {
flag = false;
2026-08-12 06:57:52 +00:00
if (tmp(13053).RewardProgram.XBOX === XBOX) {
2026-08-13 07:00:46 +00:00
tmpResult = tmp(7063);
2026-07-29 08:29:29 +00:00
flag = tmpResult.getIsCrepeEnabled(str);
}
}
if (flag) {
2026-08-12 06:57:52 +00:00
flag = tmp(13057).hasCrepeMonthlyOrbsPerk(authStore.getCurrentUser());
const tmpResult1 = tmp(13057);
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-08-12 06:57:52 +00:00
let closure_5 = { [arg1(13053).RewardProgram.NITRO]: canFetchNitroProgramReward, [arg1(13053).RewardProgram.XBOX]: canFetchXboxProgramReward };
2026-07-29 08:29:29 +00:00
const 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-08-12 06:57:52 +00:00
tmp = importDefault(3784)(date);
const tmp4 = importDefault(3784);
2026-07-20 16:05:17 +00:00
}
return tmp;
}
};
2026-07-29 08:29:29 +00:00
export const isEligibleForProgramReward = function isEligibleForProgramReward(arg0, canUseMonthlyOrbs) {
let str = canUseMonthlyOrbs;
if (canUseMonthlyOrbs === undefined) {
str = "ProgramRewardsUtils";
}
2026-08-12 06:57:52 +00:00
if (require(13053) /* RewardProgram */.RewardProgram.NITRO === arg0) {
let tmpResult = tmp(13056);
2026-07-29 08:29:29 +00:00
return tmpResult.getPremiumRewardsOrbsExperiment(str).isInTreatment;
2026-08-12 06:57:52 +00:00
} else if (tmp(13053).RewardProgram.XBOX === arg0) {
2026-08-13 07:00:46 +00:00
tmpResult = tmp(7063);
2026-07-29 08:29:29 +00:00
return tmpResult.getIsCrepeEnabled(str);
} else {
return false;
}
};
2026-07-20 16:05:17 +00:00
export const useIsEligibleForProgramReward = function useIsEligibleForProgramReward(arg0, location) {
let str = location;
if (location === undefined) {
str = "ProgramRewardsUtils";
}
2026-08-12 06:57:52 +00:00
const obj = require(13056) /* PremiumRewardsOrbsTreatment */;
2026-07-29 08:29:29 +00:00
const tmp = require;
2026-08-13 07:00:46 +00:00
const isCrepeEnabled = require(7063) /* apexExperiment */.useIsCrepeEnabled(str);
2026-08-12 06:57:52 +00:00
if (require(13053) /* RewardProgram */.RewardProgram.NITRO === arg0) {
2026-07-20 16:05:17 +00:00
return obj.usePremiumRewardsOrbsExperiment(str).isInTreatment;
2026-08-12 06:57:52 +00:00
} else if (tmp(13053).RewardProgram.XBOX === arg0) {
2026-07-20 16:05:17 +00:00
return isCrepeEnabled;
} else {
return false;
}
2026-08-13 07:00:46 +00:00
const obj2 = require(7063) /* 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-08-12 06:57:52 +00:00
const values = Object.values(require(13053) /* RewardProgram */.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-07-29 08:29:29 +00:00
let tmp4 = dependencyMap;
let tmp5 = item10015;
if (dependencyMap[tmp2](str)) {
let tmp3 = obj;
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-07-29 08:29:29 +00:00
export const hasNecessaryPremiumSubscriptionStatus = function hasNecessaryPremiumSubscriptionStatus(currentUser) {
if (currentUser == null) {
currentUser = authStore.getCurrentUser();
}
2026-08-12 06:57:52 +00:00
return require(4007) /* getPremiumPlanItem */.isPremiumExactly(currentUser, PremiumTypes.TIER_2);
2026-07-29 08:29:29 +00:00
};