@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.
@@ -16,7 +16,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
16
16
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
17
17
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
18
18
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
19
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
19
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
20
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
21
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
20
22
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
21
23
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
22
24
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -33,12 +35,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
33
35
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
34
36
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
35
37
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
38
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
36
39
 
37
40
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
38
41
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
39
42
 
40
43
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
41
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
44
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
42
45
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
43
46
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
44
47
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -58,10 +61,13 @@ class Softphone {
58
61
  onLinkEnabled(link ) {}
59
62
  onIFrameLoaded() {}
60
63
 
61
- onCallAnswered() {}
62
- onCallMade(call ) {}
64
+ onCallLocallyAnswered(call ) {}
65
+ onCallRemotelyAnswered(call ) {}
66
+ onOutgoingCallMade(call ) {}
63
67
  onCallIncoming(call ) {}
68
+ onCallRejected(call ) {}
64
69
  onCallEnded(call , card , direction , fromExtension ) {}
70
+
65
71
  onCardSaved(card ) {}
66
72
  onCardCanceled() {}
67
73
  onAuthenticated(session ) {}
@@ -93,7 +99,18 @@ class Softphone {
93
99
  onStopRecording() {}
94
100
  onUnHandledEvent(event ) {}
95
101
 
96
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
102
+ init({
103
+ url,
104
+ width,
105
+ height,
106
+ server,
107
+ port,
108
+ language,
109
+ wrapUpDuration,
110
+ enableAgent = true,
111
+ tenantId,
112
+ debug = false,
113
+ } = {}) {
97
114
  this.url = url || 'https://softphone.wazo.io';
98
115
  this.width = width || 500;
99
116
  this.height = height || 600;
@@ -116,6 +133,9 @@ class Softphone {
116
133
  if (port) {
117
134
  config.port = port;
118
135
  }
136
+ if (tenantId) {
137
+ config.tenantId = tenantId;
138
+ }
119
139
  if (wrapUpDuration) {
120
140
  config.wrapUpDuration = wrapUpDuration;
121
141
  }
@@ -126,6 +146,10 @@ class Softphone {
126
146
  this._sendMessage(BRIDGE_ENABLE_AGENT);
127
147
  }
128
148
 
149
+ if (debug) {
150
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
151
+ }
152
+
129
153
  this._createIframe(() => {
130
154
  this.iframeLoaded = true;
131
155
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -246,8 +270,8 @@ class Softphone {
246
270
  }
247
271
 
248
272
  switch (event.data.type) {
249
- case SDK_ON_CALL_MADE:
250
- this.onCallMade(event.data.callSession);
273
+ case SDK_ON_OUTGOING_CALL_MADE:
274
+ this.onOutgoingCallMade(event.data.callSession);
251
275
  break;
252
276
  case SDK_CALL_ENDED: {
253
277
  const { callSession, content, direction, userExtension } = event.data;
@@ -338,8 +362,14 @@ class Softphone {
338
362
  case BRIDGE_ON_CARD_CANCELED:
339
363
  this.onCardCanceled();
340
364
  break;
341
- case BRIDGE_ON_CALL_ANSWERED:
342
- this.onCallAnswered();
365
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
366
+ this.onCallLocallyAnswered(event.data.call);
367
+ break;
368
+ case BRIDGE_ON_CALL_REJECTED:
369
+ this.onCallRejected(event.data.call);
370
+ break;
371
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
372
+ this.onCallRemotelyAnswered(event.data.call);
343
373
  break;
344
374
  default:
345
375
  this.onUnHandledEvent(event);
@@ -13995,7 +13995,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13995
13995
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13996
13996
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13997
13997
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13998
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13998
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13999
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
14000
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13999
14001
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
14000
14002
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
14001
14003
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -14012,12 +14014,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
14012
14014
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
14013
14015
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
14014
14016
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
14017
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
14015
14018
 
14016
14019
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
14017
14020
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
14018
14021
 
14019
14022
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
14020
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
14023
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
14021
14024
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
14022
14025
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
14023
14026
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -14037,10 +14040,13 @@ class Softphone {
14037
14040
  onLinkEnabled(link ) {}
14038
14041
  onIFrameLoaded() {}
14039
14042
 
14040
- onCallAnswered() {}
14041
- onCallMade(call ) {}
14043
+ onCallLocallyAnswered(call ) {}
14044
+ onCallRemotelyAnswered(call ) {}
14045
+ onOutgoingCallMade(call ) {}
14042
14046
  onCallIncoming(call ) {}
14047
+ onCallRejected(call ) {}
14043
14048
  onCallEnded(call , card , direction , fromExtension ) {}
14049
+
14044
14050
  onCardSaved(card ) {}
14045
14051
  onCardCanceled() {}
14046
14052
  onAuthenticated(session ) {}
@@ -14072,7 +14078,18 @@ class Softphone {
14072
14078
  onStopRecording() {}
14073
14079
  onUnHandledEvent(event ) {}
14074
14080
 
14075
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
14081
+ init({
14082
+ url,
14083
+ width,
14084
+ height,
14085
+ server,
14086
+ port,
14087
+ language,
14088
+ wrapUpDuration,
14089
+ enableAgent = true,
14090
+ tenantId,
14091
+ debug = false,
14092
+ } = {}) {
14076
14093
  this.url = url || 'https://softphone.wazo.io';
14077
14094
  this.width = width || 500;
14078
14095
  this.height = height || 600;
@@ -14095,6 +14112,9 @@ class Softphone {
14095
14112
  if (port) {
14096
14113
  config.port = port;
14097
14114
  }
14115
+ if (tenantId) {
14116
+ config.tenantId = tenantId;
14117
+ }
14098
14118
  if (wrapUpDuration) {
14099
14119
  config.wrapUpDuration = wrapUpDuration;
14100
14120
  }
@@ -14105,6 +14125,10 @@ class Softphone {
14105
14125
  this._sendMessage(BRIDGE_ENABLE_AGENT);
14106
14126
  }
14107
14127
 
14128
+ if (debug) {
14129
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
14130
+ }
14131
+
14108
14132
  this._createIframe(() => {
14109
14133
  this.iframeLoaded = true;
14110
14134
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -14225,8 +14249,8 @@ class Softphone {
14225
14249
  }
14226
14250
 
14227
14251
  switch (event.data.type) {
14228
- case SDK_ON_CALL_MADE:
14229
- this.onCallMade(event.data.callSession);
14252
+ case SDK_ON_OUTGOING_CALL_MADE:
14253
+ this.onOutgoingCallMade(event.data.callSession);
14230
14254
  break;
14231
14255
  case SDK_CALL_ENDED: {
14232
14256
  const { callSession, content, direction, userExtension } = event.data;
@@ -14317,8 +14341,14 @@ class Softphone {
14317
14341
  case BRIDGE_ON_CARD_CANCELED:
14318
14342
  this.onCardCanceled();
14319
14343
  break;
14320
- case BRIDGE_ON_CALL_ANSWERED:
14321
- this.onCallAnswered();
14344
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14345
+ this.onCallLocallyAnswered(event.data.call);
14346
+ break;
14347
+ case BRIDGE_ON_CALL_REJECTED:
14348
+ this.onCallRejected(event.data.call);
14349
+ break;
14350
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14351
+ this.onCallRemotelyAnswered(event.data.call);
14322
14352
  break;
14323
14353
  default:
14324
14354
  this.onUnHandledEvent(event);
@@ -12864,7 +12864,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
12864
12864
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
12865
12865
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
12866
12866
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
12867
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
12867
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
12868
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
12869
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
12868
12870
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
12869
12871
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
12870
12872
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -12881,12 +12883,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
12881
12883
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
12882
12884
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
12883
12885
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
12886
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
12884
12887
 
12885
12888
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
12886
12889
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
12887
12890
 
12888
12891
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
12889
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
12892
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
12890
12893
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
12891
12894
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
12892
12895
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -12906,10 +12909,13 @@ class Softphone {
12906
12909
  onLinkEnabled(link ) {}
12907
12910
  onIFrameLoaded() {}
12908
12911
 
12909
- onCallAnswered() {}
12910
- onCallMade(call ) {}
12912
+ onCallLocallyAnswered(call ) {}
12913
+ onCallRemotelyAnswered(call ) {}
12914
+ onOutgoingCallMade(call ) {}
12911
12915
  onCallIncoming(call ) {}
12916
+ onCallRejected(call ) {}
12912
12917
  onCallEnded(call , card , direction , fromExtension ) {}
12918
+
12913
12919
  onCardSaved(card ) {}
12914
12920
  onCardCanceled() {}
12915
12921
  onAuthenticated(session ) {}
@@ -12941,7 +12947,18 @@ class Softphone {
12941
12947
  onStopRecording() {}
12942
12948
  onUnHandledEvent(event ) {}
12943
12949
 
12944
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
12950
+ init({
12951
+ url,
12952
+ width,
12953
+ height,
12954
+ server,
12955
+ port,
12956
+ language,
12957
+ wrapUpDuration,
12958
+ enableAgent = true,
12959
+ tenantId,
12960
+ debug = false,
12961
+ } = {}) {
12945
12962
  this.url = url || 'https://softphone.wazo.io';
12946
12963
  this.width = width || 500;
12947
12964
  this.height = height || 600;
@@ -12964,6 +12981,9 @@ class Softphone {
12964
12981
  if (port) {
12965
12982
  config.port = port;
12966
12983
  }
12984
+ if (tenantId) {
12985
+ config.tenantId = tenantId;
12986
+ }
12967
12987
  if (wrapUpDuration) {
12968
12988
  config.wrapUpDuration = wrapUpDuration;
12969
12989
  }
@@ -12974,6 +12994,10 @@ class Softphone {
12974
12994
  this._sendMessage(BRIDGE_ENABLE_AGENT);
12975
12995
  }
12976
12996
 
12997
+ if (debug) {
12998
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
12999
+ }
13000
+
12977
13001
  this._createIframe(() => {
12978
13002
  this.iframeLoaded = true;
12979
13003
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -13094,8 +13118,8 @@ class Softphone {
13094
13118
  }
13095
13119
 
13096
13120
  switch (event.data.type) {
13097
- case SDK_ON_CALL_MADE:
13098
- this.onCallMade(event.data.callSession);
13121
+ case SDK_ON_OUTGOING_CALL_MADE:
13122
+ this.onOutgoingCallMade(event.data.callSession);
13099
13123
  break;
13100
13124
  case SDK_CALL_ENDED: {
13101
13125
  const { callSession, content, direction, userExtension } = event.data;
@@ -13186,8 +13210,14 @@ class Softphone {
13186
13210
  case BRIDGE_ON_CARD_CANCELED:
13187
13211
  this.onCardCanceled();
13188
13212
  break;
13189
- case BRIDGE_ON_CALL_ANSWERED:
13190
- this.onCallAnswered();
13213
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
13214
+ this.onCallLocallyAnswered(event.data.call);
13215
+ break;
13216
+ case BRIDGE_ON_CALL_REJECTED:
13217
+ this.onCallRejected(event.data.call);
13218
+ break;
13219
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
13220
+ this.onCallRemotelyAnswered(event.data.call);
13191
13221
  break;
13192
13222
  default:
13193
13223
  this.onUnHandledEvent(event);
@@ -12869,7 +12869,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
12869
12869
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
12870
12870
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
12871
12871
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
12872
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
12872
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
12873
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
12874
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
12873
12875
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
12874
12876
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
12875
12877
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -12886,12 +12888,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
12886
12888
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
12887
12889
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
12888
12890
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
12891
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
12889
12892
 
12890
12893
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
12891
12894
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
12892
12895
 
12893
12896
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
12894
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
12897
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
12895
12898
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
12896
12899
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
12897
12900
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -12911,10 +12914,13 @@ class Softphone {
12911
12914
  onLinkEnabled(link ) {}
12912
12915
  onIFrameLoaded() {}
12913
12916
 
12914
- onCallAnswered() {}
12915
- onCallMade(call ) {}
12917
+ onCallLocallyAnswered(call ) {}
12918
+ onCallRemotelyAnswered(call ) {}
12919
+ onOutgoingCallMade(call ) {}
12916
12920
  onCallIncoming(call ) {}
12921
+ onCallRejected(call ) {}
12917
12922
  onCallEnded(call , card , direction , fromExtension ) {}
12923
+
12918
12924
  onCardSaved(card ) {}
12919
12925
  onCardCanceled() {}
12920
12926
  onAuthenticated(session ) {}
@@ -12946,7 +12952,18 @@ class Softphone {
12946
12952
  onStopRecording() {}
12947
12953
  onUnHandledEvent(event ) {}
12948
12954
 
12949
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
12955
+ init({
12956
+ url,
12957
+ width,
12958
+ height,
12959
+ server,
12960
+ port,
12961
+ language,
12962
+ wrapUpDuration,
12963
+ enableAgent = true,
12964
+ tenantId,
12965
+ debug = false,
12966
+ } = {}) {
12950
12967
  this.url = url || 'https://softphone.wazo.io';
12951
12968
  this.width = width || 500;
12952
12969
  this.height = height || 600;
@@ -12969,6 +12986,9 @@ class Softphone {
12969
12986
  if (port) {
12970
12987
  config.port = port;
12971
12988
  }
12989
+ if (tenantId) {
12990
+ config.tenantId = tenantId;
12991
+ }
12972
12992
  if (wrapUpDuration) {
12973
12993
  config.wrapUpDuration = wrapUpDuration;
12974
12994
  }
@@ -12979,6 +12999,10 @@ class Softphone {
12979
12999
  this._sendMessage(BRIDGE_ENABLE_AGENT);
12980
13000
  }
12981
13001
 
13002
+ if (debug) {
13003
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
13004
+ }
13005
+
12982
13006
  this._createIframe(() => {
12983
13007
  this.iframeLoaded = true;
12984
13008
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -13099,8 +13123,8 @@ class Softphone {
13099
13123
  }
13100
13124
 
13101
13125
  switch (event.data.type) {
13102
- case SDK_ON_CALL_MADE:
13103
- this.onCallMade(event.data.callSession);
13126
+ case SDK_ON_OUTGOING_CALL_MADE:
13127
+ this.onOutgoingCallMade(event.data.callSession);
13104
13128
  break;
13105
13129
  case SDK_CALL_ENDED: {
13106
13130
  const { callSession, content, direction, userExtension } = event.data;
@@ -13191,8 +13215,14 @@ class Softphone {
13191
13215
  case BRIDGE_ON_CARD_CANCELED:
13192
13216
  this.onCardCanceled();
13193
13217
  break;
13194
- case BRIDGE_ON_CALL_ANSWERED:
13195
- this.onCallAnswered();
13218
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
13219
+ this.onCallLocallyAnswered(event.data.call);
13220
+ break;
13221
+ case BRIDGE_ON_CALL_REJECTED:
13222
+ this.onCallRejected(event.data.call);
13223
+ break;
13224
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
13225
+ this.onCallRemotelyAnswered(event.data.call);
13196
13226
  break;
13197
13227
  default:
13198
13228
  this.onUnHandledEvent(event);
@@ -13148,7 +13148,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13148
13148
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13149
13149
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13150
13150
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13151
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13151
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13152
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13153
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13152
13154
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13153
13155
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13154
13156
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -13165,12 +13167,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13165
13167
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
13166
13168
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
13167
13169
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
13170
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
13168
13171
 
13169
13172
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
13170
13173
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
13171
13174
 
13172
13175
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
13173
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
13176
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
13174
13177
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
13175
13178
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
13176
13179
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -13190,10 +13193,13 @@ class Softphone {
13190
13193
  onLinkEnabled(link ) {}
13191
13194
  onIFrameLoaded() {}
13192
13195
 
13193
- onCallAnswered() {}
13194
- onCallMade(call ) {}
13196
+ onCallLocallyAnswered(call ) {}
13197
+ onCallRemotelyAnswered(call ) {}
13198
+ onOutgoingCallMade(call ) {}
13195
13199
  onCallIncoming(call ) {}
13200
+ onCallRejected(call ) {}
13196
13201
  onCallEnded(call , card , direction , fromExtension ) {}
13202
+
13197
13203
  onCardSaved(card ) {}
13198
13204
  onCardCanceled() {}
13199
13205
  onAuthenticated(session ) {}
@@ -13225,7 +13231,18 @@ class Softphone {
13225
13231
  onStopRecording() {}
13226
13232
  onUnHandledEvent(event ) {}
13227
13233
 
13228
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
13234
+ init({
13235
+ url,
13236
+ width,
13237
+ height,
13238
+ server,
13239
+ port,
13240
+ language,
13241
+ wrapUpDuration,
13242
+ enableAgent = true,
13243
+ tenantId,
13244
+ debug = false,
13245
+ } = {}) {
13229
13246
  this.url = url || 'https://softphone.wazo.io';
13230
13247
  this.width = width || 500;
13231
13248
  this.height = height || 600;
@@ -13248,6 +13265,9 @@ class Softphone {
13248
13265
  if (port) {
13249
13266
  config.port = port;
13250
13267
  }
13268
+ if (tenantId) {
13269
+ config.tenantId = tenantId;
13270
+ }
13251
13271
  if (wrapUpDuration) {
13252
13272
  config.wrapUpDuration = wrapUpDuration;
13253
13273
  }
@@ -13258,6 +13278,10 @@ class Softphone {
13258
13278
  this._sendMessage(BRIDGE_ENABLE_AGENT);
13259
13279
  }
13260
13280
 
13281
+ if (debug) {
13282
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
13283
+ }
13284
+
13261
13285
  this._createIframe(() => {
13262
13286
  this.iframeLoaded = true;
13263
13287
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -13378,8 +13402,8 @@ class Softphone {
13378
13402
  }
13379
13403
 
13380
13404
  switch (event.data.type) {
13381
- case SDK_ON_CALL_MADE:
13382
- this.onCallMade(event.data.callSession);
13405
+ case SDK_ON_OUTGOING_CALL_MADE:
13406
+ this.onOutgoingCallMade(event.data.callSession);
13383
13407
  break;
13384
13408
  case SDK_CALL_ENDED: {
13385
13409
  const { callSession, content, direction, userExtension } = event.data;
@@ -13470,8 +13494,14 @@ class Softphone {
13470
13494
  case BRIDGE_ON_CARD_CANCELED:
13471
13495
  this.onCardCanceled();
13472
13496
  break;
13473
- case BRIDGE_ON_CALL_ANSWERED:
13474
- this.onCallAnswered();
13497
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
13498
+ this.onCallLocallyAnswered(event.data.call);
13499
+ break;
13500
+ case BRIDGE_ON_CALL_REJECTED:
13501
+ this.onCallRejected(event.data.call);
13502
+ break;
13503
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
13504
+ this.onCallRemotelyAnswered(event.data.call);
13475
13505
  break;
13476
13506
  default:
13477
13507
  this.onUnHandledEvent(event);
@@ -13161,7 +13161,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13161
13161
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13162
13162
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13163
13163
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13164
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13164
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13165
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13166
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13165
13167
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13166
13168
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13167
13169
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -13178,12 +13180,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13178
13180
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
13179
13181
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
13180
13182
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
13183
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
13181
13184
 
13182
13185
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
13183
13186
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
13184
13187
 
13185
13188
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
13186
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
13189
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
13187
13190
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
13188
13191
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
13189
13192
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -13203,10 +13206,13 @@ class Softphone {
13203
13206
  onLinkEnabled(link ) {}
13204
13207
  onIFrameLoaded() {}
13205
13208
 
13206
- onCallAnswered() {}
13207
- onCallMade(call ) {}
13209
+ onCallLocallyAnswered(call ) {}
13210
+ onCallRemotelyAnswered(call ) {}
13211
+ onOutgoingCallMade(call ) {}
13208
13212
  onCallIncoming(call ) {}
13213
+ onCallRejected(call ) {}
13209
13214
  onCallEnded(call , card , direction , fromExtension ) {}
13215
+
13210
13216
  onCardSaved(card ) {}
13211
13217
  onCardCanceled() {}
13212
13218
  onAuthenticated(session ) {}
@@ -13238,7 +13244,18 @@ class Softphone {
13238
13244
  onStopRecording() {}
13239
13245
  onUnHandledEvent(event ) {}
13240
13246
 
13241
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
13247
+ init({
13248
+ url,
13249
+ width,
13250
+ height,
13251
+ server,
13252
+ port,
13253
+ language,
13254
+ wrapUpDuration,
13255
+ enableAgent = true,
13256
+ tenantId,
13257
+ debug = false,
13258
+ } = {}) {
13242
13259
  this.url = url || 'https://softphone.wazo.io';
13243
13260
  this.width = width || 500;
13244
13261
  this.height = height || 600;
@@ -13261,6 +13278,9 @@ class Softphone {
13261
13278
  if (port) {
13262
13279
  config.port = port;
13263
13280
  }
13281
+ if (tenantId) {
13282
+ config.tenantId = tenantId;
13283
+ }
13264
13284
  if (wrapUpDuration) {
13265
13285
  config.wrapUpDuration = wrapUpDuration;
13266
13286
  }
@@ -13271,6 +13291,10 @@ class Softphone {
13271
13291
  this._sendMessage(BRIDGE_ENABLE_AGENT);
13272
13292
  }
13273
13293
 
13294
+ if (debug) {
13295
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
13296
+ }
13297
+
13274
13298
  this._createIframe(() => {
13275
13299
  this.iframeLoaded = true;
13276
13300
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -13391,8 +13415,8 @@ class Softphone {
13391
13415
  }
13392
13416
 
13393
13417
  switch (event.data.type) {
13394
- case SDK_ON_CALL_MADE:
13395
- this.onCallMade(event.data.callSession);
13418
+ case SDK_ON_OUTGOING_CALL_MADE:
13419
+ this.onOutgoingCallMade(event.data.callSession);
13396
13420
  break;
13397
13421
  case SDK_CALL_ENDED: {
13398
13422
  const { callSession, content, direction, userExtension } = event.data;
@@ -13483,8 +13507,14 @@ class Softphone {
13483
13507
  case BRIDGE_ON_CARD_CANCELED:
13484
13508
  this.onCardCanceled();
13485
13509
  break;
13486
- case BRIDGE_ON_CALL_ANSWERED:
13487
- this.onCallAnswered();
13510
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
13511
+ this.onCallLocallyAnswered(event.data.call);
13512
+ break;
13513
+ case BRIDGE_ON_CALL_REJECTED:
13514
+ this.onCallRejected(event.data.call);
13515
+ break;
13516
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
13517
+ this.onCallRemotelyAnswered(event.data.call);
13488
13518
  break;
13489
13519
  default:
13490
13520
  this.onUnHandledEvent(event);