Files
discord-decomp/sources/modules/guild_settings/native/GuildSettingsModalInstantInvites.tsx
T
2026-07-28 01:06:53 +03:00

356 lines
18 KiB
TypeScript

/* Metro module 15983; source: modules/guild_settings/native/GuildSettingsModalInstantInvites.tsx; dependencies: [57, 31, 27, 10906, 8150, 1379, 1867, 9113, 661, 33, 4501, 1244, 1948, 8950, 6766, 6242, 8947, 11838, 566, 22, 8277, 8275, 4080, 11445, 1962, 3857, 12132, 5460, 1305, 15984, 5462, 2] */
import Module00022 from '../../../by-id/module-00022.js'; /* Metro dependency 22 */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import ChannelStore from '../../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import GuildSettingsStore from '../GuildSettingsStore.tsx'; /* Metro dependency 9113 */
import GuildIncidentsStore from '../../guild_antiraid/GuildIncidentsStore.tsx'; /* Metro dependency 10906 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TextWithIOSLinkWorkaroundModule from '../../a11y/native/TextWithIOSLinkWorkaround.tsx'; /* Metro dependency 6766 */
import * as TableCheckboxRowNativeModule from '../../../design/components/TableRow/native/TableCheckboxRow.native.tsx'; /* Metro dependency 8950 */
import * as GuildInvitesDisabledUtilsModule from '../safety/GuildInvitesDisabledUtils.tsx'; /* Metro dependency 11838 */
function _fun123633(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#123633, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:6, offset: 0x02595bda, size: 462 bytes, params: 8, frame: 23
const env0_0 = require;
const InvitesDisabledRow2 = InvitesDisabledRow;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
value.Platform;
const env0_5 = value.FlatList;
value = importDefault(8150) /* metro dependency 8150: InviteRecord */;
const env0_15 = (CreateStylesModule).createStyles({list: {paddingTop: 8},
content: {'padding': 16, 'gap': 24}, listWithPause: {paddingTop: 0}});
value = new value({code: 'pause_invites'});
const env0_18 = {};
(FileImportTrackerModule).fileFinishedImporting('modules/guild_settings/native/GuildSettingsModalInstantInvites.tsx');
exports.default = ConnectedGuildSettingsModalInstantInvites;
exports.InvitesDisabledRow = InvitesDisabledRow2;
function InvitesDisabledRow({onPauseInvites, invitesDisabled}) { // fn#123634, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:438, offset: 0x02595da8, size: 390 bytes, params: 2, frame: 24
var r9;
var format;
var IFBHag;
var defaultImport;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const Uwsjn6 = (require(1244) /* metro dependency 1244: indexNative */).t.Uwsjn6;
const value2 = Reflect.apply(string, intl, [Uwsjn6]);
if (invitesDisabled) {
r9 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t['2LLbj9']);
} else {
format = intl.format;
IFBHag = (require(1244) /* metro dependency 1244: indexNative */).t.IFBHag;
defaultImport = importDefault(1948) /* metro dependency 1948: HelpdeskUtils */;
r9 = Reflect.apply(format, intl, [IFBHag,
{helpArticleUrl: defaultImport.getArticleURL(HelpdeskArticles.INVITE_DISABLED)}]);
}
const TableCheckboxRow = (TableCheckboxRowNativeModule).TableCheckboxRow;
const TextWithIOSLinkWorkaround = (TextWithIOSLinkWorkaroundModule).TextWithIOSLinkWorkaround;
return (
<TableCheckboxRow
label={value2}
subLabel={<TextWithIOSLinkWorkaround variant="text-xs/medium">
{r9}
</TextWithIOSLinkWorkaround>}
icon={invitesDisabled
? ((TableRowIcon) => <TableRowIcon source={importDefault(8947) /* metro dependency 8947 */} />)((require(6242) /* metro dependency 6242: TableRowIconNative */).TableRowIcon)
: null}
checked={invitesDisabled}
onPress={onPauseInvites}
start
end
/>
);
}
function GuildSettingsModalInstantInvites({invites, guild, showChannel, contentContainerStyle}) { // fn#123635, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:918, offset: 0x02595f2e, size: 1031 bytes, params: 2, frame: 28
var invitesDisabledUntil;
var r2;
var r10;
var r0;
var value6;
var Date;
var prototype;
var value7;
var date;
var value8;
var value9;
var jsxRuntimeEnv0_13Binding;
var items3;
var EmptyState;
const intl = (IndexNativeModule).intl;
const t = (IndexNativeModule).t;
showChannel = !(showChannel === undefined) && showChannel;
const styles = useStyles();
const value4 = (GuildInvitesDisabledUtilsModule).useInvitesDisabledPermission(guild);
const env0_3 = value4;
const guildIncident = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildIncidentsStore],
function() {
return GuildIncidentsStore.getGuildIncident(guild.id);
});
const guildIncident2 = guildIncident;
const features = guild.features;
const has = features.has;
const INVITES_DISABLED = GuildFeatures.INVITES_DISABLED;
const value5 = Reflect.apply(has, features, [INVITES_DISABLED]);
if (value5) {
r10 = value5;
} else {
invitesDisabledUntil = guildIncident?.invitesDisabledUntil;
value6 = invitesDisabledUntil != null;
if (value6) {
Date = global.Date;
invitesDisabledUntil = guildIncident.invitesDisabledUntil;
prototype = Date.prototype;
value7 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
value8 = date instanceof Object ? date : value7;
Date = global.Date;
prototype = Date.prototype;
value9 = Object.create(prototype, {constructor: {value: Date}});
date = new Date();
r2 = value8 > (date instanceof Object ? date : value9);
} else {
r2 = value6;
}
r10 = r2;
}
let binding = guildIncident2;
const [property, env0_7] = env0_3(binding.useState(false), 2);
const [property2, env0_8] = env0_3(guildIncident2.useState(21), 2);
const value18 = guildIncident2.useMemo(_fun123640, [guildIncident2.useMemo(_fun123637, [invites, value4,
showChannel]), (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([ChannelStore],
function() {
return ChannelStore.getSortedLinkedChannelsForGuild(guild.id);
})]);
guildIncident2.useEffect(_fun123643, []);
binding = guildIncident2;
let useCallback = binding.useCallback;
const value19 = Reflect.apply(useCallback, binding, [function(a0) {
return a0.type === 'invite' ? a0.data.code : a0.data.id;
}, []]);
const value20 = guildIncident2.useCallback(_fun123645, [property, guildIncident, guild]);
binding = guildIncident2;
useCallback = binding.useCallback;
if (invites == null) {
const SceneLoadingIndicator = (require(5460) /* metro dependency 5460: SceneLoadingIndicatorNative */).SceneLoadingIndicator;
r0 = <SceneLoadingIndicator />;
} else if (value18.length === 0) {
jsxRuntimeEnv0_13Binding = jsxRuntimeEnv0_13;
items3 = [
<InvitesDisabledRow
onPauseInvites={value20}
invitesDisabled={r10}
invitesDisabledLoading={property}
/>,
];
EmptyState = (require(1305) /* metro dependency 1305: native */).EmptyState;
items3[1] = (
<EmptyState
Illustration={(require(15984) /* metro dependency 15984: InviteEmpty */).InviteEmpty}
title={intl.string(t['+nLJkZ'])}
body={intl.string(t.F53CAc)}
/>
);
r0 = (
<>
{items3}
</>
);
} else {
r0 = (
<FlatList
style={[value4 ? styles.listWithPause : styles.list]}
data={value18}
keyExtractor={value19}
renderItem={Reflect.apply(useCallback, binding, [_fun123646, [r10, value20, property]])}
initialNumToRender={10}
windowSize={property2}
contentContainerStyle={[contentContainerStyle, styles.content]}
/>
);
}
return r0;
function _fun123637() { // fn#123637, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:1361, offset: 0x02596355, size: 77 bytes, params: 1, frame: 15
const defaultImport = Module00022;
const value3 = defaultImport.sortBy(invites, _fun123638);
if (env0_3) {
value3.unshift(env1_17);
}
return value3;
function _fun123638(a0) { // fn#123638, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:1391, offset: 0x025963a2, size: 107 bytes, params: 2, frame: 13
var r2;
var r0;
var inviter;
var channel;
let value = environment.__proto__;
if (showChannel) {
channel = a0.channel;
r0 = channel == null ? undefined : channel.name.toLowerCase();
} else {
inviter = a0.inviter;
value = undefined;
r2 = inviter == null || inviter.username == null ? value : inviter.username.toLowerCase();
value = '';
r0 = r2 ?? value;
}
return r0;
}
}
function _fun123640() { // fn#123640, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:1680, offset: 0x0259642d, size: 69 bytes, params: 1, frame: 15
let binding = env0_9;
const value2 = binding.map(function(a0) {
return {type: 'invite', data: a0};
});
const items2 = [];
const value3 = arraySpread(items2, value2, 0, binding);
binding = ConstantsModule.GuildFeatures;
arraySpread(items2, binding.map(function(a0) {
return {type: 'channel', data: a0};
}), value3, binding);
return items2;
}
function _fun123643() { // fn#123643, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:1788, offset: 0x02596472, size: 19 bytes, params: 1, frame: 11
env0_8(21);
}
function _fun123645() { // fn#123645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:1891, offset: 0x025964ad, size: 286 bytes, params: 1, frame: 19
var object;
var value2;
var property;
var moduleValue;
var GuildIncidentActionSources;
var MESSAGE;
var moduleValue2;
var incidentAlertType;
var defaultImport;
var openLazy;
var moduleValue3;
var paths;
var value4;
var error;
var value5;
var defaultImport2;
var open;
var defaultImport3;
var message;
if (!env0_6) {
env0_7(true);
try {
try {
object = {};
value2 = environment.__proto__;
property = dependencyMap[20];
moduleValue = require(property);
GuildIncidentActionSources = moduleValue.GuildIncidentActionSources;
MESSAGE = GuildIncidentActionSources.MESSAGE;
object.source = MESSAGE;
property = dependencyMap[21];
moduleValue2 = require(property);
incidentAlertType = moduleValue2.getIncidentAlertType(guildIncident);
object.alertType = incidentAlertType;
property = dependencyMap[22];
defaultImport = importDefault(property);
openLazy = defaultImport.openLazy;
property = dependencyMap[24];
moduleValue3 = require(property);
property = dependencyMap[23];
paths = dependencyMap.paths;
value4 = moduleValue3(property, paths);
Reflect.apply(openLazy, defaultImport, [value4, 'GuildIncidentActionsActionSheet', {guild: guild,
analyticsData: object}]);
} catch (error) {
value5 = environment.__proto__;
property = dependencyMap[25];
defaultImport2 = importDefault(property);
open = defaultImport2.open;
property = dependencyMap[16];
defaultImport3 = importDefault(property);
message = error.message;
Reflect.apply(open, defaultImport2, [{key: 'GUILD_SETTINGS_MODAL_INVITE_ERROR', icon: defaultImport3,
content: message}]);
}
} catch (error) {
env0_7(false);
throw error;
}
env0_7(false);
}
}
function _fun123646({item}) { // fn#123646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:2260, offset: 0x025965cb, size: 195 bytes, params: 2, frame: 16
var r1;
var r0;
var value;
var code;
if (item.type === 'invite') {
code = item.data.code;
value = environment.__proto__;
if (code === env1_16) {
r1 = (
<InvitesDisabledRow
invitesDisabled={env0_5}
invitesDisabledLoading={env0_6}
onPauseInvites={ConstantsModule.HelpdeskArticles}
/>
);
} else {
value = importDefault(12132) /* metro dependency 12132: InstantInvite */;
value = ((Component) => <Component invite={item.data} />)(value);
r1 = value;
}
r0 = r1;
} else {
value = environment.__proto__;
const LinkedChannelInvite = (require(12132) /* metro dependency 12132: InstantInvite */).LinkedChannelInvite;
value = <LinkedChannelInvite channel={item.data} />;
r0 = value;
}
return r0;
}
}
function ConnectedGuildSettingsModalInstantInvites({guildId, contentContainerStyle}) { // fn#123647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:3055, offset: 0x0259668e, size: 232 bytes, params: 2, frame: 21
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
return GuildStore.getGuild(guildId);
});
return (
guild != null
? (
<>
<GuildSettingsModalInstantInvites
guild={guild}
invites={(require(566) /* metro dependency 566: flux */).useStateFromStores([GuildSettingsStore],
_fun123649)}
contentContainerStyle={contentContainerStyle}
showChannel
/>
{((NavScrim) => <NavScrim />)((require(5462) /* metro dependency 5462: NavScrimAndroid */).NavScrim)}
</>
)
: null
);
function _fun123649() { // fn#123649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16191:3237, offset: 0x02596776, size: 35 bytes, params: 1, frame: 10
const guildSettingsStoreBinding = GuildSettingsStore;
const getProps = guildSettingsStoreBinding.getProps;
return Reflect.apply(getProps, guildSettingsStoreBinding, []).invites ?? env1_18;
}
}
}
global.__d(_fun123633, 15983, [57, 31, 27, 10906, 8150, 1379, 1867, 9113, 661, 33, 4501, 1244, 1948, 8950, 6766,
6242, 8947, 11838, 566, 22, 8277, 8275, 4080, 11445, 1962, 3857, 12132, 5460, 1305, 15984, 5462,
2]) /* metro module 15983, dependencies: [57, 31, 27, 10906, 8150, 1379, 1867, 9113, 661, 33, 4501, 1244, 1948, 8950, 6766, 6242, 8947, 11838, 566, 22, 8277, 8275, 4080, 11445, 1962, 3857, 12132, 5460, 1305, 15984, 5462, 2] */;