@wazo/sdk 0.38.1 → 0.38.2
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 +31 -3
- package/dist/wazo-sdk.js +1 -1
- package/esm/index.js +69 -38
- package/esm/simple/Auth.js +69 -38
- package/esm/simple/Configuration.js +69 -38
- package/esm/simple/Phone.js +69 -38
- package/esm/simple/Softphone.js +70 -39
- package/esm/simple/index.js +69 -38
- package/esm/simple/room/LocalParticipant.js +69 -38
- package/esm/simple/room/Participant.js +69 -38
- package/esm/simple/room/RemoteParticipant.js +69 -38
- package/esm/simple/room/Room.js +69 -38
- package/esm/simple/room/SipRoom.js +69 -38
- package/esm/simple/room/Stream.js +69 -38
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +69 -38
- package/esm/simple/utils.js +69 -38
- package/lib/index.js +69 -38
- package/lib/simple/Auth.js +69 -38
- package/lib/simple/Configuration.js +69 -38
- package/lib/simple/Phone.js +69 -38
- package/lib/simple/Softphone.js +70 -39
- package/lib/simple/index.js +69 -38
- package/lib/simple/room/LocalParticipant.js +69 -38
- package/lib/simple/room/Participant.js +69 -38
- package/lib/simple/room/RemoteParticipant.js +69 -38
- package/lib/simple/room/Room.js +69 -38
- package/lib/simple/room/SipRoom.js +69 -38
- package/lib/simple/room/Stream.js +69 -38
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +69 -38
- package/lib/simple/utils.js +69 -38
- package/package.json +1 -1
- package/src/simple/Softphone.js +70 -39
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,7 @@ 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_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
|
|
13154
13153
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13155
13154
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13156
13155
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13164,6 +13163,12 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13164
13163
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13165
13164
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13166
13165
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13166
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13167
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13168
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13169
|
+
|
|
13170
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13171
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13167
13172
|
|
|
13168
13173
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13169
13174
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
@@ -13173,22 +13178,32 @@ const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
|
13173
13178
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13174
13179
|
|
|
13175
13180
|
class Softphone {
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
+
|
|
13182
|
+
|
|
13183
|
+
|
|
13184
|
+
|
|
13185
|
+
|
|
13186
|
+
|
|
13187
|
+
|
|
13188
|
+
// Message waiting for the iframe to be loaded
|
|
13189
|
+
|
|
13181
13190
|
|
|
13182
13191
|
onLinkEnabled(link ) {}
|
|
13183
13192
|
onIFrameLoaded() {}
|
|
13184
13193
|
|
|
13194
|
+
onCallAnswered() {}
|
|
13185
13195
|
onCallMade(call ) {}
|
|
13186
13196
|
onCallIncoming(call ) {}
|
|
13187
13197
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13188
13198
|
onCardSaved(card ) {}
|
|
13199
|
+
onCardCanceled() {}
|
|
13189
13200
|
onAuthenticated(session ) {}
|
|
13190
13201
|
onLoggedOut() {}
|
|
13191
|
-
|
|
13202
|
+
|
|
13203
|
+
onSearchOptions(fieldId , query ) {
|
|
13204
|
+
this.onOptionsResults(fieldId, []);
|
|
13205
|
+
}
|
|
13206
|
+
|
|
13192
13207
|
onDisplayLinkedOption(optionId ) {}
|
|
13193
13208
|
onWazoContactSearch(query ) {}
|
|
13194
13209
|
onAgentLoggedIn() {}
|
|
@@ -13211,18 +13226,15 @@ class Softphone {
|
|
|
13211
13226
|
onStopRecording() {}
|
|
13212
13227
|
onUnHandledEvent(event ) {}
|
|
13213
13228
|
|
|
13214
|
-
init({ url, width, height, server, port, language, wrapUpDuration,
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
this.width = width;
|
|
13221
|
-
}
|
|
13222
|
-
if (height) {
|
|
13223
|
-
this.height = height;
|
|
13224
|
-
}
|
|
13229
|
+
init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
|
|
13230
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
13231
|
+
this.width = width || 500;
|
|
13232
|
+
this.height = height || 600;
|
|
13233
|
+
this.displayed = false;
|
|
13234
|
+
this.iframeLoaded = false;
|
|
13225
13235
|
|
|
13236
|
+
this.iframeLoaded = false;
|
|
13237
|
+
this._pendingMessages = [];
|
|
13226
13238
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13227
13239
|
|
|
13228
13240
|
if (!server) {
|
|
@@ -13230,25 +13242,26 @@ class Softphone {
|
|
|
13230
13242
|
server = 'stack.dev.wazo.io';
|
|
13231
13243
|
}
|
|
13232
13244
|
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
});
|
|
13245
|
+
const config = { server };
|
|
13246
|
+
if (language) {
|
|
13247
|
+
config.language = language;
|
|
13248
|
+
}
|
|
13249
|
+
if (port) {
|
|
13250
|
+
config.port = port;
|
|
13251
|
+
}
|
|
13252
|
+
if (wrapUpDuration) {
|
|
13253
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
13254
|
+
}
|
|
13244
13255
|
|
|
13245
|
-
|
|
13246
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13247
|
-
}
|
|
13256
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
13248
13257
|
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13258
|
+
if (enableAgent) {
|
|
13259
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13260
|
+
}
|
|
13261
|
+
|
|
13262
|
+
this._createIframe(() => {
|
|
13263
|
+
this.iframeLoaded = true;
|
|
13264
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
13252
13265
|
|
|
13253
13266
|
this.onIFrameLoaded();
|
|
13254
13267
|
});
|
|
@@ -13309,6 +13322,18 @@ class Softphone {
|
|
|
13309
13322
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
13310
13323
|
}
|
|
13311
13324
|
|
|
13325
|
+
setCardValue(field , value ) {
|
|
13326
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
13327
|
+
}
|
|
13328
|
+
|
|
13329
|
+
injectCss(css ) {
|
|
13330
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
13331
|
+
}
|
|
13332
|
+
|
|
13333
|
+
customizeAppearance(themes , translations , assets ) {
|
|
13334
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
13335
|
+
}
|
|
13336
|
+
|
|
13312
13337
|
_createIframe(cb = () => {}) {
|
|
13313
13338
|
this.iframe = document.createElement('iframe');
|
|
13314
13339
|
// $FlowFixMe
|
|
@@ -13443,6 +13468,12 @@ class Softphone {
|
|
|
13443
13468
|
case BRIDGE_ON_STOP_RECORDING:
|
|
13444
13469
|
this.onStopRecording();
|
|
13445
13470
|
break;
|
|
13471
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
13472
|
+
this.onCardCanceled();
|
|
13473
|
+
break;
|
|
13474
|
+
case BRIDGE_ON_CALL_ANSWERED:
|
|
13475
|
+
this.onCallAnswered();
|
|
13476
|
+
break;
|
|
13446
13477
|
default:
|
|
13447
13478
|
this.onUnHandledEvent(event);
|
|
13448
13479
|
break;
|
|
@@ -13450,8 +13481,8 @@ class Softphone {
|
|
|
13450
13481
|
}
|
|
13451
13482
|
|
|
13452
13483
|
_sendMessage(type , payload = {}) {
|
|
13453
|
-
if (!this.iframe) {
|
|
13454
|
-
|
|
13484
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
13485
|
+
this._pendingMessages.push([type, payload]);
|
|
13455
13486
|
return;
|
|
13456
13487
|
}
|
|
13457
13488
|
|
|
@@ -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,7 @@ 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_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
|
|
13851
13850
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13852
13851
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13853
13852
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13861,6 +13860,12 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13861
13860
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13862
13861
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13863
13862
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13863
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13864
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13865
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13866
|
+
|
|
13867
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13868
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13864
13869
|
|
|
13865
13870
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13866
13871
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
@@ -13870,22 +13875,32 @@ const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
|
13870
13875
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13871
13876
|
|
|
13872
13877
|
class Softphone {
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
|
|
13876
|
-
|
|
13877
|
-
|
|
13878
|
+
|
|
13879
|
+
|
|
13880
|
+
|
|
13881
|
+
|
|
13882
|
+
|
|
13883
|
+
|
|
13884
|
+
|
|
13885
|
+
// Message waiting for the iframe to be loaded
|
|
13886
|
+
|
|
13878
13887
|
|
|
13879
13888
|
onLinkEnabled(link ) {}
|
|
13880
13889
|
onIFrameLoaded() {}
|
|
13881
13890
|
|
|
13891
|
+
onCallAnswered() {}
|
|
13882
13892
|
onCallMade(call ) {}
|
|
13883
13893
|
onCallIncoming(call ) {}
|
|
13884
13894
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13885
13895
|
onCardSaved(card ) {}
|
|
13896
|
+
onCardCanceled() {}
|
|
13886
13897
|
onAuthenticated(session ) {}
|
|
13887
13898
|
onLoggedOut() {}
|
|
13888
|
-
|
|
13899
|
+
|
|
13900
|
+
onSearchOptions(fieldId , query ) {
|
|
13901
|
+
this.onOptionsResults(fieldId, []);
|
|
13902
|
+
}
|
|
13903
|
+
|
|
13889
13904
|
onDisplayLinkedOption(optionId ) {}
|
|
13890
13905
|
onWazoContactSearch(query ) {}
|
|
13891
13906
|
onAgentLoggedIn() {}
|
|
@@ -13908,18 +13923,15 @@ class Softphone {
|
|
|
13908
13923
|
onStopRecording() {}
|
|
13909
13924
|
onUnHandledEvent(event ) {}
|
|
13910
13925
|
|
|
13911
|
-
init({ url, width, height, server, port, language, wrapUpDuration,
|
|
13912
|
-
|
|
13913
|
-
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
this.width = width;
|
|
13918
|
-
}
|
|
13919
|
-
if (height) {
|
|
13920
|
-
this.height = height;
|
|
13921
|
-
}
|
|
13926
|
+
init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
|
|
13927
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
13928
|
+
this.width = width || 500;
|
|
13929
|
+
this.height = height || 600;
|
|
13930
|
+
this.displayed = false;
|
|
13931
|
+
this.iframeLoaded = false;
|
|
13922
13932
|
|
|
13933
|
+
this.iframeLoaded = false;
|
|
13934
|
+
this._pendingMessages = [];
|
|
13923
13935
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13924
13936
|
|
|
13925
13937
|
if (!server) {
|
|
@@ -13927,25 +13939,26 @@ class Softphone {
|
|
|
13927
13939
|
server = 'stack.dev.wazo.io';
|
|
13928
13940
|
}
|
|
13929
13941
|
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
});
|
|
13942
|
+
const config = { server };
|
|
13943
|
+
if (language) {
|
|
13944
|
+
config.language = language;
|
|
13945
|
+
}
|
|
13946
|
+
if (port) {
|
|
13947
|
+
config.port = port;
|
|
13948
|
+
}
|
|
13949
|
+
if (wrapUpDuration) {
|
|
13950
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
13951
|
+
}
|
|
13941
13952
|
|
|
13942
|
-
|
|
13943
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13944
|
-
}
|
|
13953
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
13945
13954
|
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13955
|
+
if (enableAgent) {
|
|
13956
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13957
|
+
}
|
|
13958
|
+
|
|
13959
|
+
this._createIframe(() => {
|
|
13960
|
+
this.iframeLoaded = true;
|
|
13961
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
13949
13962
|
|
|
13950
13963
|
this.onIFrameLoaded();
|
|
13951
13964
|
});
|
|
@@ -14006,6 +14019,18 @@ class Softphone {
|
|
|
14006
14019
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14007
14020
|
}
|
|
14008
14021
|
|
|
14022
|
+
setCardValue(field , value ) {
|
|
14023
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
14024
|
+
}
|
|
14025
|
+
|
|
14026
|
+
injectCss(css ) {
|
|
14027
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
14028
|
+
}
|
|
14029
|
+
|
|
14030
|
+
customizeAppearance(themes , translations , assets ) {
|
|
14031
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
14032
|
+
}
|
|
14033
|
+
|
|
14009
14034
|
_createIframe(cb = () => {}) {
|
|
14010
14035
|
this.iframe = document.createElement('iframe');
|
|
14011
14036
|
// $FlowFixMe
|
|
@@ -14140,6 +14165,12 @@ class Softphone {
|
|
|
14140
14165
|
case BRIDGE_ON_STOP_RECORDING:
|
|
14141
14166
|
this.onStopRecording();
|
|
14142
14167
|
break;
|
|
14168
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14169
|
+
this.onCardCanceled();
|
|
14170
|
+
break;
|
|
14171
|
+
case BRIDGE_ON_CALL_ANSWERED:
|
|
14172
|
+
this.onCallAnswered();
|
|
14173
|
+
break;
|
|
14143
14174
|
default:
|
|
14144
14175
|
this.onUnHandledEvent(event);
|
|
14145
14176
|
break;
|
|
@@ -14147,8 +14178,8 @@ class Softphone {
|
|
|
14147
14178
|
}
|
|
14148
14179
|
|
|
14149
14180
|
_sendMessage(type , payload = {}) {
|
|
14150
|
-
if (!this.iframe) {
|
|
14151
|
-
|
|
14181
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14182
|
+
this._pendingMessages.push([type, payload]);
|
|
14152
14183
|
return;
|
|
14153
14184
|
}
|
|
14154
14185
|
|
|
@@ -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,7 @@ 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_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
|
|
13932
13931
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13933
13932
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13934
13933
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13942,6 +13941,12 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13942
13941
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13943
13942
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13944
13943
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13944
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13945
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13946
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13947
|
+
|
|
13948
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13949
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13945
13950
|
|
|
13946
13951
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13947
13952
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
@@ -13951,22 +13956,32 @@ const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
|
13951
13956
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13952
13957
|
|
|
13953
13958
|
class Softphone {
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
+
|
|
13960
|
+
|
|
13961
|
+
|
|
13962
|
+
|
|
13963
|
+
|
|
13964
|
+
|
|
13965
|
+
|
|
13966
|
+
// Message waiting for the iframe to be loaded
|
|
13967
|
+
|
|
13959
13968
|
|
|
13960
13969
|
onLinkEnabled(link ) {}
|
|
13961
13970
|
onIFrameLoaded() {}
|
|
13962
13971
|
|
|
13972
|
+
onCallAnswered() {}
|
|
13963
13973
|
onCallMade(call ) {}
|
|
13964
13974
|
onCallIncoming(call ) {}
|
|
13965
13975
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13966
13976
|
onCardSaved(card ) {}
|
|
13977
|
+
onCardCanceled() {}
|
|
13967
13978
|
onAuthenticated(session ) {}
|
|
13968
13979
|
onLoggedOut() {}
|
|
13969
|
-
|
|
13980
|
+
|
|
13981
|
+
onSearchOptions(fieldId , query ) {
|
|
13982
|
+
this.onOptionsResults(fieldId, []);
|
|
13983
|
+
}
|
|
13984
|
+
|
|
13970
13985
|
onDisplayLinkedOption(optionId ) {}
|
|
13971
13986
|
onWazoContactSearch(query ) {}
|
|
13972
13987
|
onAgentLoggedIn() {}
|
|
@@ -13989,18 +14004,15 @@ class Softphone {
|
|
|
13989
14004
|
onStopRecording() {}
|
|
13990
14005
|
onUnHandledEvent(event ) {}
|
|
13991
14006
|
|
|
13992
|
-
init({ url, width, height, server, port, language, wrapUpDuration,
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
this.width = width;
|
|
13999
|
-
}
|
|
14000
|
-
if (height) {
|
|
14001
|
-
this.height = height;
|
|
14002
|
-
}
|
|
14007
|
+
init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
|
|
14008
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
14009
|
+
this.width = width || 500;
|
|
14010
|
+
this.height = height || 600;
|
|
14011
|
+
this.displayed = false;
|
|
14012
|
+
this.iframeLoaded = false;
|
|
14003
14013
|
|
|
14014
|
+
this.iframeLoaded = false;
|
|
14015
|
+
this._pendingMessages = [];
|
|
14004
14016
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14005
14017
|
|
|
14006
14018
|
if (!server) {
|
|
@@ -14008,25 +14020,26 @@ class Softphone {
|
|
|
14008
14020
|
server = 'stack.dev.wazo.io';
|
|
14009
14021
|
}
|
|
14010
14022
|
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
});
|
|
14023
|
+
const config = { server };
|
|
14024
|
+
if (language) {
|
|
14025
|
+
config.language = language;
|
|
14026
|
+
}
|
|
14027
|
+
if (port) {
|
|
14028
|
+
config.port = port;
|
|
14029
|
+
}
|
|
14030
|
+
if (wrapUpDuration) {
|
|
14031
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
14032
|
+
}
|
|
14022
14033
|
|
|
14023
|
-
|
|
14024
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
14025
|
-
}
|
|
14034
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
14026
14035
|
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14036
|
+
if (enableAgent) {
|
|
14037
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
14038
|
+
}
|
|
14039
|
+
|
|
14040
|
+
this._createIframe(() => {
|
|
14041
|
+
this.iframeLoaded = true;
|
|
14042
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
14030
14043
|
|
|
14031
14044
|
this.onIFrameLoaded();
|
|
14032
14045
|
});
|
|
@@ -14087,6 +14100,18 @@ class Softphone {
|
|
|
14087
14100
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14088
14101
|
}
|
|
14089
14102
|
|
|
14103
|
+
setCardValue(field , value ) {
|
|
14104
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
14105
|
+
}
|
|
14106
|
+
|
|
14107
|
+
injectCss(css ) {
|
|
14108
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
14109
|
+
}
|
|
14110
|
+
|
|
14111
|
+
customizeAppearance(themes , translations , assets ) {
|
|
14112
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
14113
|
+
}
|
|
14114
|
+
|
|
14090
14115
|
_createIframe(cb = () => {}) {
|
|
14091
14116
|
this.iframe = document.createElement('iframe');
|
|
14092
14117
|
// $FlowFixMe
|
|
@@ -14221,6 +14246,12 @@ class Softphone {
|
|
|
14221
14246
|
case BRIDGE_ON_STOP_RECORDING:
|
|
14222
14247
|
this.onStopRecording();
|
|
14223
14248
|
break;
|
|
14249
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14250
|
+
this.onCardCanceled();
|
|
14251
|
+
break;
|
|
14252
|
+
case BRIDGE_ON_CALL_ANSWERED:
|
|
14253
|
+
this.onCallAnswered();
|
|
14254
|
+
break;
|
|
14224
14255
|
default:
|
|
14225
14256
|
this.onUnHandledEvent(event);
|
|
14226
14257
|
break;
|
|
@@ -14228,8 +14259,8 @@ class Softphone {
|
|
|
14228
14259
|
}
|
|
14229
14260
|
|
|
14230
14261
|
_sendMessage(type , payload = {}) {
|
|
14231
|
-
if (!this.iframe) {
|
|
14232
|
-
|
|
14262
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14263
|
+
this._pendingMessages.push([type, payload]);
|
|
14233
14264
|
return;
|
|
14234
14265
|
}
|
|
14235
14266
|
|