@wazo/sdk 0.38.0 → 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.
Files changed (45) hide show
  1. package/README.md +293 -0
  2. package/dist/wazo-sdk.js +5 -5
  3. package/esm/__tests__/web-rtc-client.test.js +1 -1
  4. package/esm/checker/Checker.js +1 -1
  5. package/esm/checker/checks/index.js +1 -1
  6. package/esm/checker/checks/webrtc-transport.js +1 -1
  7. package/esm/checker/checks/webrtc.js +1 -1
  8. package/esm/index.js +267 -25
  9. package/esm/simple/Auth.js +267 -25
  10. package/esm/simple/Configuration.js +267 -25
  11. package/esm/simple/Phone.js +267 -25
  12. package/esm/simple/Softphone.js +266 -24
  13. package/esm/simple/index.js +267 -25
  14. package/esm/simple/room/LocalParticipant.js +267 -25
  15. package/esm/simple/room/Participant.js +267 -25
  16. package/esm/simple/room/RemoteParticipant.js +267 -25
  17. package/esm/simple/room/Room.js +267 -25
  18. package/esm/simple/room/SipRoom.js +267 -25
  19. package/esm/simple/room/Stream.js +267 -25
  20. package/esm/simple/room/__tests__/RemoteParticipant.test.js +267 -25
  21. package/esm/simple/utils.js +267 -25
  22. package/esm/web-rtc-client.js +1 -1
  23. package/lib/__tests__/web-rtc-client.test.js +1 -1
  24. package/lib/checker/Checker.js +1 -1
  25. package/lib/checker/checks/index.js +1 -1
  26. package/lib/checker/checks/webrtc-transport.js +1 -1
  27. package/lib/checker/checks/webrtc.js +1 -1
  28. package/lib/index.js +267 -25
  29. package/lib/simple/Auth.js +267 -25
  30. package/lib/simple/Configuration.js +267 -25
  31. package/lib/simple/Phone.js +267 -25
  32. package/lib/simple/Softphone.js +266 -24
  33. package/lib/simple/index.js +267 -25
  34. package/lib/simple/room/LocalParticipant.js +267 -25
  35. package/lib/simple/room/Participant.js +267 -25
  36. package/lib/simple/room/RemoteParticipant.js +267 -25
  37. package/lib/simple/room/Room.js +267 -25
  38. package/lib/simple/room/SipRoom.js +267 -25
  39. package/lib/simple/room/Stream.js +267 -25
  40. package/lib/simple/room/__tests__/RemoteParticipant.test.js +267 -25
  41. package/lib/simple/utils.js +267 -25
  42. package/lib/web-rtc-client.js +1 -1
  43. package/package.json +1 -1
  44. package/src/simple/Softphone.js +264 -24
  45. package/src/web-rtc-client.js +1 -1
@@ -6953,7 +6953,7 @@ class WebRTCClient extends Emitter {
6953
6953
  }
6954
6954
 
6955
6955
  async _onHeartbeatTimeout() {
6956
- logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
6956
+ logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
6957
6957
 
6958
6958
  if (this.heartbeatTimeoutCb) {
6959
6959
  this.heartbeatTimeoutCb();
@@ -7538,7 +7538,7 @@ class WebRTCClient extends Emitter {
7538
7538
  }
7539
7539
 
7540
7540
  async _onHeartbeatTimeout() {
7541
- logger$1.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7541
+ logger$1.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7542
7542
 
7543
7543
  if (this.heartbeatTimeoutCb) {
7544
7544
  this.heartbeatTimeoutCb();
@@ -7538,7 +7538,7 @@ class WebRTCClient extends Emitter {
7538
7538
  }
7539
7539
 
7540
7540
  async _onHeartbeatTimeout() {
7541
- logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7541
+ logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7542
7542
 
7543
7543
  if (this.heartbeatTimeoutCb) {
7544
7544
  this.heartbeatTimeoutCb();
@@ -6953,7 +6953,7 @@ class WebRTCClient extends Emitter {
6953
6953
  }
6954
6954
 
6955
6955
  async _onHeartbeatTimeout() {
6956
- logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
6956
+ logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
6957
6957
 
6958
6958
  if (this.heartbeatTimeoutCb) {
6959
6959
  this.heartbeatTimeoutCb();
@@ -6953,7 +6953,7 @@ class WebRTCClient extends Emitter {
6953
6953
  }
6954
6954
 
6955
6955
  async _onHeartbeatTimeout() {
6956
- logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
6956
+ logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
6957
6957
 
6958
6958
  if (this.heartbeatTimeoutCb) {
6959
6959
  this.heartbeatTimeoutCb();
package/esm/index.js CHANGED
@@ -7847,7 +7847,7 @@ class WebRTCClient extends Emitter {
7847
7847
  }
7848
7848
 
7849
7849
  async _onHeartbeatTimeout() {
7850
- logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7850
+ logger$9.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7851
7851
 
7852
7852
  if (this.heartbeatTimeoutCb) {
7853
7853
  this.heartbeatTimeoutCb();
@@ -14110,40 +14110,159 @@ const createLocalAudioStream = async (options ) => createLocalStream('aud
14110
14110
  //
14111
14111
  /* eslint-disable no-unused-vars */
14112
14112
  /* global window, document */
14113
+ const BRIDGE_CONFIG_RETRIEVED = 'bridge/CONFIG_RETRIEVED';
14114
+ const BRIDGE_CREATE_OR_UPDATE_CARD = 'bridge/BRIDGE_CREATE_OR_UPDATE_CARD';
14115
+ const BRIDGE_OPTIONS_FETCHED = 'bridge/BRIDGE_OPTIONS_FETCHED';
14116
+ const BRIDGE_OPTIONS_FOUND = 'bridge/BRIDGE_OPTIONS_FOUND';
14117
+ const BRIDGE_SEARCH_OPTIONS = 'bridge/BRIDGE_SEARCH_OPTIONS';
14118
+ const BRIDGE_DISPLAY_LINKED_OPTION = 'bridge/DISPLAY_LINKED_OPTION';
14119
+ const BRIDGE_UPDATE_FORM_SCHEMA = 'bridge/BRIDGE_UPDATE_FORM_SCHEMA';
14120
+ const BRIDGE_WAZO_CONTACT_SEARCH = 'bridge/BRIDGE_WAZO_CONTACT_SEARCH';
14121
+ const BRIDGE_ON_AGENT_LOGGED_IN = 'bridge/BRIDGE_ON_AGENT_LOGGED_IN';
14122
+ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
14123
+ const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
14124
+ const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
14125
+ const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
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';
14129
+ const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
14130
+ const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
14131
+ const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
14132
+ const BRIDGE_ON_CALL_UN_MUTED = 'bridge/BRIDGE_ON_CALL_UN_MUTED';
14133
+ const BRIDGE_ON_DTMF = 'bridge/BRIDGE_ON_DTMF';
14134
+ const BRIDGE_ON_DIRECT_TRANSFER = 'bridge/BRIDGE_ON_DIRECT_TRANSFER';
14135
+ const BRIDGE_ON_CREATE_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CREATE_INDIRECT_TRANSFER';
14136
+ const BRIDGE_ON_CANCEL_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CANCEL_INDIRECT_TRANSFER';
14137
+ const BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER = 'bridge/BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER';
14138
+ const BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE';
14139
+ const BRIDGE_ON_INDIRECT_TRANSFER_DONE = 'bridge/BRIDGE_ON_INDIRECT_TRANSFER_DONE';
14140
+ const BRIDGE_ON_START_RECORDING = 'bridge/BRIDGE_ON_START_RECORDING';
14141
+ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
14142
+ const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
14143
+ const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
14144
+ const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
14145
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
14146
+
14147
+ const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
14148
+ const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
14149
+
14113
14150
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
14114
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
14151
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
14115
14152
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
14116
14153
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
14117
14154
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
14155
+ const SDK_LOGGED_OUT = 'sdk/SDK_LOGGED_OUT';
14118
14156
 
14119
14157
  class Softphone {
14120
- url = 'https://softphone.wazo.io';
14121
- width = 500;
14122
- height = 600;
14123
- displayed = false;
14124
- iframe = null;
14158
+
14159
+
14160
+
14161
+
14162
+
14163
+
14164
+
14165
+ // Message waiting for the iframe to be loaded
14166
+
14125
14167
 
14126
14168
  onLinkEnabled(link ) {}
14169
+ onIFrameLoaded() {}
14127
14170
 
14128
- onCallMade(call ) {}
14171
+ onCallLocallyAnswered(call ) {}
14172
+ onCallRemotelyAnswered(call ) {}
14173
+ onOutgoingCallMade(call ) {}
14129
14174
  onCallIncoming(call ) {}
14175
+ onCallRejected(call ) {}
14130
14176
  onCallEnded(call , card , direction , fromExtension ) {}
14177
+
14178
+ onCardSaved(card ) {}
14179
+ onCardCanceled() {}
14131
14180
  onAuthenticated(session ) {}
14181
+ onLoggedOut() {}
14182
+
14183
+ onSearchOptions(fieldId , query ) {
14184
+ this.onOptionsResults(fieldId, []);
14185
+ }
14186
+
14187
+ onDisplayLinkedOption(optionId ) {}
14188
+ onWazoContactSearch(query ) {}
14189
+ onAgentLoggedIn() {}
14190
+ onAgentLoggedOut() {}
14191
+ onAgentPaused() {}
14192
+ onAgentResumed() {}
14193
+ onLanguageChanged(language ) {}
14194
+ onCallHeld() {}
14195
+ onCallResumed() {}
14196
+ onCallMuted() {}
14197
+ onCallUnMuted() {}
14198
+ onDtmfSent(tone ) {}
14199
+ onDirectTransfer(number ) {}
14200
+ onCreateIndirectTransfer(number ) {}
14201
+ onCancelIndirectTransfer() {}
14202
+ onConfirmIndirectTransfer() {}
14203
+ onIndirectCallMade(call ) {}
14204
+ onIndirectTransferDone(call ) {}
14205
+ onStartRecording() {}
14206
+ onStopRecording() {}
14207
+ onUnHandledEvent(event ) {}
14208
+
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
+ } = {}) {
14221
+ this.url = url || 'https://softphone.wazo.io';
14222
+ this.width = width || 500;
14223
+ this.height = height || 600;
14224
+ this.displayed = false;
14225
+ this.iframeLoaded = false;
14226
+
14227
+ this.iframeLoaded = false;
14228
+ this._pendingMessages = [];
14229
+ window.addEventListener('message', this._onMessage.bind(this), false);
14230
+
14231
+ if (!server) {
14232
+ // eslint-disable-next-line no-param-reassign
14233
+ server = 'stack.dev.wazo.io';
14234
+ }
14132
14235
 
14133
- init(url , width , height ) {
14134
- if (url) {
14135
- this.url = url;
14236
+ const config = { server };
14237
+ if (language) {
14238
+ config.language = language;
14239
+ }
14240
+ if (port) {
14241
+ config.port = port;
14136
14242
  }
14137
- if (width) {
14138
- this.width = width;
14243
+ if (tenantId) {
14244
+ config.tenantId = tenantId;
14139
14245
  }
14140
- if (height) {
14141
- this.height = height;
14246
+ if (wrapUpDuration) {
14247
+ config.wrapUpDuration = wrapUpDuration;
14142
14248
  }
14143
14249
 
14144
- window.addEventListener('message', this._onMessage.bind(this), false);
14250
+ this._sendMessage(BRIDGE_CONFIG_RETRIEVED, { config });
14145
14251
 
14146
- this._createIframe();
14252
+ if (enableAgent) {
14253
+ this._sendMessage(BRIDGE_ENABLE_AGENT);
14254
+ }
14255
+
14256
+ if (debug) {
14257
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
14258
+ }
14259
+
14260
+ this._createIframe(() => {
14261
+ this.iframeLoaded = true;
14262
+ this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
14263
+
14264
+ this.onIFrameLoaded();
14265
+ });
14147
14266
  }
14148
14267
 
14149
14268
  parseLinks() {
@@ -14159,9 +14278,7 @@ class Softphone {
14159
14278
  makeCall(number ) {
14160
14279
  this.displaySoftphone();
14161
14280
 
14162
- if (this.iframe) {
14163
- this.iframe.contentWindow.postMessage({ type: SDK_CLICK_TO_CALL, number }, '*');
14164
- }
14281
+ this._sendMessage(SDK_CLICK_TO_CALL, { number });
14165
14282
  }
14166
14283
 
14167
14284
  toggleSoftphoneDisplay() {
@@ -14170,8 +14287,6 @@ class Softphone {
14170
14287
  } else {
14171
14288
  this.displaySoftphone();
14172
14289
  }
14173
-
14174
- this.displayed = !this.displayed;
14175
14290
  }
14176
14291
 
14177
14292
  displaySoftphone() {
@@ -14182,15 +14297,42 @@ class Softphone {
14182
14297
  if (this.iframe) {
14183
14298
  this.iframe.style.display = 'block';
14184
14299
  }
14300
+
14301
+ this.displayed = true;
14185
14302
  }
14186
14303
 
14187
14304
  hideSoftphone() {
14188
14305
  if (this.iframe) {
14189
14306
  this.iframe.style.display = 'none';
14190
14307
  }
14308
+ this.displayed = false;
14309
+ }
14310
+
14311
+ optionsFetched(fieldId , options ) {
14312
+ this._sendMessage(BRIDGE_OPTIONS_FETCHED, { fieldId, options });
14313
+ }
14314
+
14315
+ onOptionsResults(fieldId , options ) {
14316
+ this._sendMessage(BRIDGE_OPTIONS_FOUND, { fieldId, options });
14317
+ }
14318
+
14319
+ setFormSchema(schema , uiSchema ) {
14320
+ this._sendMessage(BRIDGE_UPDATE_FORM_SCHEMA, { schema, uiSchema });
14321
+ }
14322
+
14323
+ setCardValue(field , value ) {
14324
+ this._sendMessage(BRIDGE_SET_CARD_CONTENT, { field, value });
14325
+ }
14326
+
14327
+ injectCss(css ) {
14328
+ this._sendMessage(BRIDGE_INJECT_CSS, { css });
14191
14329
  }
14192
14330
 
14193
- _createIframe() {
14331
+ customizeAppearance(themes , translations , assets ) {
14332
+ this._sendMessage(BRIDGE_CUSTOMIZE_APPEARANCE, { themes, translations, assets });
14333
+ }
14334
+
14335
+ _createIframe(cb = () => {}) {
14194
14336
  this.iframe = document.createElement('iframe');
14195
14337
  // $FlowFixMe
14196
14338
  this.iframe.width = this.width;
@@ -14202,10 +14344,13 @@ class Softphone {
14202
14344
  this.iframe.style.left = '0';
14203
14345
  this.iframe.style.bottom = '0';
14204
14346
  this.iframe.style.border = '1px solid #aaa';
14347
+ this.iframe.style.backgroundColor = 'white';
14205
14348
  this.iframe.src = this.url;
14206
14349
  this.iframe.style.display = 'none';
14207
14350
  this.iframe.id = 'wazo-softphone';
14208
14351
 
14352
+ this.iframe.onload = cb;
14353
+
14209
14354
  // $FlowFixMe
14210
14355
  document.body.appendChild(this.iframe);
14211
14356
  }
@@ -14232,8 +14377,8 @@ class Softphone {
14232
14377
  }
14233
14378
 
14234
14379
  switch (event.data.type) {
14235
- case SDK_ON_CALL_MADE:
14236
- this.onCallMade(event.data.callSession);
14380
+ case SDK_ON_OUTGOING_CALL_MADE:
14381
+ this.onOutgoingCallMade(event.data.callSession);
14237
14382
  break;
14238
14383
  case SDK_CALL_ENDED: {
14239
14384
  const { callSession, content, direction, userExtension } = event.data;
@@ -14248,8 +14393,105 @@ class Softphone {
14248
14393
  this._onAuthenticated(event.data.session);
14249
14394
  this.onAuthenticated(event.data.session);
14250
14395
  break;
14396
+ case SDK_LOGGED_OUT:
14397
+ this.onLoggedOut();
14398
+ break;
14399
+ case BRIDGE_CREATE_OR_UPDATE_CARD: {
14400
+ const { content } = event.data;
14401
+ this.onCardSaved(content);
14402
+ break;
14403
+ }
14404
+ case BRIDGE_SEARCH_OPTIONS: {
14405
+ const { fieldId, query } = event.data;
14406
+ this.onSearchOptions(fieldId, query);
14407
+ break;
14408
+ }
14409
+ case BRIDGE_DISPLAY_LINKED_OPTION:
14410
+ this.onDisplayLinkedOption(event.data.linkedOptionId);
14411
+ break;
14412
+ case BRIDGE_WAZO_CONTACT_SEARCH:
14413
+ this.onWazoContactSearch(event.data.query);
14414
+ break;
14415
+ case BRIDGE_ON_AGENT_LOGGED_IN:
14416
+ this.onAgentLoggedIn();
14417
+ break;
14418
+ case BRIDGE_ON_AGENT_LOGGED_OUT:
14419
+ this.onAgentLoggedOut();
14420
+ break;
14421
+ case BRIDGE_ON_AGENT_PAUSED:
14422
+ this.onAgentPaused();
14423
+ break;
14424
+ case BRIDGE_ON_AGENT_RESUMED:
14425
+ this.onAgentResumed();
14426
+ break;
14427
+ case BRIDGE_ON_LANGUAGE_CHANGED:
14428
+ this.onLanguageChanged(event.data.language);
14429
+ break;
14430
+ case BRIDGE_ON_CALL_HELD:
14431
+ this.onCallHeld();
14432
+ break;
14433
+ case BRIDGE_ON_CALL_RESUMED:
14434
+ this.onCallResumed();
14435
+ break;
14436
+ case BRIDGE_ON_CALL_MUTED:
14437
+ this.onCallMuted();
14438
+ break;
14439
+ case BRIDGE_ON_CALL_UN_MUTED:
14440
+ this.onCallUnMuted();
14441
+ break;
14442
+ case BRIDGE_ON_DTMF:
14443
+ this.onDtmfSent(event.data.tone);
14444
+ break;
14445
+ case BRIDGE_ON_DIRECT_TRANSFER:
14446
+ this.onDirectTransfer(event.data.number);
14447
+ break;
14448
+ case BRIDGE_ON_CREATE_INDIRECT_TRANSFER:
14449
+ this.onCreateIndirectTransfer(event.data.number);
14450
+ break;
14451
+ case BRIDGE_ON_CANCEL_INDIRECT_TRANSFER:
14452
+ this.onCancelIndirectTransfer();
14453
+ break;
14454
+ case BRIDGE_ON_CONFIRM_INDIRECT_TRANSFER:
14455
+ this.onConfirmIndirectTransfer();
14456
+ break;
14457
+ case BRIDGE_ON_INDIRECT_TRANSFER_CALL_MADE:
14458
+ this.onIndirectCallMade(event.data.call);
14459
+ break;
14460
+ case BRIDGE_ON_INDIRECT_TRANSFER_DONE:
14461
+ this.onIndirectTransferDone(event.data.call);
14462
+ break;
14463
+ case BRIDGE_ON_START_RECORDING:
14464
+ this.onStartRecording();
14465
+ break;
14466
+ case BRIDGE_ON_STOP_RECORDING:
14467
+ this.onStopRecording();
14468
+ break;
14469
+ case BRIDGE_ON_CARD_CANCELED:
14470
+ this.onCardCanceled();
14471
+ break;
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);
14480
+ break;
14481
+ default:
14482
+ this.onUnHandledEvent(event);
14483
+ break;
14251
14484
  }
14252
14485
  }
14486
+
14487
+ _sendMessage(type , payload = {}) {
14488
+ if (!this.iframe || !this.iframeLoaded) {
14489
+ this._pendingMessages.push([type, payload]);
14490
+ return;
14491
+ }
14492
+
14493
+ this.iframe.contentWindow.postMessage({ type, ...payload }, '*');
14494
+ }
14253
14495
  }
14254
14496
 
14255
14497
  var Softphone$1 = new Softphone();