Open integration manager from widget postMessage.

pull/21833/head
Richard Lewis 2018-02-26 13:29:16 +00:00
parent d3de44e6eb
commit 14d52c9f25
1 changed files with 6 additions and 0 deletions

View File

@ -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"});