@twilio/conversations 2.0.0-rc.1 → 2.0.1-canary.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.
- package/README.md +25 -28
- package/dist/browser.js +3125 -3460
- package/dist/browser.js.map +1 -1
- package/dist/docs/assets/js/search.js +1 -1
- package/dist/docs/classes/AggregatedDeliveryReceipt.html +22 -6
- package/dist/docs/classes/Client.html +78 -33
- package/dist/docs/classes/Conversation.html +33 -17
- package/dist/docs/classes/DetailedDeliveryReceipt.html +22 -6
- package/dist/docs/classes/Media.html +23 -7
- package/dist/docs/classes/Message.html +23 -7
- package/dist/docs/classes/MessageBuilder.html +3280 -0
- package/dist/docs/classes/Participant.html +23 -7
- package/dist/docs/classes/PushNotification.html +24 -8
- package/dist/docs/classes/RestPaginator.html +28 -9
- package/dist/docs/classes/UnsentMessage.html +3144 -0
- package/dist/docs/classes/User.html +25 -9
- package/dist/docs/index.html +89 -47
- package/dist/docs/interfaces/ClientOptions.html +22 -6
- package/dist/docs/interfaces/ConversationState.html +22 -6
- package/dist/docs/interfaces/CreateConversationOptions.html +22 -6
- package/dist/docs/interfaces/LastMessage.html +22 -6
- package/dist/docs/interfaces/Paginator.html +3243 -0
- package/dist/docs/interfaces/PushNotificationData.html +3168 -0
- package/dist/docs/interfaces/SendEmailOptions.html +22 -6
- package/dist/docs/interfaces/SendMediaOptions.html +24 -7
- package/dist/docs/modules.html +88 -46
- package/dist/lib/aggregated-delivery-receipt.js +227 -0
- package/dist/lib/aggregated-delivery-receipt.js.map +1 -0
- package/dist/lib/client.js +872 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/command-executor.js +203 -0
- package/dist/lib/command-executor.js.map +1 -0
- package/dist/lib/configuration.js +196 -0
- package/dist/lib/configuration.js.map +1 -0
- package/dist/lib/conversation.js +973 -0
- package/dist/lib/conversation.js.map +1 -0
- package/dist/lib/data/conversations.js +443 -0
- package/dist/lib/data/conversations.js.map +1 -0
- package/dist/lib/data/messages.js +341 -0
- package/dist/lib/data/messages.js.map +1 -0
- package/dist/lib/data/participants.js +313 -0
- package/dist/lib/data/participants.js.map +1 -0
- package/dist/lib/data/users.js +228 -0
- package/dist/lib/data/users.js.map +1 -0
- package/dist/lib/detailed-delivery-receipt.js +154 -0
- package/dist/lib/detailed-delivery-receipt.js.map +1 -0
- package/dist/lib/index.js +167 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/interfaces/notification-types.js +143 -0
- package/dist/lib/interfaces/notification-types.js.map +1 -0
- package/dist/lib/logger.js +190 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/media.js +213 -0
- package/dist/lib/media.js.map +1 -0
- package/dist/lib/message-builder.js +209 -0
- package/dist/lib/message-builder.js.map +1 -0
- package/dist/lib/message.js +450 -0
- package/dist/lib/message.js.map +1 -0
- package/dist/lib/node_modules/tslib/tslib.es6.js +161 -0
- package/dist/lib/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/lib/packages/conversations/package.json.js +136 -0
- package/dist/lib/packages/conversations/package.json.js.map +1 -0
- package/dist/lib/participant.js +346 -0
- package/dist/lib/participant.js.map +1 -0
- package/dist/lib/push-notification.js +152 -0
- package/dist/lib/push-notification.js.map +1 -0
- package/dist/lib/rest-paginator.js +175 -0
- package/dist/lib/rest-paginator.js.map +1 -0
- package/dist/lib/services/network.js +205 -0
- package/dist/lib/services/network.js.map +1 -0
- package/dist/lib/services/typing-indicator.js +235 -0
- package/dist/lib/services/typing-indicator.js.map +1 -0
- package/dist/lib/unsent-message.js +159 -0
- package/dist/lib/unsent-message.js.map +1 -0
- package/dist/lib/user.js +392 -0
- package/dist/lib/user.js.map +1 -0
- package/dist/lib/util/deferred.js +154 -0
- package/dist/lib/util/deferred.js.map +1 -0
- package/dist/lib/util/index.js +206 -0
- package/dist/lib/util/index.js.map +1 -0
- package/dist/lib.d.ts +250 -59
- package/dist/lib.js +3055 -2919
- package/dist/lib.js.map +1 -1
- package/dist/twilio-conversations.js +25175 -23918
- package/dist/twilio-conversations.min.js +14 -2
- package/package.json +16 -14
- package/CHANGELOG.md +0 -168
- package/dist/post-install.js +0 -29
- package/dist/react-native.js +0 -4412
- package/dist/react-native.js.map +0 -1
package/README.md
CHANGED
@@ -7,33 +7,38 @@ Visit our official site for more detalis: [https://www.twilio.com/conversations]
|
|
7
7
|
|
8
8
|
Instantiating and using
|
9
9
|
------------
|
10
|
-
To use the library you need [to generate a token](https://www.twilio.com/docs/conversations/create-tokens) and pass it to the
|
10
|
+
To use the library you need [to generate a token](https://www.twilio.com/docs/conversations/create-tokens) and pass it to the Conversations Client constructor.
|
11
11
|
|
12
12
|
### NPM
|
13
13
|
```
|
14
14
|
npm install --save @twilio/conversations
|
15
15
|
```
|
16
16
|
|
17
|
-
Using this method, you can `require` `twilio-conversations` and then use the
|
17
|
+
Using this method, you can `require` `twilio-conversations` and then use the
|
18
|
+
client:
|
18
19
|
```
|
19
|
-
const
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
35
|
-
const client =
|
36
|
-
//
|
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
|
@@ -41,19 +46,11 @@ const client = await Conversations.Client.create(token);
|
|
41
46
|
Releases of `twilio-conversations.js` are hosted on a CDN, and you can include these
|
42
47
|
directly in your web app using a `<script>` tag.
|
43
48
|
```html
|
44
|
-
<script src="https://media.twiliocdn.com/sdk/js/conversations/
|
49
|
+
<script src="https://media.twiliocdn.com/sdk/js/conversations/v2.0/twilio-conversations.min.js"></script>
|
45
50
|
```
|
46
|
-
Using this method, `twilio-conversations.js` will set a browser global `Twilio.Conversations` through which you can use the client
|
47
|
-
```
|
48
|
-
Twilio.Conversations.Client.create(token).then(client => {
|
49
|
-
// Use client
|
50
|
-
});
|
51
|
-
```
|
52
|
-
|
53
|
-
or, if you prefer `async`/`await` syntax:
|
51
|
+
Using this method, `twilio-conversations.js` will set a browser global `Twilio.Conversations` through which you can use the client:
|
54
52
|
```
|
55
|
-
|
56
|
-
// Use client
|
53
|
+
const client = new Twilio.Conversations.Client(token);
|
57
54
|
```
|
58
55
|
|
59
56
|
### Security
|
@@ -67,7 +64,7 @@ number. While less flexible it is significantly more secure, which is required b
|
|
67
64
|
To consume securely use the following script snippet format:
|
68
65
|
|
69
66
|
```html
|
70
|
-
<script src="https://media.twiliocdn.com/sdk/js/conversations/releases/
|
67
|
+
<script src="https://media.twiliocdn.com/sdk/js/conversations/releases/2.0.1/twilio-conversations.min.js"
|
71
68
|
integrity="sha256-<HASH FROM THE CHANGELOGS PAGE>"
|
72
69
|
crossorigin="anonymous"></script>
|
73
70
|
```
|