@twilio/conversations 2.5.0-rc.0 → 2.5.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.
package/builds/browser.js CHANGED
@@ -302,11 +302,13 @@ var Logger = /*#__PURE__*/function () {
302
302
  }, {
303
303
  key: "trace",
304
304
  value: function trace() {
305
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
306
- args[_key] = arguments[_key];
307
- }
305
+ if (log$7.getLevel() == log$7.levels.TRACE) {
306
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
307
+ args[_key] = arguments[_key];
308
+ }
308
309
 
309
- log$7.trace.apply(null, prepareLine(this.prefix + "T", args));
310
+ log$7.debug.apply(null, prepareLine(this.prefix + "T", args));
311
+ }
310
312
  }
311
313
  }, {
312
314
  key: "debug",
@@ -357,11 +359,13 @@ var Logger = /*#__PURE__*/function () {
357
359
  }, {
358
360
  key: "trace",
359
361
  value: function trace() {
360
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
361
- args[_key6] = arguments[_key6];
362
- }
362
+ if (log$7.getLevel() == log$7.levels.TRACE) {
363
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
364
+ args[_key6] = arguments[_key6];
365
+ }
363
366
 
364
- log$7.trace.apply(null, prepareLine("T", args));
367
+ log$7.debug.apply(null, prepareLine("T", args));
368
+ }
365
369
  }
366
370
  }, {
367
371
  key: "debug",
@@ -1449,8 +1453,9 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
1449
1453
  }
1450
1454
 
1451
1455
  this.state.isTyping = true;
1452
- this.emit("typingStarted", this);
1453
- this.conversation.emit("typingStarted", this);
1456
+ this.emit(Participant.typingStarted, this);
1457
+ this.conversation.emit(Conversation.typingStarted, this); // @fixme layering violation
1458
+
1454
1459
  this.state.typingTimeout = Number(setTimeout(function () {
1455
1460
  return _this2._endTyping();
1456
1461
  }, timeout));
@@ -1469,8 +1474,8 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
1469
1474
  }
1470
1475
 
1471
1476
  this.state.isTyping = false;
1472
- this.emit("typingEnded", this);
1473
- this.conversation.emit("typingEnded", this);
1477
+ this.emit(Participant.typingEnded, this);
1478
+ this.conversation.emit(Conversation.typingEnded, this);
1474
1479
  clearInterval(this.state.typingTimeout);
1475
1480
  this.state.typingTimeout = null;
1476
1481
  }
@@ -1529,7 +1534,7 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
1529
1534
  }
1530
1535
 
1531
1536
  if (updateReasons.length > 0) {
1532
- this.emit("updated", {
1537
+ this.emit(Participant.updated, {
1533
1538
  participant: this,
1534
1539
  updateReasons: updateReasons
1535
1540
  });
@@ -1665,7 +1670,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
1665
1670
 
1666
1671
  var _super = _createSuper$7(Participants);
1667
1672
 
1668
- function Participants(conversation, participants, links, configuration, services) {
1673
+ // passed in from Conversation
1674
+ function Participants(conversation, participants, links, services) {
1669
1675
  var _this;
1670
1676
 
1671
1677
  _classCallCheck__default["default"](this, Participants);
@@ -1677,7 +1683,6 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
1677
1683
  _this.conversation = conversation;
1678
1684
  _this.participants = participants;
1679
1685
  _this.links = links;
1680
- _this.configuration = configuration;
1681
1686
  _this.services = services;
1682
1687
  return _this;
1683
1688
  }
@@ -1728,14 +1733,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
1728
1733
  mode: "open_existing"
1729
1734
  }) : Promise.resolve(arg);
1730
1735
  return this.rosterEntityPromise = this.rosterEntityPromise || participantsMapPromise.then(function (rosterMap) {
1731
- rosterMap.on("itemAdded", function (args) {
1736
+ rosterMap.on(twilioSync.SyncMap.itemAdded, function (args) {
1732
1737
  log$4.debug(_this2.conversation.sid + " itemAdded: " + args.item.key);
1733
1738
 
1734
1739
  _this2.upsertParticipant(args.item.key, args.item.data).then(function (participant) {
1735
- _this2.emit("participantJoined", participant);
1740
+ _this2.emit(Conversation.participantJoined, participant);
1736
1741
  });
1737
1742
  });
1738
- rosterMap.on("itemRemoved", function (args) {
1743
+ rosterMap.on(twilioSync.SyncMap.itemRemoved, function (args) {
1739
1744
  log$4.debug(_this2.conversation.sid + " itemRemoved: " + args.key);
1740
1745
  var participantSid = args.key;
1741
1746
 
@@ -1751,12 +1756,14 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
1751
1756
  return;
1752
1757
  }
1753
1758
 
1754
- _this2.emit("participantLeft", leftParticipant);
1759
+ _this2.emit(Conversation.participantLeft, leftParticipant);
1755
1760
  });
1756
- rosterMap.on("itemUpdated", function (args) {
1761
+ rosterMap.on(twilioSync.SyncMap.itemUpdated, function (args) {
1757
1762
  log$4.debug(_this2.conversation.sid + " itemUpdated: " + args.item.key);
1758
1763
 
1759
- _this2.upsertParticipant(args.item.key, args.item.data);
1764
+ _this2.upsertParticipant(args.item.key, args.item.data).catch(function (e) {
1765
+ return log$4.error(e);
1766
+ });
1760
1767
  });
1761
1768
  var participantsPromises = [];
1762
1769
 
@@ -1850,8 +1857,8 @@ var Participants = /*#__PURE__*/function (_ReplayEventEmitter) {
1850
1857
  };
1851
1858
  participant = new Participant(data, participantSid, this.conversation, links, this.services);
1852
1859
  this.participants.set(participantSid, participant);
1853
- participant.on("updated", function (args) {
1854
- return _this3.emit("participantUpdated", args);
1860
+ participant.on(Participant.updated, function (args) {
1861
+ return _this3.emit(Conversation.participantUpdated, args);
1855
1862
  });
1856
1863
  return _context3.abrupt("return", participant);
1857
1864
 
@@ -3207,7 +3214,7 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3207
3214
  var _getParticipant = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
3208
3215
  var _this3 = this;
3209
3216
 
3210
- var participant, errorMesage;
3217
+ var participant, errorMessage;
3211
3218
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
3212
3219
  while (1) {
3213
3220
  switch (_context.prev = _context.next) {
@@ -3252,26 +3259,26 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
3252
3259
  return _context.abrupt("return", participant);
3253
3260
 
3254
3261
  case 11:
3255
- errorMesage = "Participant with ";
3262
+ errorMessage = "Participant with ";
3256
3263
 
3257
3264
  if (this.state.participantSid) {
3258
- errorMesage += "SID '" + this.state.participantSid + "' ";
3265
+ errorMessage += "SID '" + this.state.participantSid + "' ";
3259
3266
  }
3260
3267
 
3261
3268
  if (this.state.author) {
3262
3269
  if (this.state.participantSid) {
3263
- errorMesage += "or ";
3270
+ errorMessage += "or ";
3264
3271
  }
3265
3272
 
3266
- errorMesage += "identity '" + this.state.author + "' ";
3273
+ errorMessage += "identity '" + this.state.author + "' ";
3267
3274
  }
3268
3275
 
3269
- if (errorMesage === "Participant with ") {
3270
- errorMesage = "Participant ";
3276
+ if (errorMessage === "Participant with ") {
3277
+ errorMessage = "Participant ";
3271
3278
  }
3272
3279
 
3273
- errorMesage += "was not found";
3274
- throw new Error(errorMesage);
3280
+ errorMessage += "was not found";
3281
+ throw new Error(errorMessage);
3275
3282
 
3276
3283
  case 17:
3277
3284
  case "end":
@@ -4934,32 +4941,39 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4934
4941
  participants: _this._links.participants
4935
4942
  };
4936
4943
  _this._participants = new Map();
4937
- _this._participantsEntity = new Participants(_assertThisInitialized__default["default"](_this), _this._participants, participantsLinks, _this._configuration, _this._services);
4944
+ _this._participantsEntity = new Participants(_assertThisInitialized__default["default"](_this), _this._participants, // state leak
4945
+ participantsLinks, _this._services);
4938
4946
 
4939
- _this._participantsEntity.on("participantJoined", function (participant) {
4940
- return _this.emit("participantJoined", participant);
4947
+ _this._participantsEntity.on(Conversation.participantJoined, function (participant) {
4948
+ return (// @todo update participants map here??
4949
+ _this.emit(Conversation.participantJoined, participant)
4950
+ );
4941
4951
  });
4942
4952
 
4943
- _this._participantsEntity.on("participantLeft", function (participant) {
4944
- return _this.emit("participantLeft", participant);
4953
+ _this._participantsEntity.on(Conversation.participantLeft, function (participant) {
4954
+ return (// @todo update participants map here??
4955
+ _this.emit(Conversation.participantLeft, participant)
4956
+ );
4945
4957
  });
4946
4958
 
4947
- _this._participantsEntity.on("participantUpdated", function (args) {
4948
- return _this.emit("participantUpdated", args);
4959
+ _this._participantsEntity.on(Conversation.participantUpdated, function (args) {
4960
+ return (// @todo update participants map here??
4961
+ _this.emit(Conversation.participantUpdated, args)
4962
+ );
4949
4963
  });
4950
4964
 
4951
4965
  _this._messagesEntity = new Messages(_assertThisInitialized__default["default"](_this), configuration, services);
4952
4966
 
4953
- _this._messagesEntity.on("messageAdded", function (message) {
4967
+ _this._messagesEntity.on(Conversation.messageAdded, function (message) {
4954
4968
  return _this._onMessageAdded(message);
4955
4969
  });
4956
4970
 
4957
- _this._messagesEntity.on("messageUpdated", function (args) {
4958
- return _this.emit("messageUpdated", args);
4971
+ _this._messagesEntity.on(Conversation.messageUpdated, function (args) {
4972
+ return _this.emit(Conversation.messageUpdated, args);
4959
4973
  });
4960
4974
 
4961
- _this._messagesEntity.on("messageRemoved", function (message) {
4962
- return _this.emit("messageRemoved", message);
4975
+ _this._messagesEntity.on(Conversation.messageRemoved, function (message) {
4976
+ return _this.emit(Conversation.messageRemoved, message);
4963
4977
  });
4964
4978
 
4965
4979
  return _this;
@@ -5062,7 +5076,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
5062
5076
  return (_this$_internalState$3 = this._internalState.notificationLevel) !== null && _this$_internalState$3 !== void 0 ? _this$_internalState$3 : "default";
5063
5077
  }
5064
5078
  /**
5065
- * Conversation bindings. Undocumented feature (for now).
5079
+ * Conversation bindings. An undocumented feature (for now).
5066
5080
  * @internal
5067
5081
  */
5068
5082
 
@@ -6044,18 +6058,19 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6044
6058
  }()
6045
6059
  /**
6046
6060
  * Get recipients of all messages in the conversation.
6061
+ * @param options Optional configuration, set pageSize to request a specific pagination page size. Page size specifies a number of messages to include in a single batch. Each message may include multiple recipients.
6047
6062
  */
6048
6063
 
6049
6064
  }, {
6050
6065
  key: "getMessageRecipients",
6051
6066
  value: function () {
6052
- var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24() {
6067
+ var _getMessageRecipients = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee24(options) {
6053
6068
  return _regeneratorRuntime__default["default"].wrap(function _callee24$(_context24) {
6054
6069
  while (1) {
6055
6070
  switch (_context24.prev = _context24.next) {
6056
6071
  case 0:
6057
6072
  _context24.next = 2;
6058
- return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid);
6073
+ return this._services.messageRecipientsClient.getRecipientsFromConversation(this.sid, options);
6059
6074
 
6060
6075
  case 2:
6061
6076
  return _context24.abrupt("return", _context24.sent);
@@ -6068,7 +6083,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6068
6083
  }, _callee24, this);
6069
6084
  }));
6070
6085
 
6071
- function getMessageRecipients() {
6086
+ function getMessageRecipients(_x19) {
6072
6087
  return _getMessageRecipients.apply(this, arguments);
6073
6088
  }
6074
6089
 
@@ -6077,7 +6092,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6077
6092
  /**
6078
6093
  * Load and subscribe to this conversation and do not subscribe to its
6079
6094
  * participants and messages. This or _subscribeStreams will need to be called
6080
- * before any events on conversation will fire.
6095
+ * before any events in the conversation will fire.
6081
6096
  * @internal
6082
6097
  */
6083
6098
 
@@ -6110,12 +6125,12 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6110
6125
  case 6:
6111
6126
  this._entity = _context25.sent;
6112
6127
 
6113
- this._entity.on("updated", function (args) {
6128
+ this._entity.on(twilioSync.SyncDocument.updated, function (args) {
6114
6129
  return _this2._update(args.data);
6115
6130
  });
6116
6131
 
6117
- this._entity.on("removed", function () {
6118
- return _this2.emit("removed", _this2);
6132
+ this._entity.on(twilioSync.SyncDocument.removed, function () {
6133
+ return _this2.emit(Conversation.removed, _this2);
6119
6134
  });
6120
6135
 
6121
6136
  this._update(this._entity.data);
@@ -6283,22 +6298,16 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6283
6298
  while (1) {
6284
6299
  switch (_context28.prev = _context28.next) {
6285
6300
  case 0:
6286
- if (!this._entity) {
6287
- _context28.next = 5;
6288
- break;
6289
- }
6290
-
6291
- _context28.next = 3;
6292
- return this._entity.close();
6301
+ if (this._entity) {
6302
+ this._entity.close();
6293
6303
 
6294
- case 3:
6295
- this._entity = null;
6296
- this._entityPromise = null;
6304
+ this._entity = null;
6305
+ this._entityPromise = null;
6306
+ }
6297
6307
 
6298
- case 5:
6299
6308
  return _context28.abrupt("return", Promise.all([this._participantsEntity.unsubscribe(), this._messagesEntity.unsubscribe()]));
6300
6309
 
6301
- case 6:
6310
+ case 2:
6302
6311
  case "end":
6303
6312
  return _context28.stop();
6304
6313
  }
@@ -6467,7 +6476,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6467
6476
  }
6468
6477
 
6469
6478
  if (updateReasons.size > 0) {
6470
- this.emit("updated", {
6479
+ this.emit(Conversation.updated, {
6471
6480
  conversation: this,
6472
6481
  updateReasons: _toConsumableArray__default["default"](updateReasons)
6473
6482
  });
@@ -6499,7 +6508,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6499
6508
  _iterator.f();
6500
6509
  }
6501
6510
 
6502
- this.emit("messageAdded", message);
6511
+ this.emit(Conversation.messageAdded, message);
6503
6512
  }
6504
6513
  /**
6505
6514
  * Set last read message index.
@@ -6532,7 +6541,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
6532
6541
  }, _callee29, this);
6533
6542
  }));
6534
6543
 
6535
- function _setLastReadMessageIndex(_x19) {
6544
+ function _setLastReadMessageIndex(_x20) {
6536
6545
  return _setLastReadMessageIndex2.apply(this, arguments);
6537
6546
  }
6538
6547
 
@@ -6612,7 +6621,7 @@ _defineProperty__default["default"](Conversation, "_logger", Logger.scope("Conve
6612
6621
 
6613
6622
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "add", null);
6614
6623
 
6615
- __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
6624
+ __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, optionalJson, optionalJson), __metadata("design:type", Function), __metadata("design:paramtypes", [String, String, Object, Object]), __metadata("design:returntype", Promise)], Conversation.prototype, "addNonChatParticipant", null);
6616
6625
 
6617
6626
  __decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonNegativeInteger), __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", Promise)], Conversation.prototype, "advanceLastReadMessageIndex", null);
6618
6627
 
@@ -6809,7 +6818,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6809
6818
  return addConversation;
6810
6819
  }()
6811
6820
  /**
6812
- * Fetch conversations list and instantiate all necessary objects
6821
+ * Fetch conversations' list and instantiate all necessary objects
6813
6822
  */
6814
6823
 
6815
6824
  }, {
@@ -6830,12 +6839,12 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6830
6839
 
6831
6840
  case 3:
6832
6841
  map = _context2.sent;
6833
- map.on("itemAdded", function (args) {
6842
+ map.on(twilioSync.SyncMap.itemAdded, function (args) {
6834
6843
  log$1.debug("itemAdded: ".concat(args.item.key));
6835
6844
 
6836
6845
  _this2._upsertConversation("sync", args.item.key, args.item.data);
6837
6846
  });
6838
- map.on("itemRemoved", function (args) {
6847
+ map.on(twilioSync.SyncMap.itemRemoved, function (args) {
6839
6848
  log$1.debug("itemRemoved: ".concat(args.key));
6840
6849
  var sid = args.key;
6841
6850
 
@@ -6861,7 +6870,7 @@ var Conversations = /*#__PURE__*/function (_ReplayEventEmitter) {
6861
6870
 
6862
6871
  conversation.emit("removed", conversation);
6863
6872
  });
6864
- map.on("itemUpdated", function (args) {
6873
+ map.on(twilioSync.SyncMap.itemUpdated, function (args) {
6865
6874
  log$1.debug("itemUpdated: ".concat(args.item.key));
6866
6875
 
6867
6876
  _this2._upsertConversation("sync", args.item.key, args.item.data);
@@ -7954,7 +7963,7 @@ function PushNotification(data) {
7954
7963
  this.data = data.data || {};
7955
7964
  });
7956
7965
 
7957
- var version = "2.5.0-rc.0";
7966
+ var version = "2.5.0";
7958
7967
 
7959
7968
  function ownKeys$1(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; }
7960
7969
 
@@ -8949,7 +8958,7 @@ var MessageRecipientsClient = /*#__PURE__*/function () {
8949
8958
  while (1) {
8950
8959
  switch (_context2.prev = _context2.next) {
8951
8960
  case 0:
8952
- url = new UriBuilder(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();
8961
+ url = new UriBuilder(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 : undefined).arg("PageSize", (_paginatorOptions$pag2 = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _paginatorOptions$pag2 !== void 0 ? _paginatorOptions$pag2 : undefined).build();
8953
8962
  _context2.next = 3;
8954
8963
  return this._services.commandExecutor.fetchResource(url);
8955
8964
 
@@ -9281,7 +9290,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9281
9290
  */
9282
9291
 
9283
9292
  /**
9284
- * Returned Conversations instance is not yet fully initialized. Calling any
9293
+ * Returned Conversations Client instance is not yet fully initialized. Calling any
9285
9294
  * operations will block until it is. Use connection events to monitor when
9286
9295
  * client becomes fully available (connectionStateChanged with state
9287
9296
  * 'connected') or not available (connectionStateChange with state 'denied',
@@ -9371,16 +9380,16 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9371
9380
 
9372
9381
  _this._services.twilsockClient = _this._options.twilsockClient = (_this$_options$twilso = _this._options.twilsockClient) !== null && _this$_options$twilso !== void 0 ? _this$_options$twilso : new twilsock.TwilsockClient(fpaToken, productId, _this._options);
9373
9382
 
9374
- _this._services.twilsockClient.on("tokenAboutToExpire", function () {
9375
- return _this.emit("tokenAboutToExpire");
9383
+ _this._services.twilsockClient.on(Client_1.tokenAboutToExpire, function () {
9384
+ return _this.emit(Client_1.tokenAboutToExpire);
9376
9385
  });
9377
9386
 
9378
- _this._services.twilsockClient.on("tokenExpired", function () {
9379
- return _this.emit("tokenExpired");
9387
+ _this._services.twilsockClient.on(Client_1.tokenExpired, function () {
9388
+ return _this.emit(Client_1.tokenExpired);
9380
9389
  });
9381
9390
 
9382
- _this._services.twilsockClient.on("connectionError", function (error) {
9383
- return _this.emit("connectionError", error);
9391
+ _this._services.twilsockClient.on(Client_1.connectionError, function (error) {
9392
+ return _this.emit(Client_1.connectionError, error);
9384
9393
  });
9385
9394
 
9386
9395
  _this._services.twilsockClient.on("stateChanged", function (state) {
@@ -9389,7 +9398,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9389
9398
  if (state !== _this.connectionState) {
9390
9399
  _this.connectionState = state;
9391
9400
 
9392
- _this.emit("connectionStateChanged", _this.connectionState);
9401
+ _this.emit(Client_1.connectionStateChanged, _this.connectionState);
9393
9402
  }
9394
9403
  });
9395
9404
 
@@ -9407,9 +9416,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9407
9416
  var emitFailed = function emitFailed(error) {
9408
9417
  _this._rejectEnsureReady(error);
9409
9418
 
9410
- _this.emit("stateChanged", "failed");
9419
+ _this.emit(Client_1.stateChanged, "failed");
9411
9420
 
9412
- _this.emit("initFailed", {
9421
+ _this.emit(Client_1.initFailed, {
9413
9422
  error: error
9414
9423
  });
9415
9424
  };
@@ -9462,9 +9471,9 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9462
9471
 
9463
9472
  _this._rejectEnsureReady(connectionError);
9464
9473
 
9465
- _this.emit("stateChanged", "failed");
9474
+ _this.emit(Client_1.stateChanged, "failed");
9466
9475
 
9467
- _this.emit("initFailed", {
9476
+ _this.emit(Client_1.initFailed, {
9468
9477
  error: connectionError
9469
9478
  });
9470
9479
 
@@ -9992,7 +10001,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9992
10001
  return removePushRegistrations;
9993
10002
  }()
9994
10003
  /**
9995
- * Current version of the Conversations client.
10004
+ * Parse a push notification payload.
9996
10005
  */
9997
10006
 
9998
10007
  }, {
@@ -10329,8 +10338,8 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
10329
10338
 
10330
10339
  this._resolveEnsureReady();
10331
10340
 
10332
- this.emit("stateChanged", "initialized");
10333
- this.emit("initialized");
10341
+ this.emit(Client_1.stateChanged, "initialized");
10342
+ this.emit(Client_1.initialized);
10334
10343
 
10335
10344
  case 36:
10336
10345
  case "end":