genesys-cloud-streaming-client 16.0.3-develop.57 → 16.0.3-develop.59

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.
@@ -340,7 +340,7 @@ class WebrtcExtension extends events_1.EventEmitter {
340
340
  this.currentMaxStatSize = desiredMaxStatsSize;
341
341
  }
342
342
  catch (err) {
343
- if (err.status === 413) {
343
+ if (err.response.status === 413) {
344
344
  const attemptedPayloadSize = this.currentMaxStatSize;
345
345
  this.currentMaxStatSize -= this.statsSizeDecreaseAmount;
346
346
  this.statsArr = [...statsToSend, ...this.statsArr];
@@ -5,18 +5,18 @@
5
5
  "team": "Genesys Client Media (WebRTC)",
6
6
  "indexFiles": [
7
7
  {
8
- "file": "/v16.0.3/streaming-client.browser.ie.js"
8
+ "file": "v16.0.3/streaming-client.browser.ie.js"
9
9
  },
10
10
  {
11
- "file": "/v16.0.3/streaming-client.browser.js"
11
+ "file": "v16.0.3/streaming-client.browser.js"
12
12
  },
13
13
  {
14
- "file": "/v16/streaming-client.browser.ie.js"
14
+ "file": "v16/streaming-client.browser.ie.js"
15
15
  },
16
16
  {
17
- "file": "/v16/streaming-client.browser.js"
17
+ "file": "v16/streaming-client.browser.js"
18
18
  }
19
19
  ],
20
- "build": "57",
21
- "buildDate": "2023-08-16T14:56:44.293984Z"
20
+ "build": "59",
21
+ "buildDate": "2023-10-18T20:59:01.938108Z"
22
22
  }
@@ -5737,17 +5737,24 @@ var BackOff = /** @class */ (function () {
5737
5737
  return BackOff;
5738
5738
  }());
5739
5739
 
5740
+ function _typeof(o) {
5741
+ "@babel/helpers - typeof";
5742
+
5743
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
5744
+ return typeof o;
5745
+ } : function (o) {
5746
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
5747
+ }, _typeof(o);
5748
+ }
5749
+
5740
5750
  function toInteger(dirtyNumber) {
5741
5751
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
5742
5752
  return NaN;
5743
5753
  }
5744
-
5745
5754
  var number = Number(dirtyNumber);
5746
-
5747
5755
  if (isNaN(number)) {
5748
5756
  return number;
5749
5757
  }
5750
-
5751
5758
  return number < 0 ? Math.ceil(number) : Math.floor(number);
5752
5759
  }
5753
5760
 
@@ -5757,7 +5764,6 @@ function requiredArgs(required, args) {
5757
5764
  }
5758
5765
  }
5759
5766
 
5760
- function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
5761
5767
  /**
5762
5768
  * @name toDate
5763
5769
  * @category Common Helpers
@@ -5788,12 +5794,12 @@ function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "func
5788
5794
  * const result = toDate(1392098430000)
5789
5795
  * //=> Tue Feb 11 2014 11:30:30
5790
5796
  */
5791
-
5792
5797
  function toDate(argument) {
5793
5798
  requiredArgs(1, arguments);
5794
- var argStr = Object.prototype.toString.call(argument); // Clone the date
5799
+ var argStr = Object.prototype.toString.call(argument);
5795
5800
 
5796
- if (argument instanceof Date || _typeof$1(argument) === 'object' && argStr === '[object Date]') {
5801
+ // Clone the date
5802
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
5797
5803
  // Prevent the date to lose the milliseconds when passed to new Date() in IE10
5798
5804
  return new Date(argument.getTime());
5799
5805
  } else if (typeof argument === 'number' || argStr === '[object Number]') {
@@ -5801,11 +5807,10 @@ function toDate(argument) {
5801
5807
  } else {
5802
5808
  if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
5803
5809
  // eslint-disable-next-line no-console
5804
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console
5805
-
5810
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
5811
+ // eslint-disable-next-line no-console
5806
5812
  console.warn(new Error().stack);
5807
5813
  }
5808
-
5809
5814
  return new Date(NaN);
5810
5815
  }
5811
5816
  }
@@ -5828,21 +5833,17 @@ function toDate(argument) {
5828
5833
  * const result = addDays(new Date(2014, 8, 1), 10)
5829
5834
  * //=> Thu Sep 11 2014 00:00:00
5830
5835
  */
5831
-
5832
5836
  function addDays(dirtyDate, dirtyAmount) {
5833
5837
  requiredArgs(2, arguments);
5834
5838
  var date = toDate(dirtyDate);
5835
5839
  var amount = toInteger(dirtyAmount);
5836
-
5837
5840
  if (isNaN(amount)) {
5838
5841
  return new Date(NaN);
5839
5842
  }
5840
-
5841
5843
  if (!amount) {
5842
5844
  // If 0 days, no-op to avoid changing times in the hour before end of DST
5843
5845
  return date;
5844
5846
  }
5845
-
5846
5847
  date.setDate(date.getDate() + amount);
5847
5848
  return date;
5848
5849
  }
@@ -5865,22 +5866,20 @@ function addDays(dirtyDate, dirtyAmount) {
5865
5866
  * const result = addMonths(new Date(2014, 8, 1), 5)
5866
5867
  * //=> Sun Feb 01 2015 00:00:00
5867
5868
  */
5868
-
5869
5869
  function addMonths(dirtyDate, dirtyAmount) {
5870
5870
  requiredArgs(2, arguments);
5871
5871
  var date = toDate(dirtyDate);
5872
5872
  var amount = toInteger(dirtyAmount);
5873
-
5874
5873
  if (isNaN(amount)) {
5875
5874
  return new Date(NaN);
5876
5875
  }
5877
-
5878
5876
  if (!amount) {
5879
5877
  // If 0 months, no-op to avoid changing times in the hour before end of DST
5880
5878
  return date;
5881
5879
  }
5880
+ var dayOfMonth = date.getDate();
5882
5881
 
5883
- var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for
5882
+ // The JS Date object supports date math by accepting out-of-bounds values for
5884
5883
  // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
5885
5884
  // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
5886
5885
  // want except that dates will wrap around the end of a month, meaning that
@@ -5888,11 +5887,9 @@ function addMonths(dirtyDate, dirtyAmount) {
5888
5887
  // we'll default to the end of the desired month by adding 1 to the desired
5889
5888
  // month and using a date of 0 to back up one day to the end of the desired
5890
5889
  // month.
5891
-
5892
5890
  var endOfDesiredMonth = new Date(date.getTime());
5893
5891
  endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
5894
5892
  var daysInMonth = endOfDesiredMonth.getDate();
5895
-
5896
5893
  if (dayOfMonth >= daysInMonth) {
5897
5894
  // If we're already at the end of the month, then this is the correct date
5898
5895
  // and we're done.
@@ -5910,8 +5907,6 @@ function addMonths(dirtyDate, dirtyAmount) {
5910
5907
  }
5911
5908
  }
5912
5909
 
5913
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
5914
-
5915
5910
  /**
5916
5911
  * @name add
5917
5912
  * @category Common Helpers
@@ -5960,13 +5955,16 @@ function add(dirtyDate, duration) {
5960
5955
  var days = duration.days ? toInteger(duration.days) : 0;
5961
5956
  var hours = duration.hours ? toInteger(duration.hours) : 0;
5962
5957
  var minutes = duration.minutes ? toInteger(duration.minutes) : 0;
5963
- var seconds = duration.seconds ? toInteger(duration.seconds) : 0; // Add years and months
5958
+ var seconds = duration.seconds ? toInteger(duration.seconds) : 0;
5964
5959
 
5960
+ // Add years and months
5965
5961
  var date = toDate(dirtyDate);
5966
- var dateWithMonths = months || years ? addMonths(date, months + years * 12) : date; // Add weeks and days
5962
+ var dateWithMonths = months || years ? addMonths(date, months + years * 12) : date;
5967
5963
 
5968
- var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths; // Add days, hours, minutes and seconds
5964
+ // Add weeks and days
5965
+ var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
5969
5966
 
5967
+ // Add days, hours, minutes and seconds
5970
5968
  var minutesToAdd = minutes + hours * 60;
5971
5969
  var secondsToAdd = seconds + minutesToAdd * 60;
5972
5970
  var msToAdd = secondsToAdd * 1000;
@@ -5996,7 +5994,6 @@ function add(dirtyDate, duration) {
5996
5994
  * )
5997
5995
  * //=> 1100
5998
5996
  */
5999
-
6000
5997
  function differenceInMilliseconds(dateLeft, dateRight) {
6001
5998
  requiredArgs(2, arguments);
6002
5999
  return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
@@ -6020,7 +6017,6 @@ function differenceInMilliseconds(dateLeft, dateRight) {
6020
6017
  * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
6021
6018
  * //=> true
6022
6019
  */
6023
-
6024
6020
  function isAfter(dirtyDate, dirtyDateToCompare) {
6025
6021
  requiredArgs(2, arguments);
6026
6022
  var date = toDate(dirtyDate);
@@ -6049,7 +6045,10 @@ const STATUS_CODES_TO_RETRY_LATER = [
6049
6045
  401
6050
6046
  ];
6051
6047
  const logUploaderMap = new Map();
6052
- const getOrCreateLogUploader = (url, debugMode = false) => {
6048
+ const getOrCreateLogUploader = (url, debugMode = false, useUniqueLogUploader) => {
6049
+ if (useUniqueLogUploader) {
6050
+ return new LogUploader(url, debugMode);
6051
+ }
6053
6052
  let uploader = logUploaderMap.get(url);
6054
6053
  /* if we don't have an uploader for this url, create one */
6055
6054
  if (!uploader) {
@@ -6285,7 +6284,7 @@ class ServerLogger {
6285
6284
  }
6286
6285
  this.isInitialized = true;
6287
6286
  this.debounceLogUploadTime = logger.config.uploadDebounceTime || DEFAULT_UPLOAD_DEBOUNCE;
6288
- this.logUploader = getOrCreateLogUploader(logger.config.url, logger.config.debugMode);
6287
+ this.logUploader = getOrCreateLogUploader(logger.config.url, logger.config.debugMode, logger.config.useUniqueLogUploader);
6289
6288
  window.addEventListener('unload', this.sendAllLogsInstantly.bind(this));
6290
6289
  /* when we stop server logging, we need to clear everything out */
6291
6290
  this.logger.on('onStop', (_reason) => {
@@ -6373,6 +6372,7 @@ class ServerLogger {
6373
6372
  this.logBuffer.map((item) => this.logUploader.postLogsToEndpointInstantly(this.convertToRequestParams(item.traces.reverse()), { saveOnFailure: true })));
6374
6373
  }
6375
6374
  sendLogsToServer(immediate = false) {
6375
+ var _a;
6376
6376
  return __awaiter$1(this, void 0, void 0, function* () {
6377
6377
  if (!this.logBuffer.length) {
6378
6378
  /* clear timer */
@@ -6407,10 +6407,13 @@ class ServerLogger {
6407
6407
  this.logger.emit('onError', err);
6408
6408
  this.logger.error('Error sending logs to server', err, { skipServer: true });
6409
6409
  /* no-op: the uploader will attempt reties. if the uploader throws, it means this log isn't going to make to the server */
6410
- const statusCode = `${err === null || err === void 0 ? void 0 : err.status}`;
6411
- if (['401', '404'].includes(statusCode)) {
6410
+ /* TODO: figure out why the error structure changed and determine if this is necessary */
6411
+ const statusCode = (err === null || err === void 0 ? void 0 : err.status)
6412
+ ? err.status
6413
+ : (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.status;
6414
+ if ([401, 404, '401', '404'].includes(statusCode)) {
6412
6415
  this.debug(`received a ${statusCode} from logUploader. stopping logging to server`);
6413
- this.logger.stopServerLogging(statusCode);
6416
+ this.logger.stopServerLogging();
6414
6417
  }
6415
6418
  }
6416
6419
  finally {
@@ -6570,9 +6573,11 @@ class Logger extends EventEmitter {
6570
6573
  setAccessToken(token) {
6571
6574
  this.config.accessToken = token;
6572
6575
  /* if we stopped because of a 401, we will try to start again */
6573
- if (this.stopReason === '401') {
6576
+ /* eslint-disable eqeqeq */
6577
+ if (this.stopReason == 401) {
6574
6578
  this.startServerLogging();
6575
6579
  }
6580
+ /* eslint-enable eqeqeq */
6576
6581
  }
6577
6582
  log(message, details, opts) {
6578
6583
  this.formatMessage('log', message, details, opts);
@@ -6670,7 +6675,7 @@ class Logger extends EventEmitter {
6670
6675
  }
6671
6676
  }
6672
6677
  /* eslint-disable @typescript-eslint/naming-convention */
6673
- Logger.VERSION = '4.2.3';
6678
+ Logger.VERSION = '4.2.5';
6674
6679
 
6675
6680
  /* istanbul ignore file */
6676
6681
  if (!commonjsGlobal) {
@@ -28537,7 +28542,7 @@ class WebrtcExtension extends EventEmitter {
28537
28542
  this.currentMaxStatSize = desiredMaxStatsSize;
28538
28543
  }
28539
28544
  catch (err) {
28540
- if (err.status === 413) {
28545
+ if (err.response.status === 413) {
28541
28546
  const attemptedPayloadSize = this.currentMaxStatSize;
28542
28547
  this.currentMaxStatSize -= this.statsSizeDecreaseAmount;
28543
28548
  this.statsArr = [...statsToSend, ...this.statsArr];
package/dist/es/webrtc.js CHANGED
@@ -350,7 +350,7 @@ export class WebrtcExtension extends EventEmitter {
350
350
  this.currentMaxStatSize = desiredMaxStatsSize;
351
351
  }
352
352
  catch (err) {
353
- if (err.status === 413) {
353
+ if (err.response.status === 413) {
354
354
  const attemptedPayloadSize = this.currentMaxStatSize;
355
355
  this.currentMaxStatSize -= this.statsSizeDecreaseAmount;
356
356
  this.statsArr = [...statsToSend, ...this.statsArr];
@@ -340,7 +340,7 @@ class WebrtcExtension extends events_1.EventEmitter {
340
340
  this.currentMaxStatSize = desiredMaxStatsSize;
341
341
  }
342
342
  catch (err) {
343
- if (err.status === 413) {
343
+ if (err.response.status === 413) {
344
344
  const attemptedPayloadSize = this.currentMaxStatSize;
345
345
  this.currentMaxStatSize -= this.statsSizeDecreaseAmount;
346
346
  this.statsArr = [...statsToSend, ...this.statsArr];