/* Metro module 12573; source: modules/rewards/ProgramRewardsUtils.tsx; dependencies: [1878, 1880, 3579, 12574, 12570, 12576, 5136, 12577, 3802, 2] */ import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as PremiumConstantsModule from '../premium/PremiumConstants.tsx'; /* Metro dependency 1880 */ import * as PremiumUtilsModule from '../../utils/PremiumUtils.tsx'; /* Metro dependency 3802 */ import * as CrepeExperimentModule from '../croissant/crepe/CrepeExperiment.tsx'; /* Metro dependency 5136 */ import * as ProgramRewardsTypesModule from './ProgramRewardsTypes.tsx'; /* Metro dependency 12570 */ import * as UseVirtualCurrencyEnabledModule from '../virtual_currency/hooks/useVirtualCurrencyEnabled.tsx'; /* Metro dependency 12574 */ import * as PremiumRewardsOrbsExperimentModule from '../premium/tenure_reward/experiments/PremiumRewardsOrbsExperiment.tsx'; /* Metro dependency 12576 */ function _fun96324(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#96324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12763:6, offset: 0x0215aa4f, size: 299 bytes, params: 8, frame: 23 const env0_0 = require; const isEligibleForProgramReward2 = isEligibleForProgramReward; const canFetchNitroProgramReward2 = canFetchNitroProgramReward; const canFetchXboxProgramReward2 = canFetchXboxProgramReward; const hasNecessaryPremiumSubscriptionStatus2 = hasNecessaryPremiumSubscriptionStatus; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); object = {}; const RewardProgram = (ProgramRewardsTypesModule).RewardProgram; const NITRO = RewardProgram.NITRO; object[NITRO] = canFetchNitroProgramReward2; const XBOX = RewardProgram.XBOX; object[XBOX] = canFetchXboxProgramReward2; (FileImportTrackerModule).fileFinishedImporting('modules/rewards/ProgramRewardsUtils.tsx'); exports.isProgramRewardStale = isProgramRewardStale; exports.isEligibleForProgramReward = isEligibleForProgramReward2; exports.useIsEligibleForProgramReward = useIsEligibleForProgramReward; exports.canFetchNitroProgramReward = canFetchNitroProgramReward2; exports.canFetchXboxProgramReward = canFetchXboxProgramReward2; exports.canFetchAnyProgramReward = canFetchAnyProgramReward; exports.hasNecessaryPremiumSubscriptionStatus = hasNecessaryPremiumSubscriptionStatus2; function isEligibleForProgramReward(a0) { // fn#96325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12763:129, offset: 0x0215ab7a, size: 212 bytes, params: 2, frame: 18 let value = a1; const r3 = value !== undefined ? value : 'ProgramRewardsUtils'; const enabled = UseVirtualCurrencyEnabledModule.isVirtualCurrencyEnabled({location: r3}).enabled; const RewardProgram = (ProgramRewardsTypesModule).RewardProgram; const NITRO = RewardProgram.NITRO; if (NITRO === a0) { value = require(12576) /* metro dependency 12576: PremiumRewardsOrbsExperiment */; return value.getPremiumRewardsOrbsExperiment(r3).isInTreatment && enabled; } const XBOX = RewardProgram.XBOX; if (XBOX === a0) { value = require(5136) /* metro dependency 5136: CrepeExperiment */; value = value.getIsCrepeEnabled(r3); return value && enabled; } return false; } function canFetchNitroProgramReward() { // fn#96326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12763:452, offset: 0x0215ac4e, size: 73 bytes, params: 1, frame: 16 const value = a0; const r4 = value !== undefined ? value : 'ProgramRewardsUtils'; const isEligibleForProgramRewardBinding = isEligibleForProgramReward; const RewardProgram = (ProgramRewardsTypesModule).RewardProgram; const NITRO = RewardProgram.NITRO; return isEligibleForProgramRewardBinding(NITRO, r4) && hasNecessaryPremiumSubscriptionStatus(); } function canFetchXboxProgramReward() { // fn#96327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12763:619, offset: 0x0215ac97, size: 109 bytes, params: 1, frame: 16 var r0; var moduleValue; var hasCrepeMonthlyOrbsPerk; var userStoreBinding; const value = a0; const r3 = value !== undefined ? value : 'ProgramRewardsUtils'; const isEligibleForProgramRewardBinding = isEligibleForProgramReward; const RewardProgram = (ProgramRewardsTypesModule).RewardProgram; const XBOX = RewardProgram.XBOX; const isEligibleForProgramReward2 = isEligibleForProgramRewardBinding(XBOX, r3); if (isEligibleForProgramReward2) { moduleValue = require(12577) /* metro dependency 12577: useHasXboxMonthlyOrbsPerk */; hasCrepeMonthlyOrbsPerk = moduleValue.hasCrepeMonthlyOrbsPerk; userStoreBinding = UserStore; r0 = Reflect.apply(hasCrepeMonthlyOrbsPerk, moduleValue, [userStoreBinding.getCurrentUser()]); } else { r0 = isEligibleForProgramReward2; } return r0; } function hasNecessaryPremiumSubscriptionStatus(a0) { // fn#96328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12763:916, offset: 0x0215ad04, size: 74 bytes, params: 2, frame: 14 const r3 = a0 ?? UserStore.getCurrentUser(); const isPremiumExactly = PremiumUtilsModule.isPremiumExactly; const TIER_2 = PremiumTypes.TIER_2; return Reflect.apply(isPremiumExactly, PremiumUtilsModule, [r3, TIER_2]); } function isProgramRewardStale(a0) { // fn#96329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12763:1141, offset: 0x0215ad4e, size: 100 bytes, params: 2, frame: 14 var Date; var value2; var date; if (a0 == null) { return true; } const next_reward_date = a0.next_reward_date; let value = next_reward_date != null; let r0 = value && next_reward_date !== ''; if (r0) { value = importDefault(3579) /* metro dependency 3579 */; Date = global.Date; value2 = Object.create(Date.prototype, {constructor: {value: Date}}); date = new Date(next_reward_date); value = value(date instanceof Object ? date : value2); r0 = value; } return r0; } function useIsEligibleForProgramReward(a0) { // fn#96330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12763:1353, offset: 0x0215adb2, size: 196 bytes, params: 2, frame: 19 const value = a1; const r10 = value !== undefined ? value : 'ProgramRewardsUtils'; const usePremiumRewardsOrbsExperiment = PremiumRewardsOrbsExperimentModule.usePremiumRewardsOrbsExperiment; const isInTreatment = Reflect.apply(usePremiumRewardsOrbsExperiment, PremiumRewardsOrbsExperimentModule, [r10]).isInTreatment; const value2 = (CrepeExperimentModule).useIsCrepeEnabled(r10); const useVirtualCurrencyEnabled = UseVirtualCurrencyEnabledModule.useVirtualCurrencyEnabled; const enabled = Reflect.apply(useVirtualCurrencyEnabled, UseVirtualCurrencyEnabledModule, [{location: r10}]).enabled; const RewardProgram = (ProgramRewardsTypesModule).RewardProgram; const NITRO = RewardProgram.NITRO; if (NITRO === a0) { return isInTreatment && enabled; } const XBOX = RewardProgram.XBOX; if (XBOX === a0) { return value2 && enabled; } return false; } function canFetchAnyProgramReward() { // fn#96331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12763:1826, offset: 0x0215ae76, size: 127 bytes, params: 1, frame: 16 var r5; var r2; var property; var binding; var value4; let value = a0; reducibleJoin2: while (true) { if (value !== undefined) { r5 = value; break reducibleJoin2; } value = 'ProgramRewardsUtils'; r5 = value; break reducibleJoin2; } const Object = global.Object; const values = Object.values; const RewardProgram = (ProgramRewardsTypesModule).RewardProgram; const value2 = Reflect.apply(values, Object, [RewardProgram]); let length = value2.length; const value3 = 0; if (value3 < length) { r2 = value3; reducibleLoop3: while (true) { property = value2[r2]; if (typeof property === 'number') { binding = env0_5; reducibleJoin5: while (true) { if (binding[property](r5)) { return true; } break reducibleJoin5; } } value4 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; length = value2.length; if (!(value4 < length)) { return false; } r2 = value4; continue reducibleLoop3; } } return false; } } global.__d(_fun96324, 12573, [1878, 1880, 3579, 12574, 12570, 12576, 5136, 12577, 3802, 2]) /* metro module 12573, dependencies: [1878, 1880, 3579, 12574, 12570, 12576, 5136, 12577, 3802, 2] */;