// Metro module 9412 (f9413). import { useRef } from "react"; import ChannelStore from "../../stores/ChannelStore"; import SelectedChannelStore from "../../stores/SelectedChannelStore"; import { EmojiInteractionPoint } from "./EmojiConstants"; import { AnalyticEvents } from "../../Constants"; import { collectChannelAnalyticsMetadata } from "../app_analytics/AppAnalyticsUtils"; import useMountEffect from "../../hooks/useMountEffect"; import { initiateEmojiInteraction } from "./EmojiActionCreators"; import AnalyticsUtils from "../../utils/AnalyticsUtils"; export const useTrackOpenPopout = ({ emojiId, currentGuildId, popoutData, nonce, demoMode }) => { const current = useRef({ guild_id: currentGuildId, emoji_id: emojiId, ...collectChannelAnalyticsMetadata(ChannelStore.getChannel(SelectedChannelStore.getChannelId(currentGuildId))) }).current; useMountEffect(() => { initiateEmojiInteraction(EmojiInteractionPoint.TrackOpenPopoutUsed); if (!demoMode) { const OPEN_POPOUT = AnalyticEvents.OPEN_POPOUT; let type = popoutData?.analyticsType; if (type == null) { type = "Standard Emoji Popout"; } AnalyticsUtils.track(OPEN_POPOUT, { type, nonce, ...current }); } }); return current; };