From 14d52c9f250c970e358e702ba0c76f8b6e32d208 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Mon, 26 Feb 2018 13:29:16 +0000 Subject: [PATCH] Open integration manager from widget postMessage. --- src/WidgetMessaging.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/WidgetMessaging.js b/src/WidgetMessaging.js index 7d240137a7..edef56cee4 100644 --- a/src/WidgetMessaging.js +++ b/src/WidgetMessaging.js @@ -22,6 +22,7 @@ limitations under the License. import URL from 'url'; import dis from './dispatcher'; import MatrixPostMessageApi from './MatrixPostMessageApi'; +import IntegrationManager from './IntegrationManager'; const WIDGET_API_VERSION = '0.0.1'; // Current API version const SUPPORTED_WIDGET_API_VERSIONS = [ @@ -196,6 +197,11 @@ export default class WidgetMessaging extends MatrixPostMessageApi { }); } else if (action === 'sticker_message') { dis.dispatch({action: 'sticker_message', data: event.data.widgetData, widgetId: event.data.widgetId}); + } else if (action === 'integration_manager_open') { + const data = event.data.widgetData; + const integType = (data && data.integType) ? data.integType : null; + const integId = (data && data.integId) ? data.integId : null; + IntegrationManager.open(integType, integId); } else { console.warn("Widget postMessage event unhandled"); this.sendError(event, {message: "The postMessage was unhandled"});