box-ui-elements 16.0.0-beta.8 → 16.0.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 (798) hide show
  1. package/dist/explorer.css +1 -1
  2. package/dist/explorer.js +19 -58
  3. package/dist/openwith.css +1 -1
  4. package/dist/openwith.js +10 -10
  5. package/dist/picker.css +1 -1
  6. package/dist/picker.js +12 -12
  7. package/dist/preview.css +1 -1
  8. package/dist/preview.js +17 -56
  9. package/dist/sharing.css +1 -1
  10. package/dist/sharing.js +34 -34
  11. package/dist/sidebar.css +1 -1
  12. package/dist/sidebar.js +17 -56
  13. package/dist/uploader.css +1 -1
  14. package/dist/uploader.js +12 -12
  15. package/es/api/APIFactory.js +27 -0
  16. package/es/api/APIFactory.js.flow +26 -0
  17. package/es/api/APIFactory.js.map +1 -1
  18. package/es/api/Annotations.js +180 -27
  19. package/es/api/Annotations.js.flow +150 -14
  20. package/es/api/Annotations.js.map +1 -1
  21. package/es/api/Comments.js +2 -2
  22. package/es/api/Comments.js.flow +5 -4
  23. package/es/api/Comments.js.map +1 -1
  24. package/es/api/Feed.js +578 -69
  25. package/es/api/Feed.js.flow +677 -17
  26. package/es/api/Feed.js.map +1 -1
  27. package/es/api/FileCollaborators.js +29 -0
  28. package/es/api/FileCollaborators.js.flow +30 -0
  29. package/es/api/FileCollaborators.js.map +1 -1
  30. package/es/api/ThreadedComments.js +64 -27
  31. package/es/api/ThreadedComments.js.flow +54 -29
  32. package/es/api/ThreadedComments.js.map +1 -1
  33. package/es/api/fixtures.js +381 -0
  34. package/es/api/fixtures.js.flow +401 -0
  35. package/es/api/fixtures.js.map +1 -0
  36. package/es/api/messages.js +4 -0
  37. package/es/api/messages.js.flow +5 -0
  38. package/es/api/messages.js.map +1 -1
  39. package/es/api/utils.js +33 -0
  40. package/es/api/utils.js.flow +30 -0
  41. package/es/api/utils.js.map +1 -0
  42. package/es/common/types/annotations.js.flow +18 -10
  43. package/es/common/types/feed.js +1 -1
  44. package/es/common/types/feed.js.flow +40 -4
  45. package/es/common/types/feed.js.map +1 -1
  46. package/es/components/accessible-svg/AccessibleSVG.stories.js +20 -0
  47. package/es/components/accessible-svg/AccessibleSVG.stories.js.map +1 -0
  48. package/es/components/badge/Badge.stories.js +1 -13
  49. package/es/components/badge/Badge.stories.js.map +1 -1
  50. package/es/components/badge/BetaBadge.stories.js +10 -0
  51. package/es/components/badge/BetaBadge.stories.js.map +1 -0
  52. package/es/components/badge/TrialBadge.stories.js +10 -0
  53. package/es/components/badge/TrialBadge.stories.js.map +1 -0
  54. package/es/components/badge/UpgradeBadge.stories.js +10 -0
  55. package/es/components/badge/UpgradeBadge.stories.js.map +1 -0
  56. package/es/components/breadcrumb/Breadcrumb.js +48 -35
  57. package/es/components/breadcrumb/Breadcrumb.js.flow +68 -42
  58. package/es/components/breadcrumb/Breadcrumb.js.map +1 -1
  59. package/es/components/breadcrumb/EllipsisCrumb.js +5 -3
  60. package/es/components/breadcrumb/EllipsisCrumb.js.flow +10 -6
  61. package/es/components/breadcrumb/EllipsisCrumb.js.map +1 -1
  62. package/es/components/count-badge/CountBadge.stories.js +1 -1
  63. package/es/components/count-badge/CountBadge.stories.js.map +1 -1
  64. package/es/components/draggable-list/DraggableList.stories.js +119 -5
  65. package/es/components/draggable-list/DraggableList.stories.js.map +1 -1
  66. package/es/components/dropdown-menu/DropdownMenu.js +9 -0
  67. package/es/components/dropdown-menu/DropdownMenu.js.flow +11 -0
  68. package/es/components/dropdown-menu/DropdownMenu.js.map +1 -1
  69. package/es/components/dropdown-menu/DropdownMenu.scss +3 -3
  70. package/es/components/infinite-scroll/InfiniteScroll.js +4 -2
  71. package/es/components/infinite-scroll/InfiniteScroll.js.map +1 -1
  72. package/es/components/modal/Modal.scss +5 -1
  73. package/es/components/search-form/SearchForm.js +1 -1
  74. package/es/components/search-form/SearchForm.js.flow +1 -1
  75. package/es/components/search-form/SearchForm.js.map +1 -1
  76. package/es/components/table/makeSelectable.js +304 -97
  77. package/es/components/table/makeSelectable.js.flow +299 -98
  78. package/es/components/table/makeSelectable.js.map +1 -1
  79. package/es/components/tooltip/Tooltip.js +3 -2
  80. package/es/components/tooltip/Tooltip.js.map +1 -1
  81. package/es/constants.js +11 -0
  82. package/es/constants.js.flow +11 -0
  83. package/es/constants.js.map +1 -1
  84. package/es/elements/common/annotator-context/index.js +1 -0
  85. package/es/elements/common/annotator-context/index.js.flow +4 -0
  86. package/es/elements/common/annotator-context/index.js.map +1 -1
  87. package/es/elements/common/annotator-context/types.js +12 -0
  88. package/es/elements/common/annotator-context/types.js.flow +77 -35
  89. package/es/elements/common/annotator-context/types.js.map +1 -1
  90. package/es/elements/common/annotator-context/useAnnotatorEvents.js +205 -0
  91. package/es/elements/common/annotator-context/useAnnotatorEvents.js.flow +52 -0
  92. package/es/elements/common/annotator-context/useAnnotatorEvents.js.map +1 -0
  93. package/es/elements/common/annotator-context/withAnnotations.js +224 -5
  94. package/es/elements/common/annotator-context/withAnnotations.js.flow +73 -36
  95. package/es/elements/common/annotator-context/withAnnotations.js.map +1 -1
  96. package/es/elements/common/annotator-context/withAnnotatorContext.js +12 -4
  97. package/es/elements/common/annotator-context/withAnnotatorContext.js.flow +29 -9
  98. package/es/elements/common/annotator-context/withAnnotatorContext.js.map +1 -1
  99. package/es/elements/common/current-user/index.js +3 -0
  100. package/es/elements/common/current-user/index.js.flow +8 -0
  101. package/es/elements/common/current-user/index.js.map +1 -0
  102. package/es/elements/common/current-user/withCurrentUser.js +139 -0
  103. package/es/elements/common/current-user/withCurrentUser.js.flow +40 -0
  104. package/es/elements/common/current-user/withCurrentUser.js.map +1 -0
  105. package/es/elements/common/flowTypes.js.flow +22 -4
  106. package/es/elements/common/flowTypes.js.map +1 -1
  107. package/es/elements/common/interactionTargets.js +2 -0
  108. package/es/elements/common/interactionTargets.js.flow +2 -0
  109. package/es/elements/common/interactionTargets.js.map +1 -1
  110. package/es/elements/common/logger/Logger.js +1 -1
  111. package/es/elements/common/logger/Logger.js.flow +1 -1
  112. package/es/elements/common/logger/Logger.js.map +1 -1
  113. package/es/elements/common/messages.js +4 -0
  114. package/es/elements/common/messages.js.flow +5 -0
  115. package/es/elements/common/messages.js.map +1 -1
  116. package/es/elements/content-explorer/DeleteConfirmationDialog.js +2 -1
  117. package/es/elements/content-explorer/DeleteConfirmationDialog.js.flow +3 -1
  118. package/es/elements/content-explorer/DeleteConfirmationDialog.js.map +1 -1
  119. package/es/elements/content-explorer/DeleteConfirmationDialog.scss +5 -0
  120. package/es/elements/content-explorer/stories/DeleteConfirmationDialog.stories.js +58 -0
  121. package/es/elements/content-explorer/stories/DeleteConfirmationDialog.stories.js.flow +60 -0
  122. package/es/elements/content-explorer/stories/DeleteConfirmationDialog.stories.js.map +1 -0
  123. package/es/elements/content-sidebar/ActivitySidebar.js +323 -197
  124. package/es/elements/content-sidebar/ActivitySidebar.js.flow +381 -154
  125. package/es/elements/content-sidebar/ActivitySidebar.js.map +1 -1
  126. package/es/elements/content-sidebar/ActivitySidebarFilter.js +52 -0
  127. package/es/elements/content-sidebar/ActivitySidebarFilter.js.flow +59 -0
  128. package/es/elements/content-sidebar/ActivitySidebarFilter.js.map +1 -0
  129. package/es/elements/content-sidebar/ActivitySidebarFilter.scss +4 -0
  130. package/es/elements/content-sidebar/DetailsSidebar.js +50 -25
  131. package/es/elements/content-sidebar/DetailsSidebar.js.flow +32 -4
  132. package/es/elements/content-sidebar/DetailsSidebar.js.map +1 -1
  133. package/es/elements/content-sidebar/Sidebar.js +4 -1
  134. package/es/elements/content-sidebar/Sidebar.js.flow +6 -1
  135. package/es/elements/content-sidebar/Sidebar.js.map +1 -1
  136. package/es/elements/content-sidebar/SidebarContentInsights.js +45 -0
  137. package/es/elements/content-sidebar/SidebarContentInsights.js.map +1 -0
  138. package/es/elements/content-sidebar/SidebarContentInsights.scss +6 -0
  139. package/es/elements/content-sidebar/SidebarPanels.js +2 -0
  140. package/es/elements/content-sidebar/SidebarPanels.js.flow +4 -0
  141. package/es/elements/content-sidebar/SidebarPanels.js.map +1 -1
  142. package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +91 -10
  143. package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js.flow +122 -24
  144. package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js.map +1 -1
  145. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js +27 -15
  146. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js.flow +59 -18
  147. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js.map +1 -1
  148. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js +101 -0
  149. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js.flow +126 -0
  150. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js.map +1 -0
  151. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.scss +17 -0
  152. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js +69 -0
  153. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js.flow +85 -0
  154. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js.map +1 -0
  155. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.scss +16 -0
  156. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js +62 -0
  157. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js.flow +59 -0
  158. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js.map +1 -0
  159. package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.scss +22 -0
  160. package/es/elements/content-sidebar/activity-feed/activity-feed/activityFeedUtils.js +2 -2
  161. package/es/elements/content-sidebar/activity-feed/activity-feed/activityFeedUtils.js.flow +2 -2
  162. package/es/elements/content-sidebar/activity-feed/activity-feed/activityFeedUtils.js.map +1 -1
  163. package/es/elements/content-sidebar/activity-feed/activity-feed/fixtures.js +55 -0
  164. package/es/elements/content-sidebar/activity-feed/activity-feed/fixtures.js.map +1 -0
  165. package/es/elements/content-sidebar/activity-feed/activity-feed/messages.js +16 -0
  166. package/es/elements/content-sidebar/activity-feed/activity-feed/messages.js.flow +20 -0
  167. package/es/elements/content-sidebar/activity-feed/activity-feed/messages.js.map +1 -1
  168. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js +121 -0
  169. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js.flow +117 -0
  170. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js.map +1 -0
  171. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.scss +7 -0
  172. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js +75 -0
  173. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js.flow +105 -0
  174. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js.map +1 -0
  175. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.scss +5 -0
  176. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js +77 -0
  177. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js.flow +86 -0
  178. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js.map +1 -0
  179. package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.scss +3 -0
  180. package/es/elements/content-sidebar/activity-feed/annotation-thread/errors.js +11 -0
  181. package/es/elements/content-sidebar/activity-feed/annotation-thread/errors.js.flow +26 -0
  182. package/es/elements/content-sidebar/activity-feed/annotation-thread/errors.js.map +1 -0
  183. package/es/elements/content-sidebar/activity-feed/annotation-thread/index.js +2 -0
  184. package/es/elements/content-sidebar/activity-feed/annotation-thread/index.js.flow +1 -0
  185. package/es/elements/content-sidebar/activity-feed/annotation-thread/index.js.map +1 -0
  186. package/es/elements/content-sidebar/activity-feed/annotation-thread/messages.js +17 -0
  187. package/es/elements/content-sidebar/activity-feed/annotation-thread/messages.js.flow +21 -0
  188. package/es/elements/content-sidebar/activity-feed/annotation-thread/messages.js.map +1 -0
  189. package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js +180 -0
  190. package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js.flow +203 -0
  191. package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js.map +1 -0
  192. package/es/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js +124 -0
  193. package/es/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js.flow +121 -0
  194. package/es/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js.map +1 -0
  195. package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js +19 -5
  196. package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js.flow +24 -4
  197. package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js.map +1 -1
  198. package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js +25 -4
  199. package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js.flow +36 -2
  200. package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js.map +1 -1
  201. package/es/elements/content-sidebar/activity-feed/annotations/messages.js +8 -0
  202. package/es/elements/content-sidebar/activity-feed/annotations/messages.js.flow +10 -0
  203. package/es/elements/content-sidebar/activity-feed/annotations/messages.js.map +1 -1
  204. package/es/elements/content-sidebar/activity-feed/comment/Comment.js +61 -28
  205. package/es/elements/content-sidebar/activity-feed/comment/Comment.js.flow +54 -10
  206. package/es/elements/content-sidebar/activity-feed/comment/Comment.js.map +1 -1
  207. package/es/elements/content-sidebar/activity-feed/comment/messages.js +8 -0
  208. package/es/elements/content-sidebar/activity-feed/comment/messages.js.flow +10 -0
  209. package/es/elements/content-sidebar/activity-feed/comment/messages.js.map +1 -1
  210. package/es/elements/content-sidebar/activity-feed/comment-form/CommentForm.js +4 -2
  211. package/es/elements/content-sidebar/activity-feed/comment-form/CommentForm.js.flow +3 -1
  212. package/es/elements/content-sidebar/activity-feed/comment-form/CommentForm.js.map +1 -1
  213. package/es/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.js +16 -5
  214. package/es/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.js.flow +34 -4
  215. package/es/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.js.map +1 -1
  216. package/es/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.scss +40 -3
  217. package/es/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessage.js +49 -0
  218. package/es/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessage.js.flow +42 -0
  219. package/es/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessage.js.map +1 -0
  220. package/es/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessageToggle.js +21 -0
  221. package/es/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessageToggle.js.flow +24 -0
  222. package/es/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessageToggle.js.map +1 -0
  223. package/es/elements/content-sidebar/activity-feed/common/activity-message/messages.js +12 -0
  224. package/es/elements/content-sidebar/activity-feed/common/activity-message/messages.js.flow +15 -0
  225. package/es/elements/content-sidebar/activity-feed/common/activity-message/messages.js.map +1 -1
  226. package/es/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.js +24 -0
  227. package/es/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.js.flow +30 -0
  228. package/es/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.js.map +1 -0
  229. package/es/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.scss +6 -0
  230. package/es/elements/content-sidebar/activity-feed/common/activity-status/index.js +2 -0
  231. package/es/elements/content-sidebar/activity-feed/common/activity-status/index.js.flow +2 -0
  232. package/es/elements/content-sidebar/activity-feed/common/activity-status/index.js.map +1 -0
  233. package/es/elements/content-sidebar/activity-feed/common/activity-status/messages.js +9 -0
  234. package/es/elements/content-sidebar/activity-feed/common/activity-status/messages.js.flow +13 -0
  235. package/es/elements/content-sidebar/activity-feed/common/activity-status/messages.js.map +1 -0
  236. package/es/elements/content-sidebar/activity-feed/common/activity-timestamp/ActivityTimestamp.scss +1 -1
  237. package/es/elements/content-sidebar/fixtures.js +181 -0
  238. package/es/elements/content-sidebar/fixtures.js.flow +185 -0
  239. package/es/elements/content-sidebar/fixtures.js.map +1 -0
  240. package/es/elements/content-sidebar/flowTypes.js.flow +9 -25
  241. package/es/elements/content-sidebar/messages.js +8 -0
  242. package/es/elements/content-sidebar/messages.js.flow +10 -0
  243. package/es/elements/content-sidebar/messages.js.map +1 -1
  244. package/es/elements/content-sidebar/withErrorHandling.js.flow +1 -1
  245. package/es/elements/content-sidebar/withErrorHandling.js.map +1 -1
  246. package/es/elements/content-sidebar/withSidebarAnnotations.js +215 -30
  247. package/es/elements/content-sidebar/withSidebarAnnotations.js.flow +162 -11
  248. package/es/elements/content-sidebar/withSidebarAnnotations.js.map +1 -1
  249. package/es/elements/content-uploader/OverallUploadsProgressBar.js +10 -8
  250. package/es/elements/content-uploader/OverallUploadsProgressBar.js.flow +11 -12
  251. package/es/elements/content-uploader/OverallUploadsProgressBar.js.map +1 -1
  252. package/es/features/classification/Classification.scss +1 -1
  253. package/es/features/classification/security-controls/SecurityControlsItem.scss +1 -0
  254. package/es/features/classification/security-controls/messages.js +8 -0
  255. package/es/features/classification/security-controls/messages.js.flow +10 -0
  256. package/es/features/classification/security-controls/messages.js.map +1 -1
  257. package/es/features/classification/security-controls/utils.js +4 -7
  258. package/es/features/classification/security-controls/utils.js.flow +8 -12
  259. package/es/features/classification/security-controls/utils.js.map +1 -1
  260. package/es/features/content-explorer/content-explorer/ContentExplorer.js +6 -1
  261. package/es/features/content-explorer/content-explorer/ContentExplorer.js.flow +4 -0
  262. package/es/features/content-explorer/content-explorer/ContentExplorer.js.map +1 -1
  263. package/es/features/content-explorer/content-explorer/ContentExplorer.scss +4 -0
  264. package/es/features/content-explorer/content-explorer/ContentExplorerBreadcrumbs.js +15 -9
  265. package/es/features/content-explorer/content-explorer/ContentExplorerBreadcrumbs.js.flow +14 -11
  266. package/es/features/content-explorer/content-explorer/ContentExplorerBreadcrumbs.js.map +1 -1
  267. package/es/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js +4 -1
  268. package/es/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js.flow +4 -1
  269. package/es/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js.map +1 -1
  270. package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js +6 -3
  271. package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js.flow +5 -1
  272. package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js.map +1 -1
  273. package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js +6 -1
  274. package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js.flow +5 -1
  275. package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js.map +1 -1
  276. package/es/features/content-explorer/prop-types.js +7 -1
  277. package/es/features/content-explorer/prop-types.js.flow +8 -0
  278. package/es/features/content-explorer/prop-types.js.map +1 -1
  279. package/es/features/content-insights/CompactCount.js +24 -0
  280. package/es/features/content-insights/CompactCount.js.map +1 -0
  281. package/es/features/content-insights/ContentAnalyticsErrorState.js +35 -0
  282. package/es/features/content-insights/ContentAnalyticsErrorState.js.map +1 -0
  283. package/es/features/content-insights/ContentAnalyticsErrorState.scss +17 -0
  284. package/es/features/content-insights/ContentInsightsSummary.js +42 -0
  285. package/es/features/content-insights/ContentInsightsSummary.js.map +1 -0
  286. package/es/features/content-insights/ContentInsightsSummary.scss +12 -0
  287. package/es/features/content-insights/ContentInsightsSummaryGhostState.js +19 -0
  288. package/es/features/content-insights/ContentInsightsSummaryGhostState.js.map +1 -0
  289. package/es/features/content-insights/ContentInsightsSummaryGhostState.scss +9 -0
  290. package/es/features/content-insights/GraphCardGhostState.js +25 -0
  291. package/es/features/content-insights/GraphCardGhostState.js.map +1 -0
  292. package/es/features/content-insights/GraphCardGhostState.scss +18 -0
  293. package/es/features/content-insights/GraphCardPreviewsSummary.js +30 -0
  294. package/es/features/content-insights/GraphCardPreviewsSummary.js.map +1 -0
  295. package/es/features/content-insights/GraphCardPreviewsSummary.scss +10 -0
  296. package/es/features/content-insights/GraphGhostState.js +21 -0
  297. package/es/features/content-insights/GraphGhostState.js.map +1 -0
  298. package/es/features/content-insights/GraphGhostState.scss +11 -0
  299. package/es/features/content-insights/HeaderWithCount.js +23 -0
  300. package/es/features/content-insights/HeaderWithCount.js.map +1 -0
  301. package/es/features/content-insights/HeaderWithCount.scss +10 -0
  302. package/es/features/content-insights/MetricSummary.js +85 -0
  303. package/es/features/content-insights/MetricSummary.js.map +1 -0
  304. package/es/features/content-insights/MetricSummary.scss +14 -0
  305. package/es/features/content-insights/OpenContentInsightsButton.js +16 -0
  306. package/es/features/content-insights/OpenContentInsightsButton.js.map +1 -0
  307. package/es/features/content-insights/TrendPill.js +61 -0
  308. package/es/features/content-insights/TrendPill.js.map +1 -0
  309. package/es/features/content-insights/TrendPill.scss +33 -0
  310. package/es/features/content-insights/_mixins.scss +7 -0
  311. package/es/features/content-insights/_variables.scss +4 -0
  312. package/es/features/content-insights/charts/bar/Bar.js +57 -0
  313. package/es/features/content-insights/charts/bar/Bar.js.map +1 -0
  314. package/es/features/content-insights/charts/bar/Bar.scss +27 -0
  315. package/es/features/content-insights/charts/bar/BarChart.js +70 -0
  316. package/es/features/content-insights/charts/bar/BarChart.js.map +1 -0
  317. package/es/features/content-insights/charts/bar/BarChart.scss +56 -0
  318. package/es/features/content-insights/charts/types.js +2 -0
  319. package/es/{common/types/threadedComments.js.map → features/content-insights/charts/types.js.map} +1 -1
  320. package/es/features/content-insights/constants.js +54 -0
  321. package/es/features/content-insights/constants.js.map +1 -0
  322. package/es/features/content-insights/messages.js +69 -0
  323. package/es/features/content-insights/messages.js.map +1 -0
  324. package/es/features/content-insights/numberUtils.js +10 -0
  325. package/es/features/content-insights/numberUtils.js.map +1 -0
  326. package/es/features/content-insights/types.js +2 -0
  327. package/es/features/content-insights/types.js.map +1 -0
  328. package/es/features/item-details/ItemProperties.scss +1 -1
  329. package/es/features/shared-link-settings-modal/SharedLinkSettingsModal.js +5 -3
  330. package/es/features/shared-link-settings-modal/SharedLinkSettingsModal.js.flow +4 -2
  331. package/es/features/shared-link-settings-modal/SharedLinkSettingsModal.js.map +1 -1
  332. package/es/features/unified-share-modal/ContactRestrictionNotice.js +34 -8
  333. package/es/features/unified-share-modal/ContactRestrictionNotice.js.flow +36 -6
  334. package/es/features/unified-share-modal/ContactRestrictionNotice.js.map +1 -1
  335. package/es/features/unified-share-modal/EmailForm.js +59 -47
  336. package/es/features/unified-share-modal/EmailForm.js.flow +31 -13
  337. package/es/features/unified-share-modal/EmailForm.js.map +1 -1
  338. package/es/features/unified-share-modal/UnifiedShareForm.js +112 -103
  339. package/es/features/unified-share-modal/UnifiedShareForm.js.flow +25 -8
  340. package/es/features/unified-share-modal/UnifiedShareForm.js.map +1 -1
  341. package/es/features/unified-share-modal/UnifiedShareModal.js +1 -0
  342. package/es/features/unified-share-modal/UnifiedShareModal.js.flow +1 -0
  343. package/es/features/unified-share-modal/UnifiedShareModal.js.map +1 -1
  344. package/es/features/unified-share-modal/flowTypes.js.flow +4 -2
  345. package/es/features/unified-share-modal/flowTypes.js.map +1 -1
  346. package/es/features/unified-share-modal/messages.js +12 -8
  347. package/es/features/unified-share-modal/messages.js.flow +14 -8
  348. package/es/features/unified-share-modal/messages.js.map +1 -1
  349. package/es/features/unified-share-modal/utils/hasRestrictedContacts.js +9 -4
  350. package/es/features/unified-share-modal/utils/hasRestrictedContacts.js.flow +10 -3
  351. package/es/features/unified-share-modal/utils/hasRestrictedContacts.js.map +1 -1
  352. package/es/features/unified-share-modal/utils/isRestrictedContact.js +15 -0
  353. package/es/features/unified-share-modal/utils/isRestrictedContact.js.flow +21 -0
  354. package/es/features/unified-share-modal/utils/isRestrictedContact.js.map +1 -0
  355. package/es/icon/fill/Alert16.js +3 -2
  356. package/es/icon/fill/Alert16.js.flow +3 -2
  357. package/es/icon/fill/Alert16.js.map +1 -1
  358. package/es/icon/fill/AlertBadge16.js +31 -0
  359. package/es/icon/fill/AlertBadge16.js.flow +29 -0
  360. package/es/icon/fill/AlertBadge16.js.map +1 -0
  361. package/es/icon/fill/AlertBadge16.stories.js +13 -0
  362. package/es/icon/fill/AlertBadge16.stories.js.map +1 -0
  363. package/es/icon/fill/Info16.js +2 -2
  364. package/es/icon/fill/Info16.js.flow +1 -1
  365. package/es/icon/fill/Info16.js.map +1 -1
  366. package/es/icon/fill/InfoBadge16.js +30 -0
  367. package/es/icon/fill/InfoBadge16.js.flow +28 -0
  368. package/es/icon/fill/InfoBadge16.js.map +1 -0
  369. package/es/icon/fill/InfoBadge16.stories.js +13 -0
  370. package/es/icon/fill/InfoBadge16.stories.js.map +1 -0
  371. package/es/icon/fill/UserSettings16.js +38 -0
  372. package/es/icon/fill/UserSettings16.js.flow +38 -0
  373. package/es/icon/fill/UserSettings16.js.map +1 -0
  374. package/es/icon/fill/UserSettings16.stories.js +13 -0
  375. package/es/icon/fill/UserSettings16.stories.js.map +1 -0
  376. package/es/icon/line/AlertBubble16.js +31 -0
  377. package/es/icon/line/AlertBubble16.js.flow +29 -0
  378. package/es/icon/line/AlertBubble16.js.map +1 -0
  379. package/es/icon/line/AlertBubble16.stories.js +13 -0
  380. package/es/icon/line/AlertBubble16.stories.js.map +1 -0
  381. package/es/icon/line/AvatarXBadge16.js +45 -0
  382. package/es/icon/line/AvatarXBadge16.js.flow +39 -0
  383. package/es/icon/line/AvatarXBadge16.js.map +1 -0
  384. package/es/icon/line/AvatarXBadge16.stories.js +13 -0
  385. package/es/icon/line/AvatarXBadge16.stories.js.map +1 -0
  386. package/es/icon/line/CoEdit16.js +32 -0
  387. package/es/icon/line/CoEdit16.js.flow +30 -0
  388. package/es/icon/line/CoEdit16.js.map +1 -0
  389. package/es/icon/line/CoEdit16.stories.js +13 -0
  390. package/es/icon/line/CoEdit16.stories.js.map +1 -0
  391. package/es/icon/line/Collaborations16.js +32 -0
  392. package/es/icon/line/Collaborations16.js.flow +30 -0
  393. package/es/icon/line/Collaborations16.js.map +1 -0
  394. package/es/icon/line/Collaborations16.stories.js +13 -0
  395. package/es/icon/line/Collaborations16.stories.js.map +1 -0
  396. package/es/icon/line/CommentBubble16.js +35 -0
  397. package/es/icon/line/CommentBubble16.js.flow +34 -0
  398. package/es/icon/line/CommentBubble16.js.map +1 -0
  399. package/es/icon/line/CommentBubble16.stories.js +13 -0
  400. package/es/icon/line/CommentBubble16.stories.js.map +1 -0
  401. package/es/src/components/accessible-svg/AccessibleSVG.stories.d.ts +7 -0
  402. package/es/src/components/badge/Badge.stories.d.ts +0 -3
  403. package/es/src/components/badge/BetaBadge.stories.d.ts +6 -0
  404. package/es/src/components/badge/TrialBadge.stories.d.ts +6 -0
  405. package/es/src/components/badge/UpgradeBadge.stories.d.ts +6 -0
  406. package/es/src/components/draggable-list/DraggableList.stories.d.ts +3 -3
  407. package/es/src/components/infinite-scroll/InfiniteScroll.d.ts +1 -1
  408. package/es/src/components/tooltip/Tooltip.d.ts +2 -0
  409. package/es/src/elements/common/annotator-context/__tests__/useAnnotatorEvents.test.d.ts +1 -0
  410. package/es/src/elements/common/annotator-context/index.d.ts +1 -0
  411. package/es/src/elements/common/annotator-context/types.d.ts +28 -6
  412. package/es/src/elements/common/annotator-context/useAnnotatorEvents.d.ts +52 -0
  413. package/es/src/elements/common/annotator-context/withAnnotations.d.ts +11 -2
  414. package/es/src/elements/common/annotator-context/withAnnotatorContext.d.ts +6 -2
  415. package/es/src/elements/common/current-user/__tests__/withCurrentUser.test.d.ts +1 -0
  416. package/es/src/elements/common/current-user/index.d.ts +2 -0
  417. package/es/src/elements/common/current-user/withCurrentUser.d.ts +20 -0
  418. package/es/src/elements/content-sidebar/SidebarContentInsights.d.ts +15 -0
  419. package/es/src/elements/content-sidebar/__tests__/SidebarContentInsights.test.d.ts +1 -0
  420. package/es/src/elements/content-sidebar/activity-feed/activity-feed/fixtures.d.ts +55 -0
  421. package/es/src/features/content-insights/CompactCount.d.ts +15 -0
  422. package/es/src/features/content-insights/ContentAnalyticsErrorState.d.ts +7 -0
  423. package/es/src/features/content-insights/ContentInsightsSummary.d.ts +12 -0
  424. package/es/src/features/content-insights/ContentInsightsSummaryGhostState.d.ts +3 -0
  425. package/es/src/features/content-insights/GraphCardGhostState.d.ts +3 -0
  426. package/es/src/features/content-insights/GraphCardPreviewsSummary.d.ts +16 -0
  427. package/es/src/features/content-insights/GraphGhostState.d.ts +3 -0
  428. package/es/src/features/content-insights/HeaderWithCount.d.ts +7 -0
  429. package/es/src/features/content-insights/MetricSummary.d.ts +18 -0
  430. package/es/src/features/content-insights/OpenContentInsightsButton.d.ts +5 -0
  431. package/es/src/features/content-insights/TrendPill.d.ts +15 -0
  432. package/es/src/features/content-insights/__tests__/CompactCount.test.d.ts +1 -0
  433. package/es/src/features/content-insights/__tests__/ContentAnalyticsErrorState.test.d.ts +1 -0
  434. package/es/src/features/content-insights/__tests__/ContentInsightsSummary.test.d.ts +1 -0
  435. package/es/src/features/content-insights/__tests__/GraphCardPreviewsSummary.test.d.ts +1 -0
  436. package/es/src/features/content-insights/__tests__/HeaderWithCount.test.d.ts +1 -0
  437. package/es/src/features/content-insights/__tests__/MetricSummary.test.d.ts +1 -0
  438. package/es/src/features/content-insights/charts/bar/Bar.d.ts +11 -0
  439. package/es/src/features/content-insights/charts/bar/BarChart.d.ts +19 -0
  440. package/es/src/features/content-insights/charts/bar/__tests__/Bar.test.d.ts +1 -0
  441. package/es/src/features/content-insights/charts/bar/__tests__/BarChart.test.d.ts +1 -0
  442. package/es/src/features/content-insights/charts/types.d.ts +2 -0
  443. package/es/src/features/content-insights/constants.d.ts +27 -0
  444. package/es/src/features/content-insights/messages.d.ts +83 -0
  445. package/es/src/features/content-insights/numberUtils.d.ts +3 -0
  446. package/es/src/features/content-insights/types.d.ts +24 -0
  447. package/es/src/icon/fill/AlertBadge16.d.ts +13 -0
  448. package/es/src/icon/fill/AlertBadge16.stories.d.ts +9 -0
  449. package/es/src/icon/fill/InfoBadge16.d.ts +13 -0
  450. package/es/src/icon/fill/InfoBadge16.stories.d.ts +9 -0
  451. package/es/src/icon/fill/UserSettings16.d.ts +13 -0
  452. package/es/src/icon/fill/UserSettings16.stories.d.ts +9 -0
  453. package/es/src/icon/line/AlertBubble16.d.ts +13 -0
  454. package/es/src/icon/line/AlertBubble16.stories.d.ts +9 -0
  455. package/es/src/icon/line/AvatarXBadge16.d.ts +13 -0
  456. package/es/src/icon/line/AvatarXBadge16.stories.d.ts +9 -0
  457. package/es/src/icon/line/CoEdit16.d.ts +13 -0
  458. package/es/src/icon/line/CoEdit16.stories.d.ts +9 -0
  459. package/es/src/icon/line/Collaborations16.d.ts +13 -0
  460. package/es/src/icon/line/Collaborations16.stories.d.ts +9 -0
  461. package/es/src/icon/line/CommentBubble16.d.ts +13 -0
  462. package/es/src/icon/line/CommentBubble16.stories.d.ts +9 -0
  463. package/es/src/styles/variables.d.ts +3 -1
  464. package/es/styles/constants/_layout.scss +1 -1
  465. package/es/styles/constants/_media-queries.scss +2 -0
  466. package/es/styles/variables.js +6 -2
  467. package/es/styles/variables.js.flow +4 -2
  468. package/es/styles/variables.js.map +1 -1
  469. package/es/utils/error.js +5 -1
  470. package/es/utils/error.js.flow +5 -1
  471. package/es/utils/error.js.map +1 -1
  472. package/es/utils/fields.js +8 -3
  473. package/es/utils/fields.js.flow +21 -3
  474. package/es/utils/fields.js.map +1 -1
  475. package/es/utils/sorter.js.flow +2 -2
  476. package/es/utils/sorter.js.map +1 -1
  477. package/i18n/bn-IN.js +45 -7
  478. package/i18n/bn-IN.properties +83 -7
  479. package/i18n/da-DK.js +45 -7
  480. package/i18n/da-DK.properties +83 -7
  481. package/i18n/de-DE.js +45 -7
  482. package/i18n/de-DE.properties +83 -7
  483. package/i18n/en-AU.js +45 -7
  484. package/i18n/en-AU.properties +83 -7
  485. package/i18n/en-CA.js +45 -7
  486. package/i18n/en-CA.properties +83 -7
  487. package/i18n/en-GB.js +45 -7
  488. package/i18n/en-GB.properties +83 -7
  489. package/i18n/en-US.js +45 -7
  490. package/i18n/en-US.properties +83 -7
  491. package/i18n/en-x-pseudo.js +891 -854
  492. package/i18n/en-x-pseudo.properties +941 -843
  493. package/i18n/es-419.js +45 -7
  494. package/i18n/es-419.properties +83 -7
  495. package/i18n/es-ES.js +45 -7
  496. package/i18n/es-ES.properties +83 -7
  497. package/i18n/fi-FI.js +45 -7
  498. package/i18n/fi-FI.properties +83 -7
  499. package/i18n/fr-CA.js +45 -7
  500. package/i18n/fr-CA.properties +83 -7
  501. package/i18n/fr-FR.js +45 -7
  502. package/i18n/fr-FR.properties +83 -7
  503. package/i18n/hi-IN.js +45 -7
  504. package/i18n/hi-IN.properties +83 -7
  505. package/i18n/it-IT.js +45 -7
  506. package/i18n/it-IT.properties +83 -7
  507. package/i18n/ja-JP.js +47 -9
  508. package/i18n/ja-JP.properties +85 -9
  509. package/i18n/ko-KR.js +45 -7
  510. package/i18n/ko-KR.properties +83 -7
  511. package/i18n/nb-NO.js +45 -7
  512. package/i18n/nb-NO.properties +83 -7
  513. package/i18n/nl-NL.js +45 -7
  514. package/i18n/nl-NL.properties +83 -7
  515. package/i18n/pl-PL.js +45 -7
  516. package/i18n/pl-PL.properties +83 -7
  517. package/i18n/pt-BR.js +45 -7
  518. package/i18n/pt-BR.properties +83 -7
  519. package/i18n/ru-RU.js +45 -7
  520. package/i18n/ru-RU.properties +83 -7
  521. package/i18n/sv-SE.js +45 -7
  522. package/i18n/sv-SE.properties +83 -7
  523. package/i18n/tr-TR.js +45 -7
  524. package/i18n/tr-TR.properties +83 -7
  525. package/i18n/zh-CN.js +45 -7
  526. package/i18n/zh-CN.properties +83 -7
  527. package/i18n/zh-TW.js +45 -7
  528. package/i18n/zh-TW.properties +83 -7
  529. package/package.json +7 -8
  530. package/src/__mocks__/react-intl.js +4 -0
  531. package/src/api/APIFactory.js +26 -0
  532. package/src/api/Annotations.js +150 -14
  533. package/src/api/Comments.js +5 -4
  534. package/src/api/Feed.js +677 -17
  535. package/src/api/FileCollaborators.js +30 -0
  536. package/src/api/ThreadedComments.js +54 -29
  537. package/src/api/__tests__/Annotations.test.js +217 -11
  538. package/src/api/__tests__/Feed.test.js +699 -86
  539. package/src/api/__tests__/FileCollaborators.test.js +41 -0
  540. package/src/api/__tests__/ThreadedComments.test.js +47 -10
  541. package/src/api/__tests__/utils.test.js +11 -0
  542. package/src/api/fixtures.js +401 -0
  543. package/src/api/messages.js +5 -0
  544. package/src/api/utils.js +30 -0
  545. package/src/common/types/annotations.js +18 -10
  546. package/src/common/types/feed.js +40 -4
  547. package/src/components/accessible-svg/AccessibleSVG.stories.tsx +18 -0
  548. package/src/components/badge/Badge.stories.md +1 -7
  549. package/src/components/badge/Badge.stories.tsx +1 -10
  550. package/src/components/badge/BetaBadge.stories.tsx +9 -0
  551. package/src/components/badge/TrialBadge.stories.tsx +9 -0
  552. package/src/components/badge/UpgradeBadge.stories.tsx +9 -0
  553. package/src/components/breadcrumb/Breadcrumb.js +68 -42
  554. package/src/components/breadcrumb/EllipsisCrumb.js +10 -6
  555. package/src/components/count-badge/CountBadge.stories.tsx +1 -1
  556. package/src/components/draggable-list/DraggableList.stories.tsx +72 -5
  557. package/src/components/dropdown-menu/DropdownMenu.js +11 -0
  558. package/src/components/dropdown-menu/DropdownMenu.scss +3 -3
  559. package/src/components/dropdown-menu/__tests__/DropdownMenu.test.js +38 -0
  560. package/src/components/grid-view/__tests__/__snapshots__/GridViewSlider.test.js.snap +1 -0
  561. package/src/components/infinite-scroll/InfiniteScroll.md +1 -1
  562. package/src/components/infinite-scroll/InfiniteScroll.tsx +5 -2
  563. package/src/components/infinite-scroll/__tests__/InfiniteScroll.test.tsx +115 -127
  564. package/src/components/modal/Modal.scss +5 -1
  565. package/src/components/search-form/SearchForm.js +1 -1
  566. package/src/components/search-form/__tests__/SearchForm.test.js +25 -6
  567. package/src/components/sidebar-toggle-button/__tests__/__snapshots__/SidebarToggleButton.test.js.snap +4 -0
  568. package/src/components/table/__tests__/makeSelectable.test.js +654 -144
  569. package/src/components/table/makeSelectable.js +299 -98
  570. package/src/components/time/__tests__/ReadableTime.test.js +0 -1
  571. package/src/components/tooltip/Tooltip.tsx +5 -2
  572. package/src/components/tooltip/__tests__/Tooltip.test.tsx +10 -0
  573. package/src/components/tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +1 -1
  574. package/src/constants.js +11 -0
  575. package/src/elements/common/annotator-context/__tests__/useAnnotatorEvents.test.tsx +509 -0
  576. package/src/elements/common/annotator-context/__tests__/withAnnotations.test.tsx +275 -12
  577. package/src/elements/common/annotator-context/__tests__/withAnnotatorContext.test.tsx +18 -6
  578. package/src/elements/common/annotator-context/index.js.flow +4 -0
  579. package/src/elements/common/annotator-context/index.ts +1 -0
  580. package/src/elements/common/annotator-context/types.js.flow +77 -35
  581. package/src/elements/common/annotator-context/types.ts +28 -6
  582. package/src/elements/common/annotator-context/useAnnotatorEvents.js.flow +52 -0
  583. package/src/elements/common/annotator-context/useAnnotatorEvents.ts +190 -0
  584. package/src/elements/common/annotator-context/withAnnotations.js.flow +73 -36
  585. package/src/elements/common/annotator-context/withAnnotations.tsx +170 -7
  586. package/src/elements/common/annotator-context/withAnnotatorContext.js.flow +29 -9
  587. package/src/elements/common/annotator-context/withAnnotatorContext.tsx +28 -5
  588. package/src/elements/common/current-user/__tests__/withCurrentUser.test.tsx +108 -0
  589. package/src/elements/common/current-user/index.js.flow +8 -0
  590. package/src/elements/common/current-user/index.ts +2 -0
  591. package/src/elements/common/current-user/withCurrentUser.js.flow +40 -0
  592. package/src/elements/common/current-user/withCurrentUser.tsx +139 -0
  593. package/src/elements/common/flowTypes.js +22 -4
  594. package/src/elements/common/interactionTargets.js +2 -0
  595. package/src/elements/common/logger/Logger.js +1 -1
  596. package/src/elements/common/messages.js +5 -0
  597. package/src/elements/content-explorer/DeleteConfirmationDialog.js +3 -1
  598. package/src/elements/content-explorer/DeleteConfirmationDialog.scss +5 -0
  599. package/src/elements/content-explorer/stories/DeleteConfirmationDialog.stories.js +60 -0
  600. package/src/elements/content-explorer/stories/DeleteConfirmationDialog.stories.md +1 -0
  601. package/src/elements/content-sidebar/ActivitySidebar.js +381 -154
  602. package/src/elements/content-sidebar/ActivitySidebarFilter.js +59 -0
  603. package/src/elements/content-sidebar/ActivitySidebarFilter.scss +4 -0
  604. package/src/elements/content-sidebar/DetailsSidebar.js +32 -4
  605. package/src/elements/content-sidebar/Sidebar.js +6 -1
  606. package/src/elements/content-sidebar/SidebarContentInsights.scss +6 -0
  607. package/src/elements/content-sidebar/SidebarContentInsights.tsx +57 -0
  608. package/src/elements/content-sidebar/SidebarPanels.js +4 -0
  609. package/src/elements/content-sidebar/__tests__/ActivitySidebar.test.js +533 -243
  610. package/src/elements/content-sidebar/__tests__/ActivitySidebarFilter.test.js +54 -0
  611. package/src/elements/content-sidebar/__tests__/DetailsSidebar.test.js +45 -0
  612. package/src/elements/content-sidebar/__tests__/Sidebar.test.js +1 -1
  613. package/src/elements/content-sidebar/__tests__/SidebarContentInsights.test.tsx +56 -0
  614. package/src/elements/content-sidebar/__tests__/SidebarPanels.test.js +4 -3
  615. package/src/elements/content-sidebar/__tests__/__snapshots__/ActivitySidebar.test.js.snap +29 -15
  616. package/src/elements/content-sidebar/__tests__/__snapshots__/SidebarFileProperties.test.js.snap +1 -0
  617. package/src/elements/content-sidebar/__tests__/withSidebarAnnotations.test.js +325 -32
  618. package/src/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +122 -24
  619. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js +59 -18
  620. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js +126 -0
  621. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.scss +17 -0
  622. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js +85 -0
  623. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.scss +16 -0
  624. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js +59 -0
  625. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.scss +22 -0
  626. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActiveState.test.js +19 -5
  627. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityFeed.test.js +22 -16
  628. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThread.test.js +80 -0
  629. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThreadReplies.test.js +24 -0
  630. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThreadRepliesForm.test.js +47 -0
  631. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/__snapshots__/ActiveState.test.js.snap +74 -43
  632. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/activityFeedUtils.test.js +8 -8
  633. package/src/elements/content-sidebar/activity-feed/activity-feed/activityFeedUtils.js +2 -2
  634. package/src/elements/content-sidebar/activity-feed/activity-feed/fixtures.ts +56 -0
  635. package/src/elements/content-sidebar/activity-feed/activity-feed/messages.js +20 -0
  636. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js +117 -0
  637. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.scss +7 -0
  638. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js +105 -0
  639. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.scss +5 -0
  640. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js +86 -0
  641. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.scss +3 -0
  642. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThread.test.js +28 -0
  643. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThreadContent.test.js +89 -0
  644. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThreadCreate.test.js +103 -0
  645. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/useAnnotationAPI.test.js +202 -0
  646. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/useRepliesAPI.test.js +99 -0
  647. package/src/elements/content-sidebar/activity-feed/annotation-thread/errors.js +26 -0
  648. package/src/elements/content-sidebar/activity-feed/annotation-thread/index.js +1 -0
  649. package/src/elements/content-sidebar/activity-feed/annotation-thread/messages.js +21 -0
  650. package/src/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js +203 -0
  651. package/src/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js +121 -0
  652. package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js +24 -4
  653. package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js +36 -2
  654. package/src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js +14 -10
  655. package/src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivityMenu.test.js +35 -1
  656. package/src/elements/content-sidebar/activity-feed/annotations/messages.js +10 -0
  657. package/src/elements/content-sidebar/activity-feed/comment/Comment.js +54 -10
  658. package/src/elements/content-sidebar/activity-feed/comment/__tests__/Comment.test.js +152 -7
  659. package/src/elements/content-sidebar/activity-feed/comment/__tests__/__snapshots__/Comment.test.js.snap +12 -7
  660. package/src/elements/content-sidebar/activity-feed/comment/messages.js +10 -0
  661. package/src/elements/content-sidebar/activity-feed/comment-form/CommentForm.js +3 -1
  662. package/src/elements/content-sidebar/activity-feed/comment-form/__tests__/CommentForm.test.js +11 -0
  663. package/src/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.js +34 -4
  664. package/src/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.scss +40 -3
  665. package/src/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessage.js +42 -0
  666. package/src/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessageToggle.js +24 -0
  667. package/src/elements/content-sidebar/activity-feed/common/activity-message/__tests__/ActivityMessage.test.js +48 -1
  668. package/src/elements/content-sidebar/activity-feed/common/activity-message/messages.js +15 -0
  669. package/src/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.js +30 -0
  670. package/src/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.scss +6 -0
  671. package/src/elements/content-sidebar/activity-feed/common/activity-status/__tests__/ActivityStatus.test.js +19 -0
  672. package/src/elements/content-sidebar/activity-feed/common/activity-status/index.js +2 -0
  673. package/src/elements/content-sidebar/activity-feed/common/activity-status/messages.js +13 -0
  674. package/src/elements/content-sidebar/activity-feed/common/activity-timestamp/ActivityTimestamp.scss +1 -1
  675. package/src/elements/content-sidebar/activity-feed/task-new/__tests__/Task.test.js +4 -3
  676. package/src/elements/content-sidebar/activity-feed/task-new/__tests__/__snapshots__/Task.test.js.snap +1 -2
  677. package/src/elements/content-sidebar/fixtures.js +185 -0
  678. package/src/elements/content-sidebar/flowTypes.js +9 -25
  679. package/src/elements/content-sidebar/messages.js +10 -0
  680. package/src/elements/content-sidebar/withErrorHandling.js +1 -1
  681. package/src/elements/content-sidebar/withSidebarAnnotations.js +162 -11
  682. package/src/elements/content-uploader/OverallUploadsProgressBar.js +11 -12
  683. package/src/features/classification/Classification.scss +1 -1
  684. package/src/features/classification/security-controls/SecurityControlsItem.scss +1 -0
  685. package/src/features/classification/security-controls/__tests__/__snapshots__/utils.test.js.snap +18 -16
  686. package/src/features/classification/security-controls/__tests__/utils.test.js +13 -5
  687. package/src/features/classification/security-controls/messages.js +10 -0
  688. package/src/features/classification/security-controls/utils.js +8 -12
  689. package/src/features/collapsible-sidebar/__tests__/__snapshots__/CollapsibleSidebarLogo.test.js.snap +2 -0
  690. package/src/features/content-explorer/content-explorer/ContentExplorer.js +4 -0
  691. package/src/features/content-explorer/content-explorer/ContentExplorer.scss +4 -0
  692. package/src/features/content-explorer/content-explorer/ContentExplorerBreadcrumbs.js +14 -11
  693. package/src/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js +4 -1
  694. package/src/features/content-explorer/content-explorer/__tests__/ContentExplorerBreadcrumbs.test.js +2 -2
  695. package/src/features/content-explorer/content-explorer-modal/ContentExplorerModal.js +5 -1
  696. package/src/features/content-explorer/content-explorer-modal/__tests__/__snapshots__/ContentExplorerModal.test.js.snap +1 -0
  697. package/src/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js +5 -1
  698. package/src/features/content-explorer/prop-types.js +8 -0
  699. package/src/features/content-insights/CompactCount.tsx +23 -0
  700. package/src/features/content-insights/ContentAnalyticsErrorState.scss +17 -0
  701. package/src/features/content-insights/ContentAnalyticsErrorState.tsx +44 -0
  702. package/src/features/content-insights/ContentInsightsSummary.scss +12 -0
  703. package/src/features/content-insights/ContentInsightsSummary.tsx +45 -0
  704. package/src/features/content-insights/ContentInsightsSummaryGhostState.scss +9 -0
  705. package/src/features/content-insights/ContentInsightsSummaryGhostState.tsx +18 -0
  706. package/src/features/content-insights/GraphCardGhostState.scss +18 -0
  707. package/src/features/content-insights/GraphCardGhostState.tsx +18 -0
  708. package/src/features/content-insights/GraphCardPreviewsSummary.scss +10 -0
  709. package/src/features/content-insights/GraphCardPreviewsSummary.tsx +40 -0
  710. package/src/features/content-insights/GraphGhostState.scss +11 -0
  711. package/src/features/content-insights/GraphGhostState.tsx +17 -0
  712. package/src/features/content-insights/HeaderWithCount.scss +10 -0
  713. package/src/features/content-insights/HeaderWithCount.tsx +24 -0
  714. package/src/features/content-insights/MetricSummary.scss +14 -0
  715. package/src/features/content-insights/MetricSummary.tsx +65 -0
  716. package/src/features/content-insights/OpenContentInsightsButton.tsx +20 -0
  717. package/src/features/content-insights/TrendPill.scss +33 -0
  718. package/src/features/content-insights/TrendPill.tsx +70 -0
  719. package/src/features/content-insights/__tests__/CompactCount.test.tsx +57 -0
  720. package/src/features/content-insights/__tests__/ContentAnalyticsErrorState.test.tsx +33 -0
  721. package/src/features/content-insights/__tests__/ContentInsightsSummary.test.tsx +81 -0
  722. package/src/features/content-insights/__tests__/GraphCardPreviewsSummary.test.tsx +35 -0
  723. package/src/features/content-insights/__tests__/HeaderWithCount.test.tsx +26 -0
  724. package/src/features/content-insights/__tests__/MetricSummary.test.tsx +88 -0
  725. package/src/features/content-insights/_mixins.scss +7 -0
  726. package/src/features/content-insights/_variables.scss +4 -0
  727. package/src/features/content-insights/charts/bar/Bar.scss +27 -0
  728. package/src/features/content-insights/charts/bar/Bar.tsx +48 -0
  729. package/src/features/content-insights/charts/bar/BarChart.scss +56 -0
  730. package/src/features/content-insights/charts/bar/BarChart.tsx +78 -0
  731. package/src/features/content-insights/charts/bar/__tests__/Bar.test.tsx +74 -0
  732. package/src/features/content-insights/charts/bar/__tests__/BarChart.test.tsx +110 -0
  733. package/src/features/content-insights/charts/types.ts +3 -0
  734. package/src/features/content-insights/constants.ts +60 -0
  735. package/src/features/content-insights/messages.ts +90 -0
  736. package/src/features/content-insights/numberUtils.ts +9 -0
  737. package/src/features/content-insights/types.ts +33 -0
  738. package/src/features/item-details/ItemProperties.scss +1 -1
  739. package/src/features/shared-link-settings-modal/SharedLinkSettingsModal.js +4 -2
  740. package/src/features/shared-link-settings-modal/__tests__/SharedLinkSettingsModal.test.js +22 -3
  741. package/src/features/shared-link-settings-modal/__tests__/__snapshots__/SharedLinkSettingsModal.test.js.snap +2 -1
  742. package/src/features/unified-share-modal/ContactRestrictionNotice.js +36 -6
  743. package/src/features/unified-share-modal/EmailForm.js +31 -13
  744. package/src/features/unified-share-modal/UnifiedShareForm.js +25 -8
  745. package/src/features/unified-share-modal/UnifiedShareModal.js +1 -0
  746. package/src/features/unified-share-modal/__tests__/ContactRestrictionNotice.test.js +55 -6
  747. package/src/features/unified-share-modal/__tests__/EmailForm.test.js +131 -24
  748. package/src/features/unified-share-modal/__tests__/UnifiedShareForm.test.js +89 -35
  749. package/src/features/unified-share-modal/__tests__/__snapshots__/UnifiedShareForm.test.js.snap +16 -0
  750. package/src/features/unified-share-modal/__tests__/__snapshots__/UnifiedShareModal.test.js.snap +17 -0
  751. package/src/features/unified-share-modal/flowTypes.js +4 -2
  752. package/src/features/unified-share-modal/messages.js +14 -8
  753. package/src/features/unified-share-modal/utils/__tests__/hasRestrictedContacts.test.js +24 -10
  754. package/src/features/unified-share-modal/utils/__tests__/isRestrictedContact.test.js +33 -0
  755. package/src/features/unified-share-modal/utils/hasRestrictedContacts.js +10 -3
  756. package/src/features/unified-share-modal/utils/isRestrictedContact.js +21 -0
  757. package/src/features/virtualized-table/__tests__/__snapshots__/VirtualizedTable.test.js.snap +1 -0
  758. package/src/icon/fill/Alert16.js.flow +3 -2
  759. package/src/icon/fill/Alert16.tsx +3 -2
  760. package/src/icon/fill/AlertBadge16.js.flow +29 -0
  761. package/src/icon/fill/AlertBadge16.stories.tsx +13 -0
  762. package/src/icon/fill/AlertBadge16.tsx +27 -0
  763. package/src/icon/fill/Info16.js.flow +1 -1
  764. package/src/icon/fill/Info16.tsx +1 -1
  765. package/src/icon/fill/InfoBadge16.js.flow +28 -0
  766. package/src/icon/fill/InfoBadge16.stories.tsx +13 -0
  767. package/src/icon/fill/InfoBadge16.tsx +26 -0
  768. package/src/icon/fill/UserSettings16.js.flow +38 -0
  769. package/src/icon/fill/UserSettings16.stories.tsx +13 -0
  770. package/src/icon/fill/UserSettings16.tsx +36 -0
  771. package/src/icon/line/AlertBubble16.js.flow +29 -0
  772. package/src/icon/line/AlertBubble16.stories.tsx +13 -0
  773. package/src/icon/line/AlertBubble16.tsx +27 -0
  774. package/src/icon/line/AvatarXBadge16.js.flow +39 -0
  775. package/src/icon/line/AvatarXBadge16.stories.tsx +13 -0
  776. package/src/icon/line/AvatarXBadge16.tsx +37 -0
  777. package/src/icon/line/CoEdit16.js.flow +30 -0
  778. package/src/icon/line/CoEdit16.stories.tsx +13 -0
  779. package/src/icon/line/CoEdit16.tsx +28 -0
  780. package/src/icon/line/Collaborations16.js.flow +30 -0
  781. package/src/icon/line/Collaborations16.stories.tsx +13 -0
  782. package/src/icon/line/Collaborations16.tsx +28 -0
  783. package/src/icon/line/CommentBubble16.js.flow +34 -0
  784. package/src/icon/line/CommentBubble16.stories.tsx +13 -0
  785. package/src/icon/line/CommentBubble16.tsx +32 -0
  786. package/src/styles/constants/_layout.scss +1 -1
  787. package/src/styles/constants/_media-queries.scss +2 -0
  788. package/src/styles/variables.js +4 -2
  789. package/src/styles/variables.json +4 -2
  790. package/src/styles/variables.ts +3 -1
  791. package/src/utils/__tests__/fields.test.js +23 -4
  792. package/src/utils/__tests__/sorter.test.js +3 -3
  793. package/src/utils/error.js +5 -1
  794. package/src/utils/fields.js +21 -3
  795. package/src/utils/sorter.js +2 -2
  796. package/es/common/types/threadedComments.js +0 -2
  797. package/es/common/types/threadedComments.js.flow +0 -9
  798. package/src/common/types/threadedComments.js +0 -9
package/src/api/Feed.js CHANGED
@@ -6,13 +6,15 @@
6
6
  import uniqueId from 'lodash/uniqueId';
7
7
  import noop from 'lodash/noop';
8
8
  import type { MessageDescriptor } from 'react-intl';
9
- import { getBadItemError, getBadUserError, isUserCorrectableError } from '../utils/error';
9
+ import { getBadItemError, getBadUserError, getMissingItemTextOrStatus, isUserCorrectableError } from '../utils/error';
10
10
  import commonMessages from '../elements/common/messages';
11
11
  import messages from './messages';
12
12
  import { sortFeedItems } from '../utils/sorter';
13
+ import { FEED_FILE_VERSIONS_FIELDS_TO_FETCH } from '../utils/fields';
13
14
  import Base from './Base';
14
15
  import AnnotationsAPI from './Annotations';
15
16
  import CommentsAPI from './Comments';
17
+ import ThreadedCommentsAPI from './ThreadedComments';
16
18
  import VersionsAPI from './Versions';
17
19
  import TasksNewAPI from './tasks/TasksNew';
18
20
  import GroupsAPI from './Groups';
@@ -23,6 +25,9 @@ import {
23
25
  ERROR_CODE_CREATE_TASK,
24
26
  ERROR_CODE_UPDATE_TASK,
25
27
  ERROR_CODE_GROUP_EXCEEDS_LIMIT,
28
+ FEED_ITEM_TYPE_ANNOTATION,
29
+ FEED_ITEM_TYPE_COMMENT,
30
+ FEED_ITEM_TYPE_TASK,
26
31
  HTTP_STATUS_CODE_CONFLICT,
27
32
  IS_ERROR_DISPLAYED,
28
33
  TASK_NEW_APPROVED,
@@ -59,16 +64,19 @@ import type {
59
64
  AnnotationPermission,
60
65
  Annotations,
61
66
  AppActivityItems,
67
+ BoxCommentPermission,
62
68
  Comment,
69
+ CommentFeedItemType,
63
70
  Comments,
64
71
  FeedItem,
65
72
  FeedItems,
73
+ FeedItemStatus,
66
74
  Task,
67
75
  Tasks,
76
+ ThreadedComments as ThreadedCommentsType,
68
77
  } from '../common/types/feed';
69
78
 
70
79
  const TASK_NEW_INITIAL_STATUS = TASK_NEW_NOT_STARTED;
71
- const TASK = 'task';
72
80
 
73
81
  type FeedItemsCache = {
74
82
  errors: ErrorResponseData[],
@@ -77,6 +85,16 @@ type FeedItemsCache = {
77
85
 
78
86
  type ErrorCallback = (e: ElementsXhrError, code: string, contextInfo?: Object) => void;
79
87
 
88
+ const getItemWithFilteredReplies = <T: { replies?: Array<Comment> }>(item: T, replyId: string): T => {
89
+ const { replies = [], ...rest } = item;
90
+ return { replies: replies.filter(({ id }) => id !== replyId), ...rest };
91
+ };
92
+
93
+ const getItemWithPendingReply = <T: { replies?: Array<Comment> }>(item: T, reply: Comment): T => {
94
+ const { replies = [], ...rest } = item;
95
+ return { replies: [...replies, reply], ...rest };
96
+ };
97
+
80
98
  class Feed extends Base {
81
99
  /**
82
100
  * @property {AnnotationsAPI}
@@ -113,6 +131,11 @@ class Feed extends Base {
113
131
  */
114
132
  taskLinksAPI: TaskLinksAPI[];
115
133
 
134
+ /**
135
+ * @property {ThreadedCommentsAPI}
136
+ */
137
+ threadedCommentsAPI: ThreadedCommentsAPI;
138
+
116
139
  /**
117
140
  * @property {BoxItem}
118
141
  */
@@ -151,7 +174,7 @@ class Feed extends Base {
151
174
  ...annotation,
152
175
  created_by: currentUser,
153
176
  id,
154
- type: 'annotation',
177
+ type: FEED_ITEM_TYPE_ANNOTATION,
155
178
  };
156
179
 
157
180
  this.addPendingItem(this.file.id, currentUser, newAnnotation);
@@ -165,7 +188,8 @@ class Feed extends Base {
165
188
  updateAnnotation = (
166
189
  file: BoxItem,
167
190
  annotationId: string,
168
- text: string,
191
+ text?: string,
192
+ status?: FeedItemStatus,
169
193
  permissions: AnnotationPermission,
170
194
  successCallback: (annotation: Annotation) => void,
171
195
  errorCallback: ErrorCallback,
@@ -173,19 +197,29 @@ class Feed extends Base {
173
197
  if (!file.id) {
174
198
  throw getBadItemError();
175
199
  }
200
+ if (!text && !status) {
201
+ throw getMissingItemTextOrStatus();
202
+ }
176
203
 
177
204
  this.annotationsAPI = new AnnotationsAPI(this.options);
178
205
 
179
206
  this.file = file;
180
207
  this.errorCallback = errorCallback;
181
208
 
182
- this.updateFeedItem({ message: text, isPending: true }, annotationId);
209
+ const feedItemChanges = {};
210
+ if (text) {
211
+ feedItemChanges.message = text;
212
+ }
213
+ if (status) {
214
+ feedItemChanges.status = status;
215
+ }
216
+ this.updateFeedItem({ ...feedItemChanges, isPending: true }, annotationId);
183
217
 
184
218
  this.annotationsAPI.updateAnnotation(
185
219
  this.file.id,
186
220
  annotationId,
187
221
  permissions,
188
- text,
222
+ feedItemChanges,
189
223
  (annotation: Annotation) => {
190
224
  this.updateFeedItem(
191
225
  {
@@ -217,6 +251,33 @@ class Feed extends Base {
217
251
  this.feedErrorCallback(true, e, code);
218
252
  };
219
253
 
254
+ /**
255
+ * Error callback for updating a reply
256
+ *
257
+ * @param {ElementsXhrError} error - the error returned by the API
258
+ * @param {string} code - the error code
259
+ * @param {string} id - the id of the reply (comment)
260
+ * @param {string} parentId - the id of either the parent item (an annotation or comment)
261
+ * @return {void}
262
+ */
263
+ updateReplyErrorCallback = (error: ElementsXhrError, code: string, id: string, parentId: string) => {
264
+ this.updateReplyItem(this.createFeedError(messages.commentUpdateErrorMessage), parentId, id);
265
+ this.feedErrorCallback(true, error, code);
266
+ };
267
+
268
+ /**
269
+ * Error callback for fetching replies
270
+ *
271
+ * @param {ElementsXhrError} error - the error returned by the API
272
+ * @param {string} code - the error code
273
+ * @param {string} id - the id of either an annotation or comment
274
+ * @return {void}
275
+ */
276
+ fetchRepliesErrorCallback = (error: ElementsXhrError, code: string, id: string) => {
277
+ this.updateFeedItem(this.createFeedError(messages.repliesFetchErrorMessage), id);
278
+ this.feedErrorCallback(true, error, code);
279
+ };
280
+
220
281
  deleteAnnotation = (
221
282
  file: BoxItem,
222
283
  annotationId: string,
@@ -302,11 +363,13 @@ class Feed extends Base {
302
363
  {
303
364
  shouldShowAnnotations = false,
304
365
  shouldShowAppActivity = false,
366
+ shouldShowReplies = false,
305
367
  shouldShowTasks = true,
306
368
  shouldShowVersions = true,
307
369
  }: {
308
370
  shouldShowAnnotations?: boolean,
309
371
  shouldShowAppActivity?: boolean,
372
+ shouldShowReplies?: boolean,
310
373
  shouldShowTasks?: boolean,
311
374
  shouldShowVersions?: boolean,
312
375
  } = {},
@@ -329,10 +392,14 @@ class Feed extends Base {
329
392
  this.file = file;
330
393
  this.errors = [];
331
394
  this.errorCallback = onError;
332
- const annotationsPromise = shouldShowAnnotations ? this.fetchAnnotations(permissions) : Promise.resolve();
395
+ const annotationsPromise = shouldShowAnnotations
396
+ ? this.fetchAnnotations(permissions, shouldShowReplies)
397
+ : Promise.resolve();
333
398
  const versionsPromise = shouldShowVersions ? this.fetchVersions() : Promise.resolve();
334
399
  const currentVersionPromise = shouldShowVersions ? this.fetchCurrentVersion() : Promise.resolve();
335
- const commentsPromise = this.fetchComments(permissions);
400
+ const commentsPromise = shouldShowReplies
401
+ ? this.fetchThreadedComments(permissions)
402
+ : this.fetchComments(permissions);
336
403
  const tasksPromise = shouldShowTasks ? this.fetchTasksNew() : Promise.resolve();
337
404
  const appActivityPromise = shouldShowAppActivity ? this.fetchAppActivity(permissions) : Promise.resolve();
338
405
 
@@ -359,7 +426,7 @@ class Feed extends Base {
359
426
  });
360
427
  }
361
428
 
362
- fetchAnnotations(permissions: BoxItemPermission): Promise<?Annotations> {
429
+ fetchAnnotations(permissions: BoxItemPermission, shouldFetchReplies?: boolean): Promise<?Annotations> {
363
430
  this.annotationsAPI = new AnnotationsAPI(this.options);
364
431
  return new Promise(resolve => {
365
432
  this.annotationsAPI.getAnnotations(
@@ -368,6 +435,9 @@ class Feed extends Base {
368
435
  permissions,
369
436
  resolve,
370
437
  this.fetchFeedItemErrorCallback.bind(this, resolve),
438
+ undefined,
439
+ undefined,
440
+ shouldFetchReplies,
371
441
  );
372
442
  });
373
443
  }
@@ -390,6 +460,82 @@ class Feed extends Base {
390
460
  });
391
461
  }
392
462
 
463
+ /**
464
+ * Fetches the comments with replies for a file
465
+ *
466
+ * @param {Object} permissions - the file permissions
467
+ * @return {Promise} - the file comments
468
+ */
469
+ fetchThreadedComments(permissions: BoxItemPermission): Promise<?ThreadedCommentsType> {
470
+ this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);
471
+ return new Promise(resolve => {
472
+ this.threadedCommentsAPI.getComments({
473
+ errorCallback: this.fetchFeedItemErrorCallback.bind(this, resolve),
474
+ fileId: this.file.id,
475
+ permissions,
476
+ successCallback: resolve,
477
+ });
478
+ });
479
+ }
480
+
481
+ /**
482
+ * Fetches replies (comments) of a comment or annotation
483
+ *
484
+ * @param {BoxItem} file - The file to which the comment or annotation belongs to
485
+ * @param {string} commentFeedItemId - ID of the comment or annotation
486
+ * @param {CommentFeedItemType} commentFeedItemType - Type of the comment or annotation
487
+ * @param {Function} successCallback
488
+ * @param {ErrorCallback} errorCallback
489
+ * @return {void}
490
+ */
491
+ fetchReplies(
492
+ file: BoxItem,
493
+ commentFeedItemId: string,
494
+ commentFeedItemType: CommentFeedItemType,
495
+ successCallback: (comments: Array<Comment>) => void,
496
+ errorCallback: ErrorCallback,
497
+ ): void {
498
+ const { id, permissions } = file;
499
+ if (!id || !permissions) {
500
+ throw getBadItemError();
501
+ }
502
+
503
+ this.file = file;
504
+ this.errorCallback = errorCallback;
505
+
506
+ this.updateFeedItem({ isRepliesLoading: true }, commentFeedItemId);
507
+
508
+ const successCallbackFn = (comments: ThreadedCommentsType) => {
509
+ this.updateFeedItem({ isRepliesLoading: false, replies: comments.entries }, commentFeedItemId);
510
+ successCallback(comments.entries);
511
+ };
512
+ const errorCallbackFn = (error: ErrorResponseData, code: string) => {
513
+ this.fetchRepliesErrorCallback(error, code, commentFeedItemId);
514
+ };
515
+
516
+ if (commentFeedItemType === FEED_ITEM_TYPE_ANNOTATION) {
517
+ this.annotationsAPI = new AnnotationsAPI(this.options);
518
+
519
+ this.annotationsAPI.getAnnotationReplies(
520
+ file.id,
521
+ commentFeedItemId,
522
+ permissions,
523
+ successCallbackFn,
524
+ errorCallbackFn,
525
+ );
526
+ } else if (commentFeedItemType === FEED_ITEM_TYPE_COMMENT) {
527
+ this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);
528
+
529
+ this.threadedCommentsAPI.getCommentReplies({
530
+ fileId: file.id,
531
+ commentId: commentFeedItemId,
532
+ permissions,
533
+ successCallback: successCallbackFn,
534
+ errorCallback: errorCallbackFn,
535
+ });
536
+ }
537
+ }
538
+
393
539
  /**
394
540
  * Fetches the versions for a file
395
541
  *
@@ -399,7 +545,14 @@ class Feed extends Base {
399
545
  this.versionsAPI = new VersionsAPI(this.options);
400
546
 
401
547
  return new Promise(resolve => {
402
- this.versionsAPI.getVersions(this.file.id, resolve, this.fetchFeedItemErrorCallback.bind(this, resolve));
548
+ this.versionsAPI.getVersions(
549
+ this.file.id,
550
+ resolve,
551
+ this.fetchFeedItemErrorCallback.bind(this, resolve),
552
+ undefined,
553
+ undefined,
554
+ FEED_FILE_VERSIONS_FIELDS_TO_FETCH,
555
+ );
403
556
  });
404
557
  }
405
558
 
@@ -642,15 +795,15 @@ class Feed extends Base {
642
795
  *
643
796
  * @param {BoxItem} file - The file to which the comment belongs to
644
797
  * @param {string} commentId - Comment ID
645
- * @param {BoxItemPermission} permissions - Permissions for the comment
798
+ * @param {BoxCommentPermission} permissions - Permissions for the comment
646
799
  * @param {Function} successCallback - the function which will be called on success
647
- * @param {Function} errorCallback - the function which will be called on error *
800
+ * @param {Function} errorCallback - the function which will be called on error
648
801
  * @return {void}
649
802
  */
650
803
  deleteComment = (
651
804
  file: BoxItem,
652
805
  commentId: string,
653
- permissions: BoxItemPermission,
806
+ permissions: BoxCommentPermission,
654
807
  successCallback: Function,
655
808
  errorCallback: ErrorCallback,
656
809
  ): void => {
@@ -674,6 +827,84 @@ class Feed extends Base {
674
827
  });
675
828
  };
676
829
 
830
+ /**
831
+ * Deletes a threaded comment (using ThreadedComments API).
832
+ *
833
+ * @param {BoxItem} file - The file to which the comment belongs to
834
+ * @param {string} commentId - Comment ID
835
+ * @param {BoxCommentPermission} permissions - Permissions for the comment
836
+ * @param {Function} successCallback - the function which will be called on success
837
+ * @param {Function} errorCallback - the function which will be called on error
838
+ * @return {void}
839
+ */
840
+ deleteThreadedComment = (
841
+ file: BoxItem,
842
+ commentId: string,
843
+ permissions: BoxCommentPermission,
844
+ successCallback: Function,
845
+ errorCallback: ErrorCallback,
846
+ ): void => {
847
+ if (!file.id) {
848
+ throw getBadItemError();
849
+ }
850
+
851
+ this.file = file;
852
+ this.errorCallback = errorCallback;
853
+ this.updateFeedItem({ isPending: true }, commentId);
854
+
855
+ this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);
856
+
857
+ this.threadedCommentsAPI.deleteComment({
858
+ fileId: file.id,
859
+ commentId,
860
+ permissions,
861
+ successCallback: this.deleteFeedItem.bind(this, commentId, successCallback),
862
+ errorCallback: (e: ElementsXhrError, code: string) => {
863
+ this.deleteCommentErrorCallback(e, code, commentId);
864
+ },
865
+ });
866
+ };
867
+
868
+ /**
869
+ * Deletes a reply (using ThreadedComments API).
870
+ *
871
+ * @param {BoxItem} file - The file to which the comment belongs to
872
+ * @param {string} id - id of the reply (comment)
873
+ * @param {string} parentId - id of the parent feed item
874
+ * @param {BoxCommentPermission} permissions - Permissions for the comment
875
+ * @param {Function} successCallback - the function which will be called on success
876
+ * @param {Function} errorCallback - the function which will be called on error
877
+ * @return {void}
878
+ */
879
+ deleteReply = (
880
+ file: BoxItem,
881
+ id: string,
882
+ parentId: string,
883
+ permissions: BoxCommentPermission,
884
+ successCallback: () => void,
885
+ errorCallback: ErrorCallback,
886
+ ): void => {
887
+ if (!file.id) {
888
+ throw getBadItemError();
889
+ }
890
+
891
+ this.file = file;
892
+ this.errorCallback = errorCallback;
893
+ this.updateReplyItem({ isPending: true }, parentId, id);
894
+
895
+ this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);
896
+
897
+ this.threadedCommentsAPI.deleteComment({
898
+ fileId: file.id,
899
+ commentId: id,
900
+ permissions,
901
+ successCallback: this.deleteReplyItem.bind(this, id, parentId, successCallback),
902
+ errorCallback: (e: ElementsXhrError, code: string) => {
903
+ this.deleteReplyErrorCallback(e, code, id, parentId);
904
+ },
905
+ });
906
+ };
907
+
677
908
  /**
678
909
  * Error callback for deleting a comment
679
910
  *
@@ -687,6 +918,20 @@ class Feed extends Base {
687
918
  this.feedErrorCallback(true, e, code);
688
919
  };
689
920
 
921
+ /**
922
+ * Error callback for deleting a reply
923
+ *
924
+ * @param {ElementsXhrError} error - the error returned by the API
925
+ * @param {string} code - the error code
926
+ * @param {string} id - the reply (comment) id
927
+ * @param {string} parentId - the comment id of the parent feed item
928
+ * @return {void}
929
+ */
930
+ deleteReplyErrorCallback = (error: ElementsXhrError, code: string, id: string, parentId: string) => {
931
+ this.updateReplyItem(this.createFeedError(messages.commentDeleteErrorMessage), parentId, id);
932
+ this.feedErrorCallback(true, error, code);
933
+ };
934
+
690
935
  /**
691
936
  * Creates a task.
692
937
  *
@@ -737,7 +982,7 @@ class Feed extends Base {
737
982
  due_at: dueAtString,
738
983
  id: uuid,
739
984
  description: message,
740
- type: TASK,
985
+ type: FEED_ITEM_TYPE_TASK,
741
986
  assigned_to: {
742
987
  entries: assignees.map((assignee: SelectorItem<UserMini | GroupMini>) => ({
743
988
  id: uniqueId(),
@@ -1034,6 +1279,38 @@ class Feed extends Base {
1034
1279
  }
1035
1280
  };
1036
1281
 
1282
+ /**
1283
+ * Deletes a reply from the cache
1284
+ *
1285
+ * @param {string} id - The id of the feed item to be deleted
1286
+ * @param {string} parentId - The id of the parent feed item
1287
+ * @param {Function} successCallback - function to be called after the delete
1288
+ */
1289
+ deleteReplyItem = (
1290
+ id: string,
1291
+ parentId: string,
1292
+ successCallback: (id: string, parentId: string) => void = noop,
1293
+ ) => {
1294
+ const cachedItems = this.getCachedItems(this.file.id) || { items: [], errors: [] };
1295
+ const feedItems = cachedItems.items.map(item => {
1296
+ if (item.id !== parentId) {
1297
+ return item;
1298
+ }
1299
+ if (item.type === FEED_ITEM_TYPE_ANNOTATION) {
1300
+ return getItemWithFilteredReplies<Annotation>(item, id);
1301
+ }
1302
+ if (item.type === FEED_ITEM_TYPE_COMMENT) {
1303
+ return getItemWithFilteredReplies<Comment>(item, id);
1304
+ }
1305
+ return item;
1306
+ });
1307
+ this.setCachedItems(this.file.id, feedItems);
1308
+
1309
+ if (!this.isDestroyed()) {
1310
+ successCallback(id, parentId);
1311
+ }
1312
+ };
1313
+
1037
1314
  /**
1038
1315
  * Network error callback
1039
1316
  *
@@ -1086,6 +1363,49 @@ class Feed extends Base {
1086
1363
  return pendingFeedItem;
1087
1364
  };
1088
1365
 
1366
+ /**
1367
+ * Add a placeholder pending comment (reply).
1368
+ *
1369
+ * @param {string} parentId - id of parent comment or annotation
1370
+ * @param {Object} currentUser - the user who performed the action
1371
+ * @param {Object} commentBase - Base properties for reply (comment) to be added to the feed as pending.
1372
+ * @return {Comment} - newly created pending reply
1373
+ */
1374
+ addPendingReply = (parentId: string, currentUser: User, commentBase: Object): Comment => {
1375
+ if (!this.file.id) {
1376
+ throw getBadItemError();
1377
+ }
1378
+ if (!currentUser) {
1379
+ throw getBadUserError();
1380
+ }
1381
+
1382
+ const date = new Date().toISOString();
1383
+ const pendingReply: Comment = {
1384
+ created_at: date,
1385
+ created_by: currentUser,
1386
+ modified_at: date,
1387
+ isPending: true,
1388
+ ...commentBase,
1389
+ };
1390
+
1391
+ const cachedItems = this.getCachedItems(this.file.id);
1392
+ if (cachedItems) {
1393
+ const updatedFeedItems = cachedItems.items.map(item => {
1394
+ if (item.id === parentId && item.type === FEED_ITEM_TYPE_COMMENT) {
1395
+ return getItemWithPendingReply<Comment>(item, pendingReply);
1396
+ }
1397
+ if (item.id === parentId && item.type === FEED_ITEM_TYPE_ANNOTATION) {
1398
+ return getItemWithPendingReply<Annotation>(item, pendingReply);
1399
+ }
1400
+ return item;
1401
+ });
1402
+
1403
+ this.setCachedItems(this.file.id, updatedFeedItems);
1404
+ }
1405
+
1406
+ return pendingReply;
1407
+ };
1408
+
1089
1409
  /**
1090
1410
  * Callback for successful creation of a Comment.
1091
1411
  *
@@ -1128,6 +1448,53 @@ class Feed extends Base {
1128
1448
  this.feedErrorCallback(false, e, code);
1129
1449
  };
1130
1450
 
1451
+ /**
1452
+ * Callback for successful creation of a Comment.
1453
+ *
1454
+ * @param {Comment} commentData - API returned Comment
1455
+ * @param {string} parentId - ID of the parent feed item
1456
+ * @param {string} id - ID of the reply to update with the new comment data
1457
+ * @param {Function} successCallback - success callback
1458
+ * @return {void}
1459
+ */
1460
+ createReplySuccessCallback = (
1461
+ commentData: Comment,
1462
+ parentId: string,
1463
+ id: string,
1464
+ successCallback: Function,
1465
+ ): void => {
1466
+ this.updateReplyItem(
1467
+ {
1468
+ ...commentData,
1469
+ isPending: false,
1470
+ },
1471
+ parentId,
1472
+ id,
1473
+ );
1474
+
1475
+ if (!this.isDestroyed()) {
1476
+ successCallback(commentData);
1477
+ }
1478
+ };
1479
+
1480
+ /**
1481
+ * Callback for failed creation of a reply.
1482
+ *
1483
+ * @param {ElementsXhrError} error - The axios error
1484
+ * @param {string} code - the error code
1485
+ * @param {string} parentId - ID of the parent feed item
1486
+ * @param {string} id - ID of the feed item to update
1487
+ * @return {void}
1488
+ */
1489
+ createReplyErrorCallback = (error: ElementsXhrError, code: string, parentId: string, id: string) => {
1490
+ const errorMessage =
1491
+ error.status === HTTP_STATUS_CODE_CONFLICT
1492
+ ? messages.commentCreateConflictMessage
1493
+ : messages.commentCreateErrorMessage;
1494
+ this.updateReplyItem(this.createFeedError(errorMessage), parentId, id);
1495
+ this.feedErrorCallback(false, error, code);
1496
+ };
1497
+
1131
1498
  /**
1132
1499
  * Constructs an error object that renders to an inline feed error
1133
1500
  *
@@ -1173,6 +1540,55 @@ class Feed extends Base {
1173
1540
  return null;
1174
1541
  };
1175
1542
 
1543
+ /**
1544
+ * Replace a reply of feed item with new comment data.
1545
+ *
1546
+ * @param {Object} replyUpdates - New data to be applied to the reply.
1547
+ * @param {string} parentId - ID of the parent feed item.
1548
+ * @param {string} id - ID of the reply to replace.
1549
+ * @return {void}
1550
+ */
1551
+ updateReplyItem = (replyUpdates: Object, parentId: string, id: string) => {
1552
+ if (!this.file.id) {
1553
+ throw getBadItemError();
1554
+ }
1555
+
1556
+ const getItemWithUpdatedReply = <T: { replies?: Array<Comment> }>(
1557
+ item: T,
1558
+ replyId: string,
1559
+ updates: Object,
1560
+ ): T => {
1561
+ const updatedItem: T = { ...item };
1562
+ if (updatedItem.replies) {
1563
+ updatedItem.replies = updatedItem.replies.map(reply => {
1564
+ if (reply.id === replyId) {
1565
+ return {
1566
+ ...reply,
1567
+ ...updates,
1568
+ };
1569
+ }
1570
+ return reply;
1571
+ });
1572
+ }
1573
+ return updatedItem;
1574
+ };
1575
+
1576
+ const cachedItems = this.getCachedItems(this.file.id);
1577
+ if (cachedItems) {
1578
+ const updatedFeedItems = cachedItems.items.map((item: FeedItem) => {
1579
+ if (item.id === parentId && item.type === FEED_ITEM_TYPE_COMMENT) {
1580
+ return getItemWithUpdatedReply<Comment>(item, id, replyUpdates);
1581
+ }
1582
+ if (item.id === parentId && item.type === FEED_ITEM_TYPE_ANNOTATION) {
1583
+ return getItemWithUpdatedReply<Annotation>(item, id, replyUpdates);
1584
+ }
1585
+ return item;
1586
+ });
1587
+
1588
+ this.setCachedItems(this.file.id, updatedFeedItems);
1589
+ }
1590
+ };
1591
+
1176
1592
  /**
1177
1593
  * Create a comment, and make a pending item to be replaced once the API is successful.
1178
1594
  *
@@ -1196,7 +1612,7 @@ class Feed extends Base {
1196
1612
  const commentData = {
1197
1613
  id: uuid,
1198
1614
  tagged_message: text,
1199
- type: 'comment',
1615
+ type: FEED_ITEM_TYPE_COMMENT,
1200
1616
  };
1201
1617
 
1202
1618
  if (!file.id) {
@@ -1229,12 +1645,129 @@ class Feed extends Base {
1229
1645
  };
1230
1646
 
1231
1647
  /**
1232
- * Update a comment
1648
+ * Create a threaded comment (using ThreadedComments API),
1649
+ * and make a pending item to be replaced once the API is successful.
1233
1650
  *
1234
1651
  * @param {BoxItem} file - The file to which the task is assigned
1235
1652
  * @param {Object} currentUser - the user who performed the action
1236
1653
  * @param {string} text - the comment text
1654
+ * @param {Function} successCallback - the success callback
1655
+ * @param {Function} errorCallback - the error callback
1656
+ * @return {void}
1657
+ */
1658
+ createThreadedComment = (
1659
+ file: BoxItem,
1660
+ currentUser: User,
1661
+ text: string,
1662
+ successCallback: Function,
1663
+ errorCallback: ErrorCallback,
1664
+ ): void => {
1665
+ if (!file.id) {
1666
+ throw getBadItemError();
1667
+ }
1668
+
1669
+ const uuid = uniqueId('comment_');
1670
+ const commentData = {
1671
+ id: uuid,
1672
+ tagged_message: text,
1673
+ type: FEED_ITEM_TYPE_COMMENT,
1674
+ };
1675
+
1676
+ this.file = file;
1677
+ this.errorCallback = errorCallback;
1678
+ this.addPendingItem(this.file.id, currentUser, commentData);
1679
+
1680
+ this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);
1681
+
1682
+ this.threadedCommentsAPI.createComment({
1683
+ file,
1684
+ message: text,
1685
+ successCallback: (comment: Comment) => {
1686
+ this.createCommentSuccessCallback(comment, uuid, successCallback);
1687
+ },
1688
+ errorCallback: (e: ErrorResponseData, code: string) => {
1689
+ this.createCommentErrorCallback(e, code, uuid);
1690
+ },
1691
+ });
1692
+ };
1693
+
1694
+ /**
1695
+ * Create a reply to annotation or comment, and make a pending item to be replaced once the API is successful.
1696
+ *
1697
+ * @param {BoxItem} file - The file to which the task is assigned
1698
+ * @param {Object} currentUser - the user who performed the action
1699
+ * @param {string} parentId - id of the parent item
1700
+ * @param {CommentFeedItemType} parentType - type of the parent item
1701
+ * @param {string} text - the comment text
1702
+ * @param {Function} successCallback - the success callback
1703
+ * @param {Function} errorCallback - the error callback
1704
+ * @return {void}
1705
+ */
1706
+ createReply(
1707
+ file: BoxItem,
1708
+ currentUser: User,
1709
+ parentId: string,
1710
+ parentType: CommentFeedItemType,
1711
+ text: string,
1712
+ successCallback: Function,
1713
+ errorCallback: ErrorCallback,
1714
+ ): void {
1715
+ const { id, permissions } = file;
1716
+ if (!id || !permissions) {
1717
+ throw getBadItemError();
1718
+ }
1719
+
1720
+ const uuid = uniqueId('comment_');
1721
+ const commentData = {
1722
+ id: uuid,
1723
+ tagged_message: text,
1724
+ type: FEED_ITEM_TYPE_COMMENT,
1725
+ };
1726
+
1727
+ this.file = file;
1728
+ this.errorCallback = errorCallback;
1729
+ this.addPendingReply(parentId, currentUser, commentData);
1730
+
1731
+ const successCallbackFn = (comment: Comment) => {
1732
+ this.createReplySuccessCallback(comment, parentId, uuid, successCallback);
1733
+ };
1734
+ const errorCallbackFn = (error: ErrorResponseData, code: string) => {
1735
+ this.createReplyErrorCallback(error, code, parentId, uuid);
1736
+ };
1737
+
1738
+ if (parentType === FEED_ITEM_TYPE_ANNOTATION) {
1739
+ this.annotationsAPI = new AnnotationsAPI(this.options);
1740
+
1741
+ this.annotationsAPI.createAnnotationReply(
1742
+ file.id,
1743
+ parentId,
1744
+ permissions,
1745
+ text,
1746
+ successCallbackFn,
1747
+ errorCallbackFn,
1748
+ );
1749
+ } else if (parentType === FEED_ITEM_TYPE_COMMENT) {
1750
+ this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);
1751
+
1752
+ this.threadedCommentsAPI.createCommentReply({
1753
+ fileId: file.id,
1754
+ commentId: parentId,
1755
+ permissions,
1756
+ message: text,
1757
+ successCallback: successCallbackFn,
1758
+ errorCallback: errorCallbackFn,
1759
+ });
1760
+ }
1761
+ }
1762
+
1763
+ /**
1764
+ * Update a comment
1765
+ *
1766
+ * @param {BoxItem} file - The file to which the task is assigned
1767
+ * @param {string} commentId - Comment ID
1768
+ * @param {string} text - the comment text
1237
1769
  * @param {boolean} hasMention - true if there is an @mention in the text
1770
+ * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items
1238
1771
  * @param {Function} successCallback - the success callback
1239
1772
  * @param {Function} errorCallback - the error callback
1240
1773
  * @return {void}
@@ -1244,7 +1777,7 @@ class Feed extends Base {
1244
1777
  commentId: string,
1245
1778
  text: string,
1246
1779
  hasMention: boolean,
1247
- permissions: BoxItemPermission,
1780
+ permissions: BoxCommentPermission,
1248
1781
  successCallback: Function,
1249
1782
  errorCallback: ErrorCallback,
1250
1783
  ): void => {
@@ -1295,6 +1828,128 @@ class Feed extends Base {
1295
1828
  });
1296
1829
  };
1297
1830
 
1831
+ /**
1832
+ * Update a threaded comment
1833
+ *
1834
+ * @param {BoxItem} file - The file to which the task is assigned
1835
+ * @param {string} commentId - Comment ID
1836
+ * @param {string} text - the comment text
1837
+ * @param {FeedItemStatus} status - status of the comment
1838
+ * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items
1839
+ * @param {Function} successCallback - the success callback
1840
+ * @param {Function} errorCallback - the error callback
1841
+ * @return {void}
1842
+ */
1843
+ updateThreadedComment = (
1844
+ file: BoxItem,
1845
+ commentId: string,
1846
+ text?: string,
1847
+ status?: FeedItemStatus,
1848
+ permissions: BoxCommentPermission,
1849
+ successCallback: Function,
1850
+ errorCallback: ErrorCallback,
1851
+ ): void => {
1852
+ if (!file.id) {
1853
+ throw getBadItemError();
1854
+ }
1855
+ if (!text && !status) {
1856
+ throw getMissingItemTextOrStatus();
1857
+ }
1858
+
1859
+ const commentData = {};
1860
+ if (text) {
1861
+ commentData.tagged_message = text;
1862
+ }
1863
+ if (status) {
1864
+ commentData.status = status;
1865
+ }
1866
+
1867
+ this.file = file;
1868
+ this.errorCallback = errorCallback;
1869
+ this.updateFeedItem({ ...commentData, isPending: true }, commentId);
1870
+
1871
+ this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);
1872
+
1873
+ this.threadedCommentsAPI.updateComment({
1874
+ fileId: file.id,
1875
+ commentId,
1876
+ permissions,
1877
+ message: text,
1878
+ status,
1879
+ successCallback: (comment: Comment) => {
1880
+ this.updateFeedItem(
1881
+ {
1882
+ ...comment,
1883
+ isPending: false,
1884
+ },
1885
+ commentId,
1886
+ );
1887
+ if (!this.isDestroyed()) {
1888
+ successCallback(comment);
1889
+ }
1890
+ },
1891
+ errorCallback: (e: ErrorResponseData, code: string) => {
1892
+ this.updateCommentErrorCallback(e, code, commentId);
1893
+ },
1894
+ });
1895
+ };
1896
+
1897
+ /**
1898
+ * Update a reply
1899
+ *
1900
+ * @param {BoxItem} file - The file to which the reply with its parent is assigned
1901
+ * @param {string} id - id of the reply
1902
+ * @param {string} parentId - id of the parent item
1903
+ * @param {string} text - the updated text
1904
+ * @param {BoxCommentPermission} permissions - Permissions to attach to the app activity items
1905
+ * @param {Function} successCallback - the success callback
1906
+ * @param {Function} errorCallback - the error callback
1907
+ * @return {void}
1908
+ */
1909
+ updateReply = (
1910
+ file: BoxItem,
1911
+ id: string,
1912
+ parentId: string,
1913
+ text: string,
1914
+ permissions: BoxCommentPermission,
1915
+ successCallback: (comment: Comment) => void,
1916
+ errorCallback: ErrorCallback,
1917
+ ): void => {
1918
+ if (!file.id) {
1919
+ throw getBadItemError();
1920
+ }
1921
+
1922
+ this.file = file;
1923
+ this.errorCallback = errorCallback;
1924
+ this.updateReplyItem({ tagged_message: text, isPending: true }, parentId, id);
1925
+
1926
+ this.threadedCommentsAPI = new ThreadedCommentsAPI(this.options);
1927
+
1928
+ this.threadedCommentsAPI.updateComment({
1929
+ fileId: file.id,
1930
+ commentId: id,
1931
+ permissions,
1932
+ message: text,
1933
+ undefined,
1934
+ successCallback: (comment: Comment) => {
1935
+ this.updateReplyItem(
1936
+ {
1937
+ ...comment,
1938
+ isPending: false,
1939
+ },
1940
+ parentId,
1941
+ id,
1942
+ );
1943
+ if (!this.isDestroyed()) {
1944
+ successCallback(comment);
1945
+ }
1946
+ },
1947
+ errorCallback: (error: ErrorResponseData, code: string) => {
1948
+ this.updateReplyErrorCallback(error, code, id, parentId);
1949
+ },
1950
+ });
1951
+ };
1952
+
1298
1953
  destroyTaskCollaborators() {
1299
1954
  if (Array.isArray(this.taskCollaboratorsAPI)) {
1300
1955
  this.taskCollaboratorsAPI.forEach(api => api.destroy());
@@ -1395,6 +2050,11 @@ class Feed extends Base {
1395
2050
  delete this.commentsAPI;
1396
2051
  }
1397
2052
 
2053
+ if (this.threadedCommentsAPI) {
2054
+ this.threadedCommentsAPI.destroy();
2055
+ delete this.threadedCommentsAPI;
2056
+ }
2057
+
1398
2058
  if (this.versionsAPI) {
1399
2059
  this.versionsAPI.destroy();
1400
2060
  delete this.versionsAPI;