@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.
Files changed (158) hide show
  1. package/README.md +38 -28
  2. package/builds/browser.js +4327 -7903
  3. package/builds/browser.js.map +1 -1
  4. package/builds/lib.d.ts +629 -102
  5. package/builds/lib.js +4319 -7904
  6. package/builds/lib.js.map +1 -1
  7. package/builds/twilio-conversations.js +27540 -41958
  8. package/builds/twilio-conversations.min.js +200 -1
  9. package/dist/aggregated-delivery-receipt.js +10 -1
  10. package/dist/aggregated-delivery-receipt.js.map +1 -1
  11. package/dist/channel-metadata-client.js +192 -0
  12. package/dist/channel-metadata-client.js.map +1 -0
  13. package/dist/client.js +75 -123
  14. package/dist/client.js.map +1 -1
  15. package/dist/command-executor.js +81 -20
  16. package/dist/command-executor.js.map +1 -1
  17. package/dist/configuration.js +14 -3
  18. package/dist/configuration.js.map +1 -1
  19. package/dist/content-client.js +184 -0
  20. package/dist/content-client.js.map +1 -0
  21. package/dist/content-template.js +310 -0
  22. package/dist/content-template.js.map +1 -0
  23. package/dist/conversation.js +105 -22
  24. package/dist/conversation.js.map +1 -1
  25. package/dist/data/conversations.js +43 -5
  26. package/dist/data/conversations.js.map +1 -1
  27. package/dist/data/messages.js +26 -19
  28. package/dist/data/messages.js.map +1 -1
  29. package/dist/data/participants.js +15 -4
  30. package/dist/data/participants.js.map +1 -1
  31. package/dist/data/users.js +11 -2
  32. package/dist/data/users.js.map +1 -1
  33. package/dist/detailed-delivery-receipt.js +9 -0
  34. package/dist/detailed-delivery-receipt.js.map +1 -1
  35. package/dist/index.js +20 -2
  36. package/dist/index.js.map +1 -1
  37. package/dist/interfaces/notification-types.js +9 -0
  38. package/dist/interfaces/notification-types.js.map +1 -1
  39. package/dist/interfaces/{attributes.js → rules.js} +26 -7
  40. package/dist/interfaces/rules.js.map +1 -0
  41. package/dist/logger.js +9 -0
  42. package/dist/logger.js.map +1 -1
  43. package/dist/media.js +9 -0
  44. package/dist/media.js.map +1 -1
  45. package/dist/message-builder.js +77 -6
  46. package/dist/message-builder.js.map +1 -1
  47. package/dist/message.js +115 -22
  48. package/dist/message.js.map +1 -1
  49. package/dist/node_modules/quick-lru/index.js +265 -0
  50. package/dist/node_modules/quick-lru/index.js.map +1 -0
  51. package/dist/node_modules/tslib/tslib.es6.js +9 -0
  52. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  53. package/dist/packages/conversations/package.json.js +10 -1
  54. package/dist/packages/conversations/package.json.js.map +1 -1
  55. package/dist/participant.js +45 -36
  56. package/dist/participant.js.map +1 -1
  57. package/dist/push-notification.js +9 -0
  58. package/dist/push-notification.js.map +1 -1
  59. package/dist/rest-paginator.js +20 -11
  60. package/dist/rest-paginator.js.map +1 -1
  61. package/dist/services/network.js +110 -11
  62. package/dist/services/network.js.map +1 -1
  63. package/dist/services/typing-indicator.js +22 -5
  64. package/dist/services/typing-indicator.js.map +1 -1
  65. package/dist/unsent-message.js +9 -0
  66. package/dist/unsent-message.js.map +1 -1
  67. package/dist/user.js +20 -3
  68. package/dist/user.js.map +1 -1
  69. package/dist/util/deferred.js +9 -0
  70. package/dist/util/deferred.js.map +1 -1
  71. package/dist/util/index.js +9 -0
  72. package/dist/util/index.js.map +1 -1
  73. package/docs/.nojekyll +1 -0
  74. package/docs/assets/highlight.css +113 -0
  75. package/docs/assets/main.js +58 -0
  76. package/docs/assets/search.js +1 -0
  77. package/docs/assets/style.css +1279 -0
  78. package/docs/classes/AggregatedDeliveryReceipt.html +144 -3182
  79. package/docs/classes/CancellablePromise.html +224 -3209
  80. package/docs/classes/CancellationError.html +112 -0
  81. package/docs/classes/ChannelMetadata.html +67 -0
  82. package/docs/classes/Client.html +701 -4237
  83. package/docs/classes/ContentTemplate.html +97 -0
  84. package/docs/classes/ContentTemplateVariable.html +90 -0
  85. package/docs/classes/Conversation.html +768 -4352
  86. package/docs/classes/DetailedDeliveryReceipt.html +116 -3162
  87. package/docs/classes/Media.html +119 -3165
  88. package/docs/classes/Message.html +417 -3730
  89. package/docs/classes/MessageBuilder.html +208 -3274
  90. package/docs/classes/Participant.html +258 -3442
  91. package/docs/classes/PushNotification.html +101 -3129
  92. package/docs/classes/RestPaginator.html +120 -3158
  93. package/docs/classes/UnsentMessage.html +63 -3040
  94. package/docs/classes/User.html +209 -3347
  95. package/docs/index.html +146 -3502
  96. package/docs/interfaces/ClientOptions.html +66 -3033
  97. package/docs/interfaces/ConversationBindings.html +109 -3000
  98. package/docs/interfaces/ConversationEmailBinding.html +109 -3000
  99. package/docs/interfaces/ConversationLimits.html +87 -3097
  100. package/docs/interfaces/ConversationState.html +66 -3049
  101. package/docs/interfaces/ConversationUpdatedEventArgs.html +109 -3000
  102. package/docs/interfaces/CreateConversationOptions.html +73 -3065
  103. package/docs/interfaces/LastMessage.html +66 -3049
  104. package/docs/interfaces/Paginator.html +110 -3139
  105. package/docs/interfaces/ParticipantBindingOptions.html +110 -0
  106. package/docs/interfaces/ParticipantBindings.html +109 -3000
  107. package/docs/interfaces/ParticipantEmailBinding.html +109 -3000
  108. package/docs/interfaces/PushNotificationData.html +94 -3113
  109. package/docs/interfaces/SendEmailOptions.html +59 -3033
  110. package/docs/interfaces/SendMediaOptions.html +75 -3067
  111. package/docs/modules.html +180 -3509
  112. package/docs/types/ChannelType.html +106 -0
  113. package/docs/types/ConnectionState.html +115 -0
  114. package/docs/types/ContentData.html +106 -0
  115. package/docs/types/ContentDataAction.html +107 -0
  116. package/docs/types/ContentDataActionOther.html +121 -0
  117. package/docs/types/ContentDataActionPhone.html +128 -0
  118. package/docs/types/ContentDataActionReply.html +133 -0
  119. package/docs/types/ContentDataActionUrl.html +128 -0
  120. package/docs/types/ContentDataCallToAction.html +131 -0
  121. package/docs/types/ContentDataCard.html +137 -0
  122. package/docs/types/ContentDataListItem.html +121 -0
  123. package/docs/types/ContentDataListPicker.html +134 -0
  124. package/docs/types/ContentDataLocation.html +134 -0
  125. package/docs/types/ContentDataMedia.html +129 -0
  126. package/docs/types/ContentDataOther.html +121 -0
  127. package/docs/types/ContentDataQuickReply.html +131 -0
  128. package/docs/types/ContentDataReply.html +119 -0
  129. package/docs/types/ContentDataText.html +125 -0
  130. package/docs/types/ConversationStatus.html +107 -0
  131. package/docs/types/ConversationUpdateReason.html +106 -0
  132. package/docs/types/DeliveryAmount.html +106 -0
  133. package/docs/types/DeliveryStatus.html +106 -0
  134. package/docs/types/JSONArray.html +106 -0
  135. package/docs/types/JSONObject.html +111 -0
  136. package/docs/types/JSONValue.html +106 -0
  137. package/docs/types/LogLevel.html +106 -0
  138. package/docs/types/MediaCategory.html +106 -0
  139. package/docs/types/MessageType.html +106 -0
  140. package/docs/types/MessageUpdateReason.html +106 -0
  141. package/docs/types/NotificationLevel.html +109 -0
  142. package/docs/types/NotificationsChannelType.html +110 -0
  143. package/docs/types/ParticipantEmailLevel.html +108 -0
  144. package/docs/types/ParticipantType.html +107 -0
  145. package/docs/types/ParticipantUpdateReason.html +106 -0
  146. package/docs/types/PushNotificationType.html +106 -0
  147. package/docs/types/State.html +110 -0
  148. package/docs/types/UserUpdateReason.html +106 -0
  149. package/package.json +22 -17
  150. package/CHANGELOG.md +0 -509
  151. package/dist/interfaces/attributes.js.map +0 -1
  152. package/docs/assets/css/main.css +0 -2660
  153. package/docs/assets/images/icons.png +0 -0
  154. package/docs/assets/images/icons@2x.png +0 -0
  155. package/docs/assets/images/widgets.png +0 -0
  156. package/docs/assets/images/widgets@2x.png +0 -0
  157. package/docs/assets/js/main.js +0 -248
  158. 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
- // 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
- }
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
- // 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
- }
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 src="https://media.twiliocdn.com/sdk/js/conversations/releases/3.0.0/twilio-conversations.min.js"
72
- integrity="sha256-<HASH FROM THE CHANGELOGS PAGE>"
73
- crossorigin="anonymous"></script>
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](#Changelog) page.
86
+ Find the hash of each release published on the [Changelog](#changelog) page.
77
87
 
78
- ### Changelog
88
+ ### Changelog
79
89
 
80
90
  See this [link](https://www.twilio.com/docs/conversations/javascript/changelog).