@twilio/conversations 2.5.0 → 2.6.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 (88) hide show
  1. package/README.md +2 -2
  2. package/builds/browser.esm.js +10730 -0
  3. package/builds/browser.esm.js.map +1 -0
  4. package/builds/browser.js +183 -9
  5. package/builds/browser.js.map +1 -1
  6. package/builds/lib.d.ts +6 -1
  7. package/builds/lib.esm.d.ts +3171 -0
  8. package/builds/lib.esm.js +10729 -0
  9. package/builds/lib.js +192 -9
  10. package/builds/lib.js.map +1 -1
  11. package/builds/twilio-conversations.js +324 -150
  12. package/builds/twilio-conversations.min.js +1 -1
  13. package/dist/aggregated-delivery-receipt.js +3 -5
  14. package/dist/aggregated-delivery-receipt.js.map +1 -1
  15. package/dist/channel-metadata-client.js +7 -9
  16. package/dist/channel-metadata-client.js.map +1 -1
  17. package/dist/client.js +207 -158
  18. package/dist/client.js.map +1 -1
  19. package/dist/command-executor.js +8 -8
  20. package/dist/command-executor.js.map +1 -1
  21. package/dist/configuration.js +12 -9
  22. package/dist/configuration.js.map +1 -1
  23. package/dist/content-client.js +11 -8
  24. package/dist/content-client.js.map +1 -1
  25. package/dist/content-template.js +3 -5
  26. package/dist/content-template.js.map +1 -1
  27. package/dist/conversation.js +113 -87
  28. package/dist/conversation.js.map +1 -1
  29. package/dist/data/conversations.js +42 -40
  30. package/dist/data/conversations.js.map +1 -1
  31. package/dist/data/messages.js +18 -22
  32. package/dist/data/messages.js.map +1 -1
  33. package/dist/data/participants.js +25 -23
  34. package/dist/data/participants.js.map +1 -1
  35. package/dist/data/users.js +15 -13
  36. package/dist/data/users.js.map +1 -1
  37. package/dist/detailed-delivery-receipt.js +3 -5
  38. package/dist/detailed-delivery-receipt.js.map +1 -1
  39. package/dist/index.js +17 -49
  40. package/dist/index.js.map +1 -1
  41. package/dist/interfaces/notification-types.js +1 -5
  42. package/dist/interfaces/notification-types.js.map +1 -1
  43. package/dist/interfaces/rules.js +13 -10
  44. package/dist/interfaces/rules.js.map +1 -1
  45. package/dist/logger.js +25 -26
  46. package/dist/logger.js.map +1 -1
  47. package/dist/media.js +11 -8
  48. package/dist/media.js.map +1 -1
  49. package/dist/message-builder.js +48 -40
  50. package/dist/message-builder.js.map +1 -1
  51. package/dist/message-recipients-client.js +10 -12
  52. package/dist/message-recipients-client.js.map +1 -1
  53. package/dist/message.js +88 -75
  54. package/dist/message.js.map +1 -1
  55. package/dist/node_modules/quick-lru/index.js +1 -5
  56. package/dist/node_modules/quick-lru/index.js.map +1 -1
  57. package/dist/node_modules/tslib/tslib.es6.js +1 -7
  58. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  59. package/dist/packages/conversations/package.json.js +2 -6
  60. package/dist/packages/conversations/package.json.js.map +1 -1
  61. package/dist/participant.js +34 -29
  62. package/dist/participant.js.map +1 -1
  63. package/dist/push-notification.js +5 -4
  64. package/dist/push-notification.js.map +1 -1
  65. package/dist/rest-paginator.js +6 -4
  66. package/dist/rest-paginator.js.map +1 -1
  67. package/dist/services/network.js +3 -7
  68. package/dist/services/network.js.map +1 -1
  69. package/dist/services/typing-indicator.js +11 -8
  70. package/dist/services/typing-indicator.js.map +1 -1
  71. package/dist/unsent-message.js +9 -8
  72. package/dist/unsent-message.js.map +1 -1
  73. package/dist/user.js +27 -24
  74. package/dist/user.js.map +1 -1
  75. package/dist/util/deferred.js +6 -4
  76. package/dist/util/deferred.js.map +1 -1
  77. package/dist/util/index.js +1 -9
  78. package/dist/util/index.js.map +1 -1
  79. package/docs/assets/js/search.js +1 -1
  80. package/docs/classes/Client.html +4 -4
  81. package/docs/classes/Media.html +2 -2
  82. package/docs/classes/Message.html +8 -8
  83. package/docs/classes/MessageBuilder.html +2 -2
  84. package/docs/classes/UnsentMessage.html +2 -2
  85. package/docs/index.html +3 -7
  86. package/docs/modules.html +2 -6
  87. package/package.json +2 -2
  88. package/docs/classes/CancellablePromise.html +0 -3213
package/builds/browser.js CHANGED
@@ -154,10 +154,10 @@ var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
154
154
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
155
155
  var _createClass = require('@babel/runtime/helpers/createClass');
156
156
  var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
157
- require('core-js/modules/es.object.to-string.js');
158
- require('core-js/modules/es.promise.js');
159
157
  require('core-js/modules/es.array.map.js');
158
+ require('core-js/modules/es.object.to-string.js');
160
159
  require('core-js/modules/web.dom-collections.for-each.js');
160
+ require('core-js/modules/es.promise.js');
161
161
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
162
162
  var _typeof = require('@babel/runtime/helpers/typeof');
163
163
  require('core-js/modules/es.array.concat.js');
@@ -655,6 +655,22 @@ var User = /*#__PURE__*/function (_ReplayEventEmitter) {
655
655
  * @event
656
656
  */
657
657
 
658
+ /**
659
+ * Fired when the client has subscribed to the user.
660
+ *
661
+ * Parameters:
662
+ * 1. {@link User} `user` - the user in question
663
+ * @event
664
+ */
665
+
666
+ /**
667
+ * Fired when the client has unsubscribed from the user.
668
+ *
669
+ * Parameters:
670
+ * 1. {@link User} `user` - the user in question
671
+ * @event
672
+ */
673
+
658
674
 
659
675
  _createClass__default["default"](User, [{
660
676
  key: "identity",
@@ -1327,6 +1343,24 @@ var Participant = /*#__PURE__*/function (_ReplayEventEmitter) {
1327
1343
  * @event
1328
1344
  */
1329
1345
 
1346
+ /**
1347
+ * Fired when the participant has stopped typing.
1348
+ *
1349
+ * Parameters:
1350
+ * 1. {@link Participant} `participant` - the participant in question
1351
+ * @event
1352
+ */
1353
+
1354
+ /**
1355
+ * Fired when the fields of the participant have been updated.
1356
+ *
1357
+ * Parameters:
1358
+ * 1. object `data` - info object provided with the event. It has the following properties:
1359
+ * * {@link Participant} participant - the participant in question
1360
+ * * {@link ParticipantUpdateReason}[] updateReasons - array of reasons for the update
1361
+ * @event
1362
+ */
1363
+
1330
1364
 
1331
1365
  _createClass__default["default"](Participant, [{
1332
1366
  key: "sid",
@@ -2904,6 +2938,15 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2904
2938
 
2905
2939
  return _this;
2906
2940
  }
2941
+ /**
2942
+ * Fired when the properties or the body of the message has been updated.
2943
+ *
2944
+ * Parameters:
2945
+ * 1. object `data` - info object provided with the event. It has the following properties:
2946
+ * * {@link Message} message - the message in question
2947
+ * * {@link MessageUpdateReason}[] updateReasons - array of reasons for the update
2948
+ */
2949
+
2907
2950
 
2908
2951
  _createClass__default["default"](Message, [{
2909
2952
  key: "sid",
@@ -4900,6 +4943,64 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4900
4943
  * Logger instance.
4901
4944
  */
4902
4945
 
4946
+ /**
4947
+ * Unique system identifier of the conversation.
4948
+ */
4949
+
4950
+ /**
4951
+ * Conversation links for REST requests.
4952
+ * @internal
4953
+ */
4954
+
4955
+ /**
4956
+ * Configuration of the client that the conversation belongs to.
4957
+ */
4958
+
4959
+ /**
4960
+ * Conversation service objects.
4961
+ */
4962
+
4963
+ /**
4964
+ * Internal state of the conversation.
4965
+ */
4966
+
4967
+ /**
4968
+ * Name of the conversation entity document.
4969
+ */
4970
+
4971
+ /**
4972
+ * Messages entity.
4973
+ */
4974
+
4975
+ /**
4976
+ * Sync list containing messages.
4977
+ */
4978
+
4979
+ /**
4980
+ * Map of participants.
4981
+ * @internal
4982
+ */
4983
+
4984
+ /**
4985
+ * Participants entity.
4986
+ */
4987
+
4988
+ /**
4989
+ * Sync map containing participants.
4990
+ */
4991
+
4992
+ /**
4993
+ * Source of the most recent update.
4994
+ */
4995
+
4996
+ /**
4997
+ * Promise for the conversation entity document.
4998
+ */
4999
+
5000
+ /**
5001
+ * Conversation entity document.
5002
+ */
5003
+
4903
5004
  /**
4904
5005
  * @param descriptor Conversation descriptor.
4905
5006
  * @param sid Conversation SID.
@@ -7963,7 +8064,7 @@ function PushNotification(data) {
7963
8064
  this.data = data.data || {};
7964
8065
  });
7965
8066
 
7966
- var version = "2.5.0";
8067
+ var version = "2.6.0-rc.1";
7967
8068
 
7968
8069
  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; }
7969
8070
 
@@ -8836,6 +8937,22 @@ var EmailRecipientDescriptor = /*#__PURE__*/_createClass__default["default"](
8836
8937
  * Type of recipient.
8837
8938
  */
8838
8939
 
8940
+ /**
8941
+ * Sid of the message that this recipient belongs to.
8942
+ */
8943
+
8944
+ /**
8945
+ * Email recipient level.
8946
+ */
8947
+
8948
+ /**
8949
+ * Name of the recipient.
8950
+ */
8951
+
8952
+ /**
8953
+ * Address of the recipient.
8954
+ */
8955
+
8839
8956
  /**
8840
8957
  * @internal
8841
8958
  */
@@ -9289,6 +9406,46 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9289
9406
  * Client connection state.
9290
9407
  */
9291
9408
 
9409
+ /**
9410
+ * Promise that resolves on successful initialization.
9411
+ */
9412
+
9413
+ /**
9414
+ * Options passed to the client.
9415
+ */
9416
+
9417
+ /**
9418
+ * Client service objects.
9419
+ */
9420
+
9421
+ /**
9422
+ * The user of the client.
9423
+ */
9424
+
9425
+ /**
9426
+ * Resolves the {@link Client._ensureReady} promise.
9427
+ */
9428
+
9429
+ /**
9430
+ * Rejects the {@link Client._ensureReady} promise.
9431
+ */
9432
+
9433
+ /**
9434
+ * The current token of the client.
9435
+ */
9436
+
9437
+ /**
9438
+ * The constructed configuration object.
9439
+ */
9440
+
9441
+ /**
9442
+ * The Conversations entity.
9443
+ */
9444
+
9445
+ /**
9446
+ * Promise that resolves when initial conversations are fetched.
9447
+ */
9448
+
9292
9449
  /**
9293
9450
  * Returned Conversations Client instance is not yet fully initialized. Calling any
9294
9451
  * operations will block until it is. Use connection events to monitor when
@@ -9428,6 +9585,8 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9428
9585
  terminal: true,
9429
9586
  message: "Twilsock has disconnected."
9430
9587
  });
9588
+
9589
+ _this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
9431
9590
  };
9432
9591
 
9433
9592
  _this._services.twilsockClient.once("connectionError", emitFailed);
@@ -9485,12 +9644,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
9485
9644
  }, _callee, null, [[3, 11]]);
9486
9645
  })));
9487
9646
 
9488
- _this._ensureReady = new Promise(function (resolve, reject) {
9489
- _this._resolveEnsureReady = resolve;
9490
- _this._rejectEnsureReady = reject;
9491
- }).catch(function () {
9492
- return void 0;
9493
- }); // @todo How to process unhandled rejection here?
9647
+ _this._initializeEnsureReady((options === null || options === void 0 ? void 0 : options.throwErrorsAlways) || false);
9494
9648
 
9495
9649
  if (startTwilsock) {
9496
9650
  _this._services.twilsockClient.connect();
@@ -10383,6 +10537,26 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
10383
10537
  _this5._services.notificationClient.unsubscribe(channelType, messageType);
10384
10538
  });
10385
10539
  }
10540
+ /**
10541
+ * Initialize the ensureReady promise.
10542
+ */
10543
+
10544
+ }, {
10545
+ key: "_initializeEnsureReady",
10546
+ value: function _initializeEnsureReady(throwErrorsAlways) {
10547
+ var _this6 = this;
10548
+
10549
+ this._ensureReady = new Promise(function (resolve, reject) {
10550
+ _this6._resolveEnsureReady = resolve;
10551
+ _this6._rejectEnsureReady = reject;
10552
+ }).catch(function (error) {
10553
+ if (throwErrorsAlways) {
10554
+ throw error;
10555
+ } else {
10556
+ return void 0;
10557
+ }
10558
+ });
10559
+ }
10386
10560
  }], [{
10387
10561
  key: "create",
10388
10562
  value: function () {