Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
332 lines
13 KiB
TypeScript
332 lines
13 KiB
TypeScript
// Module ID: 16881
|
|
// Function ID: 16882
|
|
// Name: IntegrationsSettingsWebhooksOverview
|
|
// Dependencies: [5, 19, 1957, 2012, 1979, 4212, 1371, 16882, 1074, 21, 4574, 576, 1483, 1396, 5619, 1178, 1114, 11, 4418, 504, 16883, 8628, 16884, 4284, 2024, 4570, 16886, 5701, 8626, 4987, 7054, 2]
|
|
// Exports: default
|
|
|
|
// Module 16881 (IntegrationsSettingsWebhooksOverview)
|
|
import initialize from "initialize" /* 504 */;
|
|
import nativeDefault from "native" /* 576 */;
|
|
import util from "util" /* 1114 */;
|
|
import AvatarUtils from "AvatarUtils" /* 1396 */;
|
|
import HelpdeskUtilsDefault from "HelpdeskUtils" /* 2024 */;
|
|
import Stack_Stack from "Stack/Stack" /* 4987 */;
|
|
import NavScrim from "NavScrim" /* 7054 */;
|
|
import Form from "Form" /* 8626 */;
|
|
import WebhooksActionCreatorsDefault from "WebhooksActionCreators" /* 16883 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import ChannelStore from "ChannelStore" /* 1957 */;
|
|
import GuildChannelStore_mod from "GuildChannelStore" /* 2012 */;
|
|
import GuildStore from "GuildStore" /* 1979 */;
|
|
import PermissionStore from "PermissionStore" /* 4212 */;
|
|
import UserStore from "UserStore" /* 1371 */;
|
|
import WebhooksStore from "WebhooksStore" /* 16882 */;
|
|
|
|
require = fn;
|
|
function WebhookItem(avatar) {
|
|
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;
|
|
const navigation = avatar(guildId[12]).useNavigation();
|
|
const items = [webhookId, webhookType, avatar, channel, guildId, name, token, navigation];
|
|
const items1 = [webhookId, avatar];
|
|
const callback = token.useCallback(() => {
|
|
navigation.push(constants2.EDIT_WEBHOOK, { webhookId, webhookType, avatar, name, channel, guildId, token });
|
|
}, items);
|
|
const memo = token.useMemo(() => {
|
|
const obj = AvatarUtils;
|
|
return obj.makeSource(AvatarUtils.getUserAvatarURL({ id: webhookId, avatar, discriminator }));
|
|
}, items1);
|
|
const obj2 = { icon: closure_18(avatar(guildId[15]).Avatar, { source: memo }), arrow: true, label: name, subLabel: null, onPress: null };
|
|
if (null != user) {
|
|
const intl2 = tmp(tmp2[16]).intl;
|
|
const obj3 = { timestamp: channel(tmp2[17]).extractTimestamp(webhookId), user: null };
|
|
const obj6 = channel(tmp2[17]);
|
|
obj3.user = channel(tmp2[18]).getUserTag(user);
|
|
let formatToPlainStringResult = intl2.formatToPlainString(tmp(tmp2[16]).t["7EcUbr"], obj3);
|
|
const obj7 = channel(tmp2[18]);
|
|
} else {
|
|
const intl = tmp(tmp2[16]).intl;
|
|
const obj5 = { timestamp: channel(tmp2[17]).extractTimestamp(webhookId) };
|
|
formatToPlainStringResult = intl.formatToPlainString(tmp(tmp2[16]).t["7mv59O"], obj5);
|
|
const obj4 = channel(tmp2[17]);
|
|
}
|
|
obj2.subLabel = formatToPlainStringResult;
|
|
obj2.onPress = callback;
|
|
return closure_18(avatar(guildId[14]).TableRow, obj2);
|
|
}
|
|
function ConnectedWebhookItem(arg0) {
|
|
({ channelId: require, user: importDefault } = arg0);
|
|
const merged = Object.assign(arg0, Object.assign({ channelId: 0, user: 0 }));
|
|
const items = [UserStore];
|
|
const stateFromStores = initialize.useStateFromStores(items, () => {
|
|
id = undefined;
|
|
if (id != null) {
|
|
id = id.id;
|
|
}
|
|
return UserStore.getUser(id);
|
|
});
|
|
const items1 = [ChannelStore];
|
|
const obj3 = {};
|
|
const stateFromStores1 = initialize.useStateFromStores(items1, () => ChannelStore.getChannel(require));
|
|
const merged1 = Object.assign(merged);
|
|
obj3.user = stateFromStores;
|
|
obj3.channel = stateFromStores1;
|
|
return closure_18(WebhookItem, obj3);
|
|
}
|
|
function CreateWebhookButton(guild) {
|
|
guild = guild.guild;
|
|
let channel = guild.channel;
|
|
let navigation;
|
|
navigation = guild(navigation[12]).useNavigation();
|
|
let obj = guild(navigation[12]);
|
|
let items = [GuildChannelStore, PermissionStore];
|
|
const stateFromStores = guild(navigation[19]).useStateFromStores(items, () => {
|
|
if (null != channel) {
|
|
return channel;
|
|
} else {
|
|
const channels = GuildChannelStore.getChannels(guild.id);
|
|
const items = [];
|
|
HermesBuiltin.arraySpread(channels[React5], HermesBuiltin.arraySpread(channels[timestampProducer], 0));
|
|
const found = items.find((channel) => closure_1_10.can(constants.MANAGE_WEBHOOKS, channel.channel));
|
|
channel = undefined;
|
|
if (found != null) {
|
|
channel = found.channel;
|
|
}
|
|
return channel;
|
|
}
|
|
});
|
|
const items1 = [stateFromStores, guild.id, navigation];
|
|
const callback = noop.useCallback(stateFromStores(function*(arg0, value) {
|
|
if (c4 === 2) {
|
|
c4 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c4 = 2;
|
|
if (0 === c3) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else {
|
|
closure_129_0 = undefined;
|
|
if (null != stateFromStores) {
|
|
c3 = 1;
|
|
c4 = 1;
|
|
const obj5 = { value: tmp2(tmp5[20]).create(guild.id, stateFromStores.id), done: false };
|
|
return obj5;
|
|
} else {
|
|
c4 = 3;
|
|
}
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
closure_129_0 = value;
|
|
if (null != closure_129_0) {
|
|
const obj6 = { webhookId: closure_129_0.id, webhookType: closure_129_0.type, avatar: null, name: null, channel: null, guildId: null, token: null };
|
|
let avatar = closure_129_0.avatar;
|
|
if (avatar == null) {
|
|
avatar = undefined;
|
|
}
|
|
obj6.avatar = avatar;
|
|
obj6.name = closure_129_0.name;
|
|
obj6.channel = closure_130_3;
|
|
obj6.guildId = closure_130_0.id;
|
|
obj6.token = closure_129_0.token;
|
|
closure_130_2.push(constants.EDIT_WEBHOOK, obj6);
|
|
}
|
|
}
|
|
c4 = 3;
|
|
const obj = { value, done: true };
|
|
return obj;
|
|
} catch (tmp18) {
|
|
c4 = tmp;
|
|
throw tmp18;
|
|
}
|
|
}
|
|
}), items1);
|
|
let obj3 = { icon: null, label: null, disabled: null, onPress: null };
|
|
const obj2 = guild(navigation[19]);
|
|
obj3.icon = closure_18(guild(navigation[21]).RowButton.Icon, { IconComponent: guild(navigation[22]).WebhookPlusIcon });
|
|
const intl = guild(navigation[16]).intl;
|
|
obj3.label = intl.string(guild(navigation[16]).t["nrO/HH"]);
|
|
obj3.disabled = null == stateFromStores;
|
|
obj3.onPress = callback;
|
|
return closure_18(guild(navigation[21]).RowButton, obj3);
|
|
}
|
|
let GuildChannelStore = fn(2012);
|
|
({ GUILD_SELECTABLE_CHANNELS_KEY: metroRequire, GUILD_VOCAL_CHANNELS_KEY: closure_7 } = GuildChannelStore);
|
|
let GuildChannelStore = GuildChannelStore_mod;
|
|
const Constants = fn(1074);
|
|
({ HelpdeskArticles: map1, ChannelSettingsSections: closure_14, NON_USER_BOT_DISCRIMINATOR: closure_15, Permissions: closure_16, WebhookTypes: closure_17 } = Constants);
|
|
const jsxProd = fn(21);
|
|
({ jsx: closure_18, Fragment: closure_19, jsxs: closure_20 } = jsxProd);
|
|
const createStyles = fn(4574);
|
|
let obj2 = { form: { backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOWER }, content: null, hint: null };
|
|
let obj3 = { backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOWER };
|
|
obj2.content = { paddingTop: nativeDefault.space.PX_16, paddingHorizontal: nativeDefault.modules.mobile.TABLE_ROW_PADDING };
|
|
let obj4 = { paddingTop: nativeDefault.space.PX_16, paddingHorizontal: nativeDefault.modules.mobile.TABLE_ROW_PADDING };
|
|
obj2.hint = { paddingHorizontal: nativeDefault.space.PX_16, marginBottom: nativeDefault.space.PX_16 };
|
|
let closure_21 = createStyles.createLegacyClassComponentStyles(obj2);
|
|
const PureComponent = noop.PureComponent;
|
|
class WebhooksOverview extends PureComponent {
|
|
}
|
|
const prototype = WebhooksOverview.prototype;
|
|
prototype["getHelpText"] = function getHelpText() {
|
|
if (this.props.webhookType === constants3.CHANNEL_FOLLOWER) {
|
|
const intl2 = util.intl;
|
|
const obj3 = { helpdeskArticle: HelpdeskUtilsDefault.getArticleURL(constants.CHANNEL_FOLLOWING) };
|
|
let formatResult = intl2.format(util.t["5u+aV1"], obj3);
|
|
} else {
|
|
const intl = util.intl;
|
|
const obj = { articleURL: HelpdeskUtilsDefault.getArticleURL(constants.WEBHOOKS_INTRODUCTION) };
|
|
formatResult = intl.format(util.t["3hX7G+"], obj);
|
|
}
|
|
return formatResult;
|
|
};
|
|
prototype["renderWebhooks"] = function renderWebhooks() {
|
|
const self = this;
|
|
({ webhooks, webhookType } = this.props);
|
|
let found = webhooks;
|
|
if (null != webhookType) {
|
|
found = webhooks.filter((type) => type.type === webhookType);
|
|
}
|
|
let dkHRkE = dependencyMap;
|
|
const helpText = self.getHelpText();
|
|
const items = [closure_18(webhookType(4570).Text, { variant: "text-sm/medium", color: "text-muted", children: helpText }), , ];
|
|
let tmp4Result = webhookType === constants3.INCOMING;
|
|
if (tmp4Result) {
|
|
let obj = { guild: self.props.guild, channel: self.props.channel };
|
|
tmp4Result = tmp4(CreateWebhookButton, obj);
|
|
}
|
|
items[1] = tmp4Result;
|
|
if (0 === found.length) {
|
|
const obj2 = { Illustration: tmp5(16886).WebhookEmpty, title: null };
|
|
if (webhookType === constants3.CHANNEL_FOLLOWER) {
|
|
const intl2 = tmp5(1114).intl;
|
|
dkHRkE = tmp5(1114).t.dkHRkE;
|
|
let stringResult = intl2.string(dkHRkE);
|
|
} else {
|
|
const intl = tmp5(1114).intl;
|
|
stringResult = intl.string(tmp5(1114).t["4JAVI+"]);
|
|
}
|
|
obj2.title = stringResult;
|
|
tmp4(tmp5(1178).EmptyState, obj2);
|
|
} else {
|
|
const obj3 = {
|
|
hasIcons: true,
|
|
children: found.map((type) => {
|
|
({ id, avatar } = type);
|
|
const obj = { webhookId: id, webhookType: type.type, avatar, name, user, channelId: channel_id, token, guildId: guild_id };
|
|
({ name, user, token, guild_id, channel_id } = type);
|
|
return closure_1_18(ConnectedWebhookItem, obj, id);
|
|
})
|
|
};
|
|
const obj4 = { children: null };
|
|
items[2] = tmp4(tmp5(5701).TableRowGroup, obj3);
|
|
obj4.children = items;
|
|
return closure_20(closure_19, obj4);
|
|
}
|
|
};
|
|
prototype["render"] = function render() {
|
|
const tmp = closure_21(this.context);
|
|
const obj = { children: null };
|
|
const obj2 = { style: tmp.form, contentContainerStyle: this.props.contentContainerStyle, children: collapsedCategories(Stack_Stack.Stack, { spacing: nativeDefault.space.PX_24, style: tmp.content, children: this.renderWebhooks() }) };
|
|
const items = [collapsedCategories(Form.Form, obj2), collapsedCategories(NavScrim.NavScrim, {})];
|
|
obj.children = items;
|
|
return closure_1_20(closure_1_19, obj);
|
|
};
|
|
WebhooksOverview.contextType = fn(4284).ThemeContext;
|
|
let closure_26 = [];
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/integration_settings/native/IntegrationsSettingsWebhooksOverview.tsx");
|
|
|
|
export default function ConnectedWebhooksOverview(channelId) {
|
|
channelId = channelId.channelId;
|
|
const guildId = channelId.guildId;
|
|
let stateFromStores;
|
|
let id1;
|
|
({ contentContainerStyle, webhookType } = channelId);
|
|
const items = [ChannelStore];
|
|
stateFromStores = channelId(stateFromStores[19]).useStateFromStores(items, () => ChannelStore.getChannel(channelId));
|
|
let obj = channelId(stateFromStores[19]);
|
|
const tmp = channelId;
|
|
const tmp2 = stateFromStores;
|
|
const items1 = [GuildStore];
|
|
const stateFromStores1 = channelId(stateFromStores[19]).useStateFromStores(items1, () => {
|
|
let guild_id;
|
|
if (stateFromStores != null) {
|
|
guild_id = stateFromStores.guild_id;
|
|
}
|
|
if (guild_id == null) {
|
|
guild_id = guildId;
|
|
}
|
|
return GuildStore.getGuild(guild_id);
|
|
});
|
|
let id;
|
|
if (stateFromStores1 != null) {
|
|
id = stateFromStores1.id;
|
|
}
|
|
if (id == null) {
|
|
id = guildId;
|
|
}
|
|
id1 = undefined;
|
|
if (stateFromStores != null) {
|
|
id1 = stateFromStores.id;
|
|
}
|
|
if (id1 == null) {
|
|
id1 = channelId;
|
|
}
|
|
let obj2 = channelId(stateFromStores[19]);
|
|
const items2 = [WebhooksStore];
|
|
const items3 = [id, id1];
|
|
const stateFromStoresArray = tmp(tmp2[19]).useStateFromStoresArray(items2, () => {
|
|
if (null != id) {
|
|
if (null != id1) {
|
|
let webhooksForChannel = WebhooksStore.getWebhooksForChannel(tmp, tmp2);
|
|
}
|
|
return webhooksForChannel;
|
|
}
|
|
if (null != id) {
|
|
webhooksForChannel = WebhooksStore.getWebhooksForGuild(tmp);
|
|
} else {
|
|
webhooksForChannel = closure_26;
|
|
}
|
|
});
|
|
const effect = id1.useEffect(() => {
|
|
if (null != id) {
|
|
if (null != id1) {
|
|
const forChannel = WebhooksActionCreatorsDefault.fetchForChannel(tmp, tmp2);
|
|
}
|
|
}
|
|
if (null != id) {
|
|
const forGuild = WebhooksActionCreatorsDefault.fetchForGuild(tmp);
|
|
}
|
|
}, items3);
|
|
let tmp9 = null;
|
|
if (null != stateFromStores1) {
|
|
const obj3 = { guild: stateFromStores1, channel: stateFromStores, webhooks: stateFromStoresArray, contentContainerStyle, webhookType };
|
|
tmp9 = closure_18(WebhooksOverview, obj3);
|
|
}
|
|
return tmp9;
|
|
};
|