// Metro module 9356 (f9357). import { useRef, useEffect } from "react"; import EmojiStore from "../../emojis/EmojiStore"; import ChannelStore from "../../../stores/ChannelStore"; import SelectedChannelStore from "../../../stores/SelectedChannelStore"; import { AnalyticEvents } from "../../../Constants"; import { EmojiIntention } from "../../emojis/EmojiConstants"; import { ExpressionPickerViewType } from "../../expression_picker/ExpressionPickerConstants"; import { getTopAndNewlyAddedEmojis } from "../hooks/useTopAndNewlyAddedEmojis"; import { getEmojiHotrail } from "../hooks/useEmojiHotrail"; import AppAnalyticsUtils from "../../app_analytics/AppAnalyticsUtils"; import EmojiUtils from "../../../utils/EmojiUtils"; const trackOnEmojiPickerOpened = function trackOnEmojiPickerOpened({ intention, containerWidth, rowSize, isBurstReaction, analyticsObject }) { const channel = ChannelStore.getChannel(SelectedChannelStore.getChannelId()); const r26 = channel == null ? void 0 : channel.getGuildId(); const r13 = intention === EmojiIntention.REACTION ? EmojiStore.emojiReactionFrecencyWithoutFetchingLatest.frequently.slice() : EmojiStore.emojiFrecencyWithoutFetchingLatest.frequently.slice(); const r21 = channel != null ? EmojiStore.getDisambiguatedEmojiContext(channel.getGuildId()).favoriteEmojisWithoutFetchingLatest : []; const r18 = r13.slice(0, intention === EmojiIntention.REACTION ? EmojiStore.emojiReactionFrecencyWithoutFetchingLatest.numFrequentlyItems : EmojiStore.emojiFrecencyWithoutFetchingLatest.numFrequentlyItems); const r46 = r26 != null ? EmojiStore.getGuildEmoji(r26) : []; const customEmoji = EmojiStore.getDisambiguatedEmojiContext(channel == null ? void 0 : channel.getGuildId()).getCustomEmoji(); const topAndNewlyAddedEmojis = getTopAndNewlyAddedEmojis({ guildId: channel == null ? void 0 : channel.getGuildId(), pickerIntention: intention }); const emojiHotrail = getEmojiHotrail({ topEmojis: topAndNewlyAddedEmojis.topEmojis, newlyAddedEmojis: topAndNewlyAddedEmojis.newlyAddedEmojis, rowSize }); const { visibleTopEmojis, visibleNewlyAddedEmojis } = emojiHotrail; AppAnalyticsUtils.trackWithMetadata(intention === EmojiIntention.REACTION ? AnalyticEvents.REACTION_PICKER_OPENED : AnalyticEvents.EXPRESSION_PICKER_OPENED, { width: containerWidth, tab: ExpressionPickerViewType.EMOJI, badged: false, num_expressions_favorites: r21.length, num_animated_expressions_favorites: r21.filter((item) => item?.animated).length, num_custom_expressions_favorites: r21.filter(EmojiUtils.isCustomEmoji).length, num_standard_expressions_favorites: r21.filter((item) => item.id == null).length, num_expressions_frecent: r18.length, num_animated_expressions_frecent: r18.filter((item) => item?.animated).length, num_custom_expressions_frecent: r18.filter(EmojiUtils.isCustomEmoji).length, num_standard_expressions_frecent: r18.filter((item) => item.id == null).length, num_current_guild_expressions: r46.length, num_custom_expressions_total: customEmoji.size, num_expressions_top_server: visibleTopEmojis.length, num_animated_expressions_top_server: visibleTopEmojis.filter((visibleTopEmoji) => visibleTopEmoji.animated).length, num_expressions_newly_added: visibleNewlyAddedEmojis.length, num_animated_expressions_newly_added: visibleNewlyAddedEmojis.filter((visibleNewlyAddedEmoji) => visibleNewlyAddedEmoji.animated).length, ...intention === EmojiIntention.REACTION && { is_burst: isBurstReaction }, ...analyticsObject != null && { location_object: analyticsObject } }); }; export default trackOnEmojiPickerOpened; export function useTrackOnEmojiPickerOpenedForReactions(a0) { const ref = useRef(a0); useEffect(() => { if (ref.current.intention === EmojiIntention.REACTION) { trackOnEmojiPickerOpened(ref.current); } }, []); }