Files
discord-decomp/stores/billing/GuildBoostSlotStore.tsx
T
2026-11-01 12:12:55 +02:00

64 lines
1.8 KiB
TypeScript

// Metro module 4082 (f4083).
import SubscriptionStore from "./SubscriptionStore";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c2347_1, c2347_2, c2347_3, handleSubscriptionStoreUpdate;
const handleGuildBoostsUpdate = function handleGuildBoostsUpdate({ guildBoostSlot }) {
const r7 = {
...c2347_3
};
r7[guildBoostSlot.id] = guildBoostSlot;
c2347_3 = r7;
};
handleSubscriptionStoreUpdate = function handleSubscriptionStoreUpdate() {
const r1 = {};
for (const item of Object.values(c2347_3)) {
r1[item.id] = item;
item.subscription = SubscriptionStore.getSubscriptionById(item.subscriptionId);
}
c2347_3 = r1;
};
c2347_1 = false;
c2347_2 = false;
c2347_3 = {};
class GuildBoostSlotStore extends Module589.Store {
static displayName = "GuildBoostSlotStore";
initialize() {
this.syncWith([SubscriptionStore], handleSubscriptionStoreUpdate);
}
get hasFetched() {
return c2347_1;
}
get isFetching() {
return c2347_2;
}
get boostSlots() {
return c2347_3;
}
getGuildBoostSlot(a0) {
return c2347_3[a0];
}
}
const guildBoostSlotStore = new GuildBoostSlotStore(Dispatcher, {
GUILD_BOOST_SLOTS_FETCH: function handleGuildBoostsFetch() {
c2347_2 = true;
},
GUILD_BOOST_SLOTS_FETCH_SUCCESS: function handleGuildBoostsFetchSuccess({ guildBoostSlots }) {
c2347_3 = {};
guildBoostSlots.forEach((guildBoostSlot) => {
c2347_3[guildBoostSlot.id] = guildBoostSlot;
});
c2347_2 = false;
c2347_1 = true;
},
GUILD_BOOST_SLOT_UPDATE_SUCCESS: handleGuildBoostsUpdate,
GUILD_BOOST_SLOT_CREATE: handleGuildBoostsUpdate,
GUILD_BOOST_SLOT_UPDATE: handleGuildBoostsUpdate,
LOGOUT: function handleLogout() {
c2347_3 = {};
c2347_1 = false;
c2347_2 = false;
}
});
export default guildBoostSlotStore;