@twilio/conversations 2.0.0-rc.3 → 2.0.0-rc.4

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,15 @@
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.0.0-rc.4](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.0.0-rc.3...@twilio/conversations@2.0.0-rc.4) (2021-10-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Fix passing JSON attributes into conversation.addNonChatParticipant ([c3da243](https://github.com/twilio/rtd-sdk-monorepo-js/commit/c3da243469f5c33663c756d9f714a38240c4dd48))
12
+
13
+
14
+
6
15
  ## [2.0.0-rc.3](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/conversations@2.0.0-rc.2...@twilio/conversations@2.0.0-rc.3) (2021-10-13)
7
16
 
8
17
  **Note:** Version bump only for package @twilio/conversations
package/README.md CHANGED
@@ -14,26 +14,31 @@ To use the library you need [to generate a token](https://www.twilio.com/docs/co
14
14
  npm install --save @twilio/conversations
15
15
  ```
16
16
 
17
- Using this method, you can `require` `twilio-conversations` and then use the client:
17
+ Using this method, you can `require` `twilio-conversations` and then use the
18
+ client:
18
19
  ```
19
- const Conversations = require('@twilio/conversations');
20
- Conversations.Client.create(token).then(client => {
21
- // Use client
22
- });
23
- ```
24
-
25
- Or, if you prefer `async`/`await` syntax:
26
- ```
27
- const Conversations = require('@twilio/conversations');
28
- const client = await Conversations.Client.create(token);
29
- // Use client
20
+ const { Client } = require('@twilio/conversations');
21
+ 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) => {
25
+ if (state === 'initialized') {
26
+ // Use the client
27
+ }
28
+ }
30
29
  ```
31
30
 
32
31
  The SDK could also be imported using the ES module syntax:
33
32
  ```
34
- import { Conversations } from '@twilio/conversations';
35
- const client = await Conversations.Client.create(token);
36
- // Use client
33
+ import { Client } from '@twilio/conversations';
34
+ const client = new Client(token);
35
+ // Before you use the client, subscribe to the `'stateChanged'` event and wait
36
+ // for the `'initialized'` state to be reported.
37
+ client.on('stateChanged', (state) => {
38
+ if (state === 'initialized') {
39
+ // Use the client
40
+ }
41
+ }
37
42
  ```
38
43
 
39
44
  ### CDN
package/dist/browser.js CHANGED
@@ -4393,7 +4393,7 @@ var Conversation = /*#__PURE__*/function (_ReplayEventEmitter) {
4393
4393
  while (1) {
4394
4394
  switch (_context5.prev = _context5.next) {
4395
4395
  case 0:
4396
- return _context5.abrupt("return", this.participantsEntity.addNonChatParticipant(proxyAddress, address, attributes !== null && attributes !== void 0 ? attributes : {}));
4396
+ return _context5.abrupt("return", this.participantsEntity.addNonChatParticipant(proxyAddress, address, attributes));
4397
4397
 
4398
4398
  case 1:
4399
4399
  case "end":
@@ -6608,7 +6608,7 @@ function PushNotification(data) {
6608
6608
  this.data = data.data || {};
6609
6609
  };
6610
6610
 
6611
- var version = "2.0.0-rc.3";
6611
+ var version = "2.0.0-rc.4";
6612
6612
 
6613
6613
  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; }
6614
6614
 
@@ -7692,6 +7692,13 @@ exports.Client = Client_1 = (_temp = _class = /*#__PURE__*/function (_ReplayEven
7692
7692
  * The factory method will automatically trigger connection.
7693
7693
  * Do not use it if you need finer-grained control.
7694
7694
  *
7695
+ * Since this method returns an already-initialized client, some of the events
7696
+ * will be lost because they happen *before* the initialization. It is
7697
+ * recommended that `client.onWithReplay` is used as opposed to `client.on`
7698
+ * for subscribing to client events. The `client.onWithReplay` will re-emit
7699
+ * the most recent value for a given event if it emitted before the
7700
+ * subscription.
7701
+ *
7695
7702
  * @param token Access token.
7696
7703
  * @param options Options to customize the client.
7697
7704
  * @returns Returns a fully initialized client.