@wazo/sdk 0.38.2 → 0.38.3

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/esm/index.js CHANGED
@@ -14123,7 +14123,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
14123
14123
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
14124
14124
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
14125
14125
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
14126
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
14126
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
14127
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
14128
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
14127
14129
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
14128
14130
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
14129
14131
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -14140,12 +14142,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
14140
14142
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
14141
14143
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
14142
14144
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
14145
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
14143
14146
 
14144
14147
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
14145
14148
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
14146
14149
 
14147
14150
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
14148
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
14151
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
14149
14152
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
14150
14153
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
14151
14154
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -14165,10 +14168,13 @@ class Softphone {
14165
14168
  onLinkEnabled(link ) {}
14166
14169
  onIFrameLoaded() {}
14167
14170
 
14168
- onCallAnswered() {}
14169
- onCallMade(call ) {}
14171
+ onCallLocallyAnswered(call ) {}
14172
+ onCallRemotelyAnswered(call ) {}
14173
+ onOutgoingCallMade(call ) {}
14170
14174
  onCallIncoming(call ) {}
14175
+ onCallRejected(call ) {}
14171
14176
  onCallEnded(call , card , direction , fromExtension ) {}
14177
+
14172
14178
  onCardSaved(card ) {}
14173
14179
  onCardCanceled() {}
14174
14180
  onAuthenticated(session ) {}
@@ -14200,7 +14206,18 @@ class Softphone {
14200
14206
  onStopRecording() {}
14201
14207
  onUnHandledEvent(event ) {}
14202
14208
 
14203
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
14209
+ init({
14210
+ url,
14211
+ width,
14212
+ height,
14213
+ server,
14214
+ port,
14215
+ language,
14216
+ wrapUpDuration,
14217
+ enableAgent = true,
14218
+ tenantId,
14219
+ debug = false,
14220
+ } = {}) {
14204
14221
  this.url = url || 'https://softphone.wazo.io';
14205
14222
  this.width = width || 500;
14206
14223
  this.height = height || 600;
@@ -14223,6 +14240,9 @@ class Softphone {
14223
14240
  if (port) {
14224
14241
  config.port = port;
14225
14242
  }
14243
+ if (tenantId) {
14244
+ config.tenantId = tenantId;
14245
+ }
14226
14246
  if (wrapUpDuration) {
14227
14247
  config.wrapUpDuration = wrapUpDuration;
14228
14248
  }
@@ -14233,6 +14253,10 @@ class Softphone {
14233
14253
  this._sendMessage(BRIDGE_ENABLE_AGENT);
14234
14254
  }
14235
14255
 
14256
+ if (debug) {
14257
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
14258
+ }
14259
+
14236
14260
  this._createIframe(() => {
14237
14261
  this.iframeLoaded = true;
14238
14262
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -14353,8 +14377,8 @@ class Softphone {
14353
14377
  }
14354
14378
 
14355
14379
  switch (event.data.type) {
14356
- case SDK_ON_CALL_MADE:
14357
- this.onCallMade(event.data.callSession);
14380
+ case SDK_ON_OUTGOING_CALL_MADE:
14381
+ this.onOutgoingCallMade(event.data.callSession);
14358
14382
  break;
14359
14383
  case SDK_CALL_ENDED: {
14360
14384
  const { callSession, content, direction, userExtension } = event.data;
@@ -14445,8 +14469,14 @@ class Softphone {
14445
14469
  case BRIDGE_ON_CARD_CANCELED:
14446
14470
  this.onCardCanceled();
14447
14471
  break;
14448
- case BRIDGE_ON_CALL_ANSWERED:
14449
- this.onCallAnswered();
14472
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14473
+ this.onCallLocallyAnswered(event.data.call);
14474
+ break;
14475
+ case BRIDGE_ON_CALL_REJECTED:
14476
+ this.onCallRejected(event.data.call);
14477
+ break;
14478
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14479
+ this.onCallRemotelyAnswered(event.data.call);
14450
14480
  break;
14451
14481
  default:
14452
14482
  this.onUnHandledEvent(event);
@@ -13684,7 +13684,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13684
13684
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13685
13685
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13686
13686
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13687
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13687
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13688
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13689
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13688
13690
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13689
13691
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13690
13692
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -13701,12 +13703,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13701
13703
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
13702
13704
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
13703
13705
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
13706
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
13704
13707
 
13705
13708
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
13706
13709
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
13707
13710
 
13708
13711
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
13709
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
13712
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
13710
13713
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
13711
13714
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
13712
13715
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -13726,10 +13729,13 @@ class Softphone {
13726
13729
  onLinkEnabled(link ) {}
13727
13730
  onIFrameLoaded() {}
13728
13731
 
13729
- onCallAnswered() {}
13730
- onCallMade(call ) {}
13732
+ onCallLocallyAnswered(call ) {}
13733
+ onCallRemotelyAnswered(call ) {}
13734
+ onOutgoingCallMade(call ) {}
13731
13735
  onCallIncoming(call ) {}
13736
+ onCallRejected(call ) {}
13732
13737
  onCallEnded(call , card , direction , fromExtension ) {}
13738
+
13733
13739
  onCardSaved(card ) {}
13734
13740
  onCardCanceled() {}
13735
13741
  onAuthenticated(session ) {}
@@ -13761,7 +13767,18 @@ class Softphone {
13761
13767
  onStopRecording() {}
13762
13768
  onUnHandledEvent(event ) {}
13763
13769
 
13764
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
13770
+ init({
13771
+ url,
13772
+ width,
13773
+ height,
13774
+ server,
13775
+ port,
13776
+ language,
13777
+ wrapUpDuration,
13778
+ enableAgent = true,
13779
+ tenantId,
13780
+ debug = false,
13781
+ } = {}) {
13765
13782
  this.url = url || 'https://softphone.wazo.io';
13766
13783
  this.width = width || 500;
13767
13784
  this.height = height || 600;
@@ -13784,6 +13801,9 @@ class Softphone {
13784
13801
  if (port) {
13785
13802
  config.port = port;
13786
13803
  }
13804
+ if (tenantId) {
13805
+ config.tenantId = tenantId;
13806
+ }
13787
13807
  if (wrapUpDuration) {
13788
13808
  config.wrapUpDuration = wrapUpDuration;
13789
13809
  }
@@ -13794,6 +13814,10 @@ class Softphone {
13794
13814
  this._sendMessage(BRIDGE_ENABLE_AGENT);
13795
13815
  }
13796
13816
 
13817
+ if (debug) {
13818
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
13819
+ }
13820
+
13797
13821
  this._createIframe(() => {
13798
13822
  this.iframeLoaded = true;
13799
13823
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -13914,8 +13938,8 @@ class Softphone {
13914
13938
  }
13915
13939
 
13916
13940
  switch (event.data.type) {
13917
- case SDK_ON_CALL_MADE:
13918
- this.onCallMade(event.data.callSession);
13941
+ case SDK_ON_OUTGOING_CALL_MADE:
13942
+ this.onOutgoingCallMade(event.data.callSession);
13919
13943
  break;
13920
13944
  case SDK_CALL_ENDED: {
13921
13945
  const { callSession, content, direction, userExtension } = event.data;
@@ -14006,8 +14030,14 @@ class Softphone {
14006
14030
  case BRIDGE_ON_CARD_CANCELED:
14007
14031
  this.onCardCanceled();
14008
14032
  break;
14009
- case BRIDGE_ON_CALL_ANSWERED:
14010
- this.onCallAnswered();
14033
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14034
+ this.onCallLocallyAnswered(event.data.call);
14035
+ break;
14036
+ case BRIDGE_ON_CALL_REJECTED:
14037
+ this.onCallRejected(event.data.call);
14038
+ break;
14039
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14040
+ this.onCallRemotelyAnswered(event.data.call);
14011
14041
  break;
14012
14042
  default:
14013
14043
  this.onUnHandledEvent(event);
@@ -13667,7 +13667,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13667
13667
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13668
13668
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13669
13669
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13670
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13670
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13671
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13672
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13671
13673
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13672
13674
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13673
13675
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -13684,12 +13686,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13684
13686
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
13685
13687
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
13686
13688
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
13689
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
13687
13690
 
13688
13691
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
13689
13692
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
13690
13693
 
13691
13694
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
13692
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
13695
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
13693
13696
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
13694
13697
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
13695
13698
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -13709,10 +13712,13 @@ class Softphone {
13709
13712
  onLinkEnabled(link ) {}
13710
13713
  onIFrameLoaded() {}
13711
13714
 
13712
- onCallAnswered() {}
13713
- onCallMade(call ) {}
13715
+ onCallLocallyAnswered(call ) {}
13716
+ onCallRemotelyAnswered(call ) {}
13717
+ onOutgoingCallMade(call ) {}
13714
13718
  onCallIncoming(call ) {}
13719
+ onCallRejected(call ) {}
13715
13720
  onCallEnded(call , card , direction , fromExtension ) {}
13721
+
13716
13722
  onCardSaved(card ) {}
13717
13723
  onCardCanceled() {}
13718
13724
  onAuthenticated(session ) {}
@@ -13744,7 +13750,18 @@ class Softphone {
13744
13750
  onStopRecording() {}
13745
13751
  onUnHandledEvent(event ) {}
13746
13752
 
13747
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
13753
+ init({
13754
+ url,
13755
+ width,
13756
+ height,
13757
+ server,
13758
+ port,
13759
+ language,
13760
+ wrapUpDuration,
13761
+ enableAgent = true,
13762
+ tenantId,
13763
+ debug = false,
13764
+ } = {}) {
13748
13765
  this.url = url || 'https://softphone.wazo.io';
13749
13766
  this.width = width || 500;
13750
13767
  this.height = height || 600;
@@ -13767,6 +13784,9 @@ class Softphone {
13767
13784
  if (port) {
13768
13785
  config.port = port;
13769
13786
  }
13787
+ if (tenantId) {
13788
+ config.tenantId = tenantId;
13789
+ }
13770
13790
  if (wrapUpDuration) {
13771
13791
  config.wrapUpDuration = wrapUpDuration;
13772
13792
  }
@@ -13777,6 +13797,10 @@ class Softphone {
13777
13797
  this._sendMessage(BRIDGE_ENABLE_AGENT);
13778
13798
  }
13779
13799
 
13800
+ if (debug) {
13801
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
13802
+ }
13803
+
13780
13804
  this._createIframe(() => {
13781
13805
  this.iframeLoaded = true;
13782
13806
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -13897,8 +13921,8 @@ class Softphone {
13897
13921
  }
13898
13922
 
13899
13923
  switch (event.data.type) {
13900
- case SDK_ON_CALL_MADE:
13901
- this.onCallMade(event.data.callSession);
13924
+ case SDK_ON_OUTGOING_CALL_MADE:
13925
+ this.onOutgoingCallMade(event.data.callSession);
13902
13926
  break;
13903
13927
  case SDK_CALL_ENDED: {
13904
13928
  const { callSession, content, direction, userExtension } = event.data;
@@ -13989,8 +14013,14 @@ class Softphone {
13989
14013
  case BRIDGE_ON_CARD_CANCELED:
13990
14014
  this.onCardCanceled();
13991
14015
  break;
13992
- case BRIDGE_ON_CALL_ANSWERED:
13993
- this.onCallAnswered();
14016
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14017
+ this.onCallLocallyAnswered(event.data.call);
14018
+ break;
14019
+ case BRIDGE_ON_CALL_REJECTED:
14020
+ this.onCallRejected(event.data.call);
14021
+ break;
14022
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14023
+ this.onCallRemotelyAnswered(event.data.call);
13994
14024
  break;
13995
14025
  default:
13996
14026
  this.onUnHandledEvent(event);
@@ -13575,7 +13575,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13575
13575
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13576
13576
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13577
13577
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13578
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13578
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13579
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13580
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13579
13581
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13580
13582
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13581
13583
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -13592,12 +13594,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13592
13594
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
13593
13595
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
13594
13596
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
13597
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
13595
13598
 
13596
13599
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
13597
13600
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
13598
13601
 
13599
13602
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
13600
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
13603
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
13601
13604
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
13602
13605
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
13603
13606
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -13617,10 +13620,13 @@ class Softphone {
13617
13620
  onLinkEnabled(link ) {}
13618
13621
  onIFrameLoaded() {}
13619
13622
 
13620
- onCallAnswered() {}
13621
- onCallMade(call ) {}
13623
+ onCallLocallyAnswered(call ) {}
13624
+ onCallRemotelyAnswered(call ) {}
13625
+ onOutgoingCallMade(call ) {}
13622
13626
  onCallIncoming(call ) {}
13627
+ onCallRejected(call ) {}
13623
13628
  onCallEnded(call , card , direction , fromExtension ) {}
13629
+
13624
13630
  onCardSaved(card ) {}
13625
13631
  onCardCanceled() {}
13626
13632
  onAuthenticated(session ) {}
@@ -13652,7 +13658,18 @@ class Softphone {
13652
13658
  onStopRecording() {}
13653
13659
  onUnHandledEvent(event ) {}
13654
13660
 
13655
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
13661
+ init({
13662
+ url,
13663
+ width,
13664
+ height,
13665
+ server,
13666
+ port,
13667
+ language,
13668
+ wrapUpDuration,
13669
+ enableAgent = true,
13670
+ tenantId,
13671
+ debug = false,
13672
+ } = {}) {
13656
13673
  this.url = url || 'https://softphone.wazo.io';
13657
13674
  this.width = width || 500;
13658
13675
  this.height = height || 600;
@@ -13675,6 +13692,9 @@ class Softphone {
13675
13692
  if (port) {
13676
13693
  config.port = port;
13677
13694
  }
13695
+ if (tenantId) {
13696
+ config.tenantId = tenantId;
13697
+ }
13678
13698
  if (wrapUpDuration) {
13679
13699
  config.wrapUpDuration = wrapUpDuration;
13680
13700
  }
@@ -13685,6 +13705,10 @@ class Softphone {
13685
13705
  this._sendMessage(BRIDGE_ENABLE_AGENT);
13686
13706
  }
13687
13707
 
13708
+ if (debug) {
13709
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
13710
+ }
13711
+
13688
13712
  this._createIframe(() => {
13689
13713
  this.iframeLoaded = true;
13690
13714
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -13805,8 +13829,8 @@ class Softphone {
13805
13829
  }
13806
13830
 
13807
13831
  switch (event.data.type) {
13808
- case SDK_ON_CALL_MADE:
13809
- this.onCallMade(event.data.callSession);
13832
+ case SDK_ON_OUTGOING_CALL_MADE:
13833
+ this.onOutgoingCallMade(event.data.callSession);
13810
13834
  break;
13811
13835
  case SDK_CALL_ENDED: {
13812
13836
  const { callSession, content, direction, userExtension } = event.data;
@@ -13897,8 +13921,14 @@ class Softphone {
13897
13921
  case BRIDGE_ON_CARD_CANCELED:
13898
13922
  this.onCardCanceled();
13899
13923
  break;
13900
- case BRIDGE_ON_CALL_ANSWERED:
13901
- this.onCallAnswered();
13924
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
13925
+ this.onCallLocallyAnswered(event.data.call);
13926
+ break;
13927
+ case BRIDGE_ON_CALL_REJECTED:
13928
+ this.onCallRejected(event.data.call);
13929
+ break;
13930
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
13931
+ this.onCallRemotelyAnswered(event.data.call);
13902
13932
  break;
13903
13933
  default:
13904
13934
  this.onUnHandledEvent(event);
@@ -14,7 +14,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
14
14
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
15
15
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
16
16
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
17
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
17
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
18
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
19
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
18
20
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
19
21
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
20
22
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -31,12 +33,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
31
33
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
32
34
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
33
35
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
36
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
34
37
 
35
38
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
36
39
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
37
40
 
38
41
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
39
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
42
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
40
43
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
41
44
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
42
45
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -56,10 +59,13 @@ class Softphone {
56
59
  onLinkEnabled(link ) {}
57
60
  onIFrameLoaded() {}
58
61
 
59
- onCallAnswered() {}
60
- onCallMade(call ) {}
62
+ onCallLocallyAnswered(call ) {}
63
+ onCallRemotelyAnswered(call ) {}
64
+ onOutgoingCallMade(call ) {}
61
65
  onCallIncoming(call ) {}
66
+ onCallRejected(call ) {}
62
67
  onCallEnded(call , card , direction , fromExtension ) {}
68
+
63
69
  onCardSaved(card ) {}
64
70
  onCardCanceled() {}
65
71
  onAuthenticated(session ) {}
@@ -91,7 +97,18 @@ class Softphone {
91
97
  onStopRecording() {}
92
98
  onUnHandledEvent(event ) {}
93
99
 
94
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
100
+ init({
101
+ url,
102
+ width,
103
+ height,
104
+ server,
105
+ port,
106
+ language,
107
+ wrapUpDuration,
108
+ enableAgent = true,
109
+ tenantId,
110
+ debug = false,
111
+ } = {}) {
95
112
  this.url = url || 'https://softphone.wazo.io';
96
113
  this.width = width || 500;
97
114
  this.height = height || 600;
@@ -114,6 +131,9 @@ class Softphone {
114
131
  if (port) {
115
132
  config.port = port;
116
133
  }
134
+ if (tenantId) {
135
+ config.tenantId = tenantId;
136
+ }
117
137
  if (wrapUpDuration) {
118
138
  config.wrapUpDuration = wrapUpDuration;
119
139
  }
@@ -124,6 +144,10 @@ class Softphone {
124
144
  this._sendMessage(BRIDGE_ENABLE_AGENT);
125
145
  }
126
146
 
147
+ if (debug) {
148
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
149
+ }
150
+
127
151
  this._createIframe(() => {
128
152
  this.iframeLoaded = true;
129
153
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -244,8 +268,8 @@ class Softphone {
244
268
  }
245
269
 
246
270
  switch (event.data.type) {
247
- case SDK_ON_CALL_MADE:
248
- this.onCallMade(event.data.callSession);
271
+ case SDK_ON_OUTGOING_CALL_MADE:
272
+ this.onOutgoingCallMade(event.data.callSession);
249
273
  break;
250
274
  case SDK_CALL_ENDED: {
251
275
  const { callSession, content, direction, userExtension } = event.data;
@@ -336,8 +360,14 @@ class Softphone {
336
360
  case BRIDGE_ON_CARD_CANCELED:
337
361
  this.onCardCanceled();
338
362
  break;
339
- case BRIDGE_ON_CALL_ANSWERED:
340
- this.onCallAnswered();
363
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
364
+ this.onCallLocallyAnswered(event.data.call);
365
+ break;
366
+ case BRIDGE_ON_CALL_REJECTED:
367
+ this.onCallRejected(event.data.call);
368
+ break;
369
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
370
+ this.onCallRemotelyAnswered(event.data.call);
341
371
  break;
342
372
  default:
343
373
  this.onUnHandledEvent(event);
@@ -13985,7 +13985,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13985
13985
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13986
13986
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13987
13987
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13988
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13988
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13989
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13990
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13989
13991
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13990
13992
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13991
13993
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -14002,12 +14004,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
14002
14004
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
14003
14005
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
14004
14006
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
14007
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
14005
14008
 
14006
14009
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
14007
14010
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
14008
14011
 
14009
14012
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
14010
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
14013
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
14011
14014
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
14012
14015
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
14013
14016
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -14027,10 +14030,13 @@ class Softphone {
14027
14030
  onLinkEnabled(link ) {}
14028
14031
  onIFrameLoaded() {}
14029
14032
 
14030
- onCallAnswered() {}
14031
- onCallMade(call ) {}
14033
+ onCallLocallyAnswered(call ) {}
14034
+ onCallRemotelyAnswered(call ) {}
14035
+ onOutgoingCallMade(call ) {}
14032
14036
  onCallIncoming(call ) {}
14037
+ onCallRejected(call ) {}
14033
14038
  onCallEnded(call , card , direction , fromExtension ) {}
14039
+
14034
14040
  onCardSaved(card ) {}
14035
14041
  onCardCanceled() {}
14036
14042
  onAuthenticated(session ) {}
@@ -14062,7 +14068,18 @@ class Softphone {
14062
14068
  onStopRecording() {}
14063
14069
  onUnHandledEvent(event ) {}
14064
14070
 
14065
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
14071
+ init({
14072
+ url,
14073
+ width,
14074
+ height,
14075
+ server,
14076
+ port,
14077
+ language,
14078
+ wrapUpDuration,
14079
+ enableAgent = true,
14080
+ tenantId,
14081
+ debug = false,
14082
+ } = {}) {
14066
14083
  this.url = url || 'https://softphone.wazo.io';
14067
14084
  this.width = width || 500;
14068
14085
  this.height = height || 600;
@@ -14085,6 +14102,9 @@ class Softphone {
14085
14102
  if (port) {
14086
14103
  config.port = port;
14087
14104
  }
14105
+ if (tenantId) {
14106
+ config.tenantId = tenantId;
14107
+ }
14088
14108
  if (wrapUpDuration) {
14089
14109
  config.wrapUpDuration = wrapUpDuration;
14090
14110
  }
@@ -14095,6 +14115,10 @@ class Softphone {
14095
14115
  this._sendMessage(BRIDGE_ENABLE_AGENT);
14096
14116
  }
14097
14117
 
14118
+ if (debug) {
14119
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
14120
+ }
14121
+
14098
14122
  this._createIframe(() => {
14099
14123
  this.iframeLoaded = true;
14100
14124
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -14215,8 +14239,8 @@ class Softphone {
14215
14239
  }
14216
14240
 
14217
14241
  switch (event.data.type) {
14218
- case SDK_ON_CALL_MADE:
14219
- this.onCallMade(event.data.callSession);
14242
+ case SDK_ON_OUTGOING_CALL_MADE:
14243
+ this.onOutgoingCallMade(event.data.callSession);
14220
14244
  break;
14221
14245
  case SDK_CALL_ENDED: {
14222
14246
  const { callSession, content, direction, userExtension } = event.data;
@@ -14307,8 +14331,14 @@ class Softphone {
14307
14331
  case BRIDGE_ON_CARD_CANCELED:
14308
14332
  this.onCardCanceled();
14309
14333
  break;
14310
- case BRIDGE_ON_CALL_ANSWERED:
14311
- this.onCallAnswered();
14334
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14335
+ this.onCallLocallyAnswered(event.data.call);
14336
+ break;
14337
+ case BRIDGE_ON_CALL_REJECTED:
14338
+ this.onCallRejected(event.data.call);
14339
+ break;
14340
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14341
+ this.onCallRemotelyAnswered(event.data.call);
14312
14342
  break;
14313
14343
  default:
14314
14344
  this.onUnHandledEvent(event);