Files
discord-decomp/modules/collectibles/hooks/useProfileFramesMarketing.tsx
T
2026-11-01 12:12:55 +02:00

101 lines
4.8 KiB
TypeScript

// Metro module 15774 (f15775).
import UserStore from "../../../stores/UserStore";
import * as _useCanPurchaseFrames from "./useCanPurchaseFrames";
import { useCanViewProfileFramesInCollectiblesShop, useIsProfileFramesEarlyAccessPhase } from "./useCanPurchaseFrames";
import { useIsProfileFramesEAMarketingEnabled, getIsProfileFramesEAMarketingEnabled } from "../experiments/CollectiblesProfileFramesEAMarketingExperiment";
import { useIsProfileFrameGiftingEnabled, getIsProfileFrameGiftingEnabled } from "../experiments/CollectiblesProfileFrameGiftingExperiment";
import { useStateFromStores } from "../../../_bundle/Module589";
import CollectiblesProfileFramesExperiment from "../experiments/CollectiblesProfileFramesExperiment";
import CollectiblesProfileFramesPurchaseExperiment, { ProfileFramesPurchaseBucket } from "../experiments/CollectiblesProfileFramesPurchaseExperiment";
export function deriveProfileFramesMarketing(a0) {
let canViewProfileFramesInCollectiblesShop = a0.canViewProfileFramesInCollectiblesShop;
let isEarlyAccess = a0.isEarlyAccess;
const { isFramesEAMarketingEnabled, isFrameGiftingEnabled, hasPaidTier2 } = a0;
if (canViewProfileFramesInCollectiblesShop) {
canViewProfileFramesInCollectiblesShop = !isEarlyAccess;
}
const isAnnouncementEligible = canViewProfileFramesInCollectiblesShop ? canViewProfileFramesInCollectiblesShop : isEarlyAccess ? isFramesEAMarketingEnabled : isEarlyAccess;
if (canViewProfileFramesInCollectiblesShop) {
canViewProfileFramesInCollectiblesShop = isFrameGiftingEnabled;
}
const r9 = {
isAnnouncementEligible,
isEarlyAccess,
showGiftingMarketing: canViewProfileFramesInCollectiblesShop,
showEaPremiumMarketing: (isEarlyAccess ? isFramesEAMarketingEnabled : isEarlyAccess) && hasPaidTier2,
showEaNonPremiumMarketing: null
};
if (isEarlyAccess) {
isEarlyAccess = isFramesEAMarketingEnabled;
}
if (isEarlyAccess) {
isEarlyAccess = !hasPaidTier2;
}
r9.showEaNonPremiumMarketing = isEarlyAccess;
return r9;
}
export function useProfileFramesMarketing(a0) {
const canViewProfileFramesInCollectiblesShop = useCanViewProfileFramesInCollectiblesShop(a0);
let isEarlyAccess = useIsProfileFramesEarlyAccessPhase(a0);
const isProfileFramesEAMarketingEnabled = useIsProfileFramesEAMarketingEnabled(a0);
const isProfileFrameGiftingEnabled = useIsProfileFrameGiftingEnabled(a0);
const stateFromStores = useStateFromStores([UserStore], () => _useCanPurchaseFrames.isUserPaidTier2(UserStore.getCurrentUser()));
let showGiftingMarketing = canViewProfileFramesInCollectiblesShop && !isEarlyAccess;
const isAnnouncementEligible = showGiftingMarketing ? showGiftingMarketing : isEarlyAccess ? isProfileFramesEAMarketingEnabled : isEarlyAccess;
if (showGiftingMarketing) {
showGiftingMarketing = isProfileFrameGiftingEnabled;
}
const r31 = {
isAnnouncementEligible,
isEarlyAccess,
showGiftingMarketing,
showEaPremiumMarketing: (isEarlyAccess ? isProfileFramesEAMarketingEnabled : isEarlyAccess) && stateFromStores,
showEaNonPremiumMarketing: null
};
if (isEarlyAccess) {
isEarlyAccess = isProfileFramesEAMarketingEnabled;
}
if (isEarlyAccess) {
isEarlyAccess = !stateFromStores;
}
r31.showEaNonPremiumMarketing = isEarlyAccess;
return r31;
}
export function getProfileFramesMarketing(a0) {
let enableProfileFrames = CollectiblesProfileFramesExperiment.getConfig({
location: a0
}).enableProfileFrames;
const bucket = CollectiblesProfileFramesPurchaseExperiment.getConfig({
location: a0
}).bucket;
let showGiftingMarketing = enableProfileFrames ? bucket !== ProfileFramesPurchaseBucket.CONTROL : enableProfileFrames;
if (enableProfileFrames) {
enableProfileFrames = bucket === ProfileFramesPurchaseBucket.PAID_PREMIUM_SUBSCRIBERS_ONLY;
}
const isProfileFramesEAMarketingEnabled = getIsProfileFramesEAMarketingEnabled(a0);
const isProfileFrameGiftingEnabled = getIsProfileFrameGiftingEnabled(a0);
const isUserPaidTier2 = _useCanPurchaseFrames.isUserPaidTier2(UserStore.getCurrentUser());
if (showGiftingMarketing) {
showGiftingMarketing = !enableProfileFrames;
}
const isAnnouncementEligible = showGiftingMarketing ? showGiftingMarketing : enableProfileFrames ? isProfileFramesEAMarketingEnabled : enableProfileFrames;
if (showGiftingMarketing) {
showGiftingMarketing = isProfileFrameGiftingEnabled;
}
const r47 = {
isAnnouncementEligible,
isEarlyAccess: enableProfileFrames,
showGiftingMarketing,
showEaPremiumMarketing: (enableProfileFrames ? isProfileFramesEAMarketingEnabled : enableProfileFrames) && isUserPaidTier2,
showEaNonPremiumMarketing: null
};
if (enableProfileFrames) {
enableProfileFrames = isProfileFramesEAMarketingEnabled;
}
if (enableProfileFrames) {
enableProfileFrames = !isUserPaidTier2;
}
r47.showEaNonPremiumMarketing = enableProfileFrames;
return r47;
}