@twilio/conversations 2.1.0-rc.1 → 2.1.0-rc.5

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 (67) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/NOTICE.txt +679 -0
  3. package/builds/browser.js +676 -587
  4. package/builds/browser.js.map +1 -1
  5. package/builds/lib.d.ts +287 -117
  6. package/builds/lib.js +676 -587
  7. package/builds/lib.js.map +1 -1
  8. package/builds/twilio-conversations.js +854 -909
  9. package/builds/twilio-conversations.min.js +2 -14
  10. package/dist/aggregated-delivery-receipt.js +6 -1
  11. package/dist/aggregated-delivery-receipt.js.map +1 -1
  12. package/dist/client.js +165 -142
  13. package/dist/client.js.map +1 -1
  14. package/dist/command-executor.js +16 -14
  15. package/dist/command-executor.js.map +1 -1
  16. package/dist/configuration.js +14 -10
  17. package/dist/configuration.js.map +1 -1
  18. package/dist/conversation.js +212 -153
  19. package/dist/conversation.js.map +1 -1
  20. package/dist/data/conversations.js +81 -77
  21. package/dist/data/conversations.js.map +1 -1
  22. package/dist/data/messages.js +42 -38
  23. package/dist/data/messages.js.map +1 -1
  24. package/dist/data/participants.js +93 -75
  25. package/dist/data/participants.js.map +1 -1
  26. package/dist/data/users.js +24 -22
  27. package/dist/data/users.js.map +1 -1
  28. package/dist/detailed-delivery-receipt.js +1 -1
  29. package/dist/detailed-delivery-receipt.js.map +1 -1
  30. package/dist/interfaces/attributes.js +4 -4
  31. package/dist/interfaces/attributes.js.map +1 -1
  32. package/dist/interfaces/notification-types.js +5 -5
  33. package/dist/interfaces/notification-types.js.map +1 -1
  34. package/dist/logger.js +36 -15
  35. package/dist/logger.js.map +1 -1
  36. package/dist/media.js +21 -9
  37. package/dist/media.js.map +1 -1
  38. package/dist/message-builder.js +10 -9
  39. package/dist/message-builder.js.map +1 -1
  40. package/dist/message.js +130 -81
  41. package/dist/message.js.map +1 -1
  42. package/dist/packages/conversations/package.json.js +1 -1
  43. package/dist/participant.js +85 -51
  44. package/dist/participant.js.map +1 -1
  45. package/dist/push-notification.js.map +1 -1
  46. package/dist/rest-paginator.js +16 -6
  47. package/dist/rest-paginator.js.map +1 -1
  48. package/dist/services/network.js +18 -14
  49. package/dist/services/network.js.map +1 -1
  50. package/dist/services/typing-indicator.js +20 -17
  51. package/dist/services/typing-indicator.js.map +1 -1
  52. package/dist/unsent-message.js.map +1 -1
  53. package/dist/user.js +85 -59
  54. package/dist/user.js.map +1 -1
  55. package/dist/util/deferred.js +3 -1
  56. package/dist/util/deferred.js.map +1 -1
  57. package/dist/util/index.js +6 -6
  58. package/dist/util/index.js.map +1 -1
  59. package/docs/classes/Client.html +24 -30
  60. package/docs/classes/Conversation.html +30 -30
  61. package/docs/classes/DetailedDeliveryReceipt.html +1 -1
  62. package/docs/classes/Message.html +7 -7
  63. package/docs/classes/MessageBuilder.html +2 -2
  64. package/docs/classes/Participant.html +7 -7
  65. package/docs/classes/User.html +7 -7
  66. package/docs/interfaces/CreateConversationOptions.html +1 -1
  67. package/package.json +23 -17
@@ -1730,7 +1730,7 @@ this.Twilio.Conversations = (function (exports) {
1730
1730
  };
1731
1731
  }
1732
1732
 
1733
- function _defineProperties$1(target, props) {
1733
+ function _defineProperties(target, props) {
1734
1734
  for (var i = 0; i < props.length; i++) {
1735
1735
  var descriptor = props[i];
1736
1736
  descriptor.enumerable = descriptor.enumerable || false;
@@ -1741,8 +1741,8 @@ this.Twilio.Conversations = (function (exports) {
1741
1741
  }
1742
1742
 
1743
1743
  function _createClass$3(Constructor, protoProps, staticProps) {
1744
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
1745
- if (staticProps) _defineProperties$1(Constructor, staticProps);
1744
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1745
+ if (staticProps) _defineProperties(Constructor, staticProps);
1746
1746
  return Constructor;
1747
1747
  }
1748
1748
 
@@ -1754,13 +1754,13 @@ this.Twilio.Conversations = (function (exports) {
1754
1754
  return self;
1755
1755
  }
1756
1756
 
1757
- function _setPrototypeOf$1(o, p) {
1758
- _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
1757
+ function _setPrototypeOf(o, p) {
1758
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
1759
1759
  o.__proto__ = p;
1760
1760
  return o;
1761
1761
  };
1762
1762
 
1763
- return _setPrototypeOf$1(o, p);
1763
+ return _setPrototypeOf(o, p);
1764
1764
  }
1765
1765
 
1766
1766
  function _inherits$4(subClass, superClass) {
@@ -1775,27 +1775,27 @@ this.Twilio.Conversations = (function (exports) {
1775
1775
  configurable: true
1776
1776
  }
1777
1777
  });
1778
- if (superClass) _setPrototypeOf$1(subClass, superClass);
1778
+ if (superClass) _setPrototypeOf(subClass, superClass);
1779
1779
  }
1780
1780
 
1781
- function _typeof$4(obj) {
1781
+ function _typeof$3(obj) {
1782
1782
  "@babel/helpers - typeof";
1783
1783
 
1784
1784
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1785
- _typeof$4 = function _typeof(obj) {
1785
+ _typeof$3 = function _typeof(obj) {
1786
1786
  return typeof obj;
1787
1787
  };
1788
1788
  } else {
1789
- _typeof$4 = function _typeof(obj) {
1789
+ _typeof$3 = function _typeof(obj) {
1790
1790
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1791
1791
  };
1792
1792
  }
1793
1793
 
1794
- return _typeof$4(obj);
1794
+ return _typeof$3(obj);
1795
1795
  }
1796
1796
 
1797
1797
  function _possibleConstructorReturn$4(self, call) {
1798
- if (call && (_typeof$4(call) === "object" || typeof call === "function")) {
1798
+ if (call && (_typeof$3(call) === "object" || typeof call === "function")) {
1799
1799
  return call;
1800
1800
  }
1801
1801
 
@@ -3144,7 +3144,7 @@ this.Twilio.Conversations = (function (exports) {
3144
3144
  var result = record.arg;
3145
3145
  var value = result.value;
3146
3146
 
3147
- if (value && _typeof$4(value) === "object" && hasOwn$1.call(value, "__await")) {
3147
+ if (value && _typeof$3(value) === "object" && hasOwn$1.call(value, "__await")) {
3148
3148
  return PromiseImpl.resolve(value.__await).then(function (value) {
3149
3149
  invoke("next", value, resolve, reject);
3150
3150
  }, function (err) {
@@ -3699,13 +3699,13 @@ this.Twilio.Conversations = (function (exports) {
3699
3699
  var c = arguments.length,
3700
3700
  r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
3701
3701
  d;
3702
- if ((typeof Reflect === "undefined" ? "undefined" : _typeof$4(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
3702
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof$3(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
3703
3703
  if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3704
3704
  }
3705
3705
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3706
3706
  }
3707
3707
  function __metadata$1(metadataKey, metadataValue) {
3708
- if ((typeof Reflect === "undefined" ? "undefined" : _typeof$4(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
3708
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof$3(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
3709
3709
  }
3710
3710
 
3711
3711
  var $$n = _export;
@@ -4088,7 +4088,7 @@ this.Twilio.Conversations = (function (exports) {
4088
4088
  var noop = function noop() {};
4089
4089
 
4090
4090
  var undefinedType = "undefined";
4091
- var isIE = (typeof window === "undefined" ? "undefined" : _typeof$4(window)) !== undefinedType && _typeof$4(window.navigator) !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
4091
+ var isIE = (typeof window === "undefined" ? "undefined" : _typeof$3(window)) !== undefinedType && _typeof$3(window.navigator) !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
4092
4092
  var logMethods = ["trace", "debug", "info", "warn", "error"]; // Cross-browser bind equivalent that works at least back to IE6
4093
4093
 
4094
4094
  function bindMethod(obj, methodName) {
@@ -4129,7 +4129,7 @@ this.Twilio.Conversations = (function (exports) {
4129
4129
  methodName = 'log';
4130
4130
  }
4131
4131
 
4132
- if ((typeof console === "undefined" ? "undefined" : _typeof$4(console)) === undefinedType) {
4132
+ if ((typeof console === "undefined" ? "undefined" : _typeof$3(console)) === undefinedType) {
4133
4133
  return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
4134
4134
  } else if (methodName === 'trace' && isIE) {
4135
4135
  return traceForIE;
@@ -4158,7 +4158,7 @@ this.Twilio.Conversations = (function (exports) {
4158
4158
 
4159
4159
  function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
4160
4160
  return function () {
4161
- if ((typeof console === "undefined" ? "undefined" : _typeof$4(console)) !== undefinedType) {
4161
+ if ((typeof console === "undefined" ? "undefined" : _typeof$3(console)) !== undefinedType) {
4162
4162
  replaceLoggingMethods.call(this, level, loggerName);
4163
4163
  this[methodName].apply(this, arguments);
4164
4164
  }
@@ -4179,13 +4179,13 @@ this.Twilio.Conversations = (function (exports) {
4179
4179
 
4180
4180
  if (typeof name === "string") {
4181
4181
  storageKey += ":" + name;
4182
- } else if (_typeof$4(name) === "symbol") {
4182
+ } else if (_typeof$3(name) === "symbol") {
4183
4183
  storageKey = undefined;
4184
4184
  }
4185
4185
 
4186
4186
  function persistLevelIfPossible(levelNum) {
4187
4187
  var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
4188
- if ((typeof window === "undefined" ? "undefined" : _typeof$4(window)) === undefinedType || !storageKey) return; // Use localStorage if available
4188
+ if ((typeof window === "undefined" ? "undefined" : _typeof$3(window)) === undefinedType || !storageKey) return; // Use localStorage if available
4189
4189
 
4190
4190
  try {
4191
4191
  window.localStorage[storageKey] = levelName;
@@ -4200,14 +4200,14 @@ this.Twilio.Conversations = (function (exports) {
4200
4200
 
4201
4201
  function getPersistedLevel() {
4202
4202
  var storedLevel;
4203
- if ((typeof window === "undefined" ? "undefined" : _typeof$4(window)) === undefinedType || !storageKey) return;
4203
+ if ((typeof window === "undefined" ? "undefined" : _typeof$3(window)) === undefinedType || !storageKey) return;
4204
4204
 
4205
4205
  try {
4206
4206
  storedLevel = window.localStorage[storageKey];
4207
4207
  } catch (ignore) {} // Fallback to cookies if local storage gives us nothing
4208
4208
 
4209
4209
 
4210
- if (_typeof$4(storedLevel) === undefinedType) {
4210
+ if (_typeof$3(storedLevel) === undefinedType) {
4211
4211
  try {
4212
4212
  var cookie = window.document.cookie;
4213
4213
  var location = cookie.indexOf(encodeURIComponent(storageKey) + "=");
@@ -4262,7 +4262,7 @@ this.Twilio.Conversations = (function (exports) {
4262
4262
 
4263
4263
  replaceLoggingMethods.call(self, level, name);
4264
4264
 
4265
- if ((typeof console === "undefined" ? "undefined" : _typeof$4(console)) === undefinedType && level < self.levels.SILENT) {
4265
+ if ((typeof console === "undefined" ? "undefined" : _typeof$3(console)) === undefinedType && level < self.levels.SILENT) {
4266
4266
  return "No console available for logging";
4267
4267
  }
4268
4268
  } else {
@@ -4304,7 +4304,7 @@ this.Twilio.Conversations = (function (exports) {
4304
4304
  var _loggersByName = {};
4305
4305
 
4306
4306
  defaultLogger.getLogger = function getLogger(name) {
4307
- if (_typeof$4(name) !== "symbol" && typeof name !== "string" || name === "") {
4307
+ if (_typeof$3(name) !== "symbol" && typeof name !== "string" || name === "") {
4308
4308
  throw new TypeError("You must supply a name when creating a logger.");
4309
4309
  }
4310
4310
 
@@ -4318,10 +4318,10 @@ this.Twilio.Conversations = (function (exports) {
4318
4318
  }; // Grab the current global log variable in case of overwrite
4319
4319
 
4320
4320
 
4321
- var _log = (typeof window === "undefined" ? "undefined" : _typeof$4(window)) !== undefinedType ? window.log : undefined;
4321
+ var _log = (typeof window === "undefined" ? "undefined" : _typeof$3(window)) !== undefinedType ? window.log : undefined;
4322
4322
 
4323
4323
  defaultLogger.noConflict = function () {
4324
- if ((typeof window === "undefined" ? "undefined" : _typeof$4(window)) !== undefinedType && window.log === defaultLogger) {
4324
+ if ((typeof window === "undefined" ? "undefined" : _typeof$3(window)) !== undefinedType && window.log === defaultLogger) {
4325
4325
  window.log = _log;
4326
4326
  }
4327
4327
 
@@ -4342,15 +4342,15 @@ this.Twilio.Conversations = (function (exports) {
4342
4342
  return ["".concat(new Date().toISOString(), " Conversations ").concat(prefix, ":")].concat(Array.from(args));
4343
4343
  }
4344
4344
 
4345
- var log$b = loglevel.exports.getLogger('twilio-conversations'); // twilio-conversations is used by Flex SDK. Please DO NOT change
4345
+ var log$b = loglevel.exports.getLogger("twilio-conversations"); // twilio-conversations is used by Flex SDK. Please DO NOT change
4346
4346
 
4347
4347
  var Logger = /*#__PURE__*/function () {
4348
4348
  function Logger(prefix) {
4349
4349
  _classCallCheck$4(this, Logger);
4350
4350
 
4351
- _defineProperty$3(this, "prefix", '');
4351
+ _defineProperty$3(this, "prefix", "");
4352
4352
 
4353
- this.prefix = prefix !== null && prefix !== undefined && prefix.length > 0 ? prefix + ' ' : '';
4353
+ this.prefix = prefix !== null && prefix !== undefined && prefix.length > 0 ? prefix + " " : "";
4354
4354
  }
4355
4355
 
4356
4356
  _createClass$3(Logger, [{
@@ -4365,7 +4365,7 @@ this.Twilio.Conversations = (function (exports) {
4365
4365
  args[_key] = arguments[_key];
4366
4366
  }
4367
4367
 
4368
- log$b.trace.apply(null, prepareLine$1(this.prefix + 'T', args));
4368
+ log$b.trace.apply(null, prepareLine$1(this.prefix + "T", args));
4369
4369
  }
4370
4370
  }, {
4371
4371
  key: "debug",
@@ -4374,7 +4374,7 @@ this.Twilio.Conversations = (function (exports) {
4374
4374
  args[_key2] = arguments[_key2];
4375
4375
  }
4376
4376
 
4377
- log$b.debug.apply(null, prepareLine$1(this.prefix + 'D', args));
4377
+ log$b.debug.apply(null, prepareLine$1(this.prefix + "D", args));
4378
4378
  }
4379
4379
  }, {
4380
4380
  key: "info",
@@ -4383,7 +4383,7 @@ this.Twilio.Conversations = (function (exports) {
4383
4383
  args[_key3] = arguments[_key3];
4384
4384
  }
4385
4385
 
4386
- log$b.info.apply(null, prepareLine$1(this.prefix + 'I', args));
4386
+ log$b.info.apply(null, prepareLine$1(this.prefix + "I", args));
4387
4387
  }
4388
4388
  }, {
4389
4389
  key: "warn",
@@ -4392,7 +4392,7 @@ this.Twilio.Conversations = (function (exports) {
4392
4392
  args[_key4] = arguments[_key4];
4393
4393
  }
4394
4394
 
4395
- log$b.warn.apply(null, prepareLine$1(this.prefix + 'W', args));
4395
+ log$b.warn.apply(null, prepareLine$1(this.prefix + "W", args));
4396
4396
  }
4397
4397
  }, {
4398
4398
  key: "error",
@@ -4401,7 +4401,7 @@ this.Twilio.Conversations = (function (exports) {
4401
4401
  args[_key5] = arguments[_key5];
4402
4402
  }
4403
4403
 
4404
- log$b.error.apply(null, prepareLine$1(this.prefix + 'E', args));
4404
+ log$b.error.apply(null, prepareLine$1(this.prefix + "E", args));
4405
4405
  }
4406
4406
  }], [{
4407
4407
  key: "scope",
@@ -4420,7 +4420,7 @@ this.Twilio.Conversations = (function (exports) {
4420
4420
  args[_key6] = arguments[_key6];
4421
4421
  }
4422
4422
 
4423
- log$b.trace.apply(null, prepareLine$1('T', args));
4423
+ log$b.trace.apply(null, prepareLine$1("T", args));
4424
4424
  }
4425
4425
  }, {
4426
4426
  key: "debug",
@@ -4429,7 +4429,7 @@ this.Twilio.Conversations = (function (exports) {
4429
4429
  args[_key7] = arguments[_key7];
4430
4430
  }
4431
4431
 
4432
- log$b.debug.apply(null, prepareLine$1('D', args));
4432
+ log$b.debug.apply(null, prepareLine$1("D", args));
4433
4433
  }
4434
4434
  }, {
4435
4435
  key: "info",
@@ -4438,7 +4438,7 @@ this.Twilio.Conversations = (function (exports) {
4438
4438
  args[_key8] = arguments[_key8];
4439
4439
  }
4440
4440
 
4441
- log$b.info.apply(null, prepareLine$1('I', args));
4441
+ log$b.info.apply(null, prepareLine$1("I", args));
4442
4442
  }
4443
4443
  }, {
4444
4444
  key: "warn",
@@ -4447,7 +4447,7 @@ this.Twilio.Conversations = (function (exports) {
4447
4447
  args[_key9] = arguments[_key9];
4448
4448
  }
4449
4449
 
4450
- log$b.warn.apply(null, prepareLine$1('W', args));
4450
+ log$b.warn.apply(null, prepareLine$1("W", args));
4451
4451
  }
4452
4452
  }, {
4453
4453
  key: "error",
@@ -4456,7 +4456,7 @@ this.Twilio.Conversations = (function (exports) {
4456
4456
  args[_key10] = arguments[_key10];
4457
4457
  }
4458
4458
 
4459
- log$b.error.apply(null, prepareLine$1('E', args));
4459
+ log$b.error.apply(null, prepareLine$1("E", args));
4460
4460
  }
4461
4461
  }]);
4462
4462
 
@@ -4556,8 +4556,8 @@ this.Twilio.Conversations = (function (exports) {
4556
4556
 
4557
4557
  function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4558
4558
  var TYPING_TIMEOUT = 5;
4559
- var HTTP_CACHE_LIFETIME = 'PT5S';
4560
- var CONSUMPTION_HORIZON_SENDING_INTERVAL = 'PT5S';
4559
+ var HTTP_CACHE_LIFETIME = "PT5S";
4560
+ var CONSUMPTION_HORIZON_SENDING_INTERVAL = "PT5S";
4561
4561
  var USER_INFOS_TO_SUBSCRIBE = 100;
4562
4562
  var MINIMUM_RETRY_DELAY$1 = 1000;
4563
4563
  var MAXIMUM_RETRY_DELAY$1 = 4000;
@@ -5235,7 +5235,7 @@ this.Twilio.Conversations = (function (exports) {
5235
5235
  }
5236
5236
 
5237
5237
  function parseToNumber(value) {
5238
- if (typeof value !== 'undefined' && !isNaN(Number(value))) {
5238
+ if (typeof value !== "undefined" && !isNaN(Number(value))) {
5239
5239
  return Number(value);
5240
5240
  }
5241
5241
 
@@ -5274,7 +5274,7 @@ this.Twilio.Conversations = (function (exports) {
5274
5274
  function UriBuilder(base) {
5275
5275
  _classCallCheck$4(this, UriBuilder);
5276
5276
 
5277
- this.base = base.replace(/\/$/, '');
5277
+ this.base = base.replace(/\/$/, "");
5278
5278
  this.args = [];
5279
5279
  this.paths = [];
5280
5280
  }
@@ -5282,8 +5282,8 @@ this.Twilio.Conversations = (function (exports) {
5282
5282
  _createClass$3(UriBuilder, [{
5283
5283
  key: "arg",
5284
5284
  value: function arg(name, value) {
5285
- if (typeof value !== 'undefined') {
5286
- this.args.push(encodeURIComponent(name) + '=' + encodeURIComponent(value));
5285
+ if (typeof value !== "undefined") {
5286
+ this.args.push(encodeURIComponent(name) + "=" + encodeURIComponent(value));
5287
5287
  }
5288
5288
 
5289
5289
  return this;
@@ -5300,11 +5300,11 @@ this.Twilio.Conversations = (function (exports) {
5300
5300
  var result = this.base;
5301
5301
 
5302
5302
  if (this.paths.length) {
5303
- result += '/' + this.paths.join('/');
5303
+ result += "/" + this.paths.join("/");
5304
5304
  }
5305
5305
 
5306
5306
  if (this.args.length) {
5307
- result += '?' + this.args.join('&');
5307
+ result += "?" + this.args.join("&");
5308
5308
  }
5309
5309
 
5310
5310
  return result;
@@ -5417,7 +5417,7 @@ this.Twilio.Conversations = (function (exports) {
5417
5417
  // https://tc39.es/ecma262/#sec-symbol.iterator
5418
5418
  defineWellKnownSymbol('iterator');
5419
5419
 
5420
- var _typeof$3 = {exports: {}};
5420
+ var _typeof$2 = {exports: {}};
5421
5421
 
5422
5422
  (function (module) {
5423
5423
  function _typeof(obj) {
@@ -5442,7 +5442,7 @@ this.Twilio.Conversations = (function (exports) {
5442
5442
 
5443
5443
  module.exports = _typeof;
5444
5444
  module.exports["default"] = module.exports, module.exports.__esModule = true;
5445
- }(_typeof$3));
5445
+ }(_typeof$2));
5446
5446
 
5447
5447
  var DESCRIPTORS$7 = descriptors;
5448
5448
  var defineProperty$6 = objectDefineProperty.f;
@@ -5769,7 +5769,7 @@ this.Twilio.Conversations = (function (exports) {
5769
5769
  }(assertThisInitialized));
5770
5770
 
5771
5771
  (function (module) {
5772
- var _typeof = _typeof$3.exports["default"];
5772
+ var _typeof = _typeof$2.exports["default"];
5773
5773
 
5774
5774
  var assertThisInitialized$1 = assertThisInitialized.exports;
5775
5775
 
@@ -5818,7 +5818,7 @@ this.Twilio.Conversations = (function (exports) {
5818
5818
  Object.defineProperty(browser$6, '__esModule', {
5819
5819
  value: true
5820
5820
  });
5821
- var _typeof$2 = _typeof$3.exports;
5821
+ var _typeof$1 = _typeof$2.exports;
5822
5822
  var _slicedToArray$2 = slicedToArray.exports;
5823
5823
  var _toConsumableArray$2 = toConsumableArray.exports;
5824
5824
  var _classCallCheck$3 = classCallCheck.exports;
@@ -5826,25 +5826,25 @@ this.Twilio.Conversations = (function (exports) {
5826
5826
  var _possibleConstructorReturn$3 = possibleConstructorReturn.exports;
5827
5827
  var _getPrototypeOf$3 = getPrototypeOf$2.exports;
5828
5828
 
5829
- function _interopDefaultLegacy$3(e) {
5830
- return e && _typeof$4(e) === 'object' && 'default' in e ? e : {
5829
+ function _interopDefaultLegacy$4(e) {
5830
+ return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
5831
5831
  'default': e
5832
5832
  };
5833
5833
  }
5834
5834
 
5835
- var _typeof__default$1 = /*#__PURE__*/_interopDefaultLegacy$3(_typeof$2);
5835
+ var _typeof__default$1 = /*#__PURE__*/_interopDefaultLegacy$4(_typeof$1);
5836
5836
 
5837
- var _slicedToArray__default$1 = /*#__PURE__*/_interopDefaultLegacy$3(_slicedToArray$2);
5837
+ var _slicedToArray__default$1 = /*#__PURE__*/_interopDefaultLegacy$4(_slicedToArray$2);
5838
5838
 
5839
- var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy$3(_toConsumableArray$2);
5839
+ var _toConsumableArray__default$1 = /*#__PURE__*/_interopDefaultLegacy$4(_toConsumableArray$2);
5840
5840
 
5841
- var _classCallCheck__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_classCallCheck$3);
5841
+ var _classCallCheck__default$3 = /*#__PURE__*/_interopDefaultLegacy$4(_classCallCheck$3);
5842
5842
 
5843
- var _inherits__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_inherits$3);
5843
+ var _inherits__default$3 = /*#__PURE__*/_interopDefaultLegacy$4(_inherits$3);
5844
5844
 
5845
- var _possibleConstructorReturn__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_possibleConstructorReturn$3);
5845
+ var _possibleConstructorReturn__default$3 = /*#__PURE__*/_interopDefaultLegacy$4(_possibleConstructorReturn$3);
5846
5846
 
5847
- var _getPrototypeOf__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_getPrototypeOf$3);
5847
+ var _getPrototypeOf__default$3 = /*#__PURE__*/_interopDefaultLegacy$4(_getPrototypeOf$3);
5848
5848
 
5849
5849
  var custom = function custom() {
5850
5850
  for (var _len = arguments.length, checks = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -6085,18 +6085,18 @@ this.Twilio.Conversations = (function (exports) {
6085
6085
  var hasNativeReflectConstruct = _isNativeReflectConstruct$e();
6086
6086
 
6087
6087
  return function _createSuperInternal() {
6088
- var Super = _getPrototypeOf__default$2['default'](Derived),
6088
+ var Super = _getPrototypeOf__default$3['default'](Derived),
6089
6089
  result;
6090
6090
 
6091
6091
  if (hasNativeReflectConstruct) {
6092
- var NewTarget = _getPrototypeOf__default$2['default'](this).constructor;
6092
+ var NewTarget = _getPrototypeOf__default$3['default'](this).constructor;
6093
6093
 
6094
6094
  result = Reflect.construct(Super, arguments, NewTarget);
6095
6095
  } else {
6096
6096
  result = Super.apply(this, arguments);
6097
6097
  }
6098
6098
 
6099
- return _possibleConstructorReturn__default$2['default'](this, result);
6099
+ return _possibleConstructorReturn__default$3['default'](this, result);
6100
6100
  };
6101
6101
  }
6102
6102
 
@@ -6261,12 +6261,12 @@ this.Twilio.Conversations = (function (exports) {
6261
6261
  var finalRuleSet = convertRuleArguments(args);
6262
6262
  return function (ctor) {
6263
6263
  return /*#__PURE__*/function (_ctor) {
6264
- _inherits__default$2['default'](_class, _ctor);
6264
+ _inherits__default$3['default'](_class, _ctor);
6265
6265
 
6266
6266
  var _super = _createSuper$d(_class);
6267
6267
 
6268
6268
  function _class() {
6269
- _classCallCheck__default$2['default'](this, _class);
6269
+ _classCallCheck__default$3['default'](this, _class);
6270
6270
 
6271
6271
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
6272
6272
  args[_key2] = arguments[_key2];
@@ -6415,7 +6415,7 @@ this.Twilio.Conversations = (function (exports) {
6415
6415
  }
6416
6416
 
6417
6417
  if (typeDescription) {
6418
- expectedTypes = typeof typeDescription === "string" ? [].concat(_toConsumableArray__default['default'](expectedTypes), [typeDescription]) : [].concat(_toConsumableArray__default['default'](expectedTypes), _toConsumableArray__default['default'](typeDescription));
6418
+ expectedTypes = typeof typeDescription === "string" ? [].concat(_toConsumableArray__default$1['default'](expectedTypes), [typeDescription]) : [].concat(_toConsumableArray__default$1['default'](expectedTypes), _toConsumableArray__default$1['default'](typeDescription));
6419
6419
  }
6420
6420
  }
6421
6421
  } catch (err) {
@@ -6470,7 +6470,7 @@ this.Twilio.Conversations = (function (exports) {
6470
6470
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
6471
6471
 
6472
6472
  if (!it) {
6473
- if (Array.isArray(o) || (it = _unsupportedIterableToArray$8(o)) || allowArrayLike && o && typeof o.length === "number") {
6473
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray$7(o)) || allowArrayLike && o && typeof o.length === "number") {
6474
6474
  if (it) o = it;
6475
6475
  var i = 0;
6476
6476
 
@@ -6523,16 +6523,16 @@ this.Twilio.Conversations = (function (exports) {
6523
6523
  };
6524
6524
  }
6525
6525
 
6526
- function _unsupportedIterableToArray$8(o, minLen) {
6526
+ function _unsupportedIterableToArray$7(o, minLen) {
6527
6527
  if (!o) return;
6528
- if (typeof o === "string") return _arrayLikeToArray$8(o, minLen);
6528
+ if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
6529
6529
  var n = Object.prototype.toString.call(o).slice(8, -1);
6530
6530
  if (n === "Object" && o.constructor) n = o.constructor.name;
6531
6531
  if (n === "Map" || n === "Set") return Array.from(o);
6532
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen);
6532
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
6533
6533
  }
6534
6534
 
6535
- function _arrayLikeToArray$8(arr, len) {
6535
+ function _arrayLikeToArray$7(arr, len) {
6536
6536
  if (len == null || len > arr.length) len = arr.length;
6537
6537
 
6538
6538
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -6592,71 +6592,17 @@ this.Twilio.Conversations = (function (exports) {
6592
6592
  var validateTypesAsync_1 = browser$6.validateTypesAsync = validateTypesAsync;
6593
6593
 
6594
6594
  var attributesValidator = custom_1(function (value) {
6595
- return [['string', 'number', 'boolean', 'object'].includes(_typeof$4(value)), 'a JSON type'];
6595
+ return [["string", "number", "boolean", "object"].includes(_typeof$3(value)), "a JSON type"];
6596
6596
  });
6597
6597
  var optionalAttributesValidator = custom_1(function (value) {
6598
- return [['undefined', 'string', 'number', 'boolean', 'object'].includes(_typeof$4(value)), 'an optional JSON type'];
6598
+ return [["undefined", "string", "number", "boolean", "object"].includes(_typeof$3(value)), "an optional JSON type"];
6599
6599
  });
6600
6600
 
6601
6601
  var browser$5 = {};
6602
6602
 
6603
- /*
6604
- @license
6605
- Copyright (c) 2021 Twilio Inc.
6606
-
6607
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6608
-
6609
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6610
-
6611
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6612
-
6613
- */
6614
-
6615
- Object.defineProperty(browser$5, '__esModule', {
6616
- value: true
6617
- });
6618
-
6619
- function _arrayLikeToArray$7(arr, len) {
6620
- if (len == null || len > arr.length) len = arr.length;
6621
-
6622
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
6623
- arr2[i] = arr[i];
6624
- }
6625
-
6626
- return arr2;
6627
- }
6628
-
6629
- function _arrayWithoutHoles$1(arr) {
6630
- if (Array.isArray(arr)) return _arrayLikeToArray$7(arr);
6631
- }
6632
-
6633
- function _iterableToArray$1(iter) {
6634
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6635
- }
6636
-
6637
- function _unsupportedIterableToArray$7(o, minLen) {
6638
- if (!o) return;
6639
- if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
6640
- var n = Object.prototype.toString.call(o).slice(8, -1);
6641
- if (n === "Object" && o.constructor) n = o.constructor.name;
6642
- if (n === "Map" || n === "Set") return Array.from(o);
6643
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
6644
- }
6645
-
6646
- function _nonIterableSpread$1() {
6647
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6648
- }
6649
-
6650
- function _toConsumableArray$1(arr) {
6651
- return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread$1();
6652
- }
6653
-
6654
- function _classCallCheck$2(instance, Constructor) {
6655
- if (!(instance instanceof Constructor)) {
6656
- throw new TypeError("Cannot call a class as a function");
6657
- }
6658
- }
6603
+ var createClass = {exports: {}};
6659
6604
 
6605
+ (function (module) {
6660
6606
  function _defineProperties(target, props) {
6661
6607
  for (var i = 0; i < props.length; i++) {
6662
6608
  var descriptor = props[i];
@@ -6667,43 +6613,46 @@ this.Twilio.Conversations = (function (exports) {
6667
6613
  }
6668
6614
  }
6669
6615
 
6670
- function _createClass$2(Constructor, protoProps, staticProps) {
6616
+ function _createClass(Constructor, protoProps, staticProps) {
6671
6617
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
6672
6618
  if (staticProps) _defineProperties(Constructor, staticProps);
6673
6619
  return Constructor;
6674
6620
  }
6675
6621
 
6676
- function _assertThisInitialized$2(self) {
6677
- if (self === void 0) {
6678
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
6679
- }
6622
+ module.exports = _createClass;
6623
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
6624
+ }(createClass));
6680
6625
 
6681
- return self;
6682
- }
6626
+ var get$1 = {exports: {}};
6683
6627
 
6684
- function _getPrototypeOf$2(o) {
6685
- _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
6686
- return o.__proto__ || Object.getPrototypeOf(o);
6687
- };
6688
- return _getPrototypeOf$2(o);
6689
- }
6628
+ var superPropBase = {exports: {}};
6629
+
6630
+ (function (module) {
6631
+ var getPrototypeOf = getPrototypeOf$2.exports;
6690
6632
 
6691
6633
  function _superPropBase(object, property) {
6692
6634
  while (!Object.prototype.hasOwnProperty.call(object, property)) {
6693
- object = _getPrototypeOf$2(object);
6635
+ object = getPrototypeOf(object);
6694
6636
  if (object === null) break;
6695
6637
  }
6696
6638
 
6697
6639
  return object;
6698
6640
  }
6699
6641
 
6700
- function _get$1(target, property, receiver) {
6642
+ module.exports = _superPropBase;
6643
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
6644
+ }(superPropBase));
6645
+
6646
+ (function (module) {
6647
+ var superPropBase$1 = superPropBase.exports;
6648
+
6649
+ function _get(target, property, receiver) {
6701
6650
  if (typeof Reflect !== "undefined" && Reflect.get) {
6702
- _get$1 = Reflect.get;
6651
+ module.exports = _get = Reflect.get;
6652
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
6703
6653
  } else {
6704
- _get$1 = function _get(target, property, receiver) {
6705
- var base = _superPropBase(target, property);
6706
-
6654
+ module.exports = _get = function _get(target, property, receiver) {
6655
+ var base = superPropBase$1(target, property);
6707
6656
  if (!base) return;
6708
6657
  var desc = Object.getOwnPropertyDescriptor(base, property);
6709
6658
 
@@ -6713,60 +6662,21 @@ this.Twilio.Conversations = (function (exports) {
6713
6662
 
6714
6663
  return desc.value;
6715
6664
  };
6716
- }
6717
6665
 
6718
- return _get$1(target, property, receiver || target);
6719
- }
6720
-
6721
- function _setPrototypeOf(o, p) {
6722
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
6723
- o.__proto__ = p;
6724
- return o;
6725
- };
6726
-
6727
- return _setPrototypeOf(o, p);
6728
- }
6729
-
6730
- function _inherits$2(subClass, superClass) {
6731
- if (typeof superClass !== "function" && superClass !== null) {
6732
- throw new TypeError("Super expression must either be null or a function");
6666
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
6733
6667
  }
6734
6668
 
6735
- subClass.prototype = Object.create(superClass && superClass.prototype, {
6736
- constructor: {
6737
- value: subClass,
6738
- writable: true,
6739
- configurable: true
6740
- }
6741
- });
6742
- if (superClass) _setPrototypeOf(subClass, superClass);
6669
+ return _get(target, property, receiver || target);
6743
6670
  }
6744
6671
 
6745
- function _typeof$1(obj) {
6746
- "@babel/helpers - typeof";
6747
-
6748
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
6749
- _typeof$1 = function _typeof(obj) {
6750
- return typeof obj;
6751
- };
6752
- } else {
6753
- _typeof$1 = function _typeof(obj) {
6754
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
6755
- };
6756
- }
6757
-
6758
- return _typeof$1(obj);
6759
- }
6672
+ module.exports = _get;
6673
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
6674
+ }(get$1));
6760
6675
 
6761
- function _possibleConstructorReturn$2(self, call) {
6762
- if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
6763
- return call;
6764
- }
6676
+ var defineProperty$5 = {exports: {}};
6765
6677
 
6766
- return _assertThisInitialized$2(self);
6767
- }
6768
-
6769
- function _defineProperty$2(obj, key, value) {
6678
+ (function (module) {
6679
+ function _defineProperty(obj, key, value) {
6770
6680
  if (key in obj) {
6771
6681
  Object.defineProperty(obj, key, {
6772
6682
  value: value,
@@ -6781,6 +6691,47 @@ this.Twilio.Conversations = (function (exports) {
6781
6691
  return obj;
6782
6692
  }
6783
6693
 
6694
+ module.exports = _defineProperty;
6695
+ module.exports["default"] = module.exports, module.exports.__esModule = true;
6696
+ }(defineProperty$5));
6697
+
6698
+ Object.defineProperty(browser$5, '__esModule', {
6699
+ value: true
6700
+ });
6701
+ var _toConsumableArray$1 = toConsumableArray.exports;
6702
+ var _classCallCheck$2 = classCallCheck.exports;
6703
+ var _createClass$2 = createClass.exports;
6704
+ var _assertThisInitialized$2 = assertThisInitialized.exports;
6705
+ var _get$1 = get$1.exports;
6706
+ var _inherits$2 = inherits.exports;
6707
+ var _possibleConstructorReturn$2 = possibleConstructorReturn.exports;
6708
+ var _getPrototypeOf$2 = getPrototypeOf$2.exports;
6709
+ var _defineProperty$2 = defineProperty$5.exports;
6710
+
6711
+ function _interopDefaultLegacy$3(e) {
6712
+ return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
6713
+ 'default': e
6714
+ };
6715
+ }
6716
+
6717
+ var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy$3(_toConsumableArray$1);
6718
+
6719
+ var _classCallCheck__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_classCallCheck$2);
6720
+
6721
+ var _createClass__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_createClass$2);
6722
+
6723
+ var _assertThisInitialized__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_assertThisInitialized$2);
6724
+
6725
+ var _get__default$1 = /*#__PURE__*/_interopDefaultLegacy$3(_get$1);
6726
+
6727
+ var _inherits__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_inherits$2);
6728
+
6729
+ var _possibleConstructorReturn__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_possibleConstructorReturn$2);
6730
+
6731
+ var _getPrototypeOf__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_getPrototypeOf$2);
6732
+
6733
+ var _defineProperty__default$2 = /*#__PURE__*/_interopDefaultLegacy$3(_defineProperty$2);
6734
+
6784
6735
  var domain$2; // This constructor is used to store event handlers. Instantiating this is
6785
6736
  // faster than explicitly calling `Object.create(null)` to get a "clean" empty
6786
6737
  // object (tested with v8 v4.9).
@@ -7235,18 +7186,18 @@ this.Twilio.Conversations = (function (exports) {
7235
7186
  var hasNativeReflectConstruct = _isNativeReflectConstruct$d();
7236
7187
 
7237
7188
  return function _createSuperInternal() {
7238
- var Super = _getPrototypeOf$2(Derived),
7189
+ var Super = _getPrototypeOf__default$2['default'](Derived),
7239
7190
  result;
7240
7191
 
7241
7192
  if (hasNativeReflectConstruct) {
7242
- var NewTarget = _getPrototypeOf$2(this).constructor;
7193
+ var NewTarget = _getPrototypeOf__default$2['default'](this).constructor;
7243
7194
 
7244
7195
  result = Reflect.construct(Super, arguments, NewTarget);
7245
7196
  } else {
7246
7197
  result = Super.apply(this, arguments);
7247
7198
  }
7248
7199
 
7249
- return _possibleConstructorReturn$2(this, result);
7200
+ return _possibleConstructorReturn__default$2['default'](this, result);
7250
7201
  };
7251
7202
  }
7252
7203
 
@@ -7264,36 +7215,36 @@ this.Twilio.Conversations = (function (exports) {
7264
7215
  }
7265
7216
 
7266
7217
  var ReplayEventEmitter = /*#__PURE__*/function (_EventEmitter) {
7267
- _inherits$2(ReplayEventEmitter, _EventEmitter);
7218
+ _inherits__default$2['default'](ReplayEventEmitter, _EventEmitter);
7268
7219
 
7269
7220
  var _super = _createSuper$c(ReplayEventEmitter);
7270
7221
 
7271
7222
  function ReplayEventEmitter() {
7272
7223
  var _this;
7273
7224
 
7274
- _classCallCheck$2(this, ReplayEventEmitter);
7225
+ _classCallCheck__default$2['default'](this, ReplayEventEmitter);
7275
7226
 
7276
7227
  _this = _super.call(this);
7277
7228
 
7278
- _defineProperty$2(_assertThisInitialized$2(_this), "eventHistory", new Map());
7229
+ _defineProperty__default$2['default'](_assertThisInitialized__default$2['default'](_this), "eventHistory", new Map());
7279
7230
 
7280
7231
  return _this;
7281
7232
  }
7282
7233
 
7283
- _createClass$2(ReplayEventEmitter, [{
7234
+ _createClass__default$2['default'](ReplayEventEmitter, [{
7284
7235
  key: "on",
7285
7236
  value: function on(event, listener) {
7286
- return _get$1(_getPrototypeOf$2(ReplayEventEmitter.prototype), "on", this).call(this, event, listener);
7237
+ return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "on", this).call(this, event, listener);
7287
7238
  }
7288
7239
  }, {
7289
7240
  key: "once",
7290
7241
  value: function once(event, listener) {
7291
- return _get$1(_getPrototypeOf$2(ReplayEventEmitter.prototype), "once", this).call(this, event, listener);
7242
+ return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "once", this).call(this, event, listener);
7292
7243
  }
7293
7244
  }, {
7294
7245
  key: "off",
7295
7246
  value: function off(event, listener) {
7296
- return _get$1(_getPrototypeOf$2(ReplayEventEmitter.prototype), "off", this).call(this, event, listener);
7247
+ return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "off", this).call(this, event, listener);
7297
7248
  }
7298
7249
  }, {
7299
7250
  key: "emit",
@@ -7305,17 +7256,17 @@ this.Twilio.Conversations = (function (exports) {
7305
7256
  }
7306
7257
 
7307
7258
  this.eventHistory.set(event, args);
7308
- return (_get2 = _get$1(_getPrototypeOf$2(ReplayEventEmitter.prototype), "emit", this)).call.apply(_get2, [this, event].concat(args));
7259
+ return (_get2 = _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "emit", this)).call.apply(_get2, [this, event].concat(args));
7309
7260
  }
7310
7261
  }, {
7311
7262
  key: "addListener",
7312
7263
  value: function addListener(event, listener) {
7313
- return _get$1(_getPrototypeOf$2(ReplayEventEmitter.prototype), "addListener", this).call(this, event, listener);
7264
+ return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "addListener", this).call(this, event, listener);
7314
7265
  }
7315
7266
  }, {
7316
7267
  key: "removeListener",
7317
7268
  value: function removeListener(event, listener) {
7318
- return _get$1(_getPrototypeOf$2(ReplayEventEmitter.prototype), "removeListener", this).call(this, event, listener);
7269
+ return _get__default$1['default'](_getPrototypeOf__default$2['default'](ReplayEventEmitter.prototype), "removeListener", this).call(this, event, listener);
7319
7270
  }
7320
7271
  }, {
7321
7272
  key: "addListenerWithReplay",
@@ -7323,7 +7274,7 @@ this.Twilio.Conversations = (function (exports) {
7323
7274
  var historyEntry = this.eventHistory.get(event);
7324
7275
 
7325
7276
  if (historyEntry !== undefined) {
7326
- listener.apply(void 0, _toConsumableArray$1(historyEntry));
7277
+ listener.apply(void 0, _toConsumableArray__default['default'](historyEntry));
7327
7278
  }
7328
7279
 
7329
7280
  return this.addListener(event, listener);
@@ -7407,10 +7358,10 @@ this.Twilio.Conversations = (function (exports) {
7407
7358
  typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
7408
7359
  /** Detect free variable `global` from Node.js. */
7409
7360
 
7410
- var freeGlobal = _typeof$4(commonjsGlobal) == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
7361
+ var freeGlobal = _typeof$3(commonjsGlobal) == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
7411
7362
  /** Detect free variable `self`. */
7412
7363
 
7413
- var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof$4(self)) == 'object' && self && self.Object === Object && self;
7364
+ var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof$3(self)) == 'object' && self && self.Object === Object && self;
7414
7365
  /** Used as a reference to the global object. */
7415
7366
 
7416
7367
  var root = freeGlobal || freeSelf || Function('return this')();
@@ -8808,7 +8759,7 @@ this.Twilio.Conversations = (function (exports) {
8808
8759
 
8809
8760
 
8810
8761
  function isKeyable(value) {
8811
- var type = _typeof$4(value);
8762
+ var type = _typeof$3(value);
8812
8763
 
8813
8764
  return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
8814
8765
  }
@@ -9128,7 +9079,7 @@ this.Twilio.Conversations = (function (exports) {
9128
9079
 
9129
9080
 
9130
9081
  function isObject(value) {
9131
- var type = _typeof$4(value);
9082
+ var type = _typeof$3(value);
9132
9083
 
9133
9084
  return value != null && (type == 'object' || type == 'function');
9134
9085
  }
@@ -9159,7 +9110,7 @@ this.Twilio.Conversations = (function (exports) {
9159
9110
 
9160
9111
 
9161
9112
  function isObjectLike(value) {
9162
- return value != null && _typeof$4(value) == 'object';
9113
+ return value != null && _typeof$3(value) == 'object';
9163
9114
  }
9164
9115
  /**
9165
9116
  * Checks if `value` is classified as a typed array.
@@ -9263,7 +9214,7 @@ this.Twilio.Conversations = (function (exports) {
9263
9214
  function _createSuper$b(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$c(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
9264
9215
 
9265
9216
  function _isNativeReflectConstruct$c() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
9266
- var log$a = Logger.scope('User');
9217
+ var log$a = Logger.scope("User");
9267
9218
  /**
9268
9219
  * Extended user information.
9269
9220
  * Note that `isOnline` and `isNotifiable` properties are eligible
@@ -9288,14 +9239,14 @@ this.Twilio.Conversations = (function (exports) {
9288
9239
 
9289
9240
  _defineProperty$3(_assertThisInitialized$3(_this), "promiseToFetch", null);
9290
9241
 
9291
- _defineProperty$3(_assertThisInitialized$3(_this), "updated", 'updated');
9242
+ _defineProperty$3(_assertThisInitialized$3(_this), "updated", "updated");
9292
9243
 
9293
- _defineProperty$3(_assertThisInitialized$3(_this), "userSubscribed", 'userSubscribed');
9244
+ _defineProperty$3(_assertThisInitialized$3(_this), "userSubscribed", "userSubscribed");
9294
9245
 
9295
- _defineProperty$3(_assertThisInitialized$3(_this), "userUnsubscribed", 'userUnsubscribed');
9246
+ _defineProperty$3(_assertThisInitialized$3(_this), "userUnsubscribed", "userUnsubscribed");
9296
9247
 
9297
9248
  _this.services = services;
9298
- _this.subscribed = 'initializing';
9249
+ _this.subscribed = "initializing";
9299
9250
 
9300
9251
  _this.setMaxListeners(0);
9301
9252
 
@@ -9388,7 +9339,7 @@ this.Twilio.Conversations = (function (exports) {
9388
9339
  }, {
9389
9340
  key: "isSubscribed",
9390
9341
  get: function get() {
9391
- return this.subscribed == 'subscribed';
9342
+ return this.subscribed == "subscribed";
9392
9343
  } // Handles service updates
9393
9344
 
9394
9345
  }, {
@@ -9405,14 +9356,14 @@ this.Twilio.Conversations = (function (exports) {
9405
9356
 
9406
9357
  case 2:
9407
9358
  updateReasons = [];
9408
- log$a.debug('User for', this.state.identity, 'updated:', key, value);
9359
+ log$a.debug("User for", this.state.identity, "updated:", key, value);
9409
9360
  _context.t0 = key;
9410
- _context.next = _context.t0 === 'friendlyName' ? 7 : _context.t0 === 'attributes' ? 9 : _context.t0 === 'reachability' ? 12 : 15;
9361
+ _context.next = _context.t0 === "friendlyName" ? 7 : _context.t0 === "attributes" ? 9 : _context.t0 === "reachability" ? 12 : 15;
9411
9362
  break;
9412
9363
 
9413
9364
  case 7:
9414
9365
  if (this.state.friendlyName !== value.value) {
9415
- updateReasons.push('friendlyName');
9366
+ updateReasons.push("friendlyName");
9416
9367
  this.state.friendlyName = value.value;
9417
9368
  }
9418
9369
 
@@ -9423,7 +9374,7 @@ this.Twilio.Conversations = (function (exports) {
9423
9374
 
9424
9375
  if (!isEqual(this.state.attributes, updateAttributes)) {
9425
9376
  this.state.attributes = updateAttributes;
9426
- updateReasons.push('attributes');
9377
+ updateReasons.push("attributes");
9427
9378
  }
9428
9379
 
9429
9380
  return _context.abrupt("break", 16);
@@ -9431,12 +9382,12 @@ this.Twilio.Conversations = (function (exports) {
9431
9382
  case 12:
9432
9383
  if (this.state.online !== value.online) {
9433
9384
  this.state.online = value.online;
9434
- updateReasons.push('reachabilityOnline');
9385
+ updateReasons.push("reachabilityOnline");
9435
9386
  }
9436
9387
 
9437
9388
  if (this.state.notifiable !== value.notifiable) {
9438
9389
  this.state.notifiable = value.notifiable;
9439
- updateReasons.push('reachabilityNotifiable');
9390
+ updateReasons.push("reachabilityNotifiable");
9440
9391
  }
9441
9392
 
9442
9393
  return _context.abrupt("break", 16);
@@ -9446,7 +9397,7 @@ this.Twilio.Conversations = (function (exports) {
9446
9397
 
9447
9398
  case 16:
9448
9399
  if (updateReasons.length > 0) {
9449
- this.emit('updated', {
9400
+ this.emit("updated", {
9450
9401
  user: this,
9451
9402
  updateReasons: updateReasons
9452
9403
  });
@@ -9489,8 +9440,8 @@ this.Twilio.Conversations = (function (exports) {
9489
9440
  return _context2.abrupt("return", Promise.resolve());
9490
9441
 
9491
9442
  case 4:
9492
- return _context2.abrupt("return", map.get('reachability').then(update).catch(function (err) {
9493
- log$a.warn('Failed to get reachability info for ', _this2.state.identity, err);
9443
+ return _context2.abrupt("return", map.get("reachability").then(update).catch(function (err) {
9444
+ log$a.warn("Failed to get reachability info for ", _this2.state.identity, err);
9494
9445
  }));
9495
9446
 
9496
9447
  case 5:
@@ -9532,26 +9483,26 @@ this.Twilio.Conversations = (function (exports) {
9532
9483
  case 4:
9533
9484
  this.promiseToFetch = this.services.syncClient.map({
9534
9485
  id: this.state.entityName,
9535
- mode: 'open_existing',
9486
+ mode: "open_existing",
9536
9487
  includeItems: true
9537
9488
  }).then(function (map) {
9538
9489
  _this3.entity = map;
9539
- map.on('itemUpdated', function (args) {
9540
- log$a.debug(_this3.state.entityName + ' (' + _this3.state.identity + ') itemUpdated: ' + args.item.key);
9490
+ map.on("itemUpdated", function (args) {
9491
+ log$a.debug(_this3.state.entityName + " (" + _this3.state.identity + ") itemUpdated: " + args.item.key);
9541
9492
  return _this3._update(args.item.key, args.item.data);
9542
9493
  });
9543
- return Promise.all([map.get('friendlyName').then(function (item) {
9494
+ return Promise.all([map.get("friendlyName").then(function (item) {
9544
9495
  return _this3._update(item.key, item.data);
9545
- }), map.get('attributes').then(function (item) {
9496
+ }), map.get("attributes").then(function (item) {
9546
9497
  return _this3._update(item.key, item.data);
9547
9498
  }), _this3._updateReachabilityInfo(map, function (item) {
9548
9499
  return _this3._update(item.key, item.data);
9549
9500
  })]);
9550
9501
  }).then(function () {
9551
- log$a.debug('Fetched for', _this3.identity);
9552
- _this3.subscribed = 'subscribed';
9502
+ log$a.debug("Fetched for", _this3.identity);
9503
+ _this3.subscribed = "subscribed";
9553
9504
 
9554
- _this3.emit('userSubscribed', _this3);
9505
+ _this3.emit("userSubscribed", _this3);
9555
9506
 
9556
9507
  return _this3;
9557
9508
  }).catch(function (err) {
@@ -9619,16 +9570,16 @@ this.Twilio.Conversations = (function (exports) {
9619
9570
  return this._initializationPromise;
9620
9571
 
9621
9572
  case 2:
9622
- if (!(this.subscribed == 'unsubscribed')) {
9573
+ if (!(this.subscribed == "unsubscribed")) {
9623
9574
  _context5.next = 4;
9624
9575
  break;
9625
9576
  }
9626
9577
 
9627
- throw new Error('Can\'t modify unsubscribed object');
9578
+ throw new Error("Can't modify unsubscribed object");
9628
9579
 
9629
9580
  case 4:
9630
9581
  _context5.next = 6;
9631
- return this.services.commandExecutor.mutateResource('post', this.links.self, {
9582
+ return this.services.commandExecutor.mutateResource("post", this.links.self, {
9632
9583
  attributes: JSON.stringify(attributes)
9633
9584
  });
9634
9585
 
@@ -9666,16 +9617,16 @@ this.Twilio.Conversations = (function (exports) {
9666
9617
  return this._initializationPromise;
9667
9618
 
9668
9619
  case 2:
9669
- if (!(this.subscribed == 'unsubscribed')) {
9620
+ if (!(this.subscribed == "unsubscribed")) {
9670
9621
  _context6.next = 4;
9671
9622
  break;
9672
9623
  }
9673
9624
 
9674
- throw new Error('Can\'t modify unsubscribed object');
9625
+ throw new Error("Can't modify unsubscribed object");
9675
9626
 
9676
9627
  case 4:
9677
9628
  _context6.next = 6;
9678
- return this.services.commandExecutor.mutateResource('post', this.links.self, {
9629
+ return this.services.commandExecutor.mutateResource("post", this.links.self, {
9679
9630
  friendly_name: friendlyName
9680
9631
  });
9681
9632
 
@@ -9724,8 +9675,8 @@ this.Twilio.Conversations = (function (exports) {
9724
9675
  case 5:
9725
9676
  this.entity.close();
9726
9677
  this.promiseToFetch = null;
9727
- this.subscribed = 'unsubscribed';
9728
- this.emit('userUnsubscribed', this);
9678
+ this.subscribed = "unsubscribed";
9679
+ this.emit("userUnsubscribed", this);
9729
9680
 
9730
9681
  case 9:
9731
9682
  case "end":
@@ -9754,9 +9705,9 @@ this.Twilio.Conversations = (function (exports) {
9754
9705
  this._resolveInitializationPromise();
9755
9706
 
9756
9707
  if (emitUpdated) {
9757
- this.emit('updated', {
9708
+ this.emit("updated", {
9758
9709
  user: this,
9759
- updateReasons: ['friendlyName', 'attributes', 'reachabilityOnline', 'reachabilityNotifiable']
9710
+ updateReasons: ["friendlyName", "attributes", "reachabilityOnline", "reachabilityNotifiable"]
9760
9711
  });
9761
9712
  }
9762
9713
  }
@@ -9767,7 +9718,7 @@ this.Twilio.Conversations = (function (exports) {
9767
9718
 
9768
9719
  __decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], User.prototype, "updateAttributes", null);
9769
9720
 
9770
- __decorate$1([validateTypesAsync_1(['string']), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
9721
+ __decorate$1([validateTypesAsync_1(["string"]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], User.prototype, "updateFriendlyName", null);
9771
9722
 
9772
9723
  function _arrayWithHoles(arr) {
9773
9724
  if (Array.isArray(arr)) return arr;
@@ -9843,7 +9794,7 @@ this.Twilio.Conversations = (function (exports) {
9843
9794
  var hiddenKeys = hiddenKeys$6;
9844
9795
  var isObject$5 = isObject$n;
9845
9796
  var has$3 = has$g;
9846
- var defineProperty$5 = objectDefineProperty.f;
9797
+ var defineProperty$4 = objectDefineProperty.f;
9847
9798
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
9848
9799
  var getOwnPropertyNamesExternalModule = objectGetOwnPropertyNamesExternal;
9849
9800
  var uid$1 = uid$5;
@@ -9859,7 +9810,7 @@ this.Twilio.Conversations = (function (exports) {
9859
9810
  };
9860
9811
 
9861
9812
  var setMetadata = function (it) {
9862
- defineProperty$5(it, METADATA, { value: {
9813
+ defineProperty$4(it, METADATA, { value: {
9863
9814
  objectID: 'O' + id++, // object ID
9864
9815
  weakData: {} // weak collections IDs
9865
9816
  } });
@@ -10035,7 +9986,7 @@ this.Twilio.Conversations = (function (exports) {
10035
9986
  return Constructor;
10036
9987
  };
10037
9988
 
10038
- var defineProperty$4 = objectDefineProperty.f;
9989
+ var defineProperty$3 = objectDefineProperty.f;
10039
9990
  var create$2 = objectCreate;
10040
9991
  var redefineAll$2 = redefineAll$4;
10041
9992
  var bind$2 = functionBindContext;
@@ -10184,7 +10135,7 @@ this.Twilio.Conversations = (function (exports) {
10184
10135
  return define(this, value = value === 0 ? 0 : value, value);
10185
10136
  }
10186
10137
  });
10187
- if (DESCRIPTORS$5) defineProperty$4(C.prototype, 'size', {
10138
+ if (DESCRIPTORS$5) defineProperty$3(C.prototype, 'size', {
10188
10139
  get: function () {
10189
10140
  return getInternalState(this).size;
10190
10141
  }
@@ -10248,51 +10199,6 @@ this.Twilio.Conversations = (function (exports) {
10248
10199
 
10249
10200
  var browser$4 = {};
10250
10201
 
10251
- var createClass = {exports: {}};
10252
-
10253
- (function (module) {
10254
- function _defineProperties(target, props) {
10255
- for (var i = 0; i < props.length; i++) {
10256
- var descriptor = props[i];
10257
- descriptor.enumerable = descriptor.enumerable || false;
10258
- descriptor.configurable = true;
10259
- if ("value" in descriptor) descriptor.writable = true;
10260
- Object.defineProperty(target, descriptor.key, descriptor);
10261
- }
10262
- }
10263
-
10264
- function _createClass(Constructor, protoProps, staticProps) {
10265
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
10266
- if (staticProps) _defineProperties(Constructor, staticProps);
10267
- return Constructor;
10268
- }
10269
-
10270
- module.exports = _createClass;
10271
- module.exports["default"] = module.exports, module.exports.__esModule = true;
10272
- }(createClass));
10273
-
10274
- var defineProperty$3 = {exports: {}};
10275
-
10276
- (function (module) {
10277
- function _defineProperty(obj, key, value) {
10278
- if (key in obj) {
10279
- Object.defineProperty(obj, key, {
10280
- value: value,
10281
- enumerable: true,
10282
- configurable: true,
10283
- writable: true
10284
- });
10285
- } else {
10286
- obj[key] = value;
10287
- }
10288
-
10289
- return obj;
10290
- }
10291
-
10292
- module.exports = _defineProperty;
10293
- module.exports["default"] = module.exports, module.exports.__esModule = true;
10294
- }(defineProperty$3));
10295
-
10296
10202
  Object.defineProperty(browser$4, '__esModule', {
10297
10203
  value: true
10298
10204
  });
@@ -10302,10 +10208,10 @@ this.Twilio.Conversations = (function (exports) {
10302
10208
  var _inherits$1 = inherits.exports;
10303
10209
  var _possibleConstructorReturn$1 = possibleConstructorReturn.exports;
10304
10210
  var _getPrototypeOf$1 = getPrototypeOf$2.exports;
10305
- var _defineProperty$1 = defineProperty$3.exports;
10211
+ var _defineProperty$1 = defineProperty$5.exports;
10306
10212
 
10307
10213
  function _interopDefaultLegacy$2(e) {
10308
- return e && _typeof$4(e) === 'object' && 'default' in e ? e : {
10214
+ return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
10309
10215
  'default': e
10310
10216
  };
10311
10217
  }
@@ -11274,13 +11180,13 @@ this.Twilio.Conversations = (function (exports) {
11274
11180
  }
11275
11181
 
11276
11182
  var retrier = new Retrier_1(_this2.configuration.backoffConfiguration);
11277
- retrier.on('attempt', function () {
11183
+ retrier.on("attempt", function () {
11278
11184
  request().then(function (result) {
11279
11185
  return retrier.succeeded(result);
11280
11186
  }).catch(function (err) {
11281
11187
  if (codesToRetryOn.indexOf(err.status) > -1) {
11282
11188
  retrier.failed(err);
11283
- } else if (err.message === 'Twilsock disconnected') {
11189
+ } else if (err.message === "Twilsock disconnected") {
11284
11190
  // Ugly hack. We must make a proper exceptions for twilsock
11285
11191
  retrier.failed(err);
11286
11192
  } else {
@@ -11291,13 +11197,13 @@ this.Twilio.Conversations = (function (exports) {
11291
11197
  }
11292
11198
  });
11293
11199
  });
11294
- retrier.on('succeeded', function (result) {
11200
+ retrier.on("succeeded", function (result) {
11295
11201
  resolve(result);
11296
11202
  });
11297
- retrier.on('cancelled', function (err) {
11203
+ retrier.on("cancelled", function (err) {
11298
11204
  return reject(err);
11299
11205
  });
11300
- retrier.on('failed', function (err) {
11206
+ retrier.on("failed", function (err) {
11301
11207
  return reject(err);
11302
11208
  });
11303
11209
  retrier.start();
@@ -11362,15 +11268,15 @@ this.Twilio.Conversations = (function (exports) {
11362
11268
  _classCallCheck$4(this, NotificationTypes);
11363
11269
  };
11364
11270
 
11365
- _defineProperty$3(NotificationTypes, "TYPING_INDICATOR", 'twilio.ipmsg.typing_indicator');
11271
+ _defineProperty$3(NotificationTypes, "TYPING_INDICATOR", "twilio.ipmsg.typing_indicator");
11366
11272
 
11367
- _defineProperty$3(NotificationTypes, "NEW_MESSAGE", 'twilio.conversations.new_message');
11273
+ _defineProperty$3(NotificationTypes, "NEW_MESSAGE", "twilio.conversations.new_message");
11368
11274
 
11369
- _defineProperty$3(NotificationTypes, "ADDED_TO_CONVERSATION", 'twilio.conversations.added_to_conversation');
11275
+ _defineProperty$3(NotificationTypes, "ADDED_TO_CONVERSATION", "twilio.conversations.added_to_conversation");
11370
11276
 
11371
- _defineProperty$3(NotificationTypes, "REMOVED_FROM_CONVERSATION", 'twilio.conversations.removed_from_conversation');
11277
+ _defineProperty$3(NotificationTypes, "REMOVED_FROM_CONVERSATION", "twilio.conversations.removed_from_conversation");
11372
11278
 
11373
- _defineProperty$3(NotificationTypes, "CONSUMPTION_UPDATE", 'twilio.channel.consumption_update');
11279
+ _defineProperty$3(NotificationTypes, "CONSUMPTION_UPDATE", "twilio.channel.consumption_update");
11374
11280
 
11375
11281
  var browser$3 = {};
11376
11282
 
@@ -11417,56 +11323,6 @@ this.Twilio.Conversations = (function (exports) {
11417
11323
  module.exports["default"] = module.exports, module.exports.__esModule = true;
11418
11324
  }(asyncToGenerator));
11419
11325
 
11420
- var get$1 = {exports: {}};
11421
-
11422
- var superPropBase = {exports: {}};
11423
-
11424
- (function (module) {
11425
- var getPrototypeOf = getPrototypeOf$2.exports;
11426
-
11427
- function _superPropBase(object, property) {
11428
- while (!Object.prototype.hasOwnProperty.call(object, property)) {
11429
- object = getPrototypeOf(object);
11430
- if (object === null) break;
11431
- }
11432
-
11433
- return object;
11434
- }
11435
-
11436
- module.exports = _superPropBase;
11437
- module.exports["default"] = module.exports, module.exports.__esModule = true;
11438
- }(superPropBase));
11439
-
11440
- (function (module) {
11441
- var superPropBase$1 = superPropBase.exports;
11442
-
11443
- function _get(target, property, receiver) {
11444
- if (typeof Reflect !== "undefined" && Reflect.get) {
11445
- module.exports = _get = Reflect.get;
11446
- module.exports["default"] = module.exports, module.exports.__esModule = true;
11447
- } else {
11448
- module.exports = _get = function _get(target, property, receiver) {
11449
- var base = superPropBase$1(target, property);
11450
- if (!base) return;
11451
- var desc = Object.getOwnPropertyDescriptor(base, property);
11452
-
11453
- if (desc.get) {
11454
- return desc.get.call(receiver);
11455
- }
11456
-
11457
- return desc.value;
11458
- };
11459
-
11460
- module.exports["default"] = module.exports, module.exports.__esModule = true;
11461
- }
11462
-
11463
- return _get(target, property, receiver || target);
11464
- }
11465
-
11466
- module.exports = _get;
11467
- module.exports["default"] = module.exports, module.exports.__esModule = true;
11468
- }(get$1));
11469
-
11470
11326
  var require$$2 = /*@__PURE__*/getAugmentedNamespace(regenerator);
11471
11327
 
11472
11328
  var redefine$3 = redefine$d.exports;
@@ -11881,7 +11737,7 @@ this.Twilio.Conversations = (function (exports) {
11881
11737
  to: init,
11882
11738
  active: true
11883
11739
  }));
11884
- } else if (_typeof$4(init) === 'object') {
11740
+ } else if (_typeof$3(init) === 'object') {
11885
11741
  return this.mapTransition(mixin({}, this.defaults.init, init, {
11886
11742
  active: true
11887
11743
  }));
@@ -11891,7 +11747,7 @@ this.Twilio.Conversations = (function (exports) {
11891
11747
  }
11892
11748
  },
11893
11749
  configureData: function configureData(data) {
11894
- if (typeof data === 'function') return data;else if (_typeof$4(data) === 'object') return function () {
11750
+ if (typeof data === 'function') return data;else if (_typeof$3(data) === 'object') return function () {
11895
11751
  return data;
11896
11752
  };else return function () {
11897
11753
  return {};
@@ -12191,7 +12047,7 @@ this.Twilio.Conversations = (function (exports) {
12191
12047
  }
12192
12048
 
12193
12049
  function build(target, config) {
12194
- if (_typeof$4(target) !== 'object' || Array.isArray(target)) throw Error('StateMachine can only be applied to objects');
12050
+ if (_typeof$3(target) !== 'object' || Array.isArray(target)) throw Error('StateMachine can only be applied to objects');
12195
12051
  plugin.build(target, config);
12196
12052
  Object.defineProperties(target, PublicProperties);
12197
12053
  mixin(target, PublicMethods);
@@ -14201,7 +14057,7 @@ this.Twilio.Conversations = (function (exports) {
14201
14057
  };
14202
14058
  /** Used as a reference to the global object. */
14203
14059
 
14204
- var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof$4(window)] && window || this;
14060
+ var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof$3(window)] && window || this;
14205
14061
  /** Detect free variable `exports`. */
14206
14062
 
14207
14063
  var freeExports = exports;
@@ -14210,7 +14066,7 @@ this.Twilio.Conversations = (function (exports) {
14210
14066
  var freeModule = module && !module.nodeType && module;
14211
14067
  /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
14212
14068
 
14213
- var freeGlobal = freeExports && freeModule && _typeof$4(commonjsGlobal) == 'object' && commonjsGlobal;
14069
+ var freeGlobal = freeExports && freeModule && _typeof$3(commonjsGlobal) == 'object' && commonjsGlobal;
14214
14070
 
14215
14071
  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
14216
14072
  root = freeGlobal;
@@ -14367,7 +14223,7 @@ this.Twilio.Conversations = (function (exports) {
14367
14223
 
14368
14224
 
14369
14225
  function isHostType(object, property) {
14370
- var type = object != null ? _typeof$4(object[property]) : 'number';
14226
+ var type = object != null ? _typeof$3(object[property]) : 'number';
14371
14227
  return !/^(?:boolean|number|string|undefined)$/.test(type) && (type == 'object' ? !!object[property] : true);
14372
14228
  }
14373
14229
  /**
@@ -14428,7 +14284,7 @@ this.Twilio.Conversations = (function (exports) {
14428
14284
  var context = root;
14429
14285
  /** Used to flag when a custom context is provided. */
14430
14286
 
14431
- var isCustomContext = ua && _typeof$4(ua) == 'object' && getClassOf(ua) != 'String'; // Juggle arguments.
14287
+ var isCustomContext = ua && _typeof$3(ua) == 'object' && getClassOf(ua) != 'String'; // Juggle arguments.
14432
14288
 
14433
14289
  if (isCustomContext) {
14434
14290
  context = ua;
@@ -14933,8 +14789,8 @@ this.Twilio.Conversations = (function (exports) {
14933
14789
  if (!name) {
14934
14790
  name = 'Rhino';
14935
14791
  }
14936
- } else if (_typeof$4(context.process) == 'object' && !context.process.browser && (data = context.process)) {
14937
- if (_typeof$4(data.versions) == 'object') {
14792
+ } else if (_typeof$3(context.process) == 'object' && !context.process.browser && (data = context.process)) {
14793
+ if (_typeof$3(data.versions) == 'object') {
14938
14794
  if (typeof data.versions.electron == 'string') {
14939
14795
  description.push('Node ' + data.versions.node);
14940
14796
  name = 'Electron';
@@ -15546,9 +15402,9 @@ this.Twilio.Conversations = (function (exports) {
15546
15402
  var _possibleConstructorReturn = possibleConstructorReturn.exports;
15547
15403
  var _getPrototypeOf = getPrototypeOf$2.exports;
15548
15404
  var _classCallCheck = classCallCheck.exports;
15549
- var _defineProperty = defineProperty$3.exports;
15405
+ var _defineProperty = defineProperty$5.exports;
15550
15406
  var _regeneratorRuntime = require$$2;
15551
- var _typeof = _typeof$3.exports;
15407
+ var _typeof = _typeof$2.exports;
15552
15408
  var declarativeTypeValidator = browser$6;
15553
15409
  var loglevelLog = loglevel.exports;
15554
15410
  var StateMachine = stateMachine.exports;
@@ -15558,7 +15414,7 @@ this.Twilio.Conversations = (function (exports) {
15558
15414
  var platform = platform$1.exports;
15559
15415
 
15560
15416
  function _interopDefaultLegacy(e) {
15561
- return e && _typeof$4(e) === 'object' && 'default' in e ? e : {
15417
+ return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
15562
15418
  'default': e
15563
15419
  };
15564
15420
  }
@@ -16200,7 +16056,7 @@ this.Twilio.Conversations = (function (exports) {
16200
16056
  }();
16201
16057
 
16202
16058
  var logInstance = new Logger("");
16203
- var version = "0.12.1";
16059
+ var version = "0.12.2-rc.0";
16204
16060
  /**
16205
16061
  * Settings container for the Twilsock client library
16206
16062
  */
@@ -20045,10 +19901,10 @@ this.Twilio.Conversations = (function (exports) {
20045
19901
  var _possibleConstructorReturn = possibleConstructorReturn.exports;
20046
19902
  var _getPrototypeOf = getPrototypeOf$2.exports;
20047
19903
  var _regeneratorRuntime = require$$2;
20048
- var _typeof = _typeof$3.exports;
19904
+ var _typeof = _typeof$2.exports;
20049
19905
  var twilsock = browser$3;
20050
19906
  var _assertThisInitialized = assertThisInitialized.exports;
20051
- var _defineProperty = defineProperty$3.exports;
19907
+ var _defineProperty = defineProperty$5.exports;
20052
19908
  var operationRetrier = browser$4;
20053
19909
  var _slicedToArray = slicedToArray.exports;
20054
19910
  var _toConsumableArray = toConsumableArray.exports;
@@ -20057,7 +19913,7 @@ this.Twilio.Conversations = (function (exports) {
20057
19913
  var declarativeTypeValidator = browser$6;
20058
19914
 
20059
19915
  function _interopDefaultLegacy(e) {
20060
- return e && _typeof$4(e) === 'object' && 'default' in e ? e : {
19916
+ return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
20061
19917
  'default': e
20062
19918
  };
20063
19919
  }
@@ -21753,9 +21609,9 @@ this.Twilio.Conversations = (function (exports) {
21753
21609
  var _inherits = inherits.exports;
21754
21610
  var _possibleConstructorReturn = possibleConstructorReturn.exports;
21755
21611
  var _getPrototypeOf = getPrototypeOf$2.exports;
21756
- var _defineProperty = defineProperty$3.exports;
21612
+ var _defineProperty = defineProperty$5.exports;
21757
21613
  var _regeneratorRuntime = require$$2;
21758
- var _typeof = _typeof$3.exports;
21614
+ var _typeof = _typeof$2.exports;
21759
21615
  var declarativeTypeValidator = browser$6;
21760
21616
  var twilsock = browser$3;
21761
21617
  var _wrapNativeSuper$1 = wrapNativeSuper.exports;
@@ -21767,7 +21623,7 @@ this.Twilio.Conversations = (function (exports) {
21767
21623
  var platform = platform$1.exports;
21768
21624
 
21769
21625
  function _interopDefaultLegacy$1(e) {
21770
- return e && _typeof$4(e) === 'object' && 'default' in e ? e : {
21626
+ return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
21771
21627
  'default': e
21772
21628
  };
21773
21629
  }
@@ -30559,7 +30415,7 @@ this.Twilio.Conversations = (function (exports) {
30559
30415
 
30560
30416
  __decorate([declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0)], InstantQuery.prototype, "updateIndexName", null);
30561
30417
 
30562
- var version$1 = "3.0.6";
30418
+ var version$1 = "3.0.7-rc.0";
30563
30419
 
30564
30420
  function _createSuper$9(Derived) {
30565
30421
  var hasNativeReflectConstruct = _isNativeReflectConstruct$a();
@@ -32023,7 +31879,7 @@ this.Twilio.Conversations = (function (exports) {
32023
31879
  a.push.apply(a, args);
32024
31880
  var Constructor = Function.bind.apply(Parent, a);
32025
31881
  var instance = new Constructor();
32026
- if (Class) _setPrototypeOf$1(instance, Class.prototype);
31882
+ if (Class) _setPrototypeOf(instance, Class.prototype);
32027
31883
  return instance;
32028
31884
  };
32029
31885
  }
@@ -32059,7 +31915,7 @@ this.Twilio.Conversations = (function (exports) {
32059
31915
  configurable: true
32060
31916
  }
32061
31917
  });
32062
- return _setPrototypeOf$1(Wrapper, Class);
31918
+ return _setPrototypeOf(Wrapper, Class);
32063
31919
  };
32064
31920
 
32065
31921
  return _wrapNativeSuper(Class);
@@ -33730,14 +33586,14 @@ this.Twilio.Conversations = (function (exports) {
33730
33586
  value: true
33731
33587
  });
33732
33588
  var _asyncToGenerator = asyncToGenerator.exports;
33733
- var _defineProperty = defineProperty$3.exports;
33589
+ var _defineProperty = defineProperty$5.exports;
33734
33590
  var _regeneratorRuntime = require$$2;
33735
33591
  var log$2 = loglevel.exports;
33736
33592
  var operationRetrier = browser$4;
33737
33593
  var declarativeTypeValidator = browser$6;
33738
33594
 
33739
33595
  function _interopDefaultLegacy(e) {
33740
- return e && _typeof$4(e) === 'object' && 'default' in e ? e : {
33596
+ return e && _typeof$3(e) === 'object' && 'default' in e ? e : {
33741
33597
  'default': e
33742
33598
  };
33743
33599
  }
@@ -33791,14 +33647,14 @@ this.Twilio.Conversations = (function (exports) {
33791
33647
  var c = arguments.length,
33792
33648
  r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
33793
33649
  d;
33794
- if ((typeof Reflect === "undefined" ? "undefined" : _typeof$4(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
33650
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof$3(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
33795
33651
  if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
33796
33652
  }
33797
33653
  return c > 3 && r && Object.defineProperty(target, key, r), r;
33798
33654
  }
33799
33655
 
33800
33656
  function __metadata(metadataKey, metadataValue) {
33801
- if ((typeof Reflect === "undefined" ? "undefined" : _typeof$4(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
33657
+ if ((typeof Reflect === "undefined" ? "undefined" : _typeof$3(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
33802
33658
  }
33803
33659
 
33804
33660
  function prepareLine(prefix, args) {
@@ -34547,7 +34403,7 @@ this.Twilio.Conversations = (function (exports) {
34547
34403
  return Network;
34548
34404
  }();
34549
34405
 
34550
- var version = "0.5.2";
34406
+ var version = "0.5.3-rc.0";
34551
34407
 
34552
34408
  var _class, _temp;
34553
34409
 
@@ -34728,11 +34584,11 @@ this.Twilio.Conversations = (function (exports) {
34728
34584
  })
34729
34585
  };
34730
34586
  _context4.next = 3;
34731
- return _this4.network.post("".concat(_this4.config.mediaSetUrl), null, JSON.stringify(query), "application/json");
34587
+ return _this4.network.post("".concat(_this4.config.mediaSetUrl), null, query, "application/json");
34732
34588
 
34733
34589
  case 3:
34734
34590
  response = _context4.sent;
34735
- return _context4.abrupt("return", response.map(function (item) {
34591
+ return _context4.abrupt("return", response.body.map(function (item) {
34736
34592
  if (item.code !== 200) {
34737
34593
  throw new Error("Failed to obtain detailed information about Media items (failed SID ".concat(item.media_record.sid, ")"));
34738
34594
  }
@@ -34757,7 +34613,7 @@ this.Twilio.Conversations = (function (exports) {
34757
34613
 
34758
34614
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", Promise)], exports['default'].prototype, "get", null);
34759
34615
 
34760
- exports['default'] = __decorate([declarativeTypeValidator.validateConstructorTypes(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, [declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.literal(null)], [declarativeTypeValidator.pureObject, 'undefined']), __metadata("design:paramtypes", [String, String, Object, Object])], exports['default']); // Proper renames should happen in index.ts,
34616
+ exports['default'] = __decorate([declarativeTypeValidator.validateConstructorTypes(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, [declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.literal(null)], [declarativeTypeValidator.pureObject, "undefined"]), __metadata("design:paramtypes", [String, String, Object, Object])], exports['default']); // Proper renames should happen in index.ts,
34761
34617
 
34762
34618
  exports.Client = exports['default'];
34763
34619
  exports.McsClient = exports['default'];
@@ -34802,7 +34658,7 @@ this.Twilio.Conversations = (function (exports) {
34802
34658
  function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
34803
34659
 
34804
34660
  function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
34805
- var log$7 = Logger.scope('Participant');
34661
+ var log$7 = Logger.scope("Participant");
34806
34662
  /**
34807
34663
  * A participant represents a remote client in a conversation.
34808
34664
  */
@@ -34816,7 +34672,7 @@ this.Twilio.Conversations = (function (exports) {
34816
34672
  * @internal
34817
34673
  */
34818
34674
  function Participant(data, sid, conversation, links, services) {
34819
- var _data$bindings;
34675
+ var _data$roleSid, _data$bindings;
34820
34676
 
34821
34677
  var _this;
34822
34678
 
@@ -34827,23 +34683,23 @@ this.Twilio.Conversations = (function (exports) {
34827
34683
  _this.links = links;
34828
34684
  _this.services = services;
34829
34685
  _this.state = {
34830
- attributes: parseAttributes(data.attributes, 'Retrieved malformed attributes from the server for participant: ' + sid, log$7),
34686
+ attributes: parseAttributes(data.attributes, "Retrieved malformed attributes from the server for participant: " + sid, log$7),
34831
34687
  dateCreated: data.dateCreated ? parseTime$1(data.dateCreated) : null,
34832
34688
  dateUpdated: data.dateCreated ? parseTime$1(data.dateUpdated) : null,
34833
34689
  sid: sid,
34834
34690
  typingTimeout: null,
34835
34691
  isTyping: false,
34836
- identity: data.identity || null,
34837
- roleSid: data.roleSid || null,
34692
+ identity: data.identity,
34693
+ roleSid: (_data$roleSid = data.roleSid) !== null && _data$roleSid !== void 0 ? _data$roleSid : "",
34838
34694
  lastReadMessageIndex: Number.isInteger(data.lastConsumedMessageIndex) ? data.lastConsumedMessageIndex : null,
34839
34695
  lastReadTimestamp: data.lastConsumptionTimestamp ? parseTime$1(data.lastConsumptionTimestamp) : null,
34840
- type: data.type || 'chat',
34696
+ type: data.type || "chat",
34841
34697
  userInfo: data.userInfo,
34842
34698
  bindings: (_data$bindings = data.bindings) !== null && _data$bindings !== void 0 ? _data$bindings : {}
34843
34699
  };
34844
34700
 
34845
34701
  if (!data.identity && !data.type) {
34846
- throw new Error('Received invalid Participant object from server: Missing identity or type of Participant.');
34702
+ throw new Error("Received invalid Participant object from server: Missing identity or type of Participant.");
34847
34703
  }
34848
34704
 
34849
34705
  return _this;
@@ -34963,7 +34819,9 @@ this.Twilio.Conversations = (function (exports) {
34963
34819
  }, {
34964
34820
  key: "bindings",
34965
34821
  get: function get() {
34966
- return this.state.bindings;
34822
+ var _this$state$bindings;
34823
+
34824
+ return (_this$state$bindings = this.state.bindings) !== null && _this$state$bindings !== void 0 ? _this$state$bindings : {};
34967
34825
  }
34968
34826
  }, {
34969
34827
  key: "_startTyping",
@@ -34975,13 +34833,16 @@ this.Twilio.Conversations = (function (exports) {
34975
34833
  function _startTyping(timeout) {
34976
34834
  var _this2 = this;
34977
34835
 
34978
- clearTimeout(this.state.typingTimeout);
34836
+ if (this.state.typingTimeout) {
34837
+ clearTimeout(this.state.typingTimeout);
34838
+ }
34839
+
34979
34840
  this.state.isTyping = true;
34980
- this.emit('typingStarted', this);
34981
- this.conversation.emit('typingStarted', this);
34982
- this.state.typingTimeout = setTimeout(function () {
34841
+ this.emit("typingStarted", this);
34842
+ this.conversation.emit("typingStarted", this);
34843
+ this.state.typingTimeout = Number(setTimeout(function () {
34983
34844
  return _this2._endTyping();
34984
- }, timeout);
34845
+ }, timeout));
34985
34846
  return this;
34986
34847
  }
34987
34848
  /**
@@ -34997,8 +34858,8 @@ this.Twilio.Conversations = (function (exports) {
34997
34858
  }
34998
34859
 
34999
34860
  this.state.isTyping = false;
35000
- this.emit('typingEnded', this);
35001
- this.conversation.emit('typingEnded', this);
34861
+ this.emit("typingEnded", this);
34862
+ this.conversation.emit("typingEnded", this);
35002
34863
  clearInterval(this.state.typingTimeout);
35003
34864
  this.state.typingTimeout = null;
35004
34865
  }
@@ -35011,35 +34872,35 @@ this.Twilio.Conversations = (function (exports) {
35011
34872
  key: "_update",
35012
34873
  value: function _update(data) {
35013
34874
  var updateReasons = [];
35014
- var updateAttributes = parseAttributes(data.attributes, 'Retrieved malformed attributes from the server for participant: ' + this.state.sid, log$7);
34875
+ var updateAttributes = parseAttributes(data.attributes, "Retrieved malformed attributes from the server for participant: " + this.state.sid, log$7);
35015
34876
 
35016
34877
  if (data.attributes && !isEqual(this.state.attributes, updateAttributes)) {
35017
34878
  this.state.attributes = updateAttributes;
35018
- updateReasons.push('attributes');
34879
+ updateReasons.push("attributes");
35019
34880
  }
35020
34881
 
35021
34882
  var updatedDateUpdated = parseTime$1(data.dateUpdated);
35022
34883
 
35023
- if (data.dateUpdated && updatedDateUpdated.getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
34884
+ if (data.dateUpdated && (updatedDateUpdated === null || updatedDateUpdated === void 0 ? void 0 : updatedDateUpdated.getTime()) !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
35024
34885
  this.state.dateUpdated = updatedDateUpdated;
35025
- updateReasons.push('dateUpdated');
34886
+ updateReasons.push("dateUpdated");
35026
34887
  }
35027
34888
 
35028
34889
  var updatedDateCreated = parseTime$1(data.dateCreated);
35029
34890
 
35030
- if (data.dateCreated && updatedDateCreated.getTime() !== (this.state.dateCreated && this.state.dateCreated.getTime())) {
34891
+ if (data.dateCreated && (updatedDateCreated === null || updatedDateCreated === void 0 ? void 0 : updatedDateCreated.getTime()) !== (this.state.dateCreated && this.state.dateCreated.getTime())) {
35031
34892
  this.state.dateCreated = updatedDateCreated;
35032
- updateReasons.push('dateCreated');
34893
+ updateReasons.push("dateCreated");
35033
34894
  }
35034
34895
 
35035
34896
  if (data.roleSid && this.state.roleSid !== data.roleSid) {
35036
34897
  this.state.roleSid = data.roleSid;
35037
- updateReasons.push('roleSid');
34898
+ updateReasons.push("roleSid");
35038
34899
  }
35039
34900
 
35040
34901
  if ((Number.isInteger(data.lastConsumedMessageIndex) || data.lastConsumedMessageIndex === null) && this.state.lastReadMessageIndex !== data.lastConsumedMessageIndex) {
35041
34902
  this.state.lastReadMessageIndex = data.lastConsumedMessageIndex;
35042
- updateReasons.push('lastReadMessageIndex');
34903
+ updateReasons.push("lastReadMessageIndex");
35043
34904
  }
35044
34905
 
35045
34906
  if (data.lastConsumptionTimestamp) {
@@ -35047,17 +34908,17 @@ this.Twilio.Conversations = (function (exports) {
35047
34908
 
35048
34909
  if (!this.state.lastReadTimestamp || this.state.lastReadTimestamp.getTime() !== lastReadTimestamp.getTime()) {
35049
34910
  this.state.lastReadTimestamp = lastReadTimestamp;
35050
- updateReasons.push('lastReadTimestamp');
34911
+ updateReasons.push("lastReadTimestamp");
35051
34912
  }
35052
34913
  }
35053
34914
 
35054
34915
  if (data.bindings && !isEqual(this.state.bindings, data.bindings)) {
35055
34916
  this.state.bindings = data.bindings;
35056
- updateReasons.push('bindings');
34917
+ updateReasons.push("bindings");
35057
34918
  }
35058
34919
 
35059
34920
  if (updateReasons.length > 0) {
35060
- this.emit('updated', {
34921
+ this.emit("updated", {
35061
34922
  participant: this,
35062
34923
  updateReasons: updateReasons
35063
34924
  });
@@ -35077,12 +34938,12 @@ this.Twilio.Conversations = (function (exports) {
35077
34938
  while (1) {
35078
34939
  switch (_context.prev = _context.next) {
35079
34940
  case 0:
35080
- if (!(this.type != 'chat')) {
34941
+ if (!(this.type != "chat")) {
35081
34942
  _context.next = 2;
35082
34943
  break;
35083
34944
  }
35084
34945
 
35085
- throw new Error('Getting User is not supported for this Participant type: ' + this.type);
34946
+ throw new Error("Getting User is not supported for this Participant type: " + this.type);
35086
34947
 
35087
34948
  case 2:
35088
34949
  return _context.abrupt("return", this.services.users.getUser(this.state.identity, this.state.userInfo));
@@ -35143,7 +35004,7 @@ this.Twilio.Conversations = (function (exports) {
35143
35004
  switch (_context3.prev = _context3.next) {
35144
35005
  case 0:
35145
35006
  _context3.next = 2;
35146
- return this.services.commandExecutor.mutateResource('post', this.links.self, {
35007
+ return this.services.commandExecutor.mutateResource("post", this.links.self, {
35147
35008
  attributes: JSON.stringify(attributes)
35148
35009
  });
35149
35010
 
@@ -35169,18 +35030,18 @@ this.Twilio.Conversations = (function (exports) {
35169
35030
  return Participant;
35170
35031
  }(ReplayEventEmitter_1);
35171
35032
 
35172
- _defineProperty$3(Participant, "typingStarted", 'typingStarted');
35033
+ _defineProperty$3(Participant, "typingStarted", "typingStarted");
35173
35034
 
35174
- _defineProperty$3(Participant, "typingEnded", 'typingEnded');
35035
+ _defineProperty$3(Participant, "typingEnded", "typingEnded");
35175
35036
 
35176
- _defineProperty$3(Participant, "updated", 'updated');
35037
+ _defineProperty$3(Participant, "updated", "updated");
35177
35038
 
35178
35039
  __decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
35179
35040
 
35180
35041
  function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
35181
35042
 
35182
35043
  function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
35183
- var log$6 = Logger.scope('Participants');
35044
+ var log$6 = Logger.scope("Participants");
35184
35045
  /**
35185
35046
  * @classdesc Represents the collection of participants for the conversation
35186
35047
  * @fires Participants#participantJoined
@@ -35199,6 +35060,9 @@ this.Twilio.Conversations = (function (exports) {
35199
35060
  _classCallCheck$4(this, Participants);
35200
35061
 
35201
35062
  _this = _super.call(this);
35063
+
35064
+ _defineProperty$3(_assertThisInitialized$3(_this), "rosterEntityPromise", null);
35065
+
35202
35066
  _this.conversation = conversation;
35203
35067
  _this.participants = participants;
35204
35068
  _this.links = links;
@@ -35250,17 +35114,17 @@ this.Twilio.Conversations = (function (exports) {
35250
35114
 
35251
35115
  return this.rosterEntityPromise = this.rosterEntityPromise || this.services.syncClient.map({
35252
35116
  id: rosterObjectName,
35253
- mode: 'open_existing'
35117
+ mode: "open_existing"
35254
35118
  }).then(function (rosterMap) {
35255
- rosterMap.on('itemAdded', function (args) {
35256
- log$6.debug(_this2.conversation.sid + ' itemAdded: ' + args.item.key);
35119
+ rosterMap.on("itemAdded", function (args) {
35120
+ log$6.debug(_this2.conversation.sid + " itemAdded: " + args.item.key);
35257
35121
 
35258
35122
  _this2.upsertParticipant(args.item.key, args.item.data).then(function (participant) {
35259
- _this2.emit('participantJoined', participant);
35123
+ _this2.emit("participantJoined", participant);
35260
35124
  });
35261
35125
  });
35262
- rosterMap.on('itemRemoved', function (args) {
35263
- log$6.debug(_this2.conversation.sid + ' itemRemoved: ' + args.key);
35126
+ rosterMap.on("itemRemoved", function (args) {
35127
+ log$6.debug(_this2.conversation.sid + " itemRemoved: " + args.key);
35264
35128
  var participantSid = args.key;
35265
35129
 
35266
35130
  if (!_this2.participants.has(participantSid)) {
@@ -35271,19 +35135,22 @@ this.Twilio.Conversations = (function (exports) {
35271
35135
 
35272
35136
  _this2.participants.delete(participantSid);
35273
35137
 
35274
- _this2.emit('participantLeft', leftParticipant);
35138
+ if (!leftParticipant) {
35139
+ return;
35140
+ }
35141
+
35142
+ _this2.emit("participantLeft", leftParticipant);
35275
35143
  });
35276
- rosterMap.on('itemUpdated', function (args) {
35277
- log$6.debug(_this2.conversation.sid + ' itemUpdated: ' + args.item.key);
35144
+ rosterMap.on("itemUpdated", function (args) {
35145
+ log$6.debug(_this2.conversation.sid + " itemUpdated: " + args.item.key);
35278
35146
 
35279
35147
  _this2.upsertParticipant(args.item.key, args.item.data);
35280
35148
  });
35281
35149
  var participantsPromises = [];
35282
- var that = _this2;
35283
35150
 
35284
35151
  var rosterMapHandler = function rosterMapHandler(paginator) {
35285
35152
  paginator.items.forEach(function (item) {
35286
- participantsPromises.push(that.upsertParticipant(item.key, item.data));
35153
+ participantsPromises.push(_this2.upsertParticipant(item.key, item.data));
35287
35154
  });
35288
35155
  return paginator.hasNextPage ? paginator.nextPage().then(rosterMapHandler) : null;
35289
35156
  };
@@ -35296,11 +35163,11 @@ this.Twilio.Conversations = (function (exports) {
35296
35163
  }).catch(function (err) {
35297
35164
  _this2.rosterEntityPromise = null;
35298
35165
 
35299
- if (_this2.services.syncClient.connectionState != 'disconnected') {
35300
- log$6.error('Failed to get roster object for conversation', _this2.conversation.sid, err);
35166
+ if (_this2.services.syncClient.connectionState != "disconnected") {
35167
+ log$6.error("Failed to get roster object for conversation", _this2.conversation.sid, err);
35301
35168
  }
35302
35169
 
35303
- log$6.debug('ERROR: Failed to get roster object for conversation', _this2.conversation.sid, err);
35170
+ log$6.debug("ERROR: Failed to get roster object for conversation", _this2.conversation.sid, err);
35304
35171
  throw err;
35305
35172
  });
35306
35173
  }
@@ -35330,8 +35197,8 @@ this.Twilio.Conversations = (function (exports) {
35330
35197
  };
35331
35198
  participant = new Participant(data, participantSid, this.conversation, links, this.services);
35332
35199
  this.participants.set(participantSid, participant);
35333
- participant.on('updated', function (args) {
35334
- return _this3.emit('participantUpdated', args);
35200
+ participant.on("updated", function (args) {
35201
+ return _this3.emit("participantUpdated", args);
35335
35202
  });
35336
35203
  return _context2.abrupt("return", participant);
35337
35204
 
@@ -35363,7 +35230,7 @@ this.Twilio.Conversations = (function (exports) {
35363
35230
  while (1) {
35364
35231
  switch (_context3.prev = _context3.next) {
35365
35232
  case 0:
35366
- return _context3.abrupt("return", this.rosterEntityPromise.then(function () {
35233
+ return _context3.abrupt("return", this.rosterEntityPromise ? this.rosterEntityPromise.then(function () {
35367
35234
  var participants = [];
35368
35235
 
35369
35236
  _this4.participants.forEach(function (participant) {
@@ -35371,7 +35238,7 @@ this.Twilio.Conversations = (function (exports) {
35371
35238
  });
35372
35239
 
35373
35240
  return participants;
35374
- }));
35241
+ }) : []);
35375
35242
 
35376
35243
  case 1:
35377
35244
  case "end":
@@ -35402,15 +35269,15 @@ this.Twilio.Conversations = (function (exports) {
35402
35269
  while (1) {
35403
35270
  switch (_context4.prev = _context4.next) {
35404
35271
  case 0:
35405
- return _context4.abrupt("return", this.rosterEntityPromise.then(function () {
35272
+ return _context4.abrupt("return", this.rosterEntityPromise ? this.rosterEntityPromise.then(function () {
35406
35273
  var participant = _this5.participants.get(participantSid);
35407
35274
 
35408
35275
  if (!participant) {
35409
- throw new Error('Participant with SID ' + participantSid + ' was not found');
35276
+ throw new Error("Participant with SID " + participantSid + " was not found");
35410
35277
  }
35411
35278
 
35412
35279
  return participant;
35413
- }));
35280
+ }) : null);
35414
35281
 
35415
35282
  case 1:
35416
35283
  case "end":
@@ -35443,7 +35310,7 @@ this.Twilio.Conversations = (function (exports) {
35443
35310
  switch (_context5.prev = _context5.next) {
35444
35311
  case 0:
35445
35312
  foundParticipant = null;
35446
- return _context5.abrupt("return", this.rosterEntityPromise.then(function () {
35313
+ return _context5.abrupt("return", this.rosterEntityPromise ? this.rosterEntityPromise.then(function () {
35447
35314
  _this6.participants.forEach(function (participant) {
35448
35315
  if (participant.identity === identity) {
35449
35316
  foundParticipant = participant;
@@ -35451,11 +35318,11 @@ this.Twilio.Conversations = (function (exports) {
35451
35318
  });
35452
35319
 
35453
35320
  if (!foundParticipant) {
35454
- throw new Error('Participant with identity ' + identity + ' was not found');
35321
+ throw new Error("Participant with identity " + identity + " was not found");
35455
35322
  }
35456
35323
 
35457
35324
  return foundParticipant;
35458
- }));
35325
+ }) : null);
35459
35326
 
35460
35327
  case 2:
35461
35328
  case "end":
@@ -35473,7 +35340,7 @@ this.Twilio.Conversations = (function (exports) {
35473
35340
  }()
35474
35341
  /**
35475
35342
  * Add a chat participant to the conversation
35476
- * @returns {Promise<any>}
35343
+ * @returns {Promise<ParticipantResponse>}
35477
35344
  */
35478
35345
 
35479
35346
  }, {
@@ -35485,9 +35352,9 @@ this.Twilio.Conversations = (function (exports) {
35485
35352
  switch (_context6.prev = _context6.next) {
35486
35353
  case 0:
35487
35354
  _context6.next = 2;
35488
- return this.services.commandExecutor.mutateResource('post', this.links.participants, {
35355
+ return this.services.commandExecutor.mutateResource("post", this.links.participants, {
35489
35356
  identity: identity,
35490
- attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined
35357
+ attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
35491
35358
  });
35492
35359
 
35493
35360
  case 2:
@@ -35524,8 +35391,8 @@ this.Twilio.Conversations = (function (exports) {
35524
35391
 
35525
35392
  var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
35526
35393
  var bindingOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
35527
- return this.services.commandExecutor.mutateResource('post', this.links.participants, {
35528
- attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined,
35394
+ return this.services.commandExecutor.mutateResource("post", this.links.participants, {
35395
+ attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined,
35529
35396
  messaging_binding: {
35530
35397
  address: address,
35531
35398
  proxy_address: proxyAddress,
@@ -35541,7 +35408,7 @@ this.Twilio.Conversations = (function (exports) {
35541
35408
  }, {
35542
35409
  key: "remove",
35543
35410
  value: function remove(identity) {
35544
- return this.services.commandExecutor.mutateResource('delete', "".concat(this.links.participants, "/").concat(identity));
35411
+ return this.services.commandExecutor.mutateResource("delete", "".concat(this.links.participants, "/").concat(identity));
35545
35412
  }
35546
35413
  }]);
35547
35414
 
@@ -35769,6 +35636,8 @@ this.Twilio.Conversations = (function (exports) {
35769
35636
  key: "getContentTemporaryUrl",
35770
35637
  value: function () {
35771
35638
  var _getContentTemporaryUrl = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
35639
+ var _this$mcsMedia$getCon, _this$mcsMedia;
35640
+
35772
35641
  return _regeneratorRuntime$1.wrap(function _callee$(_context) {
35773
35642
  while (1) {
35774
35643
  switch (_context.prev = _context.next) {
@@ -35777,7 +35646,7 @@ this.Twilio.Conversations = (function (exports) {
35777
35646
  return this._fetchMcsMedia();
35778
35647
 
35779
35648
  case 2:
35780
- return _context.abrupt("return", this.mcsMedia.getContentUrl());
35649
+ return _context.abrupt("return", (_this$mcsMedia$getCon = (_this$mcsMedia = this.mcsMedia) === null || _this$mcsMedia === void 0 ? void 0 : _this$mcsMedia.getContentUrl()) !== null && _this$mcsMedia$getCon !== void 0 ? _this$mcsMedia$getCon : null);
35781
35650
 
35782
35651
  case 3:
35783
35652
  case "end":
@@ -35807,6 +35676,8 @@ this.Twilio.Conversations = (function (exports) {
35807
35676
  key: "getCachedTemporaryUrl",
35808
35677
  value: function () {
35809
35678
  var _getCachedTemporaryUrl = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2() {
35679
+ var _this$mcsMedia$getCac, _this$mcsMedia2;
35680
+
35810
35681
  return _regeneratorRuntime$1.wrap(function _callee2$(_context2) {
35811
35682
  while (1) {
35812
35683
  switch (_context2.prev = _context2.next) {
@@ -35815,7 +35686,7 @@ this.Twilio.Conversations = (function (exports) {
35815
35686
  return this._fetchMcsMedia();
35816
35687
 
35817
35688
  case 2:
35818
- return _context2.abrupt("return", this.mcsMedia.getCachedContentUrl());
35689
+ return _context2.abrupt("return", (_this$mcsMedia$getCac = (_this$mcsMedia2 = this.mcsMedia) === null || _this$mcsMedia2 === void 0 ? void 0 : _this$mcsMedia2.getCachedContentUrl()) !== null && _this$mcsMedia$getCac !== void 0 ? _this$mcsMedia$getCac : null);
35819
35690
 
35820
35691
  case 3:
35821
35692
  case "end":
@@ -35858,7 +35729,7 @@ this.Twilio.Conversations = (function (exports) {
35858
35729
  break;
35859
35730
 
35860
35731
  case 7:
35861
- throw new Error('Media Content Service is unavailable');
35732
+ throw new Error("Media Content Service is unavailable");
35862
35733
 
35863
35734
  case 8:
35864
35735
  case "end":
@@ -36052,7 +35923,7 @@ this.Twilio.Conversations = (function (exports) {
36052
35923
  }, {
36053
35924
  key: "nextPage",
36054
35925
  value: function nextPage() {
36055
- return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error('No next page'));
35926
+ return this.hasNextPage ? this.state.source(this.state.nextToken) : Promise.reject(new Error("No next page"));
36056
35927
  }
36057
35928
  /**
36058
35929
  * Request the previous page. Does not modify the existing object.
@@ -36061,7 +35932,7 @@ this.Twilio.Conversations = (function (exports) {
36061
35932
  }, {
36062
35933
  key: "prevPage",
36063
35934
  value: function prevPage() {
36064
- return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error('No previous page'));
35935
+ return this.hasPrevPage ? this.state.source(this.state.prevToken) : Promise.reject(new Error("No previous page"));
36065
35936
  }
36066
35937
  }]);
36067
35938
 
@@ -36120,7 +35991,7 @@ this.Twilio.Conversations = (function (exports) {
36120
35991
  this.conversationSid = descriptor.conversation_sid;
36121
35992
  this.channelMessageSid = descriptor.channel_message_sid;
36122
35993
  this.participantSid = descriptor.participant_sid;
36123
- this.status = descriptor.status || 'queued';
35994
+ this.status = descriptor.status || "queued";
36124
35995
  this.errorCode = descriptor.error_code || 0;
36125
35996
  this.dateCreated = descriptor.date_created;
36126
35997
  this.dateUpdated = descriptor.date_updated;
@@ -36129,7 +36000,7 @@ this.Twilio.Conversations = (function (exports) {
36129
36000
  function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
36130
36001
 
36131
36002
  function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
36132
- var log$5 = Logger.scope('Message');
36003
+ var log$5 = Logger.scope("Message");
36133
36004
  /**
36134
36005
  * A message in a conversation.
36135
36006
  */
@@ -36147,7 +36018,7 @@ this.Twilio.Conversations = (function (exports) {
36147
36018
  * @internal
36148
36019
  */
36149
36020
  function Message(index, data, conversation, links, configuration, services) {
36150
- var _data$author, _data$subject, _data$lastUpdatedBy, _data$type, _data$memberSid;
36021
+ var _data$text, _data$lastUpdatedBy, _data$type, _data$memberSid;
36151
36022
 
36152
36023
  var _this;
36153
36024
 
@@ -36161,16 +36032,16 @@ this.Twilio.Conversations = (function (exports) {
36161
36032
  _this.state = {
36162
36033
  sid: data.sid,
36163
36034
  index: index,
36164
- author: (_data$author = data.author) !== null && _data$author !== void 0 ? _data$author : null,
36165
- subject: (_data$subject = data.subject) !== null && _data$subject !== void 0 ? _data$subject : null,
36166
- body: data.text,
36035
+ author: data.author,
36036
+ subject: data.subject,
36037
+ body: (_data$text = data.text) !== null && _data$text !== void 0 ? _data$text : null,
36167
36038
  timestamp: data.timestamp ? new Date(data.timestamp) : null,
36168
36039
  dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,
36169
36040
  lastUpdatedBy: (_data$lastUpdatedBy = data.lastUpdatedBy) !== null && _data$lastUpdatedBy !== void 0 ? _data$lastUpdatedBy : null,
36170
36041
  attributes: parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(data.sid), log$5),
36171
- type: (_data$type = data.type) !== null && _data$type !== void 0 ? _data$type : 'text',
36172
- media: data.type && data.type === 'media' && data.media ? new Media(data.media, _this.services) : null,
36173
- medias: data.type && data.type === 'media' && data.medias ? data.medias.map(function (m) {
36042
+ type: (_data$type = data.type) !== null && _data$type !== void 0 ? _data$type : "text",
36043
+ media: data.type && data.type === "media" && data.media ? new Media(data.media, _this.services) : null,
36044
+ medias: data.type && data.type === "media" && data.medias ? data.medias.map(function (m) {
36174
36045
  return new Media(m, _this.services);
36175
36046
  }) : null,
36176
36047
  participantSid: (_data$memberSid = data.memberSid) !== null && _data$memberSid !== void 0 ? _data$memberSid : null,
@@ -36303,7 +36174,7 @@ this.Twilio.Conversations = (function (exports) {
36303
36174
  }, {
36304
36175
  key: "attachedMedia",
36305
36176
  get: function get() {
36306
- return this.getMediaByCategory(['media']);
36177
+ return this.getMediaByCategory(["media"]);
36307
36178
  }
36308
36179
  /**
36309
36180
  * The server-assigned unique identifier of the authoring participant.
@@ -36312,7 +36183,9 @@ this.Twilio.Conversations = (function (exports) {
36312
36183
  }, {
36313
36184
  key: "participantSid",
36314
36185
  get: function get() {
36315
- return this.state.participantSid;
36186
+ var _this$state$participa;
36187
+
36188
+ return (_this$state$participa = this.state.participantSid) !== null && _this$state$participa !== void 0 ? _this$state$participa : "";
36316
36189
  }
36317
36190
  /**
36318
36191
  * Aggregated information about the message delivery statuses across all participants of a conversation..
@@ -36335,7 +36208,7 @@ this.Twilio.Conversations = (function (exports) {
36335
36208
  value: function getMediaByCategory(categories) {
36336
36209
  var _this$state$medias;
36337
36210
 
36338
- return (_this$state$medias = this.state.medias) === null || _this$state$medias === void 0 ? void 0 : _this$state$medias.filter(function (m) {
36211
+ return ((_this$state$medias = this.state.medias) !== null && _this$state$medias !== void 0 ? _this$state$medias : []).filter(function (m) {
36339
36212
  return categories.includes(m.category);
36340
36213
  });
36341
36214
  }
@@ -36350,8 +36223,8 @@ this.Twilio.Conversations = (function (exports) {
36350
36223
  value: function getEmailBody() {
36351
36224
  var _this$getMediaByCateg, _this$getMediaByCateg2;
36352
36225
 
36353
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'text/plain';
36354
- return (_this$getMediaByCateg = (_this$getMediaByCateg2 = this.getMediaByCategory(['body'])) === null || _this$getMediaByCateg2 === void 0 ? void 0 : _this$getMediaByCateg2.filter(function (m) {
36226
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "text/plain";
36227
+ return (_this$getMediaByCateg = (_this$getMediaByCateg2 = this.getMediaByCategory(["body"])) === null || _this$getMediaByCateg2 === void 0 ? void 0 : _this$getMediaByCateg2.filter(function (m) {
36355
36228
  return m.contentType == type;
36356
36229
  }).shift()) !== null && _this$getMediaByCateg !== void 0 ? _this$getMediaByCateg : null;
36357
36230
  }
@@ -36366,8 +36239,8 @@ this.Twilio.Conversations = (function (exports) {
36366
36239
  value: function getEmailHistory() {
36367
36240
  var _this$getMediaByCateg3, _this$getMediaByCateg4;
36368
36241
 
36369
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'text/plain';
36370
- return (_this$getMediaByCateg3 = (_this$getMediaByCateg4 = this.getMediaByCategory(['history'])) === null || _this$getMediaByCateg4 === void 0 ? void 0 : _this$getMediaByCateg4.filter(function (m) {
36242
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "text/plain";
36243
+ return (_this$getMediaByCateg3 = (_this$getMediaByCateg4 = this.getMediaByCategory(["history"])) === null || _this$getMediaByCateg4 === void 0 ? void 0 : _this$getMediaByCateg4.filter(function (m) {
36371
36244
  return m.contentType == type;
36372
36245
  }).shift()) !== null && _this$getMediaByCateg3 !== void 0 ? _this$getMediaByCateg3 : null;
36373
36246
  }
@@ -36376,41 +36249,41 @@ this.Twilio.Conversations = (function (exports) {
36376
36249
  value: function _update(data) {
36377
36250
  var updateReasons = [];
36378
36251
 
36379
- if ((data.text || typeof data.text === 'string') && data.text !== this.state.body) {
36252
+ if ((data.text || typeof data.text === "string") && data.text !== this.state.body) {
36380
36253
  this.state.body = data.text;
36381
- updateReasons.push('body');
36254
+ updateReasons.push("body");
36382
36255
  }
36383
36256
 
36384
36257
  if (data.subject && data.subject !== this.state.subject) {
36385
36258
  this.state.subject = data.subject;
36386
- updateReasons.push('subject');
36259
+ updateReasons.push("subject");
36387
36260
  }
36388
36261
 
36389
36262
  if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {
36390
36263
  this.state.lastUpdatedBy = data.lastUpdatedBy;
36391
- updateReasons.push('lastUpdatedBy');
36264
+ updateReasons.push("lastUpdatedBy");
36392
36265
  }
36393
36266
 
36394
36267
  if (data.author && data.author !== this.state.author) {
36395
36268
  this.state.author = data.author;
36396
- updateReasons.push('author');
36269
+ updateReasons.push("author");
36397
36270
  }
36398
36271
 
36399
36272
  if (data.dateUpdated && new Date(data.dateUpdated).getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
36400
36273
  this.state.dateUpdated = new Date(data.dateUpdated);
36401
- updateReasons.push('dateUpdated');
36274
+ updateReasons.push("dateUpdated");
36402
36275
  }
36403
36276
 
36404
36277
  if (data.timestamp && new Date(data.timestamp).getTime() !== (this.state.timestamp && this.state.timestamp.getTime())) {
36405
36278
  this.state.timestamp = new Date(data.timestamp);
36406
- updateReasons.push('dateCreated');
36279
+ updateReasons.push("dateCreated");
36407
36280
  }
36408
36281
 
36409
36282
  var updatedAttributes = parseAttributes(data.attributes, "Got malformed attributes for the message ".concat(this.sid), log$5);
36410
36283
 
36411
36284
  if (!isEqual(this.state.attributes, updatedAttributes)) {
36412
36285
  this.state.attributes = updatedAttributes;
36413
- updateReasons.push('attributes');
36286
+ updateReasons.push("attributes");
36414
36287
  }
36415
36288
 
36416
36289
  var updatedAggregatedDelivery = data.delivery;
@@ -36420,16 +36293,16 @@ this.Twilio.Conversations = (function (exports) {
36420
36293
  if (isUpdatedAggregateDeliveryValid) {
36421
36294
  if (!currentAggregatedDelivery) {
36422
36295
  this.state.aggregatedDeliveryReceipt = new AggregatedDeliveryReceipt(updatedAggregatedDelivery);
36423
- updateReasons.push('deliveryReceipt');
36296
+ updateReasons.push("deliveryReceipt");
36424
36297
  } else if (!currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)) {
36425
36298
  currentAggregatedDelivery._update(updatedAggregatedDelivery);
36426
36299
 
36427
- updateReasons.push('deliveryReceipt');
36300
+ updateReasons.push("deliveryReceipt");
36428
36301
  }
36429
36302
  }
36430
36303
 
36431
36304
  if (updateReasons.length > 0) {
36432
- this.emit('updated', {
36305
+ this.emit("updated", {
36433
36306
  message: this,
36434
36307
  updateReasons: updateReasons
36435
36308
  });
@@ -36490,25 +36363,25 @@ this.Twilio.Conversations = (function (exports) {
36490
36363
  return _context.abrupt("return", participant);
36491
36364
 
36492
36365
  case 11:
36493
- errorMesage = 'Participant with ';
36366
+ errorMesage = "Participant with ";
36494
36367
 
36495
36368
  if (this.state.participantSid) {
36496
- errorMesage += 'SID \'' + this.state.participantSid + '\' ';
36369
+ errorMesage += "SID '" + this.state.participantSid + "' ";
36497
36370
  }
36498
36371
 
36499
36372
  if (this.state.author) {
36500
36373
  if (this.state.participantSid) {
36501
- errorMesage += 'or ';
36374
+ errorMesage += "or ";
36502
36375
  }
36503
36376
 
36504
- errorMesage += 'identity \'' + this.state.author + '\' ';
36377
+ errorMesage += "identity '" + this.state.author + "' ";
36505
36378
  }
36506
36379
 
36507
- if (errorMesage === 'Participant with ') {
36508
- errorMesage = 'Participant ';
36380
+ if (errorMesage === "Participant with ") {
36381
+ errorMesage = "Participant ";
36509
36382
  }
36510
36383
 
36511
- errorMesage += 'was not found';
36384
+ errorMesage += "was not found";
36512
36385
  throw new Error(errorMesage);
36513
36386
 
36514
36387
  case 17:
@@ -36595,7 +36468,7 @@ this.Twilio.Conversations = (function (exports) {
36595
36468
  switch (_context3.prev = _context3.next) {
36596
36469
  case 0:
36597
36470
  _context3.next = 2;
36598
- return this.services.commandExecutor.mutateResource('delete', this.links.self);
36471
+ return this.services.commandExecutor.mutateResource("delete", this.links.self);
36599
36472
 
36600
36473
  case 2:
36601
36474
  return _context3.abrupt("return", this);
@@ -36628,7 +36501,7 @@ this.Twilio.Conversations = (function (exports) {
36628
36501
  switch (_context4.prev = _context4.next) {
36629
36502
  case 0:
36630
36503
  _context4.next = 2;
36631
- return this.services.commandExecutor.mutateResource('post', this.links.self, {
36504
+ return this.services.commandExecutor.mutateResource("post", this.links.self, {
36632
36505
  body: body
36633
36506
  });
36634
36507
 
@@ -36663,8 +36536,8 @@ this.Twilio.Conversations = (function (exports) {
36663
36536
  switch (_context5.prev = _context5.next) {
36664
36537
  case 0:
36665
36538
  _context5.next = 2;
36666
- return this.services.commandExecutor.mutateResource('post', this.links.self, {
36667
- attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined
36539
+ return this.services.commandExecutor.mutateResource("post", this.links.self, {
36540
+ attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
36668
36541
  });
36669
36542
 
36670
36543
  case 2:
@@ -36702,11 +36575,11 @@ this.Twilio.Conversations = (function (exports) {
36702
36575
  case 0:
36703
36576
  // We ignore existing mcsMedia members of each of the media entries.
36704
36577
  // Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.
36705
- sids = contentSet.map(function (m) {
36578
+ sids = contentSet === null || contentSet === void 0 ? void 0 : contentSet.map(function (m) {
36706
36579
  return m.sid;
36707
36580
  });
36708
36581
 
36709
- if (!this.services.mcsClient) {
36582
+ if (!(this.services.mcsClient && sids)) {
36710
36583
  _context6.next = 7;
36711
36584
  break;
36712
36585
  }
@@ -36720,7 +36593,7 @@ this.Twilio.Conversations = (function (exports) {
36720
36593
  }));
36721
36594
 
36722
36595
  case 7:
36723
- throw new Error('Media Content Service is unavailable');
36596
+ throw new Error("Media Content Service is unavailable");
36724
36597
 
36725
36598
  case 8:
36726
36599
  case "end":
@@ -36747,8 +36620,8 @@ this.Twilio.Conversations = (function (exports) {
36747
36620
  while (1) {
36748
36621
  switch (_context7.prev = _context7.next) {
36749
36622
  case 0:
36750
- messagesReceiptsUrl = this.configuration.links.messagesReceipts.replace('%s', this.conversation.sid).replace('%s', this.sid);
36751
- url = new UriBuilder$1(messagesReceiptsUrl).arg('PageToken', options === null || options === void 0 ? void 0 : options.pageToken).arg('PageSize', options === null || options === void 0 ? void 0 : options.pageSize).build();
36623
+ messagesReceiptsUrl = this.configuration.links.messagesReceipts.replace("%s", this.conversation.sid).replace("%s", this.sid);
36624
+ url = new UriBuilder$1(messagesReceiptsUrl).arg("PageToken", options === null || options === void 0 ? void 0 : options.pageToken).arg("PageSize", options === null || options === void 0 ? void 0 : options.pageSize).build();
36752
36625
  _context7.next = 4;
36753
36626
  return this.services.network.get(url);
36754
36627
 
@@ -36782,20 +36655,20 @@ this.Twilio.Conversations = (function (exports) {
36782
36655
  return Message;
36783
36656
  }(ReplayEventEmitter_1);
36784
36657
 
36785
- _defineProperty$3(Message, "updated", 'updated');
36658
+ _defineProperty$3(Message, "updated", "updated");
36786
36659
 
36787
- __decorate$1([validateTypes_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailBody", null);
36660
+ __decorate$1([validateTypes_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailBody", null);
36788
36661
 
36789
- __decorate$1([validateTypes_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailHistory", null);
36662
+ __decorate$1([validateTypes_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Media)], Message.prototype, "getEmailHistory", null);
36790
36663
 
36791
- __decorate$1([validateTypesAsync_1('string'), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Message.prototype, "updateBody", null);
36664
+ __decorate$1([validateTypesAsync_1("string"), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Message.prototype, "updateBody", null);
36792
36665
 
36793
36666
  __decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Message.prototype, "updateAttributes", null);
36794
36667
 
36795
36668
  __decorate$1([validateTypesAsync_1(custom_1(function (value) {
36796
36669
  return [value instanceof Array && value.length > 0 && value.reduce(function (a, c) {
36797
36670
  return a && c instanceof Media;
36798
- }, true), 'a non-empty array of Media'];
36671
+ }, true), "a non-empty array of Media"];
36799
36672
  })), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Array]), __metadata$1("design:returntype", Promise)], Message.prototype, "attachTemporaryUrlsFor", null);
36800
36673
 
36801
36674
  function _createForOfIteratorHelper$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -36807,7 +36680,7 @@ this.Twilio.Conversations = (function (exports) {
36807
36680
  function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
36808
36681
 
36809
36682
  function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
36810
- var log$4 = Logger.scope('Messages');
36683
+ var log$4 = Logger.scope("Messages");
36811
36684
  /**
36812
36685
  * Represents the collection of messages in a conversation
36813
36686
  */
@@ -36857,7 +36730,7 @@ this.Twilio.Conversations = (function (exports) {
36857
36730
  case 2:
36858
36731
  this.messagesListPromise = this.services.syncClient.list({
36859
36732
  id: name,
36860
- mode: 'open_existing'
36733
+ mode: "open_existing"
36861
36734
  });
36862
36735
  _context.prev = 3;
36863
36736
  _context.next = 6;
@@ -36865,7 +36738,7 @@ this.Twilio.Conversations = (function (exports) {
36865
36738
 
36866
36739
  case 6:
36867
36740
  list = _context.sent;
36868
- list.on('itemAdded', function (args) {
36741
+ list.on("itemAdded", function (args) {
36869
36742
  log$4.debug("".concat(_this2.conversation.sid, " itemAdded: ").concat(args.item.index));
36870
36743
  var links = {
36871
36744
  self: "".concat(_this2.conversation.links.messages, "/").concat(args.item.data.sid),
@@ -36875,33 +36748,37 @@ this.Twilio.Conversations = (function (exports) {
36875
36748
  var message = new Message(args.item.index, args.item.data, _this2.conversation, links, _this2.configuration, _this2.services);
36876
36749
 
36877
36750
  if (_this2.messagesByIndex.has(message.index)) {
36878
- log$4.debug('Message arrived, but is already known and ignored', _this2.conversation.sid, message.index);
36751
+ log$4.debug("Message arrived, but is already known and ignored", _this2.conversation.sid, message.index);
36879
36752
  return;
36880
36753
  }
36881
36754
 
36882
36755
  _this2.messagesByIndex.set(message.index, message);
36883
36756
 
36884
- message.on('updated', function (args) {
36885
- return _this2.emit('messageUpdated', args);
36757
+ message.on("updated", function (args) {
36758
+ return _this2.emit("messageUpdated", args);
36886
36759
  });
36887
36760
 
36888
- _this2.emit('messageAdded', message);
36761
+ _this2.emit("messageAdded", message);
36889
36762
  });
36890
- list.on('itemRemoved', function (args) {
36763
+ list.on("itemRemoved", function (args) {
36891
36764
  log$4.debug("#{this.conversation.sid} itemRemoved: ".concat(args.index));
36892
36765
  var index = args.index;
36893
36766
 
36894
36767
  if (_this2.messagesByIndex.has(index)) {
36895
36768
  var message = _this2.messagesByIndex.get(index);
36896
36769
 
36770
+ if (!message) {
36771
+ return;
36772
+ }
36773
+
36897
36774
  _this2.messagesByIndex.delete(message.index);
36898
36775
 
36899
- message.removeAllListeners('updated');
36776
+ message.removeAllListeners("updated");
36900
36777
 
36901
- _this2.emit('messageRemoved', message);
36778
+ _this2.emit("messageRemoved", message);
36902
36779
  }
36903
36780
  });
36904
- list.on('itemUpdated', function (args) {
36781
+ list.on("itemUpdated", function (args) {
36905
36782
  log$4.debug("".concat(_this2.conversation.sid, " itemUpdated: ").concat(args.item.index));
36906
36783
 
36907
36784
  var message = _this2.messagesByIndex.get(args.item.index);
@@ -36917,11 +36794,11 @@ this.Twilio.Conversations = (function (exports) {
36917
36794
  _context.t0 = _context["catch"](3);
36918
36795
  this.messagesListPromise = null;
36919
36796
 
36920
- if (this.services.syncClient.connectionState !== 'disconnected') {
36921
- log$4.error('Failed to get messages object for conversation', this.conversation.sid, _context.t0);
36797
+ if (this.services.syncClient.connectionState !== "disconnected") {
36798
+ log$4.error("Failed to get messages object for conversation", this.conversation.sid, _context.t0);
36922
36799
  }
36923
36800
 
36924
- log$4.debug('ERROR: Failed to get messages object for conversation', this.conversation.sid, _context.t0);
36801
+ log$4.debug("ERROR: Failed to get messages object for conversation", this.conversation.sid, _context.t0);
36925
36802
  throw _context.t0;
36926
36803
 
36927
36804
  case 19:
@@ -36989,13 +36866,13 @@ this.Twilio.Conversations = (function (exports) {
36989
36866
  var _sendV = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(message) {
36990
36867
  var _message$emailOptions;
36991
36868
 
36992
- var media, _iterator, _step, _step$value, category, mediaContent;
36869
+ var media, _iterator, _step, _mediaContent$content, _mediaContent$media, _step$value, category, mediaContent;
36993
36870
 
36994
36871
  return _regeneratorRuntime$1.wrap(function _callee3$(_context3) {
36995
36872
  while (1) {
36996
36873
  switch (_context3.prev = _context3.next) {
36997
36874
  case 0:
36998
- log$4.debug('Sending message V2', message.mediaContent, message.attributes, message.emailOptions);
36875
+ log$4.debug("Sending message V2", message.mediaContent, message.attributes, message.emailOptions);
36999
36876
  media = [];
37000
36877
  _iterator = _createForOfIteratorHelper$2(message.mediaContent);
37001
36878
  _context3.prev = 3;
@@ -37009,7 +36886,7 @@ this.Twilio.Conversations = (function (exports) {
37009
36886
  }
37010
36887
 
37011
36888
  _step$value = _slicedToArray$1(_step.value, 2), category = _step$value[0], mediaContent = _step$value[1];
37012
- log$4.debug("Adding media to a message as ".concat(mediaContent instanceof FormData ? 'FormData' : 'SendMediaOptions'), mediaContent);
36889
+ log$4.debug("Adding media to a message as ".concat(mediaContent instanceof FormData ? "FormData" : "SendMediaOptions"), mediaContent);
37013
36890
  _context3.t0 = media;
37014
36891
 
37015
36892
  if (!(mediaContent instanceof FormData)) {
@@ -37027,7 +36904,7 @@ this.Twilio.Conversations = (function (exports) {
37027
36904
 
37028
36905
  case 15:
37029
36906
  _context3.next = 17;
37030
- return this.services.mcsClient.post(mediaContent.contentType, mediaContent.media, category, mediaContent.filename);
36907
+ return this.services.mcsClient.post((_mediaContent$content = mediaContent.contentType) !== null && _mediaContent$content !== void 0 ? _mediaContent$content : "", (_mediaContent$media = mediaContent.media) !== null && _mediaContent$media !== void 0 ? _mediaContent$media : "", category, mediaContent.filename);
37031
36908
 
37032
36909
  case 17:
37033
36910
  _context3.t1 = _context3.sent;
@@ -37060,13 +36937,13 @@ this.Twilio.Conversations = (function (exports) {
37060
36937
 
37061
36938
  case 30:
37062
36939
  _context3.next = 32;
37063
- return this.services.commandExecutor.mutateResource('post', this.conversation.links.messages, {
36940
+ return this.services.commandExecutor.mutateResource("post", this.conversation.links.messages, {
37064
36941
  body: message.text,
37065
36942
  subject: (_message$emailOptions = message.emailOptions) === null || _message$emailOptions === void 0 ? void 0 : _message$emailOptions.subject,
37066
36943
  media_sids: media.map(function (m) {
37067
36944
  return m.sid;
37068
36945
  }),
37069
- attributes: typeof message.attributes !== 'undefined' ? JSON.stringify(message.attributes) : undefined
36946
+ attributes: typeof message.attributes !== "undefined" ? JSON.stringify(message.attributes) : undefined
37070
36947
  });
37071
36948
 
37072
36949
  case 32:
@@ -37107,11 +36984,11 @@ this.Twilio.Conversations = (function (exports) {
37107
36984
  case 0:
37108
36985
  attributes = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
37109
36986
  emailOptions = _args4.length > 2 ? _args4[2] : undefined;
37110
- log$4.debug('Sending text message', message, attributes, emailOptions);
36987
+ log$4.debug("Sending text message", message, attributes, emailOptions);
37111
36988
  _context4.next = 5;
37112
- return this.services.commandExecutor.mutateResource('post', this.conversation.links.messages, {
37113
- body: message !== null && message !== void 0 ? message : '',
37114
- attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined,
36989
+ return this.services.commandExecutor.mutateResource("post", this.conversation.links.messages, {
36990
+ body: message !== null && message !== void 0 ? message : "",
36991
+ attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined,
37115
36992
  subject: emailOptions === null || emailOptions === void 0 ? void 0 : emailOptions.subject
37116
36993
  });
37117
36994
 
@@ -37144,6 +37021,8 @@ this.Twilio.Conversations = (function (exports) {
37144
37021
  key: "sendMedia",
37145
37022
  value: function () {
37146
37023
  var _sendMedia = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(mediaContent) {
37024
+ var _mediaContent$content2, _mediaContent$media2;
37025
+
37147
37026
  var attributes,
37148
37027
  emailOptions,
37149
37028
  media,
@@ -37154,8 +37033,8 @@ this.Twilio.Conversations = (function (exports) {
37154
37033
  case 0:
37155
37034
  attributes = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
37156
37035
  emailOptions = _args5.length > 2 ? _args5[2] : undefined;
37157
- log$4.debug('Sending media message', mediaContent, attributes, emailOptions);
37158
- log$4.debug("Sending media message as ".concat(mediaContent instanceof FormData ? 'FormData' : 'SendMediaOptions'), mediaContent, attributes);
37036
+ log$4.debug("Sending media message", mediaContent, attributes, emailOptions);
37037
+ log$4.debug("Sending media message as ".concat(mediaContent instanceof FormData ? "FormData" : "SendMediaOptions"), mediaContent, attributes);
37159
37038
 
37160
37039
  if (!(mediaContent instanceof FormData)) {
37161
37040
  _context5.next = 10;
@@ -37172,7 +37051,7 @@ this.Twilio.Conversations = (function (exports) {
37172
37051
 
37173
37052
  case 10:
37174
37053
  _context5.next = 12;
37175
- return this.services.mcsClient.post(mediaContent.contentType, mediaContent.media, 'media', mediaContent.filename);
37054
+ return this.services.mcsClient.post((_mediaContent$content2 = mediaContent.contentType) !== null && _mediaContent$content2 !== void 0 ? _mediaContent$content2 : "", (_mediaContent$media2 = mediaContent.media) !== null && _mediaContent$media2 !== void 0 ? _mediaContent$media2 : "", "media", mediaContent.filename);
37176
37055
 
37177
37056
  case 12:
37178
37057
  _context5.t0 = _context5.sent;
@@ -37180,9 +37059,9 @@ this.Twilio.Conversations = (function (exports) {
37180
37059
  case 13:
37181
37060
  media = _context5.t0;
37182
37061
  _context5.next = 16;
37183
- return this.services.commandExecutor.mutateResource('post', this.conversation.links.messages, {
37062
+ return this.services.commandExecutor.mutateResource("post", this.conversation.links.messages, {
37184
37063
  media_sids: [media.sid],
37185
- attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined
37064
+ attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
37186
37065
  });
37187
37066
 
37188
37067
  case 16:
@@ -37220,7 +37099,7 @@ this.Twilio.Conversations = (function (exports) {
37220
37099
  while (1) {
37221
37100
  switch (_context6.prev = _context6.next) {
37222
37101
  case 0:
37223
- direction = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : 'backwards';
37102
+ direction = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : "backwards";
37224
37103
  return _context6.abrupt("return", this._getMessages(pageSize, anchor, direction));
37225
37104
 
37226
37105
  case 2:
@@ -37244,7 +37123,7 @@ this.Twilio.Conversations = (function (exports) {
37244
37123
 
37245
37124
  // Due to an inconsistency between Sync and Chat conventions, next and
37246
37125
  // previous pages should be swapped.
37247
- var shouldReverse = order === 'desc';
37126
+ var shouldReverse = order === "desc";
37248
37127
 
37249
37128
  var nextPage = function nextPage() {
37250
37129
  return page.nextPage().then(function (page) {
@@ -37288,8 +37167,8 @@ this.Twilio.Conversations = (function (exports) {
37288
37167
  };
37289
37168
  var message = new Message(index, value, this.conversation, links, this.configuration, this.services);
37290
37169
  this.messagesByIndex.set(message.index, message);
37291
- message.on('updated', function (args) {
37292
- return _this4.emit('messageUpdated', args);
37170
+ message.on("updated", function (args) {
37171
+ return _this4.emit("messageUpdated", args);
37293
37172
  });
37294
37173
  return message;
37295
37174
  }
@@ -37320,17 +37199,17 @@ this.Twilio.Conversations = (function (exports) {
37320
37199
  switch (_context7.prev = _context7.next) {
37321
37200
  case 0:
37322
37201
  pageSize = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : 30;
37323
- anchor = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : 'end';
37324
- direction = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : 'forward';
37325
- order = direction === 'backwards' ? 'desc' : 'asc';
37202
+ anchor = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : "end";
37203
+ direction = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : "forward";
37204
+ order = direction === "backwards" ? "desc" : "asc";
37326
37205
  _context7.next = 6;
37327
37206
  return this.messagesListPromise;
37328
37207
 
37329
37208
  case 6:
37330
37209
  list = _context7.sent;
37331
37210
  _context7.next = 9;
37332
- return list.getItems({
37333
- from: anchor !== 'end' ? anchor : void 0,
37211
+ return list === null || list === void 0 ? void 0 : list.getItems({
37212
+ from: anchor !== "end" ? anchor : void 0,
37334
37213
  pageSize: pageSize,
37335
37214
  order: order,
37336
37215
  limit: pageSize // @todo Limit equals pageSize by default in Sync. This is probably not ideal.
@@ -37522,19 +37401,19 @@ this.Twilio.Conversations = (function (exports) {
37522
37401
  }, {
37523
37402
  key: "addMedia",
37524
37403
  value: function addMedia(payload) {
37525
- if (typeof FormData === 'undefined' && payload instanceof FormData) {
37526
- throw new Error('Could not add FormData content whilst not in a browser');
37404
+ if (typeof FormData === "undefined" && payload instanceof FormData) {
37405
+ throw new Error("Could not add FormData content whilst not in a browser");
37527
37406
  }
37528
37407
 
37529
37408
  if (!(payload instanceof FormData)) {
37530
37409
  var mediaOptions = payload;
37531
37410
 
37532
37411
  if (!mediaOptions.contentType || !mediaOptions.media) {
37533
- throw new Error('Media content in SendMediaOptions must contain non-empty contentType and media');
37412
+ throw new Error("Media content in SendMediaOptions must contain non-empty contentType and media");
37534
37413
  }
37535
37414
  }
37536
37415
 
37537
- this.message.mediaContent.push(['media', payload]);
37416
+ this.message.mediaContent.push(["media", payload]);
37538
37417
  return this;
37539
37418
  }
37540
37419
  /**
@@ -37572,18 +37451,18 @@ this.Twilio.Conversations = (function (exports) {
37572
37451
 
37573
37452
 
37574
37453
  this.emailBodies.forEach(function (body) {
37575
- _this.message.mediaContent.push(['body', body]);
37454
+ _this.message.mediaContent.push(["body", body]);
37576
37455
  });
37577
37456
  this.emailHistories.forEach(function (history) {
37578
- _this.message.mediaContent.push(['history', history]);
37457
+ _this.message.mediaContent.push(["history", history]);
37579
37458
  });
37580
37459
  return this.message;
37581
37460
  }
37582
37461
  }, {
37583
37462
  key: "getPayloadContentType",
37584
37463
  value: function getPayloadContentType(payload) {
37585
- if (typeof FormData !== 'undefined' && payload instanceof FormData) {
37586
- return payload.get('Content-Type');
37464
+ if (typeof FormData !== "undefined" && payload instanceof FormData) {
37465
+ return payload.get("Content-Type");
37587
37466
  }
37588
37467
 
37589
37468
  return payload.contentType;
@@ -37602,21 +37481,21 @@ this.Twilio.Conversations = (function (exports) {
37602
37481
  function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
37603
37482
 
37604
37483
  function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37605
- var log$3 = Logger.scope('Conversation');
37484
+ var log$3 = Logger.scope("Conversation");
37606
37485
  var fieldMappings = {
37607
- lastMessage: 'lastMessage',
37608
- attributes: 'attributes',
37609
- createdBy: 'createdBy',
37610
- dateCreated: 'dateCreated',
37611
- dateUpdated: 'dateUpdated',
37612
- friendlyName: 'friendlyName',
37613
- lastConsumedMessageIndex: 'lastConsumedMessageIndex',
37614
- notificationLevel: 'notificationLevel',
37615
- sid: 'sid',
37616
- status: 'status',
37617
- uniqueName: 'uniqueName',
37618
- state: 'state',
37619
- bindings: 'bindings'
37486
+ lastMessage: "lastMessage",
37487
+ attributes: "attributes",
37488
+ createdBy: "createdBy",
37489
+ dateCreated: "dateCreated",
37490
+ dateUpdated: "dateUpdated",
37491
+ friendlyName: "friendlyName",
37492
+ lastConsumedMessageIndex: "lastConsumedMessageIndex",
37493
+ notificationLevel: "notificationLevel",
37494
+ sid: "sid",
37495
+ status: "status",
37496
+ uniqueName: "uniqueName",
37497
+ state: "state",
37498
+ bindings: "bindings"
37620
37499
  };
37621
37500
 
37622
37501
  function parseTime(timeString) {
@@ -37666,13 +37545,13 @@ this.Twilio.Conversations = (function (exports) {
37666
37545
  try {
37667
37546
  JSON.stringify(attributes);
37668
37547
  } catch (e) {
37669
- throw new Error('Attributes must be a valid JSON object.');
37548
+ throw new Error("Attributes must be a valid JSON object.");
37670
37549
  }
37671
37550
 
37672
37551
  _this.entityName = descriptor.channel;
37673
37552
  _this.channelState = {
37674
37553
  uniqueName: uniqueName,
37675
- status: 'notParticipating',
37554
+ status: "notParticipating",
37676
37555
  attributes: attributes,
37677
37556
  createdBy: createdBy,
37678
37557
  dateCreated: dateCreated,
@@ -37692,25 +37571,31 @@ this.Twilio.Conversations = (function (exports) {
37692
37571
  _this.participants = new Map();
37693
37572
  _this.participantsEntity = new Participants(_assertThisInitialized$3(_this), _this.participants, participantsLinks, _this.configuration, _this.services);
37694
37573
 
37695
- _this.participantsEntity.on('participantJoined', _this.emit.bind(_assertThisInitialized$3(_this), 'participantJoined'));
37574
+ _this.participantsEntity.on("participantJoined", function (participant) {
37575
+ return _this.emit("participantJoined", participant);
37576
+ });
37696
37577
 
37697
- _this.participantsEntity.on('participantLeft', _this.emit.bind(_assertThisInitialized$3(_this), 'participantLeft'));
37578
+ _this.participantsEntity.on("participantLeft", function (participant) {
37579
+ return _this.emit("participantLeft", participant);
37580
+ });
37698
37581
 
37699
- _this.participantsEntity.on('participantUpdated', function (args) {
37700
- return _this.emit('participantUpdated', args);
37582
+ _this.participantsEntity.on("participantUpdated", function (args) {
37583
+ return _this.emit("participantUpdated", args);
37701
37584
  });
37702
37585
 
37703
37586
  _this.messagesEntity = new Messages(_assertThisInitialized$3(_this), configuration, services);
37704
37587
 
37705
- _this.messagesEntity.on('messageAdded', function (message) {
37588
+ _this.messagesEntity.on("messageAdded", function (message) {
37706
37589
  return _this._onMessageAdded(message);
37707
37590
  });
37708
37591
 
37709
- _this.messagesEntity.on('messageUpdated', function (args) {
37710
- return _this.emit('messageUpdated', args);
37592
+ _this.messagesEntity.on("messageUpdated", function (args) {
37593
+ return _this.emit("messageUpdated", args);
37711
37594
  });
37712
37595
 
37713
- _this.messagesEntity.on('messageRemoved', _this.emit.bind(_assertThisInitialized$3(_this), 'messageRemoved'));
37596
+ _this.messagesEntity.on("messageRemoved", function (message) {
37597
+ return _this.emit("messageRemoved", message);
37598
+ });
37714
37599
 
37715
37600
  return _this;
37716
37601
  }
@@ -37775,7 +37660,9 @@ this.Twilio.Conversations = (function (exports) {
37775
37660
  }, {
37776
37661
  key: "createdBy",
37777
37662
  get: function get() {
37778
- return this.channelState.createdBy;
37663
+ var _this$channelState$cr;
37664
+
37665
+ return (_this$channelState$cr = this.channelState.createdBy) !== null && _this$channelState$cr !== void 0 ? _this$channelState$cr : "";
37779
37666
  }
37780
37667
  /**
37781
37668
  * Custom attributes of the conversation.
@@ -37802,7 +37689,9 @@ this.Twilio.Conversations = (function (exports) {
37802
37689
  }, {
37803
37690
  key: "lastMessage",
37804
37691
  get: function get() {
37805
- return this.channelState.lastMessage;
37692
+ var _this$channelState$la;
37693
+
37694
+ return (_this$channelState$la = this.channelState.lastMessage) !== null && _this$channelState$la !== void 0 ? _this$channelState$la : undefined;
37806
37695
  }
37807
37696
  /**
37808
37697
  * User notification level for this conversation.
@@ -37811,7 +37700,9 @@ this.Twilio.Conversations = (function (exports) {
37811
37700
  }, {
37812
37701
  key: "notificationLevel",
37813
37702
  get: function get() {
37814
- return this.channelState.notificationLevel;
37703
+ var _this$channelState$no;
37704
+
37705
+ return (_this$channelState$no = this.channelState.notificationLevel) !== null && _this$channelState$no !== void 0 ? _this$channelState$no : "default";
37815
37706
  }
37816
37707
  }, {
37817
37708
  key: "bindings",
@@ -37846,16 +37737,16 @@ this.Twilio.Conversations = (function (exports) {
37846
37737
 
37847
37738
  return this.entityPromise = (_this$entityPromise = this.entityPromise) !== null && _this$entityPromise !== void 0 ? _this$entityPromise : this.services.syncClient.document({
37848
37739
  id: this.entityName,
37849
- mode: 'open_existing'
37740
+ mode: "open_existing"
37850
37741
  }).then(function (entity) {
37851
37742
  _this2.entity = entity;
37852
37743
 
37853
- _this2.entity.on('updated', function (args) {
37744
+ _this2.entity.on("updated", function (args) {
37854
37745
  _this2._update(args.data);
37855
37746
  });
37856
37747
 
37857
- _this2.entity.on('removed', function () {
37858
- return _this2.emit('removed', _this2);
37748
+ _this2.entity.on("removed", function () {
37749
+ return _this2.emit("removed", _this2);
37859
37750
  });
37860
37751
 
37861
37752
  _this2._update(_this2.entity.data);
@@ -37865,11 +37756,11 @@ this.Twilio.Conversations = (function (exports) {
37865
37756
  _this2.entity = null;
37866
37757
  _this2.entityPromise = null;
37867
37758
 
37868
- if (_this2.services.syncClient.connectionState != 'disconnected') {
37869
- log$3.error('Failed to get conversation object', err);
37759
+ if (_this2.services.syncClient.connectionState != "disconnected") {
37760
+ log$3.error("Failed to get conversation object", err);
37870
37761
  }
37871
37762
 
37872
- log$3.debug('ERROR: Failed to get conversation object', err);
37763
+ log$3.debug("ERROR: Failed to get conversation object", err);
37873
37764
  throw err;
37874
37765
  });
37875
37766
  }
@@ -37884,7 +37775,8 @@ this.Twilio.Conversations = (function (exports) {
37884
37775
  key: "_subscribeStreams",
37885
37776
  value: function () {
37886
37777
  var _subscribeStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
37887
- var messagesObjectName, rosterObjectName;
37778
+ var _this$entity, _this$entity2, _this$entity3, messagesObjectName, rosterObjectName;
37779
+
37888
37780
  return _regeneratorRuntime$1.wrap(function _callee$(_context) {
37889
37781
  while (1) {
37890
37782
  switch (_context.prev = _context.next) {
@@ -37894,9 +37786,9 @@ this.Twilio.Conversations = (function (exports) {
37894
37786
  return this._subscribe();
37895
37787
 
37896
37788
  case 3:
37897
- log$3.trace('_subscribeStreams, this.entity.data=', this.entity.data);
37898
- messagesObjectName = this.entity.data.messages;
37899
- rosterObjectName = this.entity.data.roster;
37789
+ log$3.trace("_subscribeStreams, this.entity.data=", (_this$entity = this.entity) === null || _this$entity === void 0 ? void 0 : _this$entity.data);
37790
+ messagesObjectName = (_this$entity2 = this.entity) === null || _this$entity2 === void 0 ? void 0 : _this$entity2.data.messages;
37791
+ rosterObjectName = (_this$entity3 = this.entity) === null || _this$entity3 === void 0 ? void 0 : _this$entity3.data.roster;
37900
37792
  _context.next = 8;
37901
37793
  return Promise.all([this.messagesEntity.subscribe(messagesObjectName), this.participantsEntity.subscribe(rosterObjectName)]);
37902
37794
 
@@ -37908,11 +37800,11 @@ this.Twilio.Conversations = (function (exports) {
37908
37800
  _context.prev = 10;
37909
37801
  _context.t0 = _context["catch"](0);
37910
37802
 
37911
- if (this.services.syncClient.connectionState !== 'disconnected') {
37912
- log$3.error('Failed to subscribe on conversation objects', this.sid, _context.t0);
37803
+ if (this.services.syncClient.connectionState !== "disconnected") {
37804
+ log$3.error("Failed to subscribe on conversation objects", this.sid, _context.t0);
37913
37805
  }
37914
37806
 
37915
- log$3.debug('ERROR: Failed to subscribe on conversation objects', this.sid, _context.t0);
37807
+ log$3.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context.t0);
37916
37808
  throw _context.t0;
37917
37809
 
37918
37810
  case 15:
@@ -37989,19 +37881,19 @@ this.Twilio.Conversations = (function (exports) {
37989
37881
 
37990
37882
  this.channelState.status = status;
37991
37883
 
37992
- if (status === 'joined') {
37884
+ if (status === "joined") {
37993
37885
  this._subscribeStreams().catch(function (err) {
37994
- log$3.debug('ERROR while setting conversation status ' + status, err);
37886
+ log$3.debug("ERROR while setting conversation status " + status, err);
37995
37887
 
37996
- if (_this3.services.syncClient.connectionState !== 'disconnected') {
37888
+ if (_this3.services.syncClient.connectionState !== "disconnected") {
37997
37889
  throw err;
37998
37890
  }
37999
37891
  });
38000
37892
  } else if (this.entityPromise) {
38001
37893
  this._unsubscribe().catch(function (err) {
38002
- log$3.debug('ERROR while setting conversation status ' + status, err);
37894
+ log$3.debug("ERROR while setting conversation status " + status, err);
38003
37895
 
38004
- if (_this3.services.syncClient.connectionState !== 'disconnected') {
37896
+ if (_this3.services.syncClient.connectionState !== "disconnected") {
38005
37897
  throw err;
38006
37898
  }
38007
37899
  });
@@ -38025,9 +37917,9 @@ this.Twilio.Conversations = (function (exports) {
38025
37917
  * @internal
38026
37918
  */
38027
37919
  function _update(update) {
38028
- var _update$lastMessage, _update$lastMessage2, _this$channelState$la, _this$channelState$la2, _this$channelState$lo;
37920
+ var _update$lastMessage, _update$lastMessage2, _this$channelState$la2, _this$channelState$la3, _this$channelState$lo;
38029
37921
 
38030
- log$3.trace('_update', update);
37922
+ log$3.trace("_update", update);
38031
37923
  Conversation.preprocessUpdate(update, this.sid);
38032
37924
  var updateReasons = new Set();
38033
37925
 
@@ -38041,7 +37933,7 @@ this.Twilio.Conversations = (function (exports) {
38041
37933
 
38042
37934
  switch (localKey) {
38043
37935
  case fieldMappings.status:
38044
- if (!update.status || update.status === 'unknown' || this.channelState.status === update.status) {
37936
+ if (!update.status || update.status === "unknown" || this.channelState.status === update.status) {
38045
37937
  break;
38046
37938
  }
38047
37939
 
@@ -38064,7 +37956,7 @@ this.Twilio.Conversations = (function (exports) {
38064
37956
  }
38065
37957
 
38066
37958
  this.channelState.lastReadMessageIndex = update.lastConsumedMessageIndex;
38067
- updateReasons.add('lastReadMessageIndex');
37959
+ updateReasons.add("lastReadMessageIndex");
38068
37960
  break;
38069
37961
 
38070
37962
  case fieldMappings.lastMessage:
@@ -38081,7 +37973,7 @@ this.Twilio.Conversations = (function (exports) {
38081
37973
  updateReasons.add(localKey);
38082
37974
  }
38083
37975
 
38084
- if (((_update$lastMessage2 = update.lastMessage) === null || _update$lastMessage2 === void 0 ? void 0 : _update$lastMessage2.timestamp) !== undefined && ((_this$channelState$la = this.channelState.lastMessage) === null || _this$channelState$la === void 0 ? void 0 : (_this$channelState$la2 = _this$channelState$la.dateCreated) === null || _this$channelState$la2 === void 0 ? void 0 : _this$channelState$la2.getTime()) !== update.lastMessage.timestamp.getTime()) {
37976
+ if (((_update$lastMessage2 = update.lastMessage) === null || _update$lastMessage2 === void 0 ? void 0 : _update$lastMessage2.timestamp) !== undefined && ((_this$channelState$la2 = this.channelState.lastMessage) === null || _this$channelState$la2 === void 0 ? void 0 : (_this$channelState$la3 = _this$channelState$la2.dateCreated) === null || _this$channelState$la3 === void 0 ? void 0 : _this$channelState$la3.getTime()) !== update.lastMessage.timestamp.getTime()) {
38085
37977
  this.channelState.lastMessage.dateCreated = update.lastMessage.timestamp;
38086
37978
  updateReasons.add(localKey);
38087
37979
  }
@@ -38131,7 +38023,7 @@ this.Twilio.Conversations = (function (exports) {
38131
38023
  }
38132
38024
 
38133
38025
  if (updateReasons.size > 0) {
38134
- this.emit('updated', {
38026
+ this.emit("updated", {
38135
38027
  conversation: this,
38136
38028
  updateReasons: _toConsumableArray(updateReasons)
38137
38029
  });
@@ -38163,7 +38055,7 @@ this.Twilio.Conversations = (function (exports) {
38163
38055
  _iterator.f();
38164
38056
  }
38165
38057
 
38166
- this.emit('messageAdded', message);
38058
+ this.emit("messageAdded", message);
38167
38059
  }
38168
38060
  }, {
38169
38061
  key: "_setLastReadMessageIndex",
@@ -38175,7 +38067,7 @@ this.Twilio.Conversations = (function (exports) {
38175
38067
  switch (_context3.prev = _context3.next) {
38176
38068
  case 0:
38177
38069
  _context3.next = 2;
38178
- return this.services.commandExecutor.mutateResource('post', "".concat(this.configuration.links.myConversations, "/").concat(this.sid), {
38070
+ return this.services.commandExecutor.mutateResource("post", "".concat(this.configuration.links.myConversations, "/").concat(this.sid), {
38179
38071
  last_read_message_index: index
38180
38072
  });
38181
38073
 
@@ -38284,7 +38176,7 @@ this.Twilio.Conversations = (function (exports) {
38284
38176
  return this._subscribeStreams();
38285
38177
 
38286
38178
  case 2:
38287
- if (!(index < this.lastReadMessageIndex)) {
38179
+ if (!(index < (this.lastReadMessageIndex || 0))) {
38288
38180
  _context6.next = 6;
38289
38181
  break;
38290
38182
  }
@@ -38329,7 +38221,7 @@ this.Twilio.Conversations = (function (exports) {
38329
38221
  switch (_context7.prev = _context7.next) {
38330
38222
  case 0:
38331
38223
  _context7.next = 2;
38332
- return this.services.commandExecutor.mutateResource('delete', this.links.self);
38224
+ return this.services.commandExecutor.mutateResource("delete", this.links.self);
38333
38225
 
38334
38226
  case 2:
38335
38227
  return _context7.abrupt("return", this);
@@ -38464,6 +38356,8 @@ this.Twilio.Conversations = (function (exports) {
38464
38356
  key: "getParticipantsCount",
38465
38357
  value: function () {
38466
38358
  var _getParticipantsCount = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee11() {
38359
+ var _response$body$partic;
38360
+
38467
38361
  var url, response;
38468
38362
  return _regeneratorRuntime$1.wrap(function _callee11$(_context11) {
38469
38363
  while (1) {
@@ -38475,7 +38369,7 @@ this.Twilio.Conversations = (function (exports) {
38475
38369
 
38476
38370
  case 3:
38477
38371
  response = _context11.sent;
38478
- return _context11.abrupt("return", response.body.participants_count);
38372
+ return _context11.abrupt("return", (_response$body$partic = response.body.participants_count) !== null && _response$body$partic !== void 0 ? _response$body$partic : 0);
38479
38373
 
38480
38374
  case 5:
38481
38375
  case "end":
@@ -38528,14 +38422,17 @@ this.Twilio.Conversations = (function (exports) {
38528
38422
  }, {
38529
38423
  key: "getParticipantByIdentity",
38530
38424
  value: function () {
38531
- var _getParticipantByIdentity = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee13(identity) {
38425
+ var _getParticipantByIdentity = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee13() {
38426
+ var identity,
38427
+ _args13 = arguments;
38532
38428
  return _regeneratorRuntime$1.wrap(function _callee13$(_context13) {
38533
38429
  while (1) {
38534
38430
  switch (_context13.prev = _context13.next) {
38535
38431
  case 0:
38536
- return _context13.abrupt("return", this.participantsEntity.getParticipantByIdentity(identity));
38432
+ identity = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : "";
38433
+ return _context13.abrupt("return", this.participantsEntity.getParticipantByIdentity(identity !== null && identity !== void 0 ? identity : ""));
38537
38434
 
38538
- case 1:
38435
+ case 2:
38539
38436
  case "end":
38540
38437
  return _context13.stop();
38541
38438
  }
@@ -38543,7 +38440,7 @@ this.Twilio.Conversations = (function (exports) {
38543
38440
  }, _callee13, this);
38544
38441
  }));
38545
38442
 
38546
- function getParticipantByIdentity(_x11) {
38443
+ function getParticipantByIdentity() {
38547
38444
  return _getParticipantByIdentity.apply(this, arguments);
38548
38445
  }
38549
38446
 
@@ -38564,6 +38461,8 @@ this.Twilio.Conversations = (function (exports) {
38564
38461
  key: "getMessagesCount",
38565
38462
  value: function () {
38566
38463
  var _getMessagesCount = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee14() {
38464
+ var _response$body$messag;
38465
+
38567
38466
  var url, response;
38568
38467
  return _regeneratorRuntime$1.wrap(function _callee14$(_context14) {
38569
38468
  while (1) {
@@ -38575,7 +38474,7 @@ this.Twilio.Conversations = (function (exports) {
38575
38474
 
38576
38475
  case 3:
38577
38476
  response = _context14.sent;
38578
- return _context14.abrupt("return", response.body.messages_count);
38477
+ return _context14.abrupt("return", (_response$body$messag = response.body.messages_count) !== null && _response$body$messag !== void 0 ? _response$body$messag : 0);
38579
38478
 
38580
38479
  case 5:
38581
38480
  case "end":
@@ -38628,12 +38527,12 @@ this.Twilio.Conversations = (function (exports) {
38628
38527
  break;
38629
38528
  }
38630
38529
 
38631
- throw new Error('Conversation was not found in the user conversations list');
38530
+ throw new Error("Conversation was not found in the user conversations list");
38632
38531
 
38633
38532
  case 6:
38634
38533
  unreadMessageCount = response.body.unread_messages_count;
38635
38534
 
38636
- if (!(typeof unreadMessageCount === 'number')) {
38535
+ if (!(typeof unreadMessageCount === "number")) {
38637
38536
  _context15.next = 9;
38638
38537
  break;
38639
38538
  }
@@ -38670,7 +38569,7 @@ this.Twilio.Conversations = (function (exports) {
38670
38569
  switch (_context16.prev = _context16.next) {
38671
38570
  case 0:
38672
38571
  _context16.next = 2;
38673
- return this.services.commandExecutor.mutateResource('post', this.links.participants, {
38572
+ return this.services.commandExecutor.mutateResource("post", this.links.participants, {
38674
38573
  identity: this.configuration.userIdentity
38675
38574
  });
38676
38575
 
@@ -38703,13 +38602,13 @@ this.Twilio.Conversations = (function (exports) {
38703
38602
  while (1) {
38704
38603
  switch (_context17.prev = _context17.next) {
38705
38604
  case 0:
38706
- if (!(this.channelState.status === 'joined')) {
38605
+ if (!(this.channelState.status === "joined")) {
38707
38606
  _context17.next = 3;
38708
38607
  break;
38709
38608
  }
38710
38609
 
38711
38610
  _context17.next = 3;
38712
- return this.services.commandExecutor.mutateResource('delete', "".concat(this.links.participants, "/").concat(this.configuration.userIdentity));
38611
+ return this.services.commandExecutor.mutateResource("delete", "".concat(this.links.participants, "/").concat(this.configuration.userIdentity));
38713
38612
 
38714
38613
  case 3:
38715
38614
  return _context17.abrupt("return", this);
@@ -38734,6 +38633,9 @@ this.Twilio.Conversations = (function (exports) {
38734
38633
  * @param participant Identity, SID or the participant object to remove.
38735
38634
  */
38736
38635
 
38636
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
38637
+ // @ts-ignore TODO: fix validateTypesAsync typing
38638
+
38737
38639
  }, {
38738
38640
  key: "removeParticipant",
38739
38641
  value: function () {
@@ -38743,7 +38645,7 @@ this.Twilio.Conversations = (function (exports) {
38743
38645
  switch (_context18.prev = _context18.next) {
38744
38646
  case 0:
38745
38647
  _context18.next = 2;
38746
- return this.participantsEntity.remove(typeof participant === 'string' ? participant : participant.sid);
38648
+ return this.participantsEntity.remove(typeof participant === "string" ? participant : participant.sid);
38747
38649
 
38748
38650
  case 2:
38749
38651
  case "end":
@@ -38753,7 +38655,7 @@ this.Twilio.Conversations = (function (exports) {
38753
38655
  }, _callee18, this);
38754
38656
  }));
38755
38657
 
38756
- function removeParticipant(_x12) {
38658
+ function removeParticipant(_x11) {
38757
38659
  return _removeParticipant.apply(this, arguments);
38758
38660
  }
38759
38661
 
@@ -38772,13 +38674,15 @@ this.Twilio.Conversations = (function (exports) {
38772
38674
  key: "sendMessage",
38773
38675
  value: function () {
38774
38676
  var _sendMessage = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee19(message, messageAttributes, emailOptions) {
38775
- var _response, response;
38677
+ var _parseToNumber2;
38678
+
38679
+ var _parseToNumber, _response, response;
38776
38680
 
38777
38681
  return _regeneratorRuntime$1.wrap(function _callee19$(_context19) {
38778
38682
  while (1) {
38779
38683
  switch (_context19.prev = _context19.next) {
38780
38684
  case 0:
38781
- if (!(typeof message === 'string' || message === null)) {
38685
+ if (!(typeof message === "string" || message === null)) {
38782
38686
  _context19.next = 5;
38783
38687
  break;
38784
38688
  }
@@ -38788,7 +38692,7 @@ this.Twilio.Conversations = (function (exports) {
38788
38692
 
38789
38693
  case 3:
38790
38694
  _response = _context19.sent;
38791
- return _context19.abrupt("return", parseToNumber(_response.index));
38695
+ return _context19.abrupt("return", (_parseToNumber = parseToNumber(_response.index)) !== null && _parseToNumber !== void 0 ? _parseToNumber : 0);
38792
38696
 
38793
38697
  case 5:
38794
38698
  _context19.next = 7;
@@ -38796,7 +38700,7 @@ this.Twilio.Conversations = (function (exports) {
38796
38700
 
38797
38701
  case 7:
38798
38702
  response = _context19.sent;
38799
- return _context19.abrupt("return", parseToNumber(response.index));
38703
+ return _context19.abrupt("return", (_parseToNumber2 = parseToNumber(response.index)) !== null && _parseToNumber2 !== void 0 ? _parseToNumber2 : 0);
38800
38704
 
38801
38705
  case 9:
38802
38706
  case "end":
@@ -38806,7 +38710,7 @@ this.Twilio.Conversations = (function (exports) {
38806
38710
  }, _callee19, this);
38807
38711
  }));
38808
38712
 
38809
- function sendMessage(_x13, _x14, _x15) {
38713
+ function sendMessage(_x12, _x13, _x14) {
38810
38714
  return _sendMessage.apply(this, arguments);
38811
38715
  }
38812
38716
 
@@ -38922,7 +38826,7 @@ this.Twilio.Conversations = (function (exports) {
38922
38826
  switch (_context22.prev = _context22.next) {
38923
38827
  case 0:
38924
38828
  _context22.next = 2;
38925
- return this.services.commandExecutor.mutateResource('post', "".concat(this.configuration.links.myConversations, "/").concat(this.sid), {
38829
+ return this.services.commandExecutor.mutateResource("post", "".concat(this.configuration.links.myConversations, "/").concat(this.sid), {
38926
38830
  notification_level: notificationLevel
38927
38831
  });
38928
38832
 
@@ -38934,7 +38838,7 @@ this.Twilio.Conversations = (function (exports) {
38934
38838
  }, _callee22, this);
38935
38839
  }));
38936
38840
 
38937
- function setUserNotificationLevel(_x16) {
38841
+ function setUserNotificationLevel(_x15) {
38938
38842
  return _setUserNotificationLevel.apply(this, arguments);
38939
38843
  }
38940
38844
 
@@ -38964,7 +38868,7 @@ this.Twilio.Conversations = (function (exports) {
38964
38868
  switch (_context23.prev = _context23.next) {
38965
38869
  case 0:
38966
38870
  _context23.next = 2;
38967
- return this.services.commandExecutor.mutateResource('post', this.links.self, {
38871
+ return this.services.commandExecutor.mutateResource("post", this.links.self, {
38968
38872
  attributes: attributes !== undefined ? JSON.stringify(attributes) : undefined
38969
38873
  });
38970
38874
 
@@ -38979,7 +38883,7 @@ this.Twilio.Conversations = (function (exports) {
38979
38883
  }, _callee23, this);
38980
38884
  }));
38981
38885
 
38982
- function updateAttributes(_x17) {
38886
+ function updateAttributes(_x16) {
38983
38887
  return _updateAttributes.apply(this, arguments);
38984
38888
  }
38985
38889
 
@@ -39004,7 +38908,7 @@ this.Twilio.Conversations = (function (exports) {
39004
38908
  }
39005
38909
 
39006
38910
  _context24.next = 3;
39007
- return this.services.commandExecutor.mutateResource('post', this.links.self, {
38911
+ return this.services.commandExecutor.mutateResource("post", this.links.self, {
39008
38912
  friendly_name: friendlyName
39009
38913
  });
39010
38914
 
@@ -39019,7 +38923,7 @@ this.Twilio.Conversations = (function (exports) {
39019
38923
  }, _callee24, this);
39020
38924
  }));
39021
38925
 
39022
- function updateFriendlyName(_x18) {
38926
+ function updateFriendlyName(_x17) {
39023
38927
  return _updateFriendlyName.apply(this, arguments);
39024
38928
  }
39025
38929
 
@@ -39054,7 +38958,7 @@ this.Twilio.Conversations = (function (exports) {
39054
38958
  }, _callee25, this);
39055
38959
  }));
39056
38960
 
39057
- function updateLastReadMessageIndex(_x19) {
38961
+ function updateLastReadMessageIndex(_x18) {
39058
38962
  return _updateLastReadMessageIndex.apply(this, arguments);
39059
38963
  }
39060
38964
 
@@ -39079,11 +38983,11 @@ this.Twilio.Conversations = (function (exports) {
39079
38983
  }
39080
38984
 
39081
38985
  if (!uniqueName) {
39082
- uniqueName = '';
38986
+ uniqueName = "";
39083
38987
  }
39084
38988
 
39085
38989
  _context26.next = 4;
39086
- return this.services.commandExecutor.mutateResource('post', this.links.self, {
38990
+ return this.services.commandExecutor.mutateResource("post", this.links.self, {
39087
38991
  unique_name: uniqueName
39088
38992
  });
39089
38993
 
@@ -39098,7 +39002,7 @@ this.Twilio.Conversations = (function (exports) {
39098
39002
  }, _callee26, this);
39099
39003
  }));
39100
39004
 
39101
- function updateUniqueName(_x20) {
39005
+ function updateUniqueName(_x19) {
39102
39006
  return _updateUniqueName.apply(this, arguments);
39103
39007
  }
39104
39008
 
@@ -39108,13 +39012,13 @@ this.Twilio.Conversations = (function (exports) {
39108
39012
  key: "preprocessUpdate",
39109
39013
  value: function preprocessUpdate(update, conversationSid) {
39110
39014
  try {
39111
- if (typeof update.attributes === 'string') {
39015
+ if (typeof update.attributes === "string") {
39112
39016
  update.attributes = JSON.parse(update.attributes);
39113
39017
  } else if (update.attributes) {
39114
39018
  JSON.stringify(update.attributes);
39115
39019
  }
39116
39020
  } catch (e) {
39117
- log$3.warn('Retrieved malformed attributes from the server for conversation: ' + conversationSid);
39021
+ log$3.warn("Retrieved malformed attributes from the server for conversation: " + conversationSid);
39118
39022
  update.attributes = {};
39119
39023
  }
39120
39024
 
@@ -39123,7 +39027,7 @@ this.Twilio.Conversations = (function (exports) {
39123
39027
  update.dateCreated = new Date(update.dateCreated);
39124
39028
  }
39125
39029
  } catch (e) {
39126
- log$3.warn('Retrieved malformed dateCreated from the server for conversation: ' + conversationSid);
39030
+ log$3.warn("Retrieved malformed dateCreated from the server for conversation: " + conversationSid);
39127
39031
  delete update.dateCreated;
39128
39032
  }
39129
39033
 
@@ -39132,7 +39036,7 @@ this.Twilio.Conversations = (function (exports) {
39132
39036
  update.dateUpdated = new Date(update.dateUpdated);
39133
39037
  }
39134
39038
  } catch (e) {
39135
- log$3.warn('Retrieved malformed dateUpdated from the server for conversation: ' + conversationSid);
39039
+ log$3.warn("Retrieved malformed dateUpdated from the server for conversation: " + conversationSid);
39136
39040
  delete update.dateUpdated;
39137
39041
  }
39138
39042
 
@@ -39141,7 +39045,7 @@ this.Twilio.Conversations = (function (exports) {
39141
39045
  update.lastMessage.timestamp = new Date(update.lastMessage.timestamp);
39142
39046
  }
39143
39047
  } catch (e) {
39144
- log$3.warn('Retrieved malformed lastMessage.timestamp from the server for conversation: ' + conversationSid);
39048
+ log$3.warn("Retrieved malformed lastMessage.timestamp from the server for conversation: " + conversationSid);
39145
39049
  delete update.lastMessage.timestamp;
39146
39050
  }
39147
39051
  }
@@ -39150,25 +39054,25 @@ this.Twilio.Conversations = (function (exports) {
39150
39054
  return Conversation;
39151
39055
  }(ReplayEventEmitter_1);
39152
39056
 
39153
- _defineProperty$3(Conversation, "participantJoined", 'participantJoined');
39057
+ _defineProperty$3(Conversation, "participantJoined", "participantJoined");
39154
39058
 
39155
- _defineProperty$3(Conversation, "participantLeft", 'participantLeft');
39059
+ _defineProperty$3(Conversation, "participantLeft", "participantLeft");
39156
39060
 
39157
- _defineProperty$3(Conversation, "participantUpdated", 'participantUpdated');
39061
+ _defineProperty$3(Conversation, "participantUpdated", "participantUpdated");
39158
39062
 
39159
- _defineProperty$3(Conversation, "messageAdded", 'messageAdded');
39063
+ _defineProperty$3(Conversation, "messageAdded", "messageAdded");
39160
39064
 
39161
- _defineProperty$3(Conversation, "messageRemoved", 'messageRemoved');
39065
+ _defineProperty$3(Conversation, "messageRemoved", "messageRemoved");
39162
39066
 
39163
- _defineProperty$3(Conversation, "messageUpdated", 'messageUpdated');
39067
+ _defineProperty$3(Conversation, "messageUpdated", "messageUpdated");
39164
39068
 
39165
- _defineProperty$3(Conversation, "typingEnded", 'typingEnded');
39069
+ _defineProperty$3(Conversation, "typingEnded", "typingEnded");
39166
39070
 
39167
- _defineProperty$3(Conversation, "typingStarted", 'typingStarted');
39071
+ _defineProperty$3(Conversation, "typingStarted", "typingStarted");
39168
39072
 
39169
- _defineProperty$3(Conversation, "updated", 'updated');
39073
+ _defineProperty$3(Conversation, "updated", "updated");
39170
39074
 
39171
- _defineProperty$3(Conversation, "removed", 'removed');
39075
+ _defineProperty$3(Conversation, "removed", "removed");
39172
39076
 
39173
39077
  __decorate$1([validateTypesAsync_1(nonEmptyString_1, optionalAttributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "add", null);
39174
39078
 
@@ -39176,7 +39080,7 @@ this.Twilio.Conversations = (function (exports) {
39176
39080
 
39177
39081
  __decorate$1([validateTypesAsync_1(nonNegativeInteger_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Number]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
39178
39082
 
39179
- __decorate$1([validateTypesAsync_1(['undefined', nonNegativeInteger_1], ['undefined', nonNegativeInteger_1], ['undefined', literal_1('backwards', 'forward')]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Number, Number, String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "getMessages", null);
39083
+ __decorate$1([validateTypesAsync_1(["undefined", nonNegativeInteger_1], ["undefined", nonNegativeInteger_1], ["undefined", literal_1("backwards", "forward")]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Number, Number, String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "getMessages", null);
39180
39084
 
39181
39085
  __decorate$1([validateTypesAsync_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "getParticipantBySid", null);
39182
39086
 
@@ -39184,33 +39088,33 @@ this.Twilio.Conversations = (function (exports) {
39184
39088
 
39185
39089
  __decorate$1([validateTypesAsync_1([nonEmptyString_1, Participant]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "removeParticipant", null);
39186
39090
 
39187
- __decorate$1([validateTypesAsync_1(['string', literal_1(null), // Wrapping it into a custom rule is necessary because the FormData class is not available on initialization.
39091
+ __decorate$1([validateTypesAsync_1(["string", literal_1(null), // Wrapping it into a custom rule is necessary because the FormData class is not available on initialization.
39188
39092
  custom_1(function (value) {
39189
- return [value instanceof FormData, 'an instance of FormData'];
39190
- }), objectSchema_1('media options', {
39093
+ return [value instanceof FormData, "an instance of FormData"];
39094
+ }), objectSchema_1("media options", {
39191
39095
  contentType: nonEmptyString_1,
39192
39096
  media: custom_1(function (value) {
39193
- var isValid = typeof value === 'string' && value.length > 0 || value instanceof Uint8Array || value instanceof ArrayBuffer;
39097
+ var isValid = typeof value === "string" && value.length > 0 || value instanceof Uint8Array || value instanceof ArrayBuffer;
39194
39098
 
39195
- if (typeof Blob === 'function') {
39099
+ if (typeof Blob === "function") {
39196
39100
  isValid = isValid || value instanceof Blob;
39197
39101
  }
39198
39102
 
39199
- return [isValid, 'a non-empty string, an instance of Buffer or an instance of Blob'];
39103
+ return [isValid, "a non-empty string, an instance of Buffer or an instance of Blob"];
39200
39104
  })
39201
- })], optionalAttributesValidator, ['undefined', literal_1(null), objectSchema_1('email attributes', {
39202
- subject: [nonEmptyString_1, 'undefined']
39105
+ })], optionalAttributesValidator, ["undefined", literal_1(null), objectSchema_1("email attributes", {
39106
+ subject: [nonEmptyString_1, "undefined"]
39203
39107
  })]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object, Object, Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "sendMessage", null);
39204
39108
 
39205
- __decorate$1([validateTypesAsync_1(literal_1('default', 'muted')), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "setUserNotificationLevel", null);
39109
+ __decorate$1([validateTypesAsync_1(literal_1("default", "muted")), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "setUserNotificationLevel", null);
39206
39110
 
39207
39111
  __decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateAttributes", null);
39208
39112
 
39209
- __decorate$1([validateTypesAsync_1(['string']), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateFriendlyName", null);
39113
+ __decorate$1([validateTypesAsync_1(["string"]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateFriendlyName", null);
39210
39114
 
39211
39115
  __decorate$1([validateTypesAsync_1([literal_1(null), nonNegativeInteger_1]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Number]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateLastReadMessageIndex", null);
39212
39116
 
39213
- __decorate$1([validateTypesAsync_1(['string', literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateUniqueName", null);
39117
+ __decorate$1([validateTypesAsync_1(["string", literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateUniqueName", null);
39214
39118
 
39215
39119
  var Deferred = /*#__PURE__*/function () {
39216
39120
  function Deferred() {
@@ -39264,7 +39168,7 @@ this.Twilio.Conversations = (function (exports) {
39264
39168
  function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
39265
39169
 
39266
39170
  function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
39267
- var log$2 = Logger.scope('Conversations');
39171
+ var log$2 = Logger.scope("Conversations");
39268
39172
  /**
39269
39173
  * Represents conversations collection
39270
39174
  * {@see Conversation}
@@ -39306,12 +39210,12 @@ this.Twilio.Conversations = (function (exports) {
39306
39210
  while (1) {
39307
39211
  switch (_context.prev = _context.next) {
39308
39212
  case 0:
39309
- attributes = typeof (options === null || options === void 0 ? void 0 : options.attributes) !== 'undefined' ? options.attributes : {};
39213
+ attributes = typeof (options === null || options === void 0 ? void 0 : options.attributes) !== "undefined" ? options.attributes : {};
39310
39214
  _context.next = 3;
39311
- return this.services.commandExecutor.mutateResource('post', this.configuration.links.conversations, {
39215
+ return this.services.commandExecutor.mutateResource("post", this.configuration.links.conversations, {
39312
39216
  friendly_name: options.friendlyName,
39313
39217
  unique_name: options.uniqueName,
39314
- attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined
39218
+ attributes: typeof attributes !== "undefined" ? JSON.stringify(attributes) : undefined
39315
39219
  });
39316
39220
 
39317
39221
  case 3:
@@ -39337,12 +39241,12 @@ this.Twilio.Conversations = (function (exports) {
39337
39241
  case 12:
39338
39242
  conversation = new Conversation({
39339
39243
  channel: conversationDocument,
39340
- entityName: null,
39341
- uniqueName: null,
39244
+ entityName: "",
39245
+ uniqueName: "",
39342
39246
  attributes: null,
39343
- createdBy: null,
39344
- friendlyName: null,
39345
- lastConsumedMessageIndex: null,
39247
+ createdBy: "",
39248
+ friendlyName: "",
39249
+ lastConsumedMessageIndex: 0,
39346
39250
  dateCreated: null,
39347
39251
  dateUpdated: null
39348
39252
  }, conversationSid, links, this.configuration, this.services);
@@ -39354,7 +39258,7 @@ this.Twilio.Conversations = (function (exports) {
39354
39258
  return conversation._subscribe();
39355
39259
 
39356
39260
  case 17:
39357
- this.emit('conversationAdded', conversation);
39261
+ this.emit("conversationAdded", conversation);
39358
39262
  return _context.abrupt("return", conversation);
39359
39263
 
39360
39264
  case 19:
@@ -39393,12 +39297,12 @@ this.Twilio.Conversations = (function (exports) {
39393
39297
 
39394
39298
  case 3:
39395
39299
  map = _context2.sent;
39396
- map.on('itemAdded', function (args) {
39300
+ map.on("itemAdded", function (args) {
39397
39301
  log$2.debug("itemAdded: ".concat(args.item.key));
39398
39302
 
39399
- _this2._upsertConversation('sync', args.item.key, args.item.data);
39303
+ _this2._upsertConversation("sync", args.item.key, args.item.data);
39400
39304
  });
39401
- map.on('itemRemoved', function (args) {
39305
+ map.on("itemRemoved", function (args) {
39402
39306
  log$2.debug("itemRemoved: ".concat(args.key));
39403
39307
  var sid = args.key;
39404
39308
 
@@ -39412,22 +39316,22 @@ this.Twilio.Conversations = (function (exports) {
39412
39316
  return;
39413
39317
  }
39414
39318
 
39415
- if (conversation.status === 'joined') {
39416
- conversation._setStatus('notParticipating', 'sync');
39319
+ if (conversation.status === "joined") {
39320
+ conversation._setStatus("notParticipating", "sync");
39417
39321
 
39418
- _this2.emit('conversationLeft', conversation);
39322
+ _this2.emit("conversationLeft", conversation);
39419
39323
  }
39420
39324
 
39421
39325
  _this2.conversations.delete(sid);
39422
39326
 
39423
- _this2.emit('conversationRemoved', conversation);
39327
+ _this2.emit("conversationRemoved", conversation);
39424
39328
 
39425
- conversation.emit('removed', conversation);
39329
+ conversation.emit("removed", conversation);
39426
39330
  });
39427
- map.on('itemUpdated', function (args) {
39331
+ map.on("itemUpdated", function (args) {
39428
39332
  log$2.debug("itemUpdated: ".concat(args.item.key));
39429
39333
 
39430
- _this2._upsertConversation('sync', args.item.key, args.item.data);
39334
+ _this2._upsertConversation("sync", args.item.key, args.item.data);
39431
39335
  });
39432
39336
  _context2.next = 9;
39433
39337
  return this._fetchMyConversations();
@@ -39440,7 +39344,7 @@ this.Twilio.Conversations = (function (exports) {
39440
39344
  try {
39441
39345
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
39442
39346
  conversation = _step.value;
39443
- upserts.push(this._upsertConversation('rest', conversation.channel_sid, conversation));
39347
+ upserts.push(this._upsertConversation("rest", conversation["channel_sid"], conversation));
39444
39348
  }
39445
39349
  } catch (err) {
39446
39350
  _iterator.e(err);
@@ -39455,15 +39359,15 @@ this.Twilio.Conversations = (function (exports) {
39455
39359
  case 16:
39456
39360
  this.myConversationsFetched = true;
39457
39361
  this.tombstones.clear();
39458
- log$2.debug('The conversations list has been successfully fetched');
39362
+ log$2.debug("The conversations list has been successfully fetched");
39459
39363
  return _context2.abrupt("return", this);
39460
39364
 
39461
39365
  case 22:
39462
39366
  _context2.prev = 22;
39463
39367
  _context2.t0 = _context2["catch"](0);
39464
- errorMessage = 'Failed to fetch the conversations list';
39368
+ errorMessage = "Failed to fetch the conversations list";
39465
39369
 
39466
- if (this.services.syncClient.connectionState !== 'disconnected') {
39370
+ if (this.services.syncClient.connectionState !== "disconnected") {
39467
39371
  log$2.error(errorMessage, _context2.t0);
39468
39372
  }
39469
39373
 
@@ -39487,7 +39391,7 @@ this.Twilio.Conversations = (function (exports) {
39487
39391
  }, {
39488
39392
  key: "getConversations",
39489
39393
  value: function () {
39490
- var _getConversations = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(args) {
39394
+ var _getConversations = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3() {
39491
39395
  var _this3 = this;
39492
39396
 
39493
39397
  var conversationsMap, page;
@@ -39507,7 +39411,7 @@ this.Twilio.Conversations = (function (exports) {
39507
39411
  page = _context3.sent;
39508
39412
  return _context3.abrupt("return", this._wrapPaginator(page, function (items) {
39509
39413
  return Promise.all(items.map(function (item) {
39510
- return _this3._upsertConversation('sync', item.key, item.data);
39414
+ return _this3._upsertConversation("sync", item.key, item.data);
39511
39415
  }));
39512
39416
  }));
39513
39417
 
@@ -39519,7 +39423,7 @@ this.Twilio.Conversations = (function (exports) {
39519
39423
  }, _callee3, this);
39520
39424
  }));
39521
39425
 
39522
- function getConversations(_x2) {
39426
+ function getConversations() {
39523
39427
  return _getConversations.apply(this, arguments);
39524
39428
  }
39525
39429
 
@@ -39549,7 +39453,7 @@ this.Twilio.Conversations = (function (exports) {
39549
39453
  case 5:
39550
39454
  page = _context4.sent;
39551
39455
  items = page.items.map(function (item) {
39552
- return _this4._upsertConversation('sync', item.key, item.data);
39456
+ return _this4._upsertConversation("sync", item.key, item.data);
39553
39457
  });
39554
39458
  return _context4.abrupt("return", items.length > 0 ? items[0] : null);
39555
39459
 
@@ -39561,7 +39465,7 @@ this.Twilio.Conversations = (function (exports) {
39561
39465
  }, _callee4, this);
39562
39466
  }));
39563
39467
 
39564
- function getConversation(_x3) {
39468
+ function getConversation(_x2) {
39565
39469
  return _getConversation.apply(this, arguments);
39566
39470
  }
39567
39471
 
@@ -39587,7 +39491,7 @@ this.Twilio.Conversations = (function (exports) {
39587
39491
  data = {
39588
39492
  entityName: null,
39589
39493
  lastConsumedMessageIndex: body.last_read_message_index,
39590
- status: (body === null || body === void 0 ? void 0 : body.status) || 'unknown',
39494
+ status: (body === null || body === void 0 ? void 0 : body.status) || "unknown",
39591
39495
  friendlyName: body.friendly_name,
39592
39496
  dateUpdated: body.date_updated,
39593
39497
  dateCreated: body.date_created,
@@ -39598,7 +39502,7 @@ this.Twilio.Conversations = (function (exports) {
39598
39502
  notificationLevel: body === null || body === void 0 ? void 0 : body.notification_level,
39599
39503
  sid: sid
39600
39504
  };
39601
- return _context5.abrupt("return", this._upsertConversation('sync', sid, data));
39505
+ return _context5.abrupt("return", sid ? this._upsertConversation("sync", sid, data) : null);
39602
39506
 
39603
39507
  case 8:
39604
39508
  case "end":
@@ -39608,7 +39512,7 @@ this.Twilio.Conversations = (function (exports) {
39608
39512
  }, _callee5, this);
39609
39513
  }));
39610
39514
 
39611
- function getConversationByUniqueName(_x4) {
39515
+ function getConversationByUniqueName(_x3) {
39612
39516
  return _getConversationByUniqueName.apply(this, arguments);
39613
39517
  }
39614
39518
 
@@ -39633,7 +39537,7 @@ this.Twilio.Conversations = (function (exports) {
39633
39537
  data = {
39634
39538
  entityName: null,
39635
39539
  // lastConsumedMessageIndex: body.last_read_message_index,
39636
- status: (body === null || body === void 0 ? void 0 : body.status) || 'unknown',
39540
+ status: (body === null || body === void 0 ? void 0 : body.status) || "unknown",
39637
39541
  friendlyName: body.friendly_name,
39638
39542
  dateUpdated: body.date_updated,
39639
39543
  dateCreated: body.date_created,
@@ -39644,7 +39548,7 @@ this.Twilio.Conversations = (function (exports) {
39644
39548
  // notificationLevel: body?.notification_level,
39645
39549
  sid: sid
39646
39550
  };
39647
- return _context6.abrupt("return", this._upsertConversation('sync', sid, data));
39551
+ return _context6.abrupt("return", this._upsertConversation("sync", sid, data));
39648
39552
 
39649
39553
  case 7:
39650
39554
  case "end":
@@ -39654,7 +39558,7 @@ this.Twilio.Conversations = (function (exports) {
39654
39558
  }, _callee6, this);
39655
39559
  }));
39656
39560
 
39657
- function peekConversation(_x5) {
39561
+ function peekConversation(_x4) {
39658
39562
  return _peekConversation.apply(this, arguments);
39659
39563
  }
39660
39564
 
@@ -39671,7 +39575,7 @@ this.Twilio.Conversations = (function (exports) {
39671
39575
  _context7.next = 2;
39672
39576
  return this.services.syncClient.map({
39673
39577
  id: this.configuration.myConversations,
39674
- mode: 'open_existing'
39578
+ mode: "open_existing"
39675
39579
  });
39676
39580
 
39677
39581
  case 2:
@@ -39731,7 +39635,7 @@ this.Twilio.Conversations = (function (exports) {
39731
39635
  }, _callee8);
39732
39636
  }));
39733
39637
 
39734
- function _wrapPaginator(_x6, _x7) {
39638
+ function _wrapPaginator(_x5, _x6) {
39735
39639
  return _wrapPaginator2.apply(this, arguments);
39736
39640
  }
39737
39641
 
@@ -39749,14 +39653,14 @@ this.Twilio.Conversations = (function (exports) {
39749
39653
  switch (_context9.prev = _context9.next) {
39750
39654
  case 0:
39751
39655
  areSourcesDifferent = conversation._statusSource() !== undefined && source !== conversation._statusSource();
39752
- isChannelSourceSync = source !== 'rest' || conversation._statusSource() === 'sync';
39656
+ isChannelSourceSync = source !== "rest" || conversation._statusSource() === "sync";
39753
39657
 
39754
- if (!(areSourcesDifferent && isChannelSourceSync && source !== 'sync')) {
39658
+ if (!(areSourcesDifferent && isChannelSourceSync && source !== "sync")) {
39755
39659
  _context9.next = 5;
39756
39660
  break;
39757
39661
  }
39758
39662
 
39759
- log$2.trace('upsertConversation: conversation is known from sync and came from chat, ignoring', {
39663
+ log$2.trace("upsertConversation: conversation is known from sync and came from chat, ignoring", {
39760
39664
  sid: conversation.sid,
39761
39665
  data: data.status,
39762
39666
  conversation: conversation.status
@@ -39764,20 +39668,20 @@ this.Twilio.Conversations = (function (exports) {
39764
39668
  return _context9.abrupt("return");
39765
39669
 
39766
39670
  case 5:
39767
- if (!(data.status === 'joined' && conversation.status !== 'joined')) {
39671
+ if (!(data.status === "joined" && conversation.status !== "joined")) {
39768
39672
  _context9.next = 13;
39769
39673
  break;
39770
39674
  }
39771
39675
 
39772
- conversation._setStatus('joined', source);
39676
+ conversation._setStatus("joined", source);
39773
39677
 
39774
39678
  updateData = {};
39775
39679
 
39776
- if (typeof data.notificationLevel !== 'undefined') {
39680
+ if (typeof data.notificationLevel !== "undefined") {
39777
39681
  updateData.notificationLevel = data.notificationLevel;
39778
39682
  }
39779
39683
 
39780
- if (typeof data.lastConsumedMessageIndex !== 'undefined') {
39684
+ if (typeof data.lastConsumedMessageIndex !== "undefined") {
39781
39685
  updateData.lastConsumedMessageIndex = data.lastConsumedMessageIndex;
39782
39686
  }
39783
39687
 
@@ -39786,18 +39690,18 @@ this.Twilio.Conversations = (function (exports) {
39786
39690
  }
39787
39691
 
39788
39692
  conversation._subscribe().then(function () {
39789
- _this6.emit('conversationJoined', conversation);
39693
+ _this6.emit("conversationJoined", conversation);
39790
39694
  });
39791
39695
 
39792
39696
  return _context9.abrupt("return");
39793
39697
 
39794
39698
  case 13:
39795
- if (!(data.status === 'notParticipating' && conversation.status === 'joined')) {
39699
+ if (!(data.status === "notParticipating" && conversation.status === "joined")) {
39796
39700
  _context9.next = 20;
39797
39701
  break;
39798
39702
  }
39799
39703
 
39800
- conversation._setStatus('notParticipating', source);
39704
+ conversation._setStatus("notParticipating", source);
39801
39705
 
39802
39706
  conversation._update(data);
39803
39707
 
@@ -39805,11 +39709,11 @@ this.Twilio.Conversations = (function (exports) {
39805
39709
  return conversation._subscribe();
39806
39710
 
39807
39711
  case 18:
39808
- this.emit('conversationLeft', conversation);
39712
+ this.emit("conversationLeft", conversation);
39809
39713
  return _context9.abrupt("return");
39810
39714
 
39811
39715
  case 20:
39812
- if (!(data.status === 'notParticipating')) {
39716
+ if (!(data.status === "notParticipating")) {
39813
39717
  _context9.next = 24;
39814
39718
  break;
39815
39719
  }
@@ -39831,7 +39735,7 @@ this.Twilio.Conversations = (function (exports) {
39831
39735
  }, _callee9, this);
39832
39736
  }));
39833
39737
 
39834
- function _updateConversation(_x8, _x9, _x10) {
39738
+ function _updateConversation(_x7, _x8, _x9) {
39835
39739
  return _updateConversation2.apply(this, arguments);
39836
39740
  }
39837
39741
 
@@ -39866,17 +39770,17 @@ this.Twilio.Conversations = (function (exports) {
39866
39770
  return _context10.abrupt("return", conversation);
39867
39771
 
39868
39772
  case 9:
39869
- if (!(['chat', 'rest'].includes(source) && this.tombstones.has(sid))) {
39773
+ if (!(["chat", "rest"].includes(source) && this.tombstones.has(sid))) {
39870
39774
  _context10.next = 12;
39871
39775
  break;
39872
39776
  }
39873
39777
 
39874
- log$2.trace('upsertChannel: the channel is deleted but reappeared again from chat, ignoring', sid);
39875
- return _context10.abrupt("return");
39778
+ log$2.trace("upsertChannel: the channel is deleted but reappeared again from chat, ignoring", sid);
39779
+ return _context10.abrupt("return", null);
39876
39780
 
39877
39781
  case 12:
39878
39782
  // If the conversation is unknown, fetch it
39879
- log$2.trace('upsertConversation: creating a local conversation object with sid ' + sid, data);
39783
+ log$2.trace("upsertConversation: creating a local conversation object with sid " + sid, data);
39880
39784
  baseLink = "".concat(this.configuration.links.conversations, "/").concat(sid);
39881
39785
  links = {
39882
39786
  self: baseLink,
@@ -39891,12 +39795,12 @@ this.Twilio.Conversations = (function (exports) {
39891
39795
  case 19:
39892
39796
  this._registerForEvents(newConversation);
39893
39797
 
39894
- this.emit('conversationAdded', newConversation);
39798
+ this.emit("conversationAdded", newConversation);
39895
39799
 
39896
- if (data.status === 'joined') {
39897
- newConversation._setStatus('joined', source);
39800
+ if (data.status === "joined") {
39801
+ newConversation._setStatus("joined", source);
39898
39802
 
39899
- this.emit('conversationJoined', newConversation);
39803
+ this.emit("conversationJoined", newConversation);
39900
39804
  }
39901
39805
 
39902
39806
  return _context10.abrupt("return", newConversation);
@@ -39909,7 +39813,7 @@ this.Twilio.Conversations = (function (exports) {
39909
39813
  }, _callee10, this);
39910
39814
  }));
39911
39815
 
39912
- function _upsertConversation(_x11, _x12, _x13) {
39816
+ function _upsertConversation(_x10, _x11, _x12) {
39913
39817
  return _upsertConversation2.apply(this, arguments);
39914
39818
  }
39915
39819
 
@@ -39919,7 +39823,8 @@ this.Twilio.Conversations = (function (exports) {
39919
39823
  key: "_fetchMyConversations",
39920
39824
  value: function () {
39921
39825
  var _fetchMyConversations2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee11() {
39922
- var conversations, pageToken, url, response, receivedConversations;
39826
+ var conversations, pageToken, _response$body, url, response, receivedConversations;
39827
+
39923
39828
  return _regeneratorRuntime$1.wrap(function _callee11$(_context11) {
39924
39829
  while (1) {
39925
39830
  switch (_context11.prev = _context11.next) {
@@ -39931,7 +39836,7 @@ this.Twilio.Conversations = (function (exports) {
39931
39836
  url = new UriBuilder$1(this.configuration.links.myConversations);
39932
39837
 
39933
39838
  if (pageToken) {
39934
- url.arg('PageToken', pageToken);
39839
+ url.arg("PageToken", pageToken);
39935
39840
  }
39936
39841
 
39937
39842
  _context11.next = 6;
@@ -39939,7 +39844,7 @@ this.Twilio.Conversations = (function (exports) {
39939
39844
 
39940
39845
  case 6:
39941
39846
  response = _context11.sent;
39942
- receivedConversations = response.body.conversations.map(function (conversationDescriptor) {
39847
+ receivedConversations = (_response$body = response.body) === null || _response$body === void 0 ? void 0 : _response$body.conversations.map(function (conversationDescriptor) {
39943
39848
  return {
39944
39849
  descriptor: conversationDescriptor,
39945
39850
  channel_sid: conversationDescriptor.conversation_sid,
@@ -39984,7 +39889,7 @@ this.Twilio.Conversations = (function (exports) {
39984
39889
 
39985
39890
  if (conversation) {
39986
39891
  this.conversations.delete(sid);
39987
- this.emit('conversationRemoved', conversation);
39892
+ this.emit("conversationRemoved", conversation);
39988
39893
  }
39989
39894
  }
39990
39895
  }, {
@@ -39992,24 +39897,36 @@ this.Twilio.Conversations = (function (exports) {
39992
39897
  value: function _registerForEvents(conversation) {
39993
39898
  var _this7 = this;
39994
39899
 
39995
- conversation.on('removed', function () {
39900
+ conversation.on("removed", function () {
39996
39901
  return _this7._onConversationRemoved(conversation.sid);
39997
39902
  });
39998
- conversation.on('updated', function (args) {
39999
- return _this7.emit('conversationUpdated', args);
39903
+ conversation.on("updated", function (args) {
39904
+ return _this7.emit("conversationUpdated", args);
39905
+ });
39906
+ conversation.on("participantJoined", function (participant) {
39907
+ return _this7.emit("participantJoined", participant);
39908
+ });
39909
+ conversation.on("participantLeft", function (participant) {
39910
+ return _this7.emit("participantLeft", participant);
40000
39911
  });
40001
- conversation.on('participantJoined', this.emit.bind(this, 'participantJoined'));
40002
- conversation.on('participantLeft', this.emit.bind(this, 'participantLeft'));
40003
- conversation.on('participantUpdated', function (args) {
40004
- return _this7.emit('participantUpdated', args);
39912
+ conversation.on("participantUpdated", function (args) {
39913
+ return _this7.emit("participantUpdated", args);
40005
39914
  });
40006
- conversation.on('messageAdded', this.emit.bind(this, 'messageAdded'));
40007
- conversation.on('messageUpdated', function (args) {
40008
- return _this7.emit('messageUpdated', args);
39915
+ conversation.on("messageAdded", function (message) {
39916
+ return _this7.emit("messageAdded", message);
39917
+ });
39918
+ conversation.on("messageUpdated", function (args) {
39919
+ return _this7.emit("messageUpdated", args);
39920
+ });
39921
+ conversation.on("messageRemoved", function (message) {
39922
+ return _this7.emit("messageRemoved", message);
39923
+ });
39924
+ conversation.on("typingStarted", function (participant) {
39925
+ return _this7.emit("typingStarted", participant);
39926
+ });
39927
+ conversation.on("typingEnded", function (participant) {
39928
+ return _this7.emit("typingEnded", participant);
40009
39929
  });
40010
- conversation.on('messageRemoved', this.emit.bind(this, 'messageRemoved'));
40011
- conversation.on('typingStarted', this.emit.bind(this, 'typingStarted'));
40012
- conversation.on('typingEnded', this.emit.bind(this, 'typingEnded'));
40013
39930
  }
40014
39931
  }]);
40015
39932
 
@@ -40060,16 +39977,16 @@ this.Twilio.Conversations = (function (exports) {
40060
39977
  _this.fifoStack = [];
40061
39978
  _this.myself = myself;
40062
39979
 
40063
- _this.myself.on('updated', function (args) {
40064
- return _this.emit('userUpdated', args);
39980
+ _this.myself.on("updated", function (args) {
39981
+ return _this.emit("userUpdated", args);
40065
39982
  });
40066
39983
 
40067
- _this.myself.on('userSubscribed', function () {
40068
- return _this.emit('userSubscribed', _this.myself);
39984
+ _this.myself.on("userSubscribed", function () {
39985
+ return _this.emit("userSubscribed", _this.myself);
40069
39986
  });
40070
39987
 
40071
- _this.myself.on('userUnsubscribed', function () {
40072
- _this.emit('userUnsubscribed', _this.myself);
39988
+ _this.myself.on("userUnsubscribed", function () {
39989
+ _this.emit("userUnsubscribed", _this.myself);
40073
39990
 
40074
39991
  _this.myself._ensureFetched();
40075
39992
  });
@@ -40085,7 +40002,7 @@ this.Twilio.Conversations = (function (exports) {
40085
40002
  this.subscribedUsers.delete(user.identity);
40086
40003
  }
40087
40004
 
40088
- var foundItemIndex = -1;
40005
+ var foundItemIndex = 0;
40089
40006
  var foundItem = this.fifoStack.find(function (item, index) {
40090
40007
  if (item == user.identity) {
40091
40008
  foundItemIndex = index;
@@ -40099,7 +40016,7 @@ this.Twilio.Conversations = (function (exports) {
40099
40016
  this.fifoStack.splice(foundItemIndex, 1);
40100
40017
  }
40101
40018
 
40102
- this.emit('userUnsubscribed', user);
40019
+ this.emit("userUnsubscribed", user);
40103
40020
  }
40104
40021
  }, {
40105
40022
  key: "handleSubscribeUser",
@@ -40109,12 +40026,15 @@ this.Twilio.Conversations = (function (exports) {
40109
40026
  }
40110
40027
 
40111
40028
  if (this.fifoStack.length >= this.configuration.userInfosToSubscribe) {
40112
- this.subscribedUsers.get(this.fifoStack.shift()).unsubscribe();
40029
+ var _this$subscribedUsers, _this$subscribedUsers2;
40030
+
40031
+ var item = this.fifoStack.shift();
40032
+ (_this$subscribedUsers = this.subscribedUsers) === null || _this$subscribedUsers === void 0 ? void 0 : (_this$subscribedUsers2 = _this$subscribedUsers.get(item)) === null || _this$subscribedUsers2 === void 0 ? void 0 : _this$subscribedUsers2.unsubscribe();
40113
40033
  }
40114
40034
 
40115
40035
  this.fifoStack.push(user.identity);
40116
40036
  this.subscribedUsers.set(user.identity, user);
40117
- this.emit('userSubscribed', user);
40037
+ this.emit("userSubscribed", user);
40118
40038
  }
40119
40039
  /**
40120
40040
  * Gets user, if it's in subscribed list - then return the user object from it,
@@ -40125,65 +40045,74 @@ this.Twilio.Conversations = (function (exports) {
40125
40045
  }, {
40126
40046
  key: "getUser",
40127
40047
  value: function () {
40128
- var _getUser = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(identity) {
40048
+ var _getUser = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
40129
40049
  var _this2 = this;
40130
40050
 
40131
- var entityName,
40051
+ var identity,
40052
+ entityName,
40132
40053
  user,
40054
+ newUser,
40133
40055
  _args = arguments;
40134
40056
  return _regeneratorRuntime$1.wrap(function _callee$(_context) {
40135
40057
  while (1) {
40136
40058
  switch (_context.prev = _context.next) {
40137
40059
  case 0:
40138
- entityName = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
40139
- _context.next = 3;
40060
+ identity = _args.length > 0 && _args[0] !== undefined ? _args[0] : "";
40061
+ entityName = _args.length > 1 && _args[1] !== undefined ? _args[1] : "";
40062
+ _context.next = 4;
40140
40063
  return this.myself._ensureFetched();
40141
40064
 
40142
- case 3:
40065
+ case 4:
40143
40066
  if (!(identity == this.myself.identity)) {
40144
- _context.next = 5;
40067
+ _context.next = 6;
40145
40068
  break;
40146
40069
  }
40147
40070
 
40148
40071
  return _context.abrupt("return", this.myself);
40149
40072
 
40150
- case 5:
40073
+ case 6:
40151
40074
  user = this.subscribedUsers.get(identity);
40152
40075
 
40153
- if (user) {
40154
- _context.next = 17;
40076
+ if (!user) {
40077
+ _context.next = 9;
40155
40078
  break;
40156
40079
  }
40157
40080
 
40158
- if (entityName) {
40159
- _context.next = 11;
40081
+ return _context.abrupt("return", user);
40082
+
40083
+ case 9:
40084
+ _context.t0 = entityName;
40085
+
40086
+ if (_context.t0) {
40087
+ _context.next = 14;
40160
40088
  break;
40161
40089
  }
40162
40090
 
40163
- _context.next = 10;
40091
+ _context.next = 13;
40164
40092
  return this.getSyncUniqueName(identity);
40165
40093
 
40166
- case 10:
40167
- entityName = _context.sent;
40094
+ case 13:
40095
+ _context.t0 = _context.sent;
40168
40096
 
40169
- case 11:
40170
- user = new User(identity, entityName, this.configuration, this.services);
40171
- user.on('updated', function (args) {
40172
- return _this2.emit('userUpdated', args);
40097
+ case 14:
40098
+ entityName = _context.t0;
40099
+ newUser = new User(identity, entityName, this.configuration, this.services);
40100
+ newUser.on("updated", function (args) {
40101
+ return _this2.emit("userUpdated", args);
40173
40102
  });
40174
- user.on('userSubscribed', function () {
40175
- return _this2.handleSubscribeUser(user);
40103
+ newUser.on("userSubscribed", function () {
40104
+ return _this2.handleSubscribeUser(newUser);
40176
40105
  });
40177
- user.on('userUnsubscribed', function () {
40178
- return _this2.handleUnsubscribeUser(user);
40106
+ newUser.on("userUnsubscribed", function () {
40107
+ return _this2.handleUnsubscribeUser(newUser);
40179
40108
  });
40180
- _context.next = 17;
40181
- return user._ensureFetched();
40109
+ _context.next = 21;
40110
+ return newUser._ensureFetched();
40182
40111
 
40183
- case 17:
40184
- return _context.abrupt("return", user);
40112
+ case 21:
40113
+ return _context.abrupt("return", newUser);
40185
40114
 
40186
- case 18:
40115
+ case 22:
40187
40116
  case "end":
40188
40117
  return _context.stop();
40189
40118
  }
@@ -40191,7 +40120,7 @@ this.Twilio.Conversations = (function (exports) {
40191
40120
  }, _callee, this);
40192
40121
  }));
40193
40122
 
40194
- function getUser(_x) {
40123
+ function getUser() {
40195
40124
  return _getUser.apply(this, arguments);
40196
40125
  }
40197
40126
 
@@ -40242,6 +40171,8 @@ this.Twilio.Conversations = (function (exports) {
40242
40171
  key: "getSyncUniqueName",
40243
40172
  value: function () {
40244
40173
  var _getSyncUniqueName = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(identity) {
40174
+ var _response$body$sync_o, _response$body;
40175
+
40245
40176
  var url, response;
40246
40177
  return _regeneratorRuntime$1.wrap(function _callee3$(_context3) {
40247
40178
  while (1) {
@@ -40253,7 +40184,7 @@ this.Twilio.Conversations = (function (exports) {
40253
40184
 
40254
40185
  case 3:
40255
40186
  response = _context3.sent;
40256
- return _context3.abrupt("return", response.body.sync_objects.user_info_map);
40187
+ return _context3.abrupt("return", (_response$body$sync_o = (_response$body = response.body) === null || _response$body === void 0 ? void 0 : _response$body.sync_objects.user_info_map) !== null && _response$body$sync_o !== void 0 ? _response$body$sync_o : "");
40257
40188
 
40258
40189
  case 5:
40259
40190
  case "end":
@@ -40263,7 +40194,7 @@ this.Twilio.Conversations = (function (exports) {
40263
40194
  }, _callee3, this);
40264
40195
  }));
40265
40196
 
40266
- function getSyncUniqueName(_x2) {
40197
+ function getSyncUniqueName(_x) {
40267
40198
  return _getSyncUniqueName.apply(this, arguments);
40268
40199
  }
40269
40200
 
@@ -40274,7 +40205,7 @@ this.Twilio.Conversations = (function (exports) {
40274
40205
  return Users;
40275
40206
  }(ReplayEventEmitter_1);
40276
40207
 
40277
- var log$1 = Logger.scope('TypingIndicator');
40208
+ var log$1 = Logger.scope("TypingIndicator");
40278
40209
  /**
40279
40210
  * An important note in regards to typing timeout timers. There are two places that the SDK can get the "typing_timeout" attribute from. The first
40280
40211
  * place that the attribute appears in is the response received from POST -> /v1/typing REST call. In the body of that response, the value of the
@@ -40321,7 +40252,7 @@ this.Twilio.Conversations = (function (exports) {
40321
40252
  var _this = this;
40322
40253
 
40323
40254
  // this.services.notificationClient.subscribe(NotificationTypes.TYPING_INDICATOR, 'twilsock');
40324
- this.services.notificationClient.on('message', /*#__PURE__*/function () {
40255
+ this.services.notificationClient.on("message", /*#__PURE__*/function () {
40325
40256
  var _ref = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(type, message) {
40326
40257
  return _regeneratorRuntime$1.wrap(function _callee$(_context) {
40327
40258
  while (1) {
@@ -40362,7 +40293,7 @@ this.Twilio.Conversations = (function (exports) {
40362
40293
  while (1) {
40363
40294
  switch (_context2.prev = _context2.next) {
40364
40295
  case 0:
40365
- log$1.trace('Got new typing indicator ', message);
40296
+ log$1.trace("Got new typing indicator ", message);
40366
40297
  this.getConversation(message.channel_sid).then(function (conversation) {
40367
40298
  if (!conversation) {
40368
40299
  return;
@@ -40373,7 +40304,7 @@ this.Twilio.Conversations = (function (exports) {
40373
40304
  return;
40374
40305
  }
40375
40306
 
40376
- var timeout = _this2.configuration.typingIndicatorTimeoutOverride + 1000 || message.typing_timeout * 1000;
40307
+ var timeout = _this2.configuration.typingIndicatorTimeoutOverride ? _this2.configuration.typingIndicatorTimeoutOverride + 1000 : message.typing_timeout * 1000;
40377
40308
 
40378
40309
  participant._startTyping(timeout);
40379
40310
  });
@@ -40418,18 +40349,18 @@ this.Twilio.Conversations = (function (exports) {
40418
40349
  value: function _send(conversationSid) {
40419
40350
  var _this3 = this;
40420
40351
 
40421
- log$1.trace('Sending typing indicator');
40352
+ log$1.trace("Sending typing indicator");
40422
40353
  var url = this.configuration.links.typing;
40423
40354
  var headers = {
40424
- 'Content-Type': 'application/x-www-form-urlencoded'
40355
+ "Content-Type": "application/x-www-form-urlencoded"
40425
40356
  };
40426
40357
  var body = "ChannelSid=".concat(conversationSid);
40427
40358
  return this.services.twilsockClient.post(url, headers, body, this.configuration.productId).then(function (response) {
40428
- if (response.body.hasOwnProperty('typing_timeout')) {
40359
+ if (response.body.hasOwnProperty("typing_timeout")) {
40429
40360
  _this3.serviceTypingTimeout = response.body.typing_timeout * 1000;
40430
40361
  }
40431
40362
  }).catch(function (err) {
40432
- log$1.error('Failed to send typing indicator:', err);
40363
+ log$1.error("Failed to send typing indicator:", err);
40433
40364
  throw err;
40434
40365
  });
40435
40366
  }
@@ -40485,14 +40416,14 @@ this.Twilio.Conversations = (function (exports) {
40485
40416
  this.data = data.data || {};
40486
40417
  };
40487
40418
 
40488
- var version = "2.1.0-rc.1";
40419
+ var version = "2.1.0-rc.5";
40489
40420
 
40490
40421
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
40491
40422
 
40492
40423
  function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
40493
40424
 
40494
40425
  var trimSlashes = function trimSlashes(url) {
40495
- return url.replace(/(^\/+|\/+$)/g, '');
40426
+ return url.replace(/(^\/+|\/+$)/g, "");
40496
40427
  };
40497
40428
 
40498
40429
  var isMutationConflictResponse = function isMutationConflictResponse(response) {
@@ -40530,19 +40461,19 @@ this.Twilio.Conversations = (function (exports) {
40530
40461
  case 0:
40531
40462
  preProcessedUrl = this._preProcessUrl(url);
40532
40463
  finalHeaders = _objectSpread$1({
40533
- 'Content-Type': 'application/json; charset=utf-8'
40464
+ "Content-Type": "application/json; charset=utf-8"
40534
40465
  }, headers || {});
40535
40466
  _context.t0 = method;
40536
- _context.next = _context.t0 === 'get' ? 5 : _context.t0 === 'post' ? 11 : _context.t0 === 'delete' ? 15 : 19;
40467
+ _context.next = _context.t0 === "get" ? 5 : _context.t0 === "post" ? 11 : _context.t0 === "delete" ? 15 : 19;
40537
40468
  break;
40538
40469
 
40539
40470
  case 5:
40540
40471
  getUrl = preProcessedUrl;
40541
40472
 
40542
40473
  if (requestBody) {
40543
- getUrl += '?' + Object.entries(requestBody).map(function (entry) {
40544
- return entry.map(encodeURIComponent).join('=');
40545
- }).join('&');
40474
+ getUrl += "?" + Object.entries(requestBody).map(function (entry) {
40475
+ return entry.map(encodeURIComponent).join("=");
40476
+ }).join("&");
40546
40477
  }
40547
40478
 
40548
40479
  _context.next = 9;
@@ -40562,7 +40493,7 @@ this.Twilio.Conversations = (function (exports) {
40562
40493
 
40563
40494
  case 15:
40564
40495
  _context.next = 17;
40565
- return this._services.transport.delete(preProcessedUrl, finalHeaders, null, this._productId);
40496
+ return this._services.transport.delete(preProcessedUrl, finalHeaders, {}, this._productId);
40566
40497
 
40567
40498
  case 17:
40568
40499
  response = _context.sent;
@@ -40612,28 +40543,24 @@ this.Twilio.Conversations = (function (exports) {
40612
40543
  max: 1600,
40613
40544
  maxAttemptsCount: maxAttemptsCount
40614
40545
  }).run(function () {
40615
- return _this._makeRequest('get', url, requestBody);
40546
+ return _this._makeRequest("get", url, requestBody);
40616
40547
  });
40617
40548
 
40618
40549
  case 4:
40619
40550
  result = _context2.sent;
40620
- _context2.next = 10;
40621
- break;
40551
+ return _context2.abrupt("return", result.body);
40622
40552
 
40623
- case 7:
40624
- _context2.prev = 7;
40553
+ case 8:
40554
+ _context2.prev = 8;
40625
40555
  _context2.t0 = _context2["catch"](1);
40626
40556
  throw new Error("Fetch resource from \"".concat(url, "\" failed."));
40627
40557
 
40628
- case 10:
40629
- return _context2.abrupt("return", result.body);
40630
-
40631
40558
  case 11:
40632
40559
  case "end":
40633
40560
  return _context2.stop();
40634
40561
  }
40635
40562
  }
40636
- }, _callee2, null, [[1, 7]]);
40563
+ }, _callee2, null, [[1, 8]]);
40637
40564
  }));
40638
40565
 
40639
40566
  function fetchResource(_x5, _x6) {
@@ -40653,7 +40580,7 @@ this.Twilio.Conversations = (function (exports) {
40653
40580
  case 0:
40654
40581
  _context3.next = 2;
40655
40582
  return this._makeRequest(method, url, requestBody, {
40656
- 'X-Twilio-Mutation-Id': uuid_1.v4()
40583
+ "X-Twilio-Mutation-Id": uuid_1.v4()
40657
40584
  });
40658
40585
 
40659
40586
  case 2:
@@ -40703,7 +40630,7 @@ this.Twilio.Conversations = (function (exports) {
40703
40630
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
40704
40631
 
40705
40632
  var Client_1;
40706
- var log = Logger.scope('Client');
40633
+ var log = Logger.scope("Client");
40707
40634
  var SDK_VERSION = version;
40708
40635
 
40709
40636
  var ClientServices = function ClientServices() {
@@ -40751,22 +40678,14 @@ this.Twilio.Conversations = (function (exports) {
40751
40678
 
40752
40679
  _this = _super.call(this);
40753
40680
 
40754
- _defineProperty$3(_assertThisInitialized$3(_this), "connectionState", 'unknown');
40755
-
40756
- _defineProperty$3(_assertThisInitialized$3(_this), "conversationsPromise", null);
40757
-
40758
- _defineProperty$3(_assertThisInitialized$3(_this), "_ensureReady", null);
40759
-
40760
- _defineProperty$3(_assertThisInitialized$3(_this), "_resolveEnsureReady", null);
40761
-
40762
- _defineProperty$3(_assertThisInitialized$3(_this), "_rejectEnsureReady", null);
40681
+ _defineProperty$3(_assertThisInitialized$3(_this), "connectionState", "unknown");
40763
40682
 
40764
40683
  _defineProperty$3(_assertThisInitialized$3(_this), "version", SDK_VERSION);
40765
40684
 
40766
40685
  _defineProperty$3(_assertThisInitialized$3(_this), "parsePushNotification", Client_1.parsePushNotification);
40767
40686
 
40768
- _this.fpaToken = fpaToken;
40769
- _this.options = options;
40687
+ _this.fpaToken = fpaToken !== null && fpaToken !== void 0 ? fpaToken : "";
40688
+ _this.options = options !== null && options !== void 0 ? options : {};
40770
40689
 
40771
40690
  if (!_this.options.disableDeepClone) {
40772
40691
  var _options = _objectSpread(_objectSpread({}, _this.options), {}, {
@@ -40780,25 +40699,25 @@ this.Twilio.Conversations = (function (exports) {
40780
40699
  _this.options = _options;
40781
40700
  }
40782
40701
 
40783
- _this.options.logLevel = (_this$options$logLeve = _this.options.logLevel) !== null && _this$options$logLeve !== void 0 ? _this$options$logLeve : 'silent';
40702
+ _this.options.logLevel = (_this$options$logLeve = _this.options.logLevel) !== null && _this$options$logLeve !== void 0 ? _this$options$logLeve : "silent";
40784
40703
  log.setLevel(_this.options.logLevel);
40785
- var productId = _this.options.productId = 'ip_messaging'; // Filling ClientMetadata
40704
+ var productId = _this.options.productId = "ip_messaging"; // Filling ClientMetadata
40786
40705
 
40787
40706
  _this.options.clientMetadata = _this.options.clientMetadata || {};
40788
40707
 
40789
- if (!_this.options.clientMetadata.hasOwnProperty('type')) {
40790
- _this.options.clientMetadata.type = 'conversations';
40708
+ if (!_this.options.clientMetadata.hasOwnProperty("type")) {
40709
+ _this.options.clientMetadata.type = "conversations";
40791
40710
  }
40792
40711
 
40793
- if (!_this.options.clientMetadata.hasOwnProperty('sdk')) {
40794
- _this.options.clientMetadata.sdk = 'JS';
40712
+ if (!_this.options.clientMetadata.hasOwnProperty("sdk")) {
40713
+ _this.options.clientMetadata.sdk = "JS";
40795
40714
  _this.options.clientMetadata.sdkv = SDK_VERSION;
40796
40715
  } // Enable session local storage for Sync
40797
40716
 
40798
40717
 
40799
40718
  _this.options.Sync = _this.options.Sync || {};
40800
40719
 
40801
- if (typeof _this.options.Sync.enableSessionStorage === 'undefined') {
40720
+ if (typeof _this.options.Sync.enableSessionStorage === "undefined") {
40802
40721
  _this.options.Sync.enableSessionStorage = true;
40803
40722
  }
40804
40723
 
@@ -40807,11 +40726,11 @@ this.Twilio.Conversations = (function (exports) {
40807
40726
  }
40808
40727
 
40809
40728
  if (!fpaToken) {
40810
- throw new Error('A valid Twilio token should be provided');
40729
+ throw new Error("A valid Twilio token should be provided");
40811
40730
  }
40812
40731
 
40813
40732
  _this.services = new ClientServices();
40814
- _this._myself = new User('', '', null, _this.services);
40733
+ _this._myself = new User("", "", null, _this.services);
40815
40734
  var startTwilsock = !_this.options.twilsockClient; // Create default init registrations if none were provided.
40816
40735
  // Otherwise, the outside party have to list all the init registrations they
40817
40736
  // need.
@@ -40826,34 +40745,34 @@ this.Twilio.Conversations = (function (exports) {
40826
40745
 
40827
40746
  _this.services.twilsockClient = _this.options.twilsockClient = (_this$options$twilsoc = _this.options.twilsockClient) !== null && _this$options$twilsoc !== void 0 ? _this$options$twilsoc : new browser$3.TwilsockClient(fpaToken, productId, _this.options);
40828
40747
 
40829
- _this.services.twilsockClient.on('tokenAboutToExpire', function (ttl) {
40830
- return _this.emit('tokenAboutToExpire', ttl);
40748
+ _this.services.twilsockClient.on("tokenAboutToExpire", function (ttl) {
40749
+ return _this.emit("tokenAboutToExpire", ttl);
40831
40750
  });
40832
40751
 
40833
- _this.services.twilsockClient.on('tokenExpired', function () {
40834
- return _this.emit('tokenExpired');
40752
+ _this.services.twilsockClient.on("tokenExpired", function () {
40753
+ return _this.emit("tokenExpired");
40835
40754
  });
40836
40755
 
40837
- _this.services.twilsockClient.on('connectionError', function (error) {
40838
- return _this.emit('connectionError', error);
40756
+ _this.services.twilsockClient.on("connectionError", function (error) {
40757
+ return _this.emit("connectionError", error);
40839
40758
  });
40840
40759
 
40841
- _this.services.twilsockClient.on('stateChanged', function (state) {
40760
+ _this.services.twilsockClient.on("stateChanged", function (state) {
40842
40761
  log.debug("Handling stateChanged for ConversationsClient: new state ".concat(state));
40843
40762
 
40844
40763
  if (state !== _this.connectionState) {
40845
40764
  _this.connectionState = state;
40846
40765
 
40847
- _this.emit('connectionStateChanged', _this.connectionState);
40766
+ _this.emit("connectionStateChanged", _this.connectionState);
40848
40767
  }
40849
40768
  });
40850
40769
 
40851
40770
  _this.services.transport = _this.options.transport = (_this$options$transpo = _this.options.transport) !== null && _this$options$transpo !== void 0 ? _this$options$transpo : _this.options.twilsockClient;
40852
40771
  _this.services.notificationClient = _this.options.notificationsClient = (_this$options$notific = _this.options.notificationsClient) !== null && _this$options$notific !== void 0 ? _this$options$notific : new browser$2.Notifications(fpaToken, _this.options);
40853
40772
  _this.services.syncClient = _this.options.syncClient = (_this$options$syncCli = _this.options.syncClient) !== null && _this$options$syncCli !== void 0 ? _this$options$syncCli : new SyncClient(fpaToken, _this.options);
40854
- var configurationOptions = options.Chat || options.IPMessaging || options || {};
40855
- var region = configurationOptions.region || options.region;
40856
- var baseUrl = configurationOptions.apiUri || configurationOptions.typingUri || "https://aim.".concat(region || 'us1', ".twilio.com");
40773
+ var configurationOptions = (options === null || options === void 0 ? void 0 : options.Chat) || (options === null || options === void 0 ? void 0 : options.IPMessaging) || options || {};
40774
+ var region = configurationOptions.region || (options === null || options === void 0 ? void 0 : options.region);
40775
+ var baseUrl = configurationOptions.apiUri || configurationOptions.typingUri || "https://aim.".concat(region || "us1", ".twilio.com");
40857
40776
  _this.services.commandExecutor = new CommandExecutor(baseUrl, {
40858
40777
  transport: _this.options.transport
40859
40778
  }, productId);
@@ -40861,15 +40780,15 @@ this.Twilio.Conversations = (function (exports) {
40861
40780
  var emitFailed = function emitFailed(err) {
40862
40781
  _this._rejectEnsureReady(err);
40863
40782
 
40864
- _this.emit('stateChanged', 'failed');
40783
+ _this.emit("stateChanged", "failed");
40865
40784
  };
40866
40785
 
40867
- _this.services.twilsockClient.once('connectionError', emitFailed);
40786
+ _this.services.twilsockClient.once("connectionError", emitFailed);
40868
40787
 
40869
- _this.services.twilsockClient.once('disconnected', emitFailed); // ConversationsClient will be able to initialize only after twilsock is connected
40788
+ _this.services.twilsockClient.once("disconnected", emitFailed); // ConversationsClient will be able to initialize only after twilsock is connected
40870
40789
 
40871
40790
 
40872
- _this.services.twilsockClient.once('connected', /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
40791
+ _this.services.twilsockClient.once("connected", /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee() {
40873
40792
  var startupEvent;
40874
40793
  return _regeneratorRuntime$1.wrap(function _callee$(_context) {
40875
40794
  while (1) {
@@ -40877,20 +40796,20 @@ this.Twilio.Conversations = (function (exports) {
40877
40796
  case 0:
40878
40797
  log.debug("ConversationsClient started INITIALIZING");
40879
40798
 
40880
- _this.services.twilsockClient.off('connectionError', emitFailed);
40799
+ _this.services.twilsockClient.off("connectionError", emitFailed);
40881
40800
 
40882
- _this.services.twilsockClient.off('disconnected', emitFailed);
40801
+ _this.services.twilsockClient.off("disconnected", emitFailed);
40883
40802
 
40884
40803
  _context.prev = 3;
40885
- startupEvent = 'conversations.client.startup';
40804
+ startupEvent = "conversations.client.startup";
40886
40805
 
40887
- _this.services.twilsockClient.addPartialTelemetryEvent(new browser$3.TelemetryEventDescription(startupEvent, 'Conversations client startup', new Date()), startupEvent, browser$3.TelemetryPoint.Start);
40806
+ _this.services.twilsockClient.addPartialTelemetryEvent(new browser$3.TelemetryEventDescription(startupEvent, "Conversations client startup", new Date()), startupEvent, browser$3.TelemetryPoint.Start);
40888
40807
 
40889
40808
  _context.next = 8;
40890
40809
  return _this._initialize();
40891
40810
 
40892
40811
  case 8:
40893
- _this.services.twilsockClient.addPartialTelemetryEvent(new browser$3.TelemetryEventDescription('', '', new Date()), startupEvent, browser$3.TelemetryPoint.End);
40812
+ _this.services.twilsockClient.addPartialTelemetryEvent(new browser$3.TelemetryEventDescription("", "", new Date()), startupEvent, browser$3.TelemetryPoint.End);
40894
40813
 
40895
40814
  _context.next = 15;
40896
40815
  break;
@@ -40902,7 +40821,7 @@ this.Twilio.Conversations = (function (exports) {
40902
40821
  // Fail ChatClient if initialization is incomplete
40903
40822
  _this._rejectEnsureReady(_context.t0);
40904
40823
 
40905
- _this.emit('stateChanged', 'failed');
40824
+ _this.emit("stateChanged", "failed");
40906
40825
 
40907
40826
  case 15:
40908
40827
  case "end":
@@ -40915,7 +40834,9 @@ this.Twilio.Conversations = (function (exports) {
40915
40834
  _this._ensureReady = new Promise(function (resolve, reject) {
40916
40835
  _this._resolveEnsureReady = resolve;
40917
40836
  _this._rejectEnsureReady = reject;
40918
- }).catch(function (err) {}); // @todo How to process unhandled rejection here?
40837
+ }).catch(function () {
40838
+ return void 0;
40839
+ }); // @todo How to process unhandled rejection here?
40919
40840
 
40920
40841
  if (startTwilsock) {
40921
40842
  _this.services.twilsockClient.connect();
@@ -40944,7 +40865,7 @@ this.Twilio.Conversations = (function (exports) {
40944
40865
  key: "reachabilityEnabled",
40945
40866
  get: function get() {
40946
40867
  if (!this.configuration) {
40947
- throw new Error('Reachability information could not yet be accessed as the client ' + "has not yet been initialized. Subscribe to the 'stateChanged' event " + 'to properly react to the client initialization.');
40868
+ throw new Error("Reachability information could not yet be accessed as the client " + "has not yet been initialized. Subscribe to the 'stateChanged' event " + "to properly react to the client initialization.");
40948
40869
  }
40949
40870
 
40950
40871
  return this.configuration.reachabilityEnabled;
@@ -40984,7 +40905,7 @@ this.Twilio.Conversations = (function (exports) {
40984
40905
  switch (_context2.prev = _context2.next) {
40985
40906
  case 0:
40986
40907
  _context2.next = 2;
40987
- return this.services.commandExecutor.fetchResource('Client/v2/Configuration');
40908
+ return this.services.commandExecutor.fetchResource("Client/v2/Configuration");
40988
40909
 
40989
40910
  case 2:
40990
40911
  configurationResponse = _context2.sent;
@@ -40995,31 +40916,55 @@ this.Twilio.Conversations = (function (exports) {
40995
40916
  this.services.typingIndicator = new TypingIndicator(this.getConversationBySid.bind(this), this.configuration, this.services);
40996
40917
  this.services.network = new Network(this.configuration, this.services);
40997
40918
  this.services.users = new Users(this._myself, this.configuration, this.services);
40998
- this.services.users.on('userSubscribed', this.emit.bind(this, 'userSubscribed'));
40999
- this.services.users.on('userUpdated', function (args) {
41000
- return _this4.emit('userUpdated', args);
40919
+ this.services.users.on("userSubscribed", function (user) {
40920
+ _this4.emit("userSubscribed", user);
40921
+ });
40922
+ this.services.users.on("userUpdated", function (args) {
40923
+ return _this4.emit("userUpdated", args);
40924
+ });
40925
+ this.services.users.on("userUnsubscribed", function (user) {
40926
+ _this4.emit("userUnsubscribed", user);
41001
40927
  });
41002
- this.services.users.on('userUnsubscribed', this.emit.bind(this, 'userUnsubscribed'));
41003
40928
  this.conversations = new Conversations(this.configuration, this.services);
41004
- this.conversations.on('conversationAdded', this.emit.bind(this, 'conversationAdded'));
41005
- this.conversations.on('conversationRemoved', this.emit.bind(this, 'conversationRemoved'));
41006
- this.conversations.on('conversationJoined', this.emit.bind(this, 'conversationJoined'));
41007
- this.conversations.on('conversationLeft', this.emit.bind(this, 'conversationLeft'));
41008
- this.conversations.on('conversationUpdated', function (args) {
41009
- return _this4.emit('conversationUpdated', args);
40929
+ this.conversations.on("conversationAdded", function (conversation) {
40930
+ _this4.emit("conversationAdded", conversation);
40931
+ });
40932
+ this.conversations.on("conversationRemoved", function (conversation) {
40933
+ _this4.emit("conversationRemoved", conversation);
40934
+ });
40935
+ this.conversations.on("conversationJoined", function (conversation) {
40936
+ _this4.emit("conversationJoined", conversation);
40937
+ });
40938
+ this.conversations.on("conversationLeft", function (conversation) {
40939
+ _this4.emit("conversationLeft", conversation);
40940
+ });
40941
+ this.conversations.on("conversationUpdated", function (args) {
40942
+ return _this4.emit("conversationUpdated", args);
40943
+ });
40944
+ this.conversations.on("participantJoined", function (participant) {
40945
+ _this4.emit("participantJoined", participant);
40946
+ });
40947
+ this.conversations.on("participantLeft", function (participant) {
40948
+ _this4.emit("participantLeft", participant);
40949
+ });
40950
+ this.conversations.on("participantUpdated", function (args) {
40951
+ return _this4.emit("participantUpdated", args);
40952
+ });
40953
+ this.conversations.on("messageAdded", function (message) {
40954
+ return _this4.emit("messageAdded", message);
40955
+ });
40956
+ this.conversations.on("messageUpdated", function (args) {
40957
+ return _this4.emit("messageUpdated", args);
40958
+ });
40959
+ this.conversations.on("messageRemoved", function (message) {
40960
+ return _this4.emit("messageRemoved", message);
41010
40961
  });
41011
- this.conversations.on('participantJoined', this.emit.bind(this, 'participantJoined'));
41012
- this.conversations.on('participantLeft', this.emit.bind(this, 'participantLeft'));
41013
- this.conversations.on('participantUpdated', function (args) {
41014
- return _this4.emit('participantUpdated', args);
40962
+ this.conversations.on("typingStarted", function (participant) {
40963
+ return _this4.emit("typingStarted", participant);
41015
40964
  });
41016
- this.conversations.on('messageAdded', this.emit.bind(this, 'messageAdded'));
41017
- this.conversations.on('messageUpdated', function (args) {
41018
- return _this4.emit('messageUpdated', args);
40965
+ this.conversations.on("typingEnded", function (participant) {
40966
+ return _this4.emit("typingEnded", participant);
41019
40967
  });
41020
- this.conversations.on('messageRemoved', this.emit.bind(this, 'messageRemoved'));
41021
- this.conversations.on('typingStarted', this.emit.bind(this, 'typingStarted'));
41022
- this.conversations.on('typingEnded', this.emit.bind(this, 'typingEnded'));
41023
40968
  this.conversationsPromise = this.conversations.fetchConversations().then(function () {
41024
40969
  return _this4.conversations;
41025
40970
  }).catch(function (error) {
@@ -41034,12 +40979,12 @@ this.Twilio.Conversations = (function (exports) {
41034
40979
  });
41035
40980
  this.services.typingIndicator.initialize();
41036
40981
  this.services.mcsClient = new browser.McsClient(this.fpaToken, this.configuration.links.mediaService, this.configuration.links.mediaSetService, _objectSpread(_objectSpread({}, this.options), {}, {
41037
- transport: null
40982
+ transport: undefined
41038
40983
  }));
41039
40984
 
41040
40985
  this._resolveEnsureReady();
41041
40986
 
41042
- this.emit('stateChanged', 'initialized');
40987
+ this.emit("stateChanged", "initialized");
41043
40988
 
41044
40989
  case 33:
41045
40990
  case "end":
@@ -41105,7 +41050,7 @@ this.Twilio.Conversations = (function (exports) {
41105
41050
  return this._ensureReady;
41106
41051
 
41107
41052
  case 2:
41108
- log.info('updateToken');
41053
+ log.info("updateToken");
41109
41054
 
41110
41055
  if (!(this.fpaToken === token)) {
41111
41056
  _context4.next = 5;
@@ -41267,7 +41212,7 @@ this.Twilio.Conversations = (function (exports) {
41267
41212
  }, {
41268
41213
  key: "getSubscribedConversations",
41269
41214
  value: function () {
41270
- var _getSubscribedConversations = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7(args) {
41215
+ var _getSubscribedConversations = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee7() {
41271
41216
  return _regeneratorRuntime$1.wrap(function _callee7$(_context7) {
41272
41217
  while (1) {
41273
41218
  switch (_context7.prev = _context7.next) {
@@ -41277,7 +41222,7 @@ this.Twilio.Conversations = (function (exports) {
41277
41222
 
41278
41223
  case 2:
41279
41224
  return _context7.abrupt("return", this.conversationsPromise.then(function (conversations) {
41280
- return conversations.getConversations(args);
41225
+ return conversations.getConversations();
41281
41226
  }));
41282
41227
 
41283
41228
  case 3:
@@ -41288,7 +41233,7 @@ this.Twilio.Conversations = (function (exports) {
41288
41233
  }, _callee7, this);
41289
41234
  }));
41290
41235
 
41291
- function getSubscribedConversations(_x4) {
41236
+ function getSubscribedConversations() {
41292
41237
  return _getSubscribedConversations.apply(this, arguments);
41293
41238
  }
41294
41239
 
@@ -41325,7 +41270,7 @@ this.Twilio.Conversations = (function (exports) {
41325
41270
  }, _callee8, this);
41326
41271
  }));
41327
41272
 
41328
- function createConversation(_x5) {
41273
+ function createConversation(_x4) {
41329
41274
  return _createConversation.apply(this, arguments);
41330
41275
  }
41331
41276
 
@@ -41363,7 +41308,7 @@ this.Twilio.Conversations = (function (exports) {
41363
41308
  }, _callee9, this);
41364
41309
  }));
41365
41310
 
41366
- function setPushRegistrationId(_x6, _x7) {
41311
+ function setPushRegistrationId(_x5, _x6) {
41367
41312
  return _setPushRegistrationId.apply(this, arguments);
41368
41313
  }
41369
41314
 
@@ -41400,7 +41345,7 @@ this.Twilio.Conversations = (function (exports) {
41400
41345
  }, _callee10, this);
41401
41346
  }));
41402
41347
 
41403
- function unsetPushRegistrationId(_x8) {
41348
+ function unsetPushRegistrationId(_x7) {
41404
41349
  return _unsetPushRegistrationId.apply(this, arguments);
41405
41350
  }
41406
41351
 
@@ -41436,7 +41381,7 @@ this.Twilio.Conversations = (function (exports) {
41436
41381
  }, _callee11, this);
41437
41382
  }));
41438
41383
 
41439
- function removePushRegistrations(_x9, _x10) {
41384
+ function removePushRegistrations(_x8, _x9) {
41440
41385
  return _removePushRegistrations.apply(this, arguments);
41441
41386
  }
41442
41387
 
@@ -41459,8 +41404,8 @@ this.Twilio.Conversations = (function (exports) {
41459
41404
  return this._ensureReady;
41460
41405
 
41461
41406
  case 2:
41462
- log.debug('handlePushNotification, notificationPayload=', notificationPayload);
41463
- this.emit('pushNotification', Client_1.parsePushNotification(notificationPayload));
41407
+ log.debug("handlePushNotification, notificationPayload=", notificationPayload);
41408
+ this.emit("pushNotification", Client_1.parsePushNotification(notificationPayload));
41464
41409
 
41465
41410
  case 4:
41466
41411
  case "end":
@@ -41470,7 +41415,7 @@ this.Twilio.Conversations = (function (exports) {
41470
41415
  }, _callee12, this);
41471
41416
  }));
41472
41417
 
41473
- function handlePushNotification(_x11) {
41418
+ function handlePushNotification(_x10) {
41474
41419
  return _handlePushNotification.apply(this, arguments);
41475
41420
  }
41476
41421
 
@@ -41505,7 +41450,7 @@ this.Twilio.Conversations = (function (exports) {
41505
41450
  }, _callee13, this);
41506
41451
  }));
41507
41452
 
41508
- function getUser(_x12) {
41453
+ function getUser(_x11) {
41509
41454
  return _getUser.apply(this, arguments);
41510
41455
  }
41511
41456
 
@@ -41592,7 +41537,7 @@ this.Twilio.Conversations = (function (exports) {
41592
41537
  break;
41593
41538
  }
41594
41539
 
41595
- throw new Error('Obsolete usage of ConversationsClient.create() ' + 'factory method: if you pass twilsock from the outside then you must ' + 'use ConversationsClient constructor and be prepared to work with ' + 'uninitialized client.');
41540
+ throw new Error("Obsolete usage of ConversationsClient.create() " + "factory method: if you pass twilsock from the outside then you must " + "use ConversationsClient constructor and be prepared to work with " + "uninitialized client.");
41596
41541
 
41597
41542
  case 2:
41598
41543
  client = new Client_1(token, options);
@@ -41610,7 +41555,7 @@ this.Twilio.Conversations = (function (exports) {
41610
41555
  }, _callee15);
41611
41556
  }));
41612
41557
 
41613
- function create(_x13, _x14) {
41558
+ function create(_x12, _x13) {
41614
41559
  return _create.apply(this, arguments);
41615
41560
  }
41616
41561
 
@@ -41622,11 +41567,11 @@ this.Twilio.Conversations = (function (exports) {
41622
41567
  var result = {};
41623
41568
 
41624
41569
  for (var key in Client_1.supportedPushDataFields) {
41625
- if (typeof data[key] === 'undefined' || data[key] === null) {
41570
+ if (typeof data[key] === "undefined" || data[key] === null) {
41626
41571
  continue;
41627
41572
  }
41628
41573
 
41629
- if (key !== 'message_index') {
41574
+ if (key !== "message_index") {
41630
41575
  result[Client_1.supportedPushDataFields[key]] = data[key];
41631
41576
  continue;
41632
41577
  }
@@ -41646,19 +41591,19 @@ this.Twilio.Conversations = (function (exports) {
41646
41591
  }, {
41647
41592
  key: "parsePushNotification",
41648
41593
  value: function parsePushNotification(notificationPayload) {
41649
- log.debug('parsePushNotification, notificationPayload=', notificationPayload); // APNS specifics
41594
+ log.debug("parsePushNotification, notificationPayload=", notificationPayload); // APNS specifics
41650
41595
 
41651
- if (typeof notificationPayload.aps !== 'undefined') {
41596
+ if (typeof notificationPayload.aps !== "undefined") {
41652
41597
  if (!notificationPayload.twi_message_type) {
41653
- throw new Error('Provided push notification payload does not contain Programmable Chat push notification type');
41598
+ throw new Error("Provided push notification payload does not contain Programmable Chat push notification type");
41654
41599
  }
41655
41600
 
41656
41601
  var data = Client_1.parsePushNotificationChatData(notificationPayload);
41657
41602
  var apsPayload = notificationPayload.aps;
41658
- var body = null;
41603
+ var body;
41659
41604
  var title = null;
41660
41605
 
41661
- if (typeof apsPayload.alert === 'string') {
41606
+ if (typeof apsPayload.alert === "string") {
41662
41607
  body = apsPayload.alert || null;
41663
41608
  } else {
41664
41609
  body = apsPayload.alert.body || null;
@@ -41677,11 +41622,11 @@ this.Twilio.Conversations = (function (exports) {
41677
41622
  } // FCM specifics
41678
41623
 
41679
41624
 
41680
- if (typeof notificationPayload.data !== 'undefined') {
41625
+ if (typeof notificationPayload.data !== "undefined") {
41681
41626
  var dataPayload = notificationPayload.data;
41682
41627
 
41683
41628
  if (!dataPayload.twi_message_type) {
41684
- throw new Error('Provided push notification payload does not contain Programmable Chat push notification type');
41629
+ throw new Error("Provided push notification payload does not contain Programmable Chat push notification type");
41685
41630
  }
41686
41631
 
41687
41632
  var _data = Client_1.parsePushNotificationChatData(notificationPayload.data);
@@ -41697,16 +41642,16 @@ this.Twilio.Conversations = (function (exports) {
41697
41642
  });
41698
41643
  }
41699
41644
 
41700
- throw new Error('Provided push notification payload is not Programmable Chat notification');
41645
+ throw new Error("Provided push notification payload is not Programmable Chat notification");
41701
41646
  }
41702
41647
  }]);
41703
41648
 
41704
41649
  return Client;
41705
- }(ReplayEventEmitter_1), _defineProperty$3(_class, "version", SDK_VERSION), _defineProperty$3(_class, "supportedPushChannels", ['fcm', 'apn']), _defineProperty$3(_class, "supportedPushDataFields", {
41706
- 'conversation_sid': 'conversationSid',
41707
- 'message_sid': 'messageSid',
41708
- 'message_index': 'messageIndex'
41709
- }), _defineProperty$3(_class, "conversationAdded", 'conversationAdded'), _defineProperty$3(_class, "conversationJoined", 'conversationJoined'), _defineProperty$3(_class, "conversationLeft", 'conversationLeft'), _defineProperty$3(_class, "conversationRemoved", 'conversationRemoved'), _defineProperty$3(_class, "conversationUpdated", 'conversationUpdated'), _defineProperty$3(_class, "participantJoined", 'participantJoined'), _defineProperty$3(_class, "participantLeft", 'participantLeft'), _defineProperty$3(_class, "participantUpdated", 'participantUpdated'), _defineProperty$3(_class, "messageAdded", 'messageAdded'), _defineProperty$3(_class, "messageRemoved", 'messageRemoved'), _defineProperty$3(_class, "messageUpdated", 'messageUpdated'), _defineProperty$3(_class, "tokenAboutToExpire", 'tokenAboutToExpire'), _defineProperty$3(_class, "tokenExpired", 'tokenExpired'), _defineProperty$3(_class, "typingEnded", 'typingEnded'), _defineProperty$3(_class, "typingStarted", 'typingStarted'), _defineProperty$3(_class, "pushNotification", 'pushNotification'), _defineProperty$3(_class, "userSubscribed", 'userSubscribed'), _defineProperty$3(_class, "userUnsubscribed", 'userUnsubscribed'), _defineProperty$3(_class, "userUpdated", 'userUpdated'), _defineProperty$3(_class, "stateChanged", 'stateChanged'), _defineProperty$3(_class, "connectionStateChanged", 'connectionStateChanged'), _defineProperty$3(_class, "connectionError", 'connectionError'), _temp);
41650
+ }(ReplayEventEmitter_1), _defineProperty$3(_class, "version", SDK_VERSION), _defineProperty$3(_class, "supportedPushChannels", ["fcm", "apn"]), _defineProperty$3(_class, "supportedPushDataFields", {
41651
+ conversation_sid: "conversationSid",
41652
+ message_sid: "messageSid",
41653
+ message_index: "messageIndex"
41654
+ }), _defineProperty$3(_class, "conversationAdded", "conversationAdded"), _defineProperty$3(_class, "conversationJoined", "conversationJoined"), _defineProperty$3(_class, "conversationLeft", "conversationLeft"), _defineProperty$3(_class, "conversationRemoved", "conversationRemoved"), _defineProperty$3(_class, "conversationUpdated", "conversationUpdated"), _defineProperty$3(_class, "participantJoined", "participantJoined"), _defineProperty$3(_class, "participantLeft", "participantLeft"), _defineProperty$3(_class, "participantUpdated", "participantUpdated"), _defineProperty$3(_class, "messageAdded", "messageAdded"), _defineProperty$3(_class, "messageRemoved", "messageRemoved"), _defineProperty$3(_class, "messageUpdated", "messageUpdated"), _defineProperty$3(_class, "tokenAboutToExpire", "tokenAboutToExpire"), _defineProperty$3(_class, "tokenExpired", "tokenExpired"), _defineProperty$3(_class, "typingEnded", "typingEnded"), _defineProperty$3(_class, "typingStarted", "typingStarted"), _defineProperty$3(_class, "pushNotification", "pushNotification"), _defineProperty$3(_class, "userSubscribed", "userSubscribed"), _defineProperty$3(_class, "userUnsubscribed", "userUnsubscribed"), _defineProperty$3(_class, "userUpdated", "userUpdated"), _defineProperty$3(_class, "stateChanged", "stateChanged"), _defineProperty$3(_class, "connectionStateChanged", "connectionStateChanged"), _defineProperty$3(_class, "connectionError", "connectionError"), _temp);
41710
41655
 
41711
41656
  __decorate$1([validateTypesAsync_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "updateToken", null);
41712
41657
 
@@ -41714,27 +41659,27 @@ this.Twilio.Conversations = (function (exports) {
41714
41659
 
41715
41660
  __decorate$1([validateTypesAsync_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "getConversationByUniqueName", null);
41716
41661
 
41717
- __decorate$1([validateTypesAsync_1(['undefined', objectSchema_1('conversation options', {
41718
- friendlyName: ['string', 'undefined'],
41719
- isPrivate: ['boolean', 'undefined'],
41720
- uniqueName: ['string', 'undefined']
41662
+ __decorate$1([validateTypesAsync_1(["undefined", objectSchema_1("conversation options", {
41663
+ friendlyName: ["string", "undefined"],
41664
+ isPrivate: ["boolean", "undefined"],
41665
+ uniqueName: ["string", "undefined"]
41721
41666
  })]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "createConversation", null);
41722
41667
 
41723
- __decorate$1([validateTypesAsync_1(literal_1('fcm', 'apn'), 'string'), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "setPushRegistrationId", null);
41668
+ __decorate$1([validateTypesAsync_1(literal_1("fcm", "apn"), "string"), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "setPushRegistrationId", null);
41724
41669
 
41725
- __decorate$1([validateTypesAsync_1(literal_1('fcm', 'apn')), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "unsetPushRegistrationId", null);
41670
+ __decorate$1([validateTypesAsync_1(literal_1("fcm", "apn")), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "unsetPushRegistrationId", null);
41726
41671
 
41727
- __decorate$1([validateTypesAsync_1(literal_1('fcm', 'apn'), nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "removePushRegistrations", null);
41672
+ __decorate$1([validateTypesAsync_1(literal_1("fcm", "apn"), nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "removePushRegistrations", null);
41728
41673
 
41729
41674
  __decorate$1([validateTypesAsync_1(pureObject_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "handlePushNotification", null);
41730
41675
 
41731
41676
  __decorate$1([validateTypesAsync_1(nonEmptyString_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String]), __metadata$1("design:returntype", Promise)], exports.Client.prototype, "getUser", null);
41732
41677
 
41733
- __decorate$1([validateTypesAsync_1('string', ['undefined', pureObject_1]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, Object]), __metadata$1("design:returntype", Promise)], exports.Client, "create", null);
41678
+ __decorate$1([validateTypesAsync_1("string", ["undefined", pureObject_1]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, Object]), __metadata$1("design:returntype", Promise)], exports.Client, "create", null);
41734
41679
 
41735
41680
  __decorate$1([validateTypes_1(pureObject_1), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", PushNotification)], exports.Client, "parsePushNotification", null);
41736
41681
 
41737
- exports.Client = Client_1 = __decorate$1([validateConstructorTypes_1(nonEmptyString_1, [pureObject_1, 'undefined']), __metadata$1("design:paramtypes", [String, Object])], exports.Client);
41682
+ exports.Client = Client_1 = __decorate$1([validateConstructorTypes_1(nonEmptyString_1, [pureObject_1, "undefined"]), __metadata$1("design:paramtypes", [String, Object])], exports.Client);
41738
41683
 
41739
41684
  exports.AggregatedDeliveryReceipt = AggregatedDeliveryReceipt;
41740
41685
  exports.Conversation = Conversation;