@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
|
@@ -6953,7 +6953,7 @@ class WebRTCClient extends Emitter {
|
|
|
6953
6953
|
}
|
|
6954
6954
|
|
|
6955
6955
|
async _onHeartbeatTimeout() {
|
|
6956
|
-
logger.
|
|
6956
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6957
6957
|
|
|
6958
6958
|
if (this.heartbeatTimeoutCb) {
|
|
6959
6959
|
this.heartbeatTimeoutCb();
|
package/esm/checker/Checker.js
CHANGED
|
@@ -7538,7 +7538,7 @@ class WebRTCClient extends Emitter {
|
|
|
7538
7538
|
}
|
|
7539
7539
|
|
|
7540
7540
|
async _onHeartbeatTimeout() {
|
|
7541
|
-
logger$1.
|
|
7541
|
+
logger$1.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7542
7542
|
|
|
7543
7543
|
if (this.heartbeatTimeoutCb) {
|
|
7544
7544
|
this.heartbeatTimeoutCb();
|
|
@@ -7538,7 +7538,7 @@ class WebRTCClient extends Emitter {
|
|
|
7538
7538
|
}
|
|
7539
7539
|
|
|
7540
7540
|
async _onHeartbeatTimeout() {
|
|
7541
|
-
logger.
|
|
7541
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7542
7542
|
|
|
7543
7543
|
if (this.heartbeatTimeoutCb) {
|
|
7544
7544
|
this.heartbeatTimeoutCb();
|
|
@@ -6953,7 +6953,7 @@ class WebRTCClient extends Emitter {
|
|
|
6953
6953
|
}
|
|
6954
6954
|
|
|
6955
6955
|
async _onHeartbeatTimeout() {
|
|
6956
|
-
logger.
|
|
6956
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6957
6957
|
|
|
6958
6958
|
if (this.heartbeatTimeoutCb) {
|
|
6959
6959
|
this.heartbeatTimeoutCb();
|
|
@@ -6953,7 +6953,7 @@ class WebRTCClient extends Emitter {
|
|
|
6953
6953
|
}
|
|
6954
6954
|
|
|
6955
6955
|
async _onHeartbeatTimeout() {
|
|
6956
|
-
logger.
|
|
6956
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6957
6957
|
|
|
6958
6958
|
if (this.heartbeatTimeoutCb) {
|
|
6959
6959
|
this.heartbeatTimeoutCb();
|
package/esm/index.js
CHANGED
|
@@ -7847,7 +7847,7 @@ class WebRTCClient extends Emitter {
|
|
|
7847
7847
|
}
|
|
7848
7848
|
|
|
7849
7849
|
async _onHeartbeatTimeout() {
|
|
7850
|
-
logger$9.
|
|
7850
|
+
logger$9.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7851
7851
|
|
|
7852
7852
|
if (this.heartbeatTimeoutCb) {
|
|
7853
7853
|
this.heartbeatTimeoutCb();
|
|
@@ -14110,11 +14110,41 @@ const createLocalAudioStream = async (options ) => createLocalStream('aud
|
|
|
14110
14110
|
//
|
|
14111
14111
|
/* eslint-disable no-unused-vars */
|
|
14112
14112
|
/* global window, document */
|
|
14113
|
+
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
14114
|
+
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
14115
|
+
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
14116
|
+
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
14117
|
+
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
14118
|
+
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
14119
|
+
const BRIDGE_SEARCH_OPTIONS = 'bridge/BRIDGE_SEARCH_OPTIONS';
|
|
14120
|
+
const BRIDGE_DISPLAY_LINKED_OPTION = 'bridge/DISPLAY_LINKED_OPTION';
|
|
14121
|
+
const BRIDGE_UPDATE_FORM_SCHEMA = 'bridge/BRIDGE_UPDATE_FORM_SCHEMA';
|
|
14122
|
+
const BRIDGE_WAZO_CONTACT_SEARCH = 'bridge/BRIDGE_WAZO_CONTACT_SEARCH';
|
|
14123
|
+
const BRIDGE_ON_AGENT_LOGGED_IN = 'bridge/BRIDGE_ON_AGENT_LOGGED_IN';
|
|
14124
|
+
const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
14125
|
+
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
14126
|
+
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
14127
|
+
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
14128
|
+
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
14129
|
+
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
14130
|
+
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
14131
|
+
const BRIDGE_ON_CALL_UN_MUTED = 'bridge/BRIDGE_ON_CALL_UN_MUTED';
|
|
14132
|
+
const BRIDGE_ON_DTMF = 'bridge/BRIDGE_ON_DTMF';
|
|
14133
|
+
const BRIDGE_ON_DIRECT_TRANSFER = 'bridge/BRIDGE_ON_DIRECT_TRANSFER';
|
|
14134
|
+
const BRIDGE_ON_CREATE_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CREATE_INDIRECT_TRANSFER';
|
|
14135
|
+
const BRIDGE_ON_CANCEL_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CANCEL_INDIRECT_TRANSFER';
|
|
14136
|
+
const BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER';
|
|
14137
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE';
|
|
14138
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
14139
|
+
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
14140
|
+
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
14141
|
+
|
|
14113
14142
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
14114
14143
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
14115
14144
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
14116
14145
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
14117
14146
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
14147
|
+
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
14118
14148
|
|
|
14119
14149
|
class Softphone {
|
|
14120
14150
|
url = 'https://softphone.wazo.io';
|
|
@@ -14124,13 +14154,39 @@ class Softphone {
|
|
|
14124
14154
|
iframe = null;
|
|
14125
14155
|
|
|
14126
14156
|
onLinkEnabled(link ) {}
|
|
14157
|
+
onIFrameLoaded() {}
|
|
14127
14158
|
|
|
14128
14159
|
onCallMade(call ) {}
|
|
14129
14160
|
onCallIncoming(call ) {}
|
|
14130
14161
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
14162
|
+
onCardSaved(card ) {}
|
|
14131
14163
|
onAuthenticated(session ) {}
|
|
14132
|
-
|
|
14133
|
-
|
|
14164
|
+
onLoggedOut() {}
|
|
14165
|
+
onSearchOptions(fieldId , query ) {}
|
|
14166
|
+
onDisplayLinkedOption(optionId ) {}
|
|
14167
|
+
onWazoContactSearch(query ) {}
|
|
14168
|
+
onAgentLoggedIn() {}
|
|
14169
|
+
onAgentLoggedOut() {}
|
|
14170
|
+
onAgentPaused() {}
|
|
14171
|
+
onAgentResumed() {}
|
|
14172
|
+
onLanguageChanged(language ) {}
|
|
14173
|
+
onCallHeld() {}
|
|
14174
|
+
onCallResumed() {}
|
|
14175
|
+
onCallMuted() {}
|
|
14176
|
+
onCallUnMuted() {}
|
|
14177
|
+
onDtmfSent(tone ) {}
|
|
14178
|
+
onDirectTransfer(number ) {}
|
|
14179
|
+
onCreateIndirectTransfer(number ) {}
|
|
14180
|
+
onCancelIndirectTransfer() {}
|
|
14181
|
+
onConfirmIndirectTransfer() {}
|
|
14182
|
+
onIndirectCallMade(call ) {}
|
|
14183
|
+
onIndirectTransferDone(call ) {}
|
|
14184
|
+
onStartRecording() {}
|
|
14185
|
+
onStopRecording() {}
|
|
14186
|
+
onUnHandledEvent(event ) {}
|
|
14187
|
+
|
|
14188
|
+
init({ url, width, height, server, port, language, wrapUpDuration, shouldDisplayLinkedEntities,
|
|
14189
|
+
allowContactCreation, withCard, subscriptionType, enableAgent } = {}) {
|
|
14134
14190
|
if (url) {
|
|
14135
14191
|
this.url = url;
|
|
14136
14192
|
}
|
|
@@ -14143,7 +14199,33 @@ class Softphone {
|
|
|
14143
14199
|
|
|
14144
14200
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14145
14201
|
|
|
14146
|
-
|
|
14202
|
+
if (!server) {
|
|
14203
|
+
// eslint-disable-next-line no-param-reassign
|
|
14204
|
+
server = 'stack.dev.wazo.io';
|
|
14205
|
+
}
|
|
14206
|
+
|
|
14207
|
+
this._createIframe(() => {
|
|
14208
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, {
|
|
14209
|
+
config: {
|
|
14210
|
+
server,
|
|
14211
|
+
port,
|
|
14212
|
+
language,
|
|
14213
|
+
wrapUpDuration,
|
|
14214
|
+
shouldDisplayLinkedEntities,
|
|
14215
|
+
allowContactCreation,
|
|
14216
|
+
},
|
|
14217
|
+
});
|
|
14218
|
+
|
|
14219
|
+
if (withCard) {
|
|
14220
|
+
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
14221
|
+
}
|
|
14222
|
+
|
|
14223
|
+
if (subscriptionType) {
|
|
14224
|
+
this._sendMessage(BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE, { subscriptionType });
|
|
14225
|
+
}
|
|
14226
|
+
|
|
14227
|
+
this.onIFrameLoaded();
|
|
14228
|
+
});
|
|
14147
14229
|
}
|
|
14148
14230
|
|
|
14149
14231
|
parseLinks() {
|
|
@@ -14159,9 +14241,7 @@ class Softphone {
|
|
|
14159
14241
|
makeCall(number ) {
|
|
14160
14242
|
this.displaySoftphone();
|
|
14161
14243
|
|
|
14162
|
-
|
|
14163
|
-
this.iframe.contentWindow.postMessage({ type: SDK_CLICK_TO_CALL, number }, '*');
|
|
14164
|
-
}
|
|
14244
|
+
this._sendMessage(SDK_CLICK_TO_CALL, { number });
|
|
14165
14245
|
}
|
|
14166
14246
|
|
|
14167
14247
|
toggleSoftphoneDisplay() {
|
|
@@ -14170,8 +14250,6 @@ class Softphone {
|
|
|
14170
14250
|
} else {
|
|
14171
14251
|
this.displaySoftphone();
|
|
14172
14252
|
}
|
|
14173
|
-
|
|
14174
|
-
this.displayed = !this.displayed;
|
|
14175
14253
|
}
|
|
14176
14254
|
|
|
14177
14255
|
displaySoftphone() {
|
|
@@ -14182,15 +14260,30 @@ class Softphone {
|
|
|
14182
14260
|
if (this.iframe) {
|
|
14183
14261
|
this.iframe.style.display = 'block';
|
|
14184
14262
|
}
|
|
14263
|
+
|
|
14264
|
+
this.displayed = true;
|
|
14185
14265
|
}
|
|
14186
14266
|
|
|
14187
14267
|
hideSoftphone() {
|
|
14188
14268
|
if (this.iframe) {
|
|
14189
14269
|
this.iframe.style.display = 'none';
|
|
14190
14270
|
}
|
|
14271
|
+
this.displayed = false;
|
|
14272
|
+
}
|
|
14273
|
+
|
|
14274
|
+
optionsFetched(fieldId , options ) {
|
|
14275
|
+
this._sendMessage(BRIDGE_OPTIONS_FETCHED, { fieldId, options });
|
|
14276
|
+
}
|
|
14277
|
+
|
|
14278
|
+
onOptionsResults(fieldId , options ) {
|
|
14279
|
+
this._sendMessage(BRIDGE_OPTIONS_FOUND, { fieldId, options });
|
|
14280
|
+
}
|
|
14281
|
+
|
|
14282
|
+
setFormSchema(schema , uiSchema ) {
|
|
14283
|
+
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14191
14284
|
}
|
|
14192
14285
|
|
|
14193
|
-
_createIframe() {
|
|
14286
|
+
_createIframe(cb = () => {}) {
|
|
14194
14287
|
this.iframe = document.createElement('iframe');
|
|
14195
14288
|
// $FlowFixMe
|
|
14196
14289
|
this.iframe.width = this.width;
|
|
@@ -14202,10 +14295,13 @@ class Softphone {
|
|
|
14202
14295
|
this.iframe.style.left = '0';
|
|
14203
14296
|
this.iframe.style.bottom = '0';
|
|
14204
14297
|
this.iframe.style.border = '1px solid #aaa';
|
|
14298
|
+
this.iframe.style.backgroundColor = 'white';
|
|
14205
14299
|
this.iframe.src = this.url;
|
|
14206
14300
|
this.iframe.style.display = 'none';
|
|
14207
14301
|
this.iframe.id = 'wazo-softphone';
|
|
14208
14302
|
|
|
14303
|
+
this.iframe.onload = cb;
|
|
14304
|
+
|
|
14209
14305
|
// $FlowFixMe
|
|
14210
14306
|
document.body.appendChild(this.iframe);
|
|
14211
14307
|
}
|
|
@@ -14248,8 +14344,93 @@ class Softphone {
|
|
|
14248
14344
|
this._onAuthenticated(event.data.session);
|
|
14249
14345
|
this.onAuthenticated(event.data.session);
|
|
14250
14346
|
break;
|
|
14347
|
+
case SDK_LOGGED_OUT:
|
|
14348
|
+
this.onLoggedOut();
|
|
14349
|
+
break;
|
|
14350
|
+
case BRIDGE_CREATE_OR_UPDATE_CARD: {
|
|
14351
|
+
const { content } = event.data;
|
|
14352
|
+
this.onCardSaved(content);
|
|
14353
|
+
break;
|
|
14354
|
+
}
|
|
14355
|
+
case BRIDGE_SEARCH_OPTIONS: {
|
|
14356
|
+
const { fieldId, query } = event.data;
|
|
14357
|
+
this.onSearchOptions(fieldId, query);
|
|
14358
|
+
break;
|
|
14359
|
+
}
|
|
14360
|
+
case BRIDGE_DISPLAY_LINKED_OPTION:
|
|
14361
|
+
this.onDisplayLinkedOption(event.data.linkedOptionId);
|
|
14362
|
+
break;
|
|
14363
|
+
case BRIDGE_WAZO_CONTACT_SEARCH:
|
|
14364
|
+
this.onWazoContactSearch(event.data.query);
|
|
14365
|
+
break;
|
|
14366
|
+
case BRIDGE_ON_AGENT_LOGGED_IN:
|
|
14367
|
+
this.onAgentLoggedIn();
|
|
14368
|
+
break;
|
|
14369
|
+
case BRIDGE_ON_AGENT_LOGGED_OUT:
|
|
14370
|
+
this.onAgentLoggedOut();
|
|
14371
|
+
break;
|
|
14372
|
+
case BRIDGE_ON_AGENT_PAUSED:
|
|
14373
|
+
this.onAgentPaused();
|
|
14374
|
+
break;
|
|
14375
|
+
case BRIDGE_ON_AGENT_RESUMED:
|
|
14376
|
+
this.onAgentResumed();
|
|
14377
|
+
break;
|
|
14378
|
+
case BRIDGE_ON_LANGUAGE_CHANGED:
|
|
14379
|
+
this.onLanguageChanged(event.data.language);
|
|
14380
|
+
break;
|
|
14381
|
+
case BRIDGE_ON_CALL_HELD:
|
|
14382
|
+
this.onCallHeld();
|
|
14383
|
+
break;
|
|
14384
|
+
case BRIDGE_ON_CALL_RESUMED:
|
|
14385
|
+
this.onCallResumed();
|
|
14386
|
+
break;
|
|
14387
|
+
case BRIDGE_ON_CALL_MUTED:
|
|
14388
|
+
this.onCallMuted();
|
|
14389
|
+
break;
|
|
14390
|
+
case BRIDGE_ON_CALL_UN_MUTED:
|
|
14391
|
+
this.onCallUnMuted();
|
|
14392
|
+
break;
|
|
14393
|
+
case BRIDGE_ON_DTMF:
|
|
14394
|
+
this.onDtmfSent(event.data.tone);
|
|
14395
|
+
break;
|
|
14396
|
+
case BRIDGE_ON_DIRECT_TRANSFER:
|
|
14397
|
+
this.onDirectTransfer(event.data.number);
|
|
14398
|
+
break;
|
|
14399
|
+
case BRIDGE_ON_CREATE_INDIRECT_TRANSFER:
|
|
14400
|
+
this.onCreateIndirectTransfer(event.data.number);
|
|
14401
|
+
break;
|
|
14402
|
+
case BRIDGE_ON_CANCEL_INDIRECT_TRANSFER:
|
|
14403
|
+
this.onCancelIndirectTransfer();
|
|
14404
|
+
break;
|
|
14405
|
+
case BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER:
|
|
14406
|
+
this.onConfirmIndirectTransfer();
|
|
14407
|
+
break;
|
|
14408
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE:
|
|
14409
|
+
this.onIndirectCallMade(event.data.call);
|
|
14410
|
+
break;
|
|
14411
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_DONE:
|
|
14412
|
+
this.onIndirectTransferDone(event.data.call);
|
|
14413
|
+
break;
|
|
14414
|
+
case BRIDGE_ON_START_RECORDING:
|
|
14415
|
+
this.onStartRecording();
|
|
14416
|
+
break;
|
|
14417
|
+
case BRIDGE_ON_STOP_RECORDING:
|
|
14418
|
+
this.onStopRecording();
|
|
14419
|
+
break;
|
|
14420
|
+
default:
|
|
14421
|
+
this.onUnHandledEvent(event);
|
|
14422
|
+
break;
|
|
14251
14423
|
}
|
|
14252
14424
|
}
|
|
14425
|
+
|
|
14426
|
+
_sendMessage(type , payload = {}) {
|
|
14427
|
+
if (!this.iframe) {
|
|
14428
|
+
console.warn(`Could not send message of type ${type} to the Wazo Softphone, iframe not created yet`);
|
|
14429
|
+
return;
|
|
14430
|
+
}
|
|
14431
|
+
|
|
14432
|
+
this.iframe.contentWindow.postMessage({ type, ...payload }, '*');
|
|
14433
|
+
}
|
|
14253
14434
|
}
|
|
14254
14435
|
|
|
14255
14436
|
var Softphone$1 = new Softphone();
|
package/esm/simple/Auth.js
CHANGED
|
@@ -8025,7 +8025,7 @@ class WebRTCClient extends Emitter {
|
|
|
8025
8025
|
}
|
|
8026
8026
|
|
|
8027
8027
|
async _onHeartbeatTimeout() {
|
|
8028
|
-
logger$9.
|
|
8028
|
+
logger$9.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8029
8029
|
|
|
8030
8030
|
if (this.heartbeatTimeoutCb) {
|
|
8031
8031
|
this.heartbeatTimeoutCb();
|
|
@@ -13671,11 +13671,41 @@ class Checker {
|
|
|
13671
13671
|
//
|
|
13672
13672
|
/* eslint-disable no-unused-vars */
|
|
13673
13673
|
/* global window, document */
|
|
13674
|
+
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13675
|
+
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13676
|
+
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13677
|
+
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13678
|
+
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13679
|
+
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
13680
|
+
const BRIDGE_SEARCH_OPTIONS = 'bridge/BRIDGE_SEARCH_OPTIONS';
|
|
13681
|
+
const BRIDGE_DISPLAY_LINKED_OPTION = 'bridge/DISPLAY_LINKED_OPTION';
|
|
13682
|
+
const BRIDGE_UPDATE_FORM_SCHEMA = 'bridge/BRIDGE_UPDATE_FORM_SCHEMA';
|
|
13683
|
+
const BRIDGE_WAZO_CONTACT_SEARCH = 'bridge/BRIDGE_WAZO_CONTACT_SEARCH';
|
|
13684
|
+
const BRIDGE_ON_AGENT_LOGGED_IN = 'bridge/BRIDGE_ON_AGENT_LOGGED_IN';
|
|
13685
|
+
const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
13686
|
+
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13687
|
+
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13688
|
+
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13689
|
+
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13690
|
+
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13691
|
+
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
13692
|
+
const BRIDGE_ON_CALL_UN_MUTED = 'bridge/BRIDGE_ON_CALL_UN_MUTED';
|
|
13693
|
+
const BRIDGE_ON_DTMF = 'bridge/BRIDGE_ON_DTMF';
|
|
13694
|
+
const BRIDGE_ON_DIRECT_TRANSFER = 'bridge/BRIDGE_ON_DIRECT_TRANSFER';
|
|
13695
|
+
const BRIDGE_ON_CREATE_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CREATE_INDIRECT_TRANSFER';
|
|
13696
|
+
const BRIDGE_ON_CANCEL_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CANCEL_INDIRECT_TRANSFER';
|
|
13697
|
+
const BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER';
|
|
13698
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE';
|
|
13699
|
+
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13700
|
+
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13701
|
+
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13702
|
+
|
|
13674
13703
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13675
13704
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
13676
13705
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13677
13706
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13678
13707
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
13708
|
+
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13679
13709
|
|
|
13680
13710
|
class Softphone {
|
|
13681
13711
|
url = 'https://softphone.wazo.io';
|
|
@@ -13685,13 +13715,39 @@ class Softphone {
|
|
|
13685
13715
|
iframe = null;
|
|
13686
13716
|
|
|
13687
13717
|
onLinkEnabled(link ) {}
|
|
13718
|
+
onIFrameLoaded() {}
|
|
13688
13719
|
|
|
13689
13720
|
onCallMade(call ) {}
|
|
13690
13721
|
onCallIncoming(call ) {}
|
|
13691
13722
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13723
|
+
onCardSaved(card ) {}
|
|
13692
13724
|
onAuthenticated(session ) {}
|
|
13693
|
-
|
|
13694
|
-
|
|
13725
|
+
onLoggedOut() {}
|
|
13726
|
+
onSearchOptions(fieldId , query ) {}
|
|
13727
|
+
onDisplayLinkedOption(optionId ) {}
|
|
13728
|
+
onWazoContactSearch(query ) {}
|
|
13729
|
+
onAgentLoggedIn() {}
|
|
13730
|
+
onAgentLoggedOut() {}
|
|
13731
|
+
onAgentPaused() {}
|
|
13732
|
+
onAgentResumed() {}
|
|
13733
|
+
onLanguageChanged(language ) {}
|
|
13734
|
+
onCallHeld() {}
|
|
13735
|
+
onCallResumed() {}
|
|
13736
|
+
onCallMuted() {}
|
|
13737
|
+
onCallUnMuted() {}
|
|
13738
|
+
onDtmfSent(tone ) {}
|
|
13739
|
+
onDirectTransfer(number ) {}
|
|
13740
|
+
onCreateIndirectTransfer(number ) {}
|
|
13741
|
+
onCancelIndirectTransfer() {}
|
|
13742
|
+
onConfirmIndirectTransfer() {}
|
|
13743
|
+
onIndirectCallMade(call ) {}
|
|
13744
|
+
onIndirectTransferDone(call ) {}
|
|
13745
|
+
onStartRecording() {}
|
|
13746
|
+
onStopRecording() {}
|
|
13747
|
+
onUnHandledEvent(event ) {}
|
|
13748
|
+
|
|
13749
|
+
init({ url, width, height, server, port, language, wrapUpDuration, shouldDisplayLinkedEntities,
|
|
13750
|
+
allowContactCreation, withCard, subscriptionType, enableAgent } = {}) {
|
|
13695
13751
|
if (url) {
|
|
13696
13752
|
this.url = url;
|
|
13697
13753
|
}
|
|
@@ -13704,7 +13760,33 @@ class Softphone {
|
|
|
13704
13760
|
|
|
13705
13761
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13706
13762
|
|
|
13707
|
-
|
|
13763
|
+
if (!server) {
|
|
13764
|
+
// eslint-disable-next-line no-param-reassign
|
|
13765
|
+
server = 'stack.dev.wazo.io';
|
|
13766
|
+
}
|
|
13767
|
+
|
|
13768
|
+
this._createIframe(() => {
|
|
13769
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, {
|
|
13770
|
+
config: {
|
|
13771
|
+
server,
|
|
13772
|
+
port,
|
|
13773
|
+
language,
|
|
13774
|
+
wrapUpDuration,
|
|
13775
|
+
shouldDisplayLinkedEntities,
|
|
13776
|
+
allowContactCreation,
|
|
13777
|
+
},
|
|
13778
|
+
});
|
|
13779
|
+
|
|
13780
|
+
if (withCard) {
|
|
13781
|
+
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13782
|
+
}
|
|
13783
|
+
|
|
13784
|
+
if (subscriptionType) {
|
|
13785
|
+
this._sendMessage(BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE, { subscriptionType });
|
|
13786
|
+
}
|
|
13787
|
+
|
|
13788
|
+
this.onIFrameLoaded();
|
|
13789
|
+
});
|
|
13708
13790
|
}
|
|
13709
13791
|
|
|
13710
13792
|
parseLinks() {
|
|
@@ -13720,9 +13802,7 @@ class Softphone {
|
|
|
13720
13802
|
makeCall(number ) {
|
|
13721
13803
|
this.displaySoftphone();
|
|
13722
13804
|
|
|
13723
|
-
|
|
13724
|
-
this.iframe.contentWindow.postMessage({ type: SDK_CLICK_TO_CALL, number }, '*');
|
|
13725
|
-
}
|
|
13805
|
+
this._sendMessage(SDK_CLICK_TO_CALL, { number });
|
|
13726
13806
|
}
|
|
13727
13807
|
|
|
13728
13808
|
toggleSoftphoneDisplay() {
|
|
@@ -13731,8 +13811,6 @@ class Softphone {
|
|
|
13731
13811
|
} else {
|
|
13732
13812
|
this.displaySoftphone();
|
|
13733
13813
|
}
|
|
13734
|
-
|
|
13735
|
-
this.displayed = !this.displayed;
|
|
13736
13814
|
}
|
|
13737
13815
|
|
|
13738
13816
|
displaySoftphone() {
|
|
@@ -13743,15 +13821,30 @@ class Softphone {
|
|
|
13743
13821
|
if (this.iframe) {
|
|
13744
13822
|
this.iframe.style.display = 'block';
|
|
13745
13823
|
}
|
|
13824
|
+
|
|
13825
|
+
this.displayed = true;
|
|
13746
13826
|
}
|
|
13747
13827
|
|
|
13748
13828
|
hideSoftphone() {
|
|
13749
13829
|
if (this.iframe) {
|
|
13750
13830
|
this.iframe.style.display = 'none';
|
|
13751
13831
|
}
|
|
13832
|
+
this.displayed = false;
|
|
13833
|
+
}
|
|
13834
|
+
|
|
13835
|
+
optionsFetched(fieldId , options ) {
|
|
13836
|
+
this._sendMessage(BRIDGE_OPTIONS_FETCHED, { fieldId, options });
|
|
13837
|
+
}
|
|
13838
|
+
|
|
13839
|
+
onOptionsResults(fieldId , options ) {
|
|
13840
|
+
this._sendMessage(BRIDGE_OPTIONS_FOUND, { fieldId, options });
|
|
13841
|
+
}
|
|
13842
|
+
|
|
13843
|
+
setFormSchema(schema , uiSchema ) {
|
|
13844
|
+
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
13752
13845
|
}
|
|
13753
13846
|
|
|
13754
|
-
_createIframe() {
|
|
13847
|
+
_createIframe(cb = () => {}) {
|
|
13755
13848
|
this.iframe = document.createElement('iframe');
|
|
13756
13849
|
// $FlowFixMe
|
|
13757
13850
|
this.iframe.width = this.width;
|
|
@@ -13763,10 +13856,13 @@ class Softphone {
|
|
|
13763
13856
|
this.iframe.style.left = '0';
|
|
13764
13857
|
this.iframe.style.bottom = '0';
|
|
13765
13858
|
this.iframe.style.border = '1px solid #aaa';
|
|
13859
|
+
this.iframe.style.backgroundColor = 'white';
|
|
13766
13860
|
this.iframe.src = this.url;
|
|
13767
13861
|
this.iframe.style.display = 'none';
|
|
13768
13862
|
this.iframe.id = 'wazo-softphone';
|
|
13769
13863
|
|
|
13864
|
+
this.iframe.onload = cb;
|
|
13865
|
+
|
|
13770
13866
|
// $FlowFixMe
|
|
13771
13867
|
document.body.appendChild(this.iframe);
|
|
13772
13868
|
}
|
|
@@ -13809,8 +13905,93 @@ class Softphone {
|
|
|
13809
13905
|
this._onAuthenticated(event.data.session);
|
|
13810
13906
|
this.onAuthenticated(event.data.session);
|
|
13811
13907
|
break;
|
|
13908
|
+
case SDK_LOGGED_OUT:
|
|
13909
|
+
this.onLoggedOut();
|
|
13910
|
+
break;
|
|
13911
|
+
case BRIDGE_CREATE_OR_UPDATE_CARD: {
|
|
13912
|
+
const { content } = event.data;
|
|
13913
|
+
this.onCardSaved(content);
|
|
13914
|
+
break;
|
|
13915
|
+
}
|
|
13916
|
+
case BRIDGE_SEARCH_OPTIONS: {
|
|
13917
|
+
const { fieldId, query } = event.data;
|
|
13918
|
+
this.onSearchOptions(fieldId, query);
|
|
13919
|
+
break;
|
|
13920
|
+
}
|
|
13921
|
+
case BRIDGE_DISPLAY_LINKED_OPTION:
|
|
13922
|
+
this.onDisplayLinkedOption(event.data.linkedOptionId);
|
|
13923
|
+
break;
|
|
13924
|
+
case BRIDGE_WAZO_CONTACT_SEARCH:
|
|
13925
|
+
this.onWazoContactSearch(event.data.query);
|
|
13926
|
+
break;
|
|
13927
|
+
case BRIDGE_ON_AGENT_LOGGED_IN:
|
|
13928
|
+
this.onAgentLoggedIn();
|
|
13929
|
+
break;
|
|
13930
|
+
case BRIDGE_ON_AGENT_LOGGED_OUT:
|
|
13931
|
+
this.onAgentLoggedOut();
|
|
13932
|
+
break;
|
|
13933
|
+
case BRIDGE_ON_AGENT_PAUSED:
|
|
13934
|
+
this.onAgentPaused();
|
|
13935
|
+
break;
|
|
13936
|
+
case BRIDGE_ON_AGENT_RESUMED:
|
|
13937
|
+
this.onAgentResumed();
|
|
13938
|
+
break;
|
|
13939
|
+
case BRIDGE_ON_LANGUAGE_CHANGED:
|
|
13940
|
+
this.onLanguageChanged(event.data.language);
|
|
13941
|
+
break;
|
|
13942
|
+
case BRIDGE_ON_CALL_HELD:
|
|
13943
|
+
this.onCallHeld();
|
|
13944
|
+
break;
|
|
13945
|
+
case BRIDGE_ON_CALL_RESUMED:
|
|
13946
|
+
this.onCallResumed();
|
|
13947
|
+
break;
|
|
13948
|
+
case BRIDGE_ON_CALL_MUTED:
|
|
13949
|
+
this.onCallMuted();
|
|
13950
|
+
break;
|
|
13951
|
+
case BRIDGE_ON_CALL_UN_MUTED:
|
|
13952
|
+
this.onCallUnMuted();
|
|
13953
|
+
break;
|
|
13954
|
+
case BRIDGE_ON_DTMF:
|
|
13955
|
+
this.onDtmfSent(event.data.tone);
|
|
13956
|
+
break;
|
|
13957
|
+
case BRIDGE_ON_DIRECT_TRANSFER:
|
|
13958
|
+
this.onDirectTransfer(event.data.number);
|
|
13959
|
+
break;
|
|
13960
|
+
case BRIDGE_ON_CREATE_INDIRECT_TRANSFER:
|
|
13961
|
+
this.onCreateIndirectTransfer(event.data.number);
|
|
13962
|
+
break;
|
|
13963
|
+
case BRIDGE_ON_CANCEL_INDIRECT_TRANSFER:
|
|
13964
|
+
this.onCancelIndirectTransfer();
|
|
13965
|
+
break;
|
|
13966
|
+
case BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER:
|
|
13967
|
+
this.onConfirmIndirectTransfer();
|
|
13968
|
+
break;
|
|
13969
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE:
|
|
13970
|
+
this.onIndirectCallMade(event.data.call);
|
|
13971
|
+
break;
|
|
13972
|
+
case BRIDGE_ON_INDIRECT_TRANSFER_DONE:
|
|
13973
|
+
this.onIndirectTransferDone(event.data.call);
|
|
13974
|
+
break;
|
|
13975
|
+
case BRIDGE_ON_START_RECORDING:
|
|
13976
|
+
this.onStartRecording();
|
|
13977
|
+
break;
|
|
13978
|
+
case BRIDGE_ON_STOP_RECORDING:
|
|
13979
|
+
this.onStopRecording();
|
|
13980
|
+
break;
|
|
13981
|
+
default:
|
|
13982
|
+
this.onUnHandledEvent(event);
|
|
13983
|
+
break;
|
|
13812
13984
|
}
|
|
13813
13985
|
}
|
|
13986
|
+
|
|
13987
|
+
_sendMessage(type , payload = {}) {
|
|
13988
|
+
if (!this.iframe) {
|
|
13989
|
+
console.warn(`Could not send message of type ${type} to the Wazo Softphone, iframe not created yet`);
|
|
13990
|
+
return;
|
|
13991
|
+
}
|
|
13992
|
+
|
|
13993
|
+
this.iframe.contentWindow.postMessage({ type, ...payload }, '*');
|
|
13994
|
+
}
|
|
13814
13995
|
}
|
|
13815
13996
|
|
|
13816
13997
|
var Softphone$1 = new Softphone();
|