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

@@ -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);
};