Files
discord-decomp/sources/actions/CreateInviteModalActionCreators.tsx
2026-07-28 01:06:53 +03:00

129 lines
7.4 KiB
TypeScript

/* Metro module 9158; source: actions/CreateInviteModalActionCreators.tsx; dependencies: [9152, 661, 694, 683, 8879, 1244, 2] */
import AnalyticsUtils from '../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import Dispatcher from '../Dispatcher.tsx'; /* Metro dependency 694 */
import CreateInviteModalStore from '../stores/CreateInviteModalStore.tsx'; /* Metro dependency 9152 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../intl/index.native.tsx'; /* Metro dependency 1244 */
function _fun71812(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71812, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:6, offset: 0x01d2da9c, size: 207 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {init: init_71813, openSettings: openSettings, updateSettings: updateSettings,
resetSettings: resetSettings, createInvite: createInvite_71817, close: close_71820};
(FileImportTrackerModule).fileFinishedImporting('actions/CreateInviteModalActionCreators.tsx');
exports.default = object;
function init_71813(a0, a1, {location, targetType, targetUserId, targetApplicationId, skipCreateInvite}) { // fn#71813, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:136, offset: 0x01d2db6b, size: 138 bytes, params: 4, frame: 20
location = location === undefined ? '' : location;
Dispatcher.dispatch({type: 'CREATE_INVITE_MODAL_INIT', guildId: a0, channelId: a1, targetType: targetType,
targetUserId: targetUserId, targetApplicationId: targetApplicationId});
if (!skipCreateInvite) {
this.createInvite(location, true);
}
}
function openSettings(a0, a1, a2, a3) { // fn#71814, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:383, offset: 0x01d2dbf5, size: 156 bytes, params: 5, frame: 18
const inviteSettings = CreateInviteModalStore.getInviteSettings();
const defaultImport = Dispatcher;
const dispatch = defaultImport.dispatch;
const object = {type: 'CREATE_INVITE_MODAL_OPEN'};
copyDataProperties(object, inviteSettings, 'CREATE_INVITE_MODAL_OPEN');
object['guildId'] = a0;
object['channelId'] = a1;
object['onClose'] = a3;
Reflect.apply(dispatch, defaultImport, [object]);
const defaultImport2 = AnalyticsUtils;
const track = defaultImport2.track;
const OPEN_MODAL = AnalyticEvents.OPEN_MODAL;
Reflect.apply(track, defaultImport2, [OPEN_MODAL, {type: 'Instant Invite', source: a2}]);
}
function updateSettings(a0) { // fn#71815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:584, offset: 0x01d2dc91, size: 57 bytes, params: 2, frame: 13
(Dispatcher).dispatch({type: 'CREATE_INVITE_MODAL_UPDATE_SETTINGS',
settings: a0});
}
function resetSettings() { // fn#71816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:677, offset: 0x01d2dcca, size: 49 bytes, params: 1, frame: 13
(Dispatcher).dispatch({type: 'CREATE_INVITE_MODAL_RESET_SETTINGS'});
}
function createInvite_71817(a0, a1) { // fn#71817, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:756, offset: 0x01d2dcfb, size: 304 bytes, params: 3, frame: 26
var code;
var object;
var channelId;
var maxAge;
var maxUses;
var temporary;
var targetType;
var targetUserId;
var targetApplicationId;
var flags;
var roleIds;
var invite;
var createInvite;
var parseInt;
var value;
const pendingSettings = CreateInviteModalStore.getPendingSettings();
const value3 = null;
if (value3 != pendingSettings) {
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'CREATE_INVITE_MODAL_GENERATE_INVITE'});
channelId = pendingSettings.channelId;
maxAge = pendingSettings.maxAge;
maxUses = pendingSettings.maxUses;
temporary = pendingSettings.temporary;
targetType = pendingSettings.targetType;
targetUserId = pendingSettings.targetUserId;
targetApplicationId = pendingSettings.targetApplicationId;
flags = pendingSettings.flags;
roleIds = pendingSettings.roleIds;
invite = CreateInviteModalStore.getInvite();
code = a1 && value3 != invite ? invite.code : value3;
value = importDefault(8879) /* metro dependency 8879: InstantInviteActionCreators */;
createInvite = value.createInvite;
object = {temporary: temporary, validate: code};
parseInt = global.parseInt;
object.max_age = parseInt(maxAge, 10);
parseInt = global.parseInt;
object.max_uses = parseInt(maxUses, 10);
object.target_type = targetType;
object.target_user_id = targetUserId;
object.target_application_id = targetApplicationId;
object.flags = flags;
object.role_ids = roleIds;
value = Reflect.apply(createInvite, value, [channelId, object, a0]);
value.then(_fun71818, _fun71819);
}
function _fun71818() { // fn#71818, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:1230, offset: 0x01d2de2b, size: 60 bytes, params: 1, frame: 13
const value = environment.__proto__;
(Dispatcher).dispatch({type: 'CREATE_INVITE_MODAL_GENERATE_INVITE_SUCCESS',
channelId: channelId});
}
function _fun71819(a0) { // fn#71819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:1321, offset: 0x01d2de67, size: 138 bytes, params: 2, frame: 16
let value = environment.__proto__;
const value2 = undefined;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const WB1ip6 = (IndexNativeModule).t.WB1ip6;
const r4 = (a0 == null ? value2 : a0.message) == null ? Reflect.apply(string, intl, [WB1ip6]) : a0.message;
value = importDefault(694) /* metro dependency 694: Dispatcher */;
value.dispatch({type: 'CREATE_INVITE_MODAL_GENERATE_INVITE_FAILURE', message: r4});
return value2;
}
}
function close_71820() { // fn#71820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9343:1503, offset: 0x01d2def1, size: 67 bytes, params: 1, frame: 14
const onClose = CreateInviteModalStore.onClose;
(Dispatcher).dispatch({type: 'CREATE_INVITE_MODAL_CLOSE'});
if (onClose != null) {
onClose();
}
}
}
global.__d(_fun71812, 9158, [9152, 661, 694, 683, 8879, 1244,
2]) /* metro module 9158, dependencies: [9152, 661, 694, 683, 8879, 1244, 2] */;