🩹(frontend) fix missing notification when state is clear

Notify iframe's parent while integrating Visio when state
is cleared. Requested by Eleonore.
This commit is contained in:
lebaudantoine
2025-04-03 23:26:01 +02:00
committed by aleb_the_flash
parent 66f307b7e8
commit 6324be9fd3
6 changed files with 32 additions and 13 deletions

View File

@@ -66,6 +66,7 @@ export const CreateMeetingButton = () => {
setRoom(undefined)
setCallbackId(undefined)
setIsPending(false)
popupManager.clearState()
}
if (isPending) {

View File

@@ -24,6 +24,21 @@ export class PopupManager {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private messageParent(type: ClientMessageType, data: any) {
window?.parent.postMessage(
{
type: type,
data: data,
},
'*'
)
}
public clearState() {
this.messageParent(ClientMessageType.STATE_CLEAR, {})
}
public setupMessageListener(
onCallbackId: (id: string) => void,
onRoomData: (data: CallbackCreationRoomData) => void
@@ -39,18 +54,12 @@ export class PopupManager {
case PopupMessageType.ROOM_DATA:
if (!data?.room) return
onRoomData(data.room)
window?.parent.postMessage(
{
type: ClientMessageType.ROOM_CREATED,
data: {
room: {
url: getRouteUrl('room', data.room.slug),
...data.room,
},
},
this.messageParent(ClientMessageType.ROOM_CREATED, {
room: {
url: getRouteUrl('room', data.room.slug),
...data.room,
},
'*'
)
})
return
}
}

View File

@@ -4,6 +4,7 @@ export type CallbackCreationRoomData = {
export enum ClientMessageType {
ROOM_CREATED = 'ROOM_CREATED',
STATE_CLEAR = 'STATE_CLEAR',
}
export interface PopupMessageData {