/* Metro module 15210; source: modules/integration_settings/native/IntegrationsSettingsEditWebhook.tsx; dependencies: [6, 7, 15, 17, 18, 31, 1935, 3784, 3793, 1878, 661, 33, 4501, 697, 15205, 11265, 507, 6797, 4496, 1244, 4596, 5282, 5277, 4573, 7972, 4572, 15211, 1423, 7981, 6231, 6238, 4805, 1305, 6647, 3868, 1484, 5462, 2] */ import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../../../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */ import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import PermissionStore from '../../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */ import RelationshipStore from '../../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */ import AlertActionCreators from '../../../actions/native/AlertActionCreators.tsx'; /* Metro dependency 4496 */ import Alert from '../../../components_native/common/Alert.tsx'; /* Metro dependency 4596 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ 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 NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */ import * as UseNavigationNativeModule from '../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */ import * as GuildChannelStoreModule from '../../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */ import * as NativeModule2 from '../../../external/discord_common/js/packages/design/native.tsx'; /* Metro dependency 3868 */ import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */ import * as StackNativeModule from '../../../design/components/Stack/native/Stack.native.tsx'; /* Metro dependency 4572 */ import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */ import * as UseChannelNameModule from '../../channel/useChannelName.tsx'; /* Metro dependency 4805 */ import * as HeaderActionButtonNativeModule from '../../../design/components/Navigator/native/HeaderActionButton.native.tsx'; /* Metro dependency 5277 */ import * as NavigatorHeaderNativeModule from '../../../design/components/Navigator/native/NavigatorHeader.native.tsx'; /* Metro dependency 5282 */ import * as NavScrimAndroidModule from '../../../design/components/Navigator/native/NavScrim.android.tsx'; /* Metro dependency 5462 */ import * as TableRowGroupNativeModule from '../../../design/components/TableRow/native/TableRowGroup.native.tsx'; /* Metro dependency 6231 */ import * as TableRowNativeModule from '../../../design/components/TableRow/native/TableRow.native.tsx'; /* Metro dependency 6238 */ import * as NativeModule3 from '../../../design/void/Form/native/index.tsx'; /* Metro dependency 7972 */ import * as TextInputNativeModule from '../../../design/components/TextInput/native/TextInput.native.tsx'; /* Metro dependency 7981 */ function _fun116316(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#116316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:6, offset: 0x0248476b, size: 536 bytes, params: 8, frame: 23 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ReactModule; const createLegacyClassComponentStyles = CreateStylesModule.createLegacyClassComponentStyles; object = {}; const BACKGROUND_BASE_LOWER = (Native).colors.BACKGROUND_BASE_LOWER; object.form = {backgroundColor: BACKGROUND_BASE_LOWER}; const TABLE_ROW_PADDING = (Native).modules.mobile.TABLE_ROW_PADDING; object.row = {padding: TABLE_ROW_PADDING}; object.channelIcon = {'height': 16, 'width': 16, 'opacity': 0.6}; const env0_19 = Reflect.apply(createLegacyClassComponentStyles, CreateStylesModule, [object]); const PureComponent = value.PureComponent; value = _fun116320(PureComponent); const ThemeContext = (NativeModule2).ThemeContext; value.contextType = ThemeContext; (FileImportTrackerModule).fileFinishedImporting('modules/integration_settings/native/IntegrationsSettingsEditWebhook.tsx'); exports.default = ConnectedEditWebhook; function _isNativeReflectConstruct_116317() { // fn#116317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:358, offset: 0x02484983, 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_116317_isNativeReflectConstruct = function() { return !!result; })(); } function _fun116320(a0) { // fn#116320, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:765, offset: 0x024849e5, size: 97 bytes, params: 2, frame: 16 const EditWebhook2 = EditWebhook; Inherits(EditWebhook2, a0); return CreateClass(EditWebhook2, [{key: 'componentDidUpdate', value: value_116337}, {key: 'render', value: value_116342}]); function EditWebhook(a0) { // fn#116321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:777, offset: 0x02484a46, size: 301 bytes, params: 2, frame: 20 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_3; binding(this, EditWebhook); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_6(EditWebhook); binding = env1_5; if (_isNativeReflectConstruct_116317()) { Reflect = global.Reflect; value = Reflect.construct(value, items2, env1_6(this).constructor); r0 = value; } else { value = value.apply(this, items2); r0 = value; } value = binding(this, r0); value.state = {'avatar': null, 'name': null, 'channel': null, 'hasChanges': false, 'submitting': false, 'copied': false, avatar: value.props.avatar, name: value.props.name, channel: value.props.channel}; value.handleSave = handleSave_116322; value.handleGuildIconUpload = handleGuildIconUpload; value.handleNameChange = handleNameChange; value.handleChannelChange = handleChannelChange; value.handleCopyUrl = handleCopyUrl; value.handleConfirmDeleteWebhook = handleConfirmDeleteWebhook; value.handleDeleteWebhook = handleDeleteWebhook; value.handleCancelChanges = handleCancelChanges; return value; function EditWebhookHandleSave() { // fn#116322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:1121, owner: EditWebhook.handleSave, offset: 0x02484b73, size: 194 bytes, params: 1, frame: 18 var environment; var binding; var avatar; var name; var channel; var props; var guildId; var webhookId; var navigation; var object; var value; let state = env0_0.state; if (state.hasChanges) { binding = env0_0; state = binding.state; avatar = state.avatar; name = state.name; channel = state.channel; props = binding.props; guildId = props.guildId; webhookId = props.webhookId; navigation = props.navigation; object = {name: name}; object.channel_id = channel.id; object.avatar = avatar; binding.setState({submitting: true}); value = environment.__proto__.__proto__; value = importDefault(15205) /* metro dependency 15205: WebhooksActionCreators */; value = value.update(guildId, webhookId, object); value = value.then(function() { navigation.pop(); }); value.catch(_fun116324); } function _fun116324({body}) { // fn#116324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:1362, offset: 0x02484c4a, size: 44 bytes, params: 2, frame: 12 const binding = env1_0; binding.setState({errors: body, submitting: false}); } } function handleGuildIconUpload(a0) { // fn#116325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:1441, owner: EditWebhook.handleGuildIconUpload, offset: 0x02484c76, size: 89 bytes, params: 2, frame: 15 var binding; const avatar = env0_0.props.avatar; if (a0 !== avatar) { env0_0.setState({hasChanges: true, avatar: a0}); } else { binding = env0_0; binding.setState({hasChanges: false, avatar: avatar}); } } function handleNameChange(a0) { // fn#116326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:1566, owner: EditWebhook.handleNameChange, offset: 0x02484ccf, size: 86 bytes, params: 2, frame: 15 var binding; const name = env0_0.props.name; if (a0 !== name) { env0_0.setState({hasChanges: true, name: a0}); } else { binding = env0_0; binding.setState({hasChanges: false, name: name}); } } function handleChannelChange() { // fn#116327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:1688, owner: EditWebhook.handleChannelChange, offset: 0x02484d25, size: 109 bytes, params: 1, frame: 15 const binding = env0_0; (importDefault(11265) /* metro dependency 11265: openChannelPicker */)({guildId: binding.props.guildId, channelType: GUILD_SELECTABLE_CHANNELS_KEY, filterFn: function({channel}) { return PermissionStore.can(Permissions.MANAGE_WEBHOOKS, channel); }, selectedChannel: binding.props.channel, onSelect: onSelect_116329}); function handleChannelChangeOnSelect(a0) { // fn#116329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:1841, owner: EditWebhook.handleChannelChange.onSelect, offset: 0x02484db9, size: 96 bytes, params: 2, frame: 14 var value2; if (a0.id !== channel.id) { value = environment.__proto__; env1_0.setState({hasChanges: true, channel: a0}); } else { value2 = environment.__proto__; env1_0.setState({hasChanges: false, channel: channel}); } } } function handleCopyUrl() { // fn#116330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:1953, owner: EditWebhook.handleCopyUrl, offset: 0x02484e19, size: 144 bytes, params: 1, frame: 18 var environment; var aPIBaseURL; var value; const props = env0_0.props; const token = props.token; if (token != null) { value = environment.__proto__.__proto__; aPIBaseURL = (require(507) /* metro dependency 507: HTTPUtils */).getAPIBaseURL(false); value = Endpoints.WEBHOOK_INTEGRATION(props.webhookId, token); value = '' + aPIBaseURL + value; (require(6797) /* metro dependency 6797: ClipboardUtilsNative */).copy(value, _fun116331); } function _fun116331() { // fn#116331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:2092, offset: 0x02484ea9, size: 29 bytes, params: 1, frame: 12 return env1_0.setState({copied: true}); } } function handleConfirmDeleteWebhook() { // fn#116332, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:2153, owner: EditWebhook.handleConfirmDeleteWebhook, offset: 0x02484ec6, size: 108 bytes, params: 1, frame: 15 var environment; const props = navigation.props; const guildId = props.guildId; const webhookId = props.webhookId; var navigation = props.navigation; let value = environment.__proto__.__proto__; value = importDefault(15205) /* metro dependency 15205: WebhooksActionCreators */; value = value.delete(guildId, webhookId); value = value.then(function() { navigation.pop(); }); value.catch(_fun116334); function _fun116334() { // fn#116334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:2263, offset: 0x02484f32, size: 147 bytes, params: 1, frame: 18 const defaultImport = AlertActionCreators; const show = defaultImport.show; const object = {}; const intl = (IndexNativeModule).intl; const string = intl.string; const t = (IndexNativeModule).t; const N5riYn = t.N5riYn; object.title = Reflect.apply(string, intl, [N5riYn]); object.body = intl.string(t['/4TwKf']); Reflect.apply(show, defaultImport, [object]); } } function handleDeleteWebhook() { // fn#116335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:2405, owner: EditWebhook.handleDeleteWebhook, offset: 0x02484fc5, size: 316 bytes, params: 1, frame: 24 const binding = env0_0; const name = binding.props.name; const defaultImport = AlertActionCreators; const show = defaultImport.show; const object = {}; const intl = (IndexNativeModule).intl; const formatToPlainString = intl.formatToPlainString; const t = (IndexNativeModule).t; const QVFjHh = t.QVFjHh; object.title = Reflect.apply(formatToPlainString, intl, [QVFjHh, {name: name}]); object.body = intl.format(t['rIWe+5'], {name: name}); object.cancelText = intl.string(t.gm1Vej); object.confirmText = intl.string(t.p89ACt); object.onConfirm = binding.handleConfirmDeleteWebhook; const Colors = (Alert).Colors; const RED = Colors.RED; object.confirmColor = RED; Reflect.apply(show, defaultImport, [object]); } function handleCancelChanges() { // fn#116336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:2769, owner: EditWebhook.handleCancelChanges, offset: 0x02485101, size: 81 bytes, params: 1, frame: 12 const binding = env0_0; binding.setState({'avatar': null, 'name': null, 'channel': null, 'hasChanges': false, 'submitting': false, 'copied': false, avatar: binding.props.avatar, name: binding.props.name, channel: binding.props.channel}); } } function value_116337(a0, a1) { // fn#116337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:2964, offset: 0x02485152, size: 157 bytes, params: 3, frame: 14 var setOptions; var object; const navigation = this.props.navigation; const {submitting, hasChanges} = this.state; if (submitting !== true) { setOptions = navigation.setOptions; object = {}; if (hasChanges) { object.headerRight = headerRight_116338; object.headerLeft = headerLeft_116339; Reflect.apply(setOptions, navigation, [object]); } else { object.headerRight = undefined; object.headerLeft = undefined; Reflect.apply(setOptions, navigation, [object]); } } else if (a1.submitting) { setOptions = navigation.setOptions; object = {}; if (hasChanges) { object.headerRight = headerRight_116338; object.headerLeft = headerLeft_116339; Reflect.apply(setOptions, navigation, [object]); } else { object.headerRight = undefined; object.headerLeft = undefined; Reflect.apply(setOptions, navigation, [object]); } } else { navigation.setOptions({headerRight: headerRight_116340, headerLeft: function() { return null; }}); } function value_116337HeaderRight() { // fn#116338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:3098, owner: value_116337.headerRight, offset: 0x024851ef, size: 113 bytes, params: 1, frame: 18 const HeaderActionButton = (HeaderActionButtonNativeModule).HeaderActionButton; const handleSave = env0_0.handleSave; const intl = (IndexNativeModule).intl; return ( ); } function value_116337HeaderLeft() { // fn#116339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:3218, owner: value_116337.headerLeft, offset: 0x02485260, size: 113 bytes, params: 1, frame: 18 const HeaderActionButton = (HeaderActionButtonNativeModule).HeaderActionButton; const handleCancelChanges = env0_0.handleCancelChanges; const intl = (IndexNativeModule).intl; return ( ); } function value_116337HeaderRight_116340() { // fn#116340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:3417, owner: value_116337.headerRight, offset: 0x024852d1, size: 45 bytes, params: 1, frame: 13 const HeaderSubmittingIndicator = (NavigatorHeaderNativeModule).HeaderSubmittingIndicator; return ; } } function value_116342() { // fn#116342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:3506, offset: 0x024852fe, size: 1321 bytes, params: 1, frame: 42 var r8; var IconLabelBlock; var object; const binding = env1_19; const context = this.context; const value2 = undefined; const value3 = binding(context); const {webhookId, webhookType, token} = this.props; const {avatar, name, channel, copied, errors} = this.state; const Text = (TextModule).Text; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; let string = intl.string; const t = (require(1244) /* metro dependency 1244: indexNative */).t; const text = ( {copied ? Reflect.apply(string, intl, [t.t5VZ88]) : Reflect.apply(string, intl, [t.OpuAlK])} ); const Form = (NativeModule3).Form; const form = value3.form; const items3 = [{paddingTop: 16}]; items3[1] = this.props.contentContainerStyle; const Stack = (StackNativeModule).Stack; const PX_24 = (Native).space.PX_24; const object3 = {}; object3.paddingHorizontal = value3.row.padding; const CHANNEL_FOLLOWER = WebhookTypes.CHANNEL_FOLLOWER; const value7 = null; if (webhookType === CHANNEL_FOLLOWER) { r8 = value7; } else { IconLabelBlock = importDefault(15211) /* metro dependency 15211: IconLabelBlock */; r8 = ( ); } const items2 = [r8]; const TextInput = (TextInputNativeModule).TextInput; items2[1] = ( ); const TableRowGroup = (TableRowGroupNativeModule).TableRowGroup; string = intl.string; const GK18KJ = (require(1244) /* metro dependency 1244: indexNative */).t.GK18KJ; const TableRow = (TableRowNativeModule).TableRow; const computeChannelName = UseChannelNameModule.computeChannelName; const userStoreBinding = UserStore; const relationshipStoreBinding = RelationshipStore; const handleChannelChange = this.handleChannelChange; const Icon = (NativeModule).Icon; const Icon2 = (NativeModule).Icon; const Sizes = Icon2.Sizes; const CUSTOM = Sizes.CUSTOM; items2[2] = ( } /> ); items2[3] = ( value7 != token ? ( ) : value7 ); items2[4] = ( ); return (
{items2}
); } } function ConnectedEditWebhook(a0) { // fn#116344, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15407:5341, offset: 0x0248586b, size: 126 bytes, params: 2, frame: 19 const value2 = (UseNavigationNativeModule).useNavigation(); const jsxRuntimeEnv0_18Binding = jsxRuntimeEnv0_18; const env0_203 = ((Component) => )(env0_20); const NavScrim = (NavScrimAndroidModule).NavScrim; return ( <> {env0_203} ); } } global.__d(_fun116316, 15210, [6, 7, 15, 17, 18, 31, 1935, 3784, 3793, 1878, 661, 33, 4501, 697, 15205, 11265, 507, 6797, 4496, 1244, 4596, 5282, 5277, 4573, 7972, 4572, 15211, 1423, 7981, 6231, 6238, 4805, 1305, 6647, 3868, 1484, 5462, 2]) /* metro module 15210, dependencies: [6, 7, 15, 17, 18, 31, 1935, 3784, 3793, 1878, 661, 33, 4501, 697, 15205, 11265, 507, 6797, 4496, 1244, 4596, 5282, 5277, 4573, 7972, 4572, 15211, 1423, 7981, 6231, 6238, 4805, 1305, 6647, 3868, 1484, 5462, 2] */;