From 58dc26ee3014fb410d8f969e391562c9d67aa432 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Fri, 26 Apr 2024 19:45:33 -0500 Subject: [PATCH] use wildcard for widget client origin --- frontend/src/Widget.jsx | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/frontend/src/Widget.jsx b/frontend/src/Widget.jsx index 3c8b6e4..dafd6ab 100644 --- a/frontend/src/Widget.jsx +++ b/frontend/src/Widget.jsx @@ -244,37 +244,14 @@ function Widget() { /* --------------------------- END MAIN INITIALIZION EFFECT ----------------------- */ /* -------------------------------------------------------------------------------- */ - // useEffect(() => { - // // api.requestCapability(MatrixCapabilities.) - // api.on('action:m.message', (ev) => { - // console.log('action:m.message', ev); - // }); - // api.start(); - // }, []); - useEffect(() => { console.log('window.location', window.location); const { searchParams } = new URL(window.location.href); const widgetId = searchParams.get('widgetId'); - widgetApi.current = widgetApi.current ?? new WidgetApi(widgetId, 'https://chat.dgov.io'); - - console.log('widget api', widgetApi.current); - - // widgetApi.current.requestCapability(MatrixCapabilities.AlwaysOnScreen); - - // widgetApi.current.requestCapabilities([ - // WidgetEventCapability.forRoomEvent( - // EventDirection.Send, - // 'm.message', - // ), - // ]); - - // widgetApi.current.updateRequestedCapabilities(); - - widgetApi.current.on('ready', (e) => { - console.log('WIDGET READY', e); + widgetApi.current = widgetApi.current ?? new WidgetApi(widgetId, '*'); + widgetApi.current.on('ready', () => { const sendMessageCapability = WidgetEventCapability.forRoomEvent( EventDirection.Send, 'm.room.message',