@twilio/conversations 1.3.0-rc7 → 2.0.0-rc.3

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 (282) hide show
  1. package/CHANGELOG.md +201 -0
  2. package/README.md +5 -5
  3. package/dist/browser.js +7866 -0
  4. package/dist/browser.js.map +1 -0
  5. package/dist/docs/assets/css/main.css +2660 -0
  6. package/dist/docs/assets/images/icons.png +0 -0
  7. package/dist/docs/assets/images/icons@2x.png +0 -0
  8. package/dist/docs/assets/images/widgets.png +0 -0
  9. package/dist/docs/assets/images/widgets@2x.png +0 -0
  10. package/dist/docs/assets/js/main.js +248 -0
  11. package/dist/docs/assets/js/search.js +1 -0
  12. package/dist/docs/classes/AggregatedDeliveryReceipt.html +3286 -0
  13. package/dist/docs/classes/Client.html +4181 -0
  14. package/dist/docs/classes/Conversation.html +4397 -0
  15. package/dist/docs/classes/DetailedDeliveryReceipt.html +3265 -0
  16. package/dist/docs/classes/Media.html +3295 -0
  17. package/dist/docs/classes/Message.html +3713 -0
  18. package/dist/docs/classes/MessageBuilder.html +3280 -0
  19. package/dist/docs/classes/Participant.html +3517 -0
  20. package/dist/docs/classes/PushNotification.html +3232 -0
  21. package/dist/docs/classes/RestPaginator.html +3262 -0
  22. package/dist/docs/classes/UnsentMessage.html +3144 -0
  23. package/dist/docs/classes/User.html +3451 -0
  24. package/dist/docs/index.html +3387 -212
  25. package/dist/docs/interfaces/ClientOptions.html +3136 -0
  26. package/dist/docs/interfaces/ConversationState.html +3152 -0
  27. package/dist/docs/interfaces/CreateConversationOptions.html +3168 -0
  28. package/dist/docs/interfaces/LastMessage.html +3152 -0
  29. package/dist/docs/interfaces/Paginator.html +3243 -0
  30. package/dist/docs/interfaces/PushNotificationData.html +3168 -0
  31. package/dist/docs/interfaces/SendEmailOptions.html +3136 -0
  32. package/dist/docs/interfaces/SendMediaOptions.html +3169 -0
  33. package/dist/docs/modules.html +3418 -0
  34. package/dist/lib.d.ts +1944 -0
  35. package/dist/lib.js +7866 -0
  36. package/dist/lib.js.map +1 -0
  37. package/dist/post-install.js +29 -0
  38. package/dist/react-native.js +4031 -0
  39. package/dist/react-native.js.map +1 -0
  40. package/dist/twilio-conversations.js +40905 -0
  41. package/dist/twilio-conversations.min.js +156 -0
  42. package/package.json +59 -48
  43. package/.circleci/config.yml +0 -650
  44. package/.deepsource.toml +0 -6
  45. package/.env.example +0 -13
  46. package/browser/aggregateddeliveryreceipt.js +0 -152
  47. package/browser/client.js +0 -991
  48. package/browser/configuration.js +0 -80
  49. package/browser/conversation.js +0 -1826
  50. package/browser/data/conversations.js +0 -665
  51. package/browser/data/messages.js +0 -522
  52. package/browser/data/participants.js +0 -411
  53. package/browser/data/users.js +0 -281
  54. package/browser/detaileddeliveryreceipt.js +0 -44
  55. package/browser/index.js +0 -4
  56. package/browser/interfaces/limits.js +0 -3
  57. package/browser/interfaces/notificationtypes.js +0 -21
  58. package/browser/interfaces/paginator.js +0 -53
  59. package/browser/interfaces/responsecodes.js +0 -20
  60. package/browser/interfaces/transport.js +0 -3
  61. package/browser/logger.js +0 -141
  62. package/browser/media.js +0 -198
  63. package/browser/message.js +0 -685
  64. package/browser/participant.js +0 -415
  65. package/browser/pushnotification.js +0 -49
  66. package/browser/restpaginator.js +0 -74
  67. package/browser/services/network.js +0 -223
  68. package/browser/services/readhorizon.js +0 -181
  69. package/browser/services/typingindicator.js +0 -142
  70. package/browser/session.js +0 -505
  71. package/browser/sessionerror.js +0 -93
  72. package/browser/sri.json +0 -1
  73. package/browser/synclist.js +0 -90
  74. package/browser/synclistdescriptor.js +0 -29
  75. package/browser/syncpaginator.js +0 -63
  76. package/browser/user.js +0 -431
  77. package/browser/util/deferred.js +0 -56
  78. package/browser/util/index.js +0 -108
  79. package/dist/@twilio/conversations.js +0 -35565
  80. package/dist/@twilio/conversations.min.js +0 -204
  81. package/dist/docs/AggregatedDeliveryReceipt.html +0 -948
  82. package/dist/docs/Client.html +0 -5075
  83. package/dist/docs/Conversation.html +0 -6018
  84. package/dist/docs/DetailedDeliveryReceipt.html +0 -641
  85. package/dist/docs/Media.html +0 -694
  86. package/dist/docs/Message.html +0 -1934
  87. package/dist/docs/Paginator.html +0 -605
  88. package/dist/docs/Participant.html +0 -1510
  89. package/dist/docs/PushNotification.html +0 -836
  90. package/dist/docs/SessionError.html +0 -379
  91. package/dist/docs/User.html +0 -1315
  92. package/dist/docs/classes.list.html +0 -4431
  93. package/dist/docs/fonts/glyphicons-halflings-regular.eot +0 -0
  94. package/dist/docs/fonts/glyphicons-halflings-regular.svg +0 -288
  95. package/dist/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
  96. package/dist/docs/fonts/glyphicons-halflings-regular.woff +0 -0
  97. package/dist/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
  98. package/dist/docs/img/glyphicons-halflings-white.png +0 -0
  99. package/dist/docs/img/glyphicons-halflings.png +0 -0
  100. package/dist/docs/quicksearch.html +0 -31
  101. package/dist/docs/scripts/docstrap.lib.js +0 -11
  102. package/dist/docs/scripts/fulltext-search-ui.js +0 -89
  103. package/dist/docs/scripts/fulltext-search.js +0 -36
  104. package/dist/docs/scripts/lunr.min.js +0 -6
  105. package/dist/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  106. package/dist/docs/scripts/prettify/jquery.min.js +0 -6
  107. package/dist/docs/scripts/prettify/lang-css.js +0 -21
  108. package/dist/docs/scripts/prettify/prettify.js +0 -496
  109. package/dist/docs/scripts/sunlight.js +0 -1157
  110. package/dist/docs/scripts/toc.js +0 -203
  111. package/dist/docs/styles/darkstrap.css +0 -960
  112. package/dist/docs/styles/prettify-tomorrow.css +0 -132
  113. package/dist/docs/styles/site.cerulean.css +0 -7008
  114. package/dist/docs/styles/site.cosmo.css +0 -7061
  115. package/dist/docs/styles/site.cyborg.css +0 -7048
  116. package/dist/docs/styles/site.darkly.css +0 -7171
  117. package/dist/docs/styles/site.darkstrap.css +0 -5638
  118. package/dist/docs/styles/site.dibs-bootstrap.css +0 -5899
  119. package/dist/docs/styles/site.flatly.css +0 -7147
  120. package/dist/docs/styles/site.journal.css +0 -6973
  121. package/dist/docs/styles/site.lumen.css +0 -7298
  122. package/dist/docs/styles/site.paper.css +0 -7623
  123. package/dist/docs/styles/site.readable.css +0 -6997
  124. package/dist/docs/styles/site.sandstone.css +0 -7035
  125. package/dist/docs/styles/site.simplex.css +0 -7023
  126. package/dist/docs/styles/site.slate.css +0 -7343
  127. package/dist/docs/styles/site.spacelab.css +0 -7055
  128. package/dist/docs/styles/site.superhero.css +0 -7131
  129. package/dist/docs/styles/site.united.css +0 -6895
  130. package/dist/docs/styles/site.yeti.css +0 -7195
  131. package/dist/docs/styles/sunlight.dark.css +0 -345
  132. package/dist/docs/styles/sunlight.default.css +0 -344
  133. package/dist/sri.json +0 -1
  134. package/lib/aggregateddeliveryreceipt.d.ts +0 -98
  135. package/lib/aggregateddeliveryreceipt.js +0 -112
  136. package/lib/client.d.ts +0 -317
  137. package/lib/client.js +0 -633
  138. package/lib/configuration.d.ts +0 -21
  139. package/lib/configuration.js +0 -41
  140. package/lib/conversation.d.ts +0 -460
  141. package/lib/conversation.js +0 -940
  142. package/lib/data/conversations.d.ts +0 -57
  143. package/lib/data/conversations.js +0 -318
  144. package/lib/data/messages.d.ts +0 -75
  145. package/lib/data/messages.js +0 -208
  146. package/lib/data/participants.d.ts +0 -94
  147. package/lib/data/participants.js +0 -204
  148. package/lib/data/users.d.ts +0 -42
  149. package/lib/data/users.js +0 -113
  150. package/lib/detaileddeliveryreceipt.d.ts +0 -45
  151. package/lib/detaileddeliveryreceipt.js +0 -34
  152. package/lib/index.d.ts +0 -1
  153. package/lib/index.js +0 -3
  154. package/lib/interfaces/limits.d.ts +0 -8
  155. package/lib/interfaces/limits.js +0 -2
  156. package/lib/interfaces/notificationtypes.d.ts +0 -8
  157. package/lib/interfaces/notificationtypes.js +0 -11
  158. package/lib/interfaces/paginator.d.ts +0 -52
  159. package/lib/interfaces/paginator.js +0 -28
  160. package/lib/interfaces/responsecodes.d.ts +0 -8
  161. package/lib/interfaces/responsecodes.js +0 -10
  162. package/lib/interfaces/transport.d.ts +0 -13
  163. package/lib/interfaces/transport.js +0 -2
  164. package/lib/logger.d.ts +0 -18
  165. package/lib/logger.js +0 -35
  166. package/lib/media.d.ts +0 -52
  167. package/lib/media.js +0 -69
  168. package/lib/message.d.ts +0 -136
  169. package/lib/message.js +0 -305
  170. package/lib/participant.d.ts +0 -142
  171. package/lib/participant.js +0 -219
  172. package/lib/pushnotification.d.ts +0 -48
  173. package/lib/pushnotification.js +0 -39
  174. package/lib/restpaginator.d.ts +0 -19
  175. package/lib/restpaginator.js +0 -36
  176. package/lib/services/network.d.ts +0 -22
  177. package/lib/services/network.js +0 -87
  178. package/lib/services/readhorizon.d.ts +0 -28
  179. package/lib/services/readhorizon.js +0 -112
  180. package/lib/services/typingindicator.d.ts +0 -50
  181. package/lib/services/typingindicator.js +0 -102
  182. package/lib/session.d.ts +0 -63
  183. package/lib/session.js +0 -213
  184. package/lib/sessionerror.d.ts +0 -12
  185. package/lib/sessionerror.js +0 -24
  186. package/lib/sri.json +0 -1
  187. package/lib/synclist.d.ts +0 -24
  188. package/lib/synclist.js +0 -28
  189. package/lib/synclistdescriptor.d.ts +0 -27
  190. package/lib/synclistdescriptor.js +0 -19
  191. package/lib/syncpaginator.d.ts +0 -22
  192. package/lib/syncpaginator.js +0 -37
  193. package/lib/user.d.ts +0 -98
  194. package/lib/user.js +0 -219
  195. package/lib/util/deferred.d.ts +0 -12
  196. package/lib/util/deferred.js +0 -22
  197. package/lib/util/index.d.ts +0 -28
  198. package/lib/util/index.js +0 -82
  199. package/tools/rtd-sdk-cdn-pin/.gitrepo +0 -12
  200. package/tools/rtd-sdk-cdn-pin/README.md +0 -54
  201. package/tools/rtd-sdk-cdn-pin/bintray-settings.xml.template +0 -16
  202. package/tools/rtd-sdk-cdn-pin/cdn-common/cdn-prepare.sh +0 -67
  203. package/tools/rtd-sdk-cdn-pin/cdn-pin-latest.sh +0 -19
  204. package/tools/rtd-sdk-cdn-pin/cdn-pin.sh +0 -19
  205. package/tools/rtd-sdk-cdn-pin/cdn-upload.sh +0 -13
  206. package/tools/rtd-sdk-cdn-pin/fetch/common/fetch-bintray-android.sh +0 -34
  207. package/tools/rtd-sdk-cdn-pin/fetch/common/fetch-npm.sh +0 -18
  208. package/tools/rtd-sdk-cdn-pin/fetch/twilio-chat-android.sh +0 -5
  209. package/tools/rtd-sdk-cdn-pin/fetch/twilio-chat-js.sh +0 -5
  210. package/tools/rtd-sdk-cdn-pin/fetch/twilio-conversations-android.sh +0 -6
  211. package/tools/rtd-sdk-cdn-pin/fetch/twilio-conversations-js.sh +0 -5
  212. package/tools/rtd-sdk-cdn-pin/fetch/twilio-sync-android.sh +0 -5
  213. package/tools/rtd-sdk-cdn-pin/fetch/twilio-sync-js.sh +0 -5
  214. package/tools/rtd-sdk-cdn-pin/fetch-artifact.sh +0 -26
  215. package/tools/sdk-release-tool/.gitrepo +0 -12
  216. package/tools/sdk-release-tool/Makefile +0 -49
  217. package/tools/sdk-release-tool/README.md +0 -275
  218. package/tools/sdk-release-tool/delete +0 -3
  219. package/tools/sdk-release-tool/download +0 -3
  220. package/tools/sdk-release-tool/get-cors +0 -3
  221. package/tools/sdk-release-tool/list +0 -3
  222. package/tools/sdk-release-tool/pin +0 -3
  223. package/tools/sdk-release-tool/pin-latest +0 -3
  224. package/tools/sdk-release-tool/requirements.txt +0 -4
  225. package/tools/sdk-release-tool/sdk-release-tool +0 -3
  226. package/tools/sdk-release-tool/sdk_release_tools/__init__.py +0 -0
  227. package/tools/sdk-release-tool/sdk_release_tools/__main__.py +0 -110
  228. package/tools/sdk-release-tool/sdk_release_tools/aws.py +0 -70
  229. package/tools/sdk-release-tool/sdk_release_tools/cli.py +0 -181
  230. package/tools/sdk-release-tool/sdk_release_tools/log.py +0 -24
  231. package/tools/sdk-release-tool/sdk_release_tools/ops.py +0 -295
  232. package/tools/sdk-release-tool/sdk_release_tools/rpm.py +0 -28
  233. package/tools/sdk-release-tool/sdk_release_tools/util.py +0 -186
  234. package/tools/sdk-release-tool/sdk_release_tools/versions.py +0 -362
  235. package/tools/sdk-release-tool/signal-sdk-js.json +0 -28
  236. package/tools/sdk-release-tool/tests/test_versions.py +0 -94
  237. package/tools/sdk-release-tool/twilio-accessmanager-android.json +0 -19
  238. package/tools/sdk-release-tool/twilio-accessmanager-ios.json +0 -26
  239. package/tools/sdk-release-tool/twilio-auth-ios.json +0 -29
  240. package/tools/sdk-release-tool/twilio-authenticator-ios.json +0 -29
  241. package/tools/sdk-release-tool/twilio-chat-android-2.json +0 -19
  242. package/tools/sdk-release-tool/twilio-chat-android.json +0 -22
  243. package/tools/sdk-release-tool/twilio-chat-ios.json +0 -26
  244. package/tools/sdk-release-tool/twilio-chat-js.json +0 -27
  245. package/tools/sdk-release-tool/twilio-client-android-aar.json +0 -22
  246. package/tools/sdk-release-tool/twilio-client-android.json +0 -22
  247. package/tools/sdk-release-tool/twilio-client-ios.json +0 -20
  248. package/tools/sdk-release-tool/twilio-client-js.json +0 -17
  249. package/tools/sdk-release-tool/twilio-client-sounds-js.json +0 -14
  250. package/tools/sdk-release-tool/twilio-common-android-maven.json +0 -16
  251. package/tools/sdk-release-tool/twilio-common-android.json +0 -22
  252. package/tools/sdk-release-tool/twilio-common-ios-rtc.json +0 -25
  253. package/tools/sdk-release-tool/twilio-common-ios.json +0 -25
  254. package/tools/sdk-release-tool/twilio-common-js.json +0 -19
  255. package/tools/sdk-release-tool/twilio-conversations-android.json +0 -22
  256. package/tools/sdk-release-tool/twilio-conversations-ios.json +0 -26
  257. package/tools/sdk-release-tool/twilio-conversations-js.json +0 -27
  258. package/tools/sdk-release-tool/twilio-flex-js.json +0 -20
  259. package/tools/sdk-release-tool/twilio-flex-webchat-js.json +0 -16
  260. package/tools/sdk-release-tool/twilio-frame-chat-android.json +0 -22
  261. package/tools/sdk-release-tool/twilio-frame-chat-ios.json +0 -23
  262. package/tools/sdk-release-tool/twilio-frame-chat-js.json +0 -23
  263. package/tools/sdk-release-tool/twilio-ip-messaging-android-maven.json +0 -16
  264. package/tools/sdk-release-tool/twilio-ip-messaging-android.json +0 -22
  265. package/tools/sdk-release-tool/twilio-ip-messaging-ios.json +0 -25
  266. package/tools/sdk-release-tool/twilio-ip-messaging-js.json +0 -21
  267. package/tools/sdk-release-tool/twilio-sync-android.json +0 -22
  268. package/tools/sdk-release-tool/twilio-sync-ios.json +0 -26
  269. package/tools/sdk-release-tool/twilio-sync-js.json +0 -39
  270. package/tools/sdk-release-tool/twilio-taskrouter-js.json +0 -17
  271. package/tools/sdk-release-tool/twilio-video-android.json +0 -22
  272. package/tools/sdk-release-tool/twilio-video-cpp-linux-cross-rootfs.json +0 -13
  273. package/tools/sdk-release-tool/twilio-video-cpp.json +0 -33
  274. package/tools/sdk-release-tool/twilio-video-ios.json +0 -25
  275. package/tools/sdk-release-tool/twilio-video-js.json +0 -19
  276. package/tools/sdk-release-tool/twilio-video-jsdocs.json +0 -14
  277. package/tools/sdk-release-tool/twilio-voice-android.json +0 -22
  278. package/tools/sdk-release-tool/twilio-voice-ios.json +0 -29
  279. package/tools/sdk-release-tool/unpin +0 -3
  280. package/tools/sdk-release-tool/unpin-latest +0 -3
  281. package/tools/sdk-release-tool/upload +0 -3
  282. package/twilio-chat.js.iml +0 -9
@@ -1,98 +0,0 @@
1
- declare namespace AggregatedDeliveryReceipt {
2
- type DeliveryAmount = 'none' | 'some' | 'all';
3
- interface AggregatedDeliveryDescriptor {
4
- total: number;
5
- delivered: DeliveryAmount;
6
- failed: DeliveryAmount;
7
- read: DeliveryAmount;
8
- sent: DeliveryAmount;
9
- undelivered: DeliveryAmount;
10
- }
11
- }
12
- /**
13
- * @classdesc Contains aggregated information about a {@link Message}'s delivery statuses across all {@link Participant}s
14
- * of a {@link Conversation}.
15
- *
16
- * At any moment during delivering message to a {@link Participant} the message can have zero or more of following
17
- * delivery statuses:
18
- *
19
- * <ul><li>
20
- * Message considered as <b>sent</b> to a participant, if the nearest upstream carrier accepted the message.
21
- * </li><li>
22
- * Message considered as <b>delivered</b> to a participant, if Twilio has received confirmation of message
23
- * delivery from the upstream carrier, and, where available, the destination handset.
24
- * </li><li>
25
- * Message considered as <b>undelivered</b> to a participant, if Twilio has received a delivery receipt
26
- * indicating that the message was not delivered. This can happen for many reasons including carrier content
27
- * filtering and the availability of the destination handset.
28
- * </li><li>
29
- * Message considered as <b>read</b> by a participant, if the message has been delivered and opened by the
30
- * recipient in the conversation. The recipient must have enabled read receipts.
31
- * </li><li>
32
- * Message considered as <b>failed</b> to be delivered to a participant if the message could not be sent.
33
- * This can happen for various reasons including queue overflows, account suspensions and media
34
- * errors (in the case of MMS for instance).
35
- *</li></ul>
36
- *
37
- * {@link AggregatedDeliveryReceipt} class contains aggregated value {@link AggregatedDeliveryReceipt#DeliveryAmount} for each delivery status.
38
- *
39
- * @property {number} total - Maximum number of delivery events expected for the message
40
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} sent - Amount of participants that have <b>sent</b> delivery status for the message.
41
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} delivered - Amount of participants that have <b>delivered</b> delivery status
42
- * for the message.
43
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} read - Amount of participants that have <b>read</b> delivery status for the message.
44
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} undelivered - Amount of participants that have <b>undelivered</b> delivery status
45
- * for the message.
46
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} failed - Amount of participants that have <b>failed</b> delivery status for the message.
47
- */
48
- declare class AggregatedDeliveryReceipt {
49
- private state;
50
- /**
51
- * Signifies amount of participants which have the status for the message.
52
- * @typedef {('none'|'some'|'all')} AggregatedDeliveryReceipt#DeliveryAmount
53
- */
54
- constructor(data: AggregatedDeliveryReceipt.AggregatedDeliveryDescriptor);
55
- /**
56
- * @return Maximum number of delivery events expected for the message.
57
- */
58
- get total(): number;
59
- /**
60
- * Message considered as <b>sent</b> to a participant, if the nearest upstream carrier accepted the message.
61
- *
62
- * @return {@link DeliveryAmount} of participants that have <b>sent</b> delivery status for the message.
63
- */
64
- get sent(): AggregatedDeliveryReceipt.DeliveryAmount;
65
- /**
66
- * Message considered as <b>delivered</b> to a participant, if Twilio has received confirmation of message
67
- * delivery from the upstream carrier, and, where available, the destination handset.
68
- *
69
- * @return {@link DeliveryAmount} of participants that have <b>delivered</b> delivery status for the message.
70
- */
71
- get delivered(): AggregatedDeliveryReceipt.DeliveryAmount;
72
- /**
73
- * Message considered as <b>read</b> by a participant, if the message has been delivered and opened by the
74
- * recipient in the conversation. The recipient must have enabled read receipts.
75
- *
76
- * @return {@link DeliveryAmount} of participants that have <b>read</b> delivery status for the message.
77
- */
78
- get read(): AggregatedDeliveryReceipt.DeliveryAmount;
79
- /**
80
- * Message considered as <b>undelivered</b> to a participant, if Twilio has received a delivery receipt
81
- * indicating that the message was not delivered. This can happen for many reasons including carrier content
82
- * filtering and the availability of the destination handset.
83
- *
84
- * @return {@link DeliveryAmount} of participants that have <b>undelivered</b> delivery status for the message.
85
- */
86
- get undelivered(): AggregatedDeliveryReceipt.DeliveryAmount;
87
- /**
88
- * Message considered as <b>failed</b> to be delivered to a participant if the message could not be sent.
89
- * This can happen for various reasons including queue overflows, account suspensions and media
90
- * errors (in the case of MMS for instance). Twilio does not charge you for failed messages.
91
- *
92
- * @return {@link DeliveryAmount} of participants that have <b>failed</b> delivery status for the message.
93
- */
94
- get failed(): AggregatedDeliveryReceipt.DeliveryAmount;
95
- _update(data: AggregatedDeliveryReceipt.AggregatedDeliveryDescriptor): void;
96
- _isEquals(data: AggregatedDeliveryReceipt.AggregatedDeliveryDescriptor): boolean;
97
- }
98
- export { AggregatedDeliveryReceipt };
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * @classdesc Contains aggregated information about a {@link Message}'s delivery statuses across all {@link Participant}s
5
- * of a {@link Conversation}.
6
- *
7
- * At any moment during delivering message to a {@link Participant} the message can have zero or more of following
8
- * delivery statuses:
9
- *
10
- * <ul><li>
11
- * Message considered as <b>sent</b> to a participant, if the nearest upstream carrier accepted the message.
12
- * </li><li>
13
- * Message considered as <b>delivered</b> to a participant, if Twilio has received confirmation of message
14
- * delivery from the upstream carrier, and, where available, the destination handset.
15
- * </li><li>
16
- * Message considered as <b>undelivered</b> to a participant, if Twilio has received a delivery receipt
17
- * indicating that the message was not delivered. This can happen for many reasons including carrier content
18
- * filtering and the availability of the destination handset.
19
- * </li><li>
20
- * Message considered as <b>read</b> by a participant, if the message has been delivered and opened by the
21
- * recipient in the conversation. The recipient must have enabled read receipts.
22
- * </li><li>
23
- * Message considered as <b>failed</b> to be delivered to a participant if the message could not be sent.
24
- * This can happen for various reasons including queue overflows, account suspensions and media
25
- * errors (in the case of MMS for instance).
26
- *</li></ul>
27
- *
28
- * {@link AggregatedDeliveryReceipt} class contains aggregated value {@link AggregatedDeliveryReceipt#DeliveryAmount} for each delivery status.
29
- *
30
- * @property {number} total - Maximum number of delivery events expected for the message
31
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} sent - Amount of participants that have <b>sent</b> delivery status for the message.
32
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} delivered - Amount of participants that have <b>delivered</b> delivery status
33
- * for the message.
34
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} read - Amount of participants that have <b>read</b> delivery status for the message.
35
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} undelivered - Amount of participants that have <b>undelivered</b> delivery status
36
- * for the message.
37
- * @property {AggregatedDeliveryReceipt#DeliveryAmount} failed - Amount of participants that have <b>failed</b> delivery status for the message.
38
- */
39
- class AggregatedDeliveryReceipt {
40
- /**
41
- * Signifies amount of participants which have the status for the message.
42
- * @typedef {('none'|'some'|'all')} AggregatedDeliveryReceipt#DeliveryAmount
43
- */
44
- constructor(data) {
45
- this.state = data;
46
- }
47
- /**
48
- * @return Maximum number of delivery events expected for the message.
49
- */
50
- get total() {
51
- return this.state.total;
52
- }
53
- /**
54
- * Message considered as <b>sent</b> to a participant, if the nearest upstream carrier accepted the message.
55
- *
56
- * @return {@link DeliveryAmount} of participants that have <b>sent</b> delivery status for the message.
57
- */
58
- get sent() {
59
- return this.state.sent;
60
- }
61
- /**
62
- * Message considered as <b>delivered</b> to a participant, if Twilio has received confirmation of message
63
- * delivery from the upstream carrier, and, where available, the destination handset.
64
- *
65
- * @return {@link DeliveryAmount} of participants that have <b>delivered</b> delivery status for the message.
66
- */
67
- get delivered() {
68
- return this.state.delivered;
69
- }
70
- /**
71
- * Message considered as <b>read</b> by a participant, if the message has been delivered and opened by the
72
- * recipient in the conversation. The recipient must have enabled read receipts.
73
- *
74
- * @return {@link DeliveryAmount} of participants that have <b>read</b> delivery status for the message.
75
- */
76
- get read() {
77
- return this.state.read;
78
- }
79
- /**
80
- * Message considered as <b>undelivered</b> to a participant, if Twilio has received a delivery receipt
81
- * indicating that the message was not delivered. This can happen for many reasons including carrier content
82
- * filtering and the availability of the destination handset.
83
- *
84
- * @return {@link DeliveryAmount} of participants that have <b>undelivered</b> delivery status for the message.
85
- */
86
- get undelivered() {
87
- return this.state.undelivered;
88
- }
89
- /**
90
- * Message considered as <b>failed</b> to be delivered to a participant if the message could not be sent.
91
- * This can happen for various reasons including queue overflows, account suspensions and media
92
- * errors (in the case of MMS for instance). Twilio does not charge you for failed messages.
93
- *
94
- * @return {@link DeliveryAmount} of participants that have <b>failed</b> delivery status for the message.
95
- */
96
- get failed() {
97
- return this.state.failed;
98
- }
99
- _update(data) {
100
- this.state = data;
101
- }
102
- _isEquals(data) {
103
- const isTotalSame = this.total === data.total;
104
- const isSentSame = this.sent === data.sent;
105
- const isDeliveredSame = this.delivered === data.delivered;
106
- const isReadSame = this.read === data.read;
107
- const isUndeliveredSame = this.undelivered === data.undelivered;
108
- const isFailedSame = this.failed === data.failed;
109
- return isTotalSame && isSentSame && isDeliveredSame && isReadSame && isUndeliveredSame && isFailedSame;
110
- }
111
- }
112
- exports.AggregatedDeliveryReceipt = AggregatedDeliveryReceipt;
package/lib/client.d.ts DELETED
@@ -1,317 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import { User } from './user';
4
- import { Transport } from './interfaces/transport';
5
- import { Twilsock as TwilsockClient } from 'twilsock';
6
- import { ChannelType, ConnectionState as NotificationConnectionState, Notifications as NotificationClient } from 'twilio-notifications';
7
- import { SyncClient } from 'twilio-sync';
8
- import { Conversation } from './data/conversations';
9
- import { Paginator } from './interfaces/paginator';
10
- import { PushNotification } from './pushnotification';
11
- declare namespace Client {
12
- type ConnectionState = NotificationConnectionState;
13
- type NotificationsChannelType = ChannelType;
14
- type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent' | null;
15
- interface Options {
16
- region?: string;
17
- logLevel?: Client.LogLevel;
18
- productId?: string;
19
- twilsockClient?: TwilsockClient;
20
- transport?: Transport;
21
- notificationsClient?: NotificationClient;
22
- syncClient?: SyncClient;
23
- typingIndicatorTimeoutOverride?: number;
24
- consumptionReportIntervalOverride?: string;
25
- httpCacheIntervalOverride?: string;
26
- userInfosToSubscribeOverride?: number;
27
- retryWhenThrottledOverride?: boolean;
28
- backoffConfigOverride?: any;
29
- Chat?: any;
30
- Sync?: any;
31
- Notification?: any;
32
- Twilsock?: any;
33
- clientMetadata?: any;
34
- }
35
- interface CreateConversationOptions {
36
- attributes?: any;
37
- friendlyName?: string;
38
- uniqueName?: string;
39
- }
40
- }
41
- /**
42
- * A Client is a starting point to access Twilio Conversations functionality.
43
- *
44
- * @property {Client#ConnectionState} connectionState - Client connection state
45
- * @property {Boolean} reachabilityEnabled - Client reachability state
46
- * @property {User} user - Information for logged in user
47
- * @property {String} version - Current version of Conversations client
48
- *
49
- * @fires Client#connectionError
50
- * @fires Client#connectionStateChanged
51
- * @fires Client#conversationAdded
52
- * @fires Client#conversationJoined
53
- * @fires Client#conversationLeft
54
- * @fires Client#conversationRemoved
55
- * @fires Client#conversationUpdated
56
- * @fires Client#participantJoined
57
- * @fires Client#participantLeft
58
- * @fires Client#participantUpdated
59
- * @fires Client#messageAdded
60
- * @fires Client#messageRemoved
61
- * @fires Client#messageUpdated
62
- * @fires Client#pushNotification
63
- * @fires Client#tokenAboutToExpire
64
- * @fires Client#tokenExpired
65
- * @fires Client#typingEnded
66
- * @fires Client#typingStarted
67
- * @fires Client#userSubscribed
68
- * @fires Client#userUnsubscribed
69
- * @fires Client#userUpdated
70
- */
71
- declare class Client extends EventEmitter {
72
- connectionState: Client.ConnectionState;
73
- private sessionPromise;
74
- private conversationsPromise;
75
- private fpaToken;
76
- private config;
77
- private conversations;
78
- private options;
79
- private services;
80
- static readonly version: string;
81
- readonly version: string;
82
- private static readonly supportedPushChannels;
83
- private static readonly supportedPushDataFields;
84
- /**
85
- * These options can be passed to Client constructor.
86
- * @typedef {Object} Client#ClientOptions
87
- * @property {String} [logLevel='error'] - The level of logging to enable. Valid options
88
- * (from strictest to broadest): ['silent', 'error', 'warn', 'info', 'debug', 'trace']
89
- */
90
- /**
91
- * These options can be passed to {@link Client#createConversation}.
92
- * @typedef {Object} Client#CreateConversationOptions
93
- * @property {any} [attributes] - Any custom attributes to attach to the Conversation
94
- * @property {String} [friendlyName] - The non-unique display name of the Conversation
95
- * @property {String} [uniqueName] - The unique identifier of the Conversation
96
- */
97
- /**
98
- * Connection state of Client.
99
- * @typedef {('connecting'|'connected'|'disconnecting'|'disconnected'|'denied')} Client#ConnectionState
100
- */
101
- /**
102
- * Notifications channel type.
103
- * @typedef {('fcm'|'apn')} Client#NotificationsChannelType
104
- */
105
- private constructor();
106
- /**
107
- * Factory method to create Conversations client instance.
108
- *
109
- * @param {String} token - Access token
110
- * @param {Client#ClientOptions} [options] - Options to customize the Client
111
- * @returns {Promise<Client>}
112
- */
113
- static create(token: string, options?: Client.Options): Promise<Client>;
114
- get user(): User;
115
- get reachabilityEnabled(): boolean;
116
- get token(): string;
117
- private subscribeToPushNotifications;
118
- private unsubscribeFromPushNotifications;
119
- private initialize;
120
- /**
121
- * Gracefully shutting down library instance.
122
- * @public
123
- * @returns {Promise<void>}
124
- */
125
- shutdown(): Promise<void>;
126
- /**
127
- * Update the token used by the Client and re-register with Conversations services.
128
- * @param {String} token - Access token
129
- * @public
130
- * @returns {Promise<Client>}
131
- */
132
- updateToken(token: string): Promise<Client>;
133
- /**
134
- * Get a known Conversation by its SID.
135
- * @param {String} conversationSid - Conversation sid
136
- * @returns {Promise<Conversation>}
137
- */
138
- getConversationBySid(conversationSid: string): Promise<Conversation>;
139
- /**
140
- * Get a known Conversation by its unique identifier name.
141
- * @param {String} uniqueName - The unique identifier name of the Conversation to get
142
- * @returns {Promise<Conversation>}
143
- */
144
- getConversationByUniqueName(uniqueName: string): Promise<Conversation>;
145
- /**
146
- * Get the current list of all subscribed Conversations.
147
- * @returns {Promise<Paginator<Conversation>>}
148
- */
149
- getSubscribedConversations(args?: any): Promise<Paginator<Conversation>>;
150
- /**
151
- * Create a Conversation on the server and subscribe to its events.
152
- * The default is a Conversation with an empty friendlyName.
153
- * @param {Client#CreateConversationOptions} [options] - Options for the Conversation
154
- * @returns {Promise<Conversation>}
155
- */
156
- createConversation(options?: Client.CreateConversationOptions): Promise<Conversation>;
157
- /**
158
- * Registers for push notifications.
159
- * @param {Client#NotificationsChannelType} channelType - 'apn' and 'fcm' are supported
160
- * @param {string} registrationId - Push notification id provided by the platform
161
- * @returns {Promise<void>}
162
- */
163
- setPushRegistrationId(channelType: Client.NotificationsChannelType, registrationId: string): Promise<void>;
164
- /**
165
- * Unregisters from push notifications.
166
- * @param {Client#NotificationsChannelType} channelType - 'apn' and 'fcm' are supported
167
- * @returns {Promise<void>}
168
- */
169
- unsetPushRegistrationId(channelType: Client.NotificationsChannelType): Promise<void>;
170
- private static parsePushNotificationChatData;
171
- /**
172
- * Static method for push notification payload parsing. Returns parsed push as {@link PushNotification} object
173
- * @param {Object} notificationPayload - Push notification payload
174
- * @returns {PushNotification|Error}
175
- */
176
- static parsePushNotification(notificationPayload: any): PushNotification;
177
- parsePushNotification: typeof Client.parsePushNotification;
178
- /**
179
- * Handle push notification payload parsing and emits event {@link Client#event:pushNotification} on this {@link Client} instance.
180
- * @param {Object} notificationPayload - Push notification payload
181
- * @returns {Promise<void>}
182
- */
183
- handlePushNotification(notificationPayload: any): Promise<void>;
184
- /**
185
- * Gets user for given identity, if it's in subscribed list - then return the user object from it,
186
- * if not - then subscribes and adds user to the subscribed list.
187
- * @param {String} identity - Identity of User
188
- * @returns {Promise<User>} Fully initialized user
189
- */
190
- getUser(identity: string): Promise<User>;
191
- /**
192
- * @returns {Promise<Array<User>>} List of subscribed User objects
193
- */
194
- getSubscribedUsers(): Promise<Array<User>>;
195
- }
196
- export { User, Client, PushNotification };
197
- export default Client;
198
- /**
199
- * Fired when a Conversation becomes visible to the Client. The event is also triggered when the client creates a new Conversation.
200
- * Fired for all conversations Client has joined.
201
- * @event Client#conversationAdded
202
- * @type {Conversation}
203
- */
204
- /**
205
- * Fired when the Client joins a Conversation.
206
- * @event Client#conversationJoined
207
- * @type {Conversation}
208
- */
209
- /**
210
- * Fired when the Client leaves a Conversation.
211
- * @event Client#conversationLeft
212
- * @type {Conversation}
213
- */
214
- /**
215
- * Fired when a Conversation is no longer visible to the Client.
216
- * @event Client#conversationRemoved
217
- * @type {Conversation}
218
- */
219
- /**
220
- * Fired when a Conversation's attributes or metadata have been updated.
221
- * During Conversation's {@link Client.create| creation and initialization} this event might be fired multiple times
222
- * for same joined or created Conversation as new data is arriving from different sources.
223
- * @event Client#conversationUpdated
224
- * @type {Object}
225
- * @property {Conversation} conversation - Updated Conversation
226
- * @property {Conversation#UpdateReason[]} updateReasons - Array of Conversation's updated event reasons
227
- */
228
- /**
229
- * Fired when Client's connection state has been changed.
230
- * @event Client#connectionStateChanged
231
- * @type {Client#ConnectionState}
232
- */
233
- /**
234
- * Fired when a Participant has joined the Conversation.
235
- * @event Client#participantJoined
236
- * @type {Participant}
237
- */
238
- /**
239
- * Fired when a Participant has left the Conversation.
240
- * @event Client#participantLeft
241
- * @type {Participant}
242
- */
243
- /**
244
- * Fired when a Participant's fields has been updated.
245
- * @event Client#participantUpdated
246
- * @type {Object}
247
- * @property {Participant} participant - Updated Participant
248
- * @property {Participant#UpdateReason[]} updateReasons - Array of Participant's updated event reasons
249
- */
250
- /**
251
- * Fired when a new Message has been added to the Conversation on the server.
252
- * @event Client#messageAdded
253
- * @type {Message}
254
- */
255
- /**
256
- * Fired when Message is removed from Conversation's message list.
257
- * @event Client#messageRemoved
258
- * @type {Message}
259
- */
260
- /**
261
- * Fired when an existing Message's fields are updated with new values.
262
- * @event Client#messageUpdated
263
- * @type {Object}
264
- * @property {Message} message - Updated Message
265
- * @property {Message#UpdateReason[]} updateReasons - Array of Message's updated event reasons
266
- */
267
- /**
268
- * Fired when token is about to expire and needs to be updated.
269
- * @event Client#tokenAboutToExpire
270
- * @type {void}
271
- */
272
- /**
273
- * Fired when token is expired.
274
- * @event Client#tokenExpired
275
- * @type {void}
276
- */
277
- /**
278
- * Fired when a Participant has stopped typing.
279
- * @event Client#typingEnded
280
- * @type {Participant}
281
- */
282
- /**
283
- * Fired when a Participant has started typing.
284
- * @event Client#typingStarted
285
- * @type {Participant}
286
- */
287
- /**
288
- * Fired when client received (and parsed) push notification via one of push channels (apn or fcm).
289
- * @event Client#pushNotification
290
- * @type {PushNotification}
291
- */
292
- /**
293
- * Fired when the Client is subscribed to a User.
294
- * @event Client#userSubscribed
295
- * @type {User}
296
- */
297
- /**
298
- * Fired when the Client is unsubscribed from a User.
299
- * @event Client#userUnsubscribed
300
- * @type {User}
301
- */
302
- /**
303
- * Fired when the User's properties or reachability status have been updated.
304
- * @event Client#userUpdated
305
- * @type {Object}
306
- * @property {User} user - Updated User
307
- * @property {User#UpdateReason[]} updateReasons - Array of User's updated event reasons
308
- */
309
- /**
310
- * Fired when connection is interrupted by unexpected reason
311
- * @event Client#connectionError
312
- * @type {Object}
313
- * @property {Boolean} terminal - twilsock will stop connection attempts
314
- * @property {String} message - root cause
315
- * @property {Number} [httpStatusCode] - http status code if available
316
- * @property {Number} [errorCode] - Twilio public error code if available
317
- */