530 lines
21 KiB
TypeScript
530 lines
21 KiB
TypeScript
// Metro module 9340 (f9341).
|
|
import { useEffect, useMemo } from "react";
|
|
import EmojiStore from "../emojis/EmojiStore";
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import SortedGuildStore from "../../stores/SortedGuildStore";
|
|
import UserStore from "../../stores/UserStore";
|
|
import { EmojiCategoryTypes, EmojiCategories, EmojiSubCategory } from "./EmojiPickerConstants";
|
|
import { AnalyticEvents, AutoCompleteResultTypes, SearchTypes, AnalyticsPages, AnalyticsSections } from "../../Constants";
|
|
import { EmojiIntention, isExternalEmojiAllowedForIntention, EmojiDisabledReasons } from "../emojis/EmojiConstants";
|
|
import { ExpressionPickerViewType } from "../expression_picker/ExpressionPickerConstants";
|
|
import { PremiumUpsellTypes } from "../premium/PremiumConstants";
|
|
import { v4 } from "../../_bundle/Module514";
|
|
import { EmojiPickerStore } from "../expression_picker/ExpressionPickerGridStores";
|
|
import AppAnalyticsUtils from "../app_analytics/AppAnalyticsUtils";
|
|
import { maybeFetchTopEmojisByGuild } from "../emojis/top_emojis/TopEmojisUtils";
|
|
import useTopAndNewlyAddedEmojis from "./hooks/useTopAndNewlyAddedEmojis";
|
|
import useEmojiHotrail from "./hooks/useEmojiHotrail";
|
|
import { useStateFromStoresArray, useStateFromStores, statesWillNeverBeEqual } from "../../_bundle/Module589";
|
|
import * as _PremiumTypeUtils from "../../utils/PremiumTypeUtils";
|
|
import { useSoundmojiEmojiPickerSectionExperiment } from "../premium/sounds/soundmoji/SoundmojiSendingExperiment";
|
|
import { intl, t } from "../../intl/index.native";
|
|
import EmojiUtils from "../../utils/EmojiUtils";
|
|
import UnicodeEmojis from "../emojis/UnicodeEmojis";
|
|
import AnalyticsUtils from "../../utils/AnalyticsUtils";
|
|
import { throttle } from "../../_bundle/Module12";
|
|
import Durations from "../../utils/Durations";
|
|
import { FrecencyUserSettingsActionCreators } from "../user_settings/UserSettingsProtoActionCreators";
|
|
import { HermesBuiltin } from "../../_hermes/prelude";
|
|
function $mk82327($env) {
|
|
return () => $env.$parent[4].getDisambiguatedEmojiContext($env[0]).getFrequentlyUsedEmojisWithoutFetchingLatest();
|
|
}
|
|
function $mk82329($env) {
|
|
return () => $env.$parent[4].getDisambiguatedEmojiContext($env[0]).getFrequentlyUsedReactionEmojisWithoutFetchingLatest();
|
|
}
|
|
function $mk82331($env) {
|
|
return () => $env.$parent[4].getDisambiguatedEmojiContext($env[0]).favoriteEmojisWithoutFetchingLatest;
|
|
}
|
|
let $mk82326 = function() {
|
|
return () => {
|
|
FrecencyUserSettingsActionCreators.loadIfNecessary();
|
|
};
|
|
}, $mk82328 = function() {
|
|
return () => {
|
|
FrecencyUserSettingsActionCreators.loadIfNecessary();
|
|
};
|
|
}, $mk82330 = function() {
|
|
return () => {
|
|
FrecencyUserSettingsActionCreators.loadIfNecessary();
|
|
};
|
|
};
|
|
let env6146 = {};
|
|
const c6146_21 = /-/g;
|
|
const r56 = throttle(({ emojiSuggestions, analyticsLocation }) => {
|
|
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.AUTO_SUGGEST_DISPLAYED, {
|
|
suggestion_type: AutoCompleteResultTypes.EMOJI,
|
|
suggestion_quantity: emojiSuggestions.results.length,
|
|
custom_quantity: emojiSuggestions.results.filter((result) => result.emoji.id != null).length,
|
|
load_id: emojiSuggestions.loadId,
|
|
location: analyticsLocation
|
|
});
|
|
}, Durations.Millis.HALF_SECOND, {
|
|
leading: false,
|
|
trailing: true
|
|
});
|
|
export function initializeSearch({ intention: intention3, location: location2 }) {
|
|
const load_id = v4().replace(c6146_21, "");
|
|
EmojiPickerStore.setAnalyticsId(load_id);
|
|
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_OPENED, {
|
|
search_type: EmojiIntention.REACTION === intention3 ? SearchTypes.EMOJI_REACTION : EmojiIntention.AUTO_SUGGESTION === intention3 ? SearchTypes.EMOJI_AUTO_SUGGESTION : SearchTypes.EMOJI,
|
|
load_id,
|
|
location: location2
|
|
});
|
|
}
|
|
export function useEmojiCategories(a0, a1) {
|
|
let stateFromStores2, isPremium, soundmojiEmojiPickerSectionExperiment;
|
|
const intention = a0;
|
|
const channel = a1;
|
|
let r16 = arguments[2];
|
|
if (r16 === void 0) {
|
|
r16 = a1 == null ? void 0 : a1.getGuildId();
|
|
}
|
|
const guildId = r16;
|
|
let r6 = arguments[3];
|
|
if (r6 === void 0) {
|
|
r6 = false;
|
|
}
|
|
let env17154;
|
|
let env17155;
|
|
let env17156;
|
|
let c17153_3 = r6;
|
|
stateFromStores2 = void 0;
|
|
isPremium = void 0;
|
|
soundmojiEmojiPickerSectionExperiment = void 0;
|
|
maybeFetchTopEmojisByGuild(guildId);
|
|
const r28 = (0, isExternalEmojiAllowedForIntention)(a0);
|
|
let c17153_4 = r28;
|
|
const r9 = env17154 = {
|
|
$parent: env6146
|
|
};
|
|
env17154[0] = guildId;
|
|
useEffect($mk82326(), []);
|
|
const stateFromStoresArray = useStateFromStoresArray([EmojiStore], $mk82327(r9));
|
|
const r37 = env17155 = {
|
|
$parent: env6146
|
|
};
|
|
env17155[0] = guildId;
|
|
useEffect($mk82328(), []);
|
|
const stateFromStoresArray2 = useStateFromStoresArray([EmojiStore], $mk82329(r37));
|
|
const r47 = env17156 = {
|
|
$parent: env6146
|
|
};
|
|
env17156[0] = guildId;
|
|
useEffect($mk82330(), []);
|
|
const stateFromStoresArray3 = useStateFromStoresArray([EmojiStore], $mk82331(r47));
|
|
const topAndNewlyAddedEmojis = useTopAndNewlyAddedEmojis(guildId, a0);
|
|
const allEmojis = useEmojiHotrail({
|
|
topEmojis: topAndNewlyAddedEmojis.topEmojis,
|
|
newlyAddedEmojis: topAndNewlyAddedEmojis.newlyAddedEmojis
|
|
}).allEmojis;
|
|
const stateFromStores = useStateFromStores([EmojiStore], () => EmojiStore.getDisambiguatedEmojiContext(guildId), [guildId]);
|
|
stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId)?.name);
|
|
isPremium = _PremiumTypeUtils.isPremium(useStateFromStores([UserStore], () => UserStore.getCurrentUser()));
|
|
soundmojiEmojiPickerSectionExperiment = useSoundmojiEmojiPickerSectionExperiment({
|
|
location: "useEmojiCategories"
|
|
});
|
|
return useMemo(() => {
|
|
let groupedCustomEmoji, c26423_1;
|
|
const getEmojiUnavailableReasons2 = function getEmojiUnavailableReasons(a0) {
|
|
return EmojiUtils.getEmojiUnavailableReasons({
|
|
categoryEmojis: a0,
|
|
channel,
|
|
guildId,
|
|
intention
|
|
});
|
|
};
|
|
groupedCustomEmoji = stateFromStores.getGroupedCustomEmoji();
|
|
const flattenedGuildIds = SortedGuildStore.getFlattenedGuildIds();
|
|
c26423_1 = [];
|
|
const r7 = {
|
|
type: EmojiCategoryTypes.SOUNDMOJI,
|
|
name: intl.string(t.f0Ezmv),
|
|
id: EmojiCategories.SOUNDMOJI,
|
|
isNitroLocked: false
|
|
};
|
|
(function(a0, a1) {
|
|
for (const item of a0) {
|
|
const guild = a1 === EmojiCategoryTypes.GUILD ? GuildStore.getGuild(item) : void 0;
|
|
if (guild != null) {
|
|
const emojis = groupedCustomEmoji.get(guild.id);
|
|
if (emojis != null && emojis.length !== 0) {
|
|
const emojiUnavailableReasons2 = getEmojiUnavailableReasons2(emojis);
|
|
const { emojisDisabled, emojisUnfiltered, emojisPremiumLockedCount, emojiNitroLocked } = emojiUnavailableReasons2;
|
|
if (emojisUnfiltered.length !== 0) {
|
|
const hiddenEmojiIds = EmojiStore.getHiddenEmojiIds(guild.id);
|
|
const r61 = a1 === EmojiCategoryTypes.GUILD ? {
|
|
type: EmojiCategoryTypes.GUILD,
|
|
guild,
|
|
isNitroLocked: (isPremium ? !isPremium : emojiNitroLocked) && emojisPremiumLockedCount === emojis.length,
|
|
emojis,
|
|
emojisDisabled,
|
|
emojisHidden: hiddenEmojiIds
|
|
} : null;
|
|
if (r61 != null) {
|
|
if (guild.id === guildId) {
|
|
c26423_1.unshift(r61);
|
|
} else {
|
|
c26423_1.push(r61);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})(flattenedGuildIds, EmojiCategoryTypes.GUILD);
|
|
return EmojiStore.categories.reduce((acc, category) => {
|
|
L22: {
|
|
if (category === EmojiCategories.TOP_GUILD_EMOJI) {
|
|
const emojiUnavailableReasons3 = EmojiUtils.getEmojiUnavailableReasons({
|
|
categoryEmojis: allEmojis,
|
|
channel,
|
|
guildId,
|
|
intention
|
|
});
|
|
const { emojisDisabled: emojisDisabled3, emojisUnfiltered: emojisUnfiltered3 } = emojiUnavailableReasons3;
|
|
if (emojisUnfiltered3 != null && emojisUnfiltered3.length !== 0) {
|
|
acc.push.call(acc, {
|
|
type: EmojiCategoryTypes.TOP_GUILD_EMOJI,
|
|
id: category,
|
|
name: intl.formatToPlainString(t.W6Wi1X, {
|
|
guildName: stateFromStores2
|
|
}),
|
|
isNitroLocked: false,
|
|
emojis: emojisUnfiltered3,
|
|
emojisDisabled: emojisDisabled3
|
|
});
|
|
break L22;
|
|
}
|
|
return acc;
|
|
}
|
|
if (category === EmojiCategories.RECENT) {
|
|
const emojiUnavailableReasons2 = EmojiUtils.getEmojiUnavailableReasons({
|
|
categoryEmojis: [EmojiIntention.REACTION, EmojiIntention.DEFAULT_REACT_EMOJI].includes(intention) ? stateFromStoresArray2 : stateFromStoresArray,
|
|
channel,
|
|
guildId,
|
|
intention
|
|
});
|
|
const { emojisDisabled: emojisDisabled2, emojisUnfiltered: emojisUnfiltered2 } = emojiUnavailableReasons2;
|
|
if (emojisUnfiltered2 != null && emojisUnfiltered2.length !== 0) {
|
|
acc.push.call(acc, {
|
|
type: EmojiCategoryTypes.RECENT,
|
|
id: category,
|
|
name: intl.string(t["5TvaSm"]),
|
|
isNitroLocked: false,
|
|
emojis: emojisUnfiltered2,
|
|
emojisDisabled: emojisDisabled2
|
|
});
|
|
break L22;
|
|
}
|
|
return acc;
|
|
}
|
|
if (category === EmojiCategories.FAVORITES) {
|
|
const emojiUnavailableReasons = EmojiUtils.getEmojiUnavailableReasons({
|
|
categoryEmojis: stateFromStoresArray3,
|
|
channel,
|
|
guildId,
|
|
intention
|
|
});
|
|
const { emojisDisabled, emojisUnfiltered } = emojiUnavailableReasons;
|
|
if (emojisUnfiltered != null && emojisUnfiltered.length !== 0) {
|
|
acc.push.call(acc, {
|
|
type: EmojiCategoryTypes.FAVORITES,
|
|
id: category,
|
|
name: intl.string(t.y3LQCG),
|
|
isNitroLocked: false,
|
|
emojis: emojisUnfiltered,
|
|
emojisDisabled
|
|
});
|
|
break L22;
|
|
}
|
|
return acc;
|
|
}
|
|
if (category === EmojiCategories.CUSTOM) {
|
|
acc.push.apply(acc, [...c17153_4 ? c26423_1 : c26423_1.filter((item) => {
|
|
let r0;
|
|
if (item.type === EmojiCategoryTypes.GUILD) {
|
|
r0 = item.guild.id === guildId;
|
|
} else {
|
|
item.type;
|
|
r0 = false;
|
|
}
|
|
return r0;
|
|
})]);
|
|
} else {
|
|
acc.push({
|
|
type: EmojiCategoryTypes.UNICODE,
|
|
id: category,
|
|
name: category,
|
|
isNitroLocked: false
|
|
});
|
|
}
|
|
}
|
|
return acc;
|
|
}, soundmojiEmojiPickerSectionExperiment && c17153_3 ? [r7] : []);
|
|
}, [stateFromStores, a1, guildId, a0, isPremium, allEmojis, stateFromStores2, stateFromStoresArray2, stateFromStoresArray, stateFromStoresArray3, r28, soundmojiEmojiPickerSectionExperiment, r6]);
|
|
}
|
|
export function getUnicodeEmojiCategories() {
|
|
return UnicodeEmojis.getCategories().map((item) => ({
|
|
type: EmojiCategoryTypes.UNICODE,
|
|
id: item,
|
|
name: item,
|
|
isNitroLocked: false
|
|
}));
|
|
}
|
|
export function trackPremiumSettingsPaneOpened(a0) {
|
|
AnalyticsUtils.track(AnalyticEvents.PREMIUM_PROMOTION_OPENED, {
|
|
location_page: (a0 == null ? void 0 : a0.getGuildId()) != null ? AnalyticsPages.GUILD_CHANNEL : AnalyticsPages.DM_CHANNEL,
|
|
location_section: a0 != null ? AnalyticsSections.EMOJI_PICKER_POPOUT : AnalyticsSections.CUSTOM_STATUS_MODAL
|
|
});
|
|
}
|
|
export function trackEmojiSearchStart(a0, a1) {
|
|
const SEARCH_STARTED = AnalyticEvents.SEARCH_STARTED;
|
|
const r21 = {
|
|
search_type: EmojiIntention.REACTION === a1 ? SearchTypes.EMOJI_REACTION : EmojiIntention.AUTO_SUGGESTION === a1 ? SearchTypes.EMOJI_AUTO_SUGGESTION : SearchTypes.EMOJI,
|
|
location: a0
|
|
};
|
|
const analyticsId = EmojiPickerStore.getAnalyticsId();
|
|
HermesBuiltin.copyDataProperties(r21, analyticsId != null && analyticsId !== "" ? {
|
|
load_id: analyticsId
|
|
} : {});
|
|
AppAnalyticsUtils.trackWithMetadata(SEARCH_STARTED, r21);
|
|
}
|
|
export function trackEmojiSearchResultsViewed({ totalResults, numEmojiLocked, location: location2, searchQuery, intention: intention3, loadId }) {
|
|
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_RESULT_VIEWED, {
|
|
search_type: EmojiIntention.REACTION === intention3 ? SearchTypes.EMOJI_REACTION : EmojiIntention.AUTO_SUGGESTION === intention3 ? SearchTypes.EMOJI_AUTO_SUGGESTION : SearchTypes.EMOJI,
|
|
total_results: totalResults,
|
|
num_results_locked: numEmojiLocked,
|
|
query: searchQuery,
|
|
location: location2,
|
|
...loadId != null && loadId !== "" ? {
|
|
load_id: loadId
|
|
} : {}
|
|
});
|
|
}
|
|
export function trackEmojiSearchSelect({ emoji, emojiSuggestions, searchQuery, isLocked, location: location2, intention: intention3, index, messageId }) {
|
|
let uniqueName = emoji.uniqueName;
|
|
if (uniqueName == null) {
|
|
uniqueName = emoji.name;
|
|
}
|
|
const search_type = EmojiIntention.REACTION === intention3 ? SearchTypes.EMOJI_REACTION : EmojiIntention.AUTO_SUGGESTION === intention3 ? SearchTypes.EMOJI_AUTO_SUGGESTION : SearchTypes.EMOJI;
|
|
const SEARCH_RESULT_SELECTED = AnalyticEvents.SEARCH_RESULT_SELECTED;
|
|
const r30 = {
|
|
search_type,
|
|
location: location2,
|
|
expression_guild_id: emoji.guildId,
|
|
emoji_id: emoji.id,
|
|
emoji_name: uniqueName,
|
|
is_custom: emoji.id != null,
|
|
is_animated: emoji.animated,
|
|
is_locked: isLocked,
|
|
query: searchQuery,
|
|
index_num: index
|
|
};
|
|
let load_id = emojiSuggestions?.loadId;
|
|
if (load_id == null) {
|
|
load_id = EmojiPickerStore.getAnalyticsId();
|
|
}
|
|
HermesBuiltin.copyDataProperties(r30, load_id != null && load_id !== "" ? {
|
|
load_id
|
|
} : {});
|
|
r30.total_results = emojiSuggestions == null ? void 0 : emojiSuggestions.results?.length;
|
|
const r50 = emojiSuggestions == null;
|
|
let emoji_suggestion_ids = void 0;
|
|
if (!r50) {
|
|
const results = emojiSuggestions.results;
|
|
emoji_suggestion_ids = results == null ? void 0 : results.map((result) => result.emoji.id).filter((item) => item != null);
|
|
}
|
|
r30.emoji_suggestion_ids = emoji_suggestion_ids;
|
|
r30.message_id = messageId;
|
|
AppAnalyticsUtils.trackWithMetadata(SEARCH_RESULT_SELECTED, r30);
|
|
}
|
|
export function trackEmojiSearchEmpty({ location: location2, searchQuery, intention: intention3, loadId }) {
|
|
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_RESULT_EMPTY, {
|
|
search_type: EmojiIntention.REACTION === intention3 ? SearchTypes.EMOJI_REACTION : EmojiIntention.AUTO_SUGGESTION === intention3 ? SearchTypes.EMOJI_AUTO_SUGGESTION : SearchTypes.EMOJI,
|
|
query: searchQuery,
|
|
location: location2,
|
|
...loadId != null && loadId !== "" ? {
|
|
load_id: loadId
|
|
} : {}
|
|
});
|
|
}
|
|
export function trackEmojiFocus({ emoji, subCategory, position, newlyAddedHighlight }) {
|
|
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.EXPRESSION_PICKER_EXPRESSION_FOCUS, {
|
|
expression_section: subCategory == null ? void 0 : subCategory.toString(),
|
|
newly_added_highlight: newlyAddedHighlight,
|
|
emoji_id: emoji.id,
|
|
emoji_name: emoji.name,
|
|
emoji_animated: emoji.animated,
|
|
emoji_position: position
|
|
});
|
|
}
|
|
export function trackEmojiSelect({ emoji, location: location2, pickerIntention, category, subCategory = EmojiSubCategory.NONE, position, newlyAddedHighlight, isBurstReaction, messageId, lockedReason, visibleRowIndex }) {
|
|
const type = EmojiIntention.REACTION === pickerIntention ? isBurstReaction ? PremiumUpsellTypes.EMOJI_PICKER_SUPER_REACTION_EMOJI_CLICKED : PremiumUpsellTypes.EMOJI_PICKER_REACTION_EMOJI_CLICKED : EmojiIntention.STATUS === pickerIntention ? PremiumUpsellTypes.EMOJI_PICKER_STATUS_EMOJI_CLICKED : PremiumUpsellTypes.EMOJI_PICKER_EMOJI_CLICKED;
|
|
let uniqueName = emoji.uniqueName;
|
|
if (uniqueName == null) {
|
|
uniqueName = emoji.name;
|
|
}
|
|
AppAnalyticsUtils.trackWithMetadata(lockedReason != null ? AnalyticEvents.EXPRESSION_PICKER_LOCKED_EXPRESSION_SELECTED : AnalyticEvents.EXPRESSION_PICKER_EXPRESSION_SELECTED, {
|
|
type,
|
|
location: location2,
|
|
expression_id: emoji.id,
|
|
expression_name: uniqueName,
|
|
expression_guild_id: emoji.guildId,
|
|
is_custom: emoji.id != null,
|
|
is_animated: emoji.animated,
|
|
expression_picker_section: category,
|
|
expression_section: subCategory == null ? void 0 : subCategory.toString(),
|
|
emoji_position: position,
|
|
newly_added_highlight: newlyAddedHighlight,
|
|
is_burst: isBurstReaction,
|
|
message_id: messageId,
|
|
...lockedReason != null && {
|
|
locked_reason: EmojiDisabledReasons[lockedReason],
|
|
visible_row_index: visibleRowIndex
|
|
}
|
|
});
|
|
}
|
|
export function trackEmojiFavorited({ emoji, location: location2 }) {
|
|
let uniqueName = emoji.uniqueName;
|
|
if (uniqueName == null) {
|
|
uniqueName = emoji.name;
|
|
}
|
|
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.EXPRESSION_FAVORITED, {
|
|
location: location2,
|
|
expression_type: ExpressionPickerViewType.EMOJI,
|
|
expression_id: emoji.id,
|
|
expression_name: uniqueName,
|
|
expression_guild_id: emoji.guildId,
|
|
is_custom: emoji.id != null,
|
|
is_animated: emoji.animated
|
|
});
|
|
}
|
|
export { r56 as throttledTrackEmojiAutoSuggestDisplayed };
|
|
export function getAriaIdForEmojiCategory(a0, a1) {
|
|
return a0.type === EmojiCategoryTypes.GUILD ? a1 != null ? a1.name : "" : a0.id;
|
|
}
|
|
export function getStringForEmojiCategory(a0, a1) {
|
|
if (EmojiCategories.TOP_GUILD_EMOJI === a0) {
|
|
return intl.formatToPlainString(t.W6Wi1X, {
|
|
guildName: a1
|
|
});
|
|
}
|
|
if (EmojiCategories.RECENT === a0) {
|
|
return intl.string(t["5TvaSm"]);
|
|
}
|
|
if (EmojiCategories.FAVORITES === a0) {
|
|
return intl.string(t.y3LQCG);
|
|
}
|
|
if (EmojiCategories.ACTIVITY === a0) {
|
|
return intl.string(t.O783tR);
|
|
}
|
|
if (EmojiCategories.FLAGS === a0) {
|
|
return intl.string(t.vvaizu);
|
|
}
|
|
if (EmojiCategories.FOOD === a0) {
|
|
return intl.string(t.ldm9aY);
|
|
}
|
|
if (EmojiCategories.NATURE === a0) {
|
|
return intl.string(t.egIBDH);
|
|
}
|
|
if (EmojiCategories.OBJECTS === a0) {
|
|
return intl.string(t.gWm7Mk);
|
|
}
|
|
if (EmojiCategories.PEOPLE === a0) {
|
|
return intl.string(t.GX594D);
|
|
}
|
|
if (EmojiCategories.SYMBOLS === a0) {
|
|
return intl.string(t.QXMYAb);
|
|
}
|
|
if (EmojiCategories.TRAVEL === a0) {
|
|
return intl.string(t.w33hIP);
|
|
}
|
|
if (EmojiCategories.PREMIUM_UPSELL === a0) {
|
|
return intl.string(t.pAF6xE);
|
|
}
|
|
if (EmojiCategories.SOUNDMOJI === a0) {
|
|
return intl.string(t.f0Ezmv);
|
|
}
|
|
return a1 == null ? a0 : a1;
|
|
}
|
|
export function useEmojiSearchResults(a0, a1, a2, a3) {
|
|
let includeExternalGuilds;
|
|
const channel2 = a1;
|
|
const intention2 = a2;
|
|
const showOnlyUnicode = a3;
|
|
useEffect(() => {
|
|
FrecencyUserSettingsActionCreators.loadIfNecessary();
|
|
}, []);
|
|
includeExternalGuilds = (0, isExternalEmojiAllowedForIntention)(a2);
|
|
return useStateFromStores([EmojiStore], () => {
|
|
const query = a0.replace(/^:/, "").replace(/:$/, "");
|
|
return query !== "" ? EmojiStore.searchWithoutFetchingLatest({
|
|
channel: channel2,
|
|
query,
|
|
count: 0,
|
|
intention: intention2,
|
|
includeExternalGuilds,
|
|
showOnlyUnicode
|
|
}) : null;
|
|
}, [a0, a1, a2, includeExternalGuilds, a3], statesWillNeverBeEqual);
|
|
}
|
|
export function useFrequentlyUsedEmojis(a0) {
|
|
let env17150;
|
|
const r1 = env17150 = {
|
|
$parent: env6146
|
|
};
|
|
env17150[0] = a0;
|
|
useEffect($mk82326(), []);
|
|
return useStateFromStoresArray([EmojiStore], $mk82327(r1));
|
|
}
|
|
export function useFrequentlyUsedReactionEmojis(a0) {
|
|
let env17151;
|
|
const r1 = env17151 = {
|
|
$parent: env6146
|
|
};
|
|
env17151[0] = a0;
|
|
useEffect($mk82328(), []);
|
|
return useStateFromStoresArray([EmojiStore], $mk82329(r1));
|
|
}
|
|
export function useFavoriteEmojis(a0) {
|
|
let env17152;
|
|
const r1 = env17152 = {
|
|
$parent: env6146
|
|
};
|
|
env17152[0] = a0;
|
|
useEffect($mk82330(), []);
|
|
return useStateFromStoresArray([EmojiStore], $mk82331(r1));
|
|
}
|
|
export function useIsFavoriteEmoji(c17158_0, c17158_1) {
|
|
useEffect(() => {
|
|
FrecencyUserSettingsActionCreators.loadIfNecessary();
|
|
}, []);
|
|
return useStateFromStores([EmojiStore], () => c17158_1 != null && EmojiStore.getDisambiguatedEmojiContext(c17158_0).isFavoriteEmojiWithoutFetchingLatest(c17158_1));
|
|
}
|
|
export function useEmojiInPriorityOrder(c17159_0) {
|
|
useEffect(() => {
|
|
FrecencyUserSettingsActionCreators.loadIfNecessary();
|
|
}, []);
|
|
return useStateFromStoresArray([EmojiStore], () => EmojiStore.getDisambiguatedEmojiContext(c17159_0).getEmojiInPriorityOrderWithoutFetchingLatest());
|
|
}
|
|
export function getEmojiSubCategory(a0, a1, a2) {
|
|
if (a2 == null) {
|
|
return EmojiSubCategory.NONE;
|
|
}
|
|
const r8 = a0.map((item) => {
|
|
let id = item.id;
|
|
if (id == null) {
|
|
id = item.uniqueName;
|
|
}
|
|
if (id == null) {
|
|
id = item.name;
|
|
}
|
|
return id;
|
|
});
|
|
const r11 = a1.map((item) => item.id);
|
|
return r8.includes(a2) ? EmojiSubCategory.TOP_GUILD_EMOJI : r11.includes(a2) ? EmojiSubCategory.NEWLY_ADDED_EMOJI : EmojiSubCategory.NONE;
|
|
}
|
|
export function getSearchPlaceholder(a0, a1) {
|
|
return a0 === EmojiIntention.REACTION ? a1 ? intl.string(t["h7ES+n"]) : intl.string(t["6any2A"]) : intl.string(t.KgK5qg);
|
|
}
|