@twilio/conversations 2.4.1 → 2.5.0-rc.0

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.
@@ -4487,9 +4487,11 @@ this.Twilio.Conversations = (function (exports) {
4487
4487
  var MAXIMUM_RETRY_DELAY$1 = 4000;
4488
4488
  var MAXIMUM_ATTEMPTS_COUNT = 3;
4489
4489
  var RETRY_WHEN_THROTTLED = true;
4490
+ var CHANNEL_METADATA_CACHE_CAPACITY = 100;
4491
+ var MESSAGE_RECIPIENTS_CACHE_CAPACITY = 1000;
4490
4492
 
4491
4493
  var Configuration$1 = /*#__PURE__*/_createClass$4(function Configuration() {
4492
- var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad;
4494
+ var _ref, _constructorOptions$u, _ref2, _constructorOptions$h, _ref3, _constructorOptions$c, _options$channelMetad, _options$messageRecip;
4493
4495
 
4494
4496
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4495
4497
  var configurationResponse = arguments.length > 1 ? arguments[1] : undefined;
@@ -4548,7 +4550,8 @@ this.Twilio.Conversations = (function (exports) {
4548
4550
  this.consumptionReportInterval = toSeconds_1(parse_1(CONSUMPTION_HORIZON_SENDING_INTERVAL));
4549
4551
  }
4550
4552
 
4551
- this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : 100;
4553
+ this.channelMetadataCacheCapacity = (_options$channelMetad = options.channelMetadataCacheCapacity) !== null && _options$channelMetad !== void 0 ? _options$channelMetad : CHANNEL_METADATA_CACHE_CAPACITY;
4554
+ this.messageRecipientsCacheCapacity = (_options$messageRecip = options.messageRecipientsCacheCapacity) !== null && _options$messageRecip !== void 0 ? _options$messageRecip : MESSAGE_RECIPIENTS_CACHE_CAPACITY;
4552
4555
  });
4553
4556
 
4554
4557
  var wellKnownSymbol$a = wellKnownSymbol$s;
@@ -6685,11 +6688,11 @@ this.Twilio.Conversations = (function (exports) {
6685
6688
  });
6686
6689
  };
6687
6690
 
6688
- function _createForOfIteratorHelper$6(o, allowArrayLike) {
6691
+ function _createForOfIteratorHelper$7(o, allowArrayLike) {
6689
6692
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
6690
6693
 
6691
6694
  if (!it) {
6692
- if (Array.isArray(o) || (it = _unsupportedIterableToArray$7(o)) || allowArrayLike && o && typeof o.length === "number") {
6695
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray$8(o)) || allowArrayLike && o && typeof o.length === "number") {
6693
6696
  if (it) o = it;
6694
6697
  var i = 0;
6695
6698
 
@@ -6742,16 +6745,16 @@ this.Twilio.Conversations = (function (exports) {
6742
6745
  };
6743
6746
  }
6744
6747
 
6745
- function _unsupportedIterableToArray$7(o, minLen) {
6748
+ function _unsupportedIterableToArray$8(o, minLen) {
6746
6749
  if (!o) return;
6747
- if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
6750
+ if (typeof o === "string") return _arrayLikeToArray$8(o, minLen);
6748
6751
  var n = Object.prototype.toString.call(o).slice(8, -1);
6749
6752
  if (n === "Object" && o.constructor) n = o.constructor.name;
6750
6753
  if (n === "Map" || n === "Set") return Array.from(o);
6751
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
6754
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$8(o, minLen);
6752
6755
  }
6753
6756
 
6754
- function _arrayLikeToArray$7(arr, len) {
6757
+ function _arrayLikeToArray$8(arr, len) {
6755
6758
  if (len == null || len > arr.length) len = arr.length;
6756
6759
 
6757
6760
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -6767,7 +6770,7 @@ this.Twilio.Conversations = (function (exports) {
6767
6770
  return [false, "an array of ".concat(name)];
6768
6771
  }
6769
6772
 
6770
- var _iterator = _createForOfIteratorHelper$6(value.entries()),
6773
+ var _iterator = _createForOfIteratorHelper$7(value.entries()),
6771
6774
  _step;
6772
6775
 
6773
6776
  try {
@@ -6811,7 +6814,7 @@ this.Twilio.Conversations = (function (exports) {
6811
6814
  var validateTypes_1 = browser$7.validateTypes = validateTypes;
6812
6815
  var validateTypesAsync_1 = browser$7.validateTypesAsync = validateTypesAsync;
6813
6816
 
6814
- function _arrayLikeToArray$6(arr, len) {
6817
+ function _arrayLikeToArray$7(arr, len) {
6815
6818
  if (len == null || len > arr.length) len = arr.length;
6816
6819
 
6817
6820
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -6822,20 +6825,20 @@ this.Twilio.Conversations = (function (exports) {
6822
6825
  }
6823
6826
 
6824
6827
  function _arrayWithoutHoles(arr) {
6825
- if (Array.isArray(arr)) return _arrayLikeToArray$6(arr);
6828
+ if (Array.isArray(arr)) return _arrayLikeToArray$7(arr);
6826
6829
  }
6827
6830
 
6828
6831
  function _iterableToArray(iter) {
6829
6832
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
6830
6833
  }
6831
6834
 
6832
- function _unsupportedIterableToArray$6(o, minLen) {
6835
+ function _unsupportedIterableToArray$7(o, minLen) {
6833
6836
  if (!o) return;
6834
- if (typeof o === "string") return _arrayLikeToArray$6(o, minLen);
6837
+ if (typeof o === "string") return _arrayLikeToArray$7(o, minLen);
6835
6838
  var n = Object.prototype.toString.call(o).slice(8, -1);
6836
6839
  if (n === "Object" && o.constructor) n = o.constructor.name;
6837
6840
  if (n === "Map" || n === "Set") return Array.from(o);
6838
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
6841
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$7(o, minLen);
6839
6842
  }
6840
6843
 
6841
6844
  function _nonIterableSpread() {
@@ -6843,7 +6846,7 @@ this.Twilio.Conversations = (function (exports) {
6843
6846
  }
6844
6847
 
6845
6848
  function _toConsumableArray$1(arr) {
6846
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread();
6849
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$7(arr) || _nonIterableSpread();
6847
6850
  }
6848
6851
 
6849
6852
  var json = custom_1(function (value) {
@@ -10006,7 +10009,7 @@ this.Twilio.Conversations = (function (exports) {
10006
10009
  }
10007
10010
 
10008
10011
  function _slicedToArray$1(arr, i) {
10009
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$6(arr, i) || _nonIterableRest();
10012
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$7(arr, i) || _nonIterableRest();
10010
10013
  }
10011
10014
 
10012
10015
  var internalMetadata = {exports: {}};
@@ -11337,11 +11340,11 @@ this.Twilio.Conversations = (function (exports) {
11337
11340
  browser$5.Backoff = Backoff;
11338
11341
  var Retrier_1 = browser$5.Retrier = Retrier;
11339
11342
 
11340
- function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(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; } } }; }
11343
+ function _createForOfIteratorHelper$6(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$6(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; } } }; }
11341
11344
 
11342
- function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
11345
+ function _unsupportedIterableToArray$6(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$6(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen); }
11343
11346
 
11344
- function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
11347
+ function _arrayLikeToArray$6(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
11345
11348
 
11346
11349
  var Network = /*#__PURE__*/function () {
11347
11350
  function Network(configuration, services) {
@@ -11362,7 +11365,7 @@ this.Twilio.Conversations = (function (exports) {
11362
11365
  }, {
11363
11366
  key: "cleanupCache",
11364
11367
  value: function cleanupCache() {
11365
- var _iterator = _createForOfIteratorHelper$5(this.cache),
11368
+ var _iterator = _createForOfIteratorHelper$6(this.cache),
11366
11369
  _step;
11367
11370
 
11368
11371
  try {
@@ -26172,11 +26175,11 @@ this.Twilio.Conversations = (function (exports) {
26172
26175
  return TreeMap;
26173
26176
  }();
26174
26177
 
26175
- function _createForOfIteratorHelper$4(o, allowArrayLike) {
26178
+ function _createForOfIteratorHelper$5(o, allowArrayLike) {
26176
26179
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
26177
26180
 
26178
26181
  if (!it) {
26179
- if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") {
26182
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") {
26180
26183
  if (it) o = it;
26181
26184
  var i = 0;
26182
26185
 
@@ -26229,16 +26232,16 @@ this.Twilio.Conversations = (function (exports) {
26229
26232
  };
26230
26233
  }
26231
26234
 
26232
- function _unsupportedIterableToArray$4(o, minLen) {
26235
+ function _unsupportedIterableToArray$5(o, minLen) {
26233
26236
  if (!o) return;
26234
- if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
26237
+ if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
26235
26238
  var n = Object.prototype.toString.call(o).slice(8, -1);
26236
26239
  if (n === "Object" && o.constructor) n = o.constructor.name;
26237
26240
  if (n === "Map" || n === "Set") return Array.from(o);
26238
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
26241
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
26239
26242
  }
26240
26243
 
26241
- function _arrayLikeToArray$4(arr, len) {
26244
+ function _arrayLikeToArray$5(arr, len) {
26242
26245
  if (len == null || len > arr.length) len = arr.length;
26243
26246
 
26244
26247
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -26345,7 +26348,7 @@ this.Twilio.Conversations = (function (exports) {
26345
26348
  key: "forEach",
26346
26349
  value: function forEach(callbackfn) {
26347
26350
  if (this.items) {
26348
- var _iterator = _createForOfIteratorHelper$4(this.items),
26351
+ var _iterator = _createForOfIteratorHelper$5(this.items),
26349
26352
  _step;
26350
26353
 
26351
26354
  try {
@@ -34885,7 +34888,7 @@ this.Twilio.Conversations = (function (exports) {
34885
34888
  return Network;
34886
34889
  }();
34887
34890
 
34888
- var version = "0.6.6";
34891
+ var version = "0.6.7-rc.0";
34889
34892
 
34890
34893
  var _class;
34891
34894
 
@@ -38124,6 +38127,38 @@ this.Twilio.Conversations = (function (exports) {
38124
38127
 
38125
38128
  return getChannelMetadata;
38126
38129
  }()
38130
+ /**
38131
+ * Get recipients of the message.
38132
+ */
38133
+
38134
+ }, {
38135
+ key: "getMessageRecipients",
38136
+ value: function () {
38137
+ var _getMessageRecipients = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee11() {
38138
+ return _regeneratorRuntime$1.wrap(function _callee11$(_context11) {
38139
+ while (1) {
38140
+ switch (_context11.prev = _context11.next) {
38141
+ case 0:
38142
+ _context11.next = 2;
38143
+ return this.services.messageRecipientsClient.getRecipientsFromMessage(this.conversation.sid, this.sid);
38144
+
38145
+ case 2:
38146
+ return _context11.abrupt("return", _context11.sent);
38147
+
38148
+ case 3:
38149
+ case "end":
38150
+ return _context11.stop();
38151
+ }
38152
+ }
38153
+ }, _callee11, this);
38154
+ }));
38155
+
38156
+ function getMessageRecipients() {
38157
+ return _getMessageRecipients.apply(this, arguments);
38158
+ }
38159
+
38160
+ return getMessageRecipients;
38161
+ }()
38127
38162
  }]);
38128
38163
 
38129
38164
  return Message;
@@ -38173,11 +38208,11 @@ this.Twilio.Conversations = (function (exports) {
38173
38208
 
38174
38209
  function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty$3(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
38175
38210
 
38176
- function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(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; } } }; }
38211
+ function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(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; } } }; }
38177
38212
 
38178
- function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
38213
+ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
38179
38214
 
38180
- function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
38215
+ function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
38181
38216
 
38182
38217
  function _createSuper$5(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); }; }
38183
38218
 
@@ -38385,7 +38420,7 @@ this.Twilio.Conversations = (function (exports) {
38385
38420
  return request.cancel();
38386
38421
  });
38387
38422
  });
38388
- _iterator = _createForOfIteratorHelper$3(message.mediaContent);
38423
+ _iterator = _createForOfIteratorHelper$4(message.mediaContent);
38389
38424
  _context3.prev = 4;
38390
38425
 
38391
38426
  _iterator.s();
@@ -39038,11 +39073,11 @@ this.Twilio.Conversations = (function (exports) {
39038
39073
 
39039
39074
  __decorate$1([validateTypes_1([FormData, sendMediaOptions]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", MessageBuilder)], MessageBuilder.prototype, "addMedia", null);
39040
39075
 
39041
- 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; } } }; }
39076
+ function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(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; } } }; }
39042
39077
 
39043
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
39078
+ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
39044
39079
 
39045
- function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39080
+ function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39046
39081
 
39047
39082
  function _createSuper$4(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); }; }
39048
39083
 
@@ -40328,6 +40363,38 @@ this.Twilio.Conversations = (function (exports) {
40328
40363
 
40329
40364
  return updateUniqueName;
40330
40365
  }()
40366
+ /**
40367
+ * Get recipients of all messages in the conversation.
40368
+ */
40369
+
40370
+ }, {
40371
+ key: "getMessageRecipients",
40372
+ value: function () {
40373
+ var _getMessageRecipients = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee24() {
40374
+ return _regeneratorRuntime$1.wrap(function _callee24$(_context24) {
40375
+ while (1) {
40376
+ switch (_context24.prev = _context24.next) {
40377
+ case 0:
40378
+ _context24.next = 2;
40379
+ return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid);
40380
+
40381
+ case 2:
40382
+ return _context24.abrupt("return", _context24.sent);
40383
+
40384
+ case 3:
40385
+ case "end":
40386
+ return _context24.stop();
40387
+ }
40388
+ }
40389
+ }, _callee24, this);
40390
+ }));
40391
+
40392
+ function getMessageRecipients() {
40393
+ return _getMessageRecipients.apply(this, arguments);
40394
+ }
40395
+
40396
+ return getMessageRecipients;
40397
+ }()
40331
40398
  /**
40332
40399
  * Load and subscribe to this conversation and do not subscribe to its
40333
40400
  * participants and messages. This or _subscribeStreams will need to be called
@@ -40338,31 +40405,31 @@ this.Twilio.Conversations = (function (exports) {
40338
40405
  }, {
40339
40406
  key: "_subscribe",
40340
40407
  value: function () {
40341
- var _subscribe2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee24() {
40408
+ var _subscribe2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee25() {
40342
40409
  var _this2 = this;
40343
40410
 
40344
- return _regeneratorRuntime$1.wrap(function _callee24$(_context24) {
40411
+ return _regeneratorRuntime$1.wrap(function _callee25$(_context25) {
40345
40412
  while (1) {
40346
- switch (_context24.prev = _context24.next) {
40413
+ switch (_context25.prev = _context25.next) {
40347
40414
  case 0:
40348
40415
  if (!this._entityPromise) {
40349
- _context24.next = 2;
40416
+ _context25.next = 2;
40350
40417
  break;
40351
40418
  }
40352
40419
 
40353
- return _context24.abrupt("return", this._entityPromise);
40420
+ return _context25.abrupt("return", this._entityPromise);
40354
40421
 
40355
40422
  case 2:
40356
40423
  this._entityPromise = this._services.syncClient.document({
40357
40424
  id: this._entityName,
40358
40425
  mode: "open_existing"
40359
40426
  });
40360
- _context24.prev = 3;
40361
- _context24.next = 6;
40427
+ _context25.prev = 3;
40428
+ _context25.next = 6;
40362
40429
  return this._entityPromise;
40363
40430
 
40364
40431
  case 6:
40365
- this._entity = _context24.sent;
40432
+ this._entity = _context25.sent;
40366
40433
 
40367
40434
  this._entity.on("updated", function (args) {
40368
40435
  return _this2._update(args.data);
@@ -40374,28 +40441,28 @@ this.Twilio.Conversations = (function (exports) {
40374
40441
 
40375
40442
  this._update(this._entity.data);
40376
40443
 
40377
- return _context24.abrupt("return", this._entity);
40444
+ return _context25.abrupt("return", this._entity);
40378
40445
 
40379
40446
  case 13:
40380
- _context24.prev = 13;
40381
- _context24.t0 = _context24["catch"](3);
40447
+ _context25.prev = 13;
40448
+ _context25.t0 = _context25["catch"](3);
40382
40449
  this._entity = null;
40383
40450
  this._entityPromise = null;
40384
40451
 
40385
40452
  if (this._services.syncClient.connectionState != "disconnected") {
40386
- Conversation._logger.error("Failed to get conversation object", _context24.t0);
40453
+ Conversation._logger.error("Failed to get conversation object", _context25.t0);
40387
40454
  }
40388
40455
 
40389
- Conversation._logger.debug("ERROR: Failed to get conversation object", _context24.t0);
40456
+ Conversation._logger.debug("ERROR: Failed to get conversation object", _context25.t0);
40390
40457
 
40391
- throw _context24.t0;
40458
+ throw _context25.t0;
40392
40459
 
40393
40460
  case 20:
40394
40461
  case "end":
40395
- return _context24.stop();
40462
+ return _context25.stop();
40396
40463
  }
40397
40464
  }
40398
- }, _callee24, this, [[3, 13]]);
40465
+ }, _callee25, this, [[3, 13]]);
40399
40466
  }));
40400
40467
 
40401
40468
  function _subscribe() {
@@ -40417,44 +40484,44 @@ this.Twilio.Conversations = (function (exports) {
40417
40484
  }, {
40418
40485
  key: "_fetchStreams",
40419
40486
  value: function () {
40420
- var _fetchStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee25() {
40487
+ var _fetchStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee26() {
40421
40488
  var _this$_entity, _this$_entity2;
40422
40489
 
40423
40490
  var data;
40424
- return _regeneratorRuntime$1.wrap(function _callee25$(_context25) {
40491
+ return _regeneratorRuntime$1.wrap(function _callee26$(_context26) {
40425
40492
  while (1) {
40426
- switch (_context25.prev = _context25.next) {
40493
+ switch (_context26.prev = _context26.next) {
40427
40494
  case 0:
40428
- _context25.next = 2;
40495
+ _context26.next = 2;
40429
40496
  return this._subscribe();
40430
40497
 
40431
40498
  case 2:
40432
40499
  Conversation._logger.trace("_streamsAvailable, this.entity.data=", (_this$_entity = this._entity) === null || _this$_entity === void 0 ? void 0 : _this$_entity.data);
40433
40500
 
40434
40501
  data = (_this$_entity2 = this._entity) === null || _this$_entity2 === void 0 ? void 0 : _this$_entity2.data;
40435
- _context25.next = 6;
40502
+ _context26.next = 6;
40436
40503
  return this._services.syncClient.list({
40437
40504
  id: data.messages,
40438
40505
  mode: "open_existing"
40439
40506
  });
40440
40507
 
40441
40508
  case 6:
40442
- this._messagesList = _context25.sent;
40443
- _context25.next = 9;
40509
+ this._messagesList = _context26.sent;
40510
+ _context26.next = 9;
40444
40511
  return this._services.syncClient.map({
40445
40512
  id: data.roster,
40446
40513
  mode: "open_existing"
40447
40514
  });
40448
40515
 
40449
40516
  case 9:
40450
- this._participantsMap = _context25.sent;
40517
+ this._participantsMap = _context26.sent;
40451
40518
 
40452
40519
  case 10:
40453
40520
  case "end":
40454
- return _context25.stop();
40521
+ return _context26.stop();
40455
40522
  }
40456
40523
  }
40457
- }, _callee25, this);
40524
+ }, _callee26, this);
40458
40525
  }));
40459
40526
 
40460
40527
  function _fetchStreams() {
@@ -40474,15 +40541,15 @@ this.Twilio.Conversations = (function (exports) {
40474
40541
  }, {
40475
40542
  key: "_subscribeStreams",
40476
40543
  value: function () {
40477
- var _subscribeStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee26() {
40544
+ var _subscribeStreams2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee27() {
40478
40545
  var _this$_entity3, _this$_entity4, _this$_messagesList, _this$_participantsMa, data, messagesObjectName, rosterObjectName;
40479
40546
 
40480
- return _regeneratorRuntime$1.wrap(function _callee26$(_context26) {
40547
+ return _regeneratorRuntime$1.wrap(function _callee27$(_context27) {
40481
40548
  while (1) {
40482
- switch (_context26.prev = _context26.next) {
40549
+ switch (_context27.prev = _context27.next) {
40483
40550
  case 0:
40484
- _context26.prev = 0;
40485
- _context26.next = 3;
40551
+ _context27.prev = 0;
40552
+ _context27.next = 3;
40486
40553
  return this._subscribe();
40487
40554
 
40488
40555
  case 3:
@@ -40491,31 +40558,31 @@ this.Twilio.Conversations = (function (exports) {
40491
40558
  data = (_this$_entity4 = this._entity) === null || _this$_entity4 === void 0 ? void 0 : _this$_entity4.data;
40492
40559
  messagesObjectName = data.messages;
40493
40560
  rosterObjectName = data.roster;
40494
- _context26.next = 9;
40561
+ _context27.next = 9;
40495
40562
  return Promise.all([this._messagesEntity.subscribe((_this$_messagesList = this._messagesList) !== null && _this$_messagesList !== void 0 ? _this$_messagesList : messagesObjectName), this._participantsEntity.subscribe((_this$_participantsMa = this._participantsMap) !== null && _this$_participantsMa !== void 0 ? _this$_participantsMa : rosterObjectName)]);
40496
40563
 
40497
40564
  case 9:
40498
- _context26.next = 16;
40565
+ _context27.next = 16;
40499
40566
  break;
40500
40567
 
40501
40568
  case 11:
40502
- _context26.prev = 11;
40503
- _context26.t0 = _context26["catch"](0);
40569
+ _context27.prev = 11;
40570
+ _context27.t0 = _context27["catch"](0);
40504
40571
 
40505
40572
  if (this._services.syncClient.connectionState !== "disconnected") {
40506
- Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context26.t0);
40573
+ Conversation._logger.error("Failed to subscribe on conversation objects", this.sid, _context27.t0);
40507
40574
  }
40508
40575
 
40509
- Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context26.t0);
40576
+ Conversation._logger.debug("ERROR: Failed to subscribe on conversation objects", this.sid, _context27.t0);
40510
40577
 
40511
- throw _context26.t0;
40578
+ throw _context27.t0;
40512
40579
 
40513
40580
  case 16:
40514
40581
  case "end":
40515
- return _context26.stop();
40582
+ return _context27.stop();
40516
40583
  }
40517
40584
  }
40518
- }, _callee26, this, [[0, 11]]);
40585
+ }, _callee27, this, [[0, 11]]);
40519
40586
  }));
40520
40587
 
40521
40588
  function _subscribeStreams() {
@@ -40532,17 +40599,17 @@ this.Twilio.Conversations = (function (exports) {
40532
40599
  }, {
40533
40600
  key: "_unsubscribe",
40534
40601
  value: function () {
40535
- var _unsubscribe2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee27() {
40536
- return _regeneratorRuntime$1.wrap(function _callee27$(_context27) {
40602
+ var _unsubscribe2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee28() {
40603
+ return _regeneratorRuntime$1.wrap(function _callee28$(_context28) {
40537
40604
  while (1) {
40538
- switch (_context27.prev = _context27.next) {
40605
+ switch (_context28.prev = _context28.next) {
40539
40606
  case 0:
40540
40607
  if (!this._entity) {
40541
- _context27.next = 5;
40608
+ _context28.next = 5;
40542
40609
  break;
40543
40610
  }
40544
40611
 
40545
- _context27.next = 3;
40612
+ _context28.next = 3;
40546
40613
  return this._entity.close();
40547
40614
 
40548
40615
  case 3:
@@ -40550,14 +40617,14 @@ this.Twilio.Conversations = (function (exports) {
40550
40617
  this._entityPromise = null;
40551
40618
 
40552
40619
  case 5:
40553
- return _context27.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
40620
+ return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
40554
40621
 
40555
40622
  case 6:
40556
40623
  case "end":
40557
- return _context27.stop();
40624
+ return _context28.stop();
40558
40625
  }
40559
40626
  }
40560
- }, _callee27, this);
40627
+ }, _callee28, this);
40561
40628
  }));
40562
40629
 
40563
40630
  function _unsubscribe() {
@@ -40734,7 +40801,7 @@ this.Twilio.Conversations = (function (exports) {
40734
40801
  }, {
40735
40802
  key: "_onMessageAdded",
40736
40803
  value: function _onMessageAdded(message) {
40737
- var _iterator = _createForOfIteratorHelper$2(this._participants.values()),
40804
+ var _iterator = _createForOfIteratorHelper$3(this._participants.values()),
40738
40805
  _step;
40739
40806
 
40740
40807
  try {
@@ -40763,27 +40830,27 @@ this.Twilio.Conversations = (function (exports) {
40763
40830
  }, {
40764
40831
  key: "_setLastReadMessageIndex",
40765
40832
  value: function () {
40766
- var _setLastReadMessageIndex2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee28(index) {
40833
+ var _setLastReadMessageIndex2 = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee29(index) {
40767
40834
  var result;
40768
- return _regeneratorRuntime$1.wrap(function _callee28$(_context28) {
40835
+ return _regeneratorRuntime$1.wrap(function _callee29$(_context29) {
40769
40836
  while (1) {
40770
- switch (_context28.prev = _context28.next) {
40837
+ switch (_context29.prev = _context29.next) {
40771
40838
  case 0:
40772
- _context28.next = 2;
40839
+ _context29.next = 2;
40773
40840
  return this._services.commandExecutor.mutateResource("post", "".concat(this._configuration.links.myConversations, "/").concat(this.sid), {
40774
40841
  last_read_message_index: index
40775
40842
  });
40776
40843
 
40777
40844
  case 2:
40778
- result = _context28.sent;
40779
- return _context28.abrupt("return", result.unread_messages_count);
40845
+ result = _context29.sent;
40846
+ return _context29.abrupt("return", result.unread_messages_count);
40780
40847
 
40781
40848
  case 4:
40782
40849
  case "end":
40783
- return _context28.stop();
40850
+ return _context29.stop();
40784
40851
  }
40785
40852
  }
40786
- }, _callee28, this);
40853
+ }, _callee29, this);
40787
40854
  }));
40788
40855
 
40789
40856
  function _setLastReadMessageIndex(_x19) {
@@ -40942,11 +41009,11 @@ this.Twilio.Conversations = (function (exports) {
40942
41009
  return Deferred;
40943
41010
  }();
40944
41011
 
40945
- function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(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; } } }; }
41012
+ 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; } } }; }
40946
41013
 
40947
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
41014
+ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
40948
41015
 
40949
- function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
41016
+ function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
40950
41017
 
40951
41018
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
40952
41019
 
@@ -41126,7 +41193,7 @@ this.Twilio.Conversations = (function (exports) {
41126
41193
  case 9:
41127
41194
  myConversations = _context2.sent;
41128
41195
  upserts = [];
41129
- _iterator = _createForOfIteratorHelper$1(myConversations);
41196
+ _iterator = _createForOfIteratorHelper$2(myConversations);
41130
41197
 
41131
41198
  try {
41132
41199
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -42229,7 +42296,7 @@ this.Twilio.Conversations = (function (exports) {
42229
42296
  this.data = data.data || {};
42230
42297
  });
42231
42298
 
42232
- var version = "2.4.1";
42299
+ var version = "2.5.0-rc.0";
42233
42300
 
42234
42301
  function _isNativeFunction(fn) {
42235
42302
  return Function.toString.call(fn).indexOf("[native code]") !== -1;
@@ -42716,11 +42783,11 @@ this.Twilio.Conversations = (function (exports) {
42716
42783
  return ContentClient;
42717
42784
  }();
42718
42785
 
42719
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(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; } } }; }
42786
+ function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(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; } } }; }
42720
42787
 
42721
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
42788
+ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
42722
42789
 
42723
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
42790
+ function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
42724
42791
 
42725
42792
  var QuickLRU = /*#__PURE__*/function (_Symbol$iterator) {
42726
42793
  function QuickLRU() {
@@ -42749,7 +42816,7 @@ this.Twilio.Conversations = (function (exports) {
42749
42816
  this._size = 0;
42750
42817
 
42751
42818
  if (typeof this.onEviction === 'function') {
42752
- var _iterator = _createForOfIteratorHelper(this.oldCache.entries()),
42819
+ var _iterator = _createForOfIteratorHelper$1(this.oldCache.entries()),
42753
42820
  _step;
42754
42821
 
42755
42822
  try {
@@ -42841,7 +42908,7 @@ this.Twilio.Conversations = (function (exports) {
42841
42908
  while (1) {
42842
42909
  switch (_context.prev = _context.next) {
42843
42910
  case 0:
42844
- _iterator2 = _createForOfIteratorHelper(this);
42911
+ _iterator2 = _createForOfIteratorHelper$1(this);
42845
42912
  _context.prev = 1;
42846
42913
 
42847
42914
  _iterator2.s();
@@ -42893,7 +42960,7 @@ this.Twilio.Conversations = (function (exports) {
42893
42960
  while (1) {
42894
42961
  switch (_context2.prev = _context2.next) {
42895
42962
  case 0:
42896
- _iterator3 = _createForOfIteratorHelper(this);
42963
+ _iterator3 = _createForOfIteratorHelper$1(this);
42897
42964
  _context2.prev = 1;
42898
42965
 
42899
42966
  _iterator3.s();
@@ -42945,7 +43012,7 @@ this.Twilio.Conversations = (function (exports) {
42945
43012
  while (1) {
42946
43013
  switch (_context3.prev = _context3.next) {
42947
43014
  case 0:
42948
- _iterator4 = _createForOfIteratorHelper(this.cache);
43015
+ _iterator4 = _createForOfIteratorHelper$1(this.cache);
42949
43016
  _context3.prev = 1;
42950
43017
 
42951
43018
  _iterator4.s();
@@ -42982,7 +43049,7 @@ this.Twilio.Conversations = (function (exports) {
42982
43049
  return _context3.finish(14);
42983
43050
 
42984
43051
  case 17:
42985
- _iterator5 = _createForOfIteratorHelper(this.oldCache);
43052
+ _iterator5 = _createForOfIteratorHelper$1(this.oldCache);
42986
43053
  _context3.prev = 18;
42987
43054
 
42988
43055
  _iterator5.s();
@@ -43037,7 +43104,7 @@ this.Twilio.Conversations = (function (exports) {
43037
43104
  get: function get() {
43038
43105
  var oldCacheSize = 0;
43039
43106
 
43040
- var _iterator6 = _createForOfIteratorHelper(this.oldCache.keys()),
43107
+ var _iterator6 = _createForOfIteratorHelper$1(this.oldCache.keys()),
43041
43108
  _step6;
43042
43109
 
43043
43110
  try {
@@ -43174,6 +43241,206 @@ this.Twilio.Conversations = (function (exports) {
43174
43241
  return ChannelMetadataClient;
43175
43242
  }();
43176
43243
 
43244
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(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; } } }; }
43245
+
43246
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
43247
+
43248
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
43249
+ /**
43250
+ * Email recipient descriptor.
43251
+ */
43252
+
43253
+ var EmailRecipientDescriptor = /*#__PURE__*/_createClass$4(
43254
+ /**
43255
+ * Type of recipient.
43256
+ */
43257
+
43258
+ /**
43259
+ * @internal
43260
+ */
43261
+ function EmailRecipientDescriptor(recipient) {
43262
+ _classCallCheck$4(this, EmailRecipientDescriptor);
43263
+
43264
+ _defineProperty$3(this, "type", "email");
43265
+
43266
+ this.messageSid = recipient.message_sid;
43267
+ this.level = recipient.level;
43268
+ this.name = recipient.name;
43269
+ this.address = recipient.address;
43270
+ });
43271
+ /**
43272
+ * Unknown recipient descriptor. Used to be able to handle recipient types that
43273
+ * are not supported by the current version of the SDK.
43274
+ */
43275
+
43276
+
43277
+ var UnknownRecipientDescriptor = /*#__PURE__*/_createClass$4(
43278
+ /**
43279
+ * Type of recipient.
43280
+ */
43281
+
43282
+ /**
43283
+ * Sid of the message that this recipient belongs to.
43284
+ */
43285
+
43286
+ /**
43287
+ * Recipient data as a JSON string.
43288
+ */
43289
+
43290
+ /**
43291
+ * @internal
43292
+ */
43293
+ function UnknownRecipientDescriptor(recipient) {
43294
+ _classCallCheck$4(this, UnknownRecipientDescriptor);
43295
+
43296
+ this.type = recipient.type;
43297
+ this.messageSid = recipient.message_sid;
43298
+ this.rawData = JSON.stringify(recipient);
43299
+ });
43300
+
43301
+ var MessageRecipientsClient = /*#__PURE__*/function () {
43302
+ function MessageRecipientsClient(services, configuration) {
43303
+ _classCallCheck$4(this, MessageRecipientsClient);
43304
+
43305
+ this._services = services;
43306
+ this._configuration = configuration;
43307
+ this._cache = new quickLru({
43308
+ maxSize: configuration.messageRecipientsCacheCapacity
43309
+ });
43310
+ }
43311
+
43312
+ _createClass$4(MessageRecipientsClient, [{
43313
+ key: "getRecipientsFromMessage",
43314
+ value: function () {
43315
+ var _getRecipientsFromMessage = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee(conversationSid, messageSid) {
43316
+ var _this = this;
43317
+
43318
+ var key, cachedItem, url, recipientsResponse, recipients;
43319
+ return _regeneratorRuntime$1.wrap(function _callee$(_context) {
43320
+ while (1) {
43321
+ switch (_context.prev = _context.next) {
43322
+ case 0:
43323
+ key = "".concat(conversationSid, ",").concat(messageSid);
43324
+ cachedItem = this._cache.get(key);
43325
+
43326
+ if (!cachedItem) {
43327
+ _context.next = 4;
43328
+ break;
43329
+ }
43330
+
43331
+ return _context.abrupt("return", cachedItem.item);
43332
+
43333
+ case 4:
43334
+ url = new UriBuilder$1(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("MessageSid", messageSid).build();
43335
+ _context.next = 7;
43336
+ return this._services.commandExecutor.fetchResource(url);
43337
+
43338
+ case 7:
43339
+ recipientsResponse = _context.sent;
43340
+ recipients = recipientsResponse.message_recipients.map(function (recipient) {
43341
+ return _this._wrapResponse(recipient);
43342
+ });
43343
+
43344
+ if (recipients.length > 0) {
43345
+ this._cache.set(key, {
43346
+ item: recipients
43347
+ });
43348
+ }
43349
+
43350
+ return _context.abrupt("return", recipients);
43351
+
43352
+ case 11:
43353
+ case "end":
43354
+ return _context.stop();
43355
+ }
43356
+ }
43357
+ }, _callee, this);
43358
+ }));
43359
+
43360
+ function getRecipientsFromMessage(_x, _x2) {
43361
+ return _getRecipientsFromMessage.apply(this, arguments);
43362
+ }
43363
+
43364
+ return getRecipientsFromMessage;
43365
+ }()
43366
+ }, {
43367
+ key: "getRecipientsFromConversation",
43368
+ value: function () {
43369
+ var _getRecipientsFromConversation = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee2(conversationSid, paginatorOptions) {
43370
+ var _paginatorOptions$pag,
43371
+ _paginatorOptions$pag2,
43372
+ _this2 = this;
43373
+
43374
+ var url, recipientsResponse, allRecipients, _iterator, _step, _this$_cache$get$item, _this$_cache$get, recipient, key, existingMessageRecipients;
43375
+
43376
+ return _regeneratorRuntime$1.wrap(function _callee2$(_context2) {
43377
+ while (1) {
43378
+ switch (_context2.prev = _context2.next) {
43379
+ case 0:
43380
+ url = new UriBuilder$1(this._configuration.links.conversations).path(conversationSid).path("MessageRecipients").arg("PageToken", (_paginatorOptions$pag = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageToken) !== null && _paginatorOptions$pag !== void 0 ? _paginatorOptions$pag : "").arg("PageSize", (_paginatorOptions$pag2 = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _paginatorOptions$pag2 !== void 0 ? _paginatorOptions$pag2 : "").build();
43381
+ _context2.next = 3;
43382
+ return this._services.commandExecutor.fetchResource(url);
43383
+
43384
+ case 3:
43385
+ recipientsResponse = _context2.sent;
43386
+ allRecipients = recipientsResponse.message_recipients.map(function (recipient) {
43387
+ return _this2._wrapResponse(recipient);
43388
+ });
43389
+ _iterator = _createForOfIteratorHelper(allRecipients);
43390
+
43391
+ try {
43392
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
43393
+ recipient = _step.value;
43394
+ key = "".concat(conversationSid, ",").concat(recipient.messageSid);
43395
+ existingMessageRecipients = (_this$_cache$get$item = (_this$_cache$get = this._cache.get(key)) === null || _this$_cache$get === void 0 ? void 0 : _this$_cache$get.item) !== null && _this$_cache$get$item !== void 0 ? _this$_cache$get$item : [];
43396
+
43397
+ this._cache.set(key, {
43398
+ item: [].concat(_toConsumableArray$1(existingMessageRecipients), [recipient])
43399
+ });
43400
+ }
43401
+ } catch (err) {
43402
+ _iterator.e(err);
43403
+ } finally {
43404
+ _iterator.f();
43405
+ }
43406
+
43407
+ return _context2.abrupt("return", new RestPaginator(allRecipients, function (pageToken, pageSize) {
43408
+ return _this2.getRecipientsFromConversation(conversationSid, {
43409
+ pageToken: pageToken,
43410
+ pageSize: pageSize
43411
+ });
43412
+ }, recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token));
43413
+
43414
+ case 8:
43415
+ case "end":
43416
+ return _context2.stop();
43417
+ }
43418
+ }
43419
+ }, _callee2, this);
43420
+ }));
43421
+
43422
+ function getRecipientsFromConversation(_x3, _x4) {
43423
+ return _getRecipientsFromConversation.apply(this, arguments);
43424
+ }
43425
+
43426
+ return getRecipientsFromConversation;
43427
+ }()
43428
+ }, {
43429
+ key: "_wrapResponse",
43430
+ value: function _wrapResponse(recipient) {
43431
+ switch (recipient.type) {
43432
+ case "email":
43433
+ return new EmailRecipientDescriptor(recipient);
43434
+
43435
+ default:
43436
+ return new UnknownRecipientDescriptor(recipient);
43437
+ }
43438
+ }
43439
+ }]);
43440
+
43441
+ return MessageRecipientsClient;
43442
+ }();
43443
+
43177
43444
  var _class;
43178
43445
 
43179
43446
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -44395,6 +44662,7 @@ this.Twilio.Conversations = (function (exports) {
44395
44662
  configurationResponse = _context17.sent;
44396
44663
  this._configuration = new Configuration$1(this._options, configurationResponse, Client_1._logger);
44397
44664
  this._services.channelMetadataClient = new ChannelMetadataClient(this._services, this._configuration);
44665
+ this._services.messageRecipientsClient = new MessageRecipientsClient(this._services, this._configuration);
44398
44666
 
44399
44667
  this._myself._resolveInitialization(this._configuration, this._configuration.userIdentity, this._configuration.userInfo, true);
44400
44668
 
@@ -44473,10 +44741,10 @@ this.Twilio.Conversations = (function (exports) {
44473
44741
  }).catch(function (error) {
44474
44742
  throw error;
44475
44743
  });
44476
- _context17.next = 29;
44744
+ _context17.next = 30;
44477
44745
  return this._services.users.myself._ensureFetched();
44478
44746
 
44479
- case 29:
44747
+ case 30:
44480
44748
  Client_1._supportedPushChannels.forEach(function (channelType) {
44481
44749
  return _this3._subscribeToPushNotifications(channelType);
44482
44750
  });
@@ -44492,7 +44760,7 @@ this.Twilio.Conversations = (function (exports) {
44492
44760
  this.emit("stateChanged", "initialized");
44493
44761
  this.emit("initialized");
44494
44762
 
44495
- case 35:
44763
+ case 36:
44496
44764
  case "end":
44497
44765
  return _context17.stop();
44498
44766
  }
@@ -44749,6 +45017,7 @@ this.Twilio.Conversations = (function (exports) {
44749
45017
  exports.ContentTemplateVariable = ContentTemplateVariable;
44750
45018
  exports.Conversation = Conversation;
44751
45019
  exports.DetailedDeliveryReceipt = DetailedDeliveryReceipt;
45020
+ exports.EmailRecipientDescriptor = EmailRecipientDescriptor;
44752
45021
  exports.Media = Media;
44753
45022
  exports.Message = Message;
44754
45023
  exports.MessageBuilder = MessageBuilder;
@@ -44756,6 +45025,7 @@ this.Twilio.Conversations = (function (exports) {
44756
45025
  exports.Participant = Participant;
44757
45026
  exports.PushNotification = PushNotification;
44758
45027
  exports.RestPaginator = RestPaginator;
45028
+ exports.UnknownRecipientDescriptor = UnknownRecipientDescriptor;
44759
45029
  exports.UnsentMessage = UnsentMessage;
44760
45030
  exports.User = User;
44761
45031