decord/source/stores/CreateInviteModalStore.tsx

185 lines
5.9 KiB
TypeScript
Raw Normal View History

// Module ID: 9891
// Function ID: 9892
// Name: CreateInviteModalStore
// Dependencies: [1957, 1979, 8444, 1074, 9892, 9894, 38, 504, 573, 2]
2026-07-20 16:05:17 +00:00
// Module 9891 (CreateInviteModalStore)
2026-08-24 06:08:38 +00:00
import _modDef38 from "module_38" /* 38 */;
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import InstantInviteUtilsDefault from "InstantInviteUtils" /* 9892 */;
import DefaultInviteExpirationExperiments from "DefaultInviteExpirationExperiments" /* 9894 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import GuildStore from "GuildStore" /* 1979 */;
import InstantInviteStore from "InstantInviteStore" /* 8444 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function updateWithLatestInvite(channelId, arg1) {
({ targetType, targetUserId, targetApplicationId } = arg1);
const channel = ChannelStore.getChannel(channelId);
2026-07-20 16:05:17 +00:00
let guild_id;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
guild_id = channel.guild_id;
}
const guild = GuildStore.getGuild(guild_id);
let maxAge = DefaultInviteExpirationExperiments.getDefaultInviteExpiration({ guild });
const invite = InstantInviteStore.getInvite(channelId, { targetType, targetUserId, targetApplicationId });
_null = invite;
const obj2 = { channelId, maxAge: null, maxUses: null, temporary: null, flags: null, targetType: null, targetUserId: null, targetApplicationId: null, roleIds: null };
2026-07-29 08:29:29 +00:00
if (null != invite) {
maxAge = _null.maxAge;
2026-07-20 16:05:17 +00:00
}
obj2.maxAge = maxAge;
if (null != _null) {
let maxUses = _null.maxUses;
2026-07-20 16:05:17 +00:00
} else {
maxUses = value;
2026-07-20 16:05:17 +00:00
}
obj2.maxUses = maxUses;
let temporary = null != _null;
2026-07-20 16:05:17 +00:00
if (temporary) {
temporary = _null.temporary;
2026-07-20 16:05:17 +00:00
}
obj2.temporary = temporary;
2026-07-20 16:05:17 +00:00
let num = 0;
if (null != _null) {
num = _null.flags;
2026-07-20 16:05:17 +00:00
}
obj2.flags = num;
obj2.targetType = targetType;
obj2.targetUserId = targetUserId;
obj2.targetApplicationId = targetApplicationId;
2026-07-20 16:05:17 +00:00
let mapped;
if (_null != null) {
const roles = _null.roles;
2026-07-29 08:29:29 +00:00
if (roles != null) {
2026-07-20 16:05:17 +00:00
mapped = roles.map((id) => id.id);
}
}
2026-07-29 08:29:29 +00:00
if (mapped == null) {
2026-07-20 16:05:17 +00:00
mapped = [];
}
obj2.roleIds = mapped;
closure_6 = obj2;
closure_7 = obj2;
2026-07-20 16:05:17 +00:00
}
const FormStates = fn(1074).FormStates;
InstantInviteUtilsDefault.INVITE_OPTIONS_UNLIMITED.value;
2026-07-23 10:11:24 +00:00
let CLOSED = FormStates.CLOSED;
2026-07-29 08:29:29 +00:00
let c15 = false;
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class CreateInviteModalStore extends Store {
}
const prototype = CreateInviteModalStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(ChannelStore, GuildStore, InstantInviteStore);
2026-07-29 08:29:29 +00:00
};
prototype["init"] = function init() {
this.waitFor(InstantInviteStore);
2026-07-29 08:29:29 +00:00
};
prototype["isOpen"] = function isOpen() {
return CLOSED !== FormStates.CLOSED;
};
prototype["isSubmitting"] = function isSubmitting() {
return c15;
};
prototype["getGuildId"] = function getGuildId() {
return guildId;
2026-07-29 08:29:29 +00:00
};
prototype["getError"] = function getError() {
return message;
2026-07-29 08:29:29 +00:00
};
prototype["getInvite"] = function getInvite() {
return c5;
2026-07-29 08:29:29 +00:00
};
prototype["getInviteSettings"] = function getInviteSettings() {
return closure_6;
};
prototype["getPendingSettings"] = function getPendingSettings() {
return closure_7;
};
prototype["getProps"] = function getProps() {
return {};
};
Object.defineProperty(prototype, "onClose", {
get: function onClose() {
return c8;
2026-07-29 08:29:29 +00:00
},
set: undefined
});
CreateInviteModalStore.displayName = "CreateInviteModalStore";
const createInviteModalStore = new CreateInviteModalStore(DispatcherDefault, {
2026-07-29 08:29:29 +00:00
CREATE_INVITE_MODAL_INIT: function handleInit(guildId) {
guildId = guildId.guildId;
message = null;
2026-07-29 08:29:29 +00:00
let targetType = guildId.targetType;
if (targetType == null) {
targetType = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let targetUserId = guildId.targetUserId;
if (targetUserId == null) {
targetUserId = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let targetApplicationId = guildId.targetApplicationId;
if (targetApplicationId == null) {
targetApplicationId = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
updateWithLatestInvite(guildId.channelId, { targetType, targetUserId, targetApplicationId });
2026-07-20 16:05:17 +00:00
},
CREATE_INVITE_MODAL_OPEN: function handleModalOpen(onClose) {
CLOSED = FormStates.OPEN;
2026-07-20 16:05:17 +00:00
onClose = onClose.onClose;
c8 = onClose;
guildId = onClose.guildId;
message = null;
2026-07-29 08:29:29 +00:00
let targetType = onClose.targetType;
if (targetType == null) {
targetType = null;
}
let targetUserId = onClose.targetUserId;
if (targetUserId == null) {
targetUserId = null;
}
let targetApplicationId = onClose.targetApplicationId;
if (targetApplicationId == null) {
targetApplicationId = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
updateWithLatestInvite(onClose.channelId, { targetType, targetUserId, targetApplicationId });
2026-07-20 16:05:17 +00:00
},
CREATE_INVITE_MODAL_UPDATE_SETTINGS: function handleUpdateSettings(settings) {
settings = settings.settings;
if (null != closure_7) {
const obj = {};
const merged = Object.assign(closure_7);
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(settings);
closure_7 = obj;
2026-07-20 16:05:17 +00:00
}
},
CREATE_INVITE_MODAL_RESET_SETTINGS: function handleResetSettings() {
2026-08-24 06:08:38 +00:00
closure_7 = closure_6;
2026-07-20 16:05:17 +00:00
},
CREATE_INVITE_MODAL_GENERATE_INVITE: function handleGenerateInvite() {
2026-08-24 06:08:38 +00:00
closure_6 = closure_7;
c15 = true;
2026-07-20 16:05:17 +00:00
},
CREATE_INVITE_MODAL_GENERATE_INVITE_SUCCESS: function handleGenerateInviteSuccess(channelId) {
message = null;
2026-08-24 06:08:38 +00:00
c15 = false;
_modDef38(null != closure_6, "No invite settings for generated invite");
2026-07-29 08:29:29 +00:00
updateWithLatestInvite(channelId.channelId, { targetType: closure_6.targetType, targetUserId: closure_6.targetUserId, targetApplicationId: closure_6.targetApplicationId });
2026-07-20 16:05:17 +00:00
},
CREATE_INVITE_MODAL_GENERATE_INVITE_FAILURE: function handleGenerateInviteFailure(message) {
2026-08-24 06:08:38 +00:00
c5 = null;
c15 = false;
2026-07-20 16:05:17 +00:00
message = message.message;
},
CREATE_INVITE_MODAL_CLOSE: function handleModalClose() {
2026-08-24 06:08:38 +00:00
CLOSED = FormStates.CLOSED;
c8 = undefined;
2026-07-20 16:05:17 +00:00
}
});
const size = fn(2);
const result = size.fileFinishedImporting("stores/CreateInviteModalStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default createInviteModalStore;