decord/source/stores/CreateInviteModalStore.tsx

180 lines
5.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 8956
// Function ID: 8957
2026-07-29 08:29:29 +00:00
// Name: updateWithLatestInvite
2026-08-24 06:08:38 +00:00
// Dependencies: [1391, 1910, 8082, 676, 8957, 8959, 38, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 8956 (updateWithLatestInvite)
import _modDef38 from "module_38" /* 38 */;
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import isGuildMemberDefault from "isGuildMember" /* 8957 */;
import getDefaultInviteExpiration from "getDefaultInviteExpiration" /* 8959 */;
import closure_9 from "ensureGuildLoaded" /* 1391 */;
import closure_10 from "createGuildRecordFromRust" /* 1910 */;
import closure_11 from "map" /* 8082 */;
import { FormStates } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function updateWithLatestInvite(channelId, arg1) {
({ targetType, targetUserId, targetApplicationId } = arg1);
2026-07-23 10:11:24 +00:00
channel = channel.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;
}
2026-07-23 10:11:24 +00:00
guild = guild.getGuild(guild_id);
2026-08-24 06:08:38 +00:00
let obj = getDefaultInviteExpiration;
2026-07-20 16:05:17 +00:00
let maxAge = obj.getDefaultInviteExpiration({ guild });
2026-07-29 08:29:29 +00:00
invite = invite.getInvite(channelId, { targetType, targetUserId, targetApplicationId });
obj = { channelId, maxAge: null, maxUses: null, temporary: null, flags: null, targetType: null, targetUserId: null, targetApplicationId: null, roleIds: null };
if (null != invite) {
maxAge = invite.maxAge;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = maxAge;
if (null != invite) {
let maxUses = invite.maxUses;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
maxUses = closure_13;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = maxUses;
let temporary = null != invite;
2026-07-20 16:05:17 +00:00
if (temporary) {
2026-07-29 08:29:29 +00:00
temporary = invite.temporary;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = temporary;
2026-07-20 16:05:17 +00:00
let num = 0;
2026-07-29 08:29:29 +00:00
if (null != invite) {
num = invite.flags;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[4] = num;
obj[5] = targetType;
obj[6] = targetUserId;
obj[7] = targetApplicationId;
2026-07-20 16:05:17 +00:00
let mapped;
2026-07-29 08:29:29 +00:00
if (invite != null) {
const roles = invite.roles;
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 = [];
}
2026-07-29 08:29:29 +00:00
obj[8] = mapped;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
isGuildMemberDefault.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() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_9, closure_10, closure_11);
2026-07-29 08:29:29 +00:00
};
prototype["init"] = function init() {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_11);
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 closure_3;
};
prototype["getError"] = function getError() {
return closure_4;
};
prototype["getInvite"] = function getInvite() {
return closure_5;
};
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 closure_8;
},
set: undefined
});
CreateInviteModalStore.displayName = "CreateInviteModalStore";
2026-08-24 06:08:38 +00:00
const createInviteModalStore = new CreateInviteModalStore(dispatcherDefault, {
2026-07-29 08:29:29 +00:00
CREATE_INVITE_MODAL_INIT: function handleInit(guildId) {
guildId = guildId.guildId;
2026-08-24 06:08:38 +00:00
c4 = 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) {
2026-07-23 10:11:24 +00:00
const OPEN = FormStates.OPEN;
2026-07-20 16:05:17 +00:00
onClose = onClose.onClose;
2026-07-29 08:29:29 +00:00
const guildId = onClose.guildId;
2026-08-24 06:08:38 +00:00
c4 = 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 != obj) {
2026-07-23 10:11:24 +00:00
obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(obj);
const merged1 = Object.assign(settings);
}
},
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) {
2026-08-24 06:08:38 +00:00
c4 = null;
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
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("stores/CreateInviteModalStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default createInviteModalStore;