Files
discord-decomp/modules/premium/GuildCapUpsellHooks.tsx
T
2026-11-01 12:12:55 +02:00

34 lines
1.4 KiB
TypeScript

// Metro module 5648 (f5649).
import GuildStore from "../../stores/GuildStore";
import UserStore from "../../stores/UserStore";
import { MAX_USER_GUILDS } from "../../Constants";
import { useStateFromStores, useStateFromStoresObject } from "../../_bundle/Module589";
import { HotspotStore, HotspotLocations, hideHotspot } from "../hotspot/index";
import PremiumUtils from "../../utils/PremiumUtils";
export function useShouldShowInlineGuildCapUpsell() {
let r11 = useStateFromStores([GuildStore], () => GuildStore.getGuildCount() >= 95);
const stateFromStores = useStateFromStores([HotspotStore], () => HotspotStore.hasHotspot(HotspotLocations.GUILD_CAP_INLINE_UPSELL));
const stateFromStoresObject = useStateFromStoresObject([UserStore], () => !PremiumUtils.isPremium(UserStore.getCurrentUser()));
if (r11) {
r11 = stateFromStores;
}
if (r11) {
r11 = stateFromStoresObject;
}
return r11;
}
export function hideInlineGuildCapUpsell() {
hideHotspot(HotspotLocations.GUILD_CAP_INLINE_UPSELL);
}
export function hasIncreasedGuildCap(a0) {
return PremiumUtils.canUseIncreasedGuildCap(a0) || (a0 == null ? void 0 : a0.isStaff()) === true;
}
export function isAtGuildCapAndNonPremium() {
let r0 = GuildStore.getGuildCount() >= MAX_USER_GUILDS;
if (r0) {
const currentUser = UserStore.getCurrentUser();
r0 = !(PremiumUtils.canUseIncreasedGuildCap(currentUser) || (currentUser == null ? void 0 : currentUser.isStaff()) === true);
}
return r0;
}