This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,93 @@
// Metro module 8807 (f8808).
import { useState, useRef, useEffect } from "react";
import PromotionsStore from "../../../promotions/PromotionsStore";
import { SubscriptionPlans } from "../../../PremiumConstants";
import { useStateFromStoresArray } from "../../../../../_bundle/Module589";
import { useFetchPurchases } from "../../../../collectibles/hooks/useFetchCollectiblesCategoriesAndPurchases";
import { GiftPromotionReminderExperiment } from "../../experiments/GiftPromotionReminderExperiment";
import { MarketingComponentType } from "../../../../../_bundle/Module6567";
import { UNSAFE_isSnowflakeBoundDismissibleContentDismissed } from "../../../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../../../_bundle/Module1358";
export function useFetchClaimableGiftingPromotionRewardSkuIds() {
let purchases, hasPreviouslyFetched, fetchPurchasesError, ref;
const [state, setState] = useState();
const stateFromStoresArray = useStateFromStoresArray([PromotionsStore], () => PromotionsStore.getGiftPromotionRewardSkuIds());
const fetchPurchases = useFetchPurchases();
purchases = fetchPurchases.purchases;
hasPreviouslyFetched = fetchPurchases.hasPreviouslyFetched;
fetchPurchasesError = fetchPurchases.fetchPurchasesError;
ref = useRef(false);
useEffect(() => {
if (hasPreviouslyFetched && !ref.current && stateFromStoresArray.length > 0) {
setState(fetchPurchasesError == null ? stateFromStoresArray.filter((item) => purchases.get(item) == null) : []);
ref.current = true;
}
}, [stateFromStoresArray, purchases, hasPreviouslyFetched, fetchPurchasesError]);
return state;
}
export function getRewardAssetIdMap(a0) {
const map = new Map();
let c16793_0 = map;
a0.forEach((item) => c16793_0.set(item.skuId, item.assetId));
return map;
}
export function useShouldShowSelectFreeSkuStep(a0, a1, a2) {
const r12 = [SubscriptionPlans.PREMIUM_YEAR_TIER_2, SubscriptionPlans.PREMIUM_MONTH_TIER_2].includes(a0?.id);
const r13 = a2 != null && a2.length >= 1;
return (a1 ? r12 : a1) && r13;
}
export function useShouldAutoSelectGiftingPromotionReward(a0, a1, a2) {
const r12 = [SubscriptionPlans.PREMIUM_YEAR_TIER_2, SubscriptionPlans.PREMIUM_MONTH_TIER_2].includes(a0?.id);
return a2 != null && a2.length === 1 && r12 && a1;
}
export function useIsPlanEligibleForGiftingPromotion(a0) {
return [SubscriptionPlans.PREMIUM_YEAR_TIER_2, SubscriptionPlans.PREMIUM_MONTH_TIER_2].includes(a0?.id);
}
export function createGradientStyle(a0, a1) {
if (a0 != null) {
const r4 = a1 == null ? {} : a1;
const { reverse = false, colorStops, defaultAngle = 78.98 } = r4;
const r22 = Array.isArray(a0) ? a0 : a0.gradient;
const r25 = Array.isArray(a0) ? defaultAngle : a0.angle != null ? a0.angle : defaultAngle;
return {
background: `linear-gradient(${reverse ? (r25 + 180) % 360 : r25}deg, ${colorStops != null ? r22.map((item, index) => `${item} ${colorStops[index]}%`).join(", ") : r22.join(", ")})`
};
}
}
export function createBackgroundStyle(a0) {
if (a0 != null) {
return {
backgroundImage: `url(${a0})`,
backgroundSize: "cover",
backgroundPosition: "center",
backgroundRepeat: "no-repeat"
};
}
}
export function combinePromotionStyles(a0, a1) {
if (a0 != null && a1 != null) {
a0.backgroundImage = `${a0.backgroundImage}, ${a1.background}`;
a0.backgroundColor = "lightgray";
a0.backgroundRepeat = "no-repeat, no-repeat";
if (a0.backgroundSize == null) {
a0.backgroundSize = "auto 110%, auto";
}
if (a0.backgroundPosition == null) {
a0.backgroundPosition = "right 90% center, 0% 0%";
}
return a0;
}
return a0 == null ? a1 == null ? {} : a1 : a0;
}
export function shouldShowGiftPromotionReminderNotice() {
if (GiftPromotionReminderExperiment.getConfig({
location: "shouldShowGiftPromotionReminderNotice"
}).enabled) {
if (PromotionsStore.getMarketingComponentByType(MarketingComponentType.GIFT_REMINDER_NAGBAR) == null) {
return false;
}
const id = PromotionsStore.getGiftPromotion()?.id;
return id != null && (!!UNSAFE_isSnowflakeBoundDismissibleContentDismissed(DismissibleContent.GIFTING_PROMOTION_DESKTOP_FIRST_TIME_COACHMARK, id).isDismissed && !UNSAFE_isSnowflakeBoundDismissibleContentDismissed(DismissibleContent.GIFTING_PROMOTION_REMINDER, id).isDismissed);
}
return false;
}