@twilio/conversations 3.0.0-rc.9 → 3.0.1-rc.102

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 (88) hide show
  1. package/README.md +38 -28
  2. package/builds/browser.js +1659 -264
  3. package/builds/browser.js.map +1 -1
  4. package/builds/lib.d.ts +650 -25
  5. package/builds/lib.js +1650 -264
  6. package/builds/lib.js.map +1 -1
  7. package/builds/twilio-conversations.js +4300 -1842
  8. package/builds/twilio-conversations.min.js +1 -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 +70 -10
  14. package/dist/client.js.map +1 -1
  15. package/dist/command-executor.js +48 -6
  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 +59 -16
  24. package/dist/conversation.js.map +1 -1
  25. package/dist/data/conversations.js +25 -3
  26. package/dist/data/conversations.js.map +1 -1
  27. package/dist/data/messages.js +23 -6
  28. package/dist/data/messages.js.map +1 -1
  29. package/dist/data/participants.js +17 -8
  30. package/dist/data/participants.js.map +1 -1
  31. package/dist/data/users.js +9 -0
  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 +14 -0
  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 +156 -12
  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 +11 -2
  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 +9 -0
  60. package/dist/rest-paginator.js.map +1 -1
  61. package/dist/services/network.js +9 -0
  62. package/dist/services/network.js.map +1 -1
  63. package/dist/services/typing-indicator.js +9 -0
  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/assets/js/search.js +1 -1
  74. package/docs/classes/AggregatedDeliveryReceipt.html +1 -1
  75. package/docs/classes/ChannelMetadata.html +3050 -0
  76. package/docs/classes/Client.html +64 -25
  77. package/docs/classes/ContentTemplate.html +3116 -0
  78. package/docs/classes/ContentTemplateVariable.html +3116 -0
  79. package/docs/classes/Conversation.html +14 -9
  80. package/docs/classes/Message.html +76 -5
  81. package/docs/classes/MessageBuilder.html +41 -0
  82. package/docs/classes/Participant.html +2 -2
  83. package/docs/index.html +849 -25
  84. package/docs/interfaces/ClientOptions.html +16 -0
  85. package/docs/modules.html +848 -24
  86. package/package.json +18 -14
  87. package/CHANGELOG.md +0 -509
  88. package/dist/interfaces/attributes.js.map +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).