47 lines
2.1 KiB
TypeScript
47 lines
2.1 KiB
TypeScript
// Metro module 8700 (f8701).
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { PremiumTypes } from "../../premium/PremiumConstants";
|
|
import { useIsProfileFramesEnabled } from "../experiments/CollectiblesProfileFramesExperiment";
|
|
import CollectiblesProfileFramesPurchaseExperiment, { ProfileFramesPurchaseBucket } from "../experiments/CollectiblesProfileFramesPurchaseExperiment";
|
|
import { isPremiumExactly } from "../../../utils/PremiumTypeUtils";
|
|
import { PremiumSubscriptionType } from "../../../_bundle/Module1892";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
export default function useCanPurchaseFrames(a0) {
|
|
let r11 = useIsProfileFramesEnabled(a0);
|
|
const bucket = CollectiblesProfileFramesPurchaseExperiment.useConfig({
|
|
location: a0
|
|
}).bucket;
|
|
const stateFromStores = useStateFromStores([UserStore], () => {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
return isPremiumExactly(currentUser, PremiumTypes.TIER_2) && currentUser?.premiumState != null && currentUser.premiumState.premiumSubscriptionType === PremiumSubscriptionType.TIER_2;
|
|
});
|
|
const r27 = bucket === ProfileFramesPurchaseBucket.OPEN_PURCHASE || bucket === ProfileFramesPurchaseBucket.PAID_PREMIUM_SUBSCRIBERS_ONLY && stateFromStores;
|
|
if (r11) {
|
|
r11 = r27;
|
|
}
|
|
return r11;
|
|
};
|
|
export function useCanViewProfileFramesInCollectiblesShop(a0) {
|
|
let r9 = useIsProfileFramesEnabled(a0);
|
|
const bucket = CollectiblesProfileFramesPurchaseExperiment.useConfig({
|
|
location: a0
|
|
}).bucket;
|
|
if (r9) {
|
|
r9 = bucket !== ProfileFramesPurchaseBucket.CONTROL;
|
|
}
|
|
return r9;
|
|
}
|
|
export function useIsProfileFramesEarlyAccessPhase(a0) {
|
|
let r9 = useIsProfileFramesEnabled(a0);
|
|
const bucket = CollectiblesProfileFramesPurchaseExperiment.useConfig({
|
|
location: a0
|
|
}).bucket;
|
|
if (r9) {
|
|
r9 = bucket === ProfileFramesPurchaseBucket.PAID_PREMIUM_SUBSCRIBERS_ONLY;
|
|
}
|
|
return r9;
|
|
}
|
|
export function isUserPaidTier2(a0) {
|
|
return isPremiumExactly(a0, PremiumTypes.TIER_2) && a0?.premiumState != null && a0.premiumState.premiumSubscriptionType === PremiumSubscriptionType.TIER_2;
|
|
}
|