decord/source/modules/integration_settings/native/IntegrationsSettingsWebhooksOverview.tsx

354 lines
14 KiB
TypeScript
Raw Normal View History

2026-07-28 08:39:19 +00:00
// Module ID: 15633
// Function ID: 120357
2026-07-20 16:05:17 +00:00
// Name: _isNativeReflectConstruct
2026-07-28 08:39:19 +00:00
// Dependencies: [6, 7, 15, 17, 18, 5, 31, 1348, 1908, 1838, 3793, 1850, 15634, 653, 33, 4165, 689, 1456, 1392, 5198, 1273, 1212, 21, 4004, 566, 15635, 7614, 15636, 1921, 4161, 15638, 5536, 7611, 4576, 5483, 3877, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-28 08:39:19 +00:00
// Module 15633 (_isNativeReflectConstruct)
2026-07-23 10:11:24 +00:00
import result from "result";
2026-07-28 08:39:19 +00:00
import closure_4 from "_isNativeReflectConstruct";
import closure_5 from "_createForOfIteratorHelperLoose";
2026-07-23 10:11:24 +00:00
import useNavigation from "useNavigation";
2026-07-28 08:39:19 +00:00
import getAvatarURL from "getAvatarURL";
2026-07-23 10:11:24 +00:00
import asyncGeneratorStep from "asyncGeneratorStep";
2026-07-28 08:39:19 +00:00
import importAllResult from "TableRowGroupTitle";
2026-07-23 10:11:24 +00:00
import closure_10 from "_isNativeReflectConstruct";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_13 from "_isNativeReflectConstruct";
import closure_14 from "_createForOfIteratorHelperLoose";
import closure_15 from "_isNativeReflectConstruct";
import closure_16 from "_isNativeReflectConstruct";
import closure_17 from "_isNativeReflectConstruct";
import ME from "ME";
2026-07-28 08:39:19 +00:00
import jsxProd from "Stack";
2026-07-23 10:11:24 +00:00
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
let closure_11;
let closure_12;
let closure_18;
let closure_19;
let closure_20;
let closure_21;
let closure_22;
let closure_23;
let closure_24;
let closure_25;
const require = arg1;
2026-07-20 16:05:17 +00:00
function _isNativeReflectConstruct() {
let closure_0 = !valueOf.call(Reflect.construct(Boolean, [], () => {
}));
function _isNativeReflectConstruct() {
return closure_0;
}
const result = _isNativeReflectConstruct();
}
function WebhookItem(avatar) {
let user;
let webhookId;
avatar = avatar.avatar;
const channel = avatar.channel;
const guildId = avatar.guildId;
const name = avatar.name;
const token = avatar.token;
({ user, webhookId } = avatar);
const webhookType = avatar.webhookType;
2026-07-28 08:39:19 +00:00
let obj = avatar(guildId[17]);
2026-07-20 16:05:17 +00:00
const navigation = obj.useNavigation();
const items = [webhookId, webhookType, avatar, channel, guildId, name, token, navigation];
const items1 = [webhookId, avatar];
const callback = importAllResult.useCallback(() => {
2026-07-23 10:11:24 +00:00
navigation.push(outer1_19.EDIT_WEBHOOK, { webhookId, webhookType, avatar, name, channel, guildId, token });
2026-07-20 16:05:17 +00:00
}, items);
const memo = importAllResult.useMemo(() => {
2026-07-28 08:39:19 +00:00
let obj = avatar(guildId[18]);
2026-07-23 10:11:24 +00:00
obj = { id: webhookId, avatar, discriminator: outer1_20 };
2026-07-28 08:39:19 +00:00
return obj.makeSource(avatar(guildId[18]).getUserAvatarURL(obj));
2026-07-20 16:05:17 +00:00
}, items1);
2026-07-28 08:39:19 +00:00
obj = { icon: callback4(avatar(guildId[20]).Avatar, { source: memo }), arrow: true, label: name };
2026-07-20 16:05:17 +00:00
if (null != user) {
2026-07-28 08:39:19 +00:00
const intl2 = avatar(guildId[21]).intl;
obj = { timestamp: channel(guildId[22]).extractTimestamp(webhookId) };
const obj6 = channel(guildId[22]);
obj.user = channel(guildId[23]).getUserTag(user);
let formatToPlainStringResult = intl2.formatToPlainString(avatar(guildId[21]).t["7EcUbr"], obj);
const obj7 = channel(guildId[23]);
2026-07-20 16:05:17 +00:00
} else {
2026-07-28 08:39:19 +00:00
const intl = avatar(guildId[21]).intl;
const obj1 = { timestamp: channel(guildId[22]).extractTimestamp(webhookId) };
formatToPlainStringResult = intl.formatToPlainString(avatar(guildId[21]).t["7mv59O"], obj1);
const obj4 = channel(guildId[22]);
2026-07-20 16:05:17 +00:00
}
obj.subLabel = formatToPlainStringResult;
obj.onPress = callback;
2026-07-28 08:39:19 +00:00
return callback4(avatar(guildId[19]).TableRow, obj);
2026-07-20 16:05:17 +00:00
}
function ConnectedWebhookItem(arg0) {
2026-07-23 10:11:24 +00:00
let importDefault;
let require;
({ channelId: require, user: importDefault } = arg0);
2026-07-20 16:05:17 +00:00
let obj = Object.create(null);
obj.channelId = 0;
obj.user = 0;
const merged = Object.assign(arg0, obj);
2026-07-23 10:11:24 +00:00
obj = require(566) /* initialize */;
2026-07-20 16:05:17 +00:00
const items = [closure_16];
const stateFromStores = obj.useStateFromStores(items, () => {
let id;
if (null != id) {
id = id.id;
}
2026-07-23 10:11:24 +00:00
return outer1_16.getUser(id);
2026-07-20 16:05:17 +00:00
});
const items1 = [closure_10];
obj = {};
2026-07-23 10:11:24 +00:00
const stateFromStores1 = require(566) /* initialize */.useStateFromStores(items1, () => outer1_10.getChannel(closure_0));
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(merged);
obj["user"] = stateFromStores;
obj["channel"] = stateFromStores1;
return callback4(WebhookItem, obj);
}
function CreateWebhookButton(guild) {
guild = guild.guild;
2026-07-23 10:11:24 +00:00
let channel = guild.channel;
2026-07-28 08:39:19 +00:00
let obj = guild(navigation[17]);
2026-07-23 10:11:24 +00:00
navigation = obj.useNavigation();
let items = [closure_13, closure_15];
2026-07-28 08:39:19 +00:00
const stateFromStores = guild(navigation[24]).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
if (null != channel) {
return channel;
} else {
2026-07-23 10:11:24 +00:00
const channels = outer1_13.getChannels(guild.id);
2026-07-20 16:05:17 +00:00
const items = [];
2026-07-23 10:11:24 +00:00
HermesBuiltin.arraySpread(channels[outer1_12], HermesBuiltin.arraySpread(channels[outer1_11], 0));
const found = items.find((channel) => outer2_15.can(outer2_21.MANAGE_WEBHOOKS, channel.channel));
channel = undefined;
2026-07-20 16:05:17 +00:00
if (null != found) {
channel = found.channel;
}
return channel;
}
});
// CreateGeneratorClosureLongIndex (0x67)
const items1 = [stateFromStores, guild.id, navigation];
const callback = importAllResult.useCallback(callback3(tmp), items1);
obj = {};
2026-07-28 08:39:19 +00:00
obj = { IconComponent: guild(navigation[27]).WebhookPlusIcon };
obj.icon = callback4(guild(navigation[26]).RowButton.Icon, obj);
const intl = guild(navigation[21]).intl;
obj.label = intl.string(guild(navigation[21]).t["nrO/HH"]);
2026-07-20 16:05:17 +00:00
obj.disabled = null == stateFromStores;
obj.onPress = callback;
2026-07-28 08:39:19 +00:00
return callback4(guild(navigation[26]).RowButton, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
({ GUILD_SELECTABLE_CHANNELS_KEY: closure_11, GUILD_VOCAL_CHANNELS_KEY: closure_12 } = _isNativeReflectConstruct);
({ HelpdeskArticles: closure_18, ChannelSettingsSections: closure_19, NON_USER_BOT_DISCRIMINATOR: closure_20, Permissions: closure_21, WebhookTypes: closure_22 } = ME);
({ jsx: closure_23, Fragment: closure_24, jsxs: closure_25 } = jsxProd);
_createForOfIteratorHelperLoose = {};
2026-07-28 08:39:19 +00:00
_createForOfIteratorHelperLoose = { backgroundColor: require("_createForOfIteratorHelperLoose").colors.BACKGROUND_BASE_LOWER };
2026-07-23 10:11:24 +00:00
_createForOfIteratorHelperLoose.form = _createForOfIteratorHelperLoose;
2026-07-28 08:39:19 +00:00
_createForOfIteratorHelperLoose.content = { paddingTop: require("_createForOfIteratorHelperLoose").space.PX_16, paddingHorizontal: require("_createForOfIteratorHelperLoose").modules.mobile.TABLE_ROW_PADDING };
let obj1 = { paddingTop: require("_createForOfIteratorHelperLoose").space.PX_16, paddingHorizontal: require("_createForOfIteratorHelperLoose").modules.mobile.TABLE_ROW_PADDING };
_createForOfIteratorHelperLoose.hint = { paddingHorizontal: require("_createForOfIteratorHelperLoose").space.PX_16, marginBottom: require("_createForOfIteratorHelperLoose").space.PX_16 };
2026-07-23 10:11:24 +00:00
_createForOfIteratorHelperLoose = _createForOfIteratorHelperLoose.createLegacyClassComponentStyles(_createForOfIteratorHelperLoose);
const tmp6 = ((PureComponent) => {
2026-07-20 16:05:17 +00:00
class WebhooksOverview {
constructor() {
self = this;
2026-07-23 10:11:24 +00:00
tmp = outer1_3(this, WebhooksOverview);
obj = outer1_6(WebhooksOverview);
tmp2 = outer1_5;
if (outer1_29()) {
2026-07-20 16:05:17 +00:00
tmp6 = globalThis;
_Reflect = Reflect;
2026-07-23 10:11:24 +00:00
tmp7 = outer1_6;
2026-07-20 16:05:17 +00:00
tmp8 = arguments;
2026-07-23 10:11:24 +00:00
constructResult = Reflect.construct(obj, arguments, outer1_6(self).constructor);
2026-07-20 16:05:17 +00:00
} else {
tmp3 = arguments;
tmp4 = arguments;
constructResult = obj(...arguments);
}
return tmp2(self, constructResult);
}
}
callback2(WebhooksOverview, PureComponent);
let obj = {
key: "getHelpText",
value() {
2026-07-23 10:11:24 +00:00
if (this.props.webhookType === outer1_22.CHANNEL_FOLLOWER) {
2026-07-28 08:39:19 +00:00
const intl2 = WebhooksOverview(outer1_2[21]).intl;
let obj = { helpdeskArticle: outer1_1(outer1_2[28]).getArticleURL(outer1_18.CHANNEL_FOLLOWING) };
let formatResult = intl2.format(WebhooksOverview(outer1_2[21]).t["5u+aV1"], obj);
const obj4 = outer1_1(outer1_2[28]);
2026-07-20 16:05:17 +00:00
} else {
2026-07-28 08:39:19 +00:00
const intl = WebhooksOverview(outer1_2[21]).intl;
obj = { articleURL: outer1_1(outer1_2[28]).getArticleURL(outer1_18.WEBHOOKS_INTRODUCTION) };
formatResult = intl.format(WebhooksOverview(outer1_2[21]).t["3hX7G+"], obj);
const obj2 = outer1_1(outer1_2[28]);
2026-07-20 16:05:17 +00:00
}
return formatResult;
}
};
2026-07-23 10:11:24 +00:00
let items = [obj, , ];
2026-07-20 16:05:17 +00:00
obj = {
key: "renderWebhooks",
value() {
let webhookType;
let webhooks;
const self = this;
({ webhooks, webhookType } = this.props);
let found = webhooks;
if (null != webhookType) {
found = webhooks.filter((type) => type.type === webhookType);
}
let obj = {};
const helpText = self.getHelpText();
2026-07-23 10:11:24 +00:00
obj = { variant: "text-sm/medium", color: "text-muted", children: helpText };
2026-07-28 08:39:19 +00:00
const items = [outer1_23(WebhooksOverview(outer1_2[29]).Text, obj), , ];
2026-07-23 10:11:24 +00:00
let tmp4 = webhookType === outer1_22.INCOMING;
2026-07-20 16:05:17 +00:00
if (tmp4) {
obj = { guild: self.props.guild, channel: self.props.channel };
2026-07-23 10:11:24 +00:00
tmp4 = outer1_23(outer1_32, obj);
2026-07-20 16:05:17 +00:00
}
items[1] = tmp4;
if (0 === found.length) {
2026-07-28 08:39:19 +00:00
const obj1 = { Illustration: WebhooksOverview(outer1_2[30]).WebhookEmpty };
2026-07-23 10:11:24 +00:00
if (webhookType === outer1_22.CHANNEL_FOLLOWER) {
2026-07-28 08:39:19 +00:00
const intl2 = WebhooksOverview(outer1_2[21]).intl;
let stringResult = intl2.string(WebhooksOverview(outer1_2[21]).t.dkHRkE);
2026-07-20 16:05:17 +00:00
} else {
2026-07-28 08:39:19 +00:00
const intl = WebhooksOverview(outer1_2[21]).intl;
stringResult = intl.string(WebhooksOverview(outer1_2[21]).t["4JAVI+"]);
2026-07-20 16:05:17 +00:00
}
2026-07-21 22:01:30 +00:00
obj1.title = stringResult;
2026-07-28 08:39:19 +00:00
outer1_23(WebhooksOverview(outer1_2[20]).EmptyState, obj1);
2026-07-23 10:11:24 +00:00
const tmp10 = outer1_23;
2026-07-20 16:05:17 +00:00
} else {
2026-07-21 22:01:30 +00:00
const obj2 = {
2026-07-20 16:05:17 +00:00
hasIcons: true,
children: found.map((type) => {
let avatar;
let channel_id;
let guild_id;
let id;
let name;
let token;
let user;
({ id, avatar } = type);
const obj = { webhookId: id, webhookType: type.type };
let tmp3;
({ name, user, token, guild_id, channel_id } = type);
if (null != avatar) {
tmp3 = avatar;
}
obj.avatar = tmp3;
obj.name = name;
obj.user = user;
obj.channelId = channel_id;
obj.token = token;
obj.guildId = guild_id;
2026-07-23 10:11:24 +00:00
return outer2_23(outer2_31, obj, id);
2026-07-20 16:05:17 +00:00
})
};
2026-07-28 08:39:19 +00:00
items[2] = outer1_23(WebhooksOverview(outer1_2[31]).TableRowGroup, obj2);
2026-07-20 16:05:17 +00:00
obj.children = items;
2026-07-23 10:11:24 +00:00
return outer1_25(outer1_24, obj);
2026-07-20 16:05:17 +00:00
}
}
};
items[1] = obj;
obj = {
key: "render",
value() {
2026-07-23 10:11:24 +00:00
const tmp = outer1_26(this.context);
2026-07-20 16:05:17 +00:00
let obj = {};
obj = { style: tmp.form, contentContainerStyle: this.props.contentContainerStyle };
2026-07-28 08:39:19 +00:00
obj = { spacing: outer1_1(outer1_2[16]).space.PX_24, style: tmp.content, children: this.renderWebhooks() };
obj.children = outer1_23(WebhooksOverview(outer1_2[33]).Stack, obj);
const items = [outer1_23(WebhooksOverview(outer1_2[32]).Form, obj), outer1_23(WebhooksOverview(outer1_2[34]).NavScrim, {})];
2026-07-20 16:05:17 +00:00
obj.children = items;
2026-07-23 10:11:24 +00:00
return outer1_25(outer1_24, obj);
2026-07-20 16:05:17 +00:00
}
};
items[2] = obj;
return callback(WebhooksOverview, items);
2026-07-23 10:11:24 +00:00
})(importAllResult.PureComponent);
let closure_27 = tmp6;
tmp6.contextType = require("ManaContext").ThemeContext;
2026-07-20 16:05:17 +00:00
let closure_28 = [];
2026-07-28 08:39:19 +00:00
let obj2 = { paddingHorizontal: require("_createForOfIteratorHelperLoose").space.PX_16, marginBottom: require("_createForOfIteratorHelperLoose").space.PX_16 };
2026-07-23 10:11:24 +00:00
let result = require("_possibleConstructorReturn").fileFinishedImporting("modules/integration_settings/native/IntegrationsSettingsWebhooksOverview.tsx");
2026-07-20 16:05:17 +00:00
export default function ConnectedWebhooksOverview(channelId) {
let contentContainerStyle;
let webhookType;
channelId = channelId.channelId;
let guildId = channelId.guildId;
2026-07-23 10:11:24 +00:00
guildId = undefined;
channelId = undefined;
2026-07-20 16:05:17 +00:00
({ contentContainerStyle, webhookType } = channelId);
2026-07-28 08:39:19 +00:00
let obj = channelId(stateFromStores[24]);
2026-07-20 16:05:17 +00:00
const items = [closure_10];
2026-07-23 10:11:24 +00:00
stateFromStores = obj.useStateFromStores(items, () => outer1_10.getChannel(channelId));
2026-07-20 16:05:17 +00:00
const items1 = [closure_14];
2026-07-28 08:39:19 +00:00
const stateFromStores1 = channelId(stateFromStores[24]).useStateFromStores(items1, () => {
2026-07-20 16:05:17 +00:00
let guild_id;
if (null != stateFromStores) {
guild_id = stateFromStores.guild_id;
}
if (null == guild_id) {
guild_id = guildId;
}
2026-07-23 10:11:24 +00:00
return outer1_14.getGuild(guild_id);
2026-07-20 16:05:17 +00:00
});
let id;
if (null != stateFromStores1) {
id = stateFromStores1.id;
}
if (null != id) {
guildId = id;
}
let id1;
if (null != stateFromStores) {
id1 = stateFromStores.id;
}
if (null != id1) {
channelId = id1;
}
2026-07-28 08:39:19 +00:00
let obj2 = channelId(stateFromStores[24]);
2026-07-20 16:05:17 +00:00
const items2 = [closure_17];
const items3 = [guildId, channelId];
2026-07-28 08:39:19 +00:00
const stateFromStoresArray = channelId(stateFromStores[24]).useStateFromStoresArray(items2, () => {
2026-07-20 16:05:17 +00:00
if (null != guildId) {
if (null != channelId) {
2026-07-23 10:11:24 +00:00
let webhooksForChannel = outer1_17.getWebhooksForChannel(guildId, channelId);
2026-07-20 16:05:17 +00:00
}
return webhooksForChannel;
}
if (null != guildId) {
2026-07-23 10:11:24 +00:00
webhooksForChannel = outer1_17.getWebhooksForGuild(guildId);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
webhooksForChannel = outer1_28;
2026-07-20 16:05:17 +00:00
}
});
const effect = importAllResult.useEffect(() => {
if (null != guildId) {
if (null != channelId) {
2026-07-28 08:39:19 +00:00
const forChannel = guildId(stateFromStores[25]).fetchForChannel(guildId, channelId);
const obj2 = guildId(stateFromStores[25]);
2026-07-20 16:05:17 +00:00
}
}
if (null != guildId) {
2026-07-28 08:39:19 +00:00
const forGuild = guildId(stateFromStores[25]).fetchForGuild(guildId);
const obj = guildId(stateFromStores[25]);
2026-07-20 16:05:17 +00:00
}
}, items3);
let tmp7 = null;
if (null != stateFromStores1) {
obj = { guild: stateFromStores1, channel: stateFromStores, webhooks: stateFromStoresArray, contentContainerStyle, webhookType };
2026-07-23 10:11:24 +00:00
tmp7 = callback4(closure_27, obj);
2026-07-20 16:05:17 +00:00
}
return tmp7;
};