@wazo/sdk 0.37.42 → 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__/api-client.test.js +12 -7
- package/esm/__tests__/web-rtc-client.test.js +17 -10
- package/esm/api/agentd.js +12 -7
- package/esm/api/amid.js +12 -7
- package/esm/api/application.js +12 -7
- package/esm/api/auth.js +12 -7
- package/esm/api/call-logd.js +12 -7
- package/esm/api/calld.js +12 -7
- package/esm/api/chatd.js +12 -7
- package/esm/api/confd.js +12 -7
- package/esm/api/ctid-ng.js +12 -7
- package/esm/api/dird.js +12 -7
- package/esm/api/webhookd.js +12 -7
- package/esm/api-client.js +12 -7
- package/esm/checker/Checker.js +18 -11
- package/esm/checker/checks/aor.js +12 -7
- package/esm/checker/checks/api.js +12 -7
- package/esm/checker/checks/index.js +18 -11
- package/esm/checker/checks/wazo-websocket.js +13 -8
- package/esm/checker/checks/webrtc-transport.js +17 -10
- package/esm/checker/checks/webrtc.js +17 -10
- package/esm/domain/AdHocAPIConference.js +12 -7
- package/esm/domain/Features.js +12 -7
- package/esm/domain/Phone/CTIPhone.js +12 -7
- package/esm/domain/Phone/WebRTCPhone.js +12 -7
- package/esm/index.js +347 -11
- package/esm/lib/WazoSessionDescriptionHandler.js +12 -7
- package/esm/service/CallApi.js +12 -7
- package/esm/service/IssueReporter.js +12 -7
- package/esm/service/__tests__/IssueReporter.test.js +18 -7
- package/esm/service/getApiClient.js +12 -7
- package/esm/simple/Auth.js +347 -11
- package/esm/simple/Configuration.js +347 -11
- package/esm/simple/Directory.js +12 -7
- package/esm/simple/Phone.js +347 -11
- package/esm/simple/Softphone.js +329 -0
- package/esm/simple/Websocket.js +13 -8
- package/esm/simple/index.js +347 -11
- package/esm/simple/room/LocalParticipant.js +347 -11
- package/esm/simple/room/Participant.js +347 -11
- package/esm/simple/room/RemoteParticipant.js +347 -11
- package/esm/simple/room/Room.js +347 -11
- package/esm/simple/room/SipRoom.js +347 -11
- package/esm/simple/room/Stream.js +347 -11
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +347 -11
- package/esm/simple/utils.js +347 -11
- package/esm/utils/__tests__/api-requester.test.js +12 -7
- package/esm/utils/api-requester.js +12 -7
- package/esm/web-rtc-client.js +17 -10
- package/esm/websocket-client.js +13 -8
- package/lib/__tests__/api-client.test.js +12 -7
- package/lib/__tests__/web-rtc-client.test.js +17 -10
- package/lib/api/agentd.js +12 -7
- package/lib/api/amid.js +12 -7
- package/lib/api/application.js +12 -7
- package/lib/api/auth.js +12 -7
- package/lib/api/call-logd.js +12 -7
- package/lib/api/calld.js +12 -7
- package/lib/api/chatd.js +12 -7
- package/lib/api/confd.js +12 -7
- package/lib/api/ctid-ng.js +12 -7
- package/lib/api/dird.js +12 -7
- package/lib/api/webhookd.js +12 -7
- package/lib/api-client.js +12 -7
- package/lib/checker/Checker.js +18 -11
- package/lib/checker/checks/aor.js +12 -7
- package/lib/checker/checks/api.js +12 -7
- package/lib/checker/checks/index.js +18 -11
- package/lib/checker/checks/wazo-websocket.js +13 -8
- package/lib/checker/checks/webrtc-transport.js +17 -10
- package/lib/checker/checks/webrtc.js +17 -10
- package/lib/domain/AdHocAPIConference.js +12 -7
- package/lib/domain/Features.js +12 -7
- package/lib/domain/Phone/CTIPhone.js +12 -7
- package/lib/domain/Phone/WebRTCPhone.js +12 -7
- package/lib/index.js +347 -11
- package/lib/lib/WazoSessionDescriptionHandler.js +12 -7
- package/lib/service/CallApi.js +12 -7
- package/lib/service/IssueReporter.js +12 -7
- package/lib/service/__tests__/IssueReporter.test.js +18 -7
- package/lib/service/getApiClient.js +12 -7
- package/lib/simple/Auth.js +347 -11
- package/lib/simple/Configuration.js +347 -11
- package/lib/simple/Directory.js +12 -7
- package/lib/simple/Phone.js +347 -11
- package/lib/simple/Softphone.js +331 -0
- package/lib/simple/Websocket.js +13 -8
- package/lib/simple/index.js +347 -11
- package/lib/simple/room/LocalParticipant.js +347 -11
- package/lib/simple/room/Participant.js +347 -11
- package/lib/simple/room/RemoteParticipant.js +347 -11
- package/lib/simple/room/Room.js +347 -11
- package/lib/simple/room/SipRoom.js +347 -11
- package/lib/simple/room/Stream.js +347 -11
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +347 -11
- package/lib/simple/utils.js +347 -11
- package/lib/utils/__tests__/api-requester.test.js +12 -7
- package/lib/utils/api-requester.js +12 -7
- package/lib/web-rtc-client.js +17 -10
- package/lib/websocket-client.js +13 -8
- package/package.json +1 -1
- package/src/service/IssueReporter.js +12 -7
- package/src/service/__tests__/IssueReporter.test.js +6 -0
- package/src/simple/Softphone.js +327 -0
- package/src/simple/index.js +2 -0
- package/src/web-rtc-client.js +5 -3
- package/src/websocket-client.js +1 -1
|
@@ -415,13 +415,9 @@ class IssueReporter {
|
|
|
415
415
|
|
|
416
416
|
setTimeout(() => {
|
|
417
417
|
if (isArray) {
|
|
418
|
-
payload = payload.map(message =>
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
});
|
|
422
|
-
} else {
|
|
423
|
-
// $FlowFixMe
|
|
424
|
-
payload._retry = retry + 1;
|
|
418
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
419
|
+
} else if (payload && typeof payload === 'object') {
|
|
420
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
425
421
|
}
|
|
426
422
|
|
|
427
423
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -429,6 +425,15 @@ class IssueReporter {
|
|
|
429
425
|
});
|
|
430
426
|
}
|
|
431
427
|
|
|
428
|
+
_writeRetryCount(message , count ) {
|
|
429
|
+
if (message && typeof message === 'object') {
|
|
430
|
+
// $FlowFixMe
|
|
431
|
+
message._retry = count;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return message;
|
|
435
|
+
}
|
|
436
|
+
|
|
432
437
|
_isLevelAbove(level1 , level2 ) {
|
|
433
438
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
434
439
|
const index2 = LOG_LEVELS.indexOf(level2);
|
|
@@ -7475,8 +7480,10 @@ class WebRTCClient extends Emitter {
|
|
|
7475
7480
|
conference: isConference,
|
|
7476
7481
|
};
|
|
7477
7482
|
|
|
7478
|
-
// Avoid sdh to
|
|
7479
|
-
session.sessionDescriptionHandler
|
|
7483
|
+
// Avoid sdh to create a new stream
|
|
7484
|
+
if (session.sessionDescriptionHandler) {
|
|
7485
|
+
session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
|
|
7486
|
+
}
|
|
7480
7487
|
|
|
7481
7488
|
// Send re-INVITE
|
|
7482
7489
|
return session.invite(options);
|
|
@@ -8319,7 +8326,7 @@ class WebRTCClient extends Emitter {
|
|
|
8319
8326
|
}
|
|
8320
8327
|
|
|
8321
8328
|
async _onHeartbeatTimeout() {
|
|
8322
|
-
logger$8.
|
|
8329
|
+
logger$8.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8323
8330
|
|
|
8324
8331
|
if (this.heartbeatTimeoutCb) {
|
|
8325
8332
|
this.heartbeatTimeoutCb();
|
|
@@ -11487,7 +11494,7 @@ class WebSocketClient extends Emitter {
|
|
|
11487
11494
|
this.close();
|
|
11488
11495
|
}
|
|
11489
11496
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11490
|
-
logger$5.
|
|
11497
|
+
logger$5.info('Wazo WS url computed to reconnect', { url });
|
|
11491
11498
|
|
|
11492
11499
|
return url;
|
|
11493
11500
|
}
|
|
@@ -13115,6 +13122,334 @@ class Checker {
|
|
|
13115
13122
|
}
|
|
13116
13123
|
}
|
|
13117
13124
|
|
|
13125
|
+
//
|
|
13126
|
+
/* eslint-disable no-unused-vars */
|
|
13127
|
+
/* global window, document */
|
|
13128
|
+
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13129
|
+
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13130
|
+
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13131
|
+
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13132
|
+
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13133
|
+
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
13134
|
+
const BRIDGE_SEARCH_OPTIONS = 'bridge/BRIDGE_SEARCH_OPTIONS';
|
|
13135
|
+
const BRIDGE_DISPLAY_LINKED_OPTION = 'bridge/DISPLAY_LINKED_OPTION';
|
|
13136
|
+
const BRIDGE_UPDATE_FORM_SCHEMA = 'bridge/BRIDGE_UPDATE_FORM_SCHEMA';
|
|
13137
|
+
const BRIDGE_WAZO_CONTACT_SEARCH = 'bridge/BRIDGE_WAZO_CONTACT_SEARCH';
|
|
13138
|
+
const BRIDGE_ON_AGENT_LOGGED_IN = 'bridge/BRIDGE_ON_AGENT_LOGGED_IN';
|
|
13139
|
+
const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
13140
|
+
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13141
|
+
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13142
|
+
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13143
|
+
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13144
|
+
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13145
|
+
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
13146
|
+
const BRIDGE_ON_CALL_UN_MUTED = 'bridge/BRIDGE_ON_CALL_UN_MUTED';
|
|
13147
|
+
const BRIDGE_ON_DTMF = 'bridge/BRIDGE_ON_DTMF';
|
|
13148
|
+
const BRIDGE_ON_DIRECT_TRANSFER = 'bridge/BRIDGE_ON_DIRECT_TRANSFER';
|
|
13149
|
+
const BRIDGE_ON_CREATE_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CREATE_INDIRECT_TRANSFER';
|
|
13150
|
+
const BRIDGE_ON_CANCEL_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CANCEL_INDIRECT_TRANSFER';
|
|
13151
|
+
const BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER';
|
|
13152
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE';
|
|
13153
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13154
|
+
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13155
|
+
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13156
|
+
|
|
13157
|
+
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13158
|
+
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
13159
|
+
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13160
|
+
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13161
|
+
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
13162
|
+
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13163
|
+
|
|
13164
|
+
class Softphone {
|
|
13165
|
+
url = 'https://softphone.wazo.io';
|
|
13166
|
+
width = 500;
|
|
13167
|
+
height = 600;
|
|
13168
|
+
displayed = false;
|
|
13169
|
+
iframe = null;
|
|
13170
|
+
|
|
13171
|
+
onLinkEnabled(link ) {}
|
|
13172
|
+
onIFrameLoaded() {}
|
|
13173
|
+
|
|
13174
|
+
onCallMade(call ) {}
|
|
13175
|
+
onCallIncoming(call ) {}
|
|
13176
|
+
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13177
|
+
onCardSaved(card ) {}
|
|
13178
|
+
onAuthenticated(session ) {}
|
|
13179
|
+
onLoggedOut() {}
|
|
13180
|
+
onSearchOptions(fieldId , query ) {}
|
|
13181
|
+
onDisplayLinkedOption(optionId ) {}
|
|
13182
|
+
onWazoContactSearch(query ) {}
|
|
13183
|
+
onAgentLoggedIn() {}
|
|
13184
|
+
onAgentLoggedOut() {}
|
|
13185
|
+
onAgentPaused() {}
|
|
13186
|
+
onAgentResumed() {}
|
|
13187
|
+
onLanguageChanged(language ) {}
|
|
13188
|
+
onCallHeld() {}
|
|
13189
|
+
onCallResumed() {}
|
|
13190
|
+
onCallMuted() {}
|
|
13191
|
+
onCallUnMuted() {}
|
|
13192
|
+
onDtmfSent(tone ) {}
|
|
13193
|
+
onDirectTransfer(number ) {}
|
|
13194
|
+
onCreateIndirectTransfer(number ) {}
|
|
13195
|
+
onCancelIndirectTransfer() {}
|
|
13196
|
+
onConfirmIndirectTransfer() {}
|
|
13197
|
+
onIndirectCallMade(call ) {}
|
|
13198
|
+
onIndirectTransferDone(call ) {}
|
|
13199
|
+
onStartRecording() {}
|
|
13200
|
+
onStopRecording() {}
|
|
13201
|
+
onUnHandledEvent(event ) {}
|
|
13202
|
+
|
|
13203
|
+
init({ url, width, height, server, port, language, wrapUpDuration, shouldDisplayLinkedEntities,
|
|
13204
|
+
allowContactCreation, withCard, subscriptionType, enableAgent } = {}) {
|
|
13205
|
+
if (url) {
|
|
13206
|
+
this.url = url;
|
|
13207
|
+
}
|
|
13208
|
+
if (width) {
|
|
13209
|
+
this.width = width;
|
|
13210
|
+
}
|
|
13211
|
+
if (height) {
|
|
13212
|
+
this.height = height;
|
|
13213
|
+
}
|
|
13214
|
+
|
|
13215
|
+
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13216
|
+
|
|
13217
|
+
if (!server) {
|
|
13218
|
+
// eslint-disable-next-line no-param-reassign
|
|
13219
|
+
server = 'stack.dev.wazo.io';
|
|
13220
|
+
}
|
|
13221
|
+
|
|
13222
|
+
this._createIframe(() => {
|
|
13223
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, {
|
|
13224
|
+
config: {
|
|
13225
|
+
server,
|
|
13226
|
+
port,
|
|
13227
|
+
language,
|
|
13228
|
+
wrapUpDuration,
|
|
13229
|
+
shouldDisplayLinkedEntities,
|
|
13230
|
+
allowContactCreation,
|
|
13231
|
+
},
|
|
13232
|
+
});
|
|
13233
|
+
|
|
13234
|
+
if (withCard) {
|
|
13235
|
+
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13236
|
+
}
|
|
13237
|
+
|
|
13238
|
+
if (subscriptionType) {
|
|
13239
|
+
this._sendMessage(BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE, { subscriptionType });
|
|
13240
|
+
}
|
|
13241
|
+
|
|
13242
|
+
this.onIFrameLoaded();
|
|
13243
|
+
});
|
|
13244
|
+
}
|
|
13245
|
+
|
|
13246
|
+
parseLinks() {
|
|
13247
|
+
const links = this._getLinks();
|
|
13248
|
+
|
|
13249
|
+
links.forEach(link => {
|
|
13250
|
+
link.setAttribute('data-wazo-parsed', true);
|
|
13251
|
+
link.addEventListener('click', this._onLinkClick.bind(this));
|
|
13252
|
+
this.onLinkEnabled(link);
|
|
13253
|
+
});
|
|
13254
|
+
}
|
|
13255
|
+
|
|
13256
|
+
makeCall(number ) {
|
|
13257
|
+
this.displaySoftphone();
|
|
13258
|
+
|
|
13259
|
+
this._sendMessage(SDK_CLICK_TO_CALL, { number });
|
|
13260
|
+
}
|
|
13261
|
+
|
|
13262
|
+
toggleSoftphoneDisplay() {
|
|
13263
|
+
if (this.displayed) {
|
|
13264
|
+
this.hideSoftphone();
|
|
13265
|
+
} else {
|
|
13266
|
+
this.displaySoftphone();
|
|
13267
|
+
}
|
|
13268
|
+
}
|
|
13269
|
+
|
|
13270
|
+
displaySoftphone() {
|
|
13271
|
+
if (!this.iframe) {
|
|
13272
|
+
this._createIframe();
|
|
13273
|
+
}
|
|
13274
|
+
|
|
13275
|
+
if (this.iframe) {
|
|
13276
|
+
this.iframe.style.display = 'block';
|
|
13277
|
+
}
|
|
13278
|
+
|
|
13279
|
+
this.displayed = true;
|
|
13280
|
+
}
|
|
13281
|
+
|
|
13282
|
+
hideSoftphone() {
|
|
13283
|
+
if (this.iframe) {
|
|
13284
|
+
this.iframe.style.display = 'none';
|
|
13285
|
+
}
|
|
13286
|
+
this.displayed = false;
|
|
13287
|
+
}
|
|
13288
|
+
|
|
13289
|
+
optionsFetched(fieldId , options ) {
|
|
13290
|
+
this._sendMessage(BRIDGE_OPTIONS_FETCHED, { fieldId, options });
|
|
13291
|
+
}
|
|
13292
|
+
|
|
13293
|
+
onOptionsResults(fieldId , options ) {
|
|
13294
|
+
this._sendMessage(BRIDGE_OPTIONS_FOUND, { fieldId, options });
|
|
13295
|
+
}
|
|
13296
|
+
|
|
13297
|
+
setFormSchema(schema , uiSchema ) {
|
|
13298
|
+
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
13299
|
+
}
|
|
13300
|
+
|
|
13301
|
+
_createIframe(cb = () => {}) {
|
|
13302
|
+
this.iframe = document.createElement('iframe');
|
|
13303
|
+
// $FlowFixMe
|
|
13304
|
+
this.iframe.width = this.width;
|
|
13305
|
+
// $FlowFixMe
|
|
13306
|
+
this.iframe.height = this.height;
|
|
13307
|
+
// $FlowFixMe
|
|
13308
|
+
this.iframe.allow = 'camera *; microphone *; autoplay *; display-capture *';
|
|
13309
|
+
this.iframe.style.position = 'absolute';
|
|
13310
|
+
this.iframe.style.left = '0';
|
|
13311
|
+
this.iframe.style.bottom = '0';
|
|
13312
|
+
this.iframe.style.border = '1px solid #aaa';
|
|
13313
|
+
this.iframe.style.backgroundColor = 'white';
|
|
13314
|
+
this.iframe.src = this.url;
|
|
13315
|
+
this.iframe.style.display = 'none';
|
|
13316
|
+
this.iframe.id = 'wazo-softphone';
|
|
13317
|
+
|
|
13318
|
+
this.iframe.onload = cb;
|
|
13319
|
+
|
|
13320
|
+
// $FlowFixMe
|
|
13321
|
+
document.body.appendChild(this.iframe);
|
|
13322
|
+
}
|
|
13323
|
+
|
|
13324
|
+
_getLinks() {
|
|
13325
|
+
return [].slice.call(document.querySelectorAll('a:not([data-wazo-parsed])'), 0)
|
|
13326
|
+
.filter(link => link.href.indexOf('tel:') === 0 || link.href.indexOf('callto:') === 0);
|
|
13327
|
+
}
|
|
13328
|
+
|
|
13329
|
+
_onLinkClick(e ) {
|
|
13330
|
+
e.preventDefault();
|
|
13331
|
+
const number = e.target.href.split(':')[1];
|
|
13332
|
+
|
|
13333
|
+
this.makeCall(number);
|
|
13334
|
+
}
|
|
13335
|
+
|
|
13336
|
+
_onAuthenticated() {
|
|
13337
|
+
this.parseLinks();
|
|
13338
|
+
}
|
|
13339
|
+
|
|
13340
|
+
_onMessage(event ) {
|
|
13341
|
+
if (!event.data) {
|
|
13342
|
+
return;
|
|
13343
|
+
}
|
|
13344
|
+
|
|
13345
|
+
switch (event.data.type) {
|
|
13346
|
+
case SDK_ON_CALL_MADE:
|
|
13347
|
+
this.onCallMade(event.data.callSession);
|
|
13348
|
+
break;
|
|
13349
|
+
case SDK_CALL_ENDED: {
|
|
13350
|
+
const { callSession, content, direction, userExtension } = event.data;
|
|
13351
|
+
this.onCallEnded(callSession, content, direction, userExtension);
|
|
13352
|
+
break;
|
|
13353
|
+
}
|
|
13354
|
+
case SDK_CALL_INCOMING:
|
|
13355
|
+
this.onCallIncoming(event.data.callSession);
|
|
13356
|
+
break;
|
|
13357
|
+
case SDK_AUTHENTICATED:
|
|
13358
|
+
// $FlowFixMe
|
|
13359
|
+
this._onAuthenticated(event.data.session);
|
|
13360
|
+
this.onAuthenticated(event.data.session);
|
|
13361
|
+
break;
|
|
13362
|
+
case SDK_LOGGED_OUT:
|
|
13363
|
+
this.onLoggedOut();
|
|
13364
|
+
break;
|
|
13365
|
+
case BRIDGE_CREATE_OR_UPDATE_CARD: {
|
|
13366
|
+
const { content } = event.data;
|
|
13367
|
+
this.onCardSaved(content);
|
|
13368
|
+
break;
|
|
13369
|
+
}
|
|
13370
|
+
case BRIDGE_SEARCH_OPTIONS: {
|
|
13371
|
+
const { fieldId, query } = event.data;
|
|
13372
|
+
this.onSearchOptions(fieldId, query);
|
|
13373
|
+
break;
|
|
13374
|
+
}
|
|
13375
|
+
case BRIDGE_DISPLAY_LINKED_OPTION:
|
|
13376
|
+
this.onDisplayLinkedOption(event.data.linkedOptionId);
|
|
13377
|
+
break;
|
|
13378
|
+
case BRIDGE_WAZO_CONTACT_SEARCH:
|
|
13379
|
+
this.onWazoContactSearch(event.data.query);
|
|
13380
|
+
break;
|
|
13381
|
+
case BRIDGE_ON_AGENT_LOGGED_IN:
|
|
13382
|
+
this.onAgentLoggedIn();
|
|
13383
|
+
break;
|
|
13384
|
+
case BRIDGE_ON_AGENT_LOGGED_OUT:
|
|
13385
|
+
this.onAgentLoggedOut();
|
|
13386
|
+
break;
|
|
13387
|
+
case BRIDGE_ON_AGENT_PAUSED:
|
|
13388
|
+
this.onAgentPaused();
|
|
13389
|
+
break;
|
|
13390
|
+
case BRIDGE_ON_AGENT_RESUMED:
|
|
13391
|
+
this.onAgentResumed();
|
|
13392
|
+
break;
|
|
13393
|
+
case BRIDGE_ON_LANGUAGE_CHANGED:
|
|
13394
|
+
this.onLanguageChanged(event.data.language);
|
|
13395
|
+
break;
|
|
13396
|
+
case BRIDGE_ON_CALL_HELD:
|
|
13397
|
+
this.onCallHeld();
|
|
13398
|
+
break;
|
|
13399
|
+
case BRIDGE_ON_CALL_RESUMED:
|
|
13400
|
+
this.onCallResumed();
|
|
13401
|
+
break;
|
|
13402
|
+
case BRIDGE_ON_CALL_MUTED:
|
|
13403
|
+
this.onCallMuted();
|
|
13404
|
+
break;
|
|
13405
|
+
case BRIDGE_ON_CALL_UN_MUTED:
|
|
13406
|
+
this.onCallUnMuted();
|
|
13407
|
+
break;
|
|
13408
|
+
case BRIDGE_ON_DTMF:
|
|
13409
|
+
this.onDtmfSent(event.data.tone);
|
|
13410
|
+
break;
|
|
13411
|
+
case BRIDGE_ON_DIRECT_TRANSFER:
|
|
13412
|
+
this.onDirectTransfer(event.data.number);
|
|
13413
|
+
break;
|
|
13414
|
+
case BRIDGE_ON_CREATE_INDIRECT_TRANSFER:
|
|
13415
|
+
this.onCreateIndirectTransfer(event.data.number);
|
|
13416
|
+
break;
|
|
13417
|
+
case BRIDGE_ON_CANCEL_INDIRECT_TRANSFER:
|
|
13418
|
+
this.onCancelIndirectTransfer();
|
|
13419
|
+
break;
|
|
13420
|
+
case BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER:
|
|
13421
|
+
this.onConfirmIndirectTransfer();
|
|
13422
|
+
break;
|
|
13423
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE:
|
|
13424
|
+
this.onIndirectCallMade(event.data.call);
|
|
13425
|
+
break;
|
|
13426
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_DONE:
|
|
13427
|
+
this.onIndirectTransferDone(event.data.call);
|
|
13428
|
+
break;
|
|
13429
|
+
case BRIDGE_ON_START_RECORDING:
|
|
13430
|
+
this.onStartRecording();
|
|
13431
|
+
break;
|
|
13432
|
+
case BRIDGE_ON_STOP_RECORDING:
|
|
13433
|
+
this.onStopRecording();
|
|
13434
|
+
break;
|
|
13435
|
+
default:
|
|
13436
|
+
this.onUnHandledEvent(event);
|
|
13437
|
+
break;
|
|
13438
|
+
}
|
|
13439
|
+
}
|
|
13440
|
+
|
|
13441
|
+
_sendMessage(type , payload = {}) {
|
|
13442
|
+
if (!this.iframe) {
|
|
13443
|
+
console.warn(`Could not send message of type ${type} to the Wazo Softphone, iframe not created yet`);
|
|
13444
|
+
return;
|
|
13445
|
+
}
|
|
13446
|
+
|
|
13447
|
+
this.iframe.contentWindow.postMessage({ type, ...payload }, '*');
|
|
13448
|
+
}
|
|
13449
|
+
}
|
|
13450
|
+
|
|
13451
|
+
var Softphone$1 = new Softphone();
|
|
13452
|
+
|
|
13118
13453
|
/* global window */
|
|
13119
13454
|
|
|
13120
13455
|
const Wazo = {
|
|
@@ -13135,6 +13470,7 @@ const Wazo = {
|
|
|
13135
13470
|
loggerFor: IssueReporter$1.loggerFor.bind(IssueReporter$1),
|
|
13136
13471
|
Features: Features$1,
|
|
13137
13472
|
Checker,
|
|
13473
|
+
Softphone: Softphone$1,
|
|
13138
13474
|
|
|
13139
13475
|
// Domain
|
|
13140
13476
|
domain: {
|