@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/index.js
CHANGED
|
@@ -14111,8 +14111,6 @@ const createLocalAudioStream = async (options ) => createLocalStream('aud
|
|
|
14111
14111
|
/* eslint-disable no-unused-vars */
|
|
14112
14112
|
/* global window, document */
|
|
14113
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
14114
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
14117
14115
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
14118
14116
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -14125,6 +14123,7 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
14125
14123
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
14126
14124
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
14127
14125
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
14126
|
+
const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
|
|
14128
14127
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
14129
14128
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
14130
14129
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -14138,6 +14137,12 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
14138
14137
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
14139
14138
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
14140
14139
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
14140
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
14141
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
14142
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
14143
|
+
|
|
14144
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
14145
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
14141
14146
|
|
|
14142
14147
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
14143
14148
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
@@ -14147,22 +14152,32 @@ const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
|
14147
14152
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
14148
14153
|
|
|
14149
14154
|
class Softphone {
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
+
|
|
14156
|
+
|
|
14157
|
+
|
|
14158
|
+
|
|
14159
|
+
|
|
14160
|
+
|
|
14161
|
+
|
|
14162
|
+
// Message waiting for the iframe to be loaded
|
|
14163
|
+
|
|
14155
14164
|
|
|
14156
14165
|
onLinkEnabled(link ) {}
|
|
14157
14166
|
onIFrameLoaded() {}
|
|
14158
14167
|
|
|
14168
|
+
onCallAnswered() {}
|
|
14159
14169
|
onCallMade(call ) {}
|
|
14160
14170
|
onCallIncoming(call ) {}
|
|
14161
14171
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
14162
14172
|
onCardSaved(card ) {}
|
|
14173
|
+
onCardCanceled() {}
|
|
14163
14174
|
onAuthenticated(session ) {}
|
|
14164
14175
|
onLoggedOut() {}
|
|
14165
|
-
|
|
14176
|
+
|
|
14177
|
+
onSearchOptions(fieldId , query ) {
|
|
14178
|
+
this.onOptionsResults(fieldId, []);
|
|
14179
|
+
}
|
|
14180
|
+
|
|
14166
14181
|
onDisplayLinkedOption(optionId ) {}
|
|
14167
14182
|
onWazoContactSearch(query ) {}
|
|
14168
14183
|
onAgentLoggedIn() {}
|
|
@@ -14185,18 +14200,15 @@ class Softphone {
|
|
|
14185
14200
|
onStopRecording() {}
|
|
14186
14201
|
onUnHandledEvent(event ) {}
|
|
14187
14202
|
|
|
14188
|
-
init({ url, width, height, server, port, language, wrapUpDuration,
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
this.width = width;
|
|
14195
|
-
}
|
|
14196
|
-
if (height) {
|
|
14197
|
-
this.height = height;
|
|
14198
|
-
}
|
|
14203
|
+
init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
|
|
14204
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
14205
|
+
this.width = width || 500;
|
|
14206
|
+
this.height = height || 600;
|
|
14207
|
+
this.displayed = false;
|
|
14208
|
+
this.iframeLoaded = false;
|
|
14199
14209
|
|
|
14210
|
+
this.iframeLoaded = false;
|
|
14211
|
+
this._pendingMessages = [];
|
|
14200
14212
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14201
14213
|
|
|
14202
14214
|
if (!server) {
|
|
@@ -14204,25 +14216,26 @@ class Softphone {
|
|
|
14204
14216
|
server = 'stack.dev.wazo.io';
|
|
14205
14217
|
}
|
|
14206
14218
|
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
});
|
|
14219
|
+
const config = { server };
|
|
14220
|
+
if (language) {
|
|
14221
|
+
config.language = language;
|
|
14222
|
+
}
|
|
14223
|
+
if (port) {
|
|
14224
|
+
config.port = port;
|
|
14225
|
+
}
|
|
14226
|
+
if (wrapUpDuration) {
|
|
14227
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
14228
|
+
}
|
|
14218
14229
|
|
|
14219
|
-
|
|
14220
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
14221
|
-
}
|
|
14230
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
14222
14231
|
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14232
|
+
if (enableAgent) {
|
|
14233
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
14234
|
+
}
|
|
14235
|
+
|
|
14236
|
+
this._createIframe(() => {
|
|
14237
|
+
this.iframeLoaded = true;
|
|
14238
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
14226
14239
|
|
|
14227
14240
|
this.onIFrameLoaded();
|
|
14228
14241
|
});
|
|
@@ -14283,6 +14296,18 @@ class Softphone {
|
|
|
14283
14296
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
14284
14297
|
}
|
|
14285
14298
|
|
|
14299
|
+
setCardValue(field , value ) {
|
|
14300
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
14301
|
+
}
|
|
14302
|
+
|
|
14303
|
+
injectCss(css ) {
|
|
14304
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
14305
|
+
}
|
|
14306
|
+
|
|
14307
|
+
customizeAppearance(themes , translations , assets ) {
|
|
14308
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
14309
|
+
}
|
|
14310
|
+
|
|
14286
14311
|
_createIframe(cb = () => {}) {
|
|
14287
14312
|
this.iframe = document.createElement('iframe');
|
|
14288
14313
|
// $FlowFixMe
|
|
@@ -14417,6 +14442,12 @@ class Softphone {
|
|
|
14417
14442
|
case BRIDGE_ON_STOP_RECORDING:
|
|
14418
14443
|
this.onStopRecording();
|
|
14419
14444
|
break;
|
|
14445
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14446
|
+
this.onCardCanceled();
|
|
14447
|
+
break;
|
|
14448
|
+
case BRIDGE_ON_CALL_ANSWERED:
|
|
14449
|
+
this.onCallAnswered();
|
|
14450
|
+
break;
|
|
14420
14451
|
default:
|
|
14421
14452
|
this.onUnHandledEvent(event);
|
|
14422
14453
|
break;
|
|
@@ -14424,8 +14455,8 @@ class Softphone {
|
|
|
14424
14455
|
}
|
|
14425
14456
|
|
|
14426
14457
|
_sendMessage(type , payload = {}) {
|
|
14427
|
-
if (!this.iframe) {
|
|
14428
|
-
|
|
14458
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14459
|
+
this._pendingMessages.push([type, payload]);
|
|
14429
14460
|
return;
|
|
14430
14461
|
}
|
|
14431
14462
|
|
package/esm/simple/Auth.js
CHANGED
|
@@ -13672,8 +13672,6 @@ class Checker {
|
|
|
13672
13672
|
/* eslint-disable no-unused-vars */
|
|
13673
13673
|
/* global window, document */
|
|
13674
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
13675
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13678
13676
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13679
13677
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -13686,6 +13684,7 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13686
13684
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13687
13685
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13688
13686
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13687
|
+
const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
|
|
13689
13688
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13690
13689
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13691
13690
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13699,6 +13698,12 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13699
13698
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13700
13699
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13701
13700
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13701
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13702
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13703
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13704
|
+
|
|
13705
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13706
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13702
13707
|
|
|
13703
13708
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13704
13709
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
@@ -13708,22 +13713,32 @@ const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
|
13708
13713
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13709
13714
|
|
|
13710
13715
|
class Softphone {
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
|
|
13714
|
-
|
|
13715
|
-
|
|
13716
|
+
|
|
13717
|
+
|
|
13718
|
+
|
|
13719
|
+
|
|
13720
|
+
|
|
13721
|
+
|
|
13722
|
+
|
|
13723
|
+
// Message waiting for the iframe to be loaded
|
|
13724
|
+
|
|
13716
13725
|
|
|
13717
13726
|
onLinkEnabled(link ) {}
|
|
13718
13727
|
onIFrameLoaded() {}
|
|
13719
13728
|
|
|
13729
|
+
onCallAnswered() {}
|
|
13720
13730
|
onCallMade(call ) {}
|
|
13721
13731
|
onCallIncoming(call ) {}
|
|
13722
13732
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13723
13733
|
onCardSaved(card ) {}
|
|
13734
|
+
onCardCanceled() {}
|
|
13724
13735
|
onAuthenticated(session ) {}
|
|
13725
13736
|
onLoggedOut() {}
|
|
13726
|
-
|
|
13737
|
+
|
|
13738
|
+
onSearchOptions(fieldId , query ) {
|
|
13739
|
+
this.onOptionsResults(fieldId, []);
|
|
13740
|
+
}
|
|
13741
|
+
|
|
13727
13742
|
onDisplayLinkedOption(optionId ) {}
|
|
13728
13743
|
onWazoContactSearch(query ) {}
|
|
13729
13744
|
onAgentLoggedIn() {}
|
|
@@ -13746,18 +13761,15 @@ class Softphone {
|
|
|
13746
13761
|
onStopRecording() {}
|
|
13747
13762
|
onUnHandledEvent(event ) {}
|
|
13748
13763
|
|
|
13749
|
-
init({ url, width, height, server, port, language, wrapUpDuration,
|
|
13750
|
-
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
this.width = width;
|
|
13756
|
-
}
|
|
13757
|
-
if (height) {
|
|
13758
|
-
this.height = height;
|
|
13759
|
-
}
|
|
13764
|
+
init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
|
|
13765
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
13766
|
+
this.width = width || 500;
|
|
13767
|
+
this.height = height || 600;
|
|
13768
|
+
this.displayed = false;
|
|
13769
|
+
this.iframeLoaded = false;
|
|
13760
13770
|
|
|
13771
|
+
this.iframeLoaded = false;
|
|
13772
|
+
this._pendingMessages = [];
|
|
13761
13773
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13762
13774
|
|
|
13763
13775
|
if (!server) {
|
|
@@ -13765,25 +13777,26 @@ class Softphone {
|
|
|
13765
13777
|
server = 'stack.dev.wazo.io';
|
|
13766
13778
|
}
|
|
13767
13779
|
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
});
|
|
13780
|
+
const config = { server };
|
|
13781
|
+
if (language) {
|
|
13782
|
+
config.language = language;
|
|
13783
|
+
}
|
|
13784
|
+
if (port) {
|
|
13785
|
+
config.port = port;
|
|
13786
|
+
}
|
|
13787
|
+
if (wrapUpDuration) {
|
|
13788
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
13789
|
+
}
|
|
13779
13790
|
|
|
13780
|
-
|
|
13781
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13782
|
-
}
|
|
13791
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
13783
13792
|
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13793
|
+
if (enableAgent) {
|
|
13794
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13795
|
+
}
|
|
13796
|
+
|
|
13797
|
+
this._createIframe(() => {
|
|
13798
|
+
this.iframeLoaded = true;
|
|
13799
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
13787
13800
|
|
|
13788
13801
|
this.onIFrameLoaded();
|
|
13789
13802
|
});
|
|
@@ -13844,6 +13857,18 @@ class Softphone {
|
|
|
13844
13857
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
13845
13858
|
}
|
|
13846
13859
|
|
|
13860
|
+
setCardValue(field , value ) {
|
|
13861
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
13862
|
+
}
|
|
13863
|
+
|
|
13864
|
+
injectCss(css ) {
|
|
13865
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
13866
|
+
}
|
|
13867
|
+
|
|
13868
|
+
customizeAppearance(themes , translations , assets ) {
|
|
13869
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
13870
|
+
}
|
|
13871
|
+
|
|
13847
13872
|
_createIframe(cb = () => {}) {
|
|
13848
13873
|
this.iframe = document.createElement('iframe');
|
|
13849
13874
|
// $FlowFixMe
|
|
@@ -13978,6 +14003,12 @@ class Softphone {
|
|
|
13978
14003
|
case BRIDGE_ON_STOP_RECORDING:
|
|
13979
14004
|
this.onStopRecording();
|
|
13980
14005
|
break;
|
|
14006
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
14007
|
+
this.onCardCanceled();
|
|
14008
|
+
break;
|
|
14009
|
+
case BRIDGE_ON_CALL_ANSWERED:
|
|
14010
|
+
this.onCallAnswered();
|
|
14011
|
+
break;
|
|
13981
14012
|
default:
|
|
13982
14013
|
this.onUnHandledEvent(event);
|
|
13983
14014
|
break;
|
|
@@ -13985,8 +14016,8 @@ class Softphone {
|
|
|
13985
14016
|
}
|
|
13986
14017
|
|
|
13987
14018
|
_sendMessage(type , payload = {}) {
|
|
13988
|
-
if (!this.iframe) {
|
|
13989
|
-
|
|
14019
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14020
|
+
this._pendingMessages.push([type, payload]);
|
|
13990
14021
|
return;
|
|
13991
14022
|
}
|
|
13992
14023
|
|
|
@@ -13655,8 +13655,6 @@ class Checker {
|
|
|
13655
13655
|
/* eslint-disable no-unused-vars */
|
|
13656
13656
|
/* global window, document */
|
|
13657
13657
|
const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
|
|
13658
|
-
const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
|
|
13659
|
-
const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
|
|
13660
13658
|
const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
|
|
13661
13659
|
const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
|
|
13662
13660
|
const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
|
|
@@ -13669,6 +13667,7 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13669
13667
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13670
13668
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13671
13669
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13670
|
+
const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
|
|
13672
13671
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13673
13672
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13674
13673
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13682,6 +13681,12 @@ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFE
|
|
|
13682
13681
|
const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
|
|
13683
13682
|
const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
|
|
13684
13683
|
const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
13684
|
+
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13685
|
+
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13686
|
+
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13687
|
+
|
|
13688
|
+
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13689
|
+
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13685
13690
|
|
|
13686
13691
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13687
13692
|
const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
|
|
@@ -13691,22 +13696,32 @@ const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
|
13691
13696
|
const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
|
|
13692
13697
|
|
|
13693
13698
|
class Softphone {
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
+
|
|
13700
|
+
|
|
13701
|
+
|
|
13702
|
+
|
|
13703
|
+
|
|
13704
|
+
|
|
13705
|
+
|
|
13706
|
+
// Message waiting for the iframe to be loaded
|
|
13707
|
+
|
|
13699
13708
|
|
|
13700
13709
|
onLinkEnabled(link ) {}
|
|
13701
13710
|
onIFrameLoaded() {}
|
|
13702
13711
|
|
|
13712
|
+
onCallAnswered() {}
|
|
13703
13713
|
onCallMade(call ) {}
|
|
13704
13714
|
onCallIncoming(call ) {}
|
|
13705
13715
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13706
13716
|
onCardSaved(card ) {}
|
|
13717
|
+
onCardCanceled() {}
|
|
13707
13718
|
onAuthenticated(session ) {}
|
|
13708
13719
|
onLoggedOut() {}
|
|
13709
|
-
|
|
13720
|
+
|
|
13721
|
+
onSearchOptions(fieldId , query ) {
|
|
13722
|
+
this.onOptionsResults(fieldId, []);
|
|
13723
|
+
}
|
|
13724
|
+
|
|
13710
13725
|
onDisplayLinkedOption(optionId ) {}
|
|
13711
13726
|
onWazoContactSearch(query ) {}
|
|
13712
13727
|
onAgentLoggedIn() {}
|
|
@@ -13729,18 +13744,15 @@ class Softphone {
|
|
|
13729
13744
|
onStopRecording() {}
|
|
13730
13745
|
onUnHandledEvent(event ) {}
|
|
13731
13746
|
|
|
13732
|
-
init({ url, width, height, server, port, language, wrapUpDuration,
|
|
13733
|
-
|
|
13734
|
-
|
|
13735
|
-
|
|
13736
|
-
|
|
13737
|
-
|
|
13738
|
-
this.width = width;
|
|
13739
|
-
}
|
|
13740
|
-
if (height) {
|
|
13741
|
-
this.height = height;
|
|
13742
|
-
}
|
|
13747
|
+
init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
|
|
13748
|
+
this.url = url || 'https://softphone.wazo.io';
|
|
13749
|
+
this.width = width || 500;
|
|
13750
|
+
this.height = height || 600;
|
|
13751
|
+
this.displayed = false;
|
|
13752
|
+
this.iframeLoaded = false;
|
|
13743
13753
|
|
|
13754
|
+
this.iframeLoaded = false;
|
|
13755
|
+
this._pendingMessages = [];
|
|
13744
13756
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13745
13757
|
|
|
13746
13758
|
if (!server) {
|
|
@@ -13748,25 +13760,26 @@ class Softphone {
|
|
|
13748
13760
|
server = 'stack.dev.wazo.io';
|
|
13749
13761
|
}
|
|
13750
13762
|
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
});
|
|
13763
|
+
const config = { server };
|
|
13764
|
+
if (language) {
|
|
13765
|
+
config.language = language;
|
|
13766
|
+
}
|
|
13767
|
+
if (port) {
|
|
13768
|
+
config.port = port;
|
|
13769
|
+
}
|
|
13770
|
+
if (wrapUpDuration) {
|
|
13771
|
+
config.wrapUpDuration = wrapUpDuration;
|
|
13772
|
+
}
|
|
13762
13773
|
|
|
13763
|
-
|
|
13764
|
-
this._sendMessage(BRIDGE_ENABLE_CARD);
|
|
13765
|
-
}
|
|
13774
|
+
this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
|
|
13766
13775
|
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13776
|
+
if (enableAgent) {
|
|
13777
|
+
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13778
|
+
}
|
|
13779
|
+
|
|
13780
|
+
this._createIframe(() => {
|
|
13781
|
+
this.iframeLoaded = true;
|
|
13782
|
+
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
13770
13783
|
|
|
13771
13784
|
this.onIFrameLoaded();
|
|
13772
13785
|
});
|
|
@@ -13827,6 +13840,18 @@ class Softphone {
|
|
|
13827
13840
|
this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
|
|
13828
13841
|
}
|
|
13829
13842
|
|
|
13843
|
+
setCardValue(field , value ) {
|
|
13844
|
+
this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
|
|
13845
|
+
}
|
|
13846
|
+
|
|
13847
|
+
injectCss(css ) {
|
|
13848
|
+
this._sendMessage(BRIDGE_INJECT_CSS, { css });
|
|
13849
|
+
}
|
|
13850
|
+
|
|
13851
|
+
customizeAppearance(themes , translations , assets ) {
|
|
13852
|
+
this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
|
|
13853
|
+
}
|
|
13854
|
+
|
|
13830
13855
|
_createIframe(cb = () => {}) {
|
|
13831
13856
|
this.iframe = document.createElement('iframe');
|
|
13832
13857
|
// $FlowFixMe
|
|
@@ -13961,6 +13986,12 @@ class Softphone {
|
|
|
13961
13986
|
case BRIDGE_ON_STOP_RECORDING:
|
|
13962
13987
|
this.onStopRecording();
|
|
13963
13988
|
break;
|
|
13989
|
+
case BRIDGE_ON_CARD_CANCELED:
|
|
13990
|
+
this.onCardCanceled();
|
|
13991
|
+
break;
|
|
13992
|
+
case BRIDGE_ON_CALL_ANSWERED:
|
|
13993
|
+
this.onCallAnswered();
|
|
13994
|
+
break;
|
|
13964
13995
|
default:
|
|
13965
13996
|
this.onUnHandledEvent(event);
|
|
13966
13997
|
break;
|
|
@@ -13968,8 +13999,8 @@ class Softphone {
|
|
|
13968
13999
|
}
|
|
13969
14000
|
|
|
13970
14001
|
_sendMessage(type , payload = {}) {
|
|
13971
|
-
if (!this.iframe) {
|
|
13972
|
-
|
|
14002
|
+
if (!this.iframe || !this.iframeLoaded) {
|
|
14003
|
+
this._pendingMessages.push([type, payload]);
|
|
13973
14004
|
return;
|
|
13974
14005
|
}
|
|
13975
14006
|
|