This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
// Metro module 6021 (f6022).
const r9 = {
SENDING: "sending",
SENT: "sent",
ERROR: "error"
};
const r21 = {
GUILD: 0,
0: "GUILD",
GROUP_DM: 1,
1: "GROUP_DM",
FRIEND: 2,
2: "FRIEND"
};
const set = new Set([r21.GUILD, r21.GROUP_DM]);
const r32 = {
STREAM: 1,
1: "STREAM",
EMBEDDED_APPLICATION: 2,
2: "EMBEDDED_APPLICATION",
ROLE_SUBSCRIPTIONS_PURCHASE: 3,
3: "ROLE_SUBSCRIPTIONS_PURCHASE"
};
const r37 = {
MAIN: "main",
SETTINGS: "settings"
};
export { r9 as InviteSendStates };
export { r21 as InviteTypes };
export { set as DESKTOP_APP_REDIRECTABLE_INVITE_TYPES };
export { r32 as InviteTargetTypes };
export { r37 as InstantInviteModalPages };
@@ -0,0 +1,139 @@
// Metro module 8352 (f8353).
import GuildStore from "../../stores/GuildStore";
import { EMPTY_STRING_SNOWFLAKE_ID, GuildFeatures } from "../../Constants";
import InstantInviteUtils from "../../utils/InstantInviteUtils";
import { createExperiment } from "../experiments/index";
import { useStateFromStores } from "../../_bundle/defaultAreStatesEqual";
let value, experiment, experiment2;
const getDefaultInviteExpiration = function getDefaultInviteExpiration({ guild, experimentConfig }) {
let defaultMaxAge;
if (guild == null ? void 0 : guild.features.has(GuildFeatures.HUB)) {
return InstantInviteUtils.INVITE_OPTIONS_FOREVER.value;
}
if (experimentConfig != null) {
let defaultMaxAge2 = experimentConfig.defaultMaxAge;
if (defaultMaxAge2 == null) {
defaultMaxAge2 = value;
}
return defaultMaxAge2;
}
let guildId2 = guild?.id;
if (guildId2 == null) {
guildId2 = EMPTY_STRING_SNOWFLAKE_ID;
}
const currentConfig = experiment.getCurrentConfig({
guildId: guildId2,
location: "getDefaultInviteExpiration"
});
if (currentConfig.defaultMaxAge !== value) {
defaultMaxAge = currentConfig.defaultMaxAge;
} else {
defaultMaxAge = experiment2.getCurrentConfig({
guildId: guildId2,
location: "getDefaultInviteExpiration"
}).defaultMaxAge;
if (defaultMaxAge == null) {
defaultMaxAge = value;
}
}
return defaultMaxAge;
};
value = InstantInviteUtils.INVITE_OPTIONS_7_DAYS.value;
experiment = createExperiment({
kind: "guild",
id: "2025-08_default_invite_expiration_guild",
label: "Default Invite Expiration Guild",
defaultConfig: {
defaultMaxAge: 604800
},
treatments: [{
id: 1,
label: "14 days",
config: {
defaultMaxAge: 1209600
}
}, {
id: 2,
label: "30 days",
config: {
defaultMaxAge: 2592000
}
}, {
id: 3,
label: "60 days",
config: {
defaultMaxAge: 5184000
}
}]
});
experiment2 = createExperiment({
kind: "guild",
id: "2026-05_default_invite_expiration_guild_web",
label: "Default Invite Expiration Guild Web",
defaultConfig: {
defaultMaxAge: 604800
},
treatments: [{
id: 1,
label: "14 days",
config: {
defaultMaxAge: 1209600
}
}, {
id: 2,
label: "30 days",
config: {
defaultMaxAge: 2592000
}
}, {
id: 3,
label: "60 days",
config: {
defaultMaxAge: 5184000
}
}]
});
export { value as DEFAULT_MAX_AGE };
export { experiment as DefaultInviteExpirationGuildExperiment };
export { experiment2 as DefaultInviteExpirationGuildWebExperiment };
export { getDefaultInviteExpiration };
export function useDefaultInviteExpiration({ guildId, location: location2 }) {
const guildId2 = guildId == null ? EMPTY_STRING_SNOWFLAKE_ID : guildId;
const experiment3 = experiment.useExperiment({
guildId: guildId2,
location: location2
});
let experimentConfig = experiment2.useExperiment({
guildId: guildId2,
location: location2
});
if (experiment3?.defaultMaxAge !== value) {
experimentConfig = experiment3;
}
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
return guildId == null ? null : getDefaultInviteExpiration({
guild: stateFromStores,
experimentConfig
});
}
export function useMaxAgeOptions(a0) {
let guildId2 = a0.guildId;
const location2 = a0.location;
if (guildId2 == null) {
guildId2 = EMPTY_STRING_SNOWFLAKE_ID;
}
const experiment3 = experiment.useExperiment({
guildId: guildId2,
location: location2
});
let r14 = experiment2.useExperiment({
guildId: guildId2,
location: location2
});
if (experiment3?.defaultMaxAge !== value) {
r14 = experiment3;
}
return InstantInviteUtils.getMaxAgeOptions({
includeExperimentalValues: [r14?.defaultMaxAge]
});
}
@@ -0,0 +1,20 @@
// Metro module 12209 (f12210).
import { create } from "../../_bundle/Module644";
import { batchUpdates } from "../../_bundle/Module705";
let c8438_2 = create(() => ({}));
export function setSendState(c19732_0, c19732_1, c19732_2) {
batchUpdates(() => {
c8438_2.setState((state) => {
const r0 = {
...state
};
const r7 = {
...state[c19732_0]
};
r7[c19732_1] = c19732_2;
r0[c19732_0] = r7;
return r0;
});
});
}
export { c8438_2 as useGuildInviteSendStates };
@@ -0,0 +1,19 @@
// Metro module 11805 (f11806).
import { create } from "../../_bundle/Module644";
import { batchUpdates } from "../../_bundle/Module705";
let c8093_2 = create(() => ({}));
export function setSendState(c19184_0, c19184_1, c19184_2) {
const state = c8093_2.getState();
batchUpdates(() => {
const r10 = {
...state
};
const r11 = {
...state[c19184_0]
};
r11[c19184_1] = c19184_2;
r10[c19184_0] = r11;
c8093_2.setState(r10);
});
}
export { c8093_2 as useInstantInviteSendStates };
@@ -0,0 +1,85 @@
// Metro module 4175 (f4176).
import _slicedToArray from "../../_bundle/_slicedToArray";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import Module1464 from "../../_bundle/Module1464";
import { getFirstQueryStringValue } from "../../utils/QueryStringUtils";
let c2404_4, c2404_5, c2404_6, generateInviteKeyFromExtraData;
const readSnowflake = function readSnowflake(a0) {
return typeof a0 === "string" ? SnowflakeUtils.isProbablyAValidSnowflake(a0) ? a0 : void 0 : void 0;
};
generateInviteKeyFromExtraData = function generateInviteKeyFromExtraData({ baseCode, guildScheduledEventId, targetChannelId, targetMessageId }) {
const r3 = {};
if (guildScheduledEventId != null) {
r3[c2404_4] = guildScheduledEventId;
}
if (targetChannelId != null) {
r3[c2404_5] = targetChannelId;
if (targetMessageId != null) {
r3[c2404_6] = targetMessageId;
}
}
const r17 = Module1464.stringify(r3);
return r17 !== "" ? `${baseCode}?${r17}` : baseCode;
};
c2404_4 = "event";
c2404_5 = "channel";
c2404_6 = "message";
export { readSnowflake };
export function generateInviteKeyFromUrlParams(a0, a1) {
let r22;
if (a1 == null) {
return a0;
}
const r4 = a1.charAt(0) === "?" ? a1.substring(1) : a1;
try {
r22 = Module1464.parse(r4);
} catch ($e) {
return a0;
}
const r12 = r22;
const firstQueryStringValue = getFirstQueryStringValue(r12[c2404_4]);
const targetChannelId = readSnowflake(getFirstQueryStringValue(r12[c2404_5]));
return generateInviteKeyFromExtraData({
baseCode: a0,
guildScheduledEventId: firstQueryStringValue,
targetChannelId,
targetMessageId: targetChannelId != null ? readSnowflake(getFirstQueryStringValue(r22[c2404_6])) : void 0
});
}
export { generateInviteKeyFromExtraData };
export function parseExtraDataFromInviteKey(a0) {
const [baseCode, r7] = a0.split("?");
if (r7 == null) {
return {
baseCode
};
}
const r11 = Module1464.parse(r7);
const firstQueryStringValue = getFirstQueryStringValue(r11[c2404_4]);
const firstQueryStringValue2 = getFirstQueryStringValue(r11[c2404_5]);
const targetChannelId = typeof firstQueryStringValue2 === "string" ? SnowflakeUtils.isProbablyAValidSnowflake(firstQueryStringValue2) ? firstQueryStringValue2 : void 0 : void 0;
const r37 = targetChannelId != null;
let targetMessageId = void 0;
if (r37) {
const firstQueryStringValue3 = getFirstQueryStringValue(r11[c2404_6]);
targetMessageId = typeof firstQueryStringValue3 === "string" ? SnowflakeUtils.isProbablyAValidSnowflake(firstQueryStringValue3) ? firstQueryStringValue3 : void 0 : void 0;
}
return {
baseCode,
guildScheduledEventId: firstQueryStringValue,
targetChannelId,
targetMessageId
};
}
export function parseInviteCodeFromInviteKey(a0) {
return _slicedToArray(a0.split("?"), 1)[0];
}
export function getInviteKeySearchSuffix(a0) {
const r4 = a0.indexOf("?");
return r4 >= 0 ? a0.substring(r4) : "";
}
export function getInviteInstanceId(a0, a1) {
if (a1 != null) {
return `${a1}:${_slicedToArray(a0.split("?"), 1)[0]}`;
}
}
@@ -0,0 +1,43 @@
// Metro module 6020 (f6021).
import { isEventUpcoming } from "../guild_scheduled_events/GuildScheduledEventStore";
import { isGuildVocalChannelType, isMultiUserDM } from "../../records/ChannelRecord";
import * as _Constants from "./Constants";
import { InviteTargetTypes, InviteTypes } from "./Constants";
import { guildInviteCanEmbedProfile } from "../guild_profile/GuildProfileUtils";
let c3809_7 = {
EVENT: "event",
APPLICATION: "application",
PROFILE: "profile",
DEFAULT: "default",
VOICE_CHANNEL: "voice_channel"
};
exports.InviteTypes = _Constants.InviteTypes;
export function isGroupDMInvite(a0) {
return a0.type === InviteTypes.GROUP_DM || a0.channel != null && isMultiUserDM(a0.channel.type);
}
export function isGuildScheduledEventInviteEmbed({ guild_scheduled_event }) {
return guild_scheduled_event != null && isEventUpcoming(guild_scheduled_event);
}
export function isRoleSubscriptionInvite(a0) {
return a0.target_type === InviteTargetTypes.ROLE_SUBSCRIPTIONS_PURCHASE;
}
export function isStreamInvite(a0) {
return a0.target_type === InviteTargetTypes.STREAM && a0.target_user != null;
}
export function isFriendInvite(a0) {
return a0.type === InviteTypes.FRIEND || a0.guild == null && a0.inviter != null;
}
export function isEmbeddedApplicationInvite(a0) {
return a0.target_type === InviteTargetTypes.EMBEDDED_APPLICATION;
}
export function isVoiceChannelInvite(a0) {
return a0.channel != null && isGuildVocalChannelType(a0.channel.type);
}
export function getInviteType(a0) {
return typeof a0.type === "number" ? a0.type : a0.type === InviteTypes.GROUP_DM || a0.channel != null && isMultiUserDM(a0.channel.type) ? InviteTypes.GROUP_DM : a0.type === InviteTypes.FRIEND || a0.guild == null && a0.inviter != null ? InviteTypes.FRIEND : InviteTypes.GUILD;
}
export { c3809_7 as GuildInviteExtendedType };
export function getGuildInviteExtendedType(a0) {
const guild_scheduled_event = a0.guild_scheduled_event;
return guild_scheduled_event != null && isEventUpcoming(guild_scheduled_event) ? c3809_7.EVENT : a0.target_type === InviteTargetTypes.EMBEDDED_APPLICATION ? c3809_7.APPLICATION : guildInviteCanEmbedProfile(a0) ? c3809_7.PROFILE : a0.channel != null && isGuildVocalChannelType(a0.channel.type) ? c3809_7.VOICE_CHANNEL : c3809_7.DEFAULT;
}
@@ -0,0 +1,6 @@
// Metro module 8227 (f8228).
import { Permissions } from "../../Constants";
export function canViewInviteModal(a0, a1, a2, a3) {
const r8 = a2 == null ? a1 : a2;
return r8 != null && a0.can(Permissions.CREATE_INSTANT_INVITE, r8) || a1 != null && a1.vanityURLCode != null || a3?.invite_code != null;
}
+4
View File
@@ -0,0 +1,4 @@
// Metro module 6044 (f6045).
export default function getInviteURL(r4 = "", r6 = true) {
return `${r6 ? `${location.protocol}//` : ""}${window.GLOBAL_ENV.INVITE_HOST}${`/${r4}`}`;
};
@@ -0,0 +1,62 @@
// Metro module 4363 (f4364).
import { Linking, NativeModules } from "react-native";
import { isAndroid } from "../../../utils/PlatformUtils";
import Module4364 from "../../../_bundle/Module4364";
export function sendSMS(a0, a1) {
if (isAndroid()) {
let body = a0.body;
if (body == null) {
body = "";
}
let recipients = a0.recipients;
if (recipients == null) {
recipients = [];
}
Module4364.sendSMS(body, recipients);
} else {
NativeModules.DCDSend.sendSMS(a0, a1);
}
}
export function sendMail(a0, a1) {
if (isAndroid()) {
let subject = a0.subject;
if (subject == null) {
subject = "";
}
let body = a0.body;
if (body == null) {
body = "";
}
let recipients = a0.recipients;
if (recipients == null) {
recipients = [];
}
Module4364.sendMail(subject, body, recipients);
} else {
NativeModules.DCDSend.sendMail(a0, a1);
}
}
export function canSendSMS() {
return isAndroid() ? Promise.resolve(Module4364.canSendSMS()) : NativeModules.DCDSend.canSendSMS();
}
export function canSendMail() {
return isAndroid() ? Promise.resolve(Module4364.canSendMail()) : NativeModules.DCDSend.canSendMail();
}
export function canOpenUrlScheme(a0) {
let r25;
if (isAndroid()) {
try {
r25 = Promise.resolve(Module4364.canOpenUrlScheme(a0));
} catch ($e) {
return Promise.resolve(false);
}
return r25;
}
return new Promise((c25056_0) => {
Linking.canOpenURL(`${a0}://app`).then((result) => {
c25056_0(result);
}).catch(() => {
c25056_0(false);
});
});
}
@@ -0,0 +1,145 @@
// Metro module 12208 (f12209).
import { useMemo } from "react";
import GuildChannelStore from "../../../stores/GuildChannelStore";
import GuildMemberCountStore from "../../../stores/GuildMemberCountStore";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import GuildStore from "../../../stores/GuildStore";
import PermissionStore from "../../../stores/PermissionStore";
import SortedGuildStore from "../../../stores/SortedGuildStore";
import UserStore from "../../../stores/UserStore";
import { setSendState } from "../GuildInviteSendStateStore";
import { InviteSendStates } from "../Constants";
import { AnalyticEvents, Permissions } from "../../../Constants";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import fuzzysearch from "../../../_bundle/fuzzysearch";
import { useStateFromStoresArray } from "../../../_bundle/Module589";
import { AccessibilityAnnouncer } from "../../../_bundle/Module3902";
import { intl, t } from "../../../intl/index.native";
import InstantInviteActionCreators from "../../../actions/InstantInviteActionCreators";
import InstantInviteUtils from "../../../utils/InstantInviteUtils";
import InviteQueue, { InvitePropertiesType } from "../../../lib/InviteQueue";
function $mk116384($env) {
return () => {
const r2 = $env;
(0, setSendState)(r2[0], r2[1], InviteSendStates.SENT);
AccessibilityAnnouncer.announce(intl.string(t.PuLLzP));
};
}
let env8437 = {};
export function showGuildInviteActionSheet(a0, a1) {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: "Invite to Guilds",
source: a1
});
ActionSheetActionCreators.openLazy(import("./action_sheet/invite_to_guilds/GuildInviteActionSheet"), `invite-to-guilds-${a0}`, {
recipientId: a0,
source: a1
});
}
export function useServerInviteRows(a0, a1) {
const stateFromStoresArray = useStateFromStoresArray([SortedGuildStore, GuildStore], () => {
const flattenedGuildIds = SortedGuildStore.getFlattenedGuildIds();
const r5 = [];
let c27273_0 = r5;
flattenedGuildIds.forEach((flattenedGuildId) => {
const guild = GuildStore.getGuild(flattenedGuildId);
if (guild != null) {
c27273_0.push(guild);
}
});
return r5;
});
return useMemo(() => {
if (a0 == null) {
return [[], []];
}
const memberCounts = GuildMemberCountStore.getMemberCounts();
const r9 = [];
let c27274_1 = r9;
const r10 = [];
let c27274_2 = r10;
stateFromStoresArray.forEach((item) => {
if (PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, item) || item.vanityURLCode != null) {
const name = item.name;
if ((a1 == null || fuzzysearch(a1.toLowerCase(), name.toLowerCase())) && !GuildMemberStore.isMember(item.id, a0)) {
let memberCount = memberCounts[item.id];
if (memberCount == null) {
memberCount = 0;
}
const r30 = {
guild: item,
memberCount
};
if (item.ownerId === UserStore.getCurrentUser()?.id) {
c27274_1.push(r30);
} else {
c27274_2.push(r30);
}
}
}
});
return [r9, r10];
}, [stateFromStoresArray, a1, a0]);
}
export async function sendGuildInvite(c27272_0, c27272_1, c27272_2) {
let c27272_3, c27272_4;
let c27272_5 = 0;
const r12 = env8437;
L12: {
try {
let env30511;
c27272_4 = r12;
const r32 = env30511 = {
$parent: r12
};
c27272_3 = r32;
env30511[0] = c27272_0;
env30511[1] = c27272_1;
env30511[2] = c27272_2;
env30511[3] = void 0;
c27272_5 = 1;
(0, setSendState)(c27272_0, c27272_1, InviteSendStates.SENDING);
AccessibilityAnnouncer.announce(intl.string(t.kC3ZRG));
const defaultChannel = GuildChannelStore.getDefaultChannel(c27272_1, true, Permissions.CREATE_INSTANT_INVITE);
if (defaultChannel == null) {
throw Error();
}
const invite = await InstantInviteActionCreators.createInvite(defaultChannel.id, {
max_uses: InstantInviteUtils.INVITE_OPTIONS_ONCE.value,
max_age: InstantInviteUtils.INVITE_OPTIONS_7_DAYS.value,
unique: true
}, c27272_2);
const r99 = c27272_3;
env30511[3] = invite;
InviteQueue.enqueue({
inviteKey: env30511[3].code,
type: InvitePropertiesType.USER,
user: UserStore.getUser(env30511[0]),
location: env30511[2],
inviteAnalyticsMetadata: {
source: env30511[2]
}
}, $mk116384(r99));
c27272_5 = 0;
} catch ($e) {
let r31 = $e;
if (c27272_5 !== 0) {
while (true) {
try {
c27272_5 = 0;
(0, setSendState)(env30511[0], env30511[1], InviteSendStates.ERROR);
AccessibilityAnnouncer.announce(intl.string(t.fEptJP));
break L12;
} catch ($e) {
r31 = $e;
if (c27272_5 === 0) {
break;
}
}
}
}
throw r31;
}
}
}
@@ -0,0 +1,19 @@
// Metro module 8354 (f8355).
const r9 = {
TWITTER: "twitter",
WHATSAPP: "whatsapp",
GMAIL: "googlegmail",
LINE: "line",
MESSENGER: "fb-messenger",
TELEGRAM: "tg"
};
const r16 = {};
r16[r9.TWITTER] = (a0) => `twitter://post?message=${a0}`;
r16[r9.WHATSAPP] = (a0) => `whatsapp://send?text=${a0}`;
r16[r9.GMAIL] = (a0, a1) => `googlegmail://co?subject=${a0}&body=${a1}`;
r16[r9.LINE] = (a0) => `https://line.me/R/msg/text/?${a0}`;
r16[r9.MESSENGER] = (a0) => `fb-messenger://share/?link=${a0}`;
r16[r9.TELEGRAM] = (a0, a1) => `https://telegram.me/share/url?url=${a1}&text=${a0}`;
export { r9 as SHARE_APPS_KEY };
export { r16 as SHARE_URLS };
export const IOS_COPY_TO_PASTEBOARD = "CopyToPasteboard";
@@ -0,0 +1,17 @@
// Metro module 16234 (f16235).
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import ToastActionCreators from "../../toast/native/ToastActionCreators";
import { intl, t } from "../../../intl/index.native";
class InstantInviteManager extends AutomaticLifecycleManager {
actions = {
NATIVE_APP_INSTANT_INVITE_GDM_SHARE_FAILED: () => this.shareInviteFailed()
};
shareInviteFailed = () => {
ToastActionCreators.open({
key: "GROUP_DM_ADD_ERROR",
content: intl.string(t["N/9OFy"])
});
};
}
const instantInviteManager = new InstantInviteManager();
export default instantInviteManager;
@@ -0,0 +1,248 @@
// Metro module 8348 (f8349).
import GuildTemplateStore from "../../guild_templates/GuildTemplateStore";
import { ChannelRecordBase } from "../../../records/ChannelRecord";
import ChannelStore from "../../../stores/ChannelStore";
import CreateInviteModalStore from "../../../stores/CreateInviteModalStore";
import GuildChannelStore from "../../../stores/GuildChannelStore";
import InviteStore from "../../../stores/InviteStore";
import PresenceStore from "../../../stores/PresenceStore";
import UserStore from "../../../stores/UserStore";
import DisplayedInviteStore from "../../../stores/native/DisplayedInviteStore";
import { InviteTargetTypes } from "../Constants";
import { IOS_COPY_TO_PASTEBOARD } from "./InstantInviteConstants";
import { AnalyticEvents, InviteOptionsType, Permissions } from "../../../Constants";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { getStreamerApplication } from "../../go_live/utils/StreamerApplicationSelectors";
import CreateInviteModalActionCreators from "../../../actions/CreateInviteModalActionCreators";
import openInstantInviteActionSheet from "./components/openInstantInviteActionSheet";
import { parseExtraDataFromInviteKey, parseInviteCodeFromInviteKey } from "../InviteCodeUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { showShareActionSheet } from "../../action_sheet/native/showShareActionSheet";
import { presentInviteSent, presentLinkCopied } from "../../toast/native/ToastUtils";
import getInviteURL from "../getInviteURL";
import { copy } from "../../../utils/ClipboardUtils.native";
import { canOpenUrlScheme } from "./DCDSendUtils";
import Module38 from "../../../_bundle/Module38";
import { getInviteChannelId } from "../../../utils/native/InstantInviteUtils";
let trackOptionClicked;
const showInstantInviteActionSheet = function showInstantInviteActionSheet(a0, a1) {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: "Instant Invite",
source: a1?.source
});
const stream = a1?.stream;
const r19 = {
isActionSheet: true,
location: "IOS Instant Invite Action Sheet Mount"
};
if (stream != null) {
const stream2 = a1.stream;
r19.targetType = InviteTargetTypes.STREAM;
r19.targetUserId = stream2.ownerId;
const streamerApplication = getStreamerApplication(stream2, PresenceStore);
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: "Send Stream Invite",
location: r19.location,
other_user_id: stream2.ownerId,
application_id: streamerApplication?.id,
application_name: streamerApplication?.name,
game_id: streamerApplication?.id
});
} else if (a1?.targetApplicationId != null) {
r19.targetType = InviteTargetTypes.EMBEDDED_APPLICATION;
r19.targetApplicationId = a1.targetApplicationId;
}
if (a1?.createInvite !== false && a1?.code == null) {
CreateInviteModalActionCreators.init(a0.getGuildId(), a0.id, r19);
}
openInstantInviteActionSheet({
channel: a0,
source: a1?.source,
guildScheduledEventId: a1?.guildScheduledEventId,
targetApplicationId: a1?.targetApplicationId,
code: a1?.code,
vanityURLCode: null,
stackingBehavior: a1?.stackingBehavior
});
};
trackOptionClicked = function trackOptionClicked(a0, a1, a2, a3) {
let guild_id;
const invite = InviteStore.getInvite(parseExtraDataFromInviteKey(a0).baseCode);
const INSTANT_INVITE_OPTION_CLICKED = AnalyticEvents.INSTANT_INVITE_OPTION_CLICKED;
if (a1 instanceof ChannelRecordBase) {
guild_id = a1.guild_id;
} else {
const channel = ChannelStore.getChannel(a1?.id);
guild_id = channel == null ? void 0 : channel.getGuildId();
}
AnalyticsUtils.track(INSTANT_INVITE_OPTION_CLICKED, {
invite_type: a2,
guild_id,
channel_id: a1?.id,
invite_code: parseInviteCodeFromInviteKey(a0),
invite_channel_type: a1?.type,
invite_inviter_id: UserStore.getCurrentUser()?.id,
location: a3,
application_id: invite == null ? void 0 : invite.target_application?.id
});
};
export function showInstantInviteActionSheetForChannel(a0) {
const channel = ChannelStore.getChannel(a0);
if (channel != null) {
showInstantInviteActionSheet(channel);
}
}
export { showInstantInviteActionSheet };
export function showVanityUrlInviteActionSheet(a0, a1, a2, a3) {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: "Vanity URL Invite",
source: a2
});
CreateInviteModalActionCreators.init(a0.id, a1.id, {
skipCreateInvite: true
});
openInstantInviteActionSheet({
vanityURLCode: a0.vanityURLCode,
channel: a1,
source: a2,
guildScheduledEventId: a3?.guildScheduledEventId,
stackingBehavior: a3?.stackingBehavior
});
}
export { trackOptionClicked };
export function getShareMessage(a0) {
return a0;
}
export function handleOpenShareSheet(a0, a1, a2, a3, r5 = true) {
let guild_id;
if (a0 != null) {
const r15 = parseExtraDataFromInviteKey(a0);
const invite = InviteStore.getInvite(r15.baseCode);
const INSTANT_INVITE_SHARED = AnalyticEvents.INSTANT_INVITE_SHARED;
if (a1 instanceof ChannelRecordBase) {
guild_id = a1.guild_id;
} else {
const channel = ChannelStore.getChannel(a1?.id);
guild_id = channel == null ? void 0 : channel.getGuildId();
}
const id = a1?.id;
AnalyticsUtils.track(INSTANT_INVITE_SHARED, {
guild_id,
channel_id: id,
invite_code: r15.baseCode,
invite_channel_type: a1?.type,
invite_inviter_id: UserStore.getCurrentUser()?.id,
invite_guild_scheduled_event_id: r15.guildScheduledEventId,
location: a3,
application_id: invite == null ? void 0 : invite.target_application?.id
});
if (r5) {
trackOptionClicked(a0, a1, InviteOptionsType.SHARE, a3);
}
ActionSheetActionCreators.hideAllActionSheets();
showShareActionSheet({
message: a2,
iOSOnlyShareCallback: (a0, a1) => {
if ((a0 ? a1 != null : a0) && !a1.includes(IOS_COPY_TO_PASTEBOARD)) {
presentInviteSent();
}
}
}, a3);
}
}
export function handleCopy(a0, a1, a2, r6 = true) {
let guild_id;
if (a0 != null) {
const r13 = parseExtraDataFromInviteKey(a0);
copy(getInviteURL(a0));
const invite = InviteStore.getInvite(r13.baseCode);
const COPY_INSTANT_INVITE = AnalyticEvents.COPY_INSTANT_INVITE;
if (a1 instanceof ChannelRecordBase) {
guild_id = a1.guild_id;
} else {
const channel = ChannelStore.getChannel(a1?.id);
guild_id = channel == null ? void 0 : channel.getGuildId();
}
AnalyticsUtils.track(COPY_INSTANT_INVITE, {
server: guild_id,
channel: a1?.id,
channel_type: a1?.type,
location: a2,
code: r13.baseCode,
guild_scheduled_event_id: r13.guildScheduledEventId,
application_id: invite == null ? void 0 : invite.target_application?.id
});
if (r6) {
trackOptionClicked(a0, a1, InviteOptionsType.COPY);
}
presentLinkCopied();
}
}
export function handlePressSettings(a0, c16520_1, a2) {
let r7 = a2;
ActionSheetActionCreators.hideActionSheet();
const pendingSettings = CreateInviteModalStore.getPendingSettings();
const { guild_id, id } = a0;
if (a2 == null) {
r7 = "Instant Invite Action Sheet";
}
CreateInviteModalActionCreators.openSettings(guild_id, id, r7, () => {
if (c16520_1 != null) {
c16520_1();
} else {
let targetApplicationId = pendingSettings?.targetApplicationId;
if (targetApplicationId == null) {
targetApplicationId = void 0;
}
showInstantInviteActionSheet(a0, {
createInvite: false,
targetApplicationId
});
}
});
}
export function isAppInstalled(a0) {
return canOpenUrlScheme(a0);
}
export function handleOpenInviteActionsheet(a0, a1, a2, a3) {
let channel = ChannelStore.getChannel(a1);
if (channel == null) {
channel = GuildChannelStore.getDefaultChannel(a0.id, true, Permissions.CREATE_INSTANT_INVITE);
}
Module38(channel != null, "Channel cannot be null");
if (a0.vanityURLCode != null && a0.vanityURLCode !== "") {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: "Vanity URL Invite",
source: a3
});
CreateInviteModalActionCreators.init(a0.id, channel.id, {
skipCreateInvite: true
});
openInstantInviteActionSheet({
vanityURLCode: a0.vanityURLCode,
channel,
source: a3,
guildScheduledEventId: void 0,
stackingBehavior: void 0
});
} else {
const inviteChannelId = getInviteChannelId(channel.id, a2);
if (inviteChannelId != null) {
let r33 = ChannelStore.getChannel(inviteChannelId);
if (r33 == null) {
r33 = GuildChannelStore.getDefaultChannel(a0.id, true, Permissions.CREATE_INSTANT_INVITE);
}
Module38(r33 != null, "Channel cannot be null");
showInstantInviteActionSheet(r33, {
source: a3
});
}
}
}
export function hasDeferredInvite() {
const displayedInviteCode = DisplayedInviteStore.getDisplayedInviteCode();
const displayedGuildTemplateCode = GuildTemplateStore.getDisplayedGuildTemplateCode();
const r9 = displayedInviteCode != null ? InviteStore.getInvite(displayedInviteCode) : null;
const r13 = displayedGuildTemplateCode != null ? GuildTemplateStore.getGuildTemplate(displayedGuildTemplateCode) : null;
return r9 != null || r13 != null;
}
@@ -0,0 +1,33 @@
// Metro module 10206 (f10207).
import { View } from "react-native";
import GuildRoleStore from "../../../stores/GuildRoleStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useStateFromStoresArray } from "../../../_bundle/Module589";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import RolePill from "../../../components_native/common/RolePill";
const useStyles = createStyles({
container: {
marginTop: 8
},
label: {
marginBottom: 4
},
rolesRow: {
flexDirection: "row",
flexWrap: "wrap"
}
});
export default function InviteRolesDisplay(props) {
const { roleIds, guildId } = props;
const styles = useStyles();
const stateFromStoresArray = useStateFromStoresArray([GuildRoleStore], () => roleIds.map((roleId) => GuildRoleStore.getRole(guildId, roleId)).filter((item) => item != null), [roleIds, guildId]);
return stateFromStoresArray.length !== 0 ? <View style={styles.container}>
<Text variant="text-xs/semibold" color="text-muted" style={styles.label}>
{intl.string(t.stcSfI)}
</Text>
<View style={styles.rolesRow}>
{stateFromStoresArray.map((item) => <RolePill key={item.id} role={item} guildId={guildId} />)}
</View>
</View> : null;
};
@@ -0,0 +1,78 @@
// Metro module 12210 (f12211).
import { useState } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { ThemedEmptyState } from "../../../../../design/void/native";
import { intl, t } from "../../../../../intl/index.native";
import Module12211 from "../../../../../_bundle/Module12211";
import Module12212 from "../../../../../_bundle/Module12212";
import { useServerInviteRows } from "../../GuildInviteUtils";
import { Text } from "../../../../../design/components/Text/native/Text";
import useSafeAreaInsetsKeyboardAware_native from "../../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import { UserProfileStackedActionSheetSectionList } from "../../../../user_profile/native/UserProfileStackedActionSheet";
import GuildInviteRow from "./GuildInviteRow";
import { BottomSheetTitleHeader } from "../../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { BottomSheet } from "../../../../../design/components/Sheet/native/BottomSheet.native";
import { SearchField } from "../../../../../design/components/TextField/native/SearchField.native";
import InstantInviteUtils from "../../../../../utils/InstantInviteUtils";
let useStyles, GuildList;
const EmptyGuildList = function EmptyGuildList() {
return <ThemedEmptyState containerStyle={useStyles().emptyStateContainer} title={intl.string(t["2bfiLk"])} body={intl.string(t.V6nAfF)} darkSource={Module12211} lightSource={Module12212} />;
};
GuildList = function GuildList(props) {
const { recipientId, query, source } = props;
const styles = useStyles();
const [data, data2] = useServerInviteRows(recipientId, query);
const sections = data.length === 0 && data2.length === 0 ? [] : [{
title: intl.string(t["u+Ithu"]),
data
}, {
title: intl.string(t["c5T+X/"]),
data: data2
}];
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
const r3 = data.length === 0 || data2.length === 0;
let c19733_3 = r3;
return <UserProfileStackedActionSheetSectionList renderItem={function renderItem(info) {
return <GuildInviteRow row={info.item} recipientId={recipientId} source={source} start={info.start} end={info.end} />;
}} contentContainerStyle={{
paddingTop: r3 ? 24 : 0,
paddingBottom: insets.bottom + Module712.space.PX_16
}} sections={sections} renderSectionHeader={({ section }) => c19733_3 ? null : section.data.length > 0 ? <Text style={styles.sectionTitle} variant="text-sm/semibold" color="text-default">{section.title}</Text> : null} stickySectionHeadersEnabled keyExtractor={(item) => item.guild.id} ListEmptyComponent={EmptyGuildList} />;
};
useStyles = createStyles({
content: {
paddingHorizontal: Module712.space.PX_16
},
searchbarWrapper: {
rowGap: 8,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
},
sectionTitle: {
paddingBottom: 6,
paddingTop: 24,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
},
emptyStateContainer: {
margin: 24
}
});
export default function GuildInviteActionSheet(props) {
const { recipientId: recipientId2, source: source2 } = props;
const styles2 = useStyles();
const [query, setState] = useState("");
return <BottomSheet scrollable startExpanded header={<BottomSheetTitleHeader title={intl.string(t.HvoZQD)} />} contentStyles={styles2.content}>
<View style={styles2.searchbarWrapper}>
<SearchField onChange={function onChange(event) {
setState(event);
}} placeholder={intl.string(t.uohsSv)} />
<Text variant="text-xs/medium" color="text-subtle">
{intl.format(t["4UyUHh"], {
xDays: InstantInviteUtils.INVITE_OPTIONS_7_DAYS.label
})}
</Text>
</View>
<GuildList query={query} recipientId={recipientId2} source={source2} />
</BottomSheet>;
};
@@ -0,0 +1,38 @@
// Metro module 12213 (f12214).
import { memo } from "react";
import { View } from "react-native";
import { useGuildInviteSendStates } from "../../../GuildInviteSendStateStore";
import { InviteSendStates } from "../../../Constants";
import { sendGuildInvite } from "../../GuildInviteUtils";
import InviteButton from "../../components/InviteButton";
import GuildIcon, { GuildIconSizes } from "../../../../guild/native/GuildIcon";
import { Text } from "../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../intl/index.native";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
const r29 = memo(function GuildInviteRow(props) {
let guild;
const { row, recipientId, source, start, end } = props;
guild = void 0;
const handlePress = function handlePress() {
sendGuildInvite(recipientId, guild.id, source);
};
guild = row.guild;
const guildInviteSendStates = useGuildInviteSendStates((a0) => {
const r4 = a0[recipientId];
return r4 == null ? void 0 : r4[guild.id];
});
const trailing = <InviteButton sendState={guildInviteSendStates} onPressSend={handlePress} />;
const icon = <View importantForAccessibility="no-hide-descendants" accessibilityElementsHidden>
<GuildIcon guild={guild} size={GuildIconSizes.SMALL} />
</View>;
const subLabel = <Text variant="text-xs/medium" color="text-default">
{intl.format(t.zRl6XR, {
count: row.memberCount
})}
</Text>;
const disabled = guildInviteSendStates === InviteSendStates.SENDING || guildInviteSendStates === InviteSendStates.SENT;
return <TableRow icon={icon} label={guild.name} trailing={trailing} subLabel={subLabel} onPress={handlePress} disabled={disabled} accessibilityState={{
disabled
}} start={start} end={end} />;
});
export default r29;
@@ -0,0 +1,86 @@
// Metro module 16638 (f16639).
import { useMemo, useState, useCallback } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../../../a11y/AccessibilityStore";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import useFastestListTableRowPlaceholderConfig_native from "../../../../fastest_list/placeholders/useFastestListTableRowPlaceholderConfig.native";
import useScaledRowHeight from "../../../../main_tabs_v2/native/shared_components/user_list/useScaledRowHeight";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { isEqual } from "../../../../../_bundle/Module12";
import { FormRow, FormDivider } from "../../../../../design/void/Form/native/index";
import { RoleDot } from "../../../../../design/void/native";
import { Text } from "../../../../../design/components/Text/native/Text";
import { PressableOpacity } from "../../../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../../../intl/index.native";
import { BottomSheetTitleHeader } from "../../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { ActionSheet } from "../../../../../design/components/Sheet/native/ActionSheet.native";
import FastestList_android from "../../../../fastest_list/FastestList.android";
const useStyles = createStyles({
list: {
flex: 1
},
label: {
flexDirection: "row",
alignItems: "center"
},
roleDot: {
marginEnd: 8
}
});
export default function SelectInviteRolesActionSheet(props) {
let state, setState, stateFromStores, callback;
const { assignableRoles, selectedRoleIds, onSave } = props;
state = void 0;
setState = void 0;
stateFromStores = void 0;
callback = void 0;
const styles = useStyles();
const memo = useMemo(() => {
let c28473_0 = new Set(assignableRoles.map((assignableRole) => assignableRole.id));
return selectedRoleIds.filter((selectedRoleId) => c28473_0.has(selectedRoleId));
}, [assignableRoles, selectedRoleIds]);
[state, setState] = useState(() => new Set(memo));
stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.roleStyle);
const fastestListTableRowPlaceholderConfig_native = useFastestListTableRowPlaceholderConfig_native();
const scaledRowHeight = useScaledRowHeight();
callback = useCallback((c28474_0) => {
setState((prevState) => {
const set = new Set(prevState);
if (!set.delete(c28474_0)) {
set.add(c28474_0);
}
return set;
});
}, []);
const callback2 = useCallback(() => {
ActionSheetActionCreators.hideActionSheet();
const r20 = Array.from(state).sort();
if (!isEqual(r20, [...memo].sort())) {
onSave(r20);
}
}, [onSave, state, memo]);
const callback3 = useCallback((a0, a1) => {
const r12 = assignableRoles[a1];
let c28475_0 = r12;
const r21 = assignableRoles.length - 1;
const r34 = [stateFromStores === "dot" && r12.colorString != null && <RoleDot containerStyles={styles.roleDot} color={r12.colorString} colors={r12.colorStrings} background={false} />, ,];
const style = r12.colorString != null ? stateFromStores === "username" ? {
color: r12.colorString
} : void 0 : void 0;
const r45 = a1 === r21;
r34[1] = <Text variant="text-md/medium" style={style}>{r12.name}</Text>;
return <>
<FormRow label={<View style={styles.label}>{r34}</View>} onPress={() => callback(c28475_0.id)} trailing={<FormRow.Checkbox selected={state.has(r12.id)} />} />
{r45 ? !r45 : <FormDivider />}
</>;
}, [assignableRoles, stateFromStores, state, styles, callback]);
const trailing = <PressableOpacity onPress={callback2} accessibilityRole="button">
<Text variant="text-md/semibold">
{intl.string(t.i4jeWR)}
</Text>
</PressableOpacity>;
return <ActionSheet scrollable header={<BottomSheetTitleHeader title={intl.string(t["LPJmL/"])} trailing={trailing} />} startExpanded>
<FastestList_android inActionSheet style={styles.list} itemSize={scaledRowHeight} sections={[assignableRoles.length]} renderItem={callback3} placeholderConfig={fastestListTableRowPlaceholderConfig_native} estimatedListSize="windowSize" listId="select-invite-roles" wrapChildren />
</ActionSheet>;
};
@@ -0,0 +1,125 @@
// Metro module 10190 (f10191).
import * as Module19 from "react";
import { useState, useMemo, useEffect, useCallback } from "react";
import { View, FlatList, Platform } from "react-native";
import InviteRecord from "../../../../records/InviteRecord";
import "../../../../stores/ChannelSettingsStore";
import { Endpoints, ChannelSettingsSections } from "../../../../Constants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import useMountEffect from "../../../../hooks/useMountEffect";
import { HTTP } from "../../../../_bundle/sendRequest";
import Module12 from "../../../../_bundle/Module12";
import Module712 from "../../../../_bundle/Module712";
import InstantInvite from "../../../guild_instant_invites/native/InstantInvite";
import { SceneLoadingIndicator } from "../../../../design/components/Navigator/native/SceneLoadingIndicator.native";
import { EmptyState } from "../../../../design/void/native";
import Module10209 from "../../../../_bundle/Module10209";
import Module10210 from "../../../../_bundle/Module10210";
import { intl, t } from "../../../../intl/index.native";
import { getHeaderCloseButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import { ImpressionNames } from "../../../../_bundle/Module503";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
function $mk118830($env) {
return (a0) => new InviteRecord({
...a0,
maxUses: a0.max_uses,
maxAge: a0.max_age,
createdAt: a0.created_at
});
}
let useStyles;
let env6795 = {};
const GroupDMInviteManagement = function GroupDMInviteManagement(props) {
let setState3;
const channelId = props.channelId;
setState3 = void 0;
const styles = useStyles();
const [state, setState] = useState([]);
const [state2, setState2] = useState(true);
useMountEffect(() => {
let _fetchInvites2 = function _fetchInvites() {
const r9 = async () => {
let c31524_1;
let env32000;
c31524_1 = void 0;
const r23 = env32000 = {
$parent: env6795
};
let c31524_0 = r23;
env32000[0] = void 0;
env32000[0] = (await HTTP.get({
url: Endpoints.INSTANT_INVITES(channelId),
retries: 3,
oldFormErrors: true,
rejectWithError: true
})).body.map($mk118830(env6795));
(0, setState)(env32000[0]);
(0, setState2)(false);
};
_fetchInvites2 = r9;
return r9.apply(this, arguments);
};
(function fetchInvites() {
return _fetchInvites2.apply(this, arguments);
})().catch(() => {
setState2(false);
});
});
let windowSize;
[windowSize, setState3] = useState(21);
const memo = useMemo(() => Module12.sortBy(state, ({ inviter }) => {
const r2 = inviter == null;
let r6 = void 0;
if (!r2) {
const username = inviter.username;
r6 = username == null ? void 0 : username.toLowerCase();
}
if (r6 == null) {
r6 = "";
}
return r6;
}), [state]);
useEffect(() => {
setState3(21);
}, []);
const callback = useCallback((a0) => a0.code, []);
const callback2 = useCallback((a0) => <View style={{
marginHorizontal: Module712.space.PX_12
}}>
<InstantInvite invite={a0.item} onInviteRevoked={(c30204_0) => setState(state.filter((item) => item.code !== c30204_0.code))} />
</View>, [state]);
return state2 ? (0, jsx)(SceneLoadingIndicator, {}) : state.length === 0 ? <EmptyState lightSource={Module10209} darkSource={Module10210} title={intl.string(t["+nLJkZ"])} body={intl.string(t.F53CAc)} /> : (0, jsx)(FlatList, {
style: styles.list,
data: memo,
keyExtractor: callback,
renderItem: callback2,
initialNumToRender: 10,
windowSize
});
};
Platform;
useStyles = createStyles({
list: {
paddingTop: 8
}
});
const r44 = Module19.memo(function GroupDMInviteManagementScreen({ channelId: channelId2, onClose }) {
return (0, jsx)(Navigator, {
screens: useMemo(() => {
const channelId3 = channelId2;
const r11 = {};
r11[ChannelSettingsSections.INSTANT_INVITES_MANAGEMENT] = {
title: intl.string(t.OQ9MKu),
headerLeft: getHeaderCloseButton(onClose),
render: () => (0, jsx)(GroupDMInviteManagement, {
channelId: channelId3
}),
impressionName: ImpressionNames.GDM_SETTINGS_INVITES
};
return r11;
}, [channelId2, onClose]),
initialRouteName: ChannelSettingsSections.INSTANT_INVITES_MANAGEMENT
});
});
export default r44;
@@ -0,0 +1,188 @@
// Metro module 8357 (f8358).
import { useCallback, useState } from "react";
import { ScrollView, View } from "react-native";
import StageInstanceStore from "../../../stage_channels/StageInstanceStore";
import CreateInviteModalStore from "../../../../stores/CreateInviteModalStore";
import GuildStore from "../../../../stores/GuildStore";
import PermissionStore from "../../../../stores/PermissionStore";
import { InviteTargetTypes } from "../../Constants";
import { Permissions } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import UserPlaceholderRow from "../../../main_tabs_v2/native/shared_components/user_list/UserPlaceholderRow";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import useGetOrFetchApplications from "../../../applications/useGetOrFetchApplications";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { generateInviteKeyFromExtraData } from "../../InviteCodeUtils";
import getInviteURL from "../../getInviteURL";
import { getShareMessage, handleCopy, handleOpenShareSheet, handlePressSettings } from "../InstantInviteUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import showUserProfileActionSheet from "../../../user_profile/native/showUserProfileActionSheet";
import { setHubProgressActionComplete } from "../../../hub/HubProgressActionCreators";
import { HubProgressStep } from "../../../../_bundle/Module1306";
import useInviteSuggestionRows from "../useInviteSuggestionRows";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../../intl/index.native";
import { EmptyState } from "../../../../design/void/native";
import { AppCrash } from "../../../../design/components/Illustration/native/redesign/generated/AppCrash";
import InstantInviteEmptyState from "./InstantInviteEmptyState";
import InstantInviteShareApps from "./InstantInviteShareApps";
import { SearchField } from "../../../../design/components/TextField/native/SearchField.native";
import { searchInviteSuggestions } from "../../../../actions/InviteSuggestionsActionCreators";
import InstantInviteAgeText from "./InstantInviteAgeText";
import InstantInviteFriendsList from "./InstantInviteFriendsList";
let useStyles;
const Loading = function Loading() {
const styles = useStyles();
const r9 = [];
let key = 0;
while (true) {
r9.push(<UserPlaceholderRow key={key} row={key} />);
key = key + 1;
if (!(key < 10)) {
return <>
<View style={styles.placeholderHeader} />
<View style={styles.placeholderLabel} />
{r9}
</>;
}
}
};
useStyles = createStyles({
placeholderHeader: {
height: 16,
width: "80%",
margin: 16,
marginBottom: 8,
borderRadius: Module712.radii.sm,
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED
},
placeholderLabel: {
height: 16,
width: "40%",
margin: 16,
borderRadius: Module712.radii.sm,
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED
},
errorEmptyState: {
backgroundColor: "transparent"
},
searchAndShareContainer: {
borderTopWidth: 1,
borderColor: Module712.colors.BORDER_SUBTLE,
marginTop: Module712.space.PX_8,
paddingVertical: Module712.space.PX_8,
paddingHorizontal: Module712.space.PX_12,
flexDirection: "column",
gap: Module712.space.PX_12
},
inviteAgeText: {
paddingBottom: Module712.space.PX_8,
paddingHorizontal: Module712.space.PX_4
},
shareApps: {
paddingVertical: 0
}
});
export default function InstantInviteActionSheet(props) {
let children;
let shareMessage;
const { channel, source, vanityURLCode, guildScheduledEventId, targetApplicationId, code } = props;
shareMessage = void 0;
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.INSTANT_INVITE_MODAL).analyticsLocations;
const [r41] = useGetOrFetchApplications(targetApplicationId != null ? [targetApplicationId] : []);
const stateFromStores = useStateFromStores([PermissionStore, CreateInviteModalStore, StageInstanceStore], () => {
if (code != null) {
return code;
}
if (channel.isGuildStageVoice() && !PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, channel)) {
const stageInstanceByChannel = StageInstanceStore.getStageInstanceByChannel(channel.id);
if (stageInstanceByChannel?.invite_code != null) {
return stageInstanceByChannel.invite_code;
}
}
if (vanityURLCode != null) {
return guildScheduledEventId != null ? generateInviteKeyFromExtraData({
baseCode: vanityURLCode,
guildScheduledEventId
}) : vanityURLCode;
}
const invite = CreateInviteModalStore.getInvite();
return invite != null ? guildScheduledEventId != null ? generateInviteKeyFromExtraData({
baseCode: invite.code,
guildScheduledEventId
}) : invite.code : void 0;
});
const stateFromStores2 = useStateFromStores([CreateInviteModalStore], () => CreateInviteModalStore.getError());
const link = stateFromStores != null ? getInviteURL(stateFromStores) : null;
shareMessage = link != null ? getShareMessage(link) : "";
const r83 = targetApplicationId != null ? InviteTargetTypes.EMBEDDED_APPLICATION : null;
const callback3 = useCallback((a0) => {
ActionSheetActionCreators.hideActionSheet();
showUserProfileActionSheet({
userId: a0,
channelId: channel.id,
sourceAnalyticsLocations: analyticsLocations
});
}, [channel, analyticsLocations]);
const callback4 = useCallback((a0) => {
if (stateFromStores != null) {
a0({
channel,
code: stateFromStores,
message: shareMessage,
location: source
});
setHubProgressActionComplete(channel.getGuildId(), HubProgressStep.INVITE_USER);
}
}, [channel, stateFromStores, shareMessage, source]);
const callback2 = useCallback(() => {
setHubProgressActionComplete(channel.getGuildId(), HubProgressStep.INVITE_USER);
}, [channel]);
const callback = useCallback(() => handleCopy(stateFromStores, channel, source), [stateFromStores, channel, source]);
const callback5 = useCallback(() => handleOpenShareSheet(stateFromStores, channel, shareMessage, source), [stateFromStores, channel, shareMessage, source]);
const callback6 = useCallback(() => handlePressSettings(channel), [channel]);
const inviteSuggestionRows = useInviteSuggestionRows(channel, source, r83, targetApplicationId);
const { rows, isFetchingRows } = inviteSuggestionRows;
const r108 = stateFromStores == null || rows.length === 0 && isFetchingRows;
const [r117] = useState(stateFromStores != null && rows.length === 0 && !isFetchingRows);
const props2 = {
showGradient: stateFromStores2 != null || !r108 || !r117,
scrollable: true,
startExpanded: true,
header: <BottomSheetTitleHeader title={targetApplicationId != null ? r41 != null ? intl.formatToPlainString(t.ZdK3dW, {
applicationName: r41.name
}) : intl.string(t["OzOM/q"]) : intl.string(t["f1+QIK"])} />,
children: null
};
if (stateFromStores2 != null) {
children = <EmptyState style={styles.errorEmptyState} Illustration={AppCrash} title={stateFromStores2} />;
} else if (r108) {
children = <Loading />;
} else if (r117) {
children = <ScrollView contentContainerStyle={{
paddingBottom: bottom + 16
}}>
<InstantInviteEmptyState link={link} onCopy={callback} onShare={callback5} onPressSettings={callback6} />
</ScrollView>;
} else {
const r162 = [<InstantInviteShareApps contentContainerStyle={styles.shareApps} onItemPressed={callback4} />, <View style={styles.searchAndShareContainer}>
<SearchField size="md" isRound onChange={searchInviteSuggestions} placeholder={targetApplicationId != null ? intl.string(t.iI1gMg) : intl.formatToPlainString(t["1UgGdm"], {
groupname: GuildStore.getGuild(channel.guild_id)?.name
})} />
{!(vanityURLCode != null) && <InstantInviteAgeText style={styles.inviteAgeText} channel={channel} canEditInvite={code == null} />}
</View>];
children = <>
{[<View>{r162}</View>, <InstantInviteFriendsList data={rows} code={stateFromStores} source={source == null ? void 0 : source} onPressAvatar={callback3} onInviteSent={callback2} />]}
</>;
}
props2.children = children;
return <AnalyticsLocationProvider value={analyticsLocations}>
<BottomSheet {...props2} />
</AnalyticsLocationProvider>;
};
@@ -0,0 +1,54 @@
// Metro module 11810 (f11811).
import { View } from "react-native";
import CreateInviteModalStore from "../../../../stores/CreateInviteModalStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { Text } from "../../../../design/components/Text/native/Text";
import { maxAgeString } from "../../../../utils/InstantInviteUtils";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { handlePressSettings } from "../InstantInviteUtils";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
inviteAgeContainer: {
flexDirection: "row",
alignItems: "center",
flexWrap: "wrap"
}
});
export default function InstantInviteAgeText(props) {
const { style, channel, callbackActionSheet } = props;
let canEditInvite = props.canEditInvite;
if (canEditInvite === void 0) {
canEditInvite = true;
}
const { onEdit, source } = props;
const styles = useStyles();
const stateFromStores = useStateFromStores([CreateInviteModalStore], () => CreateInviteModalStore.getInviteSettings());
let r25 = null;
if (stateFromStores != null) {
const r41 = [<Text variant="text-xs/normal">
{maxAgeString(stateFromStores.maxAge, stateFromStores.maxUses)}
{" "}
</Text>, ,];
if (canEditInvite) {
canEditInvite = <PressableOpacity onPress={() => {
handlePressSettings(channel, callbackActionSheet, source);
if (onEdit != null) {
onEdit();
}
}} accessibilityRole="link" accessibilityLabel={intl.string(t["VNe8P/"])} hitSlop={{
top: 8,
left: 8,
bottom: 8,
right: 8
}}>
<Text variant="text-xs/normal" color="text-link">
{intl.string(t["VNe8P/"])}
</Text>
</PressableOpacity>;
}
r41[1] = canEditInvite;
r25 = <View style={[styles.inviteAgeContainer, style]}>{r41}</View>;
}
return r25;
};
@@ -0,0 +1,224 @@
// Metro module 12237 (f12238).
import { Linking } from "react-native";
import { SHARE_APPS_KEY, SHARE_URLS } from "../InstantInviteConstants";
import { InviteOptionsType, SendTypes } from "../../../../Constants";
import Share from "../../../icons/native/Share";
import Module12238 from "../../../../_bundle/Module12238";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import { handleOpenShareSheet, handleCopy, trackOptionClicked, isAppInstalled } from "../InstantInviteUtils";
import Module10200 from "../../../../_bundle/Module10200";
import Module4134 from "../../../../_bundle/Module4134";
import Module12239 from "../../../../_bundle/Module12239";
import { isMetaQuest } from "../../../device/MetaQuestUtils.android";
import Module12240 from "../../../../_bundle/Module12240";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import getInviteURL from "../../getInviteURL";
import { isIOS, isAndroid } from "../../../../utils/PlatformUtils";
import Module12258 from "../../../../_bundle/Module12258";
import Module12259 from "../../../../_bundle/Module12259";
import { canSendSMS, sendSMS, canSendMail, sendMail } from "../DCDSendUtils";
import MessageActionCreators from "../../../../actions/MessageActionCreators";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
import Module12260 from "../../../../_bundle/Module12260";
import Module11841 from "../../../../_bundle/Module11841";
import Module12261 from "../../../../_bundle/Module12261";
import Module12262 from "../../../../_bundle/Module12262";
import Module12263 from "../../../../_bundle/Module12263";
import Module12264 from "../../../../_bundle/Module12264";
import Module12265 from "../../../../_bundle/Module12265";
import Module12266 from "../../../../_bundle/Module12266";
const r28 = {
SHARE: 0,
0: "SHARE",
COPY: 1,
1: "COPY",
QR_CODE: 2,
2: "QR_CODE",
MESSAGES: 3,
3: "MESSAGES",
MAIL: 4,
4: "MAIL",
FB_MESSENGER: 5,
5: "FB_MESSENGER",
GMAIL: 6,
6: "GMAIL",
TELEGRAM: 7,
7: "TELEGRAM",
TWITTER: 8,
8: "TWITTER",
WHATSAPP: 9,
9: "WHATSAPP",
LINE: 10,
10: "LINE"
};
const r64 = [{
type: r28.SHARE,
icon: Share,
isAvailable: Promise.resolve(true),
IconComponent: Module12238,
backgroundColor: Module712.unsafe_rawColors.BRAND_500,
getLabel: () => intl.string(t.wPadMa),
onPress: (a0) => handleOpenShareSheet(a0.code, a0.channel, a0.message, a0.location)
}, {
type: r28.COPY,
icon: Module10200,
isAvailable: Promise.resolve(true),
IconComponent: Module4134,
getLabel: () => intl.string(t.WqhZss),
onPress: (a0) => handleCopy(a0.code, a0.channel, a0.location)
}, {
type: r28.QR_CODE,
icon: Module12239,
isAvailable: Promise.resolve(!isMetaQuest()),
IconComponent: Module12240,
getLabel: () => intl.string(t.rriLm1),
onPress: ({ code: code3, channel: channel3, location: location2 }) => {
ActionSheetActionCreators.openLazy(import("./InstantInviteQRCodeActionSheet"), `InstantInviteQRCodeActionSheet-${code3}`, {
link: getInviteURL(code3),
location: location2,
channel: channel3
}, "stack");
}
}, {
type: r28.MESSAGES,
fullIcon: isIOS() ? Module12258 : void 0,
icon: isAndroid() ? Module12259 : void 0,
isAvailable: canSendSMS(),
getLabel: () => intl.string(t.AQKfCj),
onPress: (a0) => {
const { channel, code, message } = a0;
trackOptionClicked(code, channel, InviteOptionsType.SMS, a0.location);
if (isIOS()) {
ActionSheetActionCreators.hideActionSheet();
}
sendSMS({
body: message
}, (a0, a1, a2) => {
if (a0) {
let channelId = channel?.id;
if (channelId == null) {
channelId = null;
}
MessageActionCreators.trackInvite({
inviteKey: code,
channelId,
messageId: null,
location: "SMS Option",
overrideProperties: {
send_type: SendTypes.SMS
}
});
}
if (a2) {
AlertActionCreators.show({
body: intl.string(t["1ieAR5"]),
isDismissable: true
});
}
});
}
}, {
type: r28.MAIL,
fullIcon: isIOS() ? Module12260 : void 0,
icon: isAndroid() ? Module11841 : void 0,
isAvailable: canSendMail(),
getLabel: () => intl.string(t.QaAypP),
onPress: (a0) => {
const { channel: channel2, code: code2, message } = a0;
trackOptionClicked(code2, channel2, InviteOptionsType.EMAIL, a0.location);
if (isIOS()) {
ActionSheetActionCreators.hideActionSheet();
}
sendMail({
subject: "",
body: message
}, (a0, a1, a2) => {
if (a0) {
let channelId = channel2?.id;
if (channelId == null) {
channelId = null;
}
MessageActionCreators.trackInvite({
inviteKey: code2,
channelId,
messageId: null,
location: "Email Option",
overrideProperties: {
send_type: SendTypes.EMAIL
}
});
}
if (a2) {
AlertActionCreators.show({
body: intl.string(t["1ieAR5"]),
isDismissable: true
});
}
});
}
}, {
type: r28.FB_MESSENGER,
fullIcon: Module12261,
isAvailable: isAppInstalled(SHARE_APPS_KEY.MESSENGER),
getLabel: () => intl.string(t.P0R3ZF),
onPress: ({ channel: channel3, code: code3, location: location2 }) => {
const inviteURL = getInviteURL(code3);
trackOptionClicked(code3, channel3, InviteOptionsType.MESSENGER, location2);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.MESSENGER](inviteURL));
}
}, {
type: r28.GMAIL,
fullIcon: Module12262,
isAvailable: isAppInstalled(SHARE_APPS_KEY.GMAIL),
getLabel: () => intl.string(t["14o9ZT"]),
onPress: (a0) => {
const { channel: channel3, code: code3, message } = a0;
trackOptionClicked(code3, channel3, InviteOptionsType.GMAIL, a0.location);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.GMAIL]("", message));
}
}, {
type: r28.TELEGRAM,
fullIcon: Module12263,
isAvailable: isAppInstalled(SHARE_APPS_KEY.TELEGRAM),
getLabel: () => intl.string(t["148qIV"]),
onPress: ({ channel: channel3, code: code3, message, location: location2 }) => {
const inviteURL = getInviteURL(code3);
trackOptionClicked(code3, channel3, InviteOptionsType.TELEGRAM, location2);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.TELEGRAM](message, inviteURL));
}
}, {
type: r28.TWITTER,
fullIcon: Module12264,
isAvailable: isAppInstalled(SHARE_APPS_KEY.TWITTER),
getLabel: () => intl.string(t.oAiltV),
onPress: (a0) => {
const { channel: channel3, code: code3, message } = a0;
trackOptionClicked(code3, channel3, InviteOptionsType.TWITTER, a0.location);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.TWITTER](message));
}
}, {
type: r28.WHATSAPP,
fullIcon: Module12265,
isAvailable: isAppInstalled(SHARE_APPS_KEY.WHATSAPP),
getLabel: () => intl.string(t.viazhS),
onPress: (a0) => {
const { channel: channel3, code: code3, message } = a0;
trackOptionClicked(code3, channel3, InviteOptionsType.WHATSAPP, a0.location);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.WHATSAPP](message));
}
}, {
type: r28.LINE,
fullIcon: Module12266,
isAvailable: isAppInstalled(SHARE_APPS_KEY.LINE),
getLabel: () => intl.string(t.kqgslH),
onPress: (a0) => {
const { channel: channel3, code: code3, message } = a0;
trackOptionClicked(code3, channel3, InviteOptionsType.LINE, a0.location);
Linking.openURL(SHARE_URLS[SHARE_APPS_KEY.LINE](message));
}
}];
const r197 = [r64[0], r64[1]];
export { r28 as ShareItemType };
export { r64 as SHARE_ITEMS };
export { r197 as SHARE_ITEMS_DEFAULT };
@@ -0,0 +1,92 @@
// Metro module 12234 (f12235).
import { View } from "react-native";
import CreateInviteModalStore from "../../../../stores/CreateInviteModalStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { RefreshEmptyState, ClearButtonVisibility } from "../../../../design/void/native";
import Module12235 from "../../../../_bundle/Module12235";
import { intl, t } from "../../../../intl/index.native";
import FreeFormTextInput from "../../../../design/void/Form/native/FreeFormTextInput";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { SettingsIcon } from "../../../../design/components/Icon/native/redesign/generated/SettingsIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import InstantInviteUtils from "../../../../utils/InstantInviteUtils";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
padding: 16
},
emptyStateContainer: {
padding: 0,
marginBottom: 16
},
emptyStateArt: {
marginBottom: 16
},
emptyStateTitle: {
marginBottom: 4
},
linkContainer: {
maxWidth: "100%",
flexDirection: "row",
marginBottom: 8,
gap: 8
},
inviteInput: {
flexShrink: 1
},
expireCaption: {
marginBottom: 16
},
settingsButton: {
width: 48,
height: 48,
justifyContent: "center",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderRadius: Module712.radii.xs
}
});
export default (a0) => {
let link = a0.link;
const { onCopy, onShare, onPressSettings } = a0;
const styles = useStyles();
const stateFromStores = useStateFromStores([CreateInviteModalStore], () => CreateInviteModalStore.getInviteSettings());
const r57 = [<RefreshEmptyState containerStyle={styles.emptyStateContainer} imageStyle={styles.emptyStateArt} titleStyle={styles.emptyStateTitle} source={Module12235} title={intl.string(t.tQc0l8)} body={intl.string(t.DXgdcD)} />, , , ,];
if (link == null) {
link = "";
}
r57[1] = <View style={styles.linkContainer}>
<FreeFormTextInput accessibilityRole="button" onPress={onCopy} editable={false} value={link} style={styles.inviteInput} forceAccessibleContainer clearButtonVisibility={ClearButtonVisibility.NEVER} />
<PressableOpacity accessibilityLabel={intl.string(t["3D5yo/"])} accessibilityRole="button" onPress={onPressSettings} style={styles.settingsButton}>
<SettingsIcon />
</PressableOpacity>
</View>;
const r3 = stateFromStores == null;
let r95 = null;
if (!r3) {
const maxAgeOptionByValue = InstantInviteUtils.getMaxAgeOptionByValue(stateFromStores.maxAge);
const r101 = maxAgeOptionByValue != null;
let maxUses = "";
let maxAge = "";
if (r101) {
let descriptiveLabel = maxAgeOptionByValue.descriptiveLabel;
if (descriptiveLabel == null) {
descriptiveLabel = "";
}
maxAge = descriptiveLabel;
}
const r110 = InstantInviteUtils.getMaxUsesOptions.find((getMaxUsesOption) => getMaxUsesOption.value === stateFromStores.maxUses);
if (r110 != null) {
maxUses = r110.descriptiveLabel;
}
r95 = intl.format(stateFromStores.maxAge === 0 ? t["99ISmn"] : t.dqPWMN, {
maxAge,
maxUses
});
}
r57[2] = <Text style={styles.expireCaption} variant="text-xs/medium" color="text-muted">{r95}</Text>;
r57[3] = <Button text={intl.string(t.Ej3B3Y)} onPress={onShare} />;
return <View style={styles.container}>{r57}</View>;
};
@@ -0,0 +1,71 @@
// Metro module 12268 (f12269).
import { useCallback } from "react";
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import TextStyles from "../../../rebrand/native/TextStyles";
import Module712 from "../../../../_bundle/Module712";
import { RefreshEmptyState } from "../../../../design/void/native";
import { intl, t } from "../../../../intl/index.native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { getRootNavigationRef } from "../../../main_tabs_v2/RootNavigationRef.native";
import { Text } from "../../../../design/components/Text/native/Text";
import InstantInviteRow from "./InstantInviteRow";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import { BottomSheetFlatList } from "../../../../_bundle/Module5245";
let useStyles, FriendsEmptyComponent;
const keyExtractor = function keyExtractor(a0) {
return a0.item.id;
};
FriendsEmptyComponent = function FriendsEmptyComponent() {
const styles = useStyles();
return <>
<RefreshEmptyState title={intl.string(t.dz4UlO)} body={intl.string(t.MBQBI7)} titleStyle={styles.emptyTitle} bodyStyle={styles.emptyBody} />
<PressableOpacity onPress={() => {
ActionSheetActionCreators.hideActionSheet();
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.navigate("friends", {
screen: "add-friends",
params: {
sourcePage: "Instant Invite Empty State"
}
});
}
}} accessibilityRole="link" accessibilityLabel={intl.string(t.a7FVbE)} hitSlop={{
top: 8,
left: 8,
bottom: 8,
right: 8
}}>
<Text style={[styles.goToFriendsLink]} variant="text-sm/semibold" color="text-link">
{intl.string(t.a7FVbE)}
</Text>
</PressableOpacity>
</>;
};
useStyles = createStyles({
emptyTitle: {
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 18),
textTransform: "none",
lineHeight: 24
},
emptyBody: {
...TextStyles(Fonts.PRIMARY_MEDIUM, Module712.colors.TEXT_SUBTLE, 16),
lineHeight: 20,
fontWeight: "600"
},
goToFriendsLink: {
textAlign: "center"
}
});
export default function InstantInviteFriendsList(props) {
const { code, onPressAvatar, onInviteSent, data, source } = props;
const callback = useCallback(({ item, index }) => <InstantInviteRow start={index === 0} end={index === data.length - 1} row={item} onPressAvatar={onPressAvatar} onInviteSent={onInviteSent} code={code} source={source} />, [onPressAvatar, onInviteSent, code, source, data.length]);
return <BottomSheetFlatList contentContainerStyle={{
paddingBottom: Module712.space.PX_16 + useSafeAreaInsetsKeyboardAware_native({
isKeyboardAwareOnAndroid: false
}).insets.bottom,
paddingHorizontal: Module712.space.PX_12
}} bounces={false} renderItem={callback} data={data} keyExtractor={keyExtractor} keyboardShouldPersistTaps="always" ListEmptyComponent={FriendsEmptyComponent} />;
};
@@ -0,0 +1,103 @@
// Metro module 12241 (f12242).
import { useEffect } from "react";
import { View } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import UserStore from "../../../../stores/UserStore";
import { InstantInviteSources, RelationshipTypes } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { intl, t } from "../../../../intl/index.native";
import Dispatcher from "../../../../Dispatcher";
import * as _ToastUtils from "../../../toast/native/ToastUtils";
import { ActionSheet } from "../../../../design/components/Sheet/native/ActionSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import QRCode from "../../../../components_native/QRCode";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
padding: Module712.space.PX_12,
display: "flex",
alignItems: "center",
justifyContent: "center",
gap: Module712.space.PX_24
},
iconContainer: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
justifyContent: "center",
alignItems: "center"
},
icon: {
padding: Module712.space.PX_4,
borderRadius: Module712.radii.lg + Module712.space.PX_4,
backgroundColor: Module712.colors.WHITE
},
code: {
alignSelf: "center"
}
});
export default function InstantInviteQRCodeActionSheet(props) {
let r51;
const link = props.link;
const styles = useStyles();
const title = props.location === InstantInviteSources.ADD_FRIENDS_MODAL ? intl.string(t.VUNqoc) : intl.string(t.DqE26p);
const { location: location2, channel } = props;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
if (channel != null) {
const guild = GuildStore.getGuild(channel.guild_id);
r51 = guild != null ? {
visible: intl.format(t.VK3zyF, {
name: guild.name
}),
plainText: intl.formatToPlainString(t.VK3zyF, {
name: guild.name
})
} : location2 === InstantInviteSources.ADD_FRIENDS_MODAL ? stateFromStores != null ? {
visible: intl.format(t.zDGAfl, {
name: stateFromStores.username
}),
plainText: intl.formatToPlainString(t.zDGAfl, {
name: stateFromStores.username
})
} : null : null;
} else {
r51 = location2 === InstantInviteSources.ADD_FRIENDS_MODAL ? stateFromStores != null ? {
visible: intl.format(t.zDGAfl, {
name: stateFromStores.username
}),
plainText: intl.formatToPlainString(t.zDGAfl, {
name: stateFromStores.username
})
} : null : null;
}
const channel2 = props.channel;
const r99 = channel2 != null ? GuildStore.getGuild(channel2.guild_id) != null ? <GuildIcon guild={GuildStore.getGuild(channel2.guild_id)} size={GuildIconSizes.LARGE} /> : null : null;
const presentFriendRequestAcceptedToast = _ToastUtils.presentFriendRequestAcceptedToast;
useEffect(() => {
const handleRelationshipAdd2 = function handleRelationshipAdd({ relationship }) {
if (relationship.type === RelationshipTypes.FRIEND) {
presentFriendRequestAcceptedToast(relationship.user);
}
};
Dispatcher.subscribe("RELATIONSHIP_ADD", handleRelationshipAdd2);
return () => {
Dispatcher.unsubscribe("RELATIONSHIP_ADD", handleRelationshipAdd2);
};
}, [presentFriendRequestAcceptedToast]);
return <ActionSheet header={<BottomSheetTitleHeader title={title} />}>
<View style={styles.container}>
<View>
<QRCode text={link} size={240} style={styles.code} accessibilityLabel={r51?.plainText} />
{r99 != null && <View style={styles.iconContainer}>
<View style={styles.icon}>{r99}</View>
</View>}
</View>
{r51 != null && <Text variant="text-md/normal">{r51.visible}</Text>}
</View>
</ActionSheet>;
};
@@ -0,0 +1,201 @@
// Metro module 11806 (f11807).
import { memo } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import CreateInviteModalStore from "../../../../stores/CreateInviteModalStore";
import GuildStore from "../../../../stores/GuildStore";
import InviteSuggestionsStore from "../../../../stores/InviteSuggestionsStore";
import UserStore from "../../../../stores/UserStore";
import { setSendState, useInstantInviteSendStates } from "../../InstantInviteSendStateStore";
import { InviteSendStates } from "../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useChannelName from "../../../channel/useChannelName";
import { RowTypes } from "../../../../utils/InstantInviteUtils";
import InviteQueue, { InvitePropertiesType } from "../../../../lib/InviteQueue";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Avatar, AvatarSizes } from "../../../../design/void/native";
import DiscordTag from "../../../user_profile/native/DiscordTag";
import UserUtils from "../../../../utils/UserUtils";
import { intl, t } from "../../../../intl/index.native";
import AvatarUtils from "../../../../utils/AvatarUtils";
import { getAcronym } from "../../../../utils/StringUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import InviteButton from "./InviteButton";
const useStyles = createStyles({
acronym: {
width: 32,
height: 32,
borderRadius: Module712.radii.lg,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
alignItems: "center",
justifyContent: "center",
overflow: "hidden",
marginTop: 0,
marginRight: 10,
borderColor: Module712.colors.BORDER_MUTED,
borderStyle: "solid",
borderWidth: 2
}
});
const r58 = memo(function InstantInviteRow(props) {
let accessibilityActions, icon, label, onAccessibilityAction;
const { row, code, onPressAvatar, onInviteSent, start, end, source } = props;
const styles = useStyles();
const id = row.item.id;
const stateFromStores2 = useStateFromStores([CreateInviteModalStore], () => CreateInviteModalStore.isSubmitting());
const stateFromStores3 = useStateFromStores([CreateInviteModalStore], () => CreateInviteModalStore.getError());
const instantInviteSendStates = useInstantInviteSendStates((a0) => {
const r1 = code != null;
let r2 = null;
if (r1) {
const r6 = a0[code];
r2 = r6 == null ? void 0 : r6[id];
}
return r2;
});
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(id));
let r54 = useChannelName(stateFromStores);
if (code == null) {
return null;
}
L32: {
const type = row.type;
if (RowTypes.DM !== type && RowTypes.FRIEND !== type) {
if (RowTypes.GROUP_DM === type) {
const r117 = stateFromStores != null ? <Avatar source={AvatarUtils.makeSource(AvatarUtils.getChannelIconURL({
id: stateFromStores.id,
icon: stateFromStores.icon,
applicationId: stateFromStores.application_id,
size: 32
}))} size={AvatarSizes.REFRESH_MEDIUM_32} /> : null;
if (r54 == null) {
r54 = "";
}
label = r54;
onAccessibilityAction = void 0;
accessibilityActions = void 0;
icon = r117;
break L32;
}
if (RowTypes.CHANNEL === type) {
const r25 = stateFromStores?.guild_id != null ? GuildStore.getGuild(stateFromStores.guild_id) : void 0;
if (r25 == null) {
return null;
}
icon = r25.icon != null ? <Avatar source={AvatarUtils.makeSource(AvatarUtils.getGuildIconURL({
id: r25.id,
icon: r25.icon,
size: 32
}))} size={AvatarSizes.REFRESH_MEDIUM_32} /> : <View style={styles.acronym}>
<Text variant="text-sm/bold">
{getAcronym(r25.name)}
</Text>
</View>;
label = r54 == null ? "" : `#${r54}`;
onAccessibilityAction = void 0;
accessibilityActions = void 0;
break L32;
}
return null;
}
const user = UserStore.getUser(id);
let source2 = user == null ? void 0 : user.getAvatarSource(void 0);
if (source2 == null) {
source2 = null;
}
const r158 = <PressableOpacity importantForAccessibility="no-hide-descendants" accessibilityElementsHidden onPress={(event) => {
event.stopPropagation();
if (onPressAvatar != null) {
onPressAvatar(id);
}
}} style={{
padding: 8,
margin: -8
}}>
<Avatar source={source2} size={AvatarSizes.REFRESH_MEDIUM_32} />
</PressableOpacity>;
const r166 = <DiscordTag nick={UserUtils.getGlobalName(user)} user={user} />;
const r168 = onPressAvatar != null ? [{
name: "viewProfile",
label: intl.formatToPlainString(t.uCenkh, {
username: user?.tag
})
}] : void 0;
onAccessibilityAction = (a0) => {
if (a0.nativeEvent.actionName === "viewProfile" && onPressAvatar !== null && onPressAvatar != null) {
onPressAvatar(id);
}
};
accessibilityActions = r168;
label = r166;
icon = r158;
}
const handlePress = function handlePress() {
L11: {
if (code != null) {
const handleSendState = function handleSendState(a0) {
if (code != null) {
setSendState(code, id, a0 ? InviteSendStates.SENT : InviteSendStates.ERROR);
if (a0 && onInviteSent != null) {
onInviteSent();
}
}
};
setSendState(code, id, InviteSendStates.SENDING);
const type = row.type;
if (RowTypes.FRIEND !== type && RowTypes.DM !== type) {
if (RowTypes.GROUP_DM === type) {
if (code == null) {
break L11;
}
InviteQueue.enqueue({
inviteKey: code,
type: InvitePropertiesType.GROUP_DM,
channel: ChannelStore.getChannel(id),
location: "Invite Action Sheet",
inviteAnalyticsMetadata: {
suggestionData: InviteSuggestionsStore.getSelectedInviteMetadata(row),
source
}
}, handleSendState);
break L11;
}
if (RowTypes.CHANNEL !== type) {
break L11;
}
if (code == null) {
break L11;
}
InviteQueue.enqueue({
inviteKey: code,
type: InvitePropertiesType.CHANNEL,
channel: ChannelStore.getChannel(id),
location: "Invite Action Sheet",
inviteAnalyticsMetadata: {
suggestionData: InviteSuggestionsStore.getSelectedInviteMetadata(row),
source
}
}, handleSendState);
break L11;
}
if (code != null) {
InviteQueue.enqueue({
inviteKey: code,
type: InvitePropertiesType.USER,
user: UserStore.getUser(id),
location: "Invite Action Sheet",
inviteAnalyticsMetadata: {
suggestionData: InviteSuggestionsStore.getSelectedInviteMetadata(row),
source
}
}, handleSendState);
}
}
}
};
return <TableRow start={start} end={end} icon={icon} label={label} trailing={<InviteButton sendState={instantInviteSendStates} onPressSend={handlePress} />} onPress={handlePress} disabled={stateFromStores3 != null || stateFromStores2 || instantInviteSendStates === InviteSendStates.SENT} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} />;
});
export default r58;
@@ -0,0 +1,64 @@
// Metro module 12236 (f12237).
import * as Module19 from "react";
import { useState, useMemo, useEffect } from "react";
import { ScrollView, View } from "react-native";
import { SHARE_ITEMS, SHARE_ITEMS_DEFAULT } from "./InstantInviteConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useFontScale } from "../../../screen/native/useFontScale";
import { Gesture, GestureDetector } from "../../../../_bundle/Module5273";
import { ImageButton } from "../../../../design/components/Button/native/ImageButton.native";
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
import Module12238 from "../../../../_bundle/Module12238";
const useStyles = createStyles({
contentContainer: {
padding: Module712.space.PX_16,
gap: Module712.space.PX_12,
alignItems: "center"
}
});
const r44 = Module19.memo(function InstantInviteShareApps(props) {
const { onItemPressed, contentContainerStyle } = props;
const styles = useStyles();
const fontScale = useFontScale();
const [state, setState] = useState(SHARE_ITEMS_DEFAULT);
const memo = useMemo(() => Gesture.Native().disallowInterruption(true), []);
useEffect(() => {
Promise.all(SHARE_ITEMS.map((item) => item.isAvailable)).then((result) => {
const r2 = [];
let c30514_0 = r2;
result.forEach((item, index) => {
if (item) {
c30514_0.push(SHARE_ITEMS[index]);
}
});
setState(r2);
});
}, []);
return <GestureDetector gesture={memo}>
<ScrollView contentContainerStyle={[styles.contentContainer, contentContainerStyle]} showsHorizontalScrollIndicator={false} horizontal>
{state.map((item) => {
let r29;
const { fullIcon, getLabel } = item;
let icon = item.icon;
let IconComponent = item.IconComponent;
const { onPress: onPress2, type } = item;
if (fullIcon != null) {
r29 = <ImageButton image={fullIcon} label={getLabel()} onPress={() => onItemPressed(onPress2)} maxFontSizeMultiplier={2} />;
} else {
if (IconComponent == null) {
if (icon == null) {
icon = Module12238;
}
IconComponent = icon;
}
r29 = <IconButton variant="secondary" icon={IconComponent} label={getLabel()} onPress={() => onItemPressed(onPress2)} maxFontSizeMultiplier={2} />;
}
return <View key={type} style={{
maxWidth: 76 * fontScale
}}>{r29}</View>;
})}
</ScrollView>
</GestureDetector>;
});
export default r44;
@@ -0,0 +1,47 @@
// Metro module 11808 (f11809).
import { memo } from "react";
import { View } from "react-native";
import { InviteSendStates } from "../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { intl, t } from "../../../../intl/index.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
buttonWrapper: {
minWidth: 66,
flexDirection: "row"
}
});
const r31 = memo(function InviteButton(props) {
let r1, text;
const sendState = props.sendState;
let disabled = props.disabled;
if (disabled === void 0) {
disabled = false;
}
const onPressSend = props.onPressSend;
const styles = useStyles();
intl.string(t.jYnGPG);
if (InviteSendStates.SENDING === sendState) {
text = intl.string(t.jYnGPG);
disabled = false;
r1 = true;
} else if (InviteSendStates.SENT === sendState) {
text = intl.string(t.dVT149);
disabled = true;
r1 = false;
} else if (InviteSendStates.ERROR === sendState) {
text = intl.string(t.wNcfpX);
disabled = false;
r1 = false;
} else {
text = intl.string(t.jYnGPG);
r1 = false;
}
if (!disabled) {
disabled = r1;
}
return <View style={styles.buttonWrapper}>
<Button accessibilityRole="none" size="sm" variant="secondary" text={text} onPress={onPressSend} disabled={disabled} grow />
</View>;
});
export default r31;
@@ -0,0 +1,18 @@
// Metro module 8356 (f8357).
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { ImpressionNames } from "../../../../_bundle/Module503";
export default function openInstantInviteActionSheet(a0) {
const r20 = import("./InstantInviteActionSheet");
let vanityURLCode = a0.vanityURLCode;
if (vanityURLCode == null) {
vanityURLCode = a0.channel.id;
}
ActionSheetActionCreators.openLazy(r20, `InstantInviteActionSheet-${vanityURLCode}`, {
...a0,
impressionName: ImpressionNames.GUILD_INVITE,
impressionProperties: {
invite_channel_id: a0.channel.id,
invite_guild_id: a0.channel.guild_id
}
}, a0.stackingBehavior);
};
@@ -0,0 +1,48 @@
// Metro module 12229 (f12230).
import { useState, useEffect } from "react";
import GuildMemberStore from "../../../stores/GuildMemberStore";
import GuildStore from "../../../stores/GuildStore";
import InviteSuggestionsStore from "../../../stores/InviteSuggestionsStore";
import { InviteTargetTypes } from "../Constants";
import { AnalyticEvents } from "../../../Constants";
import { NOOP_NULL } from "../../../_bundle/Module505";
import { useStateFromStores } from "../../../_bundle/Module589";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { loadInviteSuggestions } from "../../../actions/InviteSuggestionsActionCreators";
export default (a0, a1, a2, a3) => {
const channel = a0;
const location2 = a1;
const inviteTargetType = a2;
const application_id = a3;
const stateFromStores = useStateFromStores([InviteSuggestionsStore], () => InviteSuggestionsStore.getInviteSuggestionRows());
const [state, setState] = useState(true);
useEffect(() => {
if (!state) {
const initialCounts = InviteSuggestionsStore.getInitialCounts();
AnalyticsUtils.track(AnalyticEvents.INVITE_SUGGESTION_OPENED, {
location: location2,
num_suggestions: stateFromStores.length,
guild_id: channel.guild_id,
num_friends: initialCounts.numFriends,
num_dms: initialCounts.numDms,
num_group_dms: initialCounts.numGroupDms,
application_id
});
}
}, [stateFromStores, a0, state, a3, a1]);
useEffect(() => {
setState(true);
loadInviteSuggestions({
omitUserIds: new Set(inviteTargetType === InviteTargetTypes.EMBEDDED_APPLICATION ? [] : GuildMemberStore.getMemberIds(channel.guild_id)),
guild: GuildStore.getGuild(channel.guild_id),
channel,
inviteTargetType
}).catch(NOOP_NULL).finally(() => {
setState(false);
});
}, [a0, a2]);
return {
rows: stateFromStores,
isFetchingRows: state
};
};
+159
View File
@@ -0,0 +1,159 @@
// Metro module 8648 (f8649).
import AuthenticationStore from "../../stores/AuthenticationStore";
import GuildStore from "../../stores/GuildStore";
import { InviteTargetTypes, InviteTypes } from "./Constants";
import { AbortCodes, AnalyticEvents, Endpoints, LoggingInviteTypes } from "../../Constants";
import { getInviteType } from "./InviteTypeUtils";
import { parseExtraDataFromInviteKey } from "./InviteCodeUtils";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import TrackedHTTPUtils from "../../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../../_bundle/Module503";
import { exact } from "../../_bundle/Module1385";
let c5625_11 = new Map();
export default function resolveInvite(a0, location2, a2) {
const code = a0;
const r21 = parseExtraDataFromInviteKey(a0);
const { baseCode, targetChannelId, targetMessageId, guildScheduledEventId } = r21;
AnalyticsUtils.track(AnalyticEvents.INVITE_OPENED, {
invite_code: baseCode,
invite_instance_id: a2?.inviteInstanceId
});
if (c5625_11.has(a0)) {
return c5625_11.get(a0);
}
const query = {
inputValue: a2?.inputValue,
with_counts: true,
with_expiration: true,
guild_scheduled_event_id: guildScheduledEventId,
target_channel_id: targetChannelId,
target_message_id: targetMessageId,
with_permissions: true,
with_games: !!a2?.withGames || void 0
};
const r57 = TrackedHTTPUtils.get({
url: Endpoints.INVITE(baseCode),
query,
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.INVITE_RESOLVE,
properties: (a0) => {
const r9 = a0.ok ? a0.body : null;
const code2 = a0.body?.code;
const USER_BANNED = AbortCodes.USER_BANNED;
const guild_id = r9 == null ? void 0 : r9.guild?.id;
const r20 = {
resolved: a0.ok,
guild_id,
channel_id: r9 == null ? void 0 : r9.channel?.id,
channel_type: r9 == null ? void 0 : r9.channel?.type,
inviter_id: r9 == null ? void 0 : r9.inviter?.id,
code: baseCode,
input_value: a2?.inputValue,
location: location2,
authenticated: AuthenticationStore.isAuthenticated(),
size_total: r9?.approximate_member_count,
size_online: r9?.approximate_presence_count,
destination_user_id: r9 == null ? void 0 : r9.target_user?.id,
invite_type: null,
user_banned: null,
user_is_member: null
};
const r52 = r9 == null;
let invite_type = null;
if (!r52) {
if (r9.target_type === InviteTargetTypes.STREAM) {
invite_type = LoggingInviteTypes.STREAM;
} else if (r9.target_type === InviteTargetTypes.EMBEDDED_APPLICATION) {
invite_type = LoggingInviteTypes.APPLICATION;
} else {
const inviteType = getInviteType(r9);
invite_type = InviteTypes.FRIEND === inviteType ? LoggingInviteTypes.FRIEND_INVITE : InviteTypes.GROUP_DM === inviteType ? LoggingInviteTypes.GDM_INVITE : InviteTypes.GUILD === inviteType ? LoggingInviteTypes.SERVER_INVITE : String(inviteType);
}
}
const user_banned = code2 === USER_BANNED;
r20.invite_type = invite_type;
r20.user_banned = user_banned;
r20.user_is_member = GuildStore.getGuild(r9 == null ? void 0 : r9.guild?.id) != null;
return exact(r20);
}
},
rejectWithError: false
}).then(({ body }) => {
if (location2 != null) {
const INVITE_RESOLVED = AnalyticEvents.INVITE_RESOLVED;
const guild_id = body.guild != null ? body.guild.id : null;
const channel_id = body.channel != null ? body.channel.id : null;
const channel_type = body.channel != null ? body.channel.type : null;
const inviter_id = body.inviter ? body.inviter.id : null;
const r21 = {
resolved: true,
guild_id,
channel_id,
channel_type,
inviter_id,
code: baseCode,
input_value: a2?.inputValue,
location: location2,
authenticated: AuthenticationStore.isAuthenticated(),
size_total: body.approximate_member_count,
size_online: body.approximate_presence_count,
destination_user_id: body.target_user != null ? body.target_user.id : null,
invite_type: null,
user_is_member: null,
invite_instance_id: null
};
const r45 = body == null;
let invite_type = null;
if (!r45) {
if (body.target_type === InviteTargetTypes.STREAM) {
invite_type = LoggingInviteTypes.STREAM;
} else if (body.target_type === InviteTargetTypes.EMBEDDED_APPLICATION) {
invite_type = LoggingInviteTypes.APPLICATION;
} else {
const inviteType = getInviteType(body);
invite_type = InviteTypes.FRIEND === inviteType ? LoggingInviteTypes.FRIEND_INVITE : InviteTypes.GROUP_DM === inviteType ? LoggingInviteTypes.GDM_INVITE : InviteTypes.GUILD === inviteType ? LoggingInviteTypes.SERVER_INVITE : String(inviteType);
}
}
r21.invite_type = invite_type;
r21.user_is_member = GuildStore.getGuild(body == null ? void 0 : body.guild?.id) != null;
let invite_instance_id = a2?.inviteInstanceId;
if (invite_instance_id == null) {
invite_instance_id = null;
}
r21.invite_instance_id = invite_instance_id;
AnalyticsUtils.track(INVITE_RESOLVED, r21, {
flush: true
});
}
return {
invite: body,
code
};
}, (a0) => {
const user_banned = a0.body != null && a0.body.code === AbortCodes.USER_BANNED;
if (location2 != null) {
AnalyticsUtils.track(AnalyticEvents.INVITE_RESOLVED, {
resolved: false,
code: baseCode,
input_value: a2?.inputValue,
location: location2,
authenticated: AuthenticationStore.isAuthenticated(),
user_banned,
error_code: a0.body?.code,
error_message: a0.body?.message
}, {
flush: true
});
}
return {
invite: null,
code,
banned: user_banned
};
}).finally(() => {
c5625_11.delete(code);
});
c5625_11.set(a0, r57);
return r57;
};
@@ -0,0 +1,13 @@
// Metro module 16636 (f16637).
import PermissionStore from "../../stores/PermissionStore";
import { GuildFeatures, Permissions } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
export function useInviteApplicationBypassInfo(a0) {
const stateFromStores = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.KICK_MEMBERS, a0), [a0]);
const r16 = a0 == null ? void 0 : a0.features.has(GuildFeatures.MEMBER_VERIFICATION_MANUAL_APPROVAL);
const isManualApprovalGuild = !(r16 ? !(a0 == null ? void 0 : a0.features.has(GuildFeatures.MEMBER_VERIFICATION_GATE_ENABLED)) : !r16);
return {
canCreateApplicationBypassInvites: isManualApprovalGuild && stateFromStores,
isManualApprovalGuild
};
}
@@ -0,0 +1,35 @@
// Metro module 16637 (f16638).
import { useMemo } from "react";
import { isEveryoneRole } from "../../records/GuildRoleRecord";
import GuildRoleStore from "../../stores/GuildRoleStore";
import PermissionStore from "../../stores/PermissionStore";
import UserStore from "../../stores/UserStore";
import { Permissions } from "../../Constants";
import { useStateFromStoresObject } from "../../_bundle/Module589";
import { getHighestRole, isRoleHigher } from "../../utils/PermissionUtils";
export default function useInviteAssignableRoles(a0) {
let sortedRoles, currentUser, canManageRoles;
const stateFromStoresObject = useStateFromStoresObject([GuildRoleStore, UserStore, PermissionStore], () => ({
sortedRoles: a0 != null ? GuildRoleStore.getSortedRoles(a0.id) : [],
currentUser: UserStore.getCurrentUser(),
canManageRoles: a0 != null && PermissionStore.can(Permissions.MANAGE_ROLES, a0)
}), [a0]);
sortedRoles = stateFromStoresObject.sortedRoles;
currentUser = stateFromStoresObject.currentUser;
canManageRoles = stateFromStoresObject.canManageRoles;
return useMemo(() => {
if (a0 != null && currentUser != null && canManageRoles) {
const highestRole = getHighestRole(a0, currentUser.id);
return sortedRoles.filter((sortedRole) => {
const isEveryoneRole2 = isEveryoneRole(sortedRole);
let r1 = !isEveryoneRole2;
if (!isEveryoneRole2) {
const managed = sortedRole.managed;
r1 = managed ? !managed : sortedRole.tags?.guild_connections === void 0 && !!isRoleHigher(a0, currentUser.id, highestRole, sortedRole);
}
return r1;
});
}
return [];
}, [a0, currentUser, canManageRoles, sortedRoles]);
};