@twilio/conversations 2.2.0-rc.9 → 2.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,91 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.2.0](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.2.0-rc.15...@twilio/conversations@2.2.0) (2022-09-22)
7
+
8
+ **Note:** Version bump only for package @twilio/conversations
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.2.0-rc.15](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.2.0-rc.14...@twilio/conversations@2.2.0-rc.15) (2022-09-21)
15
+
16
+ **Note:** Version bump only for package @twilio/conversations
17
+
18
+
19
+
20
+
21
+
22
+ ## [2.2.0](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.2.0-rc.14...@twilio/conversations@2.2.0) (2022-09-21)
23
+
24
+ **Note:** Version bump only for package @twilio/conversations
25
+
26
+
27
+
28
+
29
+
30
+ ## [2.2.0-rc.14](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@3.0.0-rc.9...@twilio/conversations@2.2.0-rc.14) (2022-09-21)
31
+
32
+
33
+ ### Features
34
+
35
+ * Deprecate methods for the multiple media release ([ef89aa6](https://github.com/twilio/rtd-sdk-monorepo-js/commit/ef89aa69c17a8a94446b870858cd3e74b6e4cf05))
36
+ * Deprecate stateChanged event ([a69aa6c](https://github.com/twilio/rtd-sdk-monorepo-js/commit/a69aa6ce5faba8a53d00377b23563984c7bfcb15))
37
+ * Revert add/addNonChatParticipant return value ([32ec453](https://github.com/twilio/rtd-sdk-monorepo-js/commit/32ec453a99eea284b4fd8b8828920a2433c13f0e))
38
+ * Revert and deprecate peek conversation breaking changes ([3094767](https://github.com/twilio/rtd-sdk-monorepo-js/commit/309476703f8442b03e6c0c5d5210ab21459d2bcd))
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * Add deprecation notice for Conversation.create, fix packages versions ([94af4c8](https://github.com/twilio/rtd-sdk-monorepo-js/commit/94af4c8e8354154872bdd09af97a2ba07853e4a5))
44
+ * Fix 2.2.0 release blockers ([099622b](https://github.com/twilio/rtd-sdk-monorepo-js/commit/099622bf459a75d141652f14ce9fdbff11c2e822))
45
+ * Fix faulty event emits on token update. RTDSDK-3699 ([fb67269](https://github.com/twilio/rtd-sdk-monorepo-js/commit/fb67269bfeb31db09ba28132bcd19e98578f6453))
46
+ * Fix IE11 behavior on participant add ([56e71e4](https://github.com/twilio/rtd-sdk-monorepo-js/commit/56e71e403dac7dd7a32e1fa9201c7a72c1b61083))
47
+ * Ignore broken conversations on client init. RTDSDK-2085 ([4a812d1](https://github.com/twilio/rtd-sdk-monorepo-js/commit/4a812d14af9c91428d778f4cd26ea682f6390e69))
48
+ * Remove unused parameter from initialized event ([2a57068](https://github.com/twilio/rtd-sdk-monorepo-js/commit/2a57068fbe2534e0b21a65551a1a6914ea5b14c5))
49
+ * Rollback twilsock type, update loglevel version ([d318c5c](https://github.com/twilio/rtd-sdk-monorepo-js/commit/d318c5c0750096651ce1e01fef360aded070bb5c))
50
+ * SyncError getting minified. RTDSDK-3717 ([fd42bce](https://github.com/twilio/rtd-sdk-monorepo-js/commit/fd42bcef1a4fbc9f4b2fd332f48e8fcfd9e4cba5))
51
+ * Update stateChanged event name ([3e866bb](https://github.com/twilio/rtd-sdk-monorepo-js/commit/3e866bbf9a74c640ef5da348f3e6f2c722bbd150))
52
+
53
+
54
+
55
+ ## [2.2.0-rc.13](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.2.0-rc.12...@twilio/conversations@2.2.0-rc.13) (2022-09-13)
56
+
57
+
58
+ ### Bug Fixes
59
+
60
+ * Remove unused parameter from initialized event ([de54b9e](https://github.com/twilio/rtd-sdk-monorepo-js/commit/de54b9ec29ad358bcb6d946fb96e4fc4be3f45ce))
61
+ * SyncError getting minified. RTDSDK-3717 ([0b99992](https://github.com/twilio/rtd-sdk-monorepo-js/commit/0b99992ed6c684d74c7b19c45956d293aa5662fd))
62
+
63
+
64
+
65
+ ## [2.2.0-rc.12](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.2.0-rc.11...@twilio/conversations@2.2.0-rc.12) (2022-08-23)
66
+
67
+
68
+ ### Bug Fixes
69
+
70
+ * Fix 2.2.0 release blockers ([f54f564](https://github.com/twilio/rtd-sdk-monorepo-js/commit/f54f56421d7e8f14476abfbf6a315a84d203c88c))
71
+ * Fix faulty event emits on token update. RTDSDK-3699 ([4c40f39](https://github.com/twilio/rtd-sdk-monorepo-js/commit/4c40f39334ab6a62379c4b5c25c6a4f8cc168959))
72
+
73
+
74
+
75
+ ## [2.2.0-rc.11](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.2.0-rc.10...@twilio/conversations@2.2.0-rc.11) (2022-07-26)
76
+
77
+ **Note:** Version bump only for package @twilio/conversations
78
+
79
+
80
+
81
+
82
+
83
+ ## [2.2.0-rc.10](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.2.0-rc.9...@twilio/conversations@2.2.0-rc.10) (2022-07-26)
84
+
85
+ **Note:** Version bump only for package @twilio/conversations
86
+
87
+
88
+
89
+
90
+
6
91
  ## [2.2.0-rc.9](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.2.0-rc.8...@twilio/conversations@2.2.0-rc.9) (2022-07-25)
7
92
 
8
93
  **Note:** Version bump only for package @twilio/conversations
package/README.md CHANGED
@@ -18,31 +18,35 @@ Using this method, you can `require` `twilio-conversations` and then use the
18
18
  client:
19
19
  ```
20
20
  const { Client } = require('@twilio/conversations');
21
+
21
22
  const client = new Client(token);
22
- // Before you use the client, subscribe to the `'stateChanged'` event and wait
23
- // for the `'initialized'` state to be reported.
24
- client.on('stateChanged', ({ state, error }) => {
25
- if (state === 'initialized') {
26
- // Use the client
27
- }
28
-
29
- if (error) {
30
- // Handle error
31
- }
23
+
24
+ // Before you use the client, subscribe to the `'initialized'` event.
25
+ client.on('initialized', () => {
26
+ // Use the client.
32
27
  }
28
+
29
+ // To catch client initialization errors, subscribe to the `'initFailed'` event.
30
+ client.on('initFailed', ({ error }) => {
31
+ // Handle the error.
32
+ });
33
33
  ```
34
34
 
35
35
  The SDK could also be imported using the ES module syntax:
36
36
  ```
37
37
  import { Client } from '@twilio/conversations';
38
+
38
39
  const client = new Client(token);
39
- // Before you use the client, subscribe to the `'stateChanged'` event and wait
40
- // for the `'initialized'` state to be reported.
41
- client.on('stateChanged', ({ state, error }) => {
42
- if (state === 'initialized') {
43
- // Use the client
44
- }
40
+
41
+ // Before you use the client, subscribe to the `'initialized'` event.
42
+ client.on('initialized', () => {
43
+ // Use the client.
45
44
  }
45
+
46
+ // To catch client initialization errors, subscribe to the `'initFailed'` event.
47
+ client.on('initFailed', ({ error }) => {
48
+ // Handle the error.
49
+ });
46
50
  ```
47
51
 
48
52
  ### CDN
@@ -50,7 +54,7 @@ client.on('stateChanged', ({ state, error }) => {
50
54
  Releases of `twilio-conversations.js` are hosted on a CDN, and you can include these
51
55
  directly in your web app using a `<script>` tag.
52
56
  ```html
53
- <script src="https://media.twiliocdn.com/sdk/js/conversations/v3.0/twilio-conversations.min.js"></script>
57
+ <script src="https://media.twiliocdn.com/sdk/js/conversations/v2.2/twilio-conversations.min.js"></script>
54
58
  ```
55
59
  Using this method, `twilio-conversations.js` will set a browser global `Twilio.Conversations` through which you can use the client:
56
60
  ```
@@ -68,7 +72,7 @@ number. While less flexible it is significantly more secure, which is required b
68
72
  To consume securely use the following script snippet format:
69
73
 
70
74
  ```html
71
- <script src="https://media.twiliocdn.com/sdk/js/conversations/releases/3.0.0/twilio-conversations.min.js"
75
+ <script src="https://media.twiliocdn.com/sdk/js/conversations/releases/2.2.0/twilio-conversations.min.js"
72
76
  integrity="sha256-<HASH FROM THE CHANGELOGS PAGE>"
73
77
  crossorigin="anonymous"></script>
74
78
  ```
package/builds/browser.js CHANGED
@@ -2304,7 +2304,7 @@ var Media = /*#__PURE__*/function () {
2304
2304
  * Contains aggregated information about delivery statuses of a message across all participants
2305
2305
  * of a conversation.
2306
2306
  *
2307
- * At any moment during the message delivery to a participant, the message can have zero or more of following
2307
+ * At any moment during the message delivery to a participant, the message can have zero or more of the following
2308
2308
  * delivery statuses:
2309
2309
  * * Message is considered as **sent** to a participant if the nearest upstream carrier accepted the message.
2310
2310
  * * Message is considered as **delivered** to a participant if Twilio has received confirmation of message
@@ -2661,14 +2661,15 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2661
2661
  return this.state.dateUpdated;
2662
2662
  }
2663
2663
  /**
2664
- * Index of the message in the conversation's messages list.
2665
- * By design of the Conversations system, the message indices may have arbitrary gaps between them,
2664
+ * Index of this message in the conversation's list of messages.
2665
+ *
2666
+ * By design, the message indices may have arbitrary gaps between them,
2666
2667
  * that does not necessarily mean they were deleted or otherwise modified - just that
2667
2668
  * messages may have some non-contiguous indices even if they are being sent immediately one after another.
2668
2669
  *
2669
2670
  * Trying to use indices for some calculations is going to be unreliable.
2670
2671
  *
2671
- * To calculate the number of unread messages it is better to use the read horizon API.
2672
+ * To calculate the number of unread messages, it is better to use the Read Horizon API.
2672
2673
  * See {@link Conversation.getUnreadMessagesCount} for details.
2673
2674
  */
2674
2675
 
@@ -2983,32 +2984,27 @@ var Message = /*#__PURE__*/function (_ReplayEventEmitter) {
2983
2984
 
2984
2985
  case 2:
2985
2986
  paginator = _context2.sent;
2986
- detailedDeliveryReceipts = [];
2987
+ detailedDeliveryReceipts = paginator.items;
2987
2988
 
2988
2989
  case 4:
2989
-
2990
- detailedDeliveryReceipts = [].concat(_toConsumableArray__default["default"](detailedDeliveryReceipts), _toConsumableArray__default["default"](paginator.items));
2991
-
2992
- if (paginator.hasNextPage) {
2993
- _context2.next = 8;
2990
+ if (!paginator.hasNextPage) {
2991
+ _context2.next = 11;
2994
2992
  break;
2995
2993
  }
2996
2994
 
2997
- return _context2.abrupt("break", 13);
2998
-
2999
- case 8:
3000
- _context2.next = 10;
2995
+ _context2.next = 7;
3001
2996
  return paginator.nextPage();
3002
2997
 
3003
- case 10:
2998
+ case 7:
3004
2999
  paginator = _context2.sent;
3000
+ detailedDeliveryReceipts = [].concat(_toConsumableArray__default["default"](detailedDeliveryReceipts), _toConsumableArray__default["default"](paginator.items));
3005
3001
  _context2.next = 4;
3006
3002
  break;
3007
3003
 
3008
- case 13:
3004
+ case 11:
3009
3005
  return _context2.abrupt("return", detailedDeliveryReceipts);
3010
3006
 
3011
- case 14:
3007
+ case 12:
3012
3008
  case "end":
3013
3009
  return _context2.stop();
3014
3010
  }
@@ -4929,7 +4925,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4929
4925
  return getMessagesCount;
4930
4926
  }()
4931
4927
  /**
4932
- * Get unread messages count for the user if they are a participant of this
4928
+ * Get count of unread messages for the user if they are a participant of this
4933
4929
  * conversation. Rejects if the user is not a participant of the conversation.
4934
4930
  *
4935
4931
  * Use this method to obtain the number of unread messages together with
@@ -4937,12 +4933,19 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4937
4933
  * message indices which may have gaps. See {@link Message.index} for details.
4938
4934
  *
4939
4935
  * This method is semi-realtime. This means that this data will be eventually
4940
- * correct, but will also be possibly incorrect for a few seconds. The
4936
+ * correct, but it will also be possibly incorrect for a few seconds. The
4941
4937
  * Conversations system does not provide real time events for counter values
4942
4938
  * changes.
4943
4939
  *
4944
4940
  * This is useful for any UI badges, but it is not recommended to build any
4945
4941
  * core application logic based on these counters being accurate in real time.
4942
+ *
4943
+ * If the read horizon is not set, this function will return null. This could mean
4944
+ * that all messages in the conversation are unread, or that the read horizon system
4945
+ * is not being used. How to interpret this `null` value is up to the customer application.
4946
+ *
4947
+ * @return Number of unread messages based on the current read horizon set for
4948
+ * the user or `null` if the read horizon is not set.
4946
4949
  */
4947
4950
 
4948
4951
  }, {
@@ -5215,7 +5218,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
5215
5218
  }()
5216
5219
  /**
5217
5220
  * Set all messages in the conversation unread.
5218
- * @return Resulting unread messages count in the conversation.
5221
+ * @returns New count of unread messages after this update.
5219
5222
  */
5220
5223
 
5221
5224
  }, {
@@ -5373,7 +5376,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
5373
5376
  * Set the last read message index to the current read horizon.
5374
5377
  * @param index Message index to set as last read. If null is provided, then
5375
5378
  * the behavior is identical to {@link Conversation.setAllMessagesUnread}.
5376
- * @returns Resulting unread messages count in the conversation.
5379
+ * @returns New count of unread messages after this update.
5377
5380
  */
5378
5381
 
5379
5382
  }, {
@@ -7326,7 +7329,7 @@ function PushNotification(data) {
7326
7329
  this.data = data.data || {};
7327
7330
  });
7328
7331
 
7329
- var version = "2.2.0-rc.9";
7332
+ var version = "2.2.0";
7330
7333
 
7331
7334
  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; }
7332
7335
 
@@ -7738,9 +7741,6 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
7738
7741
 
7739
7742
  /**
7740
7743
  * Fired when the client has completed initialization successfully.
7741
- *
7742
- * Parameters:
7743
- * 1. object `data` - Optional info object provided with the event
7744
7744
  * @event
7745
7745
  */
7746
7746
 
@@ -7939,11 +7939,11 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
7939
7939
  });
7940
7940
  };
7941
7941
 
7942
- _this._services.twilsockClient.on("connectionError", emitFailed);
7942
+ _this._services.twilsockClient.once("connectionError", emitFailed);
7943
7943
 
7944
- _this._services.twilsockClient.on("disconnected", emitDisconnected);
7944
+ _this._services.twilsockClient.once("disconnected", emitDisconnected);
7945
7945
 
7946
- _this._services.twilsockClient.on("connected", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
7946
+ _this._services.twilsockClient.once("connected", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
7947
7947
  var startupEvent, connectionError;
7948
7948
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
7949
7949
  while (1) {
@@ -8806,7 +8806,7 @@ exports.Client = Client_1 = (_class = /*#__PURE__*/function (_ReplayEventEmitter
8806
8806
  this._resolveEnsureReady();
8807
8807
 
8808
8808
  this.emit("stateChanged", "initialized");
8809
- this.emit("initialized", {});
8809
+ this.emit("initialized");
8810
8810
 
8811
8811
  case 34:
8812
8812
  case "end":