@wazo/sdk 0.38.1 → 0.38.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -7
- package/dist/wazo-sdk.js +5 -5
- package/esm/index.js +103 -42
- package/esm/simple/Auth.js +103 -42
- package/esm/simple/Configuration.js +103 -42
- package/esm/simple/Phone.js +103 -42
- package/esm/simple/Softphone.js +104 -43
- package/esm/simple/index.js +103 -42
- package/esm/simple/room/LocalParticipant.js +103 -42
- package/esm/simple/room/Participant.js +103 -42
- package/esm/simple/room/RemoteParticipant.js +103 -42
- package/esm/simple/room/Room.js +103 -42
- package/esm/simple/room/SipRoom.js +103 -42
- package/esm/simple/room/Stream.js +103 -42
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +103 -42
- package/esm/simple/utils.js +103 -42
- package/lib/index.js +103 -42
- package/lib/simple/Auth.js +103 -42
- package/lib/simple/Configuration.js +103 -42
- package/lib/simple/Phone.js +103 -42
- package/lib/simple/Softphone.js +104 -43
- package/lib/simple/index.js +103 -42
- package/lib/simple/room/LocalParticipant.js +103 -42
- package/lib/simple/room/Participant.js +103 -42
- package/lib/simple/room/RemoteParticipant.js +103 -42
- package/lib/simple/room/Room.js +103 -42
- package/lib/simple/room/SipRoom.js +103 -42
- package/lib/simple/room/Stream.js +103 -42
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +103 -42
- package/lib/simple/utils.js +103 -42
- package/package.json +1 -1
- package/src/simple/Softphone.js +104 -43
|
@@ -13844,8 +13844,6 @@ class Checker {
|
|
|
13844
13844
|
/* eslint-disable no-unused-vars */
|
|
13845
13845
|
/* global window, document */
|
|
13846
13846
|
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13847
|
-
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13848
|
-
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13849
13847
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13850
13848
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13851
13849
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -13858,6 +13856,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13858
13856
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13859
13857
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13860
13858
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13859
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13860
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
13861
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13861
13862
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13862
13863
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13863
13864
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13871,31 +13872,51 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13871
13872
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13872
13873
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13873
13874
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13875
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13876
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13877
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13878
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
13879
|
+
|
|
13880
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13881
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13874
13882
|
|
|
13875
13883
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13876
|
-
const
|
|
13884
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
13877
13885
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13878
13886
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13879
13887
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
13880
13888
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13881
13889
|
|
|
13882
13890
|
class Softphone {
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13891
|
+
|
|
13892
|
+
|
|
13893
|
+
|
|
13894
|
+
|
|
13895
|
+
|
|
13896
|
+
|
|
13897
|
+
|
|
13898
|
+
// Message waiting for the iframe to be loaded
|
|
13899
|
+
|
|
13888
13900
|
|
|
13889
13901
|
onLinkEnabled(link ) {}
|
|
13890
13902
|
onIFrameLoaded() {}
|
|
13891
13903
|
|
|
13892
|
-
|
|
13904
|
+
onCallLocallyAnswered(call ) {}
|
|
13905
|
+
onCallEstablished(call ) {}
|
|
13906
|
+
onOutgoingCallMade(call ) {}
|
|
13893
13907
|
onCallIncoming(call ) {}
|
|
13908
|
+
onCallRejected(call ) {}
|
|
13894
13909
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13910
|
+
|
|
13895
13911
|
onCardSaved(card ) {}
|
|
13912
|
+
onCardCanceled() {}
|
|
13896
13913
|
onAuthenticated(session ) {}
|
|
13897
13914
|
onLoggedOut() {}
|
|
13898
|
-
|
|
13915
|
+
|
|
13916
|
+
onSearchOptions(fieldId , query ) {
|
|
13917
|
+
this.onOptionsResults(fieldId, []);
|
|
13918
|
+
}
|
|
13919
|
+
|
|
13899
13920
|
onDisplayLinkedOption(optionId ) {}
|
|
13900
13921
|
onWazoContactSearch(query ) {}
|
|
13901
13922
|
onAgentLoggedIn() {}
|
|
@@ -13918,18 +13939,26 @@ class Softphone {
|
|
|
13918
13939
|
onStopRecording() {}
|
|
13919
13940
|
onUnHandledEvent(event ) {}
|
|
13920
13941
|
|
|
13921
|
-
init({
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13942
|
+
init({
|
|
13943
|
+
url,
|
|
13944
|
+
width,
|
|
13945
|
+
height,
|
|
13946
|
+
server,
|
|
13947
|
+
port,
|
|
13948
|
+
language,
|
|
13949
|
+
wrapUpDuration,
|
|
13950
|
+
enableAgent = true,
|
|
13951
|
+
tenantId,
|
|
13952
|
+
debug = false,
|
|
13953
|
+
} = {}) {
|
|
13954
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
13955
|
+
this.width = width || 500;
|
|
13956
|
+
this.height = height || 600;
|
|
13957
|
+
this.displayed = false;
|
|
13958
|
+
this.iframeLoaded = false;
|
|
13932
13959
|
|
|
13960
|
+
this.iframeLoaded = false;
|
|
13961
|
+
this._pendingMessages = [];
|
|
13933
13962
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13934
13963
|
|
|
13935
13964
|
if (!server) {
|
|
@@ -13937,25 +13966,33 @@ class Softphone {
|
|
|
13937
13966
|
server = 'stack.dev.wazo.io';
|
|
13938
13967
|
}
|
|
13939
13968
|
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13969
|
+
const config = { server };
|
|
13970
|
+
if (language) {
|
|
13971
|
+
config.language = language;
|
|
13972
|
+
}
|
|
13973
|
+
if (port) {
|
|
13974
|
+
config.port = port;
|
|
13975
|
+
}
|
|
13976
|
+
if (tenantId) {
|
|
13977
|
+
config.tenantId = tenantId;
|
|
13978
|
+
}
|
|
13979
|
+
if (wrapUpDuration) {
|
|
13980
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
13981
|
+
}
|
|
13951
13982
|
|
|
13952
|
-
|
|
13953
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13954
|
-
}
|
|
13983
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
13955
13984
|
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13985
|
+
if (enableAgent) {
|
|
13986
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13987
|
+
}
|
|
13988
|
+
|
|
13989
|
+
if (debug) {
|
|
13990
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
13991
|
+
}
|
|
13992
|
+
|
|
13993
|
+
this._createIframe(() => {
|
|
13994
|
+
this.iframeLoaded = true;
|
|
13995
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
13959
13996
|
|
|
13960
13997
|
this.onIFrameLoaded();
|
|
13961
13998
|
});
|
|
@@ -14016,6 +14053,18 @@ class Softphone {
|
|
|
14016
14053
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14017
14054
|
}
|
|
14018
14055
|
|
|
14056
|
+
setCardValue(field , value ) {
|
|
14057
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
14058
|
+
}
|
|
14059
|
+
|
|
14060
|
+
injectCss(css ) {
|
|
14061
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
14062
|
+
}
|
|
14063
|
+
|
|
14064
|
+
customizeAppearance(themes , translations , assets ) {
|
|
14065
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
14066
|
+
}
|
|
14067
|
+
|
|
14019
14068
|
_createIframe(cb = () => {}) {
|
|
14020
14069
|
this.iframe = document.createElement('iframe');
|
|
14021
14070
|
// $FlowFixMe
|
|
@@ -14061,8 +14110,8 @@ class Softphone {
|
|
|
14061
14110
|
}
|
|
14062
14111
|
|
|
14063
14112
|
switch (event.data.type) {
|
|
14064
|
-
case
|
|
14065
|
-
this.
|
|
14113
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
14114
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
14066
14115
|
break;
|
|
14067
14116
|
case SDK_CALL_ENDED: {
|
|
14068
14117
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -14150,6 +14199,18 @@ class Softphone {
|
|
|
14150
14199
|
case BRIDGE_ON_STOP_RECORDING:
|
|
14151
14200
|
this.onStopRecording();
|
|
14152
14201
|
break;
|
|
14202
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14203
|
+
this.onCardCanceled();
|
|
14204
|
+
break;
|
|
14205
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
14206
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
14207
|
+
break;
|
|
14208
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
14209
|
+
this.onCallRejected(event.data.call);
|
|
14210
|
+
break;
|
|
14211
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
14212
|
+
this.onCallEstablished(event.data.call);
|
|
14213
|
+
break;
|
|
14153
14214
|
default:
|
|
14154
14215
|
this.onUnHandledEvent(event);
|
|
14155
14216
|
break;
|
|
@@ -14157,8 +14218,8 @@ class Softphone {
|
|
|
14157
14218
|
}
|
|
14158
14219
|
|
|
14159
14220
|
_sendMessage(type , payload = {}) {
|
|
14160
|
-
if (!this.iframe) {
|
|
14161
|
-
|
|
14221
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14222
|
+
this._pendingMessages.push([type, payload]);
|
|
14162
14223
|
return;
|
|
14163
14224
|
}
|
|
14164
14225
|
|
|
@@ -13925,8 +13925,6 @@ class Checker {
|
|
|
13925
13925
|
/* eslint-disable no-unused-vars */
|
|
13926
13926
|
/* global window, document */
|
|
13927
13927
|
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13928
|
-
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13929
|
-
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13930
13928
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13931
13929
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13932
13930
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -13939,6 +13937,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13939
13937
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13940
13938
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13941
13939
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13940
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13941
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
13942
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13942
13943
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13943
13944
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13944
13945
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13952,31 +13953,51 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13952
13953
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13953
13954
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13954
13955
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13956
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13957
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13958
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13959
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
13960
|
+
|
|
13961
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13962
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13955
13963
|
|
|
13956
13964
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13957
|
-
const
|
|
13965
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
13958
13966
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13959
13967
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13960
13968
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
13961
13969
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13962
13970
|
|
|
13963
13971
|
class Softphone {
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
13972
|
+
|
|
13973
|
+
|
|
13974
|
+
|
|
13975
|
+
|
|
13976
|
+
|
|
13977
|
+
|
|
13978
|
+
|
|
13979
|
+
// Message waiting for the iframe to be loaded
|
|
13980
|
+
|
|
13969
13981
|
|
|
13970
13982
|
onLinkEnabled(link ) {}
|
|
13971
13983
|
onIFrameLoaded() {}
|
|
13972
13984
|
|
|
13973
|
-
|
|
13985
|
+
onCallLocallyAnswered(call ) {}
|
|
13986
|
+
onCallEstablished(call ) {}
|
|
13987
|
+
onOutgoingCallMade(call ) {}
|
|
13974
13988
|
onCallIncoming(call ) {}
|
|
13989
|
+
onCallRejected(call ) {}
|
|
13975
13990
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13991
|
+
|
|
13976
13992
|
onCardSaved(card ) {}
|
|
13993
|
+
onCardCanceled() {}
|
|
13977
13994
|
onAuthenticated(session ) {}
|
|
13978
13995
|
onLoggedOut() {}
|
|
13979
|
-
|
|
13996
|
+
|
|
13997
|
+
onSearchOptions(fieldId , query ) {
|
|
13998
|
+
this.onOptionsResults(fieldId, []);
|
|
13999
|
+
}
|
|
14000
|
+
|
|
13980
14001
|
onDisplayLinkedOption(optionId ) {}
|
|
13981
14002
|
onWazoContactSearch(query ) {}
|
|
13982
14003
|
onAgentLoggedIn() {}
|
|
@@ -13999,18 +14020,26 @@ class Softphone {
|
|
|
13999
14020
|
onStopRecording() {}
|
|
14000
14021
|
onUnHandledEvent(event ) {}
|
|
14001
14022
|
|
|
14002
|
-
init({
|
|
14003
|
-
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14023
|
+
init({
|
|
14024
|
+
url,
|
|
14025
|
+
width,
|
|
14026
|
+
height,
|
|
14027
|
+
server,
|
|
14028
|
+
port,
|
|
14029
|
+
language,
|
|
14030
|
+
wrapUpDuration,
|
|
14031
|
+
enableAgent = true,
|
|
14032
|
+
tenantId,
|
|
14033
|
+
debug = false,
|
|
14034
|
+
} = {}) {
|
|
14035
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
14036
|
+
this.width = width || 500;
|
|
14037
|
+
this.height = height || 600;
|
|
14038
|
+
this.displayed = false;
|
|
14039
|
+
this.iframeLoaded = false;
|
|
14013
14040
|
|
|
14041
|
+
this.iframeLoaded = false;
|
|
14042
|
+
this._pendingMessages = [];
|
|
14014
14043
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14015
14044
|
|
|
14016
14045
|
if (!server) {
|
|
@@ -14018,25 +14047,33 @@ class Softphone {
|
|
|
14018
14047
|
server = 'stack.dev.wazo.io';
|
|
14019
14048
|
}
|
|
14020
14049
|
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14050
|
+
const config = { server };
|
|
14051
|
+
if (language) {
|
|
14052
|
+
config.language = language;
|
|
14053
|
+
}
|
|
14054
|
+
if (port) {
|
|
14055
|
+
config.port = port;
|
|
14056
|
+
}
|
|
14057
|
+
if (tenantId) {
|
|
14058
|
+
config.tenantId = tenantId;
|
|
14059
|
+
}
|
|
14060
|
+
if (wrapUpDuration) {
|
|
14061
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
14062
|
+
}
|
|
14032
14063
|
|
|
14033
|
-
|
|
14034
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
14035
|
-
}
|
|
14064
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
14036
14065
|
|
|
14037
|
-
|
|
14038
|
-
|
|
14039
|
-
|
|
14066
|
+
if (enableAgent) {
|
|
14067
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
14068
|
+
}
|
|
14069
|
+
|
|
14070
|
+
if (debug) {
|
|
14071
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
14072
|
+
}
|
|
14073
|
+
|
|
14074
|
+
this._createIframe(() => {
|
|
14075
|
+
this.iframeLoaded = true;
|
|
14076
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
14040
14077
|
|
|
14041
14078
|
this.onIFrameLoaded();
|
|
14042
14079
|
});
|
|
@@ -14097,6 +14134,18 @@ class Softphone {
|
|
|
14097
14134
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14098
14135
|
}
|
|
14099
14136
|
|
|
14137
|
+
setCardValue(field , value ) {
|
|
14138
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
14139
|
+
}
|
|
14140
|
+
|
|
14141
|
+
injectCss(css ) {
|
|
14142
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
14143
|
+
}
|
|
14144
|
+
|
|
14145
|
+
customizeAppearance(themes , translations , assets ) {
|
|
14146
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
14147
|
+
}
|
|
14148
|
+
|
|
14100
14149
|
_createIframe(cb = () => {}) {
|
|
14101
14150
|
this.iframe = document.createElement('iframe');
|
|
14102
14151
|
// $FlowFixMe
|
|
@@ -14142,8 +14191,8 @@ class Softphone {
|
|
|
14142
14191
|
}
|
|
14143
14192
|
|
|
14144
14193
|
switch (event.data.type) {
|
|
14145
|
-
case
|
|
14146
|
-
this.
|
|
14194
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
14195
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
14147
14196
|
break;
|
|
14148
14197
|
case SDK_CALL_ENDED: {
|
|
14149
14198
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -14231,6 +14280,18 @@ class Softphone {
|
|
|
14231
14280
|
case BRIDGE_ON_STOP_RECORDING:
|
|
14232
14281
|
this.onStopRecording();
|
|
14233
14282
|
break;
|
|
14283
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14284
|
+
this.onCardCanceled();
|
|
14285
|
+
break;
|
|
14286
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
14287
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
14288
|
+
break;
|
|
14289
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
14290
|
+
this.onCallRejected(event.data.call);
|
|
14291
|
+
break;
|
|
14292
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
14293
|
+
this.onCallEstablished(event.data.call);
|
|
14294
|
+
break;
|
|
14234
14295
|
default:
|
|
14235
14296
|
this.onUnHandledEvent(event);
|
|
14236
14297
|
break;
|
|
@@ -14238,8 +14299,8 @@ class Softphone {
|
|
|
14238
14299
|
}
|
|
14239
14300
|
|
|
14240
14301
|
_sendMessage(type , payload = {}) {
|
|
14241
|
-
if (!this.iframe) {
|
|
14242
|
-
|
|
14302
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14303
|
+
this._pendingMessages.push([type, payload]);
|
|
14243
14304
|
return;
|
|
14244
14305
|
}
|
|
14245
14306
|
|
|
@@ -13983,8 +13983,6 @@ class Checker {
|
|
|
13983
13983
|
/* eslint-disable no-unused-vars */
|
|
13984
13984
|
/* global window, document */
|
|
13985
13985
|
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13986
|
-
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13987
|
-
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13988
13986
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13989
13987
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13990
13988
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -13997,6 +13995,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13997
13995
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13998
13996
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13999
13997
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13998
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13999
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
14000
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
14000
14001
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
14001
14002
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
14002
14003
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -14010,31 +14011,51 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
14010
14011
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
14011
14012
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
14012
14013
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
14014
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
14015
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
14016
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
14017
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
14018
|
+
|
|
14019
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
14020
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
14013
14021
|
|
|
14014
14022
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
14015
|
-
const
|
|
14023
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
14016
14024
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
14017
14025
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
14018
14026
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
14019
14027
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
14020
14028
|
|
|
14021
14029
|
class Softphone {
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14030
|
+
|
|
14031
|
+
|
|
14032
|
+
|
|
14033
|
+
|
|
14034
|
+
|
|
14035
|
+
|
|
14036
|
+
|
|
14037
|
+
// Message waiting for the iframe to be loaded
|
|
14038
|
+
|
|
14027
14039
|
|
|
14028
14040
|
onLinkEnabled(link ) {}
|
|
14029
14041
|
onIFrameLoaded() {}
|
|
14030
14042
|
|
|
14031
|
-
|
|
14043
|
+
onCallLocallyAnswered(call ) {}
|
|
14044
|
+
onCallEstablished(call ) {}
|
|
14045
|
+
onOutgoingCallMade(call ) {}
|
|
14032
14046
|
onCallIncoming(call ) {}
|
|
14047
|
+
onCallRejected(call ) {}
|
|
14033
14048
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
14049
|
+
|
|
14034
14050
|
onCardSaved(card ) {}
|
|
14051
|
+
onCardCanceled() {}
|
|
14035
14052
|
onAuthenticated(session ) {}
|
|
14036
14053
|
onLoggedOut() {}
|
|
14037
|
-
|
|
14054
|
+
|
|
14055
|
+
onSearchOptions(fieldId , query ) {
|
|
14056
|
+
this.onOptionsResults(fieldId, []);
|
|
14057
|
+
}
|
|
14058
|
+
|
|
14038
14059
|
onDisplayLinkedOption(optionId ) {}
|
|
14039
14060
|
onWazoContactSearch(query ) {}
|
|
14040
14061
|
onAgentLoggedIn() {}
|
|
@@ -14057,18 +14078,26 @@ class Softphone {
|
|
|
14057
14078
|
onStopRecording() {}
|
|
14058
14079
|
onUnHandledEvent(event ) {}
|
|
14059
14080
|
|
|
14060
|
-
init({
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14081
|
+
init({
|
|
14082
|
+
url,
|
|
14083
|
+
width,
|
|
14084
|
+
height,
|
|
14085
|
+
server,
|
|
14086
|
+
port,
|
|
14087
|
+
language,
|
|
14088
|
+
wrapUpDuration,
|
|
14089
|
+
enableAgent = true,
|
|
14090
|
+
tenantId,
|
|
14091
|
+
debug = false,
|
|
14092
|
+
} = {}) {
|
|
14093
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
14094
|
+
this.width = width || 500;
|
|
14095
|
+
this.height = height || 600;
|
|
14096
|
+
this.displayed = false;
|
|
14097
|
+
this.iframeLoaded = false;
|
|
14071
14098
|
|
|
14099
|
+
this.iframeLoaded = false;
|
|
14100
|
+
this._pendingMessages = [];
|
|
14072
14101
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14073
14102
|
|
|
14074
14103
|
if (!server) {
|
|
@@ -14076,25 +14105,33 @@ class Softphone {
|
|
|
14076
14105
|
server = 'stack.dev.wazo.io';
|
|
14077
14106
|
}
|
|
14078
14107
|
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14108
|
+
const config = { server };
|
|
14109
|
+
if (language) {
|
|
14110
|
+
config.language = language;
|
|
14111
|
+
}
|
|
14112
|
+
if (port) {
|
|
14113
|
+
config.port = port;
|
|
14114
|
+
}
|
|
14115
|
+
if (tenantId) {
|
|
14116
|
+
config.tenantId = tenantId;
|
|
14117
|
+
}
|
|
14118
|
+
if (wrapUpDuration) {
|
|
14119
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
14120
|
+
}
|
|
14090
14121
|
|
|
14091
|
-
|
|
14092
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
14093
|
-
}
|
|
14122
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
14094
14123
|
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14124
|
+
if (enableAgent) {
|
|
14125
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
14126
|
+
}
|
|
14127
|
+
|
|
14128
|
+
if (debug) {
|
|
14129
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
14130
|
+
}
|
|
14131
|
+
|
|
14132
|
+
this._createIframe(() => {
|
|
14133
|
+
this.iframeLoaded = true;
|
|
14134
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
14098
14135
|
|
|
14099
14136
|
this.onIFrameLoaded();
|
|
14100
14137
|
});
|
|
@@ -14155,6 +14192,18 @@ class Softphone {
|
|
|
14155
14192
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14156
14193
|
}
|
|
14157
14194
|
|
|
14195
|
+
setCardValue(field , value ) {
|
|
14196
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
14197
|
+
}
|
|
14198
|
+
|
|
14199
|
+
injectCss(css ) {
|
|
14200
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
14201
|
+
}
|
|
14202
|
+
|
|
14203
|
+
customizeAppearance(themes , translations , assets ) {
|
|
14204
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
14205
|
+
}
|
|
14206
|
+
|
|
14158
14207
|
_createIframe(cb = () => {}) {
|
|
14159
14208
|
this.iframe = document.createElement('iframe');
|
|
14160
14209
|
// $FlowFixMe
|
|
@@ -14200,8 +14249,8 @@ class Softphone {
|
|
|
14200
14249
|
}
|
|
14201
14250
|
|
|
14202
14251
|
switch (event.data.type) {
|
|
14203
|
-
case
|
|
14204
|
-
this.
|
|
14252
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
14253
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
14205
14254
|
break;
|
|
14206
14255
|
case SDK_CALL_ENDED: {
|
|
14207
14256
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -14289,6 +14338,18 @@ class Softphone {
|
|
|
14289
14338
|
case BRIDGE_ON_STOP_RECORDING:
|
|
14290
14339
|
this.onStopRecording();
|
|
14291
14340
|
break;
|
|
14341
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14342
|
+
this.onCardCanceled();
|
|
14343
|
+
break;
|
|
14344
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
14345
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
14346
|
+
break;
|
|
14347
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
14348
|
+
this.onCallRejected(event.data.call);
|
|
14349
|
+
break;
|
|
14350
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
14351
|
+
this.onCallEstablished(event.data.call);
|
|
14352
|
+
break;
|
|
14292
14353
|
default:
|
|
14293
14354
|
this.onUnHandledEvent(event);
|
|
14294
14355
|
break;
|
|
@@ -14296,8 +14357,8 @@ class Softphone {
|
|
|
14296
14357
|
}
|
|
14297
14358
|
|
|
14298
14359
|
_sendMessage(type , payload = {}) {
|
|
14299
|
-
if (!this.iframe) {
|
|
14300
|
-
|
|
14360
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14361
|
+
this._pendingMessages.push([type, payload]);
|
|
14301
14362
|
return;
|
|
14302
14363
|
}
|
|
14303
14364
|
|