decord/source/actions/CreateInviteModalActionCreators.tsx

107 lines
3.8 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 8962
// Function ID: 8963
// Dependencies: [8956, 676, 709, 698, 8081, 1236, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 8962
import expandEventPropertiesDefault from "expandEventProperties" /* 698 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import generateAcceptInviteOptionsDefault from "generateAcceptInviteOptions" /* 8081 */;
import closure_3 from "updateWithLatestInvite" /* 8956 */;
import { AnalyticEvents } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("actions/CreateInviteModalActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export default {
init(guildId, channelId, location) {
let str = location.location;
if (str === undefined) {
str = "";
}
({ targetType, targetUserId, targetApplicationId, skipCreateInvite } = location);
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "CREATE_INVITE_MODAL_INIT", guildId, channelId, targetType, targetUserId, targetApplicationId };
obj.dispatch(obj);
if (!skipCreateInvite) {
2026-07-29 08:29:29 +00:00
const self = this;
const invite = this.createInvite(str, true);
2026-07-20 16:05:17 +00:00
}
},
2026-07-29 08:29:29 +00:00
openSettings(guildId, channelId, source, onClose) {
2026-07-20 16:05:17 +00:00
const inviteSettings = store.getInviteSettings();
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "CREATE_INVITE_MODAL_OPEN" };
const merged = Object.assign(inviteSettings);
2026-07-29 08:29:29 +00:00
obj.guildId = guildId;
obj.channelId = channelId;
obj.onClose = onClose;
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
obj = { type: "Instant Invite", source };
2026-08-24 06:08:38 +00:00
expandEventPropertiesDefault.track(AnalyticEvents.OPEN_MODAL, obj);
2026-07-20 16:05:17 +00:00
},
updateSettings(settings) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "CREATE_INVITE_MODAL_UPDATE_SETTINGS", settings };
obj.dispatch(obj);
},
resetSettings() {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "CREATE_INVITE_MODAL_RESET_SETTINGS" });
2026-07-20 16:05:17 +00:00
},
createInvite(arg0, arg1) {
2026-07-29 08:29:29 +00:00
let obj = store;
2026-07-20 16:05:17 +00:00
const pendingSettings = store.getPendingSettings();
if (null != pendingSettings) {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "CREATE_INVITE_MODAL_GENERATE_INVITE" });
2026-07-20 16:05:17 +00:00
const channelId = pendingSettings.channelId;
({ maxAge, maxUses, temporary, targetType, targetUserId, targetApplicationId, flags, roleIds } = pendingSettings);
2026-07-29 08:29:29 +00:00
const invite = obj.getInvite();
2026-07-20 16:05:17 +00:00
let code = null;
if (arg1) {
code = null;
if (null != invite) {
code = invite.code;
}
}
2026-08-24 06:08:38 +00:00
const obj4 = dispatcherDefault;
2026-07-29 08:29:29 +00:00
const tmp7 = importDefault;
obj = { temporary: null, validate: null, max_age: null, max_uses: null, target_type: null, target_user_id: null, target_application_id: null, flags: null, role_ids: null };
obj[0] = temporary;
obj[1] = code;
2026-07-20 16:05:17 +00:00
const _parseInt = parseInt;
2026-07-29 08:29:29 +00:00
obj[2] = parseInt(maxAge, 10);
2026-07-20 16:05:17 +00:00
const _parseInt2 = parseInt;
2026-07-29 08:29:29 +00:00
obj[3] = parseInt(maxUses, 10);
obj[4] = targetType;
obj[5] = targetUserId;
obj[6] = targetApplicationId;
obj[7] = flags;
obj[8] = roleIds;
2026-08-24 06:08:38 +00:00
const invite1 = generateAcceptInviteOptionsDefault.createInvite(channelId, obj, arg0);
2026-07-20 16:05:17 +00:00
invite1.then(() => {
2026-08-24 06:08:38 +00:00
let obj = closure_1_1(closure_1_2[2]);
2026-07-20 16:05:17 +00:00
obj = { type: "CREATE_INVITE_MODAL_GENERATE_INVITE_SUCCESS", channelId };
obj.dispatch(obj);
}, (message) => {
2026-07-29 08:29:29 +00:00
const intl = channelId(1236).intl;
message = intl.string(channelId(1236).t.WB1ip6);
2026-07-20 16:05:17 +00:00
message = undefined;
2026-07-29 08:29:29 +00:00
if (message != null) {
2026-07-20 16:05:17 +00:00
message = message.message;
}
if (null != message) {
message = message.message;
}
2026-07-29 08:29:29 +00:00
callback(709).dispatch({ type: "CREATE_INVITE_MODAL_GENERATE_INVITE_FAILURE", message });
2026-07-20 16:05:17 +00:00
});
2026-08-24 06:08:38 +00:00
const tmp7Result = generateAcceptInviteOptionsDefault;
2026-07-20 16:05:17 +00:00
}
},
close() {
const onClose = store.onClose;
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "CREATE_INVITE_MODAL_CLOSE" });
2026-07-29 08:29:29 +00:00
if (onClose != null) {
2026-07-20 16:05:17 +00:00
onClose();
}
}
};