@twilio/conversations 3.0.0-rc.9 → 3.0.1-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.
- package/README.md +38 -28
- package/builds/browser.js +4327 -7903
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +629 -102
- package/builds/lib.js +4319 -7904
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +27540 -41958
- package/builds/twilio-conversations.min.js +200 -1
- package/dist/aggregated-delivery-receipt.js +10 -1
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/channel-metadata-client.js +192 -0
- package/dist/channel-metadata-client.js.map +1 -0
- package/dist/client.js +75 -123
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js +81 -20
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +14 -3
- package/dist/configuration.js.map +1 -1
- package/dist/content-client.js +184 -0
- package/dist/content-client.js.map +1 -0
- package/dist/content-template.js +310 -0
- package/dist/content-template.js.map +1 -0
- package/dist/conversation.js +105 -22
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +43 -5
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +26 -19
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +15 -4
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +11 -2
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js +9 -0
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces/notification-types.js +9 -0
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/interfaces/{attributes.js → rules.js} +26 -7
- package/dist/interfaces/rules.js.map +1 -0
- package/dist/logger.js +9 -0
- package/dist/logger.js.map +1 -1
- package/dist/media.js +9 -0
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +77 -6
- package/dist/message-builder.js.map +1 -1
- package/dist/message.js +115 -22
- package/dist/message.js.map +1 -1
- package/dist/node_modules/quick-lru/index.js +265 -0
- package/dist/node_modules/quick-lru/index.js.map +1 -0
- package/dist/node_modules/tslib/tslib.es6.js +9 -0
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/packages/conversations/package.json.js +10 -1
- package/dist/packages/conversations/package.json.js.map +1 -1
- package/dist/participant.js +45 -36
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js +9 -0
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js +20 -11
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js +110 -11
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +22 -5
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js +9 -0
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +20 -3
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js +9 -0
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js +9 -0
- package/dist/util/index.js.map +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +113 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1279 -0
- package/docs/classes/AggregatedDeliveryReceipt.html +144 -3182
- package/docs/classes/CancellablePromise.html +224 -3209
- package/docs/classes/CancellationError.html +112 -0
- package/docs/classes/ChannelMetadata.html +67 -0
- package/docs/classes/Client.html +701 -4237
- package/docs/classes/ContentTemplate.html +97 -0
- package/docs/classes/ContentTemplateVariable.html +90 -0
- package/docs/classes/Conversation.html +768 -4352
- package/docs/classes/DetailedDeliveryReceipt.html +116 -3162
- package/docs/classes/Media.html +119 -3165
- package/docs/classes/Message.html +417 -3730
- package/docs/classes/MessageBuilder.html +208 -3274
- package/docs/classes/Participant.html +258 -3442
- package/docs/classes/PushNotification.html +101 -3129
- package/docs/classes/RestPaginator.html +120 -3158
- package/docs/classes/UnsentMessage.html +63 -3040
- package/docs/classes/User.html +209 -3347
- package/docs/index.html +146 -3502
- package/docs/interfaces/ClientOptions.html +66 -3033
- package/docs/interfaces/ConversationBindings.html +109 -3000
- package/docs/interfaces/ConversationEmailBinding.html +109 -3000
- package/docs/interfaces/ConversationLimits.html +87 -3097
- package/docs/interfaces/ConversationState.html +66 -3049
- package/docs/interfaces/ConversationUpdatedEventArgs.html +109 -3000
- package/docs/interfaces/CreateConversationOptions.html +73 -3065
- package/docs/interfaces/LastMessage.html +66 -3049
- package/docs/interfaces/Paginator.html +110 -3139
- package/docs/interfaces/ParticipantBindingOptions.html +110 -0
- package/docs/interfaces/ParticipantBindings.html +109 -3000
- package/docs/interfaces/ParticipantEmailBinding.html +109 -3000
- package/docs/interfaces/PushNotificationData.html +94 -3113
- package/docs/interfaces/SendEmailOptions.html +59 -3033
- package/docs/interfaces/SendMediaOptions.html +75 -3067
- package/docs/modules.html +180 -3509
- package/docs/types/ChannelType.html +106 -0
- package/docs/types/ConnectionState.html +115 -0
- package/docs/types/ContentData.html +106 -0
- package/docs/types/ContentDataAction.html +107 -0
- package/docs/types/ContentDataActionOther.html +121 -0
- package/docs/types/ContentDataActionPhone.html +128 -0
- package/docs/types/ContentDataActionReply.html +133 -0
- package/docs/types/ContentDataActionUrl.html +128 -0
- package/docs/types/ContentDataCallToAction.html +131 -0
- package/docs/types/ContentDataCard.html +137 -0
- package/docs/types/ContentDataListItem.html +121 -0
- package/docs/types/ContentDataListPicker.html +134 -0
- package/docs/types/ContentDataLocation.html +134 -0
- package/docs/types/ContentDataMedia.html +129 -0
- package/docs/types/ContentDataOther.html +121 -0
- package/docs/types/ContentDataQuickReply.html +131 -0
- package/docs/types/ContentDataReply.html +119 -0
- package/docs/types/ContentDataText.html +125 -0
- package/docs/types/ConversationStatus.html +107 -0
- package/docs/types/ConversationUpdateReason.html +106 -0
- package/docs/types/DeliveryAmount.html +106 -0
- package/docs/types/DeliveryStatus.html +106 -0
- package/docs/types/JSONArray.html +106 -0
- package/docs/types/JSONObject.html +111 -0
- package/docs/types/JSONValue.html +106 -0
- package/docs/types/LogLevel.html +106 -0
- package/docs/types/MediaCategory.html +106 -0
- package/docs/types/MessageType.html +106 -0
- package/docs/types/MessageUpdateReason.html +106 -0
- package/docs/types/NotificationLevel.html +109 -0
- package/docs/types/NotificationsChannelType.html +110 -0
- package/docs/types/ParticipantEmailLevel.html +108 -0
- package/docs/types/ParticipantType.html +107 -0
- package/docs/types/ParticipantUpdateReason.html +106 -0
- package/docs/types/PushNotificationType.html +106 -0
- package/docs/types/State.html +110 -0
- package/docs/types/UserUpdateReason.html +106 -0
- package/package.json +22 -17
- package/CHANGELOG.md +0 -509
- package/dist/interfaces/attributes.js.map +0 -1
- package/docs/assets/css/main.css +0 -2660
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
package/README.md
CHANGED
@@ -1,58 +1,66 @@
|
|
1
|
+
# Twilio Conversations client library
|
1
2
|
|
2
|
-
Twilio Conversations client library
|
3
|
-
=============
|
4
3
|
Twilio Conversations: Create meaningful connections with customers across various communication channels.
|
5
4
|
Visit our official site for more detalis: [https://www.twilio.com/conversations](https://www.twilio.com/conversations)
|
6
5
|
|
6
|
+
## Instantiating and using
|
7
7
|
|
8
|
-
Instantiating and using
|
9
|
-
------------
|
10
8
|
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
9
|
|
12
10
|
### NPM
|
11
|
+
|
13
12
|
```
|
14
13
|
npm install --save @twilio/conversations
|
15
14
|
```
|
16
15
|
|
17
|
-
Using this method, you can `require` `twilio-conversations` and then use the
|
16
|
+
Using this method, you can `require` `twilio-conversations` and then use the
|
18
17
|
client:
|
18
|
+
|
19
19
|
```
|
20
20
|
const { Client } = require('@twilio/conversations');
|
21
|
+
|
21
22
|
const client = new Client(token);
|
22
|
-
|
23
|
-
//
|
24
|
-
client.on('
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
23
|
+
|
24
|
+
// Before you use the client, subscribe to the `'initialized'` event.
|
25
|
+
client.on('initialized', () => {
|
26
|
+
// Use the client.
|
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
38
|
import { Client } from '@twilio/conversations';
|
39
|
+
|
38
40
|
const client = new Client(token);
|
39
|
-
|
40
|
-
//
|
41
|
-
client.on('
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
|
42
|
+
// Before you use the client, subscribe to the `'initialized'` event.
|
43
|
+
client.on('initialized', () => {
|
44
|
+
// Use the client.
|
45
|
+
});
|
46
|
+
|
47
|
+
// To catch client initialization errors, subscribe to the `'initFailed'` event.
|
48
|
+
client.on('initFailed', ({ error }) => {
|
49
|
+
// Handle the error.
|
50
|
+
});
|
46
51
|
```
|
47
52
|
|
48
53
|
### CDN
|
49
54
|
|
50
55
|
Releases of `twilio-conversations.js` are hosted on a CDN, and you can include these
|
51
56
|
directly in your web app using a `<script>` tag.
|
57
|
+
|
52
58
|
```html
|
53
59
|
<script src="https://media.twiliocdn.com/sdk/js/conversations/v3.0/twilio-conversations.min.js"></script>
|
54
60
|
```
|
61
|
+
|
55
62
|
Using this method, `twilio-conversations.js` will set a browser global `Twilio.Conversations` through which you can use the client:
|
63
|
+
|
56
64
|
```
|
57
65
|
const client = new Twilio.Conversations.Client(token);
|
58
66
|
```
|
@@ -68,13 +76,15 @@ number. While less flexible it is significantly more secure, which is required b
|
|
68
76
|
To consume securely use the following script snippet format:
|
69
77
|
|
70
78
|
```html
|
71
|
-
<script
|
72
|
-
|
73
|
-
|
79
|
+
<script
|
80
|
+
src="https://media.twiliocdn.com/sdk/js/conversations/releases/3.0.1/twilio-conversations.min.js"
|
81
|
+
integrity="sha256-<HASH FROM THE CHANGELOGS PAGE>"
|
82
|
+
crossorigin="anonymous"
|
83
|
+
></script>
|
74
84
|
```
|
75
85
|
|
76
|
-
Find the hash of each release published on the [Changelog](#
|
86
|
+
Find the hash of each release published on the [Changelog](#changelog) page.
|
77
87
|
|
78
|
-
###
|
88
|
+
### Changelog
|
79
89
|
|
80
90
|
See this [link](https://www.twilio.com/docs/conversations/javascript/changelog).
|