@wazo/sdk 0.38.0 → 0.38.1
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 +218 -0
- package/dist/wazo-sdk.js +5 -5
- package/esm/__tests__/web-rtc-client.test.js +1 -1
- package/esm/checker/Checker.js +1 -1
- package/esm/checker/checks/index.js +1 -1
- package/esm/checker/checks/webrtc-transport.js +1 -1
- package/esm/checker/checks/webrtc.js +1 -1
- package/esm/index.js +191 -10
- package/esm/simple/Auth.js +191 -10
- package/esm/simple/Configuration.js +191 -10
- package/esm/simple/Phone.js +191 -10
- package/esm/simple/Softphone.js +189 -8
- package/esm/simple/index.js +191 -10
- package/esm/simple/room/LocalParticipant.js +191 -10
- package/esm/simple/room/Participant.js +191 -10
- package/esm/simple/room/RemoteParticipant.js +191 -10
- package/esm/simple/room/Room.js +191 -10
- package/esm/simple/room/SipRoom.js +191 -10
- package/esm/simple/room/Stream.js +191 -10
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +191 -10
- package/esm/simple/utils.js +191 -10
- package/esm/web-rtc-client.js +1 -1
- package/lib/__tests__/web-rtc-client.test.js +1 -1
- package/lib/checker/Checker.js +1 -1
- package/lib/checker/checks/index.js +1 -1
- package/lib/checker/checks/webrtc-transport.js +1 -1
- package/lib/checker/checks/webrtc.js +1 -1
- package/lib/index.js +191 -10
- package/lib/simple/Auth.js +191 -10
- package/lib/simple/Configuration.js +191 -10
- package/lib/simple/Phone.js +191 -10
- package/lib/simple/Softphone.js +189 -8
- package/lib/simple/index.js +191 -10
- package/lib/simple/room/LocalParticipant.js +191 -10
- package/lib/simple/room/Participant.js +191 -10
- package/lib/simple/room/RemoteParticipant.js +191 -10
- package/lib/simple/room/Room.js +191 -10
- package/lib/simple/room/SipRoom.js +191 -10
- package/lib/simple/room/Stream.js +191 -10
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +191 -10
- package/lib/simple/utils.js +191 -10
- package/lib/web-rtc-client.js +1 -1
- package/package.json +1 -1
- package/src/simple/Softphone.js +187 -8
- package/src/web-rtc-client.js +1 -1
|
@@ -8326,7 +8326,7 @@ class WebRTCClient extends Emitter {
|
|
|
8326
8326
|
}
|
|
8327
8327
|
|
|
8328
8328
|
async _onHeartbeatTimeout() {
|
|
8329
|
-
logger$8.
|
|
8329
|
+
logger$8.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8330
8330
|
|
|
8331
8331
|
if (this.heartbeatTimeoutCb) {
|
|
8332
8332
|
this.heartbeatTimeoutCb();
|
|
@@ -13972,11 +13972,41 @@ class Checker {
|
|
|
13972
13972
|
//
|
|
13973
13973
|
/* eslint-disable no-unused-vars */
|
|
13974
13974
|
/* global window, document */
|
|
13975
|
+
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13976
|
+
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13977
|
+
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13978
|
+
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13979
|
+
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13980
|
+
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
13981
|
+
const BRIDGE_SEARCH_OPTIONS = 'bridge/BRIDGE_SEARCH_OPTIONS';
|
|
13982
|
+
const BRIDGE_DISPLAY_LINKED_OPTION = 'bridge/DISPLAY_LINKED_OPTION';
|
|
13983
|
+
const BRIDGE_UPDATE_FORM_SCHEMA = 'bridge/BRIDGE_UPDATE_FORM_SCHEMA';
|
|
13984
|
+
const BRIDGE_WAZO_CONTACT_SEARCH = 'bridge/BRIDGE_WAZO_CONTACT_SEARCH';
|
|
13985
|
+
const BRIDGE_ON_AGENT_LOGGED_IN = 'bridge/BRIDGE_ON_AGENT_LOGGED_IN';
|
|
13986
|
+
const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
13987
|
+
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13988
|
+
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13989
|
+
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13990
|
+
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13991
|
+
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13992
|
+
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
13993
|
+
const BRIDGE_ON_CALL_UN_MUTED = 'bridge/BRIDGE_ON_CALL_UN_MUTED';
|
|
13994
|
+
const BRIDGE_ON_DTMF = 'bridge/BRIDGE_ON_DTMF';
|
|
13995
|
+
const BRIDGE_ON_DIRECT_TRANSFER = 'bridge/BRIDGE_ON_DIRECT_TRANSFER';
|
|
13996
|
+
const BRIDGE_ON_CREATE_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CREATE_INDIRECT_TRANSFER';
|
|
13997
|
+
const BRIDGE_ON_CANCEL_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CANCEL_INDIRECT_TRANSFER';
|
|
13998
|
+
const BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER';
|
|
13999
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE';
|
|
14000
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
14001
|
+
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
14002
|
+
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
14003
|
+
|
|
13975
14004
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13976
14005
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
13977
14006
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13978
14007
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13979
14008
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
14009
|
+
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13980
14010
|
|
|
13981
14011
|
class Softphone {
|
|
13982
14012
|
url = 'https://softphone.wazo.io';
|
|
@@ -13986,13 +14016,39 @@ class Softphone {
|
|
|
13986
14016
|
iframe = null;
|
|
13987
14017
|
|
|
13988
14018
|
onLinkEnabled(link ) {}
|
|
14019
|
+
onIFrameLoaded() {}
|
|
13989
14020
|
|
|
13990
14021
|
onCallMade(call ) {}
|
|
13991
14022
|
onCallIncoming(call ) {}
|
|
13992
14023
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
14024
|
+
onCardSaved(card ) {}
|
|
13993
14025
|
onAuthenticated(session ) {}
|
|
13994
|
-
|
|
13995
|
-
|
|
14026
|
+
onLoggedOut() {}
|
|
14027
|
+
onSearchOptions(fieldId , query ) {}
|
|
14028
|
+
onDisplayLinkedOption(optionId ) {}
|
|
14029
|
+
onWazoContactSearch(query ) {}
|
|
14030
|
+
onAgentLoggedIn() {}
|
|
14031
|
+
onAgentLoggedOut() {}
|
|
14032
|
+
onAgentPaused() {}
|
|
14033
|
+
onAgentResumed() {}
|
|
14034
|
+
onLanguageChanged(language ) {}
|
|
14035
|
+
onCallHeld() {}
|
|
14036
|
+
onCallResumed() {}
|
|
14037
|
+
onCallMuted() {}
|
|
14038
|
+
onCallUnMuted() {}
|
|
14039
|
+
onDtmfSent(tone ) {}
|
|
14040
|
+
onDirectTransfer(number ) {}
|
|
14041
|
+
onCreateIndirectTransfer(number ) {}
|
|
14042
|
+
onCancelIndirectTransfer() {}
|
|
14043
|
+
onConfirmIndirectTransfer() {}
|
|
14044
|
+
onIndirectCallMade(call ) {}
|
|
14045
|
+
onIndirectTransferDone(call ) {}
|
|
14046
|
+
onStartRecording() {}
|
|
14047
|
+
onStopRecording() {}
|
|
14048
|
+
onUnHandledEvent(event ) {}
|
|
14049
|
+
|
|
14050
|
+
init({ url, width, height, server, port, language, wrapUpDuration, shouldDisplayLinkedEntities,
|
|
14051
|
+
allowContactCreation, withCard, subscriptionType, enableAgent } = {}) {
|
|
13996
14052
|
if (url) {
|
|
13997
14053
|
this.url = url;
|
|
13998
14054
|
}
|
|
@@ -14005,7 +14061,33 @@ class Softphone {
|
|
|
14005
14061
|
|
|
14006
14062
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14007
14063
|
|
|
14008
|
-
|
|
14064
|
+
if (!server) {
|
|
14065
|
+
// eslint-disable-next-line no-param-reassign
|
|
14066
|
+
server = 'stack.dev.wazo.io';
|
|
14067
|
+
}
|
|
14068
|
+
|
|
14069
|
+
this._createIframe(() => {
|
|
14070
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, {
|
|
14071
|
+
config: {
|
|
14072
|
+
server,
|
|
14073
|
+
port,
|
|
14074
|
+
language,
|
|
14075
|
+
wrapUpDuration,
|
|
14076
|
+
shouldDisplayLinkedEntities,
|
|
14077
|
+
allowContactCreation,
|
|
14078
|
+
},
|
|
14079
|
+
});
|
|
14080
|
+
|
|
14081
|
+
if (withCard) {
|
|
14082
|
+
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
14083
|
+
}
|
|
14084
|
+
|
|
14085
|
+
if (subscriptionType) {
|
|
14086
|
+
this._sendMessage(BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE, { subscriptionType });
|
|
14087
|
+
}
|
|
14088
|
+
|
|
14089
|
+
this.onIFrameLoaded();
|
|
14090
|
+
});
|
|
14009
14091
|
}
|
|
14010
14092
|
|
|
14011
14093
|
parseLinks() {
|
|
@@ -14021,9 +14103,7 @@ class Softphone {
|
|
|
14021
14103
|
makeCall(number ) {
|
|
14022
14104
|
this.displaySoftphone();
|
|
14023
14105
|
|
|
14024
|
-
|
|
14025
|
-
this.iframe.contentWindow.postMessage({ type: SDK_CLICK_TO_CALL, number }, '*');
|
|
14026
|
-
}
|
|
14106
|
+
this._sendMessage(SDK_CLICK_TO_CALL, { number });
|
|
14027
14107
|
}
|
|
14028
14108
|
|
|
14029
14109
|
toggleSoftphoneDisplay() {
|
|
@@ -14032,8 +14112,6 @@ class Softphone {
|
|
|
14032
14112
|
} else {
|
|
14033
14113
|
this.displaySoftphone();
|
|
14034
14114
|
}
|
|
14035
|
-
|
|
14036
|
-
this.displayed = !this.displayed;
|
|
14037
14115
|
}
|
|
14038
14116
|
|
|
14039
14117
|
displaySoftphone() {
|
|
@@ -14044,15 +14122,30 @@ class Softphone {
|
|
|
14044
14122
|
if (this.iframe) {
|
|
14045
14123
|
this.iframe.style.display = 'block';
|
|
14046
14124
|
}
|
|
14125
|
+
|
|
14126
|
+
this.displayed = true;
|
|
14047
14127
|
}
|
|
14048
14128
|
|
|
14049
14129
|
hideSoftphone() {
|
|
14050
14130
|
if (this.iframe) {
|
|
14051
14131
|
this.iframe.style.display = 'none';
|
|
14052
14132
|
}
|
|
14133
|
+
this.displayed = false;
|
|
14134
|
+
}
|
|
14135
|
+
|
|
14136
|
+
optionsFetched(fieldId , options ) {
|
|
14137
|
+
this._sendMessage(BRIDGE_OPTIONS_FETCHED, { fieldId, options });
|
|
14138
|
+
}
|
|
14139
|
+
|
|
14140
|
+
onOptionsResults(fieldId , options ) {
|
|
14141
|
+
this._sendMessage(BRIDGE_OPTIONS_FOUND, { fieldId, options });
|
|
14142
|
+
}
|
|
14143
|
+
|
|
14144
|
+
setFormSchema(schema , uiSchema ) {
|
|
14145
|
+
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14053
14146
|
}
|
|
14054
14147
|
|
|
14055
|
-
_createIframe() {
|
|
14148
|
+
_createIframe(cb = () => {}) {
|
|
14056
14149
|
this.iframe = document.createElement('iframe');
|
|
14057
14150
|
// $FlowFixMe
|
|
14058
14151
|
this.iframe.width = this.width;
|
|
@@ -14064,10 +14157,13 @@ class Softphone {
|
|
|
14064
14157
|
this.iframe.style.left = '0';
|
|
14065
14158
|
this.iframe.style.bottom = '0';
|
|
14066
14159
|
this.iframe.style.border = '1px solid #aaa';
|
|
14160
|
+
this.iframe.style.backgroundColor = 'white';
|
|
14067
14161
|
this.iframe.src = this.url;
|
|
14068
14162
|
this.iframe.style.display = 'none';
|
|
14069
14163
|
this.iframe.id = 'wazo-softphone';
|
|
14070
14164
|
|
|
14165
|
+
this.iframe.onload = cb;
|
|
14166
|
+
|
|
14071
14167
|
// $FlowFixMe
|
|
14072
14168
|
document.body.appendChild(this.iframe);
|
|
14073
14169
|
}
|
|
@@ -14110,8 +14206,93 @@ class Softphone {
|
|
|
14110
14206
|
this._onAuthenticated(event.data.session);
|
|
14111
14207
|
this.onAuthenticated(event.data.session);
|
|
14112
14208
|
break;
|
|
14209
|
+
case SDK_LOGGED_OUT:
|
|
14210
|
+
this.onLoggedOut();
|
|
14211
|
+
break;
|
|
14212
|
+
case BRIDGE_CREATE_OR_UPDATE_CARD: {
|
|
14213
|
+
const { content } = event.data;
|
|
14214
|
+
this.onCardSaved(content);
|
|
14215
|
+
break;
|
|
14216
|
+
}
|
|
14217
|
+
case BRIDGE_SEARCH_OPTIONS: {
|
|
14218
|
+
const { fieldId, query } = event.data;
|
|
14219
|
+
this.onSearchOptions(fieldId, query);
|
|
14220
|
+
break;
|
|
14221
|
+
}
|
|
14222
|
+
case BRIDGE_DISPLAY_LINKED_OPTION:
|
|
14223
|
+
this.onDisplayLinkedOption(event.data.linkedOptionId);
|
|
14224
|
+
break;
|
|
14225
|
+
case BRIDGE_WAZO_CONTACT_SEARCH:
|
|
14226
|
+
this.onWazoContactSearch(event.data.query);
|
|
14227
|
+
break;
|
|
14228
|
+
case BRIDGE_ON_AGENT_LOGGED_IN:
|
|
14229
|
+
this.onAgentLoggedIn();
|
|
14230
|
+
break;
|
|
14231
|
+
case BRIDGE_ON_AGENT_LOGGED_OUT:
|
|
14232
|
+
this.onAgentLoggedOut();
|
|
14233
|
+
break;
|
|
14234
|
+
case BRIDGE_ON_AGENT_PAUSED:
|
|
14235
|
+
this.onAgentPaused();
|
|
14236
|
+
break;
|
|
14237
|
+
case BRIDGE_ON_AGENT_RESUMED:
|
|
14238
|
+
this.onAgentResumed();
|
|
14239
|
+
break;
|
|
14240
|
+
case BRIDGE_ON_LANGUAGE_CHANGED:
|
|
14241
|
+
this.onLanguageChanged(event.data.language);
|
|
14242
|
+
break;
|
|
14243
|
+
case BRIDGE_ON_CALL_HELD:
|
|
14244
|
+
this.onCallHeld();
|
|
14245
|
+
break;
|
|
14246
|
+
case BRIDGE_ON_CALL_RESUMED:
|
|
14247
|
+
this.onCallResumed();
|
|
14248
|
+
break;
|
|
14249
|
+
case BRIDGE_ON_CALL_MUTED:
|
|
14250
|
+
this.onCallMuted();
|
|
14251
|
+
break;
|
|
14252
|
+
case BRIDGE_ON_CALL_UN_MUTED:
|
|
14253
|
+
this.onCallUnMuted();
|
|
14254
|
+
break;
|
|
14255
|
+
case BRIDGE_ON_DTMF:
|
|
14256
|
+
this.onDtmfSent(event.data.tone);
|
|
14257
|
+
break;
|
|
14258
|
+
case BRIDGE_ON_DIRECT_TRANSFER:
|
|
14259
|
+
this.onDirectTransfer(event.data.number);
|
|
14260
|
+
break;
|
|
14261
|
+
case BRIDGE_ON_CREATE_INDIRECT_TRANSFER:
|
|
14262
|
+
this.onCreateIndirectTransfer(event.data.number);
|
|
14263
|
+
break;
|
|
14264
|
+
case BRIDGE_ON_CANCEL_INDIRECT_TRANSFER:
|
|
14265
|
+
this.onCancelIndirectTransfer();
|
|
14266
|
+
break;
|
|
14267
|
+
case BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER:
|
|
14268
|
+
this.onConfirmIndirectTransfer();
|
|
14269
|
+
break;
|
|
14270
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE:
|
|
14271
|
+
this.onIndirectCallMade(event.data.call);
|
|
14272
|
+
break;
|
|
14273
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_DONE:
|
|
14274
|
+
this.onIndirectTransferDone(event.data.call);
|
|
14275
|
+
break;
|
|
14276
|
+
case BRIDGE_ON_START_RECORDING:
|
|
14277
|
+
this.onStartRecording();
|
|
14278
|
+
break;
|
|
14279
|
+
case BRIDGE_ON_STOP_RECORDING:
|
|
14280
|
+
this.onStopRecording();
|
|
14281
|
+
break;
|
|
14282
|
+
default:
|
|
14283
|
+
this.onUnHandledEvent(event);
|
|
14284
|
+
break;
|
|
14113
14285
|
}
|
|
14114
14286
|
}
|
|
14287
|
+
|
|
14288
|
+
_sendMessage(type , payload = {}) {
|
|
14289
|
+
if (!this.iframe) {
|
|
14290
|
+
console.warn(`Could not send message of type ${type} to the Wazo Softphone, iframe not created yet`);
|
|
14291
|
+
return;
|
|
14292
|
+
}
|
|
14293
|
+
|
|
14294
|
+
this.iframe.contentWindow.postMessage({ type, ...payload }, '*');
|
|
14295
|
+
}
|
|
14115
14296
|
}
|
|
14116
14297
|
|
|
14117
14298
|
var Softphone$1 = new Softphone();
|
package/esm/simple/utils.js
CHANGED
|
@@ -8326,7 +8326,7 @@ class WebRTCClient extends Emitter {
|
|
|
8326
8326
|
}
|
|
8327
8327
|
|
|
8328
8328
|
async _onHeartbeatTimeout() {
|
|
8329
|
-
logger$8.
|
|
8329
|
+
logger$8.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8330
8330
|
|
|
8331
8331
|
if (this.heartbeatTimeoutCb) {
|
|
8332
8332
|
this.heartbeatTimeoutCb();
|
|
@@ -13956,11 +13956,41 @@ class Checker {
|
|
|
13956
13956
|
//
|
|
13957
13957
|
/* eslint-disable no-unused-vars */
|
|
13958
13958
|
/* global window, document */
|
|
13959
|
+
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13960
|
+
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13961
|
+
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13962
|
+
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13963
|
+
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13964
|
+
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
13965
|
+
const BRIDGE_SEARCH_OPTIONS = 'bridge/BRIDGE_SEARCH_OPTIONS';
|
|
13966
|
+
const BRIDGE_DISPLAY_LINKED_OPTION = 'bridge/DISPLAY_LINKED_OPTION';
|
|
13967
|
+
const BRIDGE_UPDATE_FORM_SCHEMA = 'bridge/BRIDGE_UPDATE_FORM_SCHEMA';
|
|
13968
|
+
const BRIDGE_WAZO_CONTACT_SEARCH = 'bridge/BRIDGE_WAZO_CONTACT_SEARCH';
|
|
13969
|
+
const BRIDGE_ON_AGENT_LOGGED_IN = 'bridge/BRIDGE_ON_AGENT_LOGGED_IN';
|
|
13970
|
+
const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
13971
|
+
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13972
|
+
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13973
|
+
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13974
|
+
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13975
|
+
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13976
|
+
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
13977
|
+
const BRIDGE_ON_CALL_UN_MUTED = 'bridge/BRIDGE_ON_CALL_UN_MUTED';
|
|
13978
|
+
const BRIDGE_ON_DTMF = 'bridge/BRIDGE_ON_DTMF';
|
|
13979
|
+
const BRIDGE_ON_DIRECT_TRANSFER = 'bridge/BRIDGE_ON_DIRECT_TRANSFER';
|
|
13980
|
+
const BRIDGE_ON_CREATE_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CREATE_INDIRECT_TRANSFER';
|
|
13981
|
+
const BRIDGE_ON_CANCEL_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CANCEL_INDIRECT_TRANSFER';
|
|
13982
|
+
const BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER';
|
|
13983
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE';
|
|
13984
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13985
|
+
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13986
|
+
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13987
|
+
|
|
13959
13988
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13960
13989
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
13961
13990
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13962
13991
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13963
13992
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
13993
|
+
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13964
13994
|
|
|
13965
13995
|
class Softphone {
|
|
13966
13996
|
url = 'https://softphone.wazo.io';
|
|
@@ -13970,13 +14000,39 @@ class Softphone {
|
|
|
13970
14000
|
iframe = null;
|
|
13971
14001
|
|
|
13972
14002
|
onLinkEnabled(link ) {}
|
|
14003
|
+
onIFrameLoaded() {}
|
|
13973
14004
|
|
|
13974
14005
|
onCallMade(call ) {}
|
|
13975
14006
|
onCallIncoming(call ) {}
|
|
13976
14007
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
14008
|
+
onCardSaved(card ) {}
|
|
13977
14009
|
onAuthenticated(session ) {}
|
|
13978
|
-
|
|
13979
|
-
|
|
14010
|
+
onLoggedOut() {}
|
|
14011
|
+
onSearchOptions(fieldId , query ) {}
|
|
14012
|
+
onDisplayLinkedOption(optionId ) {}
|
|
14013
|
+
onWazoContactSearch(query ) {}
|
|
14014
|
+
onAgentLoggedIn() {}
|
|
14015
|
+
onAgentLoggedOut() {}
|
|
14016
|
+
onAgentPaused() {}
|
|
14017
|
+
onAgentResumed() {}
|
|
14018
|
+
onLanguageChanged(language ) {}
|
|
14019
|
+
onCallHeld() {}
|
|
14020
|
+
onCallResumed() {}
|
|
14021
|
+
onCallMuted() {}
|
|
14022
|
+
onCallUnMuted() {}
|
|
14023
|
+
onDtmfSent(tone ) {}
|
|
14024
|
+
onDirectTransfer(number ) {}
|
|
14025
|
+
onCreateIndirectTransfer(number ) {}
|
|
14026
|
+
onCancelIndirectTransfer() {}
|
|
14027
|
+
onConfirmIndirectTransfer() {}
|
|
14028
|
+
onIndirectCallMade(call ) {}
|
|
14029
|
+
onIndirectTransferDone(call ) {}
|
|
14030
|
+
onStartRecording() {}
|
|
14031
|
+
onStopRecording() {}
|
|
14032
|
+
onUnHandledEvent(event ) {}
|
|
14033
|
+
|
|
14034
|
+
init({ url, width, height, server, port, language, wrapUpDuration, shouldDisplayLinkedEntities,
|
|
14035
|
+
allowContactCreation, withCard, subscriptionType, enableAgent } = {}) {
|
|
13980
14036
|
if (url) {
|
|
13981
14037
|
this.url = url;
|
|
13982
14038
|
}
|
|
@@ -13989,7 +14045,33 @@ class Softphone {
|
|
|
13989
14045
|
|
|
13990
14046
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13991
14047
|
|
|
13992
|
-
|
|
14048
|
+
if (!server) {
|
|
14049
|
+
// eslint-disable-next-line no-param-reassign
|
|
14050
|
+
server = 'stack.dev.wazo.io';
|
|
14051
|
+
}
|
|
14052
|
+
|
|
14053
|
+
this._createIframe(() => {
|
|
14054
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, {
|
|
14055
|
+
config: {
|
|
14056
|
+
server,
|
|
14057
|
+
port,
|
|
14058
|
+
language,
|
|
14059
|
+
wrapUpDuration,
|
|
14060
|
+
shouldDisplayLinkedEntities,
|
|
14061
|
+
allowContactCreation,
|
|
14062
|
+
},
|
|
14063
|
+
});
|
|
14064
|
+
|
|
14065
|
+
if (withCard) {
|
|
14066
|
+
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
14067
|
+
}
|
|
14068
|
+
|
|
14069
|
+
if (subscriptionType) {
|
|
14070
|
+
this._sendMessage(BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE, { subscriptionType });
|
|
14071
|
+
}
|
|
14072
|
+
|
|
14073
|
+
this.onIFrameLoaded();
|
|
14074
|
+
});
|
|
13993
14075
|
}
|
|
13994
14076
|
|
|
13995
14077
|
parseLinks() {
|
|
@@ -14005,9 +14087,7 @@ class Softphone {
|
|
|
14005
14087
|
makeCall(number ) {
|
|
14006
14088
|
this.displaySoftphone();
|
|
14007
14089
|
|
|
14008
|
-
|
|
14009
|
-
this.iframe.contentWindow.postMessage({ type: SDK_CLICK_TO_CALL, number }, '*');
|
|
14010
|
-
}
|
|
14090
|
+
this._sendMessage(SDK_CLICK_TO_CALL, { number });
|
|
14011
14091
|
}
|
|
14012
14092
|
|
|
14013
14093
|
toggleSoftphoneDisplay() {
|
|
@@ -14016,8 +14096,6 @@ class Softphone {
|
|
|
14016
14096
|
} else {
|
|
14017
14097
|
this.displaySoftphone();
|
|
14018
14098
|
}
|
|
14019
|
-
|
|
14020
|
-
this.displayed = !this.displayed;
|
|
14021
14099
|
}
|
|
14022
14100
|
|
|
14023
14101
|
displaySoftphone() {
|
|
@@ -14028,15 +14106,30 @@ class Softphone {
|
|
|
14028
14106
|
if (this.iframe) {
|
|
14029
14107
|
this.iframe.style.display = 'block';
|
|
14030
14108
|
}
|
|
14109
|
+
|
|
14110
|
+
this.displayed = true;
|
|
14031
14111
|
}
|
|
14032
14112
|
|
|
14033
14113
|
hideSoftphone() {
|
|
14034
14114
|
if (this.iframe) {
|
|
14035
14115
|
this.iframe.style.display = 'none';
|
|
14036
14116
|
}
|
|
14117
|
+
this.displayed = false;
|
|
14118
|
+
}
|
|
14119
|
+
|
|
14120
|
+
optionsFetched(fieldId , options ) {
|
|
14121
|
+
this._sendMessage(BRIDGE_OPTIONS_FETCHED, { fieldId, options });
|
|
14122
|
+
}
|
|
14123
|
+
|
|
14124
|
+
onOptionsResults(fieldId , options ) {
|
|
14125
|
+
this._sendMessage(BRIDGE_OPTIONS_FOUND, { fieldId, options });
|
|
14126
|
+
}
|
|
14127
|
+
|
|
14128
|
+
setFormSchema(schema , uiSchema ) {
|
|
14129
|
+
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14037
14130
|
}
|
|
14038
14131
|
|
|
14039
|
-
_createIframe() {
|
|
14132
|
+
_createIframe(cb = () => {}) {
|
|
14040
14133
|
this.iframe = document.createElement('iframe');
|
|
14041
14134
|
// $FlowFixMe
|
|
14042
14135
|
this.iframe.width = this.width;
|
|
@@ -14048,10 +14141,13 @@ class Softphone {
|
|
|
14048
14141
|
this.iframe.style.left = '0';
|
|
14049
14142
|
this.iframe.style.bottom = '0';
|
|
14050
14143
|
this.iframe.style.border = '1px solid #aaa';
|
|
14144
|
+
this.iframe.style.backgroundColor = 'white';
|
|
14051
14145
|
this.iframe.src = this.url;
|
|
14052
14146
|
this.iframe.style.display = 'none';
|
|
14053
14147
|
this.iframe.id = 'wazo-softphone';
|
|
14054
14148
|
|
|
14149
|
+
this.iframe.onload = cb;
|
|
14150
|
+
|
|
14055
14151
|
// $FlowFixMe
|
|
14056
14152
|
document.body.appendChild(this.iframe);
|
|
14057
14153
|
}
|
|
@@ -14094,8 +14190,93 @@ class Softphone {
|
|
|
14094
14190
|
this._onAuthenticated(event.data.session);
|
|
14095
14191
|
this.onAuthenticated(event.data.session);
|
|
14096
14192
|
break;
|
|
14193
|
+
case SDK_LOGGED_OUT:
|
|
14194
|
+
this.onLoggedOut();
|
|
14195
|
+
break;
|
|
14196
|
+
case BRIDGE_CREATE_OR_UPDATE_CARD: {
|
|
14197
|
+
const { content } = event.data;
|
|
14198
|
+
this.onCardSaved(content);
|
|
14199
|
+
break;
|
|
14200
|
+
}
|
|
14201
|
+
case BRIDGE_SEARCH_OPTIONS: {
|
|
14202
|
+
const { fieldId, query } = event.data;
|
|
14203
|
+
this.onSearchOptions(fieldId, query);
|
|
14204
|
+
break;
|
|
14205
|
+
}
|
|
14206
|
+
case BRIDGE_DISPLAY_LINKED_OPTION:
|
|
14207
|
+
this.onDisplayLinkedOption(event.data.linkedOptionId);
|
|
14208
|
+
break;
|
|
14209
|
+
case BRIDGE_WAZO_CONTACT_SEARCH:
|
|
14210
|
+
this.onWazoContactSearch(event.data.query);
|
|
14211
|
+
break;
|
|
14212
|
+
case BRIDGE_ON_AGENT_LOGGED_IN:
|
|
14213
|
+
this.onAgentLoggedIn();
|
|
14214
|
+
break;
|
|
14215
|
+
case BRIDGE_ON_AGENT_LOGGED_OUT:
|
|
14216
|
+
this.onAgentLoggedOut();
|
|
14217
|
+
break;
|
|
14218
|
+
case BRIDGE_ON_AGENT_PAUSED:
|
|
14219
|
+
this.onAgentPaused();
|
|
14220
|
+
break;
|
|
14221
|
+
case BRIDGE_ON_AGENT_RESUMED:
|
|
14222
|
+
this.onAgentResumed();
|
|
14223
|
+
break;
|
|
14224
|
+
case BRIDGE_ON_LANGUAGE_CHANGED:
|
|
14225
|
+
this.onLanguageChanged(event.data.language);
|
|
14226
|
+
break;
|
|
14227
|
+
case BRIDGE_ON_CALL_HELD:
|
|
14228
|
+
this.onCallHeld();
|
|
14229
|
+
break;
|
|
14230
|
+
case BRIDGE_ON_CALL_RESUMED:
|
|
14231
|
+
this.onCallResumed();
|
|
14232
|
+
break;
|
|
14233
|
+
case BRIDGE_ON_CALL_MUTED:
|
|
14234
|
+
this.onCallMuted();
|
|
14235
|
+
break;
|
|
14236
|
+
case BRIDGE_ON_CALL_UN_MUTED:
|
|
14237
|
+
this.onCallUnMuted();
|
|
14238
|
+
break;
|
|
14239
|
+
case BRIDGE_ON_DTMF:
|
|
14240
|
+
this.onDtmfSent(event.data.tone);
|
|
14241
|
+
break;
|
|
14242
|
+
case BRIDGE_ON_DIRECT_TRANSFER:
|
|
14243
|
+
this.onDirectTransfer(event.data.number);
|
|
14244
|
+
break;
|
|
14245
|
+
case BRIDGE_ON_CREATE_INDIRECT_TRANSFER:
|
|
14246
|
+
this.onCreateIndirectTransfer(event.data.number);
|
|
14247
|
+
break;
|
|
14248
|
+
case BRIDGE_ON_CANCEL_INDIRECT_TRANSFER:
|
|
14249
|
+
this.onCancelIndirectTransfer();
|
|
14250
|
+
break;
|
|
14251
|
+
case BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER:
|
|
14252
|
+
this.onConfirmIndirectTransfer();
|
|
14253
|
+
break;
|
|
14254
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE:
|
|
14255
|
+
this.onIndirectCallMade(event.data.call);
|
|
14256
|
+
break;
|
|
14257
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_DONE:
|
|
14258
|
+
this.onIndirectTransferDone(event.data.call);
|
|
14259
|
+
break;
|
|
14260
|
+
case BRIDGE_ON_START_RECORDING:
|
|
14261
|
+
this.onStartRecording();
|
|
14262
|
+
break;
|
|
14263
|
+
case BRIDGE_ON_STOP_RECORDING:
|
|
14264
|
+
this.onStopRecording();
|
|
14265
|
+
break;
|
|
14266
|
+
default:
|
|
14267
|
+
this.onUnHandledEvent(event);
|
|
14268
|
+
break;
|
|
14097
14269
|
}
|
|
14098
14270
|
}
|
|
14271
|
+
|
|
14272
|
+
_sendMessage(type , payload = {}) {
|
|
14273
|
+
if (!this.iframe) {
|
|
14274
|
+
console.warn(`Could not send message of type ${type} to the Wazo Softphone, iframe not created yet`);
|
|
14275
|
+
return;
|
|
14276
|
+
}
|
|
14277
|
+
|
|
14278
|
+
this.iframe.contentWindow.postMessage({ type, ...payload }, '*');
|
|
14279
|
+
}
|
|
14099
14280
|
}
|
|
14100
14281
|
|
|
14101
14282
|
var Softphone$1 = new Softphone();
|
package/esm/web-rtc-client.js
CHANGED
|
@@ -6956,7 +6956,7 @@ class WebRTCClient extends Emitter {
|
|
|
6956
6956
|
}
|
|
6957
6957
|
|
|
6958
6958
|
async _onHeartbeatTimeout() {
|
|
6959
|
-
logger.
|
|
6959
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6960
6960
|
|
|
6961
6961
|
if (this.heartbeatTimeoutCb) {
|
|
6962
6962
|
this.heartbeatTimeoutCb();
|
|
@@ -6962,7 +6962,7 @@ class WebRTCClient extends Emitter {
|
|
|
6962
6962
|
}
|
|
6963
6963
|
|
|
6964
6964
|
async _onHeartbeatTimeout() {
|
|
6965
|
-
logger.
|
|
6965
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6966
6966
|
|
|
6967
6967
|
if (this.heartbeatTimeoutCb) {
|
|
6968
6968
|
this.heartbeatTimeoutCb();
|
package/lib/checker/Checker.js
CHANGED
|
@@ -7548,7 +7548,7 @@ class WebRTCClient extends Emitter {
|
|
|
7548
7548
|
}
|
|
7549
7549
|
|
|
7550
7550
|
async _onHeartbeatTimeout() {
|
|
7551
|
-
logger$1.
|
|
7551
|
+
logger$1.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7552
7552
|
|
|
7553
7553
|
if (this.heartbeatTimeoutCb) {
|
|
7554
7554
|
this.heartbeatTimeoutCb();
|
|
@@ -7548,7 +7548,7 @@ class WebRTCClient extends Emitter {
|
|
|
7548
7548
|
}
|
|
7549
7549
|
|
|
7550
7550
|
async _onHeartbeatTimeout() {
|
|
7551
|
-
logger.
|
|
7551
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7552
7552
|
|
|
7553
7553
|
if (this.heartbeatTimeoutCb) {
|
|
7554
7554
|
this.heartbeatTimeoutCb();
|
|
@@ -6962,7 +6962,7 @@ class WebRTCClient extends Emitter {
|
|
|
6962
6962
|
}
|
|
6963
6963
|
|
|
6964
6964
|
async _onHeartbeatTimeout() {
|
|
6965
|
-
logger.
|
|
6965
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6966
6966
|
|
|
6967
6967
|
if (this.heartbeatTimeoutCb) {
|
|
6968
6968
|
this.heartbeatTimeoutCb();
|
|
@@ -6962,7 +6962,7 @@ class WebRTCClient extends Emitter {
|
|
|
6962
6962
|
}
|
|
6963
6963
|
|
|
6964
6964
|
async _onHeartbeatTimeout() {
|
|
6965
|
-
logger.
|
|
6965
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6966
6966
|
|
|
6967
6967
|
if (this.heartbeatTimeoutCb) {
|
|
6968
6968
|
this.heartbeatTimeoutCb();
|