@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
package/esm/simple/room/Room.js
CHANGED
|
@@ -13137,8 +13137,6 @@ class Checker {
|
|
|
13137
13137
|
/* eslint-disable no-unused-vars */
|
|
13138
13138
|
/* global window, document */
|
|
13139
13139
|
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13140
|
-
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13141
|
-
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13142
13140
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13143
13141
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13144
13142
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -13151,6 +13149,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13151
13149
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13152
13150
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13153
13151
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13152
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13153
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
13154
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13154
13155
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13155
13156
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13156
13157
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13164,31 +13165,51 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13164
13165
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13165
13166
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13166
13167
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13168
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13169
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13170
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13171
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
13172
|
+
|
|
13173
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13174
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13167
13175
|
|
|
13168
13176
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13169
|
-
const
|
|
13177
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
13170
13178
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13171
13179
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13172
13180
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
13173
13181
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13174
13182
|
|
|
13175
13183
|
class Softphone {
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13184
|
+
|
|
13185
|
+
|
|
13186
|
+
|
|
13187
|
+
|
|
13188
|
+
|
|
13189
|
+
|
|
13190
|
+
|
|
13191
|
+
// Message waiting for the iframe to be loaded
|
|
13192
|
+
|
|
13181
13193
|
|
|
13182
13194
|
onLinkEnabled(link ) {}
|
|
13183
13195
|
onIFrameLoaded() {}
|
|
13184
13196
|
|
|
13185
|
-
|
|
13197
|
+
onCallLocallyAnswered(call ) {}
|
|
13198
|
+
onCallEstablished(call ) {}
|
|
13199
|
+
onOutgoingCallMade(call ) {}
|
|
13186
13200
|
onCallIncoming(call ) {}
|
|
13201
|
+
onCallRejected(call ) {}
|
|
13187
13202
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13203
|
+
|
|
13188
13204
|
onCardSaved(card ) {}
|
|
13205
|
+
onCardCanceled() {}
|
|
13189
13206
|
onAuthenticated(session ) {}
|
|
13190
13207
|
onLoggedOut() {}
|
|
13191
|
-
|
|
13208
|
+
|
|
13209
|
+
onSearchOptions(fieldId , query ) {
|
|
13210
|
+
this.onOptionsResults(fieldId, []);
|
|
13211
|
+
}
|
|
13212
|
+
|
|
13192
13213
|
onDisplayLinkedOption(optionId ) {}
|
|
13193
13214
|
onWazoContactSearch(query ) {}
|
|
13194
13215
|
onAgentLoggedIn() {}
|
|
@@ -13211,18 +13232,26 @@ class Softphone {
|
|
|
13211
13232
|
onStopRecording() {}
|
|
13212
13233
|
onUnHandledEvent(event ) {}
|
|
13213
13234
|
|
|
13214
|
-
init({
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13235
|
+
init({
|
|
13236
|
+
url,
|
|
13237
|
+
width,
|
|
13238
|
+
height,
|
|
13239
|
+
server,
|
|
13240
|
+
port,
|
|
13241
|
+
language,
|
|
13242
|
+
wrapUpDuration,
|
|
13243
|
+
enableAgent = true,
|
|
13244
|
+
tenantId,
|
|
13245
|
+
debug = false,
|
|
13246
|
+
} = {}) {
|
|
13247
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
13248
|
+
this.width = width || 500;
|
|
13249
|
+
this.height = height || 600;
|
|
13250
|
+
this.displayed = false;
|
|
13251
|
+
this.iframeLoaded = false;
|
|
13225
13252
|
|
|
13253
|
+
this.iframeLoaded = false;
|
|
13254
|
+
this._pendingMessages = [];
|
|
13226
13255
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13227
13256
|
|
|
13228
13257
|
if (!server) {
|
|
@@ -13230,25 +13259,33 @@ class Softphone {
|
|
|
13230
13259
|
server = 'stack.dev.wazo.io';
|
|
13231
13260
|
}
|
|
13232
13261
|
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13262
|
+
const config = { server };
|
|
13263
|
+
if (language) {
|
|
13264
|
+
config.language = language;
|
|
13265
|
+
}
|
|
13266
|
+
if (port) {
|
|
13267
|
+
config.port = port;
|
|
13268
|
+
}
|
|
13269
|
+
if (tenantId) {
|
|
13270
|
+
config.tenantId = tenantId;
|
|
13271
|
+
}
|
|
13272
|
+
if (wrapUpDuration) {
|
|
13273
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
13274
|
+
}
|
|
13244
13275
|
|
|
13245
|
-
|
|
13246
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13247
|
-
}
|
|
13276
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
13248
13277
|
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13278
|
+
if (enableAgent) {
|
|
13279
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13280
|
+
}
|
|
13281
|
+
|
|
13282
|
+
if (debug) {
|
|
13283
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
13284
|
+
}
|
|
13285
|
+
|
|
13286
|
+
this._createIframe(() => {
|
|
13287
|
+
this.iframeLoaded = true;
|
|
13288
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
13252
13289
|
|
|
13253
13290
|
this.onIFrameLoaded();
|
|
13254
13291
|
});
|
|
@@ -13309,6 +13346,18 @@ class Softphone {
|
|
|
13309
13346
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
13310
13347
|
}
|
|
13311
13348
|
|
|
13349
|
+
setCardValue(field , value ) {
|
|
13350
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
13351
|
+
}
|
|
13352
|
+
|
|
13353
|
+
injectCss(css ) {
|
|
13354
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
13355
|
+
}
|
|
13356
|
+
|
|
13357
|
+
customizeAppearance(themes , translations , assets ) {
|
|
13358
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
13359
|
+
}
|
|
13360
|
+
|
|
13312
13361
|
_createIframe(cb = () => {}) {
|
|
13313
13362
|
this.iframe = document.createElement('iframe');
|
|
13314
13363
|
// $FlowFixMe
|
|
@@ -13354,8 +13403,8 @@ class Softphone {
|
|
|
13354
13403
|
}
|
|
13355
13404
|
|
|
13356
13405
|
switch (event.data.type) {
|
|
13357
|
-
case
|
|
13358
|
-
this.
|
|
13406
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
13407
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
13359
13408
|
break;
|
|
13360
13409
|
case SDK_CALL_ENDED: {
|
|
13361
13410
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -13443,6 +13492,18 @@ class Softphone {
|
|
|
13443
13492
|
case BRIDGE_ON_STOP_RECORDING:
|
|
13444
13493
|
this.onStopRecording();
|
|
13445
13494
|
break;
|
|
13495
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
13496
|
+
this.onCardCanceled();
|
|
13497
|
+
break;
|
|
13498
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
13499
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
13500
|
+
break;
|
|
13501
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
13502
|
+
this.onCallRejected(event.data.call);
|
|
13503
|
+
break;
|
|
13504
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
13505
|
+
this.onCallEstablished(event.data.call);
|
|
13506
|
+
break;
|
|
13446
13507
|
default:
|
|
13447
13508
|
this.onUnHandledEvent(event);
|
|
13448
13509
|
break;
|
|
@@ -13450,8 +13511,8 @@ class Softphone {
|
|
|
13450
13511
|
}
|
|
13451
13512
|
|
|
13452
13513
|
_sendMessage(type , payload = {}) {
|
|
13453
|
-
if (!this.iframe) {
|
|
13454
|
-
|
|
13514
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
13515
|
+
this._pendingMessages.push([type, payload]);
|
|
13455
13516
|
return;
|
|
13456
13517
|
}
|
|
13457
13518
|
|
|
@@ -13834,8 +13834,6 @@ class Checker {
|
|
|
13834
13834
|
/* eslint-disable no-unused-vars */
|
|
13835
13835
|
/* global window, document */
|
|
13836
13836
|
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13837
|
-
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13838
|
-
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13839
13837
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13840
13838
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13841
13839
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -13848,6 +13846,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13848
13846
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13849
13847
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13850
13848
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13849
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13850
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
13851
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13851
13852
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13852
13853
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13853
13854
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13861,31 +13862,51 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13861
13862
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13862
13863
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13863
13864
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13865
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13866
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13867
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13868
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
13869
|
+
|
|
13870
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13871
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13864
13872
|
|
|
13865
13873
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13866
|
-
const
|
|
13874
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
13867
13875
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13868
13876
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13869
13877
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
13870
13878
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13871
13879
|
|
|
13872
13880
|
class Softphone {
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13881
|
+
|
|
13882
|
+
|
|
13883
|
+
|
|
13884
|
+
|
|
13885
|
+
|
|
13886
|
+
|
|
13887
|
+
|
|
13888
|
+
// Message waiting for the iframe to be loaded
|
|
13889
|
+
|
|
13878
13890
|
|
|
13879
13891
|
onLinkEnabled(link ) {}
|
|
13880
13892
|
onIFrameLoaded() {}
|
|
13881
13893
|
|
|
13882
|
-
|
|
13894
|
+
onCallLocallyAnswered(call ) {}
|
|
13895
|
+
onCallEstablished(call ) {}
|
|
13896
|
+
onOutgoingCallMade(call ) {}
|
|
13883
13897
|
onCallIncoming(call ) {}
|
|
13898
|
+
onCallRejected(call ) {}
|
|
13884
13899
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13900
|
+
|
|
13885
13901
|
onCardSaved(card ) {}
|
|
13902
|
+
onCardCanceled() {}
|
|
13886
13903
|
onAuthenticated(session ) {}
|
|
13887
13904
|
onLoggedOut() {}
|
|
13888
|
-
|
|
13905
|
+
|
|
13906
|
+
onSearchOptions(fieldId , query ) {
|
|
13907
|
+
this.onOptionsResults(fieldId, []);
|
|
13908
|
+
}
|
|
13909
|
+
|
|
13889
13910
|
onDisplayLinkedOption(optionId ) {}
|
|
13890
13911
|
onWazoContactSearch(query ) {}
|
|
13891
13912
|
onAgentLoggedIn() {}
|
|
@@ -13908,18 +13929,26 @@ class Softphone {
|
|
|
13908
13929
|
onStopRecording() {}
|
|
13909
13930
|
onUnHandledEvent(event ) {}
|
|
13910
13931
|
|
|
13911
|
-
init({
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13932
|
+
init({
|
|
13933
|
+
url,
|
|
13934
|
+
width,
|
|
13935
|
+
height,
|
|
13936
|
+
server,
|
|
13937
|
+
port,
|
|
13938
|
+
language,
|
|
13939
|
+
wrapUpDuration,
|
|
13940
|
+
enableAgent = true,
|
|
13941
|
+
tenantId,
|
|
13942
|
+
debug = false,
|
|
13943
|
+
} = {}) {
|
|
13944
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
13945
|
+
this.width = width || 500;
|
|
13946
|
+
this.height = height || 600;
|
|
13947
|
+
this.displayed = false;
|
|
13948
|
+
this.iframeLoaded = false;
|
|
13922
13949
|
|
|
13950
|
+
this.iframeLoaded = false;
|
|
13951
|
+
this._pendingMessages = [];
|
|
13923
13952
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13924
13953
|
|
|
13925
13954
|
if (!server) {
|
|
@@ -13927,25 +13956,33 @@ class Softphone {
|
|
|
13927
13956
|
server = 'stack.dev.wazo.io';
|
|
13928
13957
|
}
|
|
13929
13958
|
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13959
|
+
const config = { server };
|
|
13960
|
+
if (language) {
|
|
13961
|
+
config.language = language;
|
|
13962
|
+
}
|
|
13963
|
+
if (port) {
|
|
13964
|
+
config.port = port;
|
|
13965
|
+
}
|
|
13966
|
+
if (tenantId) {
|
|
13967
|
+
config.tenantId = tenantId;
|
|
13968
|
+
}
|
|
13969
|
+
if (wrapUpDuration) {
|
|
13970
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
13971
|
+
}
|
|
13941
13972
|
|
|
13942
|
-
|
|
13943
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13944
|
-
}
|
|
13973
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
13945
13974
|
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13975
|
+
if (enableAgent) {
|
|
13976
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13977
|
+
}
|
|
13978
|
+
|
|
13979
|
+
if (debug) {
|
|
13980
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
13981
|
+
}
|
|
13982
|
+
|
|
13983
|
+
this._createIframe(() => {
|
|
13984
|
+
this.iframeLoaded = true;
|
|
13985
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
13949
13986
|
|
|
13950
13987
|
this.onIFrameLoaded();
|
|
13951
13988
|
});
|
|
@@ -14006,6 +14043,18 @@ class Softphone {
|
|
|
14006
14043
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14007
14044
|
}
|
|
14008
14045
|
|
|
14046
|
+
setCardValue(field , value ) {
|
|
14047
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
14048
|
+
}
|
|
14049
|
+
|
|
14050
|
+
injectCss(css ) {
|
|
14051
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
14052
|
+
}
|
|
14053
|
+
|
|
14054
|
+
customizeAppearance(themes , translations , assets ) {
|
|
14055
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
14056
|
+
}
|
|
14057
|
+
|
|
14009
14058
|
_createIframe(cb = () => {}) {
|
|
14010
14059
|
this.iframe = document.createElement('iframe');
|
|
14011
14060
|
// $FlowFixMe
|
|
@@ -14051,8 +14100,8 @@ class Softphone {
|
|
|
14051
14100
|
}
|
|
14052
14101
|
|
|
14053
14102
|
switch (event.data.type) {
|
|
14054
|
-
case
|
|
14055
|
-
this.
|
|
14103
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
14104
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
14056
14105
|
break;
|
|
14057
14106
|
case SDK_CALL_ENDED: {
|
|
14058
14107
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -14140,6 +14189,18 @@ class Softphone {
|
|
|
14140
14189
|
case BRIDGE_ON_STOP_RECORDING:
|
|
14141
14190
|
this.onStopRecording();
|
|
14142
14191
|
break;
|
|
14192
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14193
|
+
this.onCardCanceled();
|
|
14194
|
+
break;
|
|
14195
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
14196
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
14197
|
+
break;
|
|
14198
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
14199
|
+
this.onCallRejected(event.data.call);
|
|
14200
|
+
break;
|
|
14201
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
14202
|
+
this.onCallEstablished(event.data.call);
|
|
14203
|
+
break;
|
|
14143
14204
|
default:
|
|
14144
14205
|
this.onUnHandledEvent(event);
|
|
14145
14206
|
break;
|
|
@@ -14147,8 +14208,8 @@ class Softphone {
|
|
|
14147
14208
|
}
|
|
14148
14209
|
|
|
14149
14210
|
_sendMessage(type , payload = {}) {
|
|
14150
|
-
if (!this.iframe) {
|
|
14151
|
-
|
|
14211
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14212
|
+
this._pendingMessages.push([type, payload]);
|
|
14152
14213
|
return;
|
|
14153
14214
|
}
|
|
14154
14215
|
|
|
@@ -13915,8 +13915,6 @@ class Checker {
|
|
|
13915
13915
|
/* eslint-disable no-unused-vars */
|
|
13916
13916
|
/* global window, document */
|
|
13917
13917
|
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13918
|
-
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13919
|
-
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13920
13918
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13921
13919
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13922
13920
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -13929,6 +13927,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13929
13927
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13930
13928
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13931
13929
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13930
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13931
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
13932
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13932
13933
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13933
13934
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13934
13935
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13942,31 +13943,51 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13942
13943
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13943
13944
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13944
13945
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13946
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13947
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13948
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13949
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
13950
|
+
|
|
13951
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13952
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13945
13953
|
|
|
13946
13954
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13947
|
-
const
|
|
13955
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
13948
13956
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13949
13957
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13950
13958
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
13951
13959
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13952
13960
|
|
|
13953
13961
|
class Softphone {
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13962
|
+
|
|
13963
|
+
|
|
13964
|
+
|
|
13965
|
+
|
|
13966
|
+
|
|
13967
|
+
|
|
13968
|
+
|
|
13969
|
+
// Message waiting for the iframe to be loaded
|
|
13970
|
+
|
|
13959
13971
|
|
|
13960
13972
|
onLinkEnabled(link ) {}
|
|
13961
13973
|
onIFrameLoaded() {}
|
|
13962
13974
|
|
|
13963
|
-
|
|
13975
|
+
onCallLocallyAnswered(call ) {}
|
|
13976
|
+
onCallEstablished(call ) {}
|
|
13977
|
+
onOutgoingCallMade(call ) {}
|
|
13964
13978
|
onCallIncoming(call ) {}
|
|
13979
|
+
onCallRejected(call ) {}
|
|
13965
13980
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13981
|
+
|
|
13966
13982
|
onCardSaved(card ) {}
|
|
13983
|
+
onCardCanceled() {}
|
|
13967
13984
|
onAuthenticated(session ) {}
|
|
13968
13985
|
onLoggedOut() {}
|
|
13969
|
-
|
|
13986
|
+
|
|
13987
|
+
onSearchOptions(fieldId , query ) {
|
|
13988
|
+
this.onOptionsResults(fieldId, []);
|
|
13989
|
+
}
|
|
13990
|
+
|
|
13970
13991
|
onDisplayLinkedOption(optionId ) {}
|
|
13971
13992
|
onWazoContactSearch(query ) {}
|
|
13972
13993
|
onAgentLoggedIn() {}
|
|
@@ -13989,18 +14010,26 @@ class Softphone {
|
|
|
13989
14010
|
onStopRecording() {}
|
|
13990
14011
|
onUnHandledEvent(event ) {}
|
|
13991
14012
|
|
|
13992
|
-
init({
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
|
|
14002
|
-
|
|
14013
|
+
init({
|
|
14014
|
+
url,
|
|
14015
|
+
width,
|
|
14016
|
+
height,
|
|
14017
|
+
server,
|
|
14018
|
+
port,
|
|
14019
|
+
language,
|
|
14020
|
+
wrapUpDuration,
|
|
14021
|
+
enableAgent = true,
|
|
14022
|
+
tenantId,
|
|
14023
|
+
debug = false,
|
|
14024
|
+
} = {}) {
|
|
14025
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
14026
|
+
this.width = width || 500;
|
|
14027
|
+
this.height = height || 600;
|
|
14028
|
+
this.displayed = false;
|
|
14029
|
+
this.iframeLoaded = false;
|
|
14003
14030
|
|
|
14031
|
+
this.iframeLoaded = false;
|
|
14032
|
+
this._pendingMessages = [];
|
|
14004
14033
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14005
14034
|
|
|
14006
14035
|
if (!server) {
|
|
@@ -14008,25 +14037,33 @@ class Softphone {
|
|
|
14008
14037
|
server = 'stack.dev.wazo.io';
|
|
14009
14038
|
}
|
|
14010
14039
|
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14040
|
+
const config = { server };
|
|
14041
|
+
if (language) {
|
|
14042
|
+
config.language = language;
|
|
14043
|
+
}
|
|
14044
|
+
if (port) {
|
|
14045
|
+
config.port = port;
|
|
14046
|
+
}
|
|
14047
|
+
if (tenantId) {
|
|
14048
|
+
config.tenantId = tenantId;
|
|
14049
|
+
}
|
|
14050
|
+
if (wrapUpDuration) {
|
|
14051
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
14052
|
+
}
|
|
14022
14053
|
|
|
14023
|
-
|
|
14024
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
14025
|
-
}
|
|
14054
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
14026
14055
|
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14056
|
+
if (enableAgent) {
|
|
14057
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
14058
|
+
}
|
|
14059
|
+
|
|
14060
|
+
if (debug) {
|
|
14061
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
14062
|
+
}
|
|
14063
|
+
|
|
14064
|
+
this._createIframe(() => {
|
|
14065
|
+
this.iframeLoaded = true;
|
|
14066
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
14030
14067
|
|
|
14031
14068
|
this.onIFrameLoaded();
|
|
14032
14069
|
});
|
|
@@ -14087,6 +14124,18 @@ class Softphone {
|
|
|
14087
14124
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14088
14125
|
}
|
|
14089
14126
|
|
|
14127
|
+
setCardValue(field , value ) {
|
|
14128
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
14129
|
+
}
|
|
14130
|
+
|
|
14131
|
+
injectCss(css ) {
|
|
14132
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
14133
|
+
}
|
|
14134
|
+
|
|
14135
|
+
customizeAppearance(themes , translations , assets ) {
|
|
14136
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
14137
|
+
}
|
|
14138
|
+
|
|
14090
14139
|
_createIframe(cb = () => {}) {
|
|
14091
14140
|
this.iframe = document.createElement('iframe');
|
|
14092
14141
|
// $FlowFixMe
|
|
@@ -14132,8 +14181,8 @@ class Softphone {
|
|
|
14132
14181
|
}
|
|
14133
14182
|
|
|
14134
14183
|
switch (event.data.type) {
|
|
14135
|
-
case
|
|
14136
|
-
this.
|
|
14184
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
14185
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
14137
14186
|
break;
|
|
14138
14187
|
case SDK_CALL_ENDED: {
|
|
14139
14188
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -14221,6 +14270,18 @@ class Softphone {
|
|
|
14221
14270
|
case BRIDGE_ON_STOP_RECORDING:
|
|
14222
14271
|
this.onStopRecording();
|
|
14223
14272
|
break;
|
|
14273
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14274
|
+
this.onCardCanceled();
|
|
14275
|
+
break;
|
|
14276
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
14277
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
14278
|
+
break;
|
|
14279
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
14280
|
+
this.onCallRejected(event.data.call);
|
|
14281
|
+
break;
|
|
14282
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
14283
|
+
this.onCallEstablished(event.data.call);
|
|
14284
|
+
break;
|
|
14224
14285
|
default:
|
|
14225
14286
|
this.onUnHandledEvent(event);
|
|
14226
14287
|
break;
|
|
@@ -14228,8 +14289,8 @@ class Softphone {
|
|
|
14228
14289
|
}
|
|
14229
14290
|
|
|
14230
14291
|
_sendMessage(type , payload = {}) {
|
|
14231
|
-
if (!this.iframe) {
|
|
14232
|
-
|
|
14292
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14293
|
+
this._pendingMessages.push([type, payload]);
|
|
14233
14294
|
return;
|
|
14234
14295
|
}
|
|
14235
14296
|
|