// Metro module 16196 (f16197). import AuthenticationStore from "../../stores/AuthenticationStore"; import GuildRoomStore from "./GuildRoomStore"; import { Endpoints } from "../../Constants"; import { HTTP } from "../../_bundle/sendRequest"; import { serverGuildRoomToClient } from "./GuildRoomUtils"; import Dispatcher from "../../Dispatcher"; import { trackGuildRoomUserConnected, trackGuildRoomSeatSelected, trackGuildRoomUserUpdated, trackGuildRoomUserDisconnected, trackGuildRoomObjectInteracted } from "./GuildRoomAnalytics"; import { fireSurveyAction } from "../qualtrics/QualtricsActionCreators"; import { SurveyActionTypes } from "../../_bundle/Module9280"; import { GuildRoomObjectTypes } from "./GuildRoomTypes"; let c11613_7, guildRoomObjectDelete, deletePendingGuildRoomNote; const guildRoomObjectCreate = async function guildRoomObjectCreate(c28277_0, c28277_1, body2) { return await HTTP.post({ url: Endpoints.GUILD_ROOM_OBJECT_CREATE(c28277_0, c28277_1), body: body2, rejectWithError: true }); }; guildRoomObjectDelete = async function guildRoomObjectDelete(c28279_0, c28279_1, c28279_2, body4) { return await HTTP.del({ url: Endpoints.GUILD_ROOM_OBJECT_DELETE(c28279_0, c28279_1, c28279_2), body: body4, rejectWithError: true }); }; deletePendingGuildRoomNote = function deletePendingGuildRoomNote(a0) { Dispatcher.dispatch({ type: "GUILD_ROOM_PENDING_NOTE_DELETE", roomId: a0 }); }; c11613_7 = { x: 0, y: 0 }; export async function guildRoomConnect(c28274_0, c28274_1, c28274_2) { let r33; let position, c28274_4, c28274_5, c28274_8; let c28274_9 = 0; let c30987_0, c30987_1, c30987_2, c30987_3, c30987_4, c30987_5, c30987_6, c30987_7, c30987_8; L18: { try { c30987_0 = c28274_0; c30987_1 = c28274_1; c30987_2 = c28274_2; c30987_3 = void 0; c30987_4 = void 0; c30987_5 = void 0; c30987_6 = void 0; c30987_7 = void 0; c30987_8 = void 0; c28274_9 = 1; position = c28274_2; if (c28274_2 == null) { position = c11613_7; } c30987_3 = position; c30987_4 = await HTTP.post({ url: Endpoints.GUILD_ROOM_CONNECT(c28274_0, c28274_1), body: { position }, rejectWithError: true }); c30987_5 = serverGuildRoomToClient(c30987_4.body); Dispatcher.dispatch({ type: "GUILD_ROOM_CONNECT", room: c30987_5, guildId: c30987_0, pendingPosition: c30987_3 }); if (c30987_1 !== c30987_0) { trackGuildRoomUserConnected({ guildId: c30987_0, channelId: c30987_1 }); fireSurveyAction(SurveyActionTypes.GUILD_ROOM_JOINED); c30987_6 = c30987_5.users.get(AuthenticationStore.getId()); if (c30987_6 != null) { c30987_7 = [{ updateType: "position", updateReason: "default", position: c30987_6.position }, { updateType: "status_id", updateReason: "default", statusId: c30987_6.statusId }, { updateType: "status_text", updateReason: "default", statusText: c30987_6.statusText }]; const r132 = c30987_7; c28274_5 = r132; const r134 = r132[Symbol.iterator](); c28274_5 = r134.next; c28274_4 = r134; while (true) { const r136 = c28274_5; let r137 = c28274_4; const r138 = r137 === void 0 ? void 0 : (r33 = r136.call(r137)).done ? r137 = void 0 : r33.value; c28274_4 = r137; if (r137 === void 0) { trackGuildRoomSeatSelected({ guildId: c30987_0, channelId: c30987_1, actualSeatPosition: c30987_6.position, targetSeatPosition: c30987_2 }); break; } c28274_9 = 2; c30987_8 = r138; trackGuildRoomUserUpdated({ channelId: c30987_1, update: c30987_8 }); c28274_9 = 1; } } } c28274_9 = 0; } catch ($e) { const r39 = $e; let r8 = r39; c28274_8 = r39; let r40 = c28274_9; if (r40 !== 0) { while (true) { if (r40 === 1) { try { c28274_9 = 0; Dispatcher.dispatch({ type: "GUILD_ROOM_CONNECT_FAILURE", guildId: c30987_0, roomId: c30987_1 }); break L18; } catch (r174) { r8 = r174; c28274_8 = r174; r40 = c28274_9; if (r40 === 0) { break; } } } else { try { const r169 = c28274_8; c28274_9 = 1; const r171 = c28274_4; if (r171 !== void 0 && typeof r171.return === "function") { try { r171.return(); } catch {} } throw r169; } catch (r168) { r8 = r168; c28274_8 = r168; r40 = c28274_9; if (r40 === 0) { break; } } } } } throw r8; } } } export async function guildRoomDisconnect(c28275_0, roomId) { let c28275_5 = 0; let c30988_0, c30988_1; L12: { try { c30988_0 = c28275_0; c30988_1 = roomId; c28275_5 = 1; Dispatcher.dispatch({ type: "GUILD_ROOM_DISCONNECT", userId: AuthenticationStore.getId(), roomId }); await HTTP.post({ url: Endpoints.GUILD_ROOM_DISCONNECT(c28275_0, roomId), rejectWithError: true }); if (c30988_1 !== c30988_0) { trackGuildRoomUserDisconnected({ guildId: c30988_0, channelId: c30988_1 }); } c28275_5 = 0; } catch ($e) { let r8 = $e; if (c28275_5 !== 0) { while (true) { try { c28275_5 = 0; break L12; } catch ($e) { r8 = $e; if (c28275_5 === 0) { break; } } } } throw r8; } } } export function guildRoomLocalDisconnect(a0, a1) { Dispatcher.dispatch({ type: "GUILD_ROOM_DISCONNECT", userId: a0, roomId: a1 }); } export async function guildRoomUpdate(c28276_0, roomId2, body) { let c28276_6 = 0; let c30989_0, c30989_1, c30989_2, c30989_3, c30989_4, c30989_5, c30989_6, c30989_7, c30989_8; L44: { try { c30989_0 = c28276_0; c30989_1 = roomId2; c30989_2 = body; c30989_3 = void 0; c30989_4 = void 0; c30989_5 = void 0; c30989_6 = void 0; c30989_7 = void 0; c30989_8 = void 0; c30989_3 = GuildRoomStore.getRoom(roomId2); c30989_4 = GuildRoomStore.getRoomUsers(roomId2); c30989_5 = GuildRoomStore.getRoomObjects(roomId2); c28276_6 = 1; const r37 = { type: "GUILD_ROOM_LOCAL_UPDATE", roomId: roomId2 }; if (body?.background != null) { r37.background = body.background; } if (body?.user_position != null) { r37.position = body.user_position; } if (body?.user_status_id != null) { r37.statusId = body.user_status_id; } if (body?.user_status_text != null) { r37.statusText = body.user_status_text; } Dispatcher.dispatch(r37); c30989_6 = await HTTP.post({ url: Endpoints.GUILD_ROOM_UPDATE(c28276_0, roomId2), body, rejectWithError: true }); c30989_7 = serverGuildRoomToClient(c30989_6.body); if (c30989_0 !== c30989_1) { if (c30989_2?.user_position != null) { trackGuildRoomUserUpdated({ channelId: c30989_1, update: { updateType: "position", updateReason: "user_selected", position: c30989_2.user_position } }); } if (c30989_2?.user_status_id != null) { trackGuildRoomUserUpdated({ channelId: c30989_1, update: { updateType: "status_id", updateReason: "user_selected", statusId: c30989_2.user_status_id } }); } if (c30989_2?.user_status_text != null) { trackGuildRoomUserUpdated({ channelId: c30989_1, update: { updateType: "status_text", updateReason: "user_selected", statusText: c30989_2.user_status_text } }); } if (c30989_2?.user_position != null) { c30989_8 = c30989_7.users.get(AuthenticationStore.getId()); if (c30989_8 != null) { trackGuildRoomSeatSelected({ guildId: c30989_0, channelId: c30989_1, actualSeatPosition: c30989_8.position, targetSeatPosition: c30989_2.user_position }); } } } c28276_6 = 0; } catch ($e) { let r8 = $e; if (c28276_6 !== 0) { while (true) { try { c28276_6 = 0; Dispatcher.dispatch({ type: "GUILD_ROOM_UPDATE_FAILURE", originalRoom: c30989_3, originalRoomUsers: c30989_4, originalRoomObjects: c30989_5, guildId: c30989_0 }); break L44; } catch ($e) { r8 = $e; if (c28276_6 === 0) { break; } } } } throw r8; } } } export function selectGuildRoomLocalPosition(a0) { Dispatcher.dispatch({ type: "GUILD_ROOM_LOCAL_POSITION_REQUESTED", position: a0 }); } export function guildRoomToggleLayout(a0, a1) { Dispatcher.dispatch({ type: "GUILD_ROOM_TOGGLE_LAYOUT", roomId: a0, clearLayout: a1 }); } export { guildRoomObjectCreate }; export async function guildRoomObjectUpdate(c28278_0, c28278_1, c28278_2, body3) { return await HTTP.post({ url: Endpoints.GUILD_ROOM_OBJECT_UPDATE(c28278_0, c28278_1, c28278_2), body: body3, rejectWithError: true }); } export { guildRoomObjectDelete }; export function startPendingGuildRoomNote(a0) { Dispatcher.dispatch({ type: "GUILD_ROOM_PENDING_NOTE_START", roomId: a0 }); } export function placePendingGuildRoomNote(a0, a1) { Dispatcher.dispatch({ type: "GUILD_ROOM_PENDING_NOTE_PLACE", roomId: a0, position: a1 }); } export { deletePendingGuildRoomNote }; export async function createGuildRoomNote(c28280_0, c28280_1, content, position2) { let c28280_7 = 0; let c30990_0, c30990_1; L12: { try { c30990_0 = c28280_0; c30990_1 = c28280_1; deletePendingGuildRoomNote(c28280_1); c28280_7 = 1; await guildRoomObjectCreate(c28280_0, c28280_1, { object_type: GuildRoomObjectTypes.NOTE, content, position: position2 }); if (c30990_1 !== c30990_0) { trackGuildRoomObjectInteracted({ interactionType: "note_created", guildId: c30990_0, channelId: c30990_1 }); } Dispatcher.dispatch({ type: "GUILD_ROOM_NOTE_CREATE_COMPLETE", roomId: c30990_1 }); c28280_7 = 0; } catch ($e) { let r8 = $e; if (c28280_7 !== 0) { while (true) { try { c28280_7 = 0; Dispatcher.dispatch({ type: "GUILD_ROOM_NOTE_CREATE_COMPLETE", roomId: c30990_1 }); break L12; } catch ($e) { r8 = $e; if (c28280_7 === 0) { break; } } } } throw r8; } } } export async function deleteGuildRoomNote(c28281_0, c28281_1, c28281_2) { let c28281_4; c28281_4 = void 0; let c30991_0 = c28281_0; let c30991_1 = c28281_1; await guildRoomObjectDelete(c28281_0, c28281_1, c28281_2, { object_type: GuildRoomObjectTypes.NOTE }); if (c30991_1 !== c30991_0) { trackGuildRoomObjectInteracted({ interactionType: "note_deleted", guildId: c30991_0, channelId: c30991_1 }); } } export async function fetchGuildRoom(c28282_0, c28282_1) { let c28282_3; c28282_3 = void 0; let c30992_0 = c28282_0; let c30992_1 = await HTTP.get({ url: Endpoints.GUILD_ROOM(c28282_0, c28282_1), rejectWithError: true }); let c30992_2 = serverGuildRoomToClient(c30992_1.body); Dispatcher.dispatch({ type: "GUILD_ROOM_FETCH_SUCCESS", guildId: c30992_0, room: c30992_2 }); }