@twilio/conversations 1.3.0-rc8 → 2.0.0-rc.4

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 +210 -0
  2. package/README.md +22 -17
  3. package/dist/browser.js +7873 -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 +3394 -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 +3170 -0
  33. package/dist/docs/modules.html +3425 -0
  34. package/dist/lib.d.ts +1952 -0
  35. package/dist/lib.js +7873 -0
  36. package/dist/lib.js.map +1 -0
  37. package/dist/post-install.js +29 -0
  38. package/dist/react-native.js +4038 -0
  39. package/dist/react-native.js.map +1 -0
  40. package/dist/twilio-conversations.js +40912 -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 -632
  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 -35533
  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 -296
  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,415 +0,0 @@
1
- "use strict";
2
-
3
- var _promise = require("babel-runtime/core-js/promise");
4
-
5
- var _promise2 = _interopRequireDefault(_promise);
6
-
7
- var _stringify = require("babel-runtime/core-js/json/stringify");
8
-
9
- var _stringify2 = _interopRequireDefault(_stringify);
10
-
11
- var _regenerator = require("babel-runtime/regenerator");
12
-
13
- var _regenerator2 = _interopRequireDefault(_regenerator);
14
-
15
- var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
16
-
17
- var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
18
-
19
- var _isInteger = require("babel-runtime/core-js/number/is-integer");
20
-
21
- var _isInteger2 = _interopRequireDefault(_isInteger);
22
-
23
- var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
24
-
25
- var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
26
-
27
- var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
28
-
29
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
30
-
31
- var _createClass2 = require("babel-runtime/helpers/createClass");
32
-
33
- var _createClass3 = _interopRequireDefault(_createClass2);
34
-
35
- var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
36
-
37
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
38
-
39
- var _inherits2 = require("babel-runtime/helpers/inherits");
40
-
41
- var _inherits3 = _interopRequireDefault(_inherits2);
42
-
43
- var _metadata = require("babel-runtime/core-js/reflect/metadata");
44
-
45
- var _metadata2 = _interopRequireDefault(_metadata);
46
-
47
- var _defineProperty = require("babel-runtime/core-js/object/define-property");
48
-
49
- var _defineProperty2 = _interopRequireDefault(_defineProperty);
50
-
51
- var _typeof2 = require("babel-runtime/helpers/typeof");
52
-
53
- var _typeof3 = _interopRequireDefault(_typeof2);
54
-
55
- var _getOwnPropertyDescriptor = require("babel-runtime/core-js/object/get-own-property-descriptor");
56
-
57
- var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
58
-
59
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
60
-
61
- var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
62
- var c = arguments.length,
63
- r = c < 3 ? target : desc === null ? desc = (0, _getOwnPropertyDescriptor2.default)(target, key) : desc,
64
- d;
65
- if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof3.default)(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
66
- if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
67
- }return c > 3 && r && (0, _defineProperty2.default)(target, key, r), r;
68
- };
69
- var __metadata = undefined && undefined.__metadata || function (k, v) {
70
- if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof3.default)(Reflect)) === "object" && typeof _metadata2.default === "function") return (0, _metadata2.default)(k, v);
71
- };
72
- Object.defineProperty(exports, "__esModule", { value: true });
73
- var events_1 = require("events");
74
- var util_1 = require("./util");
75
- var logger_1 = require("./logger");
76
- var twilio_sdk_type_validator_1 = require("twilio-sdk-type-validator");
77
- var log = logger_1.Logger.scope('Participant');
78
- /**
79
- * @classdesc A Participant represents a remote Client in a Conversation.
80
- * @property {any} attributes - Object with custom attributes for Participant
81
- * @property {Conversation} conversation - The Conversation the remote Client is a Participant of
82
- * @property {Date} dateCreated - The Date this Participant was created
83
- * @property {Date} dateUpdated - The Date this Participant was last updated
84
- * @property {String} identity - The identity of the remote Client
85
- * @property {Boolean} isTyping - Whether or not this Participant is currently typing
86
- * @property {Number|null} lastReadMessageIndex - Latest read Message index by this Participant.
87
- * Note that just retrieving messages on a client endpoint does not mean that messages are read,
88
- * please consider reading about [Read Horizon feature]{@link https://www.twilio.com/docs/api/chat/guides/consumption-horizon}
89
- * to find out how to mark messages as read.
90
- * @property {Date} lastReadTimestamp - Date when Participant has updated his read horizon
91
- * @property {String} sid - The server-assigned unique identifier for the Participant
92
- * @property {Participant#Type} type - The type of Participant
93
- * @fires Participant#typingEnded
94
- * @fires Participant#typingStarted
95
- * @fires Participant#updated
96
- */
97
-
98
- var Participant = function (_events_1$EventEmitte) {
99
- (0, _inherits3.default)(Participant, _events_1$EventEmitte);
100
-
101
- /**
102
- * The update reason for <code>updated</code> event emitted on Participant
103
- * @typedef {('attributes' | 'dateCreated' | 'dateUpdated' | 'roleSid' |
104
- 'lastReadMessageIndex' | 'lastReadTimestamp' | 'bindings')} Participant#UpdateReason
105
- */
106
- /**
107
- * The type of Participant
108
- * @typedef {('chat' | 'sms' | 'whatsapp' | 'email')} Participant#Type
109
- */
110
- function Participant(services, conversation, data, sid) {
111
- (0, _classCallCheck3.default)(this, Participant);
112
-
113
- var _a;
114
-
115
- var _this = (0, _possibleConstructorReturn3.default)(this, (Participant.__proto__ || (0, _getPrototypeOf2.default)(Participant)).call(this));
116
-
117
- _this.conversation = conversation;
118
- _this.services = services;
119
- _this.state = {
120
- attributes: util_1.parseAttributes(data.attributes, 'Retrieved malformed attributes from the server for participant: ' + sid, log),
121
- dateCreated: data.dateCreated ? util_1.parseTime(data.dateCreated) : null,
122
- dateUpdated: data.dateCreated ? util_1.parseTime(data.dateUpdated) : null,
123
- sid: sid,
124
- typingTimeout: null,
125
- isTyping: false,
126
- identity: data.identity || null,
127
- roleSid: data.roleSid || null,
128
- lastReadMessageIndex: (0, _isInteger2.default)(data.lastConsumedMessageIndex) ? data.lastConsumedMessageIndex : null,
129
- lastReadTimestamp: data.lastConsumptionTimestamp ? util_1.parseTime(data.lastConsumptionTimestamp) : null,
130
- type: data.type || 'chat',
131
- userInfo: data.userInfo,
132
- bindings: (_a = data.bindings, _a !== null && _a !== void 0 ? _a : {})
133
- };
134
- if (!data.identity && !data.type) {
135
- throw new Error('Received invalid Participant object from server: Missing identity or type of Participant.');
136
- }
137
- return _this;
138
- }
139
-
140
- (0, _createClass3.default)(Participant, [{
141
- key: "_startTyping",
142
-
143
- /**
144
- * Private method used to start or reset the typing indicator timeout (with event emitting)
145
- * @private
146
- */
147
- value: function _startTyping(timeout) {
148
- var _this2 = this;
149
-
150
- clearTimeout(this.state.typingTimeout);
151
- this.state.isTyping = true;
152
- this.emit('typingStarted', this);
153
- this.conversation.emit('typingStarted', this);
154
- this.state.typingTimeout = setTimeout(function () {
155
- return _this2._endTyping();
156
- }, timeout);
157
- return this;
158
- }
159
- /**
160
- * Private method function used to stop typing indicator (with event emitting)
161
- * @private
162
- */
163
-
164
- }, {
165
- key: "_endTyping",
166
- value: function _endTyping() {
167
- if (!this.state.typingTimeout) {
168
- return;
169
- }
170
- this.state.isTyping = false;
171
- this.emit('typingEnded', this);
172
- this.conversation.emit('typingEnded', this);
173
- clearInterval(this.state.typingTimeout);
174
- this.state.typingTimeout = null;
175
- }
176
- /**
177
- * Private method function used update local object's property roleSid with new value
178
- * @private
179
- */
180
-
181
- }, {
182
- key: "_update",
183
- value: function _update(data) {
184
- var updateReasons = [];
185
- var updateAttributes = util_1.parseAttributes(data.attributes, 'Retrieved malformed attributes from the server for participant: ' + this.state.sid, log);
186
- if (data.attributes && !util_1.isDeepEqual(this.state.attributes, updateAttributes)) {
187
- this.state.attributes = updateAttributes;
188
- updateReasons.push('attributes');
189
- }
190
- var updatedDateUpdated = util_1.parseTime(data.dateUpdated);
191
- if (data.dateUpdated && updatedDateUpdated.getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
192
- this.state.dateUpdated = updatedDateUpdated;
193
- updateReasons.push('dateUpdated');
194
- }
195
- var updatedDateCreated = util_1.parseTime(data.dateCreated);
196
- if (data.dateCreated && updatedDateCreated.getTime() !== (this.state.dateCreated && this.state.dateCreated.getTime())) {
197
- this.state.dateCreated = updatedDateCreated;
198
- updateReasons.push('dateCreated');
199
- }
200
- if (data.roleSid && this.state.roleSid !== data.roleSid) {
201
- this.state.roleSid = data.roleSid;
202
- updateReasons.push('roleSid');
203
- }
204
- if (((0, _isInteger2.default)(data.lastConsumedMessageIndex) || data.lastConsumedMessageIndex === null) && this.state.lastReadMessageIndex !== data.lastConsumedMessageIndex) {
205
- this.state.lastReadMessageIndex = data.lastConsumedMessageIndex;
206
- updateReasons.push('lastReadMessageIndex');
207
- }
208
- if (data.lastConsumptionTimestamp) {
209
- var lastReadTimestamp = new Date(data.lastConsumptionTimestamp);
210
- if (!this.state.lastReadTimestamp || this.state.lastReadTimestamp.getTime() !== lastReadTimestamp.getTime()) {
211
- this.state.lastReadTimestamp = lastReadTimestamp;
212
- updateReasons.push('lastReadTimestamp');
213
- }
214
- }
215
- if (data.bindings && !util_1.isDeepEqual(this.state.bindings, data.bindings)) {
216
- this.state.bindings = data.bindings;
217
- updateReasons.push('bindings');
218
- }
219
- if (updateReasons.length > 0) {
220
- this.emit('updated', { participant: this, updateReasons: updateReasons });
221
- }
222
- return this;
223
- }
224
- /**
225
- * Gets User for this participant and subscribes to it. Supported only for <code>chat</code> type of Participants
226
- * @returns {Promise<User>}
227
- */
228
-
229
- }, {
230
- key: "getUser",
231
- value: function () {
232
- var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
233
- return _regenerator2.default.wrap(function _callee$(_context) {
234
- while (1) {
235
- switch (_context.prev = _context.next) {
236
- case 0:
237
- if (!(this.type != 'chat')) {
238
- _context.next = 2;
239
- break;
240
- }
241
-
242
- throw new Error('Getting User is not supported for this Participant type: ' + this.type);
243
-
244
- case 2:
245
- return _context.abrupt("return", this.services.users.getUser(this.state.identity, this.state.userInfo));
246
-
247
- case 3:
248
- case "end":
249
- return _context.stop();
250
- }
251
- }
252
- }, _callee, this);
253
- }));
254
-
255
- function getUser() {
256
- return _ref.apply(this, arguments);
257
- }
258
-
259
- return getUser;
260
- }()
261
- /**
262
- * Remove Participant from the Conversation.
263
- * @returns {Promise<void>}
264
- */
265
-
266
- }, {
267
- key: "remove",
268
- value: function () {
269
- var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
270
- return _regenerator2.default.wrap(function _callee2$(_context2) {
271
- while (1) {
272
- switch (_context2.prev = _context2.next) {
273
- case 0:
274
- return _context2.abrupt("return", this.conversation.removeParticipant(this));
275
-
276
- case 1:
277
- case "end":
278
- return _context2.stop();
279
- }
280
- }
281
- }, _callee2, this);
282
- }));
283
-
284
- function remove() {
285
- return _ref2.apply(this, arguments);
286
- }
287
-
288
- return remove;
289
- }()
290
- /**
291
- * Edit participant attributes.
292
- * @param {any} attributes new attributes for Participant.
293
- * @returns {Promise<Participant>}
294
- */
295
-
296
- }, {
297
- key: "updateAttributes",
298
- value: function () {
299
- var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(attributes) {
300
- return _regenerator2.default.wrap(function _callee3$(_context3) {
301
- while (1) {
302
- switch (_context3.prev = _context3.next) {
303
- case 0:
304
- _context3.next = 2;
305
- return this.services.session.addCommand('editMemberAttributes', {
306
- channelSid: this.conversation.sid,
307
- memberSid: this.sid,
308
- attributes: (0, _stringify2.default)(attributes)
309
- });
310
-
311
- case 2:
312
- return _context3.abrupt("return", this);
313
-
314
- case 3:
315
- case "end":
316
- return _context3.stop();
317
- }
318
- }
319
- }, _callee3, this);
320
- }));
321
-
322
- function updateAttributes(_x) {
323
- return _ref3.apply(this, arguments);
324
- }
325
-
326
- return updateAttributes;
327
- }()
328
- }, {
329
- key: "sid",
330
- get: function get() {
331
- return this.state.sid;
332
- }
333
- }, {
334
- key: "attributes",
335
- get: function get() {
336
- return this.state.attributes;
337
- }
338
- }, {
339
- key: "dateCreated",
340
- get: function get() {
341
- return this.state.dateCreated;
342
- }
343
- }, {
344
- key: "dateUpdated",
345
- get: function get() {
346
- return this.state.dateUpdated;
347
- }
348
- }, {
349
- key: "identity",
350
- get: function get() {
351
- return this.state.identity;
352
- }
353
- }, {
354
- key: "isTyping",
355
- get: function get() {
356
- return this.state.isTyping;
357
- }
358
- }, {
359
- key: "lastReadMessageIndex",
360
- get: function get() {
361
- return this.state.lastReadMessageIndex;
362
- }
363
- }, {
364
- key: "lastReadTimestamp",
365
- get: function get() {
366
- return this.state.lastReadTimestamp;
367
- }
368
- }, {
369
- key: "roleSid",
370
- get: function get() {
371
- return this.state.roleSid;
372
- }
373
- }, {
374
- key: "type",
375
- get: function get() {
376
- return this.state.type;
377
- }
378
- /**
379
- * Get the bindings mapping for the current participant.
380
- * Available binding depends on the participant type.
381
- * You could access it as `participant.bindings.sms?.address` or
382
- * using the type dynamically `participant.bindings[participant.type]`
383
- * just be aware that the binding information has different structure for
384
- * each participant type.
385
- * See also {EmailBinding}, the only available binding descriptor available currently.
386
- */
387
-
388
- }, {
389
- key: "bindings",
390
- get: function get() {
391
- return this.state.bindings;
392
- }
393
- }]);
394
- return Participant;
395
- }(events_1.EventEmitter);
396
-
397
- __decorate([twilio_sdk_type_validator_1.validateTypesAsync(['string', 'number', 'boolean', 'object', twilio_sdk_type_validator_1.literal(null)]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", _promise2.default)], Participant.prototype, "updateAttributes", null);
398
- exports.Participant = Participant;
399
- /**
400
- * Fired when Participant started to type.
401
- * @event Participant#typingStarted
402
- * @type {Participant}
403
- */
404
- /**
405
- * Fired when Participant ended to type.
406
- * @event Participant#typingEnded
407
- * @type {Participant}
408
- */
409
- /**
410
- * Fired when Participant's fields has been updated.
411
- * @event Participant#updated
412
- * @type {Object}
413
- * @property {Participant} participant - Updated Participant
414
- * @property {Participant#UpdateReason[]} updateReasons - Array of Participant's updated event reasons
415
- */
@@ -1,49 +0,0 @@
1
- 'use strict';
2
-
3
- var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
4
-
5
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
6
-
7
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
-
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- /**
11
- * @classdesc Push notification representation within Conversations Client
12
- * @property {String} [action] - Notification action (`click_action` in FCM/GCM terms and `category` in APN terms)
13
- * @property {Number} [badge] - Number for the badge
14
- * @property {String} body - Notification text
15
- * @property {PushNotification#ConversationData} data - Additional Conversation data
16
- * @property {String} [sound] - Notification sound
17
- * @property {String} [title] - Notification title
18
- * @property {PushNotification#NotificationType} type - Notification type
19
- */
20
-
21
- var PushNotification =
22
- /**
23
- * Conversation push notification type
24
- * @typedef {('twilio.conversations.new_message' | 'twilio.conversations.added_to_conversation'
25
- | 'twilio.conversations.removed_from_conversation')} PushNotification#NotificationType
26
- */
27
- /**
28
- * Additional Conversations data for given Push Notification
29
- * @typedef {Object} PushNotification#ConversationData
30
- * @property {String} [conversationSid] - SID of Conversation
31
- * @property {Number} [messageIndex] - Index of Message in Conversation
32
- * @property {String} [messageSid] - SID of Message
33
- */
34
- /**
35
- * @param {PushNotification.Descriptor} data - initial data for PushNotification
36
- */
37
- function PushNotification(data) {
38
- (0, _classCallCheck3.default)(this, PushNotification);
39
-
40
- this.title = data.title || null;
41
- this.body = data.body || null;
42
- this.sound = data.sound || null;
43
- this.badge = data.badge || null;
44
- this.action = data.action || null;
45
- this.type = data.type || null;
46
- this.data = data.data || {};
47
- };
48
-
49
- exports.PushNotification = PushNotification;
@@ -1,74 +0,0 @@
1
- 'use strict';
2
-
3
- var _promise = require('babel-runtime/core-js/promise');
4
-
5
- var _promise2 = _interopRequireDefault(_promise);
6
-
7
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
8
-
9
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
10
-
11
- var _createClass2 = require('babel-runtime/helpers/createClass');
12
-
13
- var _createClass3 = _interopRequireDefault(_createClass2);
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- /**
19
- * @class Paginator
20
- * @classdesc Pagination helper class
21
- *
22
- * @property {Array} items Array of elements on current page
23
- * @property {boolean} hasNextPage Indicates the existence of next page
24
- * @property {boolean} hasPrevPage Indicates the existence of previous page
25
- */
26
-
27
- var RestPaginator = function () {
28
- /*
29
- * @constructor
30
- * @param {Array} items Array of element for current page
31
- * @param {Object} params
32
- * @private
33
- */
34
- function RestPaginator(items, source, prevToken, nextToken) {
35
- (0, _classCallCheck3.default)(this, RestPaginator);
36
-
37
- this.state = {
38
- prevToken: prevToken,
39
- nextToken: nextToken,
40
- source: source,
41
- items: items
42
- };
43
- }
44
-
45
- (0, _createClass3.default)(RestPaginator, [{
46
- key: 'nextPage',
47
- value: function nextPage() {
48
- return this.hasNextPage ? this.state.source(this.state.nextToken) : _promise2.default.reject(new Error('No next page'));
49
- }
50
- }, {
51
- key: 'prevPage',
52
- value: function prevPage() {
53
- return this.hasPrevPage ? this.state.source(this.state.prevToken) : _promise2.default.reject(new Error('No previous page'));
54
- }
55
- }, {
56
- key: 'hasNextPage',
57
- get: function get() {
58
- return !!this.state.nextToken;
59
- }
60
- }, {
61
- key: 'hasPrevPage',
62
- get: function get() {
63
- return !!this.state.prevToken;
64
- }
65
- }, {
66
- key: 'items',
67
- get: function get() {
68
- return this.state.items;
69
- }
70
- }]);
71
- return RestPaginator;
72
- }();
73
-
74
- exports.RestPaginator = RestPaginator;