@wazo/euc-plugins-sdk
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -102,2 +102,24 @@ "use strict"; | ||
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) => { | ||
@@ -113,2 +135,3 @@ if (!event.data) { | ||
case constants_1.EVENT_APP_UNLOADED: | ||
delete this._headerBackCallbacks[event.data.tabId]; | ||
this.onAppUnLoaded(event.data.tabId); | ||
@@ -180,2 +203,12 @@ break; | ||
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: | ||
@@ -273,2 +306,3 @@ this.onUnHandledEvent(event); | ||
this._queuedMessages = []; | ||
this._headerBackCallbacks = {}; | ||
this.context = { | ||
@@ -275,0 +309,0 @@ app: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EVENT_CHANGE_TOOLBAR_DISPLAY = exports.EVENT_ON_SWITCH_STACK_TENANT = exports.EVENT_ON_CONNECTED_TO_STACK = exports.EVENT_UPDATE_BADGE = exports.EVENT_ON_NEW_SESSION = exports.EVENT_IGNORE_CALL = exports.EVENT_PARTICIPANT_LEAVE_ROOM = exports.EVENT_PARTICIPANT_JOIN_ROOM = exports.EVENT_USER_LEAVE_ROOM = exports.EVENT_USER_JOIN_ROOM = exports.EVENT_REMOVE_MODAL = exports.EVENT_DISPLAY_MODAL = exports.EVENT_RESET_NAVBAR_COLOR = exports.EVENT_CHANGE_NAVBAR_COLOR = exports.EVENT_DISPLAY_NOTIFICATION = exports.EVENT_RESET_SOUNDS = exports.EVENT_CONFIGURE_SOUNDS = exports.EVENT_STOP_CURRENT_SOUND = exports.EVENT_PLAY_HANGUP_SOUND = exports.EVENT_PLAY_DOUBLE_CALL_SOUND = exports.EVENT_PLAY_INCOMING_CALL_SOUND = exports.EVENT_PLAY_NEW_MESSAGE_SOUND = exports.EVENT_PLAY_PROGRESS_SOUND = exports.EVENT_WS_MESSAGE = exports.EVENT_ROUTE_CHANGE = exports.EVENT_ON_MEETING_CREATED = exports.EVENT_OPEN_SETTINGS = exports.EVENT_OPEN_MEETING_LOBBY = exports.EVENT_CREATE_MEETING = exports.EVENT_OPEN_LINK = exports.EVENT_ON_CALL_HUNG_UP = exports.EVENT_ON_CALL_ACCEPTED = exports.EVENT_ON_CALL_ANSWERED = exports.EVENT_ON_CALL_MADE = exports.EVENT_ON_CALL_INCOMING = exports.EVENT_START_CALL = exports.EVENT_OPEN_LEFT_PANEL = exports.EVENT_CLOSE_LEFT_PANEL = exports.EVENT_ON_BACKGROUND_MESSAGE = exports.EVENT_ON_IFRAME_MESSAGE = exports.EVENT_SEND_BACKGROUND_MESSAGE = exports.EVENT_SEND_IFRAME_MESSAGE = exports.EVENT_ON_LOGOUT = exports.EVENT_APP_INITIALIZE = exports.EVENT_PLUGIN_UNLOADED = exports.EVENT_APP_UNLOADED = exports.EVENT_ON_LOADED = void 0; | ||
exports.EVENT_MOBILE_SHOW_BOTTOM_NAV = exports.EVENT_MOBILE_CONTEXTUAL_MENU = exports.EVENT_MOBILE_HEADER = exports.EVENT_CHANGE_TOOLBAR_DISPLAY = exports.EVENT_ON_SWITCH_STACK_TENANT = exports.EVENT_ON_CONNECTED_TO_STACK = exports.EVENT_UPDATE_BADGE = exports.EVENT_ON_NEW_SESSION = exports.EVENT_IGNORE_CALL = exports.EVENT_PARTICIPANT_LEAVE_ROOM = exports.EVENT_PARTICIPANT_JOIN_ROOM = exports.EVENT_USER_LEAVE_ROOM = exports.EVENT_USER_JOIN_ROOM = exports.EVENT_REMOVE_MODAL = exports.EVENT_DISPLAY_MODAL = exports.EVENT_RESET_NAVBAR_COLOR = exports.EVENT_CHANGE_NAVBAR_COLOR = exports.EVENT_DISPLAY_NOTIFICATION = exports.EVENT_RESET_SOUNDS = exports.EVENT_CONFIGURE_SOUNDS = exports.EVENT_STOP_CURRENT_SOUND = exports.EVENT_PLAY_HANGUP_SOUND = exports.EVENT_PLAY_DOUBLE_CALL_SOUND = exports.EVENT_PLAY_INCOMING_CALL_SOUND = exports.EVENT_PLAY_NEW_MESSAGE_SOUND = exports.EVENT_PLAY_PROGRESS_SOUND = exports.EVENT_WS_MESSAGE = exports.EVENT_ROUTE_CHANGE = exports.EVENT_ON_MEETING_CREATED = exports.EVENT_OPEN_SETTINGS = exports.EVENT_OPEN_MEETING_LOBBY = exports.EVENT_CREATE_MEETING = exports.EVENT_OPEN_LINK = exports.EVENT_ON_CALL_HUNG_UP = exports.EVENT_ON_CALL_ACCEPTED = exports.EVENT_ON_CALL_ANSWERED = exports.EVENT_ON_CALL_MADE = exports.EVENT_ON_CALL_INCOMING = exports.EVENT_START_CALL = exports.EVENT_OPEN_LEFT_PANEL = exports.EVENT_CLOSE_LEFT_PANEL = exports.EVENT_ON_BACKGROUND_MESSAGE = exports.EVENT_ON_IFRAME_MESSAGE = exports.EVENT_SEND_BACKGROUND_MESSAGE = exports.EVENT_SEND_IFRAME_MESSAGE = exports.EVENT_ON_LOGOUT = exports.EVENT_APP_INITIALIZE = exports.EVENT_PLUGIN_UNLOADED = exports.EVENT_APP_UNLOADED = exports.EVENT_ON_LOADED = void 0; | ||
exports.EVENT_MOBILE_ON_HEADER_BACK = exports.EVENT_MOBILE_ON_MENU_ACTION = void 0; | ||
// Global | ||
@@ -54,1 +55,7 @@ exports.EVENT_ON_LOADED = 'wazo/ON_LOADED'; | ||
exports.EVENT_CHANGE_TOOLBAR_DISPLAY = 'wazo/EVENT_CHANGE_TOOLBAR_DISPLAY'; | ||
// Mobile | ||
exports.EVENT_MOBILE_HEADER = 'wazo/mobile/EVENT_MOBILE_HEADER'; | ||
exports.EVENT_MOBILE_CONTEXTUAL_MENU = 'wazo/mobile/EVENT_MOBILE_CONTEXTUAL_MENU'; | ||
exports.EVENT_MOBILE_SHOW_BOTTOM_NAV = 'wazo/mobile/EVENT_MOBILE_SHOW_BOTTOM_NAV'; | ||
exports.EVENT_MOBILE_ON_MENU_ACTION = 'wazo/mobile/EVENT_MOBILE_ON_MENU_ACTION'; | ||
exports.EVENT_MOBILE_ON_HEADER_BACK = 'wazo/mobile/EVENT_MOBILE_ON_HEADER_BACK'; |
@@ -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,2 +21,3 @@ var _setPluginId: Function; | ||
_isBackground: boolean; | ||
_headerBackCallbacks: Record<string, Function>; | ||
onNewSession: (session: WDASession | PortalSession) => void; | ||
@@ -80,2 +81,9 @@ onUnLoaded: (e: Event) => 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; | ||
@@ -82,0 +90,0 @@ _sendMessage: (type: string, payload?: {}) => any; |
@@ -48,2 +48,7 @@ export declare const EVENT_ON_LOADED = "wazo/ON_LOADED"; | ||
export declare const EVENT_CHANGE_TOOLBAR_DISPLAY = "wazo/EVENT_CHANGE_TOOLBAR_DISPLAY"; | ||
export declare const EVENT_MOBILE_HEADER = "wazo/mobile/EVENT_MOBILE_HEADER"; | ||
export declare const EVENT_MOBILE_CONTEXTUAL_MENU = "wazo/mobile/EVENT_MOBILE_CONTEXTUAL_MENU"; | ||
export declare const EVENT_MOBILE_SHOW_BOTTOM_NAV = "wazo/mobile/EVENT_MOBILE_SHOW_BOTTOM_NAV"; | ||
export declare const EVENT_MOBILE_ON_MENU_ACTION = "wazo/mobile/EVENT_MOBILE_ON_MENU_ACTION"; | ||
export declare const EVENT_MOBILE_ON_HEADER_BACK = "wazo/mobile/EVENT_MOBILE_ON_HEADER_BACK"; | ||
//# sourceMappingURL=constants.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,2 +0,2 @@ | ||
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, } from './constants'; | ||
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; | ||
@@ -90,2 +90,24 @@ export class App { | ||
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) => { | ||
@@ -101,2 +123,3 @@ if (!event.data) { | ||
case EVENT_APP_UNLOADED: | ||
delete this._headerBackCallbacks[event.data.tabId]; | ||
this.onAppUnLoaded(event.data.tabId); | ||
@@ -168,2 +191,12 @@ break; | ||
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: | ||
@@ -265,2 +298,3 @@ this.onUnHandledEvent(event); | ||
this._queuedMessages = []; | ||
this._headerBackCallbacks = {}; | ||
this.context = { | ||
@@ -267,0 +301,0 @@ app: { |
@@ -51,1 +51,7 @@ // Global | ||
export const EVENT_CHANGE_TOOLBAR_DISPLAY = 'wazo/EVENT_CHANGE_TOOLBAR_DISPLAY'; | ||
// Mobile | ||
export const EVENT_MOBILE_HEADER = 'wazo/mobile/EVENT_MOBILE_HEADER'; | ||
export const EVENT_MOBILE_CONTEXTUAL_MENU = 'wazo/mobile/EVENT_MOBILE_CONTEXTUAL_MENU'; | ||
export const EVENT_MOBILE_SHOW_BOTTOM_NAV = 'wazo/mobile/EVENT_MOBILE_SHOW_BOTTOM_NAV'; | ||
export const EVENT_MOBILE_ON_MENU_ACTION = 'wazo/mobile/EVENT_MOBILE_ON_MENU_ACTION'; | ||
export const EVENT_MOBILE_ON_HEADER_BACK = 'wazo/mobile/EVENT_MOBILE_ON_HEADER_BACK'; |
@@ -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,2 +21,3 @@ var _setPluginId: Function; | ||
_isBackground: boolean; | ||
_headerBackCallbacks: Record<string, Function>; | ||
onNewSession: (session: WDASession | PortalSession) => void; | ||
@@ -80,2 +81,9 @@ onUnLoaded: (e: Event) => 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; | ||
@@ -82,0 +90,0 @@ _sendMessage: (type: string, payload?: {}) => any; |
@@ -48,2 +48,7 @@ export declare const EVENT_ON_LOADED = "wazo/ON_LOADED"; | ||
export declare const EVENT_CHANGE_TOOLBAR_DISPLAY = "wazo/EVENT_CHANGE_TOOLBAR_DISPLAY"; | ||
export declare const EVENT_MOBILE_HEADER = "wazo/mobile/EVENT_MOBILE_HEADER"; | ||
export declare const EVENT_MOBILE_CONTEXTUAL_MENU = "wazo/mobile/EVENT_MOBILE_CONTEXTUAL_MENU"; | ||
export declare const EVENT_MOBILE_SHOW_BOTTOM_NAV = "wazo/mobile/EVENT_MOBILE_SHOW_BOTTOM_NAV"; | ||
export declare const EVENT_MOBILE_ON_MENU_ACTION = "wazo/mobile/EVENT_MOBILE_ON_MENU_ACTION"; | ||
export declare const EVENT_MOBILE_ON_HEADER_BACK = "wazo/mobile/EVENT_MOBILE_ON_HEADER_BACK"; | ||
//# sourceMappingURL=constants.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": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Wazo's Unified Enterprise Communication JavaScript Software Development Kit.", | ||
@@ -5,0 +5,0 @@ "author": "Wazo (http://wazo.io)", |
@@ -16,2 +16,3 @@ /* global Wazo */ | ||
UpdateBadgeArgs, | ||
MobileMenuItem, | ||
} from './types'; | ||
@@ -67,2 +68,7 @@ | ||
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'; | ||
@@ -94,2 +100,3 @@ | ||
_isBackground: boolean; | ||
_headerBackCallbacks: Record<string, Function>; | ||
@@ -134,2 +141,3 @@ // Global | ||
this._queuedMessages = []; | ||
this._headerBackCallbacks = {}; | ||
@@ -269,2 +277,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) => { | ||
@@ -281,2 +317,3 @@ if (!event.data) { | ||
case EVENT_APP_UNLOADED: | ||
delete this._headerBackCallbacks[event.data.tabId]; | ||
this.onAppUnLoaded(event.data.tabId); | ||
@@ -352,2 +389,14 @@ 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: | ||
@@ -354,0 +403,0 @@ this.onUnHandledEvent(event); |
@@ -53,1 +53,8 @@ // Global | ||
export const EVENT_CHANGE_TOOLBAR_DISPLAY = 'wazo/EVENT_CHANGE_TOOLBAR_DISPLAY'; | ||
// Mobile | ||
export const EVENT_MOBILE_HEADER = 'wazo/mobile/EVENT_MOBILE_HEADER'; | ||
export const EVENT_MOBILE_CONTEXTUAL_MENU = 'wazo/mobile/EVENT_MOBILE_CONTEXTUAL_MENU'; | ||
export const EVENT_MOBILE_SHOW_BOTTOM_NAV = 'wazo/mobile/EVENT_MOBILE_SHOW_BOTTOM_NAV'; | ||
export const EVENT_MOBILE_ON_MENU_ACTION = 'wazo/mobile/EVENT_MOBILE_ON_MENU_ACTION'; | ||
export const EVENT_MOBILE_ON_HEADER_BACK = 'wazo/mobile/EVENT_MOBILE_ON_HEADER_BACK'; |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181342
3794