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

34 lines
1.7 KiB
TypeScript

// Metro module 7940 (f7941).
import { useCallback } from "react";
import CollectiblesCategoryStore from "../CollectiblesCategoryStore";
import { AnalyticEvents } from "../../../Constants";
import { AnalyticsPremiumFeatureTiers, AnalyticsPremiumFeatureNames } from "../../premium/PremiumConstants";
import { CollectiblesItemType } from "../../../_bundle/Module1901";
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { isPremiumCollectiblesProduct } from "../CollectiblesUtils";
const r24 = {};
r24[CollectiblesItemType.AVATAR_DECORATION] = AnalyticsPremiumFeatureNames.AVATAR_DECORATION;
r24[CollectiblesItemType.PROFILE_EFFECT] = AnalyticsPremiumFeatureNames.PROFILE_EFFECT;
r24[CollectiblesItemType.PROFILE_FRAME] = void 0;
r24[CollectiblesItemType.NAMEPLATE] = void 0;
r24[CollectiblesItemType.NONE] = void 0;
r24[CollectiblesItemType.BUNDLE] = void 0;
r24[CollectiblesItemType.VARIANTS_GROUP] = void 0;
r24[CollectiblesItemType.EXTERNAL_SKU] = void 0;
let c5013_7 = r24;
export default function useTrackCollectiblesItemTryOut(a0) {
const location_stack = a0;
const stateFromStores = useStateFromStores([CollectiblesCategoryStore], () => CollectiblesCategoryStore.products);
return useCallback((a0) => {
const type = a0.type;
const r8 = stateFromStores.get(a0.skuId);
AnalyticsUtils.track(AnalyticEvents.PREMIUM_FEATURE_TRY_OUT, {
feature_name: c5013_7[type],
feature_tier: isPremiumCollectiblesProduct(r8) ? AnalyticsPremiumFeatureTiers.FREE : AnalyticsPremiumFeatureTiers.PREMIUM_STANDARD,
feature_selection: r8?.name,
location_stack
});
}, [stateFromStores, a0]);
};