Files
discord-decomp/sources/modules/premium/powerups/hooks/useFeaturedExpiringPowerup.tsx
T
2026-07-27 16:20:00 +03:00

145 lines
6.6 KiB
TypeScript

/* Metro module 14615; source: modules/premium/powerups/hooks/useFeaturedExpiringPowerup.tsx; dependencies: [31, 8255, 8258, 566, 14616, 5134, 2] */
function _fun110511(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#110511, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14812:6, offset: 0x0237ba0e, size: 149 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importAll(31) /* metro dependency 31 */;
const gameServerStore = importDefault(8255) /* metro dependency 8255: GameServerStore */;
const guildPowerupsStore = importDefault(8258) /* metro dependency 8258: GuildPowerupsStore */;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/powerups/hooks/useFeaturedExpiringPowerup.tsx');
exports.default = useFeaturedExpiringPowerup;
}
function useFeaturedExpiringPowerup(a0) { // fn#110512, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14812:231, offset: 0x0237baa3, size: 184 bytes, params: 2, frame: 19
const env0_0 = a0;
const stateForGuild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildPowerupsStore],
_fun110513);
const stateForGuild2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GameServerStore],
_fun110514);
return stateForGuild2.useMemo(_fun110515, [stateForGuild, stateForGuild2,
(require(14616) /* metro dependency 14616: ExpiringPowerupCoachmarkExperiment */).useExpiringPowerupCoachmarkEnabled('useFeaturedExpiringPowerup')]);
}
function _fun110515() { // fn#110515, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14812:491, offset: 0x0237bb91, size: 463 bytes, params: 1, frame: 23
var environment;
var unlockedPowerups;
var r1;
var entitlements;
var title;
var r7;
var num_expiring_boosts;
var Object;
var values;
var stateForGuildBinding;
var value2;
var value3;
var object;
var value4;
var value5;
var value6;
var value7;
var value8;
var sku;
var Math;
var max;
var value9;
var moduleValue;
var getDaysRemaining;
var Date;
var ends_at;
var value10;
var date;
var metadata;
var value;
if (env0_3) {
Object = global.Object;
values = Object.values;
stateForGuildBinding = stateForGuild;
value2 = null;
value3 = undefined;
unlockedPowerups = value2 == stateForGuildBinding ? value3 : stateForGuild.unlockedPowerups;
r1 = value2 != unlockedPowerups ? unlockedPowerups : {};
value4 = Reflect.apply(values, Object, [r1]);
object = [];
value5 = 0;
value6 = arraySpread(object, value4, value5, undefined);
Object = global.Object;
values = Object.values;
entitlements = value2 == stateForGuild ? value3 : stateForGuild.entitlements;
r1 = value2 != entitlements ? entitlements : {};
arraySpread(object, Reflect.apply(values, Object, [r1]), value6, undefined);
value7 = object.filter(function(a0) {
var r3;
var r0;
var property;
var value = a0.ends_at != null;
if (value) {
property = a0.metadata;
value = undefined;
r3 = property == null ? value : property.num_expiring_boosts;
value = 0;
value = (r3 ?? value) > value;
r0 = value;
} else {
r0 = value;
}
return r0;
});
if (value5 === value7.length) {
return undefined;
}
value8 = value7.reduce(_fun110517);
title = value2 == stateForGuild || value2 == stateForGuild.allPowerups[value8.sku_id] ? value3 : stateForGuild.allPowerups[value8.sku_id].title;
r7 = value2 != title ? title : value2;
sku = value8.sku;
value = value2 != (value2 == sku || value2 == sku.tenant_metadata || value2 == sku.tenant_metadata.guild_monetization ? value3 : sku.tenant_metadata.guild_monetization.game_server);
if (value2 !== r7) {
object = {name: r7};
Math = global.Math;
max = Math.max;
value9 = environment.__proto__;
moduleValue = require(5134) /* metro dependency 5134: CollectiblesUtils */;
getDaysRemaining = moduleValue.getDaysRemaining;
Date = global.Date;
ends_at = value8.ends_at;
value10 = Object.create(Date.prototype, {constructor: {value: Date}});
date = new Date();
object.daysUntilExpiry = Reflect.apply(max, Math, [value5, Reflect.apply(getDaysRemaining, moduleValue,
[date instanceof Object ? date : value10])]);
metadata = value8.metadata;
num_expiring_boosts = value2 == metadata ? value3 : metadata.num_expiring_boosts;
object.numExpiringBoosts = value2 != num_expiring_boosts ? num_expiring_boosts : value5;
object.isGameServer = value;
object.skuId = value8.sku_id;
return object;
}
if (value) {
object = {name: r7};
Math = global.Math;
max = Math.max;
value9 = environment.__proto__;
moduleValue = require(5134) /* metro dependency 5134: CollectiblesUtils */;
getDaysRemaining = moduleValue.getDaysRemaining;
Date = global.Date;
ends_at = value8.ends_at;
value10 = Object.create(Date.prototype, {constructor: {value: Date}});
date = new Date();
object.daysUntilExpiry = Reflect.apply(max, Math, [value5, Reflect.apply(getDaysRemaining, moduleValue,
[date instanceof Object ? date : value10])]);
metadata = value8.metadata;
num_expiring_boosts = value2 == metadata ? value3 : metadata.num_expiring_boosts;
object.numExpiringBoosts = value2 != num_expiring_boosts ? num_expiring_boosts : value5;
object.isGameServer = value;
object.skuId = value8.sku_id;
return object;
}
}
}
function _fun110517(a0, a1) { // fn#110517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14812:806, offset: 0x0237bd9b, size: 27 bytes, params: 3, frame: 4
const value = a0;
const value2 = a1;
return value2.ends_at > value.ends_at ? value2 : value;
}