Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
86 lines
3.5 KiB
TypeScript
86 lines
3.5 KiB
TypeScript
// Module ID: 9864
|
|
// Function ID: 9865
|
|
// Name: useMobileInviteSuggestions
|
|
// Dependencies: [32, 19, 2021, 1979, 9865, 4598, 7750, 1074, 1085, 504, 1242, 9878, 9879, 2]
|
|
// Exports: default
|
|
|
|
// Module 9864 (useMobileInviteSuggestions)
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1242 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import GuildMemberStore from "GuildMemberStore" /* 2021 */;
|
|
import GuildStore from "GuildStore" /* 1979 */;
|
|
import InviteSuggestionsStore from "InviteSuggestionsStore" /* 9865 */;
|
|
import SortedVoiceStateStore from "SortedVoiceStateStore" /* 4598 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
const require = fn;
|
|
const InviteTargetTypes = fn(7750).InviteTargetTypes;
|
|
const AnalyticEvents = fn(1074).AnalyticEvents;
|
|
const NOOP_NULL = fn(1085).NOOP_NULL;
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/instant_invite/native/useMobileInviteSuggestions.tsx");
|
|
|
|
export default function useMobileInviteSuggestions(arg0, _location, arg2, application_id) {
|
|
_require = arg0;
|
|
dependencyMap = arg2;
|
|
_slicedToArray = application_id;
|
|
let items = [closure_7, SortedVoiceStateStore];
|
|
[rows, closure_5] = require("initialize").useStateFromStoresArray(items, () => {
|
|
const items = [InviteSuggestionsStore.getInviteSuggestionRows(), ];
|
|
let voiceStatesForChannel = null;
|
|
if (null != closure_0) {
|
|
voiceStatesForChannel = SortedVoiceStateStore.getVoiceStatesForChannel(tmp);
|
|
}
|
|
items[1] = voiceStatesForChannel;
|
|
return items;
|
|
});
|
|
[isFetchingRows, closure_7] = rows.useState(true);
|
|
const items1 = [rows, arg0, isFetchingRows, application_id, _location];
|
|
const effect = rows.useEffect(() => {
|
|
if (!isFetchingRows) {
|
|
const initialCounts = InviteSuggestionsStore.getInitialCounts();
|
|
const obj3 = { location: _location, num_suggestions: rows.length, guild_id: closure_0.guild_id, num_friends: null, num_dms: null, num_group_dms: null, application_id: null };
|
|
({ numFriends: obj2.num_friends, numDms: obj2.num_dms, numGroupDms: obj2.num_group_dms } = initialCounts);
|
|
obj3.application_id = application_id;
|
|
AnalyticsUtilsDefault.track(AnalyticEvents.INVITE_SUGGESTION_OPENED, obj3);
|
|
}
|
|
}, items1);
|
|
const items2 = [arg0, arg2];
|
|
const effect1 = rows.useEffect(() => {
|
|
closure_7(true);
|
|
let isGuildVoiceResult = !tmp3;
|
|
if (dependencyMap !== constants.EMBEDDED_APPLICATION) {
|
|
isGuildVoiceResult = set.isGuildVoice();
|
|
}
|
|
if (isGuildVoiceResult) {
|
|
const obj2 = { location: "useMobileInviteSuggestions", guildId: set.guild_id };
|
|
isGuildVoiceResult = closure_0(9878).getGuildMembersInMobileVCInvitesExperiment(obj2);
|
|
const obj = closure_0(9878);
|
|
}
|
|
if (dependencyMap !== constants.EMBEDDED_APPLICATION) {
|
|
if (!isGuildVoiceResult) {
|
|
let memberIds = closure_5.getMemberIds(set.guild_id);
|
|
}
|
|
const _Set = Set;
|
|
set = new Set(memberIds);
|
|
if (isGuildVoiceResult) {
|
|
isGuildVoiceResult = null != closure_5;
|
|
}
|
|
if (isGuildVoiceResult) {
|
|
const item = closure_5.forEach((user) => {
|
|
set.add(user.user.id);
|
|
});
|
|
}
|
|
const obj4 = { omitUserIds: set, guild: isFetchingRows.getGuild(set.guild_id), channel: set, inviteTargetType: dependencyMap };
|
|
const inviteSuggestions = closure_0(9879).loadInviteSuggestions(obj4);
|
|
const obj3 = closure_0(9879);
|
|
inviteSuggestions.catch(NOOP_NULL).finally(() => {
|
|
closure_1_7(false);
|
|
});
|
|
}
|
|
memberIds = [];
|
|
}, items2);
|
|
return { rows, isFetchingRows };
|
|
};
|