@wazo/sdk 0.37.42 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +218 -0
  2. package/dist/wazo-sdk.js +5 -5
  3. package/esm/__tests__/api-client.test.js +12 -7
  4. package/esm/__tests__/web-rtc-client.test.js +17 -10
  5. package/esm/api/agentd.js +12 -7
  6. package/esm/api/amid.js +12 -7
  7. package/esm/api/application.js +12 -7
  8. package/esm/api/auth.js +12 -7
  9. package/esm/api/call-logd.js +12 -7
  10. package/esm/api/calld.js +12 -7
  11. package/esm/api/chatd.js +12 -7
  12. package/esm/api/confd.js +12 -7
  13. package/esm/api/ctid-ng.js +12 -7
  14. package/esm/api/dird.js +12 -7
  15. package/esm/api/webhookd.js +12 -7
  16. package/esm/api-client.js +12 -7
  17. package/esm/checker/Checker.js +18 -11
  18. package/esm/checker/checks/aor.js +12 -7
  19. package/esm/checker/checks/api.js +12 -7
  20. package/esm/checker/checks/index.js +18 -11
  21. package/esm/checker/checks/wazo-websocket.js +13 -8
  22. package/esm/checker/checks/webrtc-transport.js +17 -10
  23. package/esm/checker/checks/webrtc.js +17 -10
  24. package/esm/domain/AdHocAPIConference.js +12 -7
  25. package/esm/domain/Features.js +12 -7
  26. package/esm/domain/Phone/CTIPhone.js +12 -7
  27. package/esm/domain/Phone/WebRTCPhone.js +12 -7
  28. package/esm/index.js +347 -11
  29. package/esm/lib/WazoSessionDescriptionHandler.js +12 -7
  30. package/esm/service/CallApi.js +12 -7
  31. package/esm/service/IssueReporter.js +12 -7
  32. package/esm/service/__tests__/IssueReporter.test.js +18 -7
  33. package/esm/service/getApiClient.js +12 -7
  34. package/esm/simple/Auth.js +347 -11
  35. package/esm/simple/Configuration.js +347 -11
  36. package/esm/simple/Directory.js +12 -7
  37. package/esm/simple/Phone.js +347 -11
  38. package/esm/simple/Softphone.js +329 -0
  39. package/esm/simple/Websocket.js +13 -8
  40. package/esm/simple/index.js +347 -11
  41. package/esm/simple/room/LocalParticipant.js +347 -11
  42. package/esm/simple/room/Participant.js +347 -11
  43. package/esm/simple/room/RemoteParticipant.js +347 -11
  44. package/esm/simple/room/Room.js +347 -11
  45. package/esm/simple/room/SipRoom.js +347 -11
  46. package/esm/simple/room/Stream.js +347 -11
  47. package/esm/simple/room/__tests__/RemoteParticipant.test.js +347 -11
  48. package/esm/simple/utils.js +347 -11
  49. package/esm/utils/__tests__/api-requester.test.js +12 -7
  50. package/esm/utils/api-requester.js +12 -7
  51. package/esm/web-rtc-client.js +17 -10
  52. package/esm/websocket-client.js +13 -8
  53. package/lib/__tests__/api-client.test.js +12 -7
  54. package/lib/__tests__/web-rtc-client.test.js +17 -10
  55. package/lib/api/agentd.js +12 -7
  56. package/lib/api/amid.js +12 -7
  57. package/lib/api/application.js +12 -7
  58. package/lib/api/auth.js +12 -7
  59. package/lib/api/call-logd.js +12 -7
  60. package/lib/api/calld.js +12 -7
  61. package/lib/api/chatd.js +12 -7
  62. package/lib/api/confd.js +12 -7
  63. package/lib/api/ctid-ng.js +12 -7
  64. package/lib/api/dird.js +12 -7
  65. package/lib/api/webhookd.js +12 -7
  66. package/lib/api-client.js +12 -7
  67. package/lib/checker/Checker.js +18 -11
  68. package/lib/checker/checks/aor.js +12 -7
  69. package/lib/checker/checks/api.js +12 -7
  70. package/lib/checker/checks/index.js +18 -11
  71. package/lib/checker/checks/wazo-websocket.js +13 -8
  72. package/lib/checker/checks/webrtc-transport.js +17 -10
  73. package/lib/checker/checks/webrtc.js +17 -10
  74. package/lib/domain/AdHocAPIConference.js +12 -7
  75. package/lib/domain/Features.js +12 -7
  76. package/lib/domain/Phone/CTIPhone.js +12 -7
  77. package/lib/domain/Phone/WebRTCPhone.js +12 -7
  78. package/lib/index.js +347 -11
  79. package/lib/lib/WazoSessionDescriptionHandler.js +12 -7
  80. package/lib/service/CallApi.js +12 -7
  81. package/lib/service/IssueReporter.js +12 -7
  82. package/lib/service/__tests__/IssueReporter.test.js +18 -7
  83. package/lib/service/getApiClient.js +12 -7
  84. package/lib/simple/Auth.js +347 -11
  85. package/lib/simple/Configuration.js +347 -11
  86. package/lib/simple/Directory.js +12 -7
  87. package/lib/simple/Phone.js +347 -11
  88. package/lib/simple/Softphone.js +331 -0
  89. package/lib/simple/Websocket.js +13 -8
  90. package/lib/simple/index.js +347 -11
  91. package/lib/simple/room/LocalParticipant.js +347 -11
  92. package/lib/simple/room/Participant.js +347 -11
  93. package/lib/simple/room/RemoteParticipant.js +347 -11
  94. package/lib/simple/room/Room.js +347 -11
  95. package/lib/simple/room/SipRoom.js +347 -11
  96. package/lib/simple/room/Stream.js +347 -11
  97. package/lib/simple/room/__tests__/RemoteParticipant.test.js +347 -11
  98. package/lib/simple/utils.js +347 -11
  99. package/lib/utils/__tests__/api-requester.test.js +12 -7
  100. package/lib/utils/api-requester.js +12 -7
  101. package/lib/web-rtc-client.js +17 -10
  102. package/lib/websocket-client.js +13 -8
  103. package/package.json +1 -1
  104. package/src/service/IssueReporter.js +12 -7
  105. package/src/service/__tests__/IssueReporter.test.js +6 -0
  106. package/src/simple/Softphone.js +327 -0
  107. package/src/simple/index.js +2 -0
  108. package/src/web-rtc-client.js +5 -3
  109. package/src/websocket-client.js +1 -1
@@ -365,13 +365,9 @@ class IssueReporter {
365
365
 
366
366
  setTimeout(() => {
367
367
  if (isArray) {
368
- payload = payload.map(message => {
369
- message._retry = retry + 1;
370
- return message;
371
- });
372
- } else {
373
- // $FlowFixMe
374
- payload._retry = retry + 1;
368
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
369
+ } else if (payload && typeof payload === 'object') {
370
+ payload = this._writeRetryCount(payload, retry + 1);
375
371
  }
376
372
 
377
373
  this._sendDebugToGrafana(payload, retry + 1);
@@ -379,6 +375,15 @@ class IssueReporter {
379
375
  });
380
376
  }
381
377
 
378
+ _writeRetryCount(message , count ) {
379
+ if (message && typeof message === 'object') {
380
+ // $FlowFixMe
381
+ message._retry = count;
382
+ }
383
+
384
+ return message;
385
+ }
386
+
382
387
  _isLevelAbove(level1 , level2 ) {
383
388
  const index1 = LOG_LEVELS.indexOf(level1);
384
389
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -494,4 +499,10 @@ describe('IssueReporter', () => {
494
499
  expect(IssueReporter$1.removeSlashes('\"')).toBe("'");
495
500
  expect(IssueReporter$1.removeSlashes('\\\"')).toBe("'");
496
501
  });
502
+
503
+ it('Add retry count', () => {
504
+ expect(IssueReporter$1._writeRetryCount('', 1)).toBe('');
505
+ expect(IssueReporter$1._writeRetryCount('{}', 1)).toBe('{}');
506
+ expect(IssueReporter$1._writeRetryCount({}, 1)).toEqual({ _retry: 1 });
507
+ });
497
508
  });
@@ -404,13 +404,9 @@ class IssueReporter {
404
404
 
405
405
  setTimeout(() => {
406
406
  if (isArray) {
407
- payload = payload.map(message => {
408
- message._retry = retry + 1;
409
- return message;
410
- });
411
- } else {
412
- // $FlowFixMe
413
- payload._retry = retry + 1;
407
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
408
+ } else if (payload && typeof payload === 'object') {
409
+ payload = this._writeRetryCount(payload, retry + 1);
414
410
  }
415
411
 
416
412
  this._sendDebugToGrafana(payload, retry + 1);
@@ -418,6 +414,15 @@ class IssueReporter {
418
414
  });
419
415
  }
420
416
 
417
+ _writeRetryCount(message , count ) {
418
+ if (message && typeof message === 'object') {
419
+ // $FlowFixMe
420
+ message._retry = count;
421
+ }
422
+
423
+ return message;
424
+ }
425
+
421
426
  _isLevelAbove(level1 , level2 ) {
422
427
  const index1 = LOG_LEVELS.indexOf(level1);
423
428
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -1921,13 +1921,9 @@ class IssueReporter {
1921
1921
 
1922
1922
  setTimeout(() => {
1923
1923
  if (isArray) {
1924
- payload = payload.map(message => {
1925
- message._retry = retry + 1;
1926
- return message;
1927
- });
1928
- } else {
1929
- // $FlowFixMe
1930
- payload._retry = retry + 1;
1924
+ payload = payload.map(message => this._writeRetryCount(message, retry + 1));
1925
+ } else if (payload && typeof payload === 'object') {
1926
+ payload = this._writeRetryCount(payload, retry + 1);
1931
1927
  }
1932
1928
 
1933
1929
  this._sendDebugToGrafana(payload, retry + 1);
@@ -1935,6 +1931,15 @@ class IssueReporter {
1935
1931
  });
1936
1932
  }
1937
1933
 
1934
+ _writeRetryCount(message , count ) {
1935
+ if (message && typeof message === 'object') {
1936
+ // $FlowFixMe
1937
+ message._retry = count;
1938
+ }
1939
+
1940
+ return message;
1941
+ }
1942
+
1938
1943
  _isLevelAbove(level1 , level2 ) {
1939
1944
  const index1 = LOG_LEVELS.indexOf(level1);
1940
1945
  const index2 = LOG_LEVELS.indexOf(level2);
@@ -7186,8 +7191,10 @@ class WebRTCClient extends Emitter {
7186
7191
  conference: isConference,
7187
7192
  };
7188
7193
 
7189
- // Avoid sdh to created a new stream
7190
- session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
7194
+ // Avoid sdh to create a new stream
7195
+ if (session.sessionDescriptionHandler) {
7196
+ session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
7197
+ }
7191
7198
 
7192
7199
  // Send re-INVITE
7193
7200
  return session.invite(options);
@@ -8030,7 +8037,7 @@ class WebRTCClient extends Emitter {
8030
8037
  }
8031
8038
 
8032
8039
  async _onHeartbeatTimeout() {
8033
- logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8040
+ logger$9.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8034
8041
 
8035
8042
  if (this.heartbeatTimeoutCb) {
8036
8043
  this.heartbeatTimeoutCb();
@@ -11198,7 +11205,7 @@ class WebSocketClient extends Emitter {
11198
11205
  this.close();
11199
11206
  }
11200
11207
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
11201
- logger$6.log('Wazo WS url computed to reconnect', { url });
11208
+ logger$6.info('Wazo WS url computed to reconnect', { url });
11202
11209
 
11203
11210
  return url;
11204
11211
  }
@@ -13673,6 +13680,334 @@ class Checker {
13673
13680
  }
13674
13681
  }
13675
13682
 
13683
+ //
13684
+ /* eslint-disable no-unused-vars */
13685
+ /* global window, document */
13686
+ const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
13687
+ const BRIDGE_ENABLE_CARD = 'bridge/ENABLE_CARD';
13688
+ const BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE = 'bridge/CHANGE_REQUIRED_SUBSCRIPTION_TYPE';
13689
+ const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
13690
+ const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
13691
+ const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
13692
+ const BRIDGE_SEARCH_OPTIONS = 'bridge/BRIDGE_SEARCH_OPTIONS';
13693
+ const BRIDGE_DISPLAY_LINKED_OPTION = 'bridge/DISPLAY_LINKED_OPTION';
13694
+ const BRIDGE_UPDATE_FORM_SCHEMA = 'bridge/BRIDGE_UPDATE_FORM_SCHEMA';
13695
+ const BRIDGE_WAZO_CONTACT_SEARCH = 'bridge/BRIDGE_WAZO_CONTACT_SEARCH';
13696
+ const BRIDGE_ON_AGENT_LOGGED_IN = 'bridge/BRIDGE_ON_AGENT_LOGGED_IN';
13697
+ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13698
+ const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13699
+ const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13700
+ const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13701
+ const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13702
+ const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13703
+ const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
13704
+ const BRIDGE_ON_CALL_UN_MUTED = 'bridge/BRIDGE_ON_CALL_UN_MUTED';
13705
+ const BRIDGE_ON_DTMF = 'bridge/BRIDGE_ON_DTMF';
13706
+ const BRIDGE_ON_DIRECT_TRANSFER = 'bridge/BRIDGE_ON_DIRECT_TRANSFER';
13707
+ const BRIDGE_ON_CREATE_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CREATE_INDIRECT_TRANSFER';
13708
+ const BRIDGE_ON_CANCEL_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CANCEL_INDIRECT_TRANSFER';
13709
+ const BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER';
13710
+ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE';
13711
+ const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
13712
+ const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
13713
+ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13714
+
13715
+ const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
13716
+ const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
13717
+ const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
13718
+ const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
13719
+ const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
13720
+ const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
13721
+
13722
+ class Softphone {
13723
+ url = 'https://softphone.wazo.io';
13724
+ width = 500;
13725
+ height = 600;
13726
+ displayed = false;
13727
+ iframe = null;
13728
+
13729
+ onLinkEnabled(link ) {}
13730
+ onIFrameLoaded() {}
13731
+
13732
+ onCallMade(call ) {}
13733
+ onCallIncoming(call ) {}
13734
+ onCallEnded(call , card , direction , fromExtension ) {}
13735
+ onCardSaved(card ) {}
13736
+ onAuthenticated(session ) {}
13737
+ onLoggedOut() {}
13738
+ onSearchOptions(fieldId , query ) {}
13739
+ onDisplayLinkedOption(optionId ) {}
13740
+ onWazoContactSearch(query ) {}
13741
+ onAgentLoggedIn() {}
13742
+ onAgentLoggedOut() {}
13743
+ onAgentPaused() {}
13744
+ onAgentResumed() {}
13745
+ onLanguageChanged(language ) {}
13746
+ onCallHeld() {}
13747
+ onCallResumed() {}
13748
+ onCallMuted() {}
13749
+ onCallUnMuted() {}
13750
+ onDtmfSent(tone ) {}
13751
+ onDirectTransfer(number ) {}
13752
+ onCreateIndirectTransfer(number ) {}
13753
+ onCancelIndirectTransfer() {}
13754
+ onConfirmIndirectTransfer() {}
13755
+ onIndirectCallMade(call ) {}
13756
+ onIndirectTransferDone(call ) {}
13757
+ onStartRecording() {}
13758
+ onStopRecording() {}
13759
+ onUnHandledEvent(event ) {}
13760
+
13761
+ init({ url, width, height, server, port, language, wrapUpDuration, shouldDisplayLinkedEntities,
13762
+ allowContactCreation, withCard, subscriptionType, enableAgent } = {}) {
13763
+ if (url) {
13764
+ this.url = url;
13765
+ }
13766
+ if (width) {
13767
+ this.width = width;
13768
+ }
13769
+ if (height) {
13770
+ this.height = height;
13771
+ }
13772
+
13773
+ window.addEventListener('message', this._onMessage.bind(this), false);
13774
+
13775
+ if (!server) {
13776
+ // eslint-disable-next-line no-param-reassign
13777
+ server = 'stack.dev.wazo.io';
13778
+ }
13779
+
13780
+ this._createIframe(() => {
13781
+ this._sendMessage(BRIDGE_CONFIG_RETRIEVED, {
13782
+ config: {
13783
+ server,
13784
+ port,
13785
+ language,
13786
+ wrapUpDuration,
13787
+ shouldDisplayLinkedEntities,
13788
+ allowContactCreation,
13789
+ },
13790
+ });
13791
+
13792
+ if (withCard) {
13793
+ this._sendMessage(BRIDGE_ENABLE_CARD);
13794
+ }
13795
+
13796
+ if (subscriptionType) {
13797
+ this._sendMessage(BRIDGE_CHANGE_REQUIRED_SUBSCRIPTION_TYPE, { subscriptionType });
13798
+ }
13799
+
13800
+ this.onIFrameLoaded();
13801
+ });
13802
+ }
13803
+
13804
+ parseLinks() {
13805
+ const links = this._getLinks();
13806
+
13807
+ links.forEach(link => {
13808
+ link.setAttribute('data-wazo-parsed', true);
13809
+ link.addEventListener('click', this._onLinkClick.bind(this));
13810
+ this.onLinkEnabled(link);
13811
+ });
13812
+ }
13813
+
13814
+ makeCall(number ) {
13815
+ this.displaySoftphone();
13816
+
13817
+ this._sendMessage(SDK_CLICK_TO_CALL, { number });
13818
+ }
13819
+
13820
+ toggleSoftphoneDisplay() {
13821
+ if (this.displayed) {
13822
+ this.hideSoftphone();
13823
+ } else {
13824
+ this.displaySoftphone();
13825
+ }
13826
+ }
13827
+
13828
+ displaySoftphone() {
13829
+ if (!this.iframe) {
13830
+ this._createIframe();
13831
+ }
13832
+
13833
+ if (this.iframe) {
13834
+ this.iframe.style.display = 'block';
13835
+ }
13836
+
13837
+ this.displayed = true;
13838
+ }
13839
+
13840
+ hideSoftphone() {
13841
+ if (this.iframe) {
13842
+ this.iframe.style.display = 'none';
13843
+ }
13844
+ this.displayed = false;
13845
+ }
13846
+
13847
+ optionsFetched(fieldId , options ) {
13848
+ this._sendMessage(BRIDGE_OPTIONS_FETCHED, { fieldId, options });
13849
+ }
13850
+
13851
+ onOptionsResults(fieldId , options ) {
13852
+ this._sendMessage(BRIDGE_OPTIONS_FOUND, { fieldId, options });
13853
+ }
13854
+
13855
+ setFormSchema(schema , uiSchema ) {
13856
+ this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
13857
+ }
13858
+
13859
+ _createIframe(cb = () => {}) {
13860
+ this.iframe = document.createElement('iframe');
13861
+ // $FlowFixMe
13862
+ this.iframe.width = this.width;
13863
+ // $FlowFixMe
13864
+ this.iframe.height = this.height;
13865
+ // $FlowFixMe
13866
+ this.iframe.allow = 'camera *; microphone *; autoplay *; display-capture *';
13867
+ this.iframe.style.position = 'absolute';
13868
+ this.iframe.style.left = '0';
13869
+ this.iframe.style.bottom = '0';
13870
+ this.iframe.style.border = '1px solid #aaa';
13871
+ this.iframe.style.backgroundColor = 'white';
13872
+ this.iframe.src = this.url;
13873
+ this.iframe.style.display = 'none';
13874
+ this.iframe.id = 'wazo-softphone';
13875
+
13876
+ this.iframe.onload = cb;
13877
+
13878
+ // $FlowFixMe
13879
+ document.body.appendChild(this.iframe);
13880
+ }
13881
+
13882
+ _getLinks() {
13883
+ return [].slice.call(document.querySelectorAll('a:not([data-wazo-parsed])'), 0)
13884
+ .filter(link => link.href.indexOf('tel:') === 0 || link.href.indexOf('callto:') === 0);
13885
+ }
13886
+
13887
+ _onLinkClick(e ) {
13888
+ e.preventDefault();
13889
+ const number = e.target.href.split(':')[1];
13890
+
13891
+ this.makeCall(number);
13892
+ }
13893
+
13894
+ _onAuthenticated() {
13895
+ this.parseLinks();
13896
+ }
13897
+
13898
+ _onMessage(event ) {
13899
+ if (!event.data) {
13900
+ return;
13901
+ }
13902
+
13903
+ switch (event.data.type) {
13904
+ case SDK_ON_CALL_MADE:
13905
+ this.onCallMade(event.data.callSession);
13906
+ break;
13907
+ case SDK_CALL_ENDED: {
13908
+ const { callSession, content, direction, userExtension } = event.data;
13909
+ this.onCallEnded(callSession, content, direction, userExtension);
13910
+ break;
13911
+ }
13912
+ case SDK_CALL_INCOMING:
13913
+ this.onCallIncoming(event.data.callSession);
13914
+ break;
13915
+ case SDK_AUTHENTICATED:
13916
+ // $FlowFixMe
13917
+ this._onAuthenticated(event.data.session);
13918
+ this.onAuthenticated(event.data.session);
13919
+ break;
13920
+ case SDK_LOGGED_OUT:
13921
+ this.onLoggedOut();
13922
+ break;
13923
+ case BRIDGE_CREATE_OR_UPDATE_CARD: {
13924
+ const { content } = event.data;
13925
+ this.onCardSaved(content);
13926
+ break;
13927
+ }
13928
+ case BRIDGE_SEARCH_OPTIONS: {
13929
+ const { fieldId, query } = event.data;
13930
+ this.onSearchOptions(fieldId, query);
13931
+ break;
13932
+ }
13933
+ case BRIDGE_DISPLAY_LINKED_OPTION:
13934
+ this.onDisplayLinkedOption(event.data.linkedOptionId);
13935
+ break;
13936
+ case BRIDGE_WAZO_CONTACT_SEARCH:
13937
+ this.onWazoContactSearch(event.data.query);
13938
+ break;
13939
+ case BRIDGE_ON_AGENT_LOGGED_IN:
13940
+ this.onAgentLoggedIn();
13941
+ break;
13942
+ case BRIDGE_ON_AGENT_LOGGED_OUT:
13943
+ this.onAgentLoggedOut();
13944
+ break;
13945
+ case BRIDGE_ON_AGENT_PAUSED:
13946
+ this.onAgentPaused();
13947
+ break;
13948
+ case BRIDGE_ON_AGENT_RESUMED:
13949
+ this.onAgentResumed();
13950
+ break;
13951
+ case BRIDGE_ON_LANGUAGE_CHANGED:
13952
+ this.onLanguageChanged(event.data.language);
13953
+ break;
13954
+ case BRIDGE_ON_CALL_HELD:
13955
+ this.onCallHeld();
13956
+ break;
13957
+ case BRIDGE_ON_CALL_RESUMED:
13958
+ this.onCallResumed();
13959
+ break;
13960
+ case BRIDGE_ON_CALL_MUTED:
13961
+ this.onCallMuted();
13962
+ break;
13963
+ case BRIDGE_ON_CALL_UN_MUTED:
13964
+ this.onCallUnMuted();
13965
+ break;
13966
+ case BRIDGE_ON_DTMF:
13967
+ this.onDtmfSent(event.data.tone);
13968
+ break;
13969
+ case BRIDGE_ON_DIRECT_TRANSFER:
13970
+ this.onDirectTransfer(event.data.number);
13971
+ break;
13972
+ case BRIDGE_ON_CREATE_INDIRECT_TRANSFER:
13973
+ this.onCreateIndirectTransfer(event.data.number);
13974
+ break;
13975
+ case BRIDGE_ON_CANCEL_INDIRECT_TRANSFER:
13976
+ this.onCancelIndirectTransfer();
13977
+ break;
13978
+ case BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER:
13979
+ this.onConfirmIndirectTransfer();
13980
+ break;
13981
+ case BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE:
13982
+ this.onIndirectCallMade(event.data.call);
13983
+ break;
13984
+ case BRIDGE_ON_INDIRECT_TRANSFER_DONE:
13985
+ this.onIndirectTransferDone(event.data.call);
13986
+ break;
13987
+ case BRIDGE_ON_START_RECORDING:
13988
+ this.onStartRecording();
13989
+ break;
13990
+ case BRIDGE_ON_STOP_RECORDING:
13991
+ this.onStopRecording();
13992
+ break;
13993
+ default:
13994
+ this.onUnHandledEvent(event);
13995
+ break;
13996
+ }
13997
+ }
13998
+
13999
+ _sendMessage(type , payload = {}) {
14000
+ if (!this.iframe) {
14001
+ console.warn(`Could not send message of type ${type} to the Wazo Softphone, iframe not created yet`);
14002
+ return;
14003
+ }
14004
+
14005
+ this.iframe.contentWindow.postMessage({ type, ...payload }, '*');
14006
+ }
14007
+ }
14008
+
14009
+ var Softphone$1 = new Softphone();
14010
+
13676
14011
  /* global window */
13677
14012
 
13678
14013
  const Wazo = {
@@ -13693,6 +14028,7 @@ const Wazo = {
13693
14028
  loggerFor: IssueReporter$1.loggerFor.bind(IssueReporter$1),
13694
14029
  Features: Features$1,
13695
14030
  Checker,
14031
+ Softphone: Softphone$1,
13696
14032
 
13697
14033
  // Domain
13698
14034
  domain: {