Files
discord-decomp/sources/stores/CreateInviteModalStore.tsx
T
2026-07-28 01:06:53 +03:00

191 lines
10 KiB
TypeScript

/* Metro module 9152; source: stores/CreateInviteModalStore.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 1867, 8880, 661, 9153, 9155, 44, 566, 694, 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 Module00044 from '../by-id/module-00044.js'; /* Metro dependency 44 */
import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import ChannelStore from './ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from './GuildStore.tsx'; /* Metro dependency 1867 */
import InstantInviteStore from './InstantInviteStore.tsx'; /* Metro dependency 8880 */
import InstantInviteUtils from '../utils/InstantInviteUtils.tsx'; /* Metro dependency 9153 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
function _fun71695(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9337:6, offset: 0x01d2a4b3, size: 508 bytes, params: 8, frame: 19
const env0_0 = require;
const init_71701 = function(a0) {
env0_12 = a0.guildId;
var value2 = null;
env0_13 = value2;
var property = a0.targetType;
var r5 = value2 != property ? property : value2;
property = a0.targetUserId;
var r4 = value2 != property ? property : value2;
property = a0.targetApplicationId;
updateWithLatestInvite(a0.channelId, {targetType: r5, targetUserId: r4,
targetApplicationId: value2 != property ? property : value2});
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const FormStates = (ConstantsModule).FormStates;
const INVITE_OPTIONS_UNLIMITED = (InstantInviteUtils).INVITE_OPTIONS_UNLIMITED;
let value = INVITE_OPTIONS_UNLIMITED.value;
let env0_19 = FormStates.CLOSED;
const Store = (Flux).Store;
_fun71702(Store).displayName = 'CreateInviteModalStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{CREATE_INVITE_MODAL_INIT: function(a0) {
init_71701(a0);
}, CREATE_INVITE_MODAL_OPEN: function(a0) {
env0_19 = FormStates.OPEN;
var onClose = a0.onClose;
var value2 = undefined;
env0_17 = onClose ?? value2;
init_71701(a0);
return value2;
}, CREATE_INVITE_MODAL_UPDATE_SETTINGS: CREATE_INVITE_MODAL_UPDATE_SETTINGS,
CREATE_INVITE_MODAL_RESET_SETTINGS: CREATE_INVITE_MODAL_RESET_SETTINGS,
CREATE_INVITE_MODAL_GENERATE_INVITE: CREATE_INVITE_MODAL_GENERATE_INVITE,
CREATE_INVITE_MODAL_GENERATE_INVITE_SUCCESS: CREATE_INVITE_MODAL_GENERATE_INVITE_SUCCESS,
CREATE_INVITE_MODAL_GENERATE_INVITE_FAILURE: function(a0) {
env0_14 = null;
env0_20 = false;
env0_13 = a0.message;
}, CREATE_INVITE_MODAL_CLOSE: function() {
env0_19 = FormStates.CLOSED;
env0_17 = undefined;
}});
(FileImportTrackerModule).fileFinishedImporting('stores/CreateInviteModalStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_71696() { // fn#71696, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9337:201, offset: 0x01d2a6af, 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_71696_isNativeReflectConstruct = function() {
return !!result;
})();
}
function updateWithLatestInvite(a0, {targetType, targetUserId, targetApplicationId}) { // fn#71699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9337:467, offset: 0x01d2a711, size: 343 bytes, params: 3, frame: 21
const defaultInviteExpiration = (require(9155) /* metro dependency 9155: DefaultInviteExpirationExperiments */).getDefaultInviteExpiration({guild: GuildStore.getGuild(ChannelStore.getChannel(a0)?.guild_id)});
const invite = InstantInviteStore.getInvite(a0, {targetType: targetType, targetUserId: targetUserId,
targetApplicationId: targetApplicationId});
invite2 = invite;
object = {channelId: a0};
object.maxAge = invite == null ? defaultInviteExpiration : invite2.maxAge;
object.maxUses = invite2 != null ? invite2.maxUses : value;
object.temporary = invite2 != null && invite2.temporary;
object.flags = invite2 != null ? invite2.flags : 0;
object.targetType = targetType;
object.targetUserId = targetUserId;
object.targetApplicationId = targetApplicationId;
const binding = invite2;
let r3 = binding == null || binding.roles == null ? undefined : binding.roles.map(function(a0) {
return a0.id;
});
r3 = r3 ?? [];
object.roleIds = r3;
}
function _fun71702(a0) { // fn#71702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9337:1247, offset: 0x01d2a8d7, size: 322 bytes, params: 2, frame: 16
const CreateInviteModalStore2 = CreateInviteModalStore;
Inherits(CreateInviteModalStore2, a0);
return CreateClass(CreateInviteModalStore2, [{key: 'initialize', value: function() {
this.waitFor(ChannelStore, GuildStore, InstantInviteStore);
}}, {key: 'init', value: function() {
this.waitFor(InstantInviteStore);
}}, {key: 'isOpen', value: function() {
return CLOSED !== FormStates.CLOSED;
}}, {key: 'isSubmitting', value: value_71707}, {key: 'getGuildId', value: value_71708}, {key: 'getError',
value: value_71709}, {key: 'getInvite', value: value_71710}, {key: 'getInviteSettings', value: value_71711},
{key: 'getPendingSettings', value: value_71712}, {key: 'getProps', value: function() {
return {};
}}, {key: 'onClose', get: get_71714}]);
function CreateInviteModalStore() { // fn#71703, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9337:1259, offset: 0x010e3a31, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, CreateInviteModalStore);
const value3 = env1_6(CreateInviteModalStore);
return env1_5(this, _isNativeReflectConstruct_71696() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
function value_71707() { // fn#71707, offset: 0x00e4253a, size: 9 bytes, params: 1, frame: 1
return env1_20;
}
function value_71708() { // fn#71708, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1
return env1_12;
}
function value_71709() { // fn#71709, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1
return env1_13;
}
function value_71710() { // fn#71710, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
return env1_14;
}
function value_71711() { // fn#71711, offset: 0x00df0e8b, size: 9 bytes, params: 1, frame: 1
return env1_15;
}
function value_71712() { // fn#71712, offset: 0x00df0e94, size: 9 bytes, params: 1, frame: 1
return env1_16;
}
function get_71714() { // fn#71714, offset: 0x00e07553, size: 9 bytes, params: 1, frame: 1
return env1_17;
}
}
function CREATE_INVITE_MODAL_UPDATE_SETTINGS({settings}) { // fn#71717, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9337:2376, offset: 0x01d2aa7c, size: 53 bytes, params: 2, frame: 13
var object;
const binding = env0_16;
if (binding != null) {
object = {};
copyDataProperties(object, settings, copyDataProperties(object, env0_16, binding));
}
}
function CREATE_INVITE_MODAL_RESET_SETTINGS() { // fn#71718, offset: 0x01d2aab1, size: 15 bytes, params: 1, frame: 2
}
function CREATE_INVITE_MODAL_GENERATE_INVITE() { // fn#71719, offset: 0x01d2aac0, size: 21 bytes, params: 1, frame: 2
}
function CREATE_INVITE_MODAL_GENERATE_INVITE_SUCCESS({channelId}) { // fn#71720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9337:2639, offset: 0x01d2aad5, size: 116 bytes, params: 2, frame: 15
(Module00044)(env0_15 != null, 'No invite settings for generated invite');
const binding = env0_15;
updateWithLatestInvite(channelId, {targetType: binding.targetType, targetUserId: binding.targetUserId,
targetApplicationId: binding.targetApplicationId});
}
}
global.__d(_fun71695, 9152, [6, 7, 15, 17, 18, 1379, 1867, 8880, 661, 9153, 9155, 44, 566, 694,
2]) /* metro module 9152, dependencies: [6, 7, 15, 17, 18, 1379, 1867, 8880, 661, 9153, 9155, 44, 566, 694, 2] */;