decord/source/modules/premium/GuildCapUpsellHooks.tsx
github-actions f0f877e8ce chore: update source for alpha 347.1
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4824.js (118.4 MB)
2026-09-15 14:23:42 +00:00

66 lines
2.5 KiB
TypeScript

// Module ID: 7319
// Function ID: 7320
// Name: GuildCapUpsellHooks
// Dependencies: [1980, 1372, 1074, 504, 7320, 4297, 2]
// Exports: hasIncreasedGuildCap, hideInlineGuildCapUpsell, isAtGuildCapAndNonPremium, useShouldShowInlineGuildCapUpsell
// Module 7319 (GuildCapUpsellHooks)
import initialize from "initialize" /* 504 */;
import PremiumUtilsDefault from "PremiumUtils" /* 4297 */;
import HotspotStore2 from "HotspotStore" /* 7320 */;
import GuildStore from "GuildStore" /* 1980 */;
import UserStore from "UserStore" /* 1372 */;
require = fn;
const MAX_USER_GUILDS = fn(1074).MAX_USER_GUILDS;
const size = fn(2);
let result = size.fileFinishedImporting("modules/premium/GuildCapUpsellHooks.tsx");
export const useShouldShowInlineGuildCapUpsell = function useShouldShowInlineGuildCapUpsell() {
const items = [GuildStore];
let stateFromStores = initialize.useStateFromStores(items, () => guildCount.getGuildCount() >= 95);
const items1 = [HotspotStore2.HotspotStore];
const stateFromStores1 = initialize.useStateFromStores(items1, () => {
const HotspotStore = HotspotStore2.HotspotStore;
return HotspotStore.hasHotspot(HotspotStore2.HotspotLocations.GUILD_CAP_INLINE_UPSELL);
});
const items2 = [UserStore];
const stateFromStoresObject = initialize.useStateFromStoresObject(items2, () => !PremiumUtilsDefault.isPremium(currentUser.getCurrentUser()));
if (stateFromStores) {
stateFromStores = stateFromStores1;
}
if (stateFromStores) {
stateFromStores = stateFromStoresObject;
}
return stateFromStores;
};
export const hideInlineGuildCapUpsell = function hideInlineGuildCapUpsell() {
HotspotStore2.hideHotspot(HotspotStore2.HotspotLocations.GUILD_CAP_INLINE_UPSELL);
};
export const hasIncreasedGuildCap = function hasIncreasedGuildCap(currentUser) {
let result = PremiumUtilsDefault.canUseIncreasedGuildCap(currentUser);
if (!result) {
let isStaffResult;
if (currentUser != null) {
isStaffResult = currentUser.isStaff();
}
result = true === isStaffResult;
}
return result;
};
export const isAtGuildCapAndNonPremium = function isAtGuildCapAndNonPremium() {
let tmp = GuildStore.getGuildCount() >= MAX_USER_GUILDS;
if (tmp) {
const currentUser = UserStore.getCurrentUser();
let result = PremiumUtilsDefault.canUseIncreasedGuildCap(currentUser);
if (!result) {
let isStaffResult;
if (currentUser != null) {
isStaffResult = currentUser.isStaff();
}
result = true === isStaffResult;
}
tmp = !result;
}
return tmp;
};