From d43b2857c11879b340154f0d565a26f140d0dcb6 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Fri, 4 Apr 2025 13:17:40 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9(sdk)=20notify=20iframe=20parent=20?= =?UTF-8?q?when=20room=20is=20gathered=20through=20callback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On the first room creation, when the authentication redirection takes place, the iframe wasn't properly messaging the parent. Fixed it. Send the room data in any of the two methods to acquire it. Actually, the code when gathering data through the callback endpoint is a bit dirty. --- .../src/features/sdk/routes/CreateMeetingButton.tsx | 6 ++++++ src/frontend/src/features/sdk/utils/PopupManager.ts | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/features/sdk/routes/CreateMeetingButton.tsx b/src/frontend/src/features/sdk/routes/CreateMeetingButton.tsx index 3b472005..8170b466 100644 --- a/src/frontend/src/features/sdk/routes/CreateMeetingButton.tsx +++ b/src/frontend/src/features/sdk/routes/CreateMeetingButton.tsx @@ -48,6 +48,12 @@ export const CreateMeetingButton = () => { setRoom(data.room) setCallbackId(undefined) setIsPending(false) + popupManager.sendRoomData({ + room: { + url: getRouteUrl('room', data.room.slug), + ...data.room, + }, + }) }, [data]) useEffect(() => { diff --git a/src/frontend/src/features/sdk/utils/PopupManager.ts b/src/frontend/src/features/sdk/utils/PopupManager.ts index f98a4cd3..e6a7afc8 100644 --- a/src/frontend/src/features/sdk/utils/PopupManager.ts +++ b/src/frontend/src/features/sdk/utils/PopupManager.ts @@ -39,6 +39,11 @@ export class PopupManager { this.messageParent(ClientMessageType.STATE_CLEAR, {}) } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + public sendRoomData(data: { room: any }) { + this.messageParent(ClientMessageType.ROOM_CREATED, data) + } + public setupMessageListener( onCallbackId: (id: string) => void, onRoomData: (data: CallbackCreationRoomData) => void @@ -54,7 +59,7 @@ export class PopupManager { case PopupMessageType.ROOM_DATA: if (!data?.room) return onRoomData(data.room) - this.messageParent(ClientMessageType.ROOM_CREATED, { + this.sendRoomData({ room: { url: getRouteUrl('room', data.room.slug), ...data.room,