Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wazo/euc-plugins-sdk

Package Overview
Dependencies
Maintainers
4
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wazo/euc-plugins-sdk - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

lib/cjs/constants.js

189

lib/cjs/app.js

@@ -13,50 +13,3 @@ "use strict";

exports.App = void 0;
// Global
const EVENT_ON_LOADED = 'wazo/ON_LOADED';
const EVENT_APP_UNLOADED = 'wazo/EVENT_APP_UNLOADED';
const EVENT_APP_INITIALIZE = 'wazo/EVENT_APP_INITIALIZE';
const EVENT_ON_LOGOUT = 'wazo/EVENT_ON_LOGOUT';
const EVENT_SEND_IFRAME_MESSAGE = 'wazo/EVENT_SEND_IFRAME_MESSAGE';
const EVENT_SEND_BACKGROUND_MESSAGE = 'wazo/EVENT_SEND_BACKGROUND_MESSAGE';
const EVENT_ON_IFRAME_MESSAGE = 'wazo/EVENT_ON_IFRAME_MESSAGE';
const EVENT_ON_BACKGROUND_MESSAGE = 'wazo/EVENT_ON_BACKGROUND_MESSAGE';
// WDA
const EVENT_CLOSE_LEFT_PANEL = 'wazo/EVENT_CLOSE_LEFT_PANEL';
const EVENT_OPEN_LEFT_PANEL = 'wazo/EVENT_OPEN_LEFT_PANEL';
const EVENT_START_CALL = 'wazo/START_CALL';
const EVENT_ON_CALL_INCOMING = 'wazo/EVENT_ON_CALL_INCOMING';
const EVENT_ON_CALL_MADE = 'wazo/EVENT_ON_CALL_MADE';
const EVENT_ON_CALL_ANSWERED = 'wazo/EVENT_ON_CALL_ANSWERED';
const EVENT_ON_CALL_HUNG_UP = 'wazo/EVENT_ON_CALL_HUNG_UP';
const EVENT_OPEN_LINK = 'wazo/EVENT_OPEN_LINK';
const EVENT_CREATE_MEETING = 'wazo/EVENT_CREATE_MEETING';
const EVENT_OPEN_MEETING_LOBBY = 'wazo/EVENT_OPEN_MEETING_LOBBY';
const EVENT_OPEN_SETTINGS = 'wazo/EVENT_OPEN_SETTINGS';
const EVENT_ON_MEETING_CREATED = 'wazo/EVENT_ON_MEETING_CREATED';
const EVENT_ROUTE_CHANGE = 'wazo/EVENT_ROUTE_CHANGE';
const EVENT_WS_MESSAGE = 'wazo/EVENT_WS_MESSAGE';
const EVENT_PLAY_PROGRESS_SOUND = 'wazo/EVENT_PLAY_PROGRESS_SOUND';
const EVENT_PLAY_NEW_MESSAGE_SOUND = 'wazo/EVENT_PLAY_NEW_MESSAGE_SOUND';
const EVENT_PLAY_INCOMING_CALL_SOUND = 'wazo/EVENT_PLAY_INCOMING_CALL_SOUND';
const EVENT_PLAY_DOUBLE_CALL_SOUND = 'wazo/EVENT_PLAY_DOUBLE_CALL_SOUND';
const EVENT_PLAY_HANGUP_SOUND = 'wazo/EVENT_PLAY_HANGUP_SOUND';
const EVENT_STOP_CURRENT_SOUND = 'wazo/EVENT_STOP_CURRENT_SOUND';
const EVENT_CONFIGURE_SOUNDS = 'wazo/EVENT_CONFIGURE_SOUNDS';
const EVENT_RESET_SOUNDS = 'wazo/EVENT_RESET_SOUNDS';
const EVENT_DISPLAY_NOTIFICATION = 'wazo/EVENT_DISPLAY_NOTIFICATION';
const EVENT_CHANGE_NAVBAR_COLOR = 'wazo/EVENT_CHANGE_NAVBAR_COLOR';
const EVENT_RESET_NAVBAR_COLOR = 'wazo/EVENT_RESET_NAVBAR_COLOR';
const EVENT_DISPLAY_MODAL = 'wazo/EVENT_DISPLAY_MODAL';
const EVENT_REMOVE_MODAL = 'wazo/EVENT_REMOVE_MODAL';
const EVENT_USER_JOIN_ROOM = 'wazo/EVENT_USER_JOIN_ROOM';
const EVENT_USER_LEAVE_ROOM = 'wazo/EVENT_USER_LEAVE_ROOM';
const EVENT_PARTICIPANT_JOIN_ROOM = 'wazo/EVENT_PARTICIPANT_JOIN_ROOM';
const EVENT_PARTICIPANT_LEAVE_ROOM = 'wazo/EVENT_PARTICIPANT_LEAVE_ROOM';
const EVENT_IGNORE_CALL = 'wazo/EVENT_IGNORE_CALL';
const EVENT_ON_NEW_SESSION = 'wazo/EVENT_ON_NEW_SESSION';
const EVENT_UPDATE_BADGE = 'wazo/EVENT_UPDATE_BADGE';
// Portal
const EVENT_ON_CONNECTED_TO_STACK = 'wazo/EVENT_ON_CONNECTED_TO_STACK';
const EVENT_ON_SWITCH_STACK_TENANT = 'wazo/EVENT_ON_SWITCH_STACK_TENANT';
const EVENT_CHANGE_TOOLBAR_DISPLAY = 'wazo/EVENT_CHANGE_TOOLBAR_DISPLAY';
const constants_1 = require("./constants");
const initializationTimeoutInMs = 5000;

@@ -68,2 +21,3 @@ class App {

this.onUnLoaded = (e) => { };
this.onPluginUnLoaded = () => { };
this.onAppUnLoaded = (tabId) => { };

@@ -77,2 +31,3 @@ this.onIframeMessage = (message) => { };

this.onCallAnswered = (call) => { };
this.onCallAccepted = (call) => { };
this.onCallHungUp = (call) => { };

@@ -96,3 +51,3 @@ this.onUnHandledEvent = (event) => { };

return new Promise((resolve, reject) => {
this._sendMessage(EVENT_APP_INITIALIZE, { bg: this._isBackground, pluginId: this._pluginId });
this._sendMessage(constants_1.EVENT_APP_INITIALIZE, { bg: this._isBackground, pluginId: this._pluginId });
this._initializeTimeout = setTimeout(() => {

@@ -110,16 +65,16 @@ this._initializeTimeout = null;

this.getContext = () => this.context;
this.sendMessageToIframe = (payload) => this._sendMessage(EVENT_SEND_IFRAME_MESSAGE, { payload });
this.sendMessageToBackground = (payload) => this._sendMessage(EVENT_SEND_BACKGROUND_MESSAGE, { payload });
this.sendMessageToIframe = (payload) => this._sendMessage(constants_1.EVENT_SEND_IFRAME_MESSAGE, { payload });
this.sendMessageToBackground = (payload) => this._sendMessage(constants_1.EVENT_SEND_BACKGROUND_MESSAGE, { payload });
// WDA
this.startCall = ({ targets, requestedModalities = ['audio'] }) => {
this._sendMessage(EVENT_START_CALL, { targets, requestedModalities });
this._sendMessage(constants_1.EVENT_START_CALL, { targets, requestedModalities });
};
this.openLink = (url) => {
this._sendMessage(EVENT_OPEN_LINK, { url });
this._sendMessage(constants_1.EVENT_OPEN_LINK, { url });
};
this.createMeeting = (name, requireAuthorization = false, persistent = false) => {
this._sendMessage(EVENT_CREATE_MEETING, { name, requireAuthorization, persistent });
this._sendMessage(constants_1.EVENT_CREATE_MEETING, { name, requireAuthorization, persistent });
};
this.openMeetingLobby = (extension) => {
this._sendMessage(EVENT_OPEN_MEETING_LOBBY, { extension });
this._sendMessage(constants_1.EVENT_OPEN_MEETING_LOBBY, { extension });
};

@@ -130,17 +85,17 @@ this.openSettings = () => {

};
this.closeLeftPanel = () => this._sendMessage(EVENT_CLOSE_LEFT_PANEL);
this.openLeftPanel = () => this._sendMessage(EVENT_OPEN_LEFT_PANEL);
this.playProgressSound = () => this._sendMessage(EVENT_PLAY_PROGRESS_SOUND);
this.playNewMessageSound = () => this._sendMessage(EVENT_PLAY_NEW_MESSAGE_SOUND);
this.playIncomingCallSound = () => this._sendMessage(EVENT_PLAY_INCOMING_CALL_SOUND);
this.playDoubleCallSound = () => this._sendMessage(EVENT_PLAY_DOUBLE_CALL_SOUND);
this.playHangupSound = () => this._sendMessage(EVENT_PLAY_HANGUP_SOUND);
this.stopCurrentSound = () => this._sendMessage(EVENT_STOP_CURRENT_SOUND);
this.configureSounds = (sounds) => this._sendMessage(EVENT_CONFIGURE_SOUNDS, { sounds });
this.resetSounds = () => this._sendMessage(EVENT_RESET_SOUNDS);
this.changeNavBarColor = (color) => this._sendMessage(EVENT_CHANGE_NAVBAR_COLOR, { color });
this.resetNavBarColor = () => this._sendMessage(EVENT_RESET_NAVBAR_COLOR);
this.displayNotification = (title, text) => this._sendMessage(EVENT_DISPLAY_NOTIFICATION, { title, text });
this.displayModal = ({ url, title, text, htmlText, height, width }) => this._sendMessage(EVENT_DISPLAY_MODAL, { url, title, text, htmlText, height, width });
this.removeModal = () => this._sendMessage(EVENT_REMOVE_MODAL);
this.closeLeftPanel = () => this._sendMessage(constants_1.EVENT_CLOSE_LEFT_PANEL);
this.openLeftPanel = () => this._sendMessage(constants_1.EVENT_OPEN_LEFT_PANEL);
this.playProgressSound = () => this._sendMessage(constants_1.EVENT_PLAY_PROGRESS_SOUND);
this.playNewMessageSound = () => this._sendMessage(constants_1.EVENT_PLAY_NEW_MESSAGE_SOUND);
this.playIncomingCallSound = () => this._sendMessage(constants_1.EVENT_PLAY_INCOMING_CALL_SOUND);
this.playDoubleCallSound = () => this._sendMessage(constants_1.EVENT_PLAY_DOUBLE_CALL_SOUND);
this.playHangupSound = () => this._sendMessage(constants_1.EVENT_PLAY_HANGUP_SOUND);
this.stopCurrentSound = () => this._sendMessage(constants_1.EVENT_STOP_CURRENT_SOUND);
this.configureSounds = (sounds) => this._sendMessage(constants_1.EVENT_CONFIGURE_SOUNDS, { sounds });
this.resetSounds = () => this._sendMessage(constants_1.EVENT_RESET_SOUNDS);
this.changeNavBarColor = (color) => this._sendMessage(constants_1.EVENT_CHANGE_NAVBAR_COLOR, { color });
this.resetNavBarColor = () => this._sendMessage(constants_1.EVENT_RESET_NAVBAR_COLOR);
this.displayNotification = (title, text) => this._sendMessage(constants_1.EVENT_DISPLAY_NOTIFICATION, { title, text });
this.displayModal = ({ url, title, text, htmlText, height, width }) => this._sendMessage(constants_1.EVENT_DISPLAY_MODAL, { url, title, text, htmlText, height, width });
this.removeModal = () => this._sendMessage(constants_1.EVENT_REMOVE_MODAL);
this.hasLocalVideoStream = (call) => Wazo.Phone.phone.hasALocalVideoTrack(call);

@@ -150,5 +105,27 @@ this.getLocalCurrentVideoStream = (call) => Wazo.Phone.phone.getLocalVideoStream(call);

this.getRemoteVideoStream = (call) => Wazo.Phone.phone.getRemoteVideoStream(call);
this.updateBadge = (args) => this._sendMessage(EVENT_UPDATE_BADGE, Object.assign(Object.assign({}, args), { entityId: args.entityId || this._entityId || 'update-badge-null-entity-id' }));
this.updateBadge = (args) => this._sendMessage(constants_1.EVENT_UPDATE_BADGE, Object.assign(Object.assign({}, args), { entityId: args.entityId || this._entityId || 'update-badge-null-entity-id' }));
// Portal
this.changeToolbarDisplay = (display) => this._sendMessage(EVENT_CHANGE_TOOLBAR_DISPLAY, { display });
this.changeToolbarDisplay = (display) => this._sendMessage(constants_1.EVENT_CHANGE_TOOLBAR_DISPLAY, { display });
// App to Mobile
this.setMobileHeader = ({ title, callback }, entityId) => {
const id = entityId || this._entityId;
if (id) {
delete this._headerBackCallbacks[id];
if (typeof callback === 'function') {
this._headerBackCallbacks[id] = callback;
}
}
this._sendMessage(constants_1.EVENT_MOBILE_HEADER, {
headerTitle: title,
emitHeaderBack: !!callback,
entityId: entityId || this._entityId,
});
};
// @WIP
this.setMobileContextualMenu = (contextualMenu, entityId) => this._sendMessage(constants_1.EVENT_MOBILE_CONTEXTUAL_MENU, { contextualMenu, entityId: entityId || this._entityId });
// @WIP
this.setMobileShowBottomNav = (showBottomNav, entityId) => this._sendMessage(constants_1.EVENT_MOBILE_SHOW_BOTTOM_NAV, { showBottomNav, entityId: entityId || this._entityId });
// Mobile to app
// @WIP
this.onMobileMenuAction = (id) => this.sendMessageToIframe({ type: constants_1.EVENT_MOBILE_ON_MENU_ACTION, id });
this._onMessage = (event) => {

@@ -160,16 +137,20 @@ if (!event.data) {

// Global
case EVENT_ON_LOADED:
case constants_1.EVENT_ON_LOADED:
this._onLoaded(event.data.session, event.data.theme, event.data.locale, event.data.extra);
break;
case EVENT_APP_UNLOADED:
case constants_1.EVENT_APP_UNLOADED:
delete this._headerBackCallbacks[event.data.tabId];
this.onAppUnLoaded(event.data.tabId);
break;
case EVENT_ON_LOGOUT:
case constants_1.EVENT_PLUGIN_UNLOADED:
this._unloadPlugin();
break;
case constants_1.EVENT_ON_LOGOUT:
this.onLogout();
this._resetEvents();
this._unloadPlugin();
break;
case EVENT_ON_NEW_SESSION:
case constants_1.EVENT_ON_NEW_SESSION:
this.onNewSession(event.data.session);
break;
case EVENT_ON_IFRAME_MESSAGE:
case constants_1.EVENT_ON_IFRAME_MESSAGE:
if (event.data._pluginId === this._pluginId) {

@@ -179,3 +160,3 @@ this.onIframeMessage(event.data.payload);

break;
case EVENT_ON_BACKGROUND_MESSAGE:
case constants_1.EVENT_ON_BACKGROUND_MESSAGE:
if (event.data._pluginId === this._pluginId) {

@@ -185,43 +166,56 @@ this.onBackgroundMessage(event.data.payload);

break;
case EVENT_USER_JOIN_ROOM:
case constants_1.EVENT_USER_JOIN_ROOM:
this.onUserJoinRoom(event.data.room);
break;
case EVENT_USER_LEAVE_ROOM:
case constants_1.EVENT_USER_LEAVE_ROOM:
this.onUserLeaveRoom(event.data.room);
break;
case EVENT_PARTICIPANT_JOIN_ROOM:
case constants_1.EVENT_PARTICIPANT_JOIN_ROOM:
this.onParticipantJoinRoom(event.data.room, event.data.participant);
break;
case EVENT_PARTICIPANT_LEAVE_ROOM:
case constants_1.EVENT_PARTICIPANT_LEAVE_ROOM:
this.onParticipantLeaveRoom(event.data.room, event.data.participant);
break;
// WDA
case EVENT_WS_MESSAGE:
case constants_1.EVENT_WS_MESSAGE:
this.onWebsocketMessage(event.data.message);
break;
case EVENT_ON_MEETING_CREATED:
case constants_1.EVENT_ON_MEETING_CREATED:
this.onMeetingCreated(event.data.meeting);
break;
case EVENT_ROUTE_CHANGE:
case constants_1.EVENT_ROUTE_CHANGE:
this.onRouteChanged(event.data.location, event.data.action);
break;
case EVENT_ON_CALL_INCOMING:
case constants_1.EVENT_ON_CALL_INCOMING:
this.onCallIncoming(event.data.call);
break;
case EVENT_ON_CALL_MADE:
case constants_1.EVENT_ON_CALL_MADE:
this.onCallMade(event.data.call);
break;
case EVENT_ON_CALL_ANSWERED:
case constants_1.EVENT_ON_CALL_ANSWERED:
this.onCallAnswered(event.data.call);
break;
case EVENT_ON_CALL_HUNG_UP:
case constants_1.EVENT_ON_CALL_ACCEPTED:
this.onCallAccepted(event.data.call);
break;
case constants_1.EVENT_ON_CALL_HUNG_UP:
this.onCallHungUp(event.data.call);
break;
// Portal
case EVENT_ON_CONNECTED_TO_STACK:
case constants_1.EVENT_ON_CONNECTED_TO_STACK:
this.onConnectedToStack(event.data.stackSession);
break;
case EVENT_ON_SWITCH_STACK_TENANT:
case constants_1.EVENT_ON_SWITCH_STACK_TENANT:
this.onSwitchTenant(event.data.tenant.uuid, event.data.tenant.name);
break;
// Mobile
case constants_1.EVENT_MOBILE_ON_HEADER_BACK:
const action = this._headerBackCallbacks[event.data.entityId || this._entityId];
if (typeof action === 'function') {
action();
}
break;
case constants_1.EVENT_MOBILE_ON_MENU_ACTION:
this.onMobileMenuAction(event.data);
break;
default:

@@ -233,3 +227,3 @@ this.onUnHandledEvent(event);

this._sendMessage = (type, payload = {}) => {
if (!this.isInitialized() && type !== EVENT_APP_INITIALIZE) {
if (!this.isInitialized() && type !== constants_1.EVENT_APP_INITIALIZE) {
this._queuedMessages.push({ type, payload });

@@ -274,2 +268,6 @@ return;

};
this._unloadPlugin = () => {
this.onPluginUnLoaded();
this._resetEvents();
};
this._configurePlugin = (configuration) => {

@@ -288,2 +286,3 @@ if (configuration.pluginId) {

this.onUnLoaded = (e) => { };
this.onPluginUnLoaded = () => { };
this.onAppUnLoaded = (tabId) => { };

@@ -298,2 +297,3 @@ this.onIframeMessage = (message) => { };

this.onCallAnswered = (call) => { };
this.onCallAccepted = (call) => { };
this.onCallHungUp = (call) => { };

@@ -317,2 +317,3 @@ this.onUnHandledEvent = (event) => { };

this._queuedMessages = [];
this._headerBackCallbacks = {};
this.context = {

@@ -349,3 +350,3 @@ app: {

ignoreCall(call) {
this._sendMessage(EVENT_IGNORE_CALL, { call });
this._sendMessage(constants_1.EVENT_IGNORE_CALL, { call });
}

@@ -352,0 +353,0 @@ }

@@ -25,2 +25,5 @@ "use strict";

};
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -36,1 +39,2 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

exports.softphone = softphone_1.default;
__exportStar(require("./constants"), exports);

@@ -1,2 +0,2 @@

import { Call, Room, Contact, Context, Meeting, UserInfo, Extra, ModalParameter, Sounds, PluginConfiguration, WDASession, PortalSession, UpdateBadgeArgs } from './types';
import { Call, Room, Contact, Context, Meeting, UserInfo, Extra, ModalParameter, Sounds, PluginConfiguration, WDASession, PortalSession, UpdateBadgeArgs, MobileMenuItem } from './types';
declare global {

@@ -21,4 +21,6 @@ var _setPluginId: Function;

_isBackground: boolean;
_headerBackCallbacks: Record<string, Function>;
onNewSession: (session: WDASession | PortalSession) => void;
onUnLoaded: (e: Event) => void;
onPluginUnLoaded: () => void;
onAppUnLoaded: (tabId: string) => void;

@@ -31,2 +33,3 @@ onIframeMessage: (message: Object) => void;

onCallAnswered: (call: Call) => void;
onCallAccepted: (call: Call) => void;
onCallHungUp: (call: Call) => void;

@@ -79,2 +82,9 @@ onUnHandledEvent: (event: MessageEvent) => void;

changeToolbarDisplay: (display: boolean) => any;
setMobileHeader: ({ title, callback }: {
title?: string | null | undefined;
callback?: Function | null | undefined;
}, entityId?: string) => void;
setMobileContextualMenu: (contextualMenu: MobileMenuItem[], entityId?: string) => any;
setMobileShowBottomNav: (showBottomNav: boolean, entityId?: string) => any;
onMobileMenuAction: (id: string) => any;
_onMessage: (event: MessageEvent) => void;

@@ -85,2 +95,3 @@ _sendMessage: (type: string, payload?: {}) => any;

_setPluginId: (pluginId: string) => void;
_unloadPlugin: () => void;
_configurePlugin: (configuration: PluginConfiguration) => void;

@@ -87,0 +98,0 @@ _resetEvents: () => void;

import app, { App } from './app';
import softphone from './softphone';
export * from './constants';
export { app, // @deprecated
App, softphone, };
//# sourceMappingURL=index.d.ts.map

@@ -263,3 +263,7 @@ export declare enum HostClientType {

};
export type MobileMenuItem = {
label: string;
id: string;
};
export {};
//# sourceMappingURL=types.d.ts.map

@@ -1,49 +0,2 @@

// Global
const EVENT_ON_LOADED = 'wazo/ON_LOADED';
const EVENT_APP_UNLOADED = 'wazo/EVENT_APP_UNLOADED';
const EVENT_APP_INITIALIZE = 'wazo/EVENT_APP_INITIALIZE';
const EVENT_ON_LOGOUT = 'wazo/EVENT_ON_LOGOUT';
const EVENT_SEND_IFRAME_MESSAGE = 'wazo/EVENT_SEND_IFRAME_MESSAGE';
const EVENT_SEND_BACKGROUND_MESSAGE = 'wazo/EVENT_SEND_BACKGROUND_MESSAGE';
const EVENT_ON_IFRAME_MESSAGE = 'wazo/EVENT_ON_IFRAME_MESSAGE';
const EVENT_ON_BACKGROUND_MESSAGE = 'wazo/EVENT_ON_BACKGROUND_MESSAGE';
// WDA
const EVENT_CLOSE_LEFT_PANEL = 'wazo/EVENT_CLOSE_LEFT_PANEL';
const EVENT_OPEN_LEFT_PANEL = 'wazo/EVENT_OPEN_LEFT_PANEL';
const EVENT_START_CALL = 'wazo/START_CALL';
const EVENT_ON_CALL_INCOMING = 'wazo/EVENT_ON_CALL_INCOMING';
const EVENT_ON_CALL_MADE = 'wazo/EVENT_ON_CALL_MADE';
const EVENT_ON_CALL_ANSWERED = 'wazo/EVENT_ON_CALL_ANSWERED';
const EVENT_ON_CALL_HUNG_UP = 'wazo/EVENT_ON_CALL_HUNG_UP';
const EVENT_OPEN_LINK = 'wazo/EVENT_OPEN_LINK';
const EVENT_CREATE_MEETING = 'wazo/EVENT_CREATE_MEETING';
const EVENT_OPEN_MEETING_LOBBY = 'wazo/EVENT_OPEN_MEETING_LOBBY';
const EVENT_OPEN_SETTINGS = 'wazo/EVENT_OPEN_SETTINGS';
const EVENT_ON_MEETING_CREATED = 'wazo/EVENT_ON_MEETING_CREATED';
const EVENT_ROUTE_CHANGE = 'wazo/EVENT_ROUTE_CHANGE';
const EVENT_WS_MESSAGE = 'wazo/EVENT_WS_MESSAGE';
const EVENT_PLAY_PROGRESS_SOUND = 'wazo/EVENT_PLAY_PROGRESS_SOUND';
const EVENT_PLAY_NEW_MESSAGE_SOUND = 'wazo/EVENT_PLAY_NEW_MESSAGE_SOUND';
const EVENT_PLAY_INCOMING_CALL_SOUND = 'wazo/EVENT_PLAY_INCOMING_CALL_SOUND';
const EVENT_PLAY_DOUBLE_CALL_SOUND = 'wazo/EVENT_PLAY_DOUBLE_CALL_SOUND';
const EVENT_PLAY_HANGUP_SOUND = 'wazo/EVENT_PLAY_HANGUP_SOUND';
const EVENT_STOP_CURRENT_SOUND = 'wazo/EVENT_STOP_CURRENT_SOUND';
const EVENT_CONFIGURE_SOUNDS = 'wazo/EVENT_CONFIGURE_SOUNDS';
const EVENT_RESET_SOUNDS = 'wazo/EVENT_RESET_SOUNDS';
const EVENT_DISPLAY_NOTIFICATION = 'wazo/EVENT_DISPLAY_NOTIFICATION';
const EVENT_CHANGE_NAVBAR_COLOR = 'wazo/EVENT_CHANGE_NAVBAR_COLOR';
const EVENT_RESET_NAVBAR_COLOR = 'wazo/EVENT_RESET_NAVBAR_COLOR';
const EVENT_DISPLAY_MODAL = 'wazo/EVENT_DISPLAY_MODAL';
const EVENT_REMOVE_MODAL = 'wazo/EVENT_REMOVE_MODAL';
const EVENT_USER_JOIN_ROOM = 'wazo/EVENT_USER_JOIN_ROOM';
const EVENT_USER_LEAVE_ROOM = 'wazo/EVENT_USER_LEAVE_ROOM';
const EVENT_PARTICIPANT_JOIN_ROOM = 'wazo/EVENT_PARTICIPANT_JOIN_ROOM';
const EVENT_PARTICIPANT_LEAVE_ROOM = 'wazo/EVENT_PARTICIPANT_LEAVE_ROOM';
const EVENT_IGNORE_CALL = 'wazo/EVENT_IGNORE_CALL';
const EVENT_ON_NEW_SESSION = 'wazo/EVENT_ON_NEW_SESSION';
const EVENT_UPDATE_BADGE = 'wazo/EVENT_UPDATE_BADGE';
// Portal
const EVENT_ON_CONNECTED_TO_STACK = 'wazo/EVENT_ON_CONNECTED_TO_STACK';
const EVENT_ON_SWITCH_STACK_TENANT = 'wazo/EVENT_ON_SWITCH_STACK_TENANT';
const EVENT_CHANGE_TOOLBAR_DISPLAY = 'wazo/EVENT_CHANGE_TOOLBAR_DISPLAY';
import { EVENT_ON_LOADED, EVENT_APP_UNLOADED, EVENT_PLUGIN_UNLOADED, EVENT_APP_INITIALIZE, EVENT_ON_LOGOUT, EVENT_SEND_IFRAME_MESSAGE, EVENT_SEND_BACKGROUND_MESSAGE, EVENT_ON_IFRAME_MESSAGE, EVENT_ON_BACKGROUND_MESSAGE, EVENT_CLOSE_LEFT_PANEL, EVENT_OPEN_LEFT_PANEL, EVENT_START_CALL, EVENT_ON_CALL_INCOMING, EVENT_ON_CALL_MADE, EVENT_ON_CALL_ANSWERED, EVENT_ON_CALL_ACCEPTED, EVENT_ON_CALL_HUNG_UP, EVENT_OPEN_LINK, EVENT_CREATE_MEETING, EVENT_OPEN_MEETING_LOBBY, EVENT_ON_MEETING_CREATED, EVENT_ROUTE_CHANGE, EVENT_WS_MESSAGE, EVENT_PLAY_PROGRESS_SOUND, EVENT_PLAY_NEW_MESSAGE_SOUND, EVENT_PLAY_INCOMING_CALL_SOUND, EVENT_PLAY_DOUBLE_CALL_SOUND, EVENT_PLAY_HANGUP_SOUND, EVENT_STOP_CURRENT_SOUND, EVENT_CONFIGURE_SOUNDS, EVENT_RESET_SOUNDS, EVENT_DISPLAY_NOTIFICATION, EVENT_CHANGE_NAVBAR_COLOR, EVENT_RESET_NAVBAR_COLOR, EVENT_DISPLAY_MODAL, EVENT_REMOVE_MODAL, EVENT_USER_JOIN_ROOM, EVENT_USER_LEAVE_ROOM, EVENT_PARTICIPANT_JOIN_ROOM, EVENT_PARTICIPANT_LEAVE_ROOM, EVENT_IGNORE_CALL, EVENT_ON_NEW_SESSION, EVENT_UPDATE_BADGE, EVENT_ON_CONNECTED_TO_STACK, EVENT_ON_SWITCH_STACK_TENANT, EVENT_CHANGE_TOOLBAR_DISPLAY, EVENT_MOBILE_HEADER, EVENT_MOBILE_CONTEXTUAL_MENU, EVENT_MOBILE_SHOW_BOTTOM_NAV, EVENT_MOBILE_ON_MENU_ACTION, EVENT_MOBILE_ON_HEADER_BACK, } from './constants';
const initializationTimeoutInMs = 5000;

@@ -55,2 +8,3 @@ export class App {

this.onUnLoaded = (e) => { };
this.onPluginUnLoaded = () => { };
this.onAppUnLoaded = (tabId) => { };

@@ -64,2 +18,3 @@ this.onIframeMessage = (message) => { };

this.onCallAnswered = (call) => { };
this.onCallAccepted = (call) => { };
this.onCallHungUp = (call) => { };

@@ -137,2 +92,24 @@ this.onUnHandledEvent = (event) => { };

this.changeToolbarDisplay = (display) => this._sendMessage(EVENT_CHANGE_TOOLBAR_DISPLAY, { display });
// App to Mobile
this.setMobileHeader = ({ title, callback }, entityId) => {
const id = entityId || this._entityId;
if (id) {
delete this._headerBackCallbacks[id];
if (typeof callback === 'function') {
this._headerBackCallbacks[id] = callback;
}
}
this._sendMessage(EVENT_MOBILE_HEADER, {
headerTitle: title,
emitHeaderBack: !!callback,
entityId: entityId || this._entityId,
});
};
// @WIP
this.setMobileContextualMenu = (contextualMenu, entityId) => this._sendMessage(EVENT_MOBILE_CONTEXTUAL_MENU, { contextualMenu, entityId: entityId || this._entityId });
// @WIP
this.setMobileShowBottomNav = (showBottomNav, entityId) => this._sendMessage(EVENT_MOBILE_SHOW_BOTTOM_NAV, { showBottomNav, entityId: entityId || this._entityId });
// Mobile to app
// @WIP
this.onMobileMenuAction = (id) => this.sendMessageToIframe({ type: EVENT_MOBILE_ON_MENU_ACTION, id });
this._onMessage = (event) => {

@@ -148,7 +125,11 @@ if (!event.data) {

case EVENT_APP_UNLOADED:
delete this._headerBackCallbacks[event.data.tabId];
this.onAppUnLoaded(event.data.tabId);
break;
case EVENT_PLUGIN_UNLOADED:
this._unloadPlugin();
break;
case EVENT_ON_LOGOUT:
this.onLogout();
this._resetEvents();
this._unloadPlugin();
break;

@@ -199,2 +180,5 @@ case EVENT_ON_NEW_SESSION:

break;
case EVENT_ON_CALL_ACCEPTED:
this.onCallAccepted(event.data.call);
break;
case EVENT_ON_CALL_HUNG_UP:

@@ -210,2 +194,12 @@ this.onCallHungUp(event.data.call);

break;
// Mobile
case EVENT_MOBILE_ON_HEADER_BACK:
const action = this._headerBackCallbacks[event.data.entityId || this._entityId];
if (typeof action === 'function') {
action();
}
break;
case EVENT_MOBILE_ON_MENU_ACTION:
this.onMobileMenuAction(event.data);
break;
default:

@@ -261,2 +255,6 @@ this.onUnHandledEvent(event);

};
this._unloadPlugin = () => {
this.onPluginUnLoaded();
this._resetEvents();
};
this._configurePlugin = (configuration) => {

@@ -275,2 +273,3 @@ if (configuration.pluginId) {

this.onUnLoaded = (e) => { };
this.onPluginUnLoaded = () => { };
this.onAppUnLoaded = (tabId) => { };

@@ -285,2 +284,3 @@ this.onIframeMessage = (message) => { };

this.onCallAnswered = (call) => { };
this.onCallAccepted = (call) => { };
this.onCallHungUp = (call) => { };

@@ -304,2 +304,3 @@ this.onUnHandledEvent = (event) => { };

this._queuedMessages = [];
this._headerBackCallbacks = {};
this.context = {

@@ -306,0 +307,0 @@ app: {

import app, { App } from './app';
import softphone from './softphone';
export * from './constants';
export { app, // @deprecated
App, softphone, };

@@ -1,2 +0,2 @@

import { Call, Room, Contact, Context, Meeting, UserInfo, Extra, ModalParameter, Sounds, PluginConfiguration, WDASession, PortalSession, UpdateBadgeArgs } from './types';
import { Call, Room, Contact, Context, Meeting, UserInfo, Extra, ModalParameter, Sounds, PluginConfiguration, WDASession, PortalSession, UpdateBadgeArgs, MobileMenuItem } from './types';
declare global {

@@ -21,4 +21,6 @@ var _setPluginId: Function;

_isBackground: boolean;
_headerBackCallbacks: Record<string, Function>;
onNewSession: (session: WDASession | PortalSession) => void;
onUnLoaded: (e: Event) => void;
onPluginUnLoaded: () => void;
onAppUnLoaded: (tabId: string) => void;

@@ -31,2 +33,3 @@ onIframeMessage: (message: Object) => void;

onCallAnswered: (call: Call) => void;
onCallAccepted: (call: Call) => void;
onCallHungUp: (call: Call) => void;

@@ -79,2 +82,9 @@ onUnHandledEvent: (event: MessageEvent) => void;

changeToolbarDisplay: (display: boolean) => any;
setMobileHeader: ({ title, callback }: {
title?: string | null | undefined;
callback?: Function | null | undefined;
}, entityId?: string) => void;
setMobileContextualMenu: (contextualMenu: MobileMenuItem[], entityId?: string) => any;
setMobileShowBottomNav: (showBottomNav: boolean, entityId?: string) => any;
onMobileMenuAction: (id: string) => any;
_onMessage: (event: MessageEvent) => void;

@@ -85,2 +95,3 @@ _sendMessage: (type: string, payload?: {}) => any;

_setPluginId: (pluginId: string) => void;
_unloadPlugin: () => void;
_configurePlugin: (configuration: PluginConfiguration) => void;

@@ -87,0 +98,0 @@ _resetEvents: () => void;

import app, { App } from './app';
import softphone from './softphone';
export * from './constants';
export { app, // @deprecated
App, softphone, };
//# sourceMappingURL=index.d.ts.map

@@ -263,3 +263,7 @@ export declare enum HostClientType {

};
export type MobileMenuItem = {
label: string;
id: string;
};
export {};
//# sourceMappingURL=types.d.ts.map
{
"name": "@wazo/euc-plugins-sdk",
"version": "0.0.20",
"version": "0.0.21",
"description": "Wazo's Unified Enterprise Communication JavaScript Software Development Kit.",

@@ -66,3 +66,5 @@ "author": "Wazo (http://wazo.io)",

},
"dependencies": {}
"dependencies": {
"events": "^3.3.0"
}
}

@@ -16,4 +16,60 @@ /* global Wazo */

UpdateBadgeArgs,
MobileMenuItem,
} from './types';
import {
EVENT_ON_LOADED,
EVENT_APP_UNLOADED,
EVENT_PLUGIN_UNLOADED,
EVENT_APP_INITIALIZE,
EVENT_ON_LOGOUT,
EVENT_SEND_IFRAME_MESSAGE,
EVENT_SEND_BACKGROUND_MESSAGE,
EVENT_ON_IFRAME_MESSAGE,
EVENT_ON_BACKGROUND_MESSAGE,
EVENT_CLOSE_LEFT_PANEL,
EVENT_OPEN_LEFT_PANEL,
EVENT_START_CALL,
EVENT_ON_CALL_INCOMING,
EVENT_ON_CALL_MADE,
EVENT_ON_CALL_ANSWERED,
EVENT_ON_CALL_ACCEPTED,
EVENT_ON_CALL_HUNG_UP,
EVENT_OPEN_LINK,
EVENT_CREATE_MEETING,
EVENT_OPEN_MEETING_LOBBY,
EVENT_OPEN_SETTINGS,
EVENT_ON_MEETING_CREATED,
EVENT_ROUTE_CHANGE,
EVENT_WS_MESSAGE,
EVENT_PLAY_PROGRESS_SOUND,
EVENT_PLAY_NEW_MESSAGE_SOUND,
EVENT_PLAY_INCOMING_CALL_SOUND,
EVENT_PLAY_DOUBLE_CALL_SOUND,
EVENT_PLAY_HANGUP_SOUND,
EVENT_STOP_CURRENT_SOUND,
EVENT_CONFIGURE_SOUNDS,
EVENT_RESET_SOUNDS,
EVENT_DISPLAY_NOTIFICATION,
EVENT_CHANGE_NAVBAR_COLOR,
EVENT_RESET_NAVBAR_COLOR,
EVENT_DISPLAY_MODAL,
EVENT_REMOVE_MODAL,
EVENT_USER_JOIN_ROOM,
EVENT_USER_LEAVE_ROOM,
EVENT_PARTICIPANT_JOIN_ROOM,
EVENT_PARTICIPANT_LEAVE_ROOM,
EVENT_IGNORE_CALL,
EVENT_ON_NEW_SESSION,
EVENT_UPDATE_BADGE,
EVENT_ON_CONNECTED_TO_STACK,
EVENT_ON_SWITCH_STACK_TENANT,
EVENT_CHANGE_TOOLBAR_DISPLAY,
EVENT_MOBILE_HEADER,
EVENT_MOBILE_CONTEXTUAL_MENU,
EVENT_MOBILE_SHOW_BOTTOM_NAV,
EVENT_MOBILE_ON_MENU_ACTION,
EVENT_MOBILE_ON_HEADER_BACK,
} from './constants';
declare global {

@@ -26,53 +82,2 @@ // Deprecated, use `_configurePlugin` instead

// Global
const EVENT_ON_LOADED = 'wazo/ON_LOADED';
const EVENT_APP_UNLOADED = 'wazo/EVENT_APP_UNLOADED';
const EVENT_APP_INITIALIZE = 'wazo/EVENT_APP_INITIALIZE';
const EVENT_ON_LOGOUT = 'wazo/EVENT_ON_LOGOUT';
const EVENT_SEND_IFRAME_MESSAGE = 'wazo/EVENT_SEND_IFRAME_MESSAGE';
const EVENT_SEND_BACKGROUND_MESSAGE = 'wazo/EVENT_SEND_BACKGROUND_MESSAGE';
const EVENT_ON_IFRAME_MESSAGE = 'wazo/EVENT_ON_IFRAME_MESSAGE';
const EVENT_ON_BACKGROUND_MESSAGE = 'wazo/EVENT_ON_BACKGROUND_MESSAGE';
// WDA
const EVENT_CLOSE_LEFT_PANEL = 'wazo/EVENT_CLOSE_LEFT_PANEL';
const EVENT_OPEN_LEFT_PANEL = 'wazo/EVENT_OPEN_LEFT_PANEL';
const EVENT_START_CALL = 'wazo/START_CALL';
const EVENT_ON_CALL_INCOMING = 'wazo/EVENT_ON_CALL_INCOMING';
const EVENT_ON_CALL_MADE = 'wazo/EVENT_ON_CALL_MADE';
const EVENT_ON_CALL_ANSWERED = 'wazo/EVENT_ON_CALL_ANSWERED';
const EVENT_ON_CALL_HUNG_UP = 'wazo/EVENT_ON_CALL_HUNG_UP';
const EVENT_OPEN_LINK = 'wazo/EVENT_OPEN_LINK';
const EVENT_CREATE_MEETING = 'wazo/EVENT_CREATE_MEETING';
const EVENT_OPEN_MEETING_LOBBY = 'wazo/EVENT_OPEN_MEETING_LOBBY';
const EVENT_OPEN_SETTINGS = 'wazo/EVENT_OPEN_SETTINGS';
const EVENT_ON_MEETING_CREATED = 'wazo/EVENT_ON_MEETING_CREATED';
const EVENT_ROUTE_CHANGE = 'wazo/EVENT_ROUTE_CHANGE';
const EVENT_WS_MESSAGE = 'wazo/EVENT_WS_MESSAGE';
const EVENT_PLAY_PROGRESS_SOUND = 'wazo/EVENT_PLAY_PROGRESS_SOUND';
const EVENT_PLAY_NEW_MESSAGE_SOUND = 'wazo/EVENT_PLAY_NEW_MESSAGE_SOUND';
const EVENT_PLAY_INCOMING_CALL_SOUND = 'wazo/EVENT_PLAY_INCOMING_CALL_SOUND';
const EVENT_PLAY_DOUBLE_CALL_SOUND = 'wazo/EVENT_PLAY_DOUBLE_CALL_SOUND';
const EVENT_PLAY_HANGUP_SOUND = 'wazo/EVENT_PLAY_HANGUP_SOUND';
const EVENT_STOP_CURRENT_SOUND = 'wazo/EVENT_STOP_CURRENT_SOUND';
const EVENT_CONFIGURE_SOUNDS = 'wazo/EVENT_CONFIGURE_SOUNDS';
const EVENT_RESET_SOUNDS = 'wazo/EVENT_RESET_SOUNDS';
const EVENT_DISPLAY_NOTIFICATION = 'wazo/EVENT_DISPLAY_NOTIFICATION';
const EVENT_CHANGE_NAVBAR_COLOR = 'wazo/EVENT_CHANGE_NAVBAR_COLOR';
const EVENT_RESET_NAVBAR_COLOR = 'wazo/EVENT_RESET_NAVBAR_COLOR';
const EVENT_DISPLAY_MODAL = 'wazo/EVENT_DISPLAY_MODAL';
const EVENT_REMOVE_MODAL = 'wazo/EVENT_REMOVE_MODAL';
const EVENT_USER_JOIN_ROOM = 'wazo/EVENT_USER_JOIN_ROOM';
const EVENT_USER_LEAVE_ROOM = 'wazo/EVENT_USER_LEAVE_ROOM';
const EVENT_PARTICIPANT_JOIN_ROOM = 'wazo/EVENT_PARTICIPANT_JOIN_ROOM';
const EVENT_PARTICIPANT_LEAVE_ROOM = 'wazo/EVENT_PARTICIPANT_LEAVE_ROOM';
const EVENT_IGNORE_CALL = 'wazo/EVENT_IGNORE_CALL';
const EVENT_ON_NEW_SESSION = 'wazo/EVENT_ON_NEW_SESSION';
const EVENT_UPDATE_BADGE = 'wazo/EVENT_UPDATE_BADGE';
// Portal
const EVENT_ON_CONNECTED_TO_STACK = 'wazo/EVENT_ON_CONNECTED_TO_STACK';
const EVENT_ON_SWITCH_STACK_TENANT = 'wazo/EVENT_ON_SWITCH_STACK_TENANT';
const EVENT_CHANGE_TOOLBAR_DISPLAY = 'wazo/EVENT_CHANGE_TOOLBAR_DISPLAY';
const initializationTimeoutInMs = 5000;

@@ -95,2 +100,3 @@

_isBackground: boolean;
_headerBackCallbacks: Record<string, Function>;

@@ -100,2 +106,3 @@ // Global

onUnLoaded = (e: Event) => {};
onPluginUnLoaded = () => {};
onAppUnLoaded = (tabId: string) => {};

@@ -110,2 +117,3 @@ onIframeMessage = (message: Object) => { };

onCallAnswered = (call: Call) => {};
onCallAccepted = (call: Call) => {};
onCallHungUp = (call: Call) => {};

@@ -135,2 +143,3 @@ onUnHandledEvent = (event: MessageEvent) => {};

this._queuedMessages = [];
this._headerBackCallbacks = {};

@@ -270,2 +279,30 @@ this.context = {

// App to Mobile
setMobileHeader = ({ title, callback }: { title?: string | null, callback?: Function | null }, entityId?: string) => {
const id = entityId || this._entityId;
if (id) {
delete this._headerBackCallbacks[id];
if (typeof callback === 'function') {
this._headerBackCallbacks[id] = callback;
}
}
this._sendMessage(EVENT_MOBILE_HEADER, {
headerTitle: title,
emitHeaderBack: !!callback,
entityId: entityId || this._entityId,
});
}
// @WIP
setMobileContextualMenu = (contextualMenu: MobileMenuItem[], entityId?: string) => this._sendMessage(EVENT_MOBILE_CONTEXTUAL_MENU, { contextualMenu, entityId: entityId || this._entityId });
// @WIP
setMobileShowBottomNav = (showBottomNav: boolean, entityId?: string) => this._sendMessage(EVENT_MOBILE_SHOW_BOTTOM_NAV, { showBottomNav, entityId: entityId || this._entityId });
// Mobile to app
// @WIP
onMobileMenuAction = (id: string) => this.sendMessageToIframe({ type: EVENT_MOBILE_ON_MENU_ACTION, id });
_onMessage = (event: MessageEvent) => {

@@ -282,7 +319,11 @@ if (!event.data) {

case EVENT_APP_UNLOADED:
delete this._headerBackCallbacks[event.data.tabId];
this.onAppUnLoaded(event.data.tabId);
break;
case EVENT_PLUGIN_UNLOADED:
this._unloadPlugin();
break;
case EVENT_ON_LOGOUT:
this.onLogout();
this._resetEvents();
this._unloadPlugin();
break;

@@ -334,2 +375,5 @@ case EVENT_ON_NEW_SESSION:

break;
case EVENT_ON_CALL_ACCEPTED:
this.onCallAccepted(event.data.call);
break;
case EVENT_ON_CALL_HUNG_UP:

@@ -348,2 +392,14 @@ this.onCallHungUp(event.data.call);

// Mobile
case EVENT_MOBILE_ON_HEADER_BACK:
const action = this._headerBackCallbacks[event.data.entityId || this._entityId];
if (typeof action === 'function') {
action();
}
break;
case EVENT_MOBILE_ON_MENU_ACTION:
this.onMobileMenuAction(event.data);
break;
default:

@@ -412,2 +468,7 @@ this.onUnHandledEvent(event);

_unloadPlugin = () => {
this.onPluginUnLoaded();
this._resetEvents();
}
_configurePlugin = (configuration: PluginConfiguration) => {

@@ -427,2 +488,3 @@ if (configuration.pluginId) {

this.onUnLoaded = (e: Event) => {};
this.onPluginUnLoaded = () => {};
this.onAppUnLoaded = (tabId: string) => {};

@@ -438,2 +500,3 @@ this.onIframeMessage = (message: Object) => { };

this.onCallAnswered = (call: Call) => {};
this.onCallAccepted = (call: Call) => {};
this.onCallHungUp = (call: Call) => {};

@@ -440,0 +503,0 @@ this.onUnHandledEvent = (event: MessageEvent) => {};

import app, { App } from './app';
import softphone from './softphone';
export * from './constants';
export {

@@ -5,0 +6,0 @@ app, // @deprecated

@@ -260,1 +260,5 @@ export enum HostClientType {

export type MobileMenuItem = {
label: string,
id: string,
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc