@twilio/conversations 3.0.0-rc.9 → 3.0.1-rc.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.
Files changed (121) hide show
  1. package/README.md +39 -29
  2. package/builds/browser.esm.js +10846 -0
  3. package/builds/browser.esm.js.map +1 -0
  4. package/builds/browser.js +2505 -479
  5. package/builds/browser.js.map +1 -1
  6. package/builds/lib.d.ts +805 -70
  7. package/builds/lib.esm.d.ts +3178 -0
  8. package/builds/lib.esm.js +10845 -0
  9. package/builds/lib.js +2505 -479
  10. package/builds/lib.js.map +1 -1
  11. package/builds/twilio-conversations.js +25853 -24412
  12. package/builds/twilio-conversations.js.map +1 -0
  13. package/builds/twilio-conversations.min.js +2 -1
  14. package/builds/twilio-conversations.min.js.map +1 -0
  15. package/dist/aggregated-delivery-receipt.js +10 -5
  16. package/dist/aggregated-delivery-receipt.js.map +1 -1
  17. package/dist/channel-metadata-client.js +187 -0
  18. package/dist/channel-metadata-client.js.map +1 -0
  19. package/dist/client.js +266 -192
  20. package/dist/client.js.map +1 -1
  21. package/dist/command-executor.js +53 -15
  22. package/dist/command-executor.js.map +1 -1
  23. package/dist/configuration.js +23 -12
  24. package/dist/configuration.js.map +1 -1
  25. package/dist/content-client.js +180 -0
  26. package/dist/content-client.js.map +1 -0
  27. package/dist/content-template.js +304 -0
  28. package/dist/content-template.js.map +1 -0
  29. package/dist/conversation.js +213 -134
  30. package/dist/conversation.js.map +1 -1
  31. package/dist/data/conversations.js +70 -50
  32. package/dist/data/conversations.js.map +1 -1
  33. package/dist/data/messages.js +40 -27
  34. package/dist/data/messages.js.map +1 -1
  35. package/dist/data/participants.js +38 -32
  36. package/dist/data/participants.js.map +1 -1
  37. package/dist/data/users.js +19 -14
  38. package/dist/data/users.js.map +1 -1
  39. package/dist/detailed-delivery-receipt.js +9 -4
  40. package/dist/detailed-delivery-receipt.js.map +1 -1
  41. package/dist/index.js +26 -41
  42. package/dist/index.js.map +1 -1
  43. package/dist/interfaces/notification-types.js +9 -4
  44. package/dist/interfaces/notification-types.js.map +1 -1
  45. package/dist/interfaces/rules.js +160 -0
  46. package/dist/interfaces/rules.js.map +1 -0
  47. package/dist/logger.js +17 -28
  48. package/dist/logger.js.map +1 -1
  49. package/dist/media.js +40 -24
  50. package/dist/media.js.map +1 -1
  51. package/dist/message-builder.js +79 -12
  52. package/dist/message-builder.js.map +1 -1
  53. package/dist/message-recipients-client.js +231 -0
  54. package/dist/message-recipients-client.js.map +1 -0
  55. package/dist/message.js +258 -92
  56. package/dist/message.js.map +1 -1
  57. package/dist/node_modules/quick-lru/index.js +261 -0
  58. package/dist/node_modules/quick-lru/index.js.map +1 -0
  59. package/dist/node_modules/tslib/tslib.es6.js +15 -5
  60. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  61. package/dist/packages/conversations/package.json.js +12 -7
  62. package/dist/packages/conversations/package.json.js.map +1 -1
  63. package/dist/participant.js +42 -38
  64. package/dist/participant.js.map +1 -1
  65. package/dist/push-notification.js +9 -4
  66. package/dist/push-notification.js.map +1 -1
  67. package/dist/rest-paginator.js +9 -4
  68. package/dist/rest-paginator.js.map +1 -1
  69. package/dist/services/network.js +11 -6
  70. package/dist/services/network.js.map +1 -1
  71. package/dist/services/typing-indicator.js +17 -11
  72. package/dist/services/typing-indicator.js.map +1 -1
  73. package/dist/unsent-message.js +14 -9
  74. package/dist/unsent-message.js.map +1 -1
  75. package/dist/user.js +40 -32
  76. package/dist/user.js.map +1 -1
  77. package/dist/util/deferred.js +9 -4
  78. package/dist/util/deferred.js.map +1 -1
  79. package/dist/util/index.js +44 -8
  80. package/dist/util/index.js.map +1 -1
  81. package/dist/{interfaces/attributes.js → utils/uuid.js} +17 -19
  82. package/dist/utils/uuid.js.map +1 -0
  83. package/package.json +21 -20
  84. package/CHANGELOG.md +0 -509
  85. package/dist/interfaces/attributes.js.map +0 -1
  86. package/docs/assets/css/main.css +0 -2660
  87. package/docs/assets/images/icons.png +0 -0
  88. package/docs/assets/images/icons@2x.png +0 -0
  89. package/docs/assets/images/widgets.png +0 -0
  90. package/docs/assets/images/widgets@2x.png +0 -0
  91. package/docs/assets/js/main.js +0 -248
  92. package/docs/assets/js/search.js +0 -1
  93. package/docs/classes/AggregatedDeliveryReceipt.html +0 -3184
  94. package/docs/classes/CancellablePromise.html +0 -3213
  95. package/docs/classes/Client.html +0 -4239
  96. package/docs/classes/Conversation.html +0 -4354
  97. package/docs/classes/DetailedDeliveryReceipt.html +0 -3163
  98. package/docs/classes/Media.html +0 -3167
  99. package/docs/classes/Message.html +0 -3732
  100. package/docs/classes/MessageBuilder.html +0 -3277
  101. package/docs/classes/Participant.html +0 -3444
  102. package/docs/classes/PushNotification.html +0 -3130
  103. package/docs/classes/RestPaginator.html +0 -3160
  104. package/docs/classes/UnsentMessage.html +0 -3042
  105. package/docs/classes/User.html +0 -3349
  106. package/docs/index.html +0 -3509
  107. package/docs/interfaces/ClientOptions.html +0 -3034
  108. package/docs/interfaces/ConversationBindings.html +0 -3001
  109. package/docs/interfaces/ConversationEmailBinding.html +0 -3001
  110. package/docs/interfaces/ConversationLimits.html +0 -3098
  111. package/docs/interfaces/ConversationState.html +0 -3050
  112. package/docs/interfaces/ConversationUpdatedEventArgs.html +0 -3001
  113. package/docs/interfaces/CreateConversationOptions.html +0 -3066
  114. package/docs/interfaces/LastMessage.html +0 -3050
  115. package/docs/interfaces/Paginator.html +0 -3141
  116. package/docs/interfaces/ParticipantBindings.html +0 -3001
  117. package/docs/interfaces/ParticipantEmailBinding.html +0 -3001
  118. package/docs/interfaces/PushNotificationData.html +0 -3114
  119. package/docs/interfaces/SendEmailOptions.html +0 -3034
  120. package/docs/interfaces/SendMediaOptions.html +0 -3068
  121. package/docs/modules.html +0 -3510
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
- <script src="https://media.twiliocdn.com/sdk/js/conversations/v3.0/twilio-conversations.min.js"></script>
59
+ <script src="https://sdk.twilio.com/js/conversations/v4.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://sdk.twilio.com/js/conversations/releases/4.0.0/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).