Files
discord-decomp/sources/modules/integration_settings/native/IntegrationsSettingsWebhooksOverview.tsx
T
2026-07-27 16:20:00 +03:00

305 lines
16 KiB
TypeScript

/* Metro module 15203; source: modules/integration_settings/native/IntegrationsSettingsWebhooksOverview.tsx; dependencies: [6, 7, 15, 17, 18, 31, 27, 1379, 1867, 1878, 15204, 661, 33, 4501, 697, 1484, 1423, 6238, 1305, 1244, 21, 3995, 566, 1948, 4573, 15206, 6231, 7972, 4572, 5462, 3868, 15205, 2] */
function _fun116252(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#116252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:6, offset: 0x02482d6f, size: 590 bytes, params: 8, frame: 23
var object2;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
let value = importAll(31) /* metro dependency 31 */;
(require(27) /* metro dependency 27 */).Platform;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const webhooksStore = importDefault(15204) /* metro dependency 15204: WebhooksStore */;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_13 = constantsModule.HelpdeskArticles;
const env0_14 = constantsModule.ChannelSettingsSections;
const env0_15 = constantsModule.NON_USER_BOT_DISCRIMINATOR;
const env0_16 = constantsModule.WebhookTypes;
const value3 = require(33) /* metro dependency 33 */;
const env0_17 = value3.jsx;
const env0_18 = value3.Fragment;
const env0_19 = value3.jsxs;
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createLegacyClassComponentStyles = createStylesModule.createLegacyClassComponentStyles;
object2 = {};
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object2.form = {backgroundColor: BACKGROUND_BASE_LOWER, paddingTop: 16};
object2.hint = {'paddingHorizontal': 16, 'marginBottom': 16};
const TABLE_ROW_PADDING = (importDefault(697) /* metro dependency 697: native */).modules.mobile.TABLE_ROW_PADDING;
object2.row = {padding: TABLE_ROW_PADDING};
const env0_20 = Reflect.apply(createLegacyClassComponentStyles, createStylesModule, [object2]);
const PureComponent = value.PureComponent;
value = _fun116262(PureComponent);
const ThemeContext = (require(3868) /* metro dependency 3868: native */).ThemeContext;
value.contextType = ThemeContext;
const env0_22 = [];
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/integration_settings/native/IntegrationsSettingsWebhooksOverview.tsx');
exports.default = ConnectedWebhooksOverview;
}
function _isNativeReflectConstruct_116253() { // fn#116253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:367, offset: 0x02482fbd, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_116253_isNativeReflectConstruct = function() {
return !!result;
})();
}
function WebhookItem({avatar, channel, guildId, name, token, user, webhookId, webhookType}) { // fn#116256, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:786, offset: 0x0248301f, size: 517 bytes, params: 2, frame: 27
var object6;
var r5;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var formatToPlainString;
var property;
var object2;
var object5;
var value;
const value3 = env0_8.useCallback(_fun116257, [webhookId, webhookType, avatar, channel, guildId, name, token,
(require(1484) /* metro dependency 1484: useNavigationNative */).useNavigation()]);
const value4 = env0_8.useMemo(function() {
return require(dependencyMap[16]).makeSource(require(dependencyMap[16]).getUserAvatarURL({id: webhookId,
avatar: avatar, discriminator: NON_USER_BOT_DISCRIMINATOR}));
}, [webhookId, avatar]);
const TableRow = (require(6238) /* metro dependency 6238: TableRowNative */).TableRow;
object6 = {};
const Avatar = (require(1305) /* metro dependency 1305: native */).Avatar;
object6.icon = <Avatar source={value4} />;
object6.arrow = true;
object6.label = name;
if (user != null) {
formatToPlainString = intl.formatToPlainString;
property = (require(1244) /* metro dependency 1244: indexNative */).t['7EcUbr'];
object5 = {};
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
object5.timestamp = value.extractTimestamp(webhookId);
value = importDefault(3995) /* metro dependency 3995: UserUtils */;
object5.user = value.getUserTag(user);
value = Reflect.apply(formatToPlainString, intl, [property, object5]);
r5 = value;
} else {
formatToPlainString = intl.formatToPlainString;
property = (require(1244) /* metro dependency 1244: indexNative */).t['7mv59O'];
object2 = {};
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
object2.timestamp = value.extractTimestamp(webhookId);
value = Reflect.apply(formatToPlainString, intl, [property, object2]);
r5 = value;
}
object6.subLabel = r5;
object6.onPress = value3;
return <TableRow {...object6} />;
}
function ConnectedWebhookItem(a0) { // fn#116259, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:1492, offset: 0x024832de, size: 190 bytes, params: 2, frame: 21
const env0_0 = a0.channelId;
let user = a0.user;
const value = Object.create(null);
value.channelId = 0;
value.user = 0;
const value2 = copyDataProperties({}, a0, value, undefined);
user = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], function() {
return UserStore.getUser(user?.id);
});
return (
<WebhookItem
{...value2}
{...{['user']: user}}
{...{['channel']: (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore],
function() {
return ChannelStore.getChannel(channelId);
})}}
/>
);
}
function _fun116262(a0) { // fn#116262, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:1734, offset: 0x024833cb, size: 126 bytes, params: 2, frame: 16
const closure = WebhooksOverview;
env0_7(closure, a0);
return env0_4(closure, [{key: 'getHelpText', value: value_116264}, {key: 'renderWebhooks', value: value_116265},
{key: 'render', value: value_116268}]);
}
function ConnectedWebhooksOverview({channelId, guildId, contentContainerStyle, webhookType}) { // fn#116269, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:3596, offset: 0x024838af, size: 325 bytes, params: 2, frame: 23
const channel = (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore], function() {
return ChannelStore.getChannel(channelId);
});
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
var r0;
var getGuild = GuildStore.getGuild;
r0 = channel?.guild_id;
r0 = r0 ?? guildId;
return Reflect.apply(getGuild, GuildStore, [r0]);
});
const r13 = guild?.id ?? guildId;
const r12 = channel?.id ?? channelId;
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([WebhooksStore], _fun116272);
env0_8.useEffect(_fun116273, [r13, r12]);
return guild != null ? ((Component) => <Component guild={guild} channel={channel} webhooks={value4} contentContainerStyle={contentContainerStyle} webhookType={webhookType} />)(env0_21) : null;
}
function _fun116257() { // fn#116257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:935, offset: 0x02483224, size: 97 bytes, params: 1, frame: 15
const binding = env0_7;
const push = binding.push;
const EDIT_WEBHOOK = ChannelSettingsSections.EDIT_WEBHOOK;
Reflect.apply(push, binding, [EDIT_WEBHOOK, {webhookId: webhookId, webhookType: webhookType, avatar: avatar,
name: name, channel: channel, guildId: guildId, token: token}]);
}
function value_116264() { // fn#116264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:2045, offset: 0x02483449, size: 243 bytes, params: 1, frame: 19
var r0;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var format;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var property;
var defaultImport;
var defaultImport2;
const webhookType = this.props.webhookType;
const value = environment.__proto__;
const CHANNEL_FOLLOWER = WebhookTypes.CHANNEL_FOLLOWER;
if (webhookType === CHANNEL_FOLLOWER) {
format = intl.format;
property = t['5u+aV1'];
defaultImport2 = importDefault(1948) /* metro dependency 1948: HelpdeskUtils */;
r0 = Reflect.apply(format, intl, [property,
{helpdeskArticle: defaultImport2.getArticleURL(HelpdeskArticles.CHANNEL_FOLLOWING)}]);
} else {
format = intl.format;
property = t['3hX7G+'];
defaultImport = importDefault(1948) /* metro dependency 1948: HelpdeskUtils */;
r0 = Reflect.apply(format, intl, [property,
{articleURL: defaultImport.getArticleURL(HelpdeskArticles.WEBHOOKS_INTRODUCTION)}]);
}
return r0;
}
function value_116265() { // fn#116265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:2346, offset: 0x0248353c, size: 511 bytes, params: 1, frame: 26
var environment;
var r9;
var r0;
var value2;
var value3;
var jsxRuntimeEnv1_18Binding;
var value4;
var items2;
var EmptyState;
var CHANNEL_FOLLOWER;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const {webhooks, webhookType} = this.props;
const r6 = webhookType == null ? webhooks : webhooks.filter(function({type}) {
return type === webhookType;
});
let value = this.getHelpText();
if (r6.length === 0) {
value3 = environment.__proto__;
jsxRuntimeEnv1_18Binding = jsxRuntimeEnv1_18;
value4 = undefined;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
value = <Text variant="text-sm/medium" color="text-muted">{value}</Text>;
items2 = [value];
EmptyState = (require(1305) /* metro dependency 1305: native */).EmptyState;
var emptyStateProps = {Illustration: (require(15206) /* metro dependency 15206: WebhookEmpty */).WebhookEmpty};
CHANNEL_FOLLOWER = WebhookTypes.CHANNEL_FOLLOWER;
r9 = webhookType === CHANNEL_FOLLOWER ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.dkHRkE) : intl.string((require(1244) /* metro dependency 1244: indexNative */).t['4JAVI+']);
emptyStateProps.title = r9;
CHANNEL_FOLLOWER = WebhookTypes.CHANNEL_FOLLOWER;
r9 = webhookType === CHANNEL_FOLLOWER ? value4 : intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Gg3fUf);
emptyStateProps.body = r9;
items2[1] = <EmptyState {...emptyStateProps} />;
value = <>{items2}</>;
r0 = value;
} else {
value2 = environment.__proto__;
const TableRowGroup = (require(6231) /* metro dependency 6231: TableRowGroupNative */).TableRowGroup;
value = <TableRowGroup description={value} hasIcons>{r6.map(_fun116267)}</TableRowGroup>;
r0 = value;
}
return r0;
}
function value_116268() { // fn#116268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:3109, offset: 0x024837b2, size: 253 bytes, params: 1, frame: 26
const value2 = env1_20(this.context);
const jsxRuntimeEnv1_18Binding = jsxRuntimeEnv1_18;
const Form = (require(7972) /* metro dependency 7972: native */).Form;
const form = value2.form;
const contentContainerStyle = this.props.contentContainerStyle;
const Stack = (require(4572) /* metro dependency 4572: StackNative */).Stack;
const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
const form2 = <Form style={form} contentContainerStyle={contentContainerStyle}><Stack spacing={PX_24} style={{paddingHorizontal: value2.row.padding}}>{this.renderWebhooks()}</Stack></Form>;
const NavScrim = (require(5462) /* metro dependency 5462: NavScrimAndroid */).NavScrim;
return (
<>
{form2}
<NavScrim />
</>
);
}
function _fun116272() { // fn#116272, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:3979, offset: 0x02483a2b, size: 95 bytes, params: 1, frame: 14
return env0_3 == null ? env0_3 != null ? WebhooksStore.getWebhooksForGuild(env0_3) : env1_22 : env0_4 != null ? WebhooksStore.getWebhooksForChannel(env0_3,
env0_4) : env0_3 != null ? WebhooksStore.getWebhooksForGuild(env0_3) : env1_22;
}
function _fun116273() { // fn#116273, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:4086, offset: 0x02483a8a, size: 120 bytes, params: 1, frame: 13
var value2;
var value3;
var defaultImport2;
if (env0_3 == null) {
if (env0_3 != null) {
value2 = environment.__proto__;
(importDefault(15205) /* metro dependency 15205: WebhooksActionCreators */).fetchForGuild(env0_3);
}
} else if (env0_4 != null) {
value3 = environment.__proto__;
defaultImport2 = importDefault(15205) /* metro dependency 15205: WebhooksActionCreators */;
defaultImport2.fetchForChannel(env0_3, env0_4);
} else if (env0_3 != null) {
value2 = environment.__proto__;
(importDefault(15205) /* metro dependency 15205: WebhooksActionCreators */).fetchForGuild(env0_3);
}
}
function _fun116267({id, type, avatar, name, user, token, guild_id, channel_id}) { // fn#116267, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15400:2889, offset: 0x0248373b, size: 119 bytes, params: 2, frame: 23
const value = environment.__proto__.__proto__;
return (
<ConnectedWebhookItem
webhookId={id}
webhookType={type}
avatar={avatar ?? undefined}
name={name}
user={user}
channelId={channel_id}
token={token}
guildId={guild_id}
key={id}
/>
);
}