@twilio/conversations 2.0.1-rc.7 → 2.1.0-rc.1

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 (57) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/builds/browser.js +249 -65
  3. package/builds/browser.js.map +1 -1
  4. package/builds/lib.d.ts +86 -9
  5. package/builds/lib.js +249 -65
  6. package/builds/lib.js.map +1 -1
  7. package/builds/twilio-conversations.js +254 -251
  8. package/builds/twilio-conversations.min.js +3 -3
  9. package/dist/conversation.js +24 -10
  10. package/dist/conversation.js.map +1 -1
  11. package/dist/data/conversations.js +1 -1
  12. package/dist/data/conversations.js.map +1 -1
  13. package/dist/data/messages.js +1 -1
  14. package/dist/data/messages.js.map +1 -1
  15. package/dist/data/participants.js +7 -3
  16. package/dist/data/participants.js.map +1 -1
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/interfaces/attributes.js +147 -0
  20. package/dist/interfaces/attributes.js.map +1 -0
  21. package/dist/message-builder.js +52 -0
  22. package/dist/message-builder.js.map +1 -1
  23. package/dist/message.js +35 -4
  24. package/dist/message.js.map +1 -1
  25. package/dist/packages/conversations/package.json.js +1 -1
  26. package/dist/participant.js +20 -3
  27. package/dist/participant.js.map +1 -1
  28. package/dist/user.js +2 -1
  29. package/dist/user.js.map +1 -1
  30. package/docs/assets/js/search.js +1 -1
  31. package/docs/classes/AggregatedDeliveryReceipt.html +15 -0
  32. package/docs/classes/Client.html +15 -0
  33. package/docs/classes/Conversation.html +24 -2
  34. package/docs/classes/DetailedDeliveryReceipt.html +15 -0
  35. package/docs/classes/Media.html +15 -0
  36. package/docs/classes/Message.html +83 -2
  37. package/docs/classes/MessageBuilder.html +91 -0
  38. package/docs/classes/Participant.html +45 -1
  39. package/docs/classes/PushNotification.html +15 -0
  40. package/docs/classes/RestPaginator.html +15 -0
  41. package/docs/classes/UnsentMessage.html +15 -0
  42. package/docs/classes/User.html +15 -0
  43. package/docs/index.html +37 -3
  44. package/docs/interfaces/ClientOptions.html +15 -0
  45. package/docs/interfaces/ConversationBindings.html +3118 -0
  46. package/docs/interfaces/ConversationEmailBinding.html +3118 -0
  47. package/docs/interfaces/ConversationState.html +15 -0
  48. package/docs/interfaces/CreateConversationOptions.html +15 -0
  49. package/docs/interfaces/LastMessage.html +15 -0
  50. package/docs/interfaces/Paginator.html +15 -0
  51. package/docs/interfaces/ParticipantBindings.html +3118 -0
  52. package/docs/interfaces/ParticipantEmailBinding.html +3118 -0
  53. package/docs/interfaces/PushNotificationData.html +15 -0
  54. package/docs/interfaces/SendEmailOptions.html +15 -0
  55. package/docs/interfaces/SendMediaOptions.html +15 -0
  56. package/docs/modules.html +37 -3
  57. package/package.json +9 -9
@@ -6591,6 +6591,13 @@ this.Twilio.Conversations = (function (exports) {
6591
6591
  var validateTypes_1 = browser$6.validateTypes = validateTypes;
6592
6592
  var validateTypesAsync_1 = browser$6.validateTypesAsync = validateTypesAsync;
6593
6593
 
6594
+ var attributesValidator = custom_1(function (value) {
6595
+ return [['string', 'number', 'boolean', 'object'].includes(_typeof$4(value)), 'a JSON type'];
6596
+ });
6597
+ var optionalAttributesValidator = custom_1(function (value) {
6598
+ return [['undefined', 'string', 'number', 'boolean', 'object'].includes(_typeof$4(value)), 'an optional JSON type'];
6599
+ });
6600
+
6594
6601
  var browser$5 = {};
6595
6602
 
6596
6603
  /*
@@ -9758,7 +9765,7 @@ this.Twilio.Conversations = (function (exports) {
9758
9765
  return User;
9759
9766
  }(ReplayEventEmitter_1);
9760
9767
 
9761
- __decorate$1([validateTypesAsync_1(['string', 'number', 'boolean', 'object', literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], User.prototype, "updateAttributes", null);
9768
+ __decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], User.prototype, "updateAttributes", null);
9762
9769
 
9763
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);
9764
9771
 
@@ -16193,7 +16200,7 @@ this.Twilio.Conversations = (function (exports) {
16193
16200
  }();
16194
16201
 
16195
16202
  var logInstance = new Logger("");
16196
- var version = "0.12.1-rc.4";
16203
+ var version = "0.12.1";
16197
16204
  /**
16198
16205
  * Settings container for the Twilsock client library
16199
16206
  */
@@ -20046,6 +20053,7 @@ this.Twilio.Conversations = (function (exports) {
20046
20053
  var _slicedToArray = slicedToArray.exports;
20047
20054
  var _toConsumableArray = toConsumableArray.exports;
20048
20055
  var logger = loglevel.exports;
20056
+ var uuid = uuid_1;
20049
20057
  var declarativeTypeValidator = browser$6;
20050
20058
 
20051
20059
  function _interopDefaultLegacy(e) {
@@ -20102,6 +20110,8 @@ this.Twilio.Conversations = (function (exports) {
20102
20110
 
20103
20111
  var logger__namespace = /*#__PURE__*/_interopNamespace(logger);
20104
20112
 
20113
+ var uuid__namespace = /*#__PURE__*/_interopNamespace(uuid);
20114
+
20105
20115
  function __decorate(decorators, target, key, desc) {
20106
20116
  var c = arguments.length,
20107
20117
  r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
@@ -21165,189 +21175,6 @@ this.Twilio.Conversations = (function (exports) {
21165
21175
  return RegistrarConnector;
21166
21176
  }(Connector);
21167
21177
 
21168
- var rngBrowser = {
21169
- exports: {}
21170
- }; // browser this is a little complicated due to unknown quality of Math.random()
21171
- // and inconsistent support for the `crypto` API. We do the best we can via
21172
- // feature-detection
21173
- // getRandomValues needs to be invoked in a context where "this" is a Crypto
21174
- // implementation. Also, find the complete implementation of crypto on IE11.
21175
-
21176
- var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
21177
-
21178
- if (getRandomValues) {
21179
- // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
21180
- var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
21181
-
21182
- rngBrowser.exports = function whatwgRNG() {
21183
- getRandomValues(rnds8);
21184
- return rnds8;
21185
- };
21186
- } else {
21187
- // Math.random()-based (RNG)
21188
- //
21189
- // If all else fails, use Math.random(). It's fast, but is of unspecified
21190
- // quality.
21191
- var rnds = new Array(16);
21192
-
21193
- rngBrowser.exports = function mathRNG() {
21194
- for (var i = 0, r; i < 16; i++) {
21195
- if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
21196
- rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
21197
- }
21198
-
21199
- return rnds;
21200
- };
21201
- }
21202
- /**
21203
- * Convert array of 16 byte values to UUID string format of the form:
21204
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
21205
- */
21206
-
21207
-
21208
- var byteToHex = [];
21209
-
21210
- for (var i = 0; i < 256; ++i) {
21211
- byteToHex[i] = (i + 0x100).toString(16).substr(1);
21212
- }
21213
-
21214
- function bytesToUuid$2(buf, offset) {
21215
- var i = offset || 0;
21216
- var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
21217
-
21218
- return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
21219
- }
21220
-
21221
- var bytesToUuid_1 = bytesToUuid$2;
21222
- var rng$1 = rngBrowser.exports;
21223
- var bytesToUuid$1 = bytesToUuid_1; // **`v1()` - Generate time-based UUID**
21224
- //
21225
- // Inspired by https://github.com/LiosK/UUID.js
21226
- // and http://docs.python.org/library/uuid.html
21227
-
21228
- var _nodeId;
21229
-
21230
- var _clockseq; // Previous uuid creation time
21231
-
21232
-
21233
- var _lastMSecs = 0;
21234
- var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
21235
-
21236
- function v1$1(options, buf, offset) {
21237
- var i = buf && offset || 0;
21238
- var b = buf || [];
21239
- options = options || {};
21240
- var node = options.node || _nodeId;
21241
- var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
21242
- // specified. We do this lazily to minimize issues related to insufficient
21243
- // system entropy. See #189
21244
-
21245
- if (node == null || clockseq == null) {
21246
- var seedBytes = rng$1();
21247
-
21248
- if (node == null) {
21249
- // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
21250
- node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
21251
- }
21252
-
21253
- if (clockseq == null) {
21254
- // Per 4.2.2, randomize (14 bit) clockseq
21255
- clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
21256
- }
21257
- } // UUID timestamps are 100 nano-second units since the Gregorian epoch,
21258
- // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
21259
- // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
21260
- // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
21261
-
21262
-
21263
- var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock
21264
- // cycle to simulate higher resolution clock
21265
-
21266
- var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
21267
-
21268
- var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
21269
-
21270
- if (dt < 0 && options.clockseq === undefined) {
21271
- clockseq = clockseq + 1 & 0x3fff;
21272
- } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
21273
- // time interval
21274
-
21275
-
21276
- if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
21277
- nsecs = 0;
21278
- } // Per 4.2.1.2 Throw error if too many uuids are requested
21279
-
21280
-
21281
- if (nsecs >= 10000) {
21282
- throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
21283
- }
21284
-
21285
- _lastMSecs = msecs;
21286
- _lastNSecs = nsecs;
21287
- _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
21288
-
21289
- msecs += 12219292800000; // `time_low`
21290
-
21291
- var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
21292
- b[i++] = tl >>> 24 & 0xff;
21293
- b[i++] = tl >>> 16 & 0xff;
21294
- b[i++] = tl >>> 8 & 0xff;
21295
- b[i++] = tl & 0xff; // `time_mid`
21296
-
21297
- var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
21298
- b[i++] = tmh >>> 8 & 0xff;
21299
- b[i++] = tmh & 0xff; // `time_high_and_version`
21300
-
21301
- b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
21302
-
21303
- b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
21304
-
21305
- b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
21306
-
21307
- b[i++] = clockseq & 0xff; // `node`
21308
-
21309
- for (var n = 0; n < 6; ++n) {
21310
- b[i + n] = node[n];
21311
- }
21312
-
21313
- return buf ? buf : bytesToUuid$1(b);
21314
- }
21315
-
21316
- var v1_1 = v1$1;
21317
- var rng = rngBrowser.exports;
21318
- var bytesToUuid = bytesToUuid_1;
21319
-
21320
- function v4$1(options, buf, offset) {
21321
- var i = buf && offset || 0;
21322
-
21323
- if (typeof options == 'string') {
21324
- buf = options === 'binary' ? new Array(16) : null;
21325
- options = null;
21326
- }
21327
-
21328
- options = options || {};
21329
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
21330
-
21331
- rnds[6] = rnds[6] & 0x0f | 0x40;
21332
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
21333
-
21334
- if (buf) {
21335
- for (var ii = 0; ii < 16; ++ii) {
21336
- buf[i + ii] = rnds[ii];
21337
- }
21338
- }
21339
-
21340
- return buf || bytesToUuid(rnds);
21341
- }
21342
-
21343
- var v4_1 = v4$1;
21344
- var v1 = v1_1;
21345
- var v4 = v4_1;
21346
- var uuid = v4;
21347
- uuid.v1 = v1;
21348
- uuid.v4 = v4;
21349
- var uuid_1 = uuid;
21350
-
21351
21178
  function _createSuper$1(Derived) {
21352
21179
  var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
21353
21180
 
@@ -21403,7 +21230,7 @@ this.Twilio.Conversations = (function (exports) {
21403
21230
 
21404
21231
  _this = _super.call(this, "twilsock");
21405
21232
 
21406
- _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "contextId", uuid_1.v4());
21233
+ _defineProperty__default['default'](_assertThisInitialized__default['default'](_this), "contextId", uuid__namespace.v4());
21407
21234
 
21408
21235
  _this.productId = productId;
21409
21236
  _this.platform = platform;
@@ -30732,7 +30559,7 @@ this.Twilio.Conversations = (function (exports) {
30732
30559
 
30733
30560
  __decorate([declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0)], InstantQuery.prototype, "updateIndexName", null);
30734
30561
 
30735
- var version$1 = "3.0.6-rc.4";
30562
+ var version$1 = "3.0.6";
30736
30563
 
30737
30564
  function _createSuper$9(Derived) {
30738
30565
  var hasNativeReflectConstruct = _isNativeReflectConstruct$a();
@@ -34720,7 +34547,7 @@ this.Twilio.Conversations = (function (exports) {
34720
34547
  return Network;
34721
34548
  }();
34722
34549
 
34723
- var version = "0.5.2-rc.4";
34550
+ var version = "0.5.2";
34724
34551
 
34725
34552
  var _class, _temp;
34726
34553
 
@@ -34989,6 +34816,8 @@ this.Twilio.Conversations = (function (exports) {
34989
34816
  * @internal
34990
34817
  */
34991
34818
  function Participant(data, sid, conversation, links, services) {
34819
+ var _data$bindings;
34820
+
34992
34821
  var _this;
34993
34822
 
34994
34823
  _classCallCheck$4(this, Participant);
@@ -35009,7 +34838,8 @@ this.Twilio.Conversations = (function (exports) {
35009
34838
  lastReadMessageIndex: Number.isInteger(data.lastConsumedMessageIndex) ? data.lastConsumedMessageIndex : null,
35010
34839
  lastReadTimestamp: data.lastConsumptionTimestamp ? parseTime$1(data.lastConsumptionTimestamp) : null,
35011
34840
  type: data.type || 'chat',
35012
- userInfo: data.userInfo
34841
+ userInfo: data.userInfo,
34842
+ bindings: (_data$bindings = data.bindings) !== null && _data$bindings !== void 0 ? _data$bindings : {}
35013
34843
  };
35014
34844
 
35015
34845
  if (!data.identity && !data.type) {
@@ -35112,7 +34942,7 @@ this.Twilio.Conversations = (function (exports) {
35112
34942
  return this.state.roleSid;
35113
34943
  }
35114
34944
  /**
35115
- * Message type of the participant.
34945
+ * Type of the participant.
35116
34946
  */
35117
34947
 
35118
34948
  }, {
@@ -35120,6 +34950,21 @@ this.Twilio.Conversations = (function (exports) {
35120
34950
  get: function get() {
35121
34951
  return this.state.type;
35122
34952
  }
34953
+ /**
34954
+ * Get the bindings mapping for the current participant.
34955
+ * Available binding depends on the participant type.
34956
+ * You could access it as `participant.bindings.sms?.address` or
34957
+ * using the type dynamically `participant.bindings[participant.type]`
34958
+ * just be aware that the binding information has different structure for
34959
+ * each participant type.
34960
+ * See also {ParticipantEmailBinding}, the only available currently binding descriptor.
34961
+ */
34962
+
34963
+ }, {
34964
+ key: "bindings",
34965
+ get: function get() {
34966
+ return this.state.bindings;
34967
+ }
35123
34968
  }, {
35124
34969
  key: "_startTyping",
35125
34970
  value:
@@ -35206,6 +35051,11 @@ this.Twilio.Conversations = (function (exports) {
35206
35051
  }
35207
35052
  }
35208
35053
 
35054
+ if (data.bindings && !isEqual(this.state.bindings, data.bindings)) {
35055
+ this.state.bindings = data.bindings;
35056
+ updateReasons.push('bindings');
35057
+ }
35058
+
35209
35059
  if (updateReasons.length > 0) {
35210
35060
  this.emit('updated', {
35211
35061
  participant: this,
@@ -35325,7 +35175,7 @@ this.Twilio.Conversations = (function (exports) {
35325
35175
 
35326
35176
  _defineProperty$3(Participant, "updated", 'updated');
35327
35177
 
35328
- __decorate$1([validateTypesAsync_1(['string', 'number', 'boolean', 'object', literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
35178
+ __decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Participant.prototype, "updateAttributes", null);
35329
35179
 
35330
35180
  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); }; }
35331
35181
 
@@ -35505,19 +35355,38 @@ this.Twilio.Conversations = (function (exports) {
35505
35355
 
35506
35356
  }, {
35507
35357
  key: "getParticipants",
35508
- value: function getParticipants() {
35509
- var _this4 = this;
35358
+ value: function () {
35359
+ var _getParticipants = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3() {
35360
+ var _this4 = this;
35510
35361
 
35511
- return this.rosterEntityPromise.then(function () {
35512
- var participants = [];
35362
+ return _regeneratorRuntime$1.wrap(function _callee3$(_context3) {
35363
+ while (1) {
35364
+ switch (_context3.prev = _context3.next) {
35365
+ case 0:
35366
+ return _context3.abrupt("return", this.rosterEntityPromise.then(function () {
35367
+ var participants = [];
35513
35368
 
35514
- _this4.participants.forEach(function (participant) {
35515
- return participants.push(participant);
35516
- });
35369
+ _this4.participants.forEach(function (participant) {
35370
+ return participants.push(participant);
35371
+ });
35517
35372
 
35518
- return participants;
35519
- });
35520
- }
35373
+ return participants;
35374
+ }));
35375
+
35376
+ case 1:
35377
+ case "end":
35378
+ return _context3.stop();
35379
+ }
35380
+ }
35381
+ }, _callee3, this);
35382
+ }));
35383
+
35384
+ function getParticipants() {
35385
+ return _getParticipants.apply(this, arguments);
35386
+ }
35387
+
35388
+ return getParticipants;
35389
+ }()
35521
35390
  /**
35522
35391
  * Get participant by SID from conversation
35523
35392
  * @returns {Promise<Participant>}
@@ -35526,14 +35395,14 @@ this.Twilio.Conversations = (function (exports) {
35526
35395
  }, {
35527
35396
  key: "getParticipantBySid",
35528
35397
  value: function () {
35529
- var _getParticipantBySid = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee3(participantSid) {
35398
+ var _getParticipantBySid = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(participantSid) {
35530
35399
  var _this5 = this;
35531
35400
 
35532
- return _regeneratorRuntime$1.wrap(function _callee3$(_context3) {
35401
+ return _regeneratorRuntime$1.wrap(function _callee4$(_context4) {
35533
35402
  while (1) {
35534
- switch (_context3.prev = _context3.next) {
35403
+ switch (_context4.prev = _context4.next) {
35535
35404
  case 0:
35536
- return _context3.abrupt("return", this.rosterEntityPromise.then(function () {
35405
+ return _context4.abrupt("return", this.rosterEntityPromise.then(function () {
35537
35406
  var participant = _this5.participants.get(participantSid);
35538
35407
 
35539
35408
  if (!participant) {
@@ -35545,10 +35414,10 @@ this.Twilio.Conversations = (function (exports) {
35545
35414
 
35546
35415
  case 1:
35547
35416
  case "end":
35548
- return _context3.stop();
35417
+ return _context4.stop();
35549
35418
  }
35550
35419
  }
35551
- }, _callee3, this);
35420
+ }, _callee4, this);
35552
35421
  }));
35553
35422
 
35554
35423
  function getParticipantBySid(_x3) {
@@ -35565,16 +35434,16 @@ this.Twilio.Conversations = (function (exports) {
35565
35434
  }, {
35566
35435
  key: "getParticipantByIdentity",
35567
35436
  value: function () {
35568
- var _getParticipantByIdentity = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee4(identity) {
35437
+ var _getParticipantByIdentity = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(identity) {
35569
35438
  var _this6 = this;
35570
35439
 
35571
35440
  var foundParticipant;
35572
- return _regeneratorRuntime$1.wrap(function _callee4$(_context4) {
35441
+ return _regeneratorRuntime$1.wrap(function _callee5$(_context5) {
35573
35442
  while (1) {
35574
- switch (_context4.prev = _context4.next) {
35443
+ switch (_context5.prev = _context5.next) {
35575
35444
  case 0:
35576
35445
  foundParticipant = null;
35577
- return _context4.abrupt("return", this.rosterEntityPromise.then(function () {
35446
+ return _context5.abrupt("return", this.rosterEntityPromise.then(function () {
35578
35447
  _this6.participants.forEach(function (participant) {
35579
35448
  if (participant.identity === identity) {
35580
35449
  foundParticipant = participant;
@@ -35590,10 +35459,10 @@ this.Twilio.Conversations = (function (exports) {
35590
35459
 
35591
35460
  case 2:
35592
35461
  case "end":
35593
- return _context4.stop();
35462
+ return _context5.stop();
35594
35463
  }
35595
35464
  }
35596
- }, _callee4, this);
35465
+ }, _callee5, this);
35597
35466
  }));
35598
35467
 
35599
35468
  function getParticipantByIdentity(_x4) {
@@ -35610,26 +35479,26 @@ this.Twilio.Conversations = (function (exports) {
35610
35479
  }, {
35611
35480
  key: "add",
35612
35481
  value: function () {
35613
- var _add = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(identity, attributes) {
35614
- return _regeneratorRuntime$1.wrap(function _callee5$(_context5) {
35482
+ var _add = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee6(identity, attributes) {
35483
+ return _regeneratorRuntime$1.wrap(function _callee6$(_context6) {
35615
35484
  while (1) {
35616
- switch (_context5.prev = _context5.next) {
35485
+ switch (_context6.prev = _context6.next) {
35617
35486
  case 0:
35618
- _context5.next = 2;
35487
+ _context6.next = 2;
35619
35488
  return this.services.commandExecutor.mutateResource('post', this.links.participants, {
35620
35489
  identity: identity,
35621
35490
  attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined
35622
35491
  });
35623
35492
 
35624
35493
  case 2:
35625
- return _context5.abrupt("return", _context5.sent);
35494
+ return _context6.abrupt("return", _context6.sent);
35626
35495
 
35627
35496
  case 3:
35628
35497
  case "end":
35629
- return _context5.stop();
35498
+ return _context6.stop();
35630
35499
  }
35631
35500
  }
35632
- }, _callee5, this);
35501
+ }, _callee6, this);
35633
35502
  }));
35634
35503
 
35635
35504
  function add(_x5, _x6) {
@@ -35644,17 +35513,24 @@ this.Twilio.Conversations = (function (exports) {
35644
35513
  * @param proxyAddress
35645
35514
  * @param address
35646
35515
  * @param attributes
35516
+ * @param bindingOptions
35647
35517
  * @returns {Promise<any>}
35648
35518
  */
35649
35519
 
35650
35520
  }, {
35651
35521
  key: "addNonChatParticipant",
35652
- value: function addNonChatParticipant(proxyAddress, address, attributes) {
35522
+ value: function addNonChatParticipant(proxyAddress, address) {
35523
+ var _bindingOptions$email, _bindingOptions$email2;
35524
+
35525
+ var attributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
35526
+ var bindingOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
35653
35527
  return this.services.commandExecutor.mutateResource('post', this.links.participants, {
35654
35528
  attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined,
35655
35529
  messaging_binding: {
35656
35530
  address: address,
35657
- proxy_address: proxyAddress
35531
+ proxy_address: proxyAddress,
35532
+ name: bindingOptions === null || bindingOptions === void 0 ? void 0 : (_bindingOptions$email = bindingOptions.email) === null || _bindingOptions$email === void 0 ? void 0 : _bindingOptions$email.name,
35533
+ level: bindingOptions === null || bindingOptions === void 0 ? void 0 : (_bindingOptions$email2 = bindingOptions.email) === null || _bindingOptions$email2 === void 0 ? void 0 : _bindingOptions$email2.level
35658
35534
  }
35659
35535
  });
35660
35536
  }
@@ -36402,7 +36278,7 @@ this.Twilio.Conversations = (function (exports) {
36402
36278
  return this.state.attributes;
36403
36279
  }
36404
36280
  /**
36405
- * Push notification type of the message.
36281
+ * Type of the message.
36406
36282
  */
36407
36283
 
36408
36284
  }, {
@@ -36411,7 +36287,7 @@ this.Twilio.Conversations = (function (exports) {
36411
36287
  return this.state.type;
36412
36288
  }
36413
36289
  /**
36414
- * One of the attached media.
36290
+ * One of the attached media (if present).
36415
36291
  * @deprecated Use attachedMedia instead. Note that the latter is now an array.
36416
36292
  */
36417
36293
 
@@ -36463,6 +36339,38 @@ this.Twilio.Conversations = (function (exports) {
36463
36339
  return categories.includes(m.category);
36464
36340
  });
36465
36341
  }
36342
+ /**
36343
+ * Get a media descriptor for an email body attachment of a provided type.
36344
+ * Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.
36345
+ * @param type Type of email body to request, defaults to `text/plain`.
36346
+ */
36347
+
36348
+ }, {
36349
+ key: "getEmailBody",
36350
+ value: function getEmailBody() {
36351
+ var _this$getMediaByCateg, _this$getMediaByCateg2;
36352
+
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) {
36355
+ return m.contentType == type;
36356
+ }).shift()) !== null && _this$getMediaByCateg !== void 0 ? _this$getMediaByCateg : null;
36357
+ }
36358
+ /**
36359
+ * Get a media descriptor for an email history attachment of a provided type.
36360
+ * Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.
36361
+ * @param type Type of email history to request, defaults to `text/plain`.
36362
+ */
36363
+
36364
+ }, {
36365
+ key: "getEmailHistory",
36366
+ value: function getEmailHistory() {
36367
+ var _this$getMediaByCateg3, _this$getMediaByCateg4;
36368
+
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) {
36371
+ return m.contentType == type;
36372
+ }).shift()) !== null && _this$getMediaByCateg3 !== void 0 ? _this$getMediaByCateg3 : null;
36373
+ }
36466
36374
  }, {
36467
36375
  key: "_update",
36468
36376
  value: function _update(data) {
@@ -36876,14 +36784,18 @@ this.Twilio.Conversations = (function (exports) {
36876
36784
 
36877
36785
  _defineProperty$3(Message, "updated", 'updated');
36878
36786
 
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);
36788
+
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);
36790
+
36879
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);
36880
36792
 
36881
- __decorate$1([validateTypesAsync_1(['string', 'number', 'boolean', 'object', literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Message.prototype, "updateAttributes", null);
36793
+ __decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Message.prototype, "updateAttributes", null);
36882
36794
 
36883
36795
  __decorate$1([validateTypesAsync_1(custom_1(function (value) {
36884
36796
  return [value instanceof Array && value.length > 0 && value.reduce(function (a, c) {
36885
36797
  return a && c instanceof Media;
36886
- }), 'a non-empty array of Media'];
36798
+ }, true), 'a non-empty array of Media'];
36887
36799
  })), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Array]), __metadata$1("design:returntype", Promise)], Message.prototype, "attachTemporaryUrlsFor", null);
36888
36800
 
36889
36801
  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; } } }; }
@@ -37068,7 +36980,7 @@ this.Twilio.Conversations = (function (exports) {
37068
36980
  /**
37069
36981
  * Send Message to the conversation, message could include both text and multiple media attachments.
37070
36982
  * @param message Message to post
37071
- * @returns Returns promise which can fail
36983
+ * @returns Returns a promise which can fail
37072
36984
  */
37073
36985
 
37074
36986
  }, {
@@ -37541,6 +37453,8 @@ this.Twilio.Conversations = (function (exports) {
37541
37453
 
37542
37454
  this.limits = limits;
37543
37455
  this.message = new UnsentMessage(messagesEntity);
37456
+ this.emailBodies = new Map();
37457
+ this.emailHistories = new Map();
37544
37458
  }
37545
37459
  /**
37546
37460
  * Sets the message body.
@@ -37576,6 +37490,30 @@ this.Twilio.Conversations = (function (exports) {
37576
37490
  this.message.attributes = attributes;
37577
37491
  return this;
37578
37492
  }
37493
+ /**
37494
+ * Set email body with given MIME-type.
37495
+ * @param mimeType Format of the body to set (text/plain or text/html).
37496
+ * @param body Body payload in selected format.
37497
+ */
37498
+
37499
+ }, {
37500
+ key: "setEmailBody",
37501
+ value: function setEmailBody(mimeType, body) {
37502
+ this.emailBodies.set(mimeType, body);
37503
+ return this;
37504
+ }
37505
+ /**
37506
+ * Set email history with given MIME-type.
37507
+ * @param mimeType Format of the history to set (text/plain or text/html).
37508
+ * @param history History payload in selected format.
37509
+ */
37510
+
37511
+ }, {
37512
+ key: "setEmailHistory",
37513
+ value: function setEmailHistory(mimeType, history) {
37514
+ this.emailHistories.set(mimeType, history);
37515
+ return this;
37516
+ }
37579
37517
  /**
37580
37518
  * Adds media to the message.
37581
37519
  * @param payload Media to add.
@@ -37584,6 +37522,18 @@ this.Twilio.Conversations = (function (exports) {
37584
37522
  }, {
37585
37523
  key: "addMedia",
37586
37524
  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');
37527
+ }
37528
+
37529
+ if (!(payload instanceof FormData)) {
37530
+ var mediaOptions = payload;
37531
+
37532
+ if (!mediaOptions.contentType || !mediaOptions.media) {
37533
+ throw new Error('Media content in SendMediaOptions must contain non-empty contentType and media');
37534
+ }
37535
+ }
37536
+
37587
37537
  this.message.mediaContent.push(['media', payload]);
37588
37538
  return this;
37589
37539
  }
@@ -37594,11 +37544,39 @@ this.Twilio.Conversations = (function (exports) {
37594
37544
  }, {
37595
37545
  key: "build",
37596
37546
  value: function build() {
37547
+ var _this = this;
37548
+
37549
+ this.emailBodies.forEach(function (_, key) {
37550
+ if (!_this.limits.emailBodiesAllowedMimeTypes.includes(key)) {
37551
+ throw new Error("Unsupported email body MIME type ".concat(key));
37552
+ }
37553
+ });
37554
+ this.emailHistories.forEach(function (_, key) {
37555
+ if (!_this.limits.emailHistoriesAllowedMimeTypes.includes(key)) {
37556
+ throw new Error("Unsupported email history MIME type ".concat(key));
37557
+ }
37558
+ });
37559
+
37560
+ if (this.emailBodies.size > this.limits.emailBodiesAllowedMimeTypes.length) {
37561
+ throw new Error("Too many email bodies attached to the message (".concat(this.emailBodies.size, " > ").concat(this.limits.emailBodiesAllowedMimeTypes.length, ")"));
37562
+ }
37563
+
37564
+ if (this.emailHistories.size > this.limits.emailHistoriesAllowedMimeTypes.length) {
37565
+ throw new Error("Too many email histories attached to the message (".concat(this.emailHistories.size, " > ").concat(this.limits.emailHistoriesAllowedMimeTypes.length, ")"));
37566
+ }
37567
+
37597
37568
  if (this.message.mediaContent.length > this.limits.mediaAttachmentsCountLimit) {
37598
37569
  throw new Error("Too many media attachments in the message (".concat(this.message.mediaContent.length, " > ").concat(this.limits.mediaAttachmentsCountLimit, ")"));
37599
37570
  } // @todo we don't know the sizes of the attachments in FormData
37571
+ // @todo insertion below makes build() method non-repeatable - probably move to UnsentMessage.send() or even sendV2()?
37600
37572
 
37601
37573
 
37574
+ this.emailBodies.forEach(function (body) {
37575
+ _this.message.mediaContent.push(['body', body]);
37576
+ });
37577
+ this.emailHistories.forEach(function (history) {
37578
+ _this.message.mediaContent.push(['history', history]);
37579
+ });
37602
37580
  return this.message;
37603
37581
  }
37604
37582
  }, {
@@ -37637,7 +37615,8 @@ this.Twilio.Conversations = (function (exports) {
37637
37615
  sid: 'sid',
37638
37616
  status: 'status',
37639
37617
  uniqueName: 'uniqueName',
37640
- state: 'state'
37618
+ state: 'state',
37619
+ bindings: 'bindings'
37641
37620
  };
37642
37621
 
37643
37622
  function parseTime(timeString) {
@@ -37665,6 +37644,8 @@ this.Twilio.Conversations = (function (exports) {
37665
37644
  * @internal
37666
37645
  */
37667
37646
  function Conversation(descriptor, sid, links, configuration, services) {
37647
+ var _descriptor$bindings;
37648
+
37668
37649
  var _this;
37669
37650
 
37670
37651
  _classCallCheck$4(this, Conversation);
@@ -37697,7 +37678,8 @@ this.Twilio.Conversations = (function (exports) {
37697
37678
  dateCreated: dateCreated,
37698
37679
  dateUpdated: dateUpdated,
37699
37680
  friendlyName: friendlyName,
37700
- lastReadMessageIndex: lastReadMessageIndex
37681
+ lastReadMessageIndex: lastReadMessageIndex,
37682
+ bindings: (_descriptor$bindings = descriptor.bindings) !== null && _descriptor$bindings !== void 0 ? _descriptor$bindings : {}
37701
37683
  };
37702
37684
 
37703
37685
  if (descriptor.notificationLevel) {
@@ -37831,6 +37813,11 @@ this.Twilio.Conversations = (function (exports) {
37831
37813
  get: function get() {
37832
37814
  return this.channelState.notificationLevel;
37833
37815
  }
37816
+ }, {
37817
+ key: "bindings",
37818
+ get: function get() {
37819
+ return this.channelState.bindings;
37820
+ }
37834
37821
  }, {
37835
37822
  key: "limits",
37836
37823
  get: function get() {
@@ -38120,6 +38107,15 @@ this.Twilio.Conversations = (function (exports) {
38120
38107
  updateReasons.add(localKey);
38121
38108
  break;
38122
38109
 
38110
+ case fieldMappings.bindings:
38111
+ if (isEqual(this.channelState.bindings, update.bindings)) {
38112
+ break;
38113
+ }
38114
+
38115
+ this.channelState.bindings = update.bindings;
38116
+ updateReasons.add(localKey);
38117
+ break;
38118
+
38123
38119
  default:
38124
38120
  var isDate = update[key] instanceof Date;
38125
38121
  var keysMatchAsDates = isDate && ((_this$channelState$lo = this.channelState[localKey]) === null || _this$channelState$lo === void 0 ? void 0 : _this$channelState$lo.getTime()) === update[key].getTime();
@@ -38215,7 +38211,7 @@ this.Twilio.Conversations = (function (exports) {
38215
38211
  while (1) {
38216
38212
  switch (_context4.prev = _context4.next) {
38217
38213
  case 0:
38218
- return _context4.abrupt("return", this.participantsEntity.add(identity, attributes));
38214
+ return _context4.abrupt("return", this.participantsEntity.add(identity, attributes !== null && attributes !== void 0 ? attributes : {}));
38219
38215
 
38220
38216
  case 1:
38221
38217
  case "end":
@@ -38236,19 +38232,25 @@ this.Twilio.Conversations = (function (exports) {
38236
38232
  * @param proxyAddress Proxy (Twilio) address of the participant.
38237
38233
  * @param address User address of the participant.
38238
38234
  * @param attributes Attributes to be attached to the participant.
38235
+ * @param bindingOptions Options for adding email participants - name and CC/To level.
38239
38236
  */
38240
38237
 
38241
38238
  }, {
38242
38239
  key: "addNonChatParticipant",
38243
38240
  value: function () {
38244
- var _addNonChatParticipant = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(proxyAddress, address, attributes) {
38241
+ var _addNonChatParticipant = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1.mark(function _callee5(proxyAddress, address) {
38242
+ var attributes,
38243
+ bindingOptions,
38244
+ _args5 = arguments;
38245
38245
  return _regeneratorRuntime$1.wrap(function _callee5$(_context5) {
38246
38246
  while (1) {
38247
38247
  switch (_context5.prev = _context5.next) {
38248
38248
  case 0:
38249
- return _context5.abrupt("return", this.participantsEntity.addNonChatParticipant(proxyAddress, address, attributes));
38249
+ attributes = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
38250
+ bindingOptions = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : {};
38251
+ return _context5.abrupt("return", this.participantsEntity.addNonChatParticipant(proxyAddress, address, attributes !== null && attributes !== void 0 ? attributes : {}, bindingOptions !== null && bindingOptions !== void 0 ? bindingOptions : {}));
38250
38252
 
38251
- case 1:
38253
+ case 3:
38252
38254
  case "end":
38253
38255
  return _context5.stop();
38254
38256
  }
@@ -38256,7 +38258,7 @@ this.Twilio.Conversations = (function (exports) {
38256
38258
  }, _callee5, this);
38257
38259
  }));
38258
38260
 
38259
- function addNonChatParticipant(_x4, _x5, _x6) {
38261
+ function addNonChatParticipant(_x4, _x5) {
38260
38262
  return _addNonChatParticipant.apply(this, arguments);
38261
38263
  }
38262
38264
 
@@ -38308,7 +38310,7 @@ this.Twilio.Conversations = (function (exports) {
38308
38310
  }, _callee6, this);
38309
38311
  }));
38310
38312
 
38311
- function advanceLastReadMessageIndex(_x7) {
38313
+ function advanceLastReadMessageIndex(_x6) {
38312
38314
  return _advanceLastReadMessageIndex.apply(this, arguments);
38313
38315
  }
38314
38316
 
@@ -38409,7 +38411,7 @@ this.Twilio.Conversations = (function (exports) {
38409
38411
  }, _callee9, this);
38410
38412
  }));
38411
38413
 
38412
- function getMessages(_x8, _x9, _x10) {
38414
+ function getMessages(_x7, _x8, _x9) {
38413
38415
  return _getMessages.apply(this, arguments);
38414
38416
  }
38415
38417
 
@@ -38512,7 +38514,7 @@ this.Twilio.Conversations = (function (exports) {
38512
38514
  }, _callee12, this);
38513
38515
  }));
38514
38516
 
38515
- function getParticipantBySid(_x11) {
38517
+ function getParticipantBySid(_x10) {
38516
38518
  return _getParticipantBySid.apply(this, arguments);
38517
38519
  }
38518
38520
 
@@ -38541,7 +38543,7 @@ this.Twilio.Conversations = (function (exports) {
38541
38543
  }, _callee13, this);
38542
38544
  }));
38543
38545
 
38544
- function getParticipantByIdentity(_x12) {
38546
+ function getParticipantByIdentity(_x11) {
38545
38547
  return _getParticipantByIdentity.apply(this, arguments);
38546
38548
  }
38547
38549
 
@@ -38751,7 +38753,7 @@ this.Twilio.Conversations = (function (exports) {
38751
38753
  }, _callee18, this);
38752
38754
  }));
38753
38755
 
38754
- function removeParticipant(_x13) {
38756
+ function removeParticipant(_x12) {
38755
38757
  return _removeParticipant.apply(this, arguments);
38756
38758
  }
38757
38759
 
@@ -38804,7 +38806,7 @@ this.Twilio.Conversations = (function (exports) {
38804
38806
  }, _callee19, this);
38805
38807
  }));
38806
38808
 
38807
- function sendMessage(_x14, _x15, _x16) {
38809
+ function sendMessage(_x13, _x14, _x15) {
38808
38810
  return _sendMessage.apply(this, arguments);
38809
38811
  }
38810
38812
 
@@ -38813,6 +38815,7 @@ this.Twilio.Conversations = (function (exports) {
38813
38815
  /**
38814
38816
  * New interface to prepare for sending a message.
38815
38817
  * Use instead of `sendMessage`.
38818
+ * @return A MessageBuilder to help set all message sending options.
38816
38819
  */
38817
38820
 
38818
38821
  }, {
@@ -38931,7 +38934,7 @@ this.Twilio.Conversations = (function (exports) {
38931
38934
  }, _callee22, this);
38932
38935
  }));
38933
38936
 
38934
- function setUserNotificationLevel(_x17) {
38937
+ function setUserNotificationLevel(_x16) {
38935
38938
  return _setUserNotificationLevel.apply(this, arguments);
38936
38939
  }
38937
38940
 
@@ -38976,7 +38979,7 @@ this.Twilio.Conversations = (function (exports) {
38976
38979
  }, _callee23, this);
38977
38980
  }));
38978
38981
 
38979
- function updateAttributes(_x18) {
38982
+ function updateAttributes(_x17) {
38980
38983
  return _updateAttributes.apply(this, arguments);
38981
38984
  }
38982
38985
 
@@ -39016,7 +39019,7 @@ this.Twilio.Conversations = (function (exports) {
39016
39019
  }, _callee24, this);
39017
39020
  }));
39018
39021
 
39019
- function updateFriendlyName(_x19) {
39022
+ function updateFriendlyName(_x18) {
39020
39023
  return _updateFriendlyName.apply(this, arguments);
39021
39024
  }
39022
39025
 
@@ -39051,7 +39054,7 @@ this.Twilio.Conversations = (function (exports) {
39051
39054
  }, _callee25, this);
39052
39055
  }));
39053
39056
 
39054
- function updateLastReadMessageIndex(_x20) {
39057
+ function updateLastReadMessageIndex(_x19) {
39055
39058
  return _updateLastReadMessageIndex.apply(this, arguments);
39056
39059
  }
39057
39060
 
@@ -39095,7 +39098,7 @@ this.Twilio.Conversations = (function (exports) {
39095
39098
  }, _callee26, this);
39096
39099
  }));
39097
39100
 
39098
- function updateUniqueName(_x21) {
39101
+ function updateUniqueName(_x20) {
39099
39102
  return _updateUniqueName.apply(this, arguments);
39100
39103
  }
39101
39104
 
@@ -39167,9 +39170,9 @@ this.Twilio.Conversations = (function (exports) {
39167
39170
 
39168
39171
  _defineProperty$3(Conversation, "removed", 'removed');
39169
39172
 
39170
- __decorate$1([validateTypesAsync_1(nonEmptyString_1, ['undefined', 'string', 'number', 'boolean', 'object', literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "add", null);
39173
+ __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);
39171
39174
 
39172
- __decorate$1([validateTypesAsync_1(nonEmptyString_1, nonEmptyString_1, ['undefined', 'string', 'number', 'boolean', 'object', literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, String, Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
39175
+ __decorate$1([validateTypesAsync_1(nonEmptyString_1, nonEmptyString_1, optionalAttributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [String, String, Object, Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
39173
39176
 
39174
39177
  __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);
39175
39178
 
@@ -39195,13 +39198,13 @@ this.Twilio.Conversations = (function (exports) {
39195
39198
 
39196
39199
  return [isValid, 'a non-empty string, an instance of Buffer or an instance of Blob'];
39197
39200
  })
39198
- })], ['undefined', 'string', 'number', 'boolean', 'object', literal_1(null)], ['undefined', literal_1(null), objectSchema_1('email attributes', {
39201
+ })], optionalAttributesValidator, ['undefined', literal_1(null), objectSchema_1('email attributes', {
39199
39202
  subject: [nonEmptyString_1, 'undefined']
39200
39203
  })]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object, Object, Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "sendMessage", null);
39201
39204
 
39202
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);
39203
39206
 
39204
- __decorate$1([validateTypesAsync_1(['string', 'number', 'boolean', 'object', literal_1(null)]), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateAttributes", null);
39207
+ __decorate$1([validateTypesAsync_1(attributesValidator), __metadata$1("design:type", Function), __metadata$1("design:paramtypes", [Object]), __metadata$1("design:returntype", Promise)], Conversation.prototype, "updateAttributes", null);
39205
39208
 
39206
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);
39207
39210
 
@@ -39944,7 +39947,7 @@ this.Twilio.Conversations = (function (exports) {
39944
39947
  channel: conversationDescriptor.sync_objects.conversation,
39945
39948
  messages: conversationDescriptor.sync_objects.messages,
39946
39949
  roster: "".concat(conversationDescriptor.conversation_sid, ".roster"),
39947
- lastConsumedMessageIndex: conversationDescriptor.last_consumed_message_index,
39950
+ lastConsumedMessageIndex: conversationDescriptor.last_read_message_index,
39948
39951
  notificationLevel: conversationDescriptor.notification_level
39949
39952
  };
39950
39953
  });
@@ -40482,7 +40485,7 @@ this.Twilio.Conversations = (function (exports) {
40482
40485
  this.data = data.data || {};
40483
40486
  };
40484
40487
 
40485
- var version = "2.0.1-rc.7";
40488
+ var version = "2.1.0-rc.1";
40486
40489
 
40487
40490
  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; }
40488
40491