🩹(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:
committed by
aleb_the_flash
parent
66f307b7e8
commit
6324be9fd3
@@ -66,6 +66,7 @@ export const CreateMeetingButton = () => {
|
||||
setRoom(undefined)
|
||||
setCallbackId(undefined)
|
||||
setIsPending(false)
|
||||
popupManager.clearState()
|
||||
}
|
||||
|
||||
if (isPending) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ export type CallbackCreationRoomData = {
|
||||
|
||||
export enum ClientMessageType {
|
||||
ROOM_CREATED = 'ROOM_CREATED',
|
||||
STATE_CLEAR = 'STATE_CLEAR',
|
||||
}
|
||||
|
||||
export interface PopupMessageData {
|
||||
|
||||
Reference in New Issue
Block a user