box-ui-elements 16.0.0-beta.9 → 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 (788) 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 +84 -8
  19. package/es/api/Annotations.js.flow +60 -6
  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 -71
  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 -12
  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/line/AlertBubble16.js +31 -0
  372. package/es/icon/line/AlertBubble16.js.flow +29 -0
  373. package/es/icon/line/AlertBubble16.js.map +1 -0
  374. package/es/icon/line/AlertBubble16.stories.js +13 -0
  375. package/es/icon/line/AlertBubble16.stories.js.map +1 -0
  376. package/es/icon/line/AvatarXBadge16.js +45 -0
  377. package/es/icon/line/AvatarXBadge16.js.flow +39 -0
  378. package/es/icon/line/AvatarXBadge16.js.map +1 -0
  379. package/es/icon/line/AvatarXBadge16.stories.js +13 -0
  380. package/es/icon/line/AvatarXBadge16.stories.js.map +1 -0
  381. package/es/icon/line/CoEdit16.js +32 -0
  382. package/es/icon/line/CoEdit16.js.flow +30 -0
  383. package/es/icon/line/CoEdit16.js.map +1 -0
  384. package/es/icon/line/CoEdit16.stories.js +13 -0
  385. package/es/icon/line/CoEdit16.stories.js.map +1 -0
  386. package/es/icon/line/Collaborations16.js +32 -0
  387. package/es/icon/line/Collaborations16.js.flow +30 -0
  388. package/es/icon/line/Collaborations16.js.map +1 -0
  389. package/es/icon/line/Collaborations16.stories.js +13 -0
  390. package/es/icon/line/Collaborations16.stories.js.map +1 -0
  391. package/es/icon/line/CommentBubble16.js +35 -0
  392. package/es/icon/line/CommentBubble16.js.flow +34 -0
  393. package/es/icon/line/CommentBubble16.js.map +1 -0
  394. package/es/icon/line/CommentBubble16.stories.js +13 -0
  395. package/es/icon/line/CommentBubble16.stories.js.map +1 -0
  396. package/es/src/components/accessible-svg/AccessibleSVG.stories.d.ts +7 -0
  397. package/es/src/components/badge/Badge.stories.d.ts +0 -3
  398. package/es/src/components/badge/BetaBadge.stories.d.ts +6 -0
  399. package/es/src/components/badge/TrialBadge.stories.d.ts +6 -0
  400. package/es/src/components/badge/UpgradeBadge.stories.d.ts +6 -0
  401. package/es/src/components/draggable-list/DraggableList.stories.d.ts +3 -3
  402. package/es/src/components/infinite-scroll/InfiniteScroll.d.ts +1 -1
  403. package/es/src/components/tooltip/Tooltip.d.ts +2 -0
  404. package/es/src/elements/common/annotator-context/__tests__/useAnnotatorEvents.test.d.ts +1 -0
  405. package/es/src/elements/common/annotator-context/index.d.ts +1 -0
  406. package/es/src/elements/common/annotator-context/types.d.ts +28 -6
  407. package/es/src/elements/common/annotator-context/useAnnotatorEvents.d.ts +52 -0
  408. package/es/src/elements/common/annotator-context/withAnnotations.d.ts +11 -2
  409. package/es/src/elements/common/annotator-context/withAnnotatorContext.d.ts +6 -2
  410. package/es/src/elements/common/current-user/__tests__/withCurrentUser.test.d.ts +1 -0
  411. package/es/src/elements/common/current-user/index.d.ts +2 -0
  412. package/es/src/elements/common/current-user/withCurrentUser.d.ts +20 -0
  413. package/es/src/elements/content-sidebar/SidebarContentInsights.d.ts +15 -0
  414. package/es/src/elements/content-sidebar/__tests__/SidebarContentInsights.test.d.ts +1 -0
  415. package/es/src/elements/content-sidebar/activity-feed/activity-feed/fixtures.d.ts +55 -0
  416. package/es/src/features/content-insights/CompactCount.d.ts +15 -0
  417. package/es/src/features/content-insights/ContentAnalyticsErrorState.d.ts +7 -0
  418. package/es/src/features/content-insights/ContentInsightsSummary.d.ts +12 -0
  419. package/es/src/features/content-insights/ContentInsightsSummaryGhostState.d.ts +3 -0
  420. package/es/src/features/content-insights/GraphCardGhostState.d.ts +3 -0
  421. package/es/src/features/content-insights/GraphCardPreviewsSummary.d.ts +16 -0
  422. package/es/src/features/content-insights/GraphGhostState.d.ts +3 -0
  423. package/es/src/features/content-insights/HeaderWithCount.d.ts +7 -0
  424. package/es/src/features/content-insights/MetricSummary.d.ts +18 -0
  425. package/es/src/features/content-insights/OpenContentInsightsButton.d.ts +5 -0
  426. package/es/src/features/content-insights/TrendPill.d.ts +15 -0
  427. package/es/src/features/content-insights/__tests__/CompactCount.test.d.ts +1 -0
  428. package/es/src/features/content-insights/__tests__/ContentAnalyticsErrorState.test.d.ts +1 -0
  429. package/es/src/features/content-insights/__tests__/ContentInsightsSummary.test.d.ts +1 -0
  430. package/es/src/features/content-insights/__tests__/GraphCardPreviewsSummary.test.d.ts +1 -0
  431. package/es/src/features/content-insights/__tests__/HeaderWithCount.test.d.ts +1 -0
  432. package/es/src/features/content-insights/__tests__/MetricSummary.test.d.ts +1 -0
  433. package/es/src/features/content-insights/charts/bar/Bar.d.ts +11 -0
  434. package/es/src/features/content-insights/charts/bar/BarChart.d.ts +19 -0
  435. package/es/src/features/content-insights/charts/bar/__tests__/Bar.test.d.ts +1 -0
  436. package/es/src/features/content-insights/charts/bar/__tests__/BarChart.test.d.ts +1 -0
  437. package/es/src/features/content-insights/charts/types.d.ts +2 -0
  438. package/es/src/features/content-insights/constants.d.ts +27 -0
  439. package/es/src/features/content-insights/messages.d.ts +83 -0
  440. package/es/src/features/content-insights/numberUtils.d.ts +3 -0
  441. package/es/src/features/content-insights/types.d.ts +24 -0
  442. package/es/src/icon/fill/AlertBadge16.d.ts +13 -0
  443. package/es/src/icon/fill/AlertBadge16.stories.d.ts +9 -0
  444. package/es/src/icon/fill/InfoBadge16.d.ts +13 -0
  445. package/es/src/icon/fill/InfoBadge16.stories.d.ts +9 -0
  446. package/es/src/icon/line/AlertBubble16.d.ts +13 -0
  447. package/es/src/icon/line/AlertBubble16.stories.d.ts +9 -0
  448. package/es/src/icon/line/AvatarXBadge16.d.ts +13 -0
  449. package/es/src/icon/line/AvatarXBadge16.stories.d.ts +9 -0
  450. package/es/src/icon/line/CoEdit16.d.ts +13 -0
  451. package/es/src/icon/line/CoEdit16.stories.d.ts +9 -0
  452. package/es/src/icon/line/Collaborations16.d.ts +13 -0
  453. package/es/src/icon/line/Collaborations16.stories.d.ts +9 -0
  454. package/es/src/icon/line/CommentBubble16.d.ts +13 -0
  455. package/es/src/icon/line/CommentBubble16.stories.d.ts +9 -0
  456. package/es/src/styles/variables.d.ts +3 -1
  457. package/es/styles/constants/_layout.scss +1 -1
  458. package/es/styles/constants/_media-queries.scss +2 -0
  459. package/es/styles/variables.js +6 -2
  460. package/es/styles/variables.js.flow +4 -2
  461. package/es/styles/variables.js.map +1 -1
  462. package/es/utils/error.js +5 -1
  463. package/es/utils/error.js.flow +5 -1
  464. package/es/utils/error.js.map +1 -1
  465. package/es/utils/fields.js +8 -3
  466. package/es/utils/fields.js.flow +21 -3
  467. package/es/utils/fields.js.map +1 -1
  468. package/es/utils/sorter.js.flow +2 -2
  469. package/es/utils/sorter.js.map +1 -1
  470. package/i18n/bn-IN.js +45 -7
  471. package/i18n/bn-IN.properties +83 -7
  472. package/i18n/da-DK.js +45 -7
  473. package/i18n/da-DK.properties +83 -7
  474. package/i18n/de-DE.js +45 -7
  475. package/i18n/de-DE.properties +83 -7
  476. package/i18n/en-AU.js +45 -7
  477. package/i18n/en-AU.properties +83 -7
  478. package/i18n/en-CA.js +45 -7
  479. package/i18n/en-CA.properties +83 -7
  480. package/i18n/en-GB.js +45 -7
  481. package/i18n/en-GB.properties +83 -7
  482. package/i18n/en-US.js +45 -7
  483. package/i18n/en-US.properties +83 -7
  484. package/i18n/en-x-pseudo.js +891 -854
  485. package/i18n/en-x-pseudo.properties +941 -843
  486. package/i18n/es-419.js +45 -7
  487. package/i18n/es-419.properties +83 -7
  488. package/i18n/es-ES.js +45 -7
  489. package/i18n/es-ES.properties +83 -7
  490. package/i18n/fi-FI.js +45 -7
  491. package/i18n/fi-FI.properties +83 -7
  492. package/i18n/fr-CA.js +45 -7
  493. package/i18n/fr-CA.properties +83 -7
  494. package/i18n/fr-FR.js +45 -7
  495. package/i18n/fr-FR.properties +83 -7
  496. package/i18n/hi-IN.js +45 -7
  497. package/i18n/hi-IN.properties +83 -7
  498. package/i18n/it-IT.js +45 -7
  499. package/i18n/it-IT.properties +83 -7
  500. package/i18n/ja-JP.js +47 -9
  501. package/i18n/ja-JP.properties +85 -9
  502. package/i18n/ko-KR.js +45 -7
  503. package/i18n/ko-KR.properties +83 -7
  504. package/i18n/nb-NO.js +45 -7
  505. package/i18n/nb-NO.properties +83 -7
  506. package/i18n/nl-NL.js +45 -7
  507. package/i18n/nl-NL.properties +83 -7
  508. package/i18n/pl-PL.js +45 -7
  509. package/i18n/pl-PL.properties +83 -7
  510. package/i18n/pt-BR.js +45 -7
  511. package/i18n/pt-BR.properties +83 -7
  512. package/i18n/ru-RU.js +45 -7
  513. package/i18n/ru-RU.properties +83 -7
  514. package/i18n/sv-SE.js +45 -7
  515. package/i18n/sv-SE.properties +83 -7
  516. package/i18n/tr-TR.js +45 -7
  517. package/i18n/tr-TR.properties +83 -7
  518. package/i18n/zh-CN.js +45 -7
  519. package/i18n/zh-CN.properties +83 -7
  520. package/i18n/zh-TW.js +45 -7
  521. package/i18n/zh-TW.properties +83 -7
  522. package/package.json +7 -8
  523. package/src/__mocks__/react-intl.js +4 -0
  524. package/src/api/APIFactory.js +26 -0
  525. package/src/api/Annotations.js +60 -6
  526. package/src/api/Comments.js +5 -4
  527. package/src/api/Feed.js +677 -17
  528. package/src/api/FileCollaborators.js +30 -0
  529. package/src/api/ThreadedComments.js +54 -29
  530. package/src/api/__tests__/Annotations.test.js +77 -3
  531. package/src/api/__tests__/Feed.test.js +698 -85
  532. package/src/api/__tests__/FileCollaborators.test.js +41 -0
  533. package/src/api/__tests__/ThreadedComments.test.js +47 -10
  534. package/src/api/__tests__/utils.test.js +11 -0
  535. package/src/api/fixtures.js +401 -0
  536. package/src/api/messages.js +5 -0
  537. package/src/api/utils.js +30 -0
  538. package/src/common/types/annotations.js +18 -12
  539. package/src/common/types/feed.js +40 -4
  540. package/src/components/accessible-svg/AccessibleSVG.stories.tsx +18 -0
  541. package/src/components/badge/Badge.stories.md +1 -7
  542. package/src/components/badge/Badge.stories.tsx +1 -10
  543. package/src/components/badge/BetaBadge.stories.tsx +9 -0
  544. package/src/components/badge/TrialBadge.stories.tsx +9 -0
  545. package/src/components/badge/UpgradeBadge.stories.tsx +9 -0
  546. package/src/components/breadcrumb/Breadcrumb.js +68 -42
  547. package/src/components/breadcrumb/EllipsisCrumb.js +10 -6
  548. package/src/components/count-badge/CountBadge.stories.tsx +1 -1
  549. package/src/components/draggable-list/DraggableList.stories.tsx +72 -5
  550. package/src/components/dropdown-menu/DropdownMenu.js +11 -0
  551. package/src/components/dropdown-menu/DropdownMenu.scss +3 -3
  552. package/src/components/dropdown-menu/__tests__/DropdownMenu.test.js +38 -0
  553. package/src/components/grid-view/__tests__/__snapshots__/GridViewSlider.test.js.snap +1 -0
  554. package/src/components/infinite-scroll/InfiniteScroll.md +1 -1
  555. package/src/components/infinite-scroll/InfiniteScroll.tsx +5 -2
  556. package/src/components/infinite-scroll/__tests__/InfiniteScroll.test.tsx +115 -127
  557. package/src/components/modal/Modal.scss +5 -1
  558. package/src/components/search-form/SearchForm.js +1 -1
  559. package/src/components/search-form/__tests__/SearchForm.test.js +25 -6
  560. package/src/components/sidebar-toggle-button/__tests__/__snapshots__/SidebarToggleButton.test.js.snap +4 -0
  561. package/src/components/table/__tests__/makeSelectable.test.js +654 -144
  562. package/src/components/table/makeSelectable.js +299 -98
  563. package/src/components/time/__tests__/ReadableTime.test.js +0 -1
  564. package/src/components/tooltip/Tooltip.tsx +5 -2
  565. package/src/components/tooltip/__tests__/Tooltip.test.tsx +10 -0
  566. package/src/components/tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +1 -1
  567. package/src/constants.js +11 -0
  568. package/src/elements/common/annotator-context/__tests__/useAnnotatorEvents.test.tsx +509 -0
  569. package/src/elements/common/annotator-context/__tests__/withAnnotations.test.tsx +275 -12
  570. package/src/elements/common/annotator-context/__tests__/withAnnotatorContext.test.tsx +18 -6
  571. package/src/elements/common/annotator-context/index.js.flow +4 -0
  572. package/src/elements/common/annotator-context/index.ts +1 -0
  573. package/src/elements/common/annotator-context/types.js.flow +77 -35
  574. package/src/elements/common/annotator-context/types.ts +28 -6
  575. package/src/elements/common/annotator-context/useAnnotatorEvents.js.flow +52 -0
  576. package/src/elements/common/annotator-context/useAnnotatorEvents.ts +190 -0
  577. package/src/elements/common/annotator-context/withAnnotations.js.flow +73 -36
  578. package/src/elements/common/annotator-context/withAnnotations.tsx +170 -7
  579. package/src/elements/common/annotator-context/withAnnotatorContext.js.flow +29 -9
  580. package/src/elements/common/annotator-context/withAnnotatorContext.tsx +28 -5
  581. package/src/elements/common/current-user/__tests__/withCurrentUser.test.tsx +108 -0
  582. package/src/elements/common/current-user/index.js.flow +8 -0
  583. package/src/elements/common/current-user/index.ts +2 -0
  584. package/src/elements/common/current-user/withCurrentUser.js.flow +40 -0
  585. package/src/elements/common/current-user/withCurrentUser.tsx +139 -0
  586. package/src/elements/common/flowTypes.js +22 -4
  587. package/src/elements/common/interactionTargets.js +2 -0
  588. package/src/elements/common/logger/Logger.js +1 -1
  589. package/src/elements/common/messages.js +5 -0
  590. package/src/elements/content-explorer/DeleteConfirmationDialog.js +3 -1
  591. package/src/elements/content-explorer/DeleteConfirmationDialog.scss +5 -0
  592. package/src/elements/content-explorer/stories/DeleteConfirmationDialog.stories.js +60 -0
  593. package/src/elements/content-explorer/stories/DeleteConfirmationDialog.stories.md +1 -0
  594. package/src/elements/content-sidebar/ActivitySidebar.js +381 -154
  595. package/src/elements/content-sidebar/ActivitySidebarFilter.js +59 -0
  596. package/src/elements/content-sidebar/ActivitySidebarFilter.scss +4 -0
  597. package/src/elements/content-sidebar/DetailsSidebar.js +32 -4
  598. package/src/elements/content-sidebar/Sidebar.js +6 -1
  599. package/src/elements/content-sidebar/SidebarContentInsights.scss +6 -0
  600. package/src/elements/content-sidebar/SidebarContentInsights.tsx +57 -0
  601. package/src/elements/content-sidebar/SidebarPanels.js +4 -0
  602. package/src/elements/content-sidebar/__tests__/ActivitySidebar.test.js +533 -243
  603. package/src/elements/content-sidebar/__tests__/ActivitySidebarFilter.test.js +54 -0
  604. package/src/elements/content-sidebar/__tests__/DetailsSidebar.test.js +45 -0
  605. package/src/elements/content-sidebar/__tests__/Sidebar.test.js +1 -1
  606. package/src/elements/content-sidebar/__tests__/SidebarContentInsights.test.tsx +56 -0
  607. package/src/elements/content-sidebar/__tests__/SidebarPanels.test.js +4 -3
  608. package/src/elements/content-sidebar/__tests__/__snapshots__/ActivitySidebar.test.js.snap +29 -15
  609. package/src/elements/content-sidebar/__tests__/__snapshots__/SidebarFileProperties.test.js.snap +1 -0
  610. package/src/elements/content-sidebar/__tests__/withSidebarAnnotations.test.js +325 -32
  611. package/src/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +122 -24
  612. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js +59 -18
  613. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js +126 -0
  614. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.scss +17 -0
  615. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js +85 -0
  616. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.scss +16 -0
  617. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js +59 -0
  618. package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.scss +22 -0
  619. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActiveState.test.js +19 -5
  620. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityFeed.test.js +22 -16
  621. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThread.test.js +80 -0
  622. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThreadReplies.test.js +24 -0
  623. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThreadRepliesForm.test.js +47 -0
  624. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/__snapshots__/ActiveState.test.js.snap +74 -43
  625. package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/activityFeedUtils.test.js +8 -8
  626. package/src/elements/content-sidebar/activity-feed/activity-feed/activityFeedUtils.js +2 -2
  627. package/src/elements/content-sidebar/activity-feed/activity-feed/fixtures.ts +56 -0
  628. package/src/elements/content-sidebar/activity-feed/activity-feed/messages.js +20 -0
  629. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js +117 -0
  630. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.scss +7 -0
  631. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js +105 -0
  632. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.scss +5 -0
  633. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js +86 -0
  634. package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.scss +3 -0
  635. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThread.test.js +28 -0
  636. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThreadContent.test.js +89 -0
  637. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThreadCreate.test.js +103 -0
  638. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/useAnnotationAPI.test.js +202 -0
  639. package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/useRepliesAPI.test.js +99 -0
  640. package/src/elements/content-sidebar/activity-feed/annotation-thread/errors.js +26 -0
  641. package/src/elements/content-sidebar/activity-feed/annotation-thread/index.js +1 -0
  642. package/src/elements/content-sidebar/activity-feed/annotation-thread/messages.js +21 -0
  643. package/src/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js +203 -0
  644. package/src/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js +121 -0
  645. package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js +24 -4
  646. package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js +36 -2
  647. package/src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js +14 -10
  648. package/src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivityMenu.test.js +35 -1
  649. package/src/elements/content-sidebar/activity-feed/annotations/messages.js +10 -0
  650. package/src/elements/content-sidebar/activity-feed/comment/Comment.js +54 -10
  651. package/src/elements/content-sidebar/activity-feed/comment/__tests__/Comment.test.js +152 -7
  652. package/src/elements/content-sidebar/activity-feed/comment/__tests__/__snapshots__/Comment.test.js.snap +12 -7
  653. package/src/elements/content-sidebar/activity-feed/comment/messages.js +10 -0
  654. package/src/elements/content-sidebar/activity-feed/comment-form/CommentForm.js +3 -1
  655. package/src/elements/content-sidebar/activity-feed/comment-form/__tests__/CommentForm.test.js +11 -0
  656. package/src/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.js +34 -4
  657. package/src/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.scss +40 -3
  658. package/src/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessage.js +42 -0
  659. package/src/elements/content-sidebar/activity-feed/common/activity-message/CollapsableMessageToggle.js +24 -0
  660. package/src/elements/content-sidebar/activity-feed/common/activity-message/__tests__/ActivityMessage.test.js +48 -1
  661. package/src/elements/content-sidebar/activity-feed/common/activity-message/messages.js +15 -0
  662. package/src/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.js +30 -0
  663. package/src/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.scss +6 -0
  664. package/src/elements/content-sidebar/activity-feed/common/activity-status/__tests__/ActivityStatus.test.js +19 -0
  665. package/src/elements/content-sidebar/activity-feed/common/activity-status/index.js +2 -0
  666. package/src/elements/content-sidebar/activity-feed/common/activity-status/messages.js +13 -0
  667. package/src/elements/content-sidebar/activity-feed/common/activity-timestamp/ActivityTimestamp.scss +1 -1
  668. package/src/elements/content-sidebar/activity-feed/task-new/__tests__/Task.test.js +4 -3
  669. package/src/elements/content-sidebar/activity-feed/task-new/__tests__/__snapshots__/Task.test.js.snap +1 -2
  670. package/src/elements/content-sidebar/fixtures.js +185 -0
  671. package/src/elements/content-sidebar/flowTypes.js +9 -25
  672. package/src/elements/content-sidebar/messages.js +10 -0
  673. package/src/elements/content-sidebar/withErrorHandling.js +1 -1
  674. package/src/elements/content-sidebar/withSidebarAnnotations.js +162 -11
  675. package/src/elements/content-uploader/OverallUploadsProgressBar.js +11 -12
  676. package/src/features/classification/Classification.scss +1 -1
  677. package/src/features/classification/security-controls/SecurityControlsItem.scss +1 -0
  678. package/src/features/classification/security-controls/__tests__/__snapshots__/utils.test.js.snap +18 -16
  679. package/src/features/classification/security-controls/__tests__/utils.test.js +13 -5
  680. package/src/features/classification/security-controls/messages.js +10 -0
  681. package/src/features/classification/security-controls/utils.js +8 -12
  682. package/src/features/collapsible-sidebar/__tests__/__snapshots__/CollapsibleSidebarLogo.test.js.snap +2 -0
  683. package/src/features/content-explorer/content-explorer/ContentExplorer.js +4 -0
  684. package/src/features/content-explorer/content-explorer/ContentExplorer.scss +4 -0
  685. package/src/features/content-explorer/content-explorer/ContentExplorerBreadcrumbs.js +14 -11
  686. package/src/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js +4 -1
  687. package/src/features/content-explorer/content-explorer/__tests__/ContentExplorerBreadcrumbs.test.js +2 -2
  688. package/src/features/content-explorer/content-explorer-modal/ContentExplorerModal.js +5 -1
  689. package/src/features/content-explorer/content-explorer-modal/__tests__/__snapshots__/ContentExplorerModal.test.js.snap +1 -0
  690. package/src/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js +5 -1
  691. package/src/features/content-explorer/prop-types.js +8 -0
  692. package/src/features/content-insights/CompactCount.tsx +23 -0
  693. package/src/features/content-insights/ContentAnalyticsErrorState.scss +17 -0
  694. package/src/features/content-insights/ContentAnalyticsErrorState.tsx +44 -0
  695. package/src/features/content-insights/ContentInsightsSummary.scss +12 -0
  696. package/src/features/content-insights/ContentInsightsSummary.tsx +45 -0
  697. package/src/features/content-insights/ContentInsightsSummaryGhostState.scss +9 -0
  698. package/src/features/content-insights/ContentInsightsSummaryGhostState.tsx +18 -0
  699. package/src/features/content-insights/GraphCardGhostState.scss +18 -0
  700. package/src/features/content-insights/GraphCardGhostState.tsx +18 -0
  701. package/src/features/content-insights/GraphCardPreviewsSummary.scss +10 -0
  702. package/src/features/content-insights/GraphCardPreviewsSummary.tsx +40 -0
  703. package/src/features/content-insights/GraphGhostState.scss +11 -0
  704. package/src/features/content-insights/GraphGhostState.tsx +17 -0
  705. package/src/features/content-insights/HeaderWithCount.scss +10 -0
  706. package/src/features/content-insights/HeaderWithCount.tsx +24 -0
  707. package/src/features/content-insights/MetricSummary.scss +14 -0
  708. package/src/features/content-insights/MetricSummary.tsx +65 -0
  709. package/src/features/content-insights/OpenContentInsightsButton.tsx +20 -0
  710. package/src/features/content-insights/TrendPill.scss +33 -0
  711. package/src/features/content-insights/TrendPill.tsx +70 -0
  712. package/src/features/content-insights/__tests__/CompactCount.test.tsx +57 -0
  713. package/src/features/content-insights/__tests__/ContentAnalyticsErrorState.test.tsx +33 -0
  714. package/src/features/content-insights/__tests__/ContentInsightsSummary.test.tsx +81 -0
  715. package/src/features/content-insights/__tests__/GraphCardPreviewsSummary.test.tsx +35 -0
  716. package/src/features/content-insights/__tests__/HeaderWithCount.test.tsx +26 -0
  717. package/src/features/content-insights/__tests__/MetricSummary.test.tsx +88 -0
  718. package/src/features/content-insights/_mixins.scss +7 -0
  719. package/src/features/content-insights/_variables.scss +4 -0
  720. package/src/features/content-insights/charts/bar/Bar.scss +27 -0
  721. package/src/features/content-insights/charts/bar/Bar.tsx +48 -0
  722. package/src/features/content-insights/charts/bar/BarChart.scss +56 -0
  723. package/src/features/content-insights/charts/bar/BarChart.tsx +78 -0
  724. package/src/features/content-insights/charts/bar/__tests__/Bar.test.tsx +74 -0
  725. package/src/features/content-insights/charts/bar/__tests__/BarChart.test.tsx +110 -0
  726. package/src/features/content-insights/charts/types.ts +3 -0
  727. package/src/features/content-insights/constants.ts +60 -0
  728. package/src/features/content-insights/messages.ts +90 -0
  729. package/src/features/content-insights/numberUtils.ts +9 -0
  730. package/src/features/content-insights/types.ts +33 -0
  731. package/src/features/item-details/ItemProperties.scss +1 -1
  732. package/src/features/shared-link-settings-modal/SharedLinkSettingsModal.js +4 -2
  733. package/src/features/shared-link-settings-modal/__tests__/SharedLinkSettingsModal.test.js +22 -3
  734. package/src/features/shared-link-settings-modal/__tests__/__snapshots__/SharedLinkSettingsModal.test.js.snap +2 -1
  735. package/src/features/unified-share-modal/ContactRestrictionNotice.js +36 -6
  736. package/src/features/unified-share-modal/EmailForm.js +31 -13
  737. package/src/features/unified-share-modal/UnifiedShareForm.js +25 -8
  738. package/src/features/unified-share-modal/UnifiedShareModal.js +1 -0
  739. package/src/features/unified-share-modal/__tests__/ContactRestrictionNotice.test.js +55 -6
  740. package/src/features/unified-share-modal/__tests__/EmailForm.test.js +131 -24
  741. package/src/features/unified-share-modal/__tests__/UnifiedShareForm.test.js +89 -35
  742. package/src/features/unified-share-modal/__tests__/__snapshots__/UnifiedShareForm.test.js.snap +16 -0
  743. package/src/features/unified-share-modal/__tests__/__snapshots__/UnifiedShareModal.test.js.snap +17 -0
  744. package/src/features/unified-share-modal/flowTypes.js +4 -2
  745. package/src/features/unified-share-modal/messages.js +14 -8
  746. package/src/features/unified-share-modal/utils/__tests__/hasRestrictedContacts.test.js +24 -10
  747. package/src/features/unified-share-modal/utils/__tests__/isRestrictedContact.test.js +33 -0
  748. package/src/features/unified-share-modal/utils/hasRestrictedContacts.js +10 -3
  749. package/src/features/unified-share-modal/utils/isRestrictedContact.js +21 -0
  750. package/src/features/virtualized-table/__tests__/__snapshots__/VirtualizedTable.test.js.snap +1 -0
  751. package/src/icon/fill/Alert16.js.flow +3 -2
  752. package/src/icon/fill/Alert16.tsx +3 -2
  753. package/src/icon/fill/AlertBadge16.js.flow +29 -0
  754. package/src/icon/fill/AlertBadge16.stories.tsx +13 -0
  755. package/src/icon/fill/AlertBadge16.tsx +27 -0
  756. package/src/icon/fill/Info16.js.flow +1 -1
  757. package/src/icon/fill/Info16.tsx +1 -1
  758. package/src/icon/fill/InfoBadge16.js.flow +28 -0
  759. package/src/icon/fill/InfoBadge16.stories.tsx +13 -0
  760. package/src/icon/fill/InfoBadge16.tsx +26 -0
  761. package/src/icon/line/AlertBubble16.js.flow +29 -0
  762. package/src/icon/line/AlertBubble16.stories.tsx +13 -0
  763. package/src/icon/line/AlertBubble16.tsx +27 -0
  764. package/src/icon/line/AvatarXBadge16.js.flow +39 -0
  765. package/src/icon/line/AvatarXBadge16.stories.tsx +13 -0
  766. package/src/icon/line/AvatarXBadge16.tsx +37 -0
  767. package/src/icon/line/CoEdit16.js.flow +30 -0
  768. package/src/icon/line/CoEdit16.stories.tsx +13 -0
  769. package/src/icon/line/CoEdit16.tsx +28 -0
  770. package/src/icon/line/Collaborations16.js.flow +30 -0
  771. package/src/icon/line/Collaborations16.stories.tsx +13 -0
  772. package/src/icon/line/Collaborations16.tsx +28 -0
  773. package/src/icon/line/CommentBubble16.js.flow +34 -0
  774. package/src/icon/line/CommentBubble16.stories.tsx +13 -0
  775. package/src/icon/line/CommentBubble16.tsx +32 -0
  776. package/src/styles/constants/_layout.scss +1 -1
  777. package/src/styles/constants/_media-queries.scss +2 -0
  778. package/src/styles/variables.js +4 -2
  779. package/src/styles/variables.json +4 -2
  780. package/src/styles/variables.ts +3 -1
  781. package/src/utils/__tests__/fields.test.js +23 -4
  782. package/src/utils/__tests__/sorter.test.js +3 -3
  783. package/src/utils/error.js +5 -1
  784. package/src/utils/fields.js +21 -3
  785. package/src/utils/sorter.js +2 -2
  786. package/es/common/types/threadedComments.js +0 -2
  787. package/es/common/types/threadedComments.js.flow +0 -9
  788. package/src/common/types/threadedComments.js +0 -9
@@ -2,6 +2,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
6
+
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
+
5
9
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
10
 
7
11
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -24,6 +28,7 @@ import * as React from 'react';
24
28
  import getProp from 'lodash/get';
25
29
  import noop from 'lodash/noop';
26
30
  import { matchPath } from 'react-router-dom';
31
+ import { FEED_ITEM_TYPE_VERSION } from '../../constants';
27
32
  import { getBadUserError } from '../../utils/error';
28
33
  export default function withSidebarAnnotations(WrappedComponent) {
29
34
  var WithSidebarAnnotations =
@@ -101,7 +106,7 @@ export default function withSidebarAnnotations(WrappedComponent) {
101
106
  feedItems = _ref$items === void 0 ? [] : _ref$items;
102
107
 
103
108
  var version = feedItems.filter(function (item) {
104
- return item.type === 'file_version';
109
+ return item.type === FEED_ITEM_TYPE_VERSION;
105
110
  }).find(function (item) {
106
111
  return item.id === fileVersionId;
107
112
  });
@@ -116,6 +121,19 @@ export default function withSidebarAnnotations(WrappedComponent) {
116
121
  }
117
122
  });
118
123
 
124
+ _defineProperty(_assertThisInitialized(_this), "refreshActivitySidebar", function () {
125
+ var _this$props4 = _this.props,
126
+ isOpen = _this$props4.isOpen,
127
+ location = _this$props4.location;
128
+ var pathname = getProp(location, 'pathname', '');
129
+ var isActivity = matchPath(pathname, '/activity');
130
+ var current = _this.sidebarPanels.current; // If the activity sidebar is currently open, then force it to refresh with the updated data
131
+
132
+ if (current && isActivity && isOpen) {
133
+ current.refresh(false);
134
+ }
135
+ });
136
+
119
137
  _this.redirectDeeplinkedAnnotation();
120
138
 
121
139
  return _this;
@@ -124,16 +142,17 @@ export default function withSidebarAnnotations(WrappedComponent) {
124
142
  _createClass(WithSidebarAnnotations, [{
125
143
  key: "componentDidUpdate",
126
144
  value: function componentDidUpdate(prevProps) {
127
- var _this$props4 = this.props,
128
- annotatorState = _this$props4.annotatorState,
129
- fileId = _this$props4.fileId,
130
- getAnnotationsMatchPath = _this$props4.getAnnotationsMatchPath,
131
- location = _this$props4.location,
132
- onVersionChange = _this$props4.onVersionChange;
145
+ var _this$props5 = this.props,
146
+ annotatorState = _this$props5.annotatorState,
147
+ fileId = _this$props5.fileId,
148
+ getAnnotationsMatchPath = _this$props5.getAnnotationsMatchPath,
149
+ location = _this$props5.location,
150
+ onVersionChange = _this$props5.onVersionChange;
133
151
  var prevAnnotatorState = prevProps.annotatorState,
134
152
  prevFileId = prevProps.fileId,
135
153
  prevLocation = prevProps.location;
136
- var activeAnnotationId = annotatorState.activeAnnotationId,
154
+ var action = annotatorState.action,
155
+ activeAnnotationId = annotatorState.activeAnnotationId,
137
156
  annotation = annotatorState.annotation;
138
157
  var prevActiveAnnotationId = prevAnnotatorState.activeAnnotationId,
139
158
  prevAnnotation = prevAnnotatorState.annotation;
@@ -145,7 +164,27 @@ export default function withSidebarAnnotations(WrappedComponent) {
145
164
  var isTransitioningToAnnotationPath = activeAnnotationId && !isAnnotationsPath;
146
165
  var prevFileVersionId = getProp(prevMatch, 'params.fileVersionId');
147
166
 
148
- if (annotation && prevAnnotation !== annotation) {
167
+ if (action === 'reply_create_start' || action === 'reply_create_end') {
168
+ this.addAnnotationReply();
169
+ }
170
+
171
+ if (action === 'reply_delete_start' || action === 'reply_delete_end') {
172
+ this.deleteAnnotationReply();
173
+ }
174
+
175
+ if (action === 'reply_update_start' || action === 'reply_update_end') {
176
+ this.updateAnnotationReply();
177
+ }
178
+
179
+ if (action === 'update_start' || action === 'update_end') {
180
+ this.updateAnnotation();
181
+ }
182
+
183
+ if (action === 'delete_start' || action === 'delete_end') {
184
+ this.deleteAnnotation();
185
+ }
186
+
187
+ if ((action === 'create_start' || action === 'create_end') && annotation && prevAnnotation !== annotation) {
149
188
  this.addAnnotation();
150
189
  } // Active annotation id changed. If location is currently an annotation path or
151
190
  // if location is not currently an annotation path but the active annotation id
@@ -169,19 +208,17 @@ export default function withSidebarAnnotations(WrappedComponent) {
169
208
  }, {
170
209
  key: "addAnnotation",
171
210
  value: function addAnnotation() {
172
- var _this$props5 = this.props,
173
- _this$props5$annotato = _this$props5.annotatorState,
174
- action = _this$props5$annotato.action,
175
- annotation = _this$props5$annotato.annotation,
176
- _this$props5$annotato2 = _this$props5$annotato.meta;
177
- _this$props5$annotato2 = _this$props5$annotato2 === void 0 ? {} : _this$props5$annotato2;
178
- var requestId = _this$props5$annotato2.requestId,
179
- api = _this$props5.api,
180
- currentUser = _this$props5.currentUser,
181
- file = _this$props5.file,
182
- fileId = _this$props5.fileId,
183
- isOpen = _this$props5.isOpen,
184
- location = _this$props5.location;
211
+ var _this$props6 = this.props,
212
+ _this$props6$annotato = _this$props6.annotatorState,
213
+ action = _this$props6$annotato.action,
214
+ annotation = _this$props6$annotato.annotation,
215
+ _this$props6$annotato2 = _this$props6$annotato.meta;
216
+ _this$props6$annotato2 = _this$props6$annotato2 === void 0 ? {} : _this$props6$annotato2;
217
+ var requestId = _this$props6$annotato2.requestId,
218
+ api = _this$props6.api,
219
+ currentUser = _this$props6.currentUser,
220
+ file = _this$props6.file,
221
+ fileId = _this$props6.fileId;
185
222
 
186
223
  if (!requestId) {
187
224
  return;
@@ -193,24 +230,172 @@ export default function withSidebarAnnotations(WrappedComponent) {
193
230
  }
194
231
 
195
232
  var feedAPI = api.getFeedAPI(false);
196
- var pathname = getProp(location, 'pathname', '');
197
- var isActivity = matchPath(pathname, '/activity');
198
233
  var isPending = action === 'create_start';
199
234
 
200
235
  var _ref2 = feedAPI.getCachedItems(fileId) || {},
201
- hasItems = _ref2.items;
202
-
203
- var current = this.sidebarPanels.current; // If there are existing items in the cache for this file, then patch the cache with the new annotation
236
+ hasItems = _ref2.items; // If there are existing items in the cache for this file, then patch the cache with the new annotation
204
237
  // If there are no cache entry for feeditems, then it is assumed that it has not yet been fetched.
205
238
 
239
+
206
240
  if (hasItems) {
207
241
  feedAPI.addAnnotation(file, currentUser, annotation, requestId, isPending);
208
- } // If the activity sidebar is currently open, then force it to refresh with the updated data
242
+ }
209
243
 
244
+ this.refreshActivitySidebar();
245
+ }
246
+ }, {
247
+ key: "addAnnotationReply",
248
+ value: function addAnnotationReply() {
249
+ var _this$props7 = this.props,
250
+ _this$props7$annotato = _this$props7.annotatorState,
251
+ action = _this$props7$annotato.action,
252
+ annotationId = _this$props7$annotato.annotation.id,
253
+ annotationReply = _this$props7$annotato.annotationReply,
254
+ requestId = _this$props7$annotato.meta.requestId,
255
+ api = _this$props7.api,
256
+ currentUser = _this$props7.currentUser,
257
+ file = _this$props7.file;
210
258
 
211
- if (current && isActivity && isOpen) {
212
- current.refresh(false);
259
+ if (!currentUser) {
260
+ throw getBadUserError();
261
+ }
262
+
263
+ var feedAPI = api.getFeedAPI(false);
264
+ feedAPI.file = file;
265
+
266
+ if (action === 'reply_create_start') {
267
+ feedAPI.addPendingReply(annotationId, currentUser, _objectSpread({}, annotationReply, {
268
+ id: requestId
269
+ }));
270
+ } else {
271
+ var _ref3 = feedAPI.getCachedItems(file.id) || {},
272
+ _ref3$items = _ref3.items,
273
+ feedItems = _ref3$items === void 0 ? [] : _ref3$items;
274
+
275
+ var annotationItem = feedItems.find(function (_ref4) {
276
+ var id = _ref4.id;
277
+ return id === annotationId;
278
+ });
279
+
280
+ if (!annotationItem) {
281
+ return;
282
+ }
283
+
284
+ feedAPI.updateFeedItem({
285
+ total_reply_count: annotationItem.total_reply_count + 1
286
+ }, annotationId);
287
+ feedAPI.updateReplyItem(_objectSpread({}, annotationReply, {
288
+ isPending: false
289
+ }), annotationId, requestId);
290
+ }
291
+
292
+ this.refreshActivitySidebar();
293
+ }
294
+ }, {
295
+ key: "deleteAnnotation",
296
+ value: function deleteAnnotation() {
297
+ var _this$props8 = this.props,
298
+ _this$props8$annotato = _this$props8.annotatorState,
299
+ action = _this$props8$annotato.action,
300
+ annotation = _this$props8$annotato.annotation,
301
+ api = _this$props8.api,
302
+ file = _this$props8.file;
303
+ var feedAPI = api.getFeedAPI(false);
304
+ feedAPI.file = file;
305
+
306
+ if (action === 'delete_start') {
307
+ feedAPI.updateFeedItem({
308
+ isPending: true
309
+ }, annotation.id);
310
+ } else {
311
+ feedAPI.deleteFeedItem(annotation.id);
312
+ }
313
+
314
+ this.refreshActivitySidebar();
315
+ }
316
+ }, {
317
+ key: "deleteAnnotationReply",
318
+ value: function deleteAnnotationReply() {
319
+ var _this$props9 = this.props,
320
+ _this$props9$annotato = _this$props9.annotatorState,
321
+ action = _this$props9$annotato.action,
322
+ annotationId = _this$props9$annotato.annotation.id,
323
+ replyId = _this$props9$annotato.annotationReply.id,
324
+ api = _this$props9.api,
325
+ file = _this$props9.file;
326
+ var feedAPI = api.getFeedAPI(false);
327
+ feedAPI.file = file;
328
+
329
+ if (action === 'reply_delete_start') {
330
+ feedAPI.updateReplyItem({
331
+ isPending: true
332
+ }, annotationId, replyId);
333
+ } else {
334
+ var _ref5 = feedAPI.getCachedItems(file.id) || {},
335
+ _ref5$items = _ref5.items,
336
+ feedItems = _ref5$items === void 0 ? [] : _ref5$items;
337
+
338
+ var annotationItem = feedItems.find(function (_ref6) {
339
+ var id = _ref6.id;
340
+ return id === annotationId;
341
+ });
342
+
343
+ if (!annotationItem) {
344
+ return;
345
+ } // Check if the parent annotation has the reply currently visible
346
+
347
+
348
+ var replyItem = annotationItem.replies.find(function (_ref7) {
349
+ var id = _ref7.id;
350
+ return id === replyId;
351
+ });
352
+
353
+ if (replyItem) {
354
+ feedAPI.deleteReplyItem(replyId, annotationId);
355
+ } else if (annotationItem.total_reply_count > 0) {
356
+ // Decrease the amount of replies by 1
357
+ feedAPI.updateFeedItem({
358
+ total_reply_count: annotationItem.total_reply_count - 1
359
+ }, annotationId);
360
+ }
213
361
  }
362
+
363
+ this.refreshActivitySidebar();
364
+ }
365
+ }, {
366
+ key: "updateAnnotation",
367
+ value: function updateAnnotation() {
368
+ var _this$props10 = this.props,
369
+ _this$props10$annotat = _this$props10.annotatorState,
370
+ action = _this$props10$annotat.action,
371
+ annotation = _this$props10$annotat.annotation,
372
+ api = _this$props10.api,
373
+ file = _this$props10.file;
374
+ var feedAPI = api.getFeedAPI(false);
375
+ var isPending = action === 'update_start';
376
+ feedAPI.file = file;
377
+ feedAPI.updateFeedItem(_objectSpread({}, annotation, {
378
+ isPending: isPending
379
+ }), annotation.id);
380
+ this.refreshActivitySidebar();
381
+ }
382
+ }, {
383
+ key: "updateAnnotationReply",
384
+ value: function updateAnnotationReply() {
385
+ var _this$props11 = this.props,
386
+ _this$props11$annotat = _this$props11.annotatorState,
387
+ action = _this$props11$annotat.action,
388
+ annotation = _this$props11$annotat.annotation,
389
+ annotationReply = _this$props11$annotat.annotationReply,
390
+ api = _this$props11.api,
391
+ file = _this$props11.file;
392
+ var feedAPI = api.getFeedAPI(false);
393
+ var isPending = action === 'reply_update_start';
394
+ feedAPI.file = file;
395
+ feedAPI.updateReplyItem(_objectSpread({}, annotationReply, {
396
+ isPending: isPending
397
+ }), annotation.id, annotationReply.id);
398
+ this.refreshActivitySidebar();
214
399
  }
215
400
  }, {
216
401
  key: "render",
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import getProp from 'lodash/get';
4
4
  import noop from 'lodash/noop';
5
5
  import { matchPath, type ContextRouter } from 'react-router-dom';
6
+ import { FEED_ITEM_TYPE_VERSION } from '../../constants';
6
7
  import { getBadUserError } from '../../utils/error';
7
8
  import type { WithAnnotatorContextProps } from '../common/annotator-context';
8
9
  import type { BoxItem, User } from '../../common/types/core';
@@ -58,7 +59,7 @@ export default function withSidebarAnnotations(
58
59
  componentDidUpdate(prevProps: Props) {
59
60
  const { annotatorState, fileId, getAnnotationsMatchPath, location, onVersionChange }: Props = this.props;
60
61
  const { annotatorState: prevAnnotatorState, fileId: prevFileId, location: prevLocation }: Props = prevProps;
61
- const { activeAnnotationId, annotation } = annotatorState;
62
+ const { action, activeAnnotationId, annotation } = annotatorState;
62
63
  const { activeAnnotationId: prevActiveAnnotationId, annotation: prevAnnotation } = prevAnnotatorState;
63
64
 
64
65
  const match = getAnnotationsMatchPath(location);
@@ -69,7 +70,27 @@ export default function withSidebarAnnotations(
69
70
  const isTransitioningToAnnotationPath = activeAnnotationId && !isAnnotationsPath;
70
71
  const prevFileVersionId = getProp(prevMatch, 'params.fileVersionId');
71
72
 
72
- if (annotation && prevAnnotation !== annotation) {
73
+ if (action === 'reply_create_start' || action === 'reply_create_end') {
74
+ this.addAnnotationReply();
75
+ }
76
+
77
+ if (action === 'reply_delete_start' || action === 'reply_delete_end') {
78
+ this.deleteAnnotationReply();
79
+ }
80
+
81
+ if (action === 'reply_update_start' || action === 'reply_update_end') {
82
+ this.updateAnnotationReply();
83
+ }
84
+
85
+ if (action === 'update_start' || action === 'update_end') {
86
+ this.updateAnnotation();
87
+ }
88
+
89
+ if (action === 'delete_start' || action === 'delete_end') {
90
+ this.deleteAnnotation();
91
+ }
92
+
93
+ if ((action === 'create_start' || action === 'create_end') && annotation && prevAnnotation !== annotation) {
73
94
  this.addAnnotation();
74
95
  }
75
96
 
@@ -98,8 +119,6 @@ export default function withSidebarAnnotations(
98
119
  currentUser,
99
120
  file,
100
121
  fileId,
101
- isOpen,
102
- location,
103
122
  } = this.props;
104
123
 
105
124
  if (!requestId) {
@@ -112,11 +131,8 @@ export default function withSidebarAnnotations(
112
131
  }
113
132
 
114
133
  const feedAPI = api.getFeedAPI(false);
115
- const pathname = getProp(location, 'pathname', '');
116
- const isActivity = matchPath(pathname, '/activity');
117
134
  const isPending = action === 'create_start';
118
135
  const { items: hasItems } = feedAPI.getCachedItems(fileId) || {};
119
- const { current } = this.sidebarPanels;
120
136
 
121
137
  // If there are existing items in the cache for this file, then patch the cache with the new annotation
122
138
  // If there are no cache entry for feeditems, then it is assumed that it has not yet been fetched.
@@ -124,10 +140,132 @@ export default function withSidebarAnnotations(
124
140
  feedAPI.addAnnotation(file, currentUser, annotation, requestId, isPending);
125
141
  }
126
142
 
127
- // If the activity sidebar is currently open, then force it to refresh with the updated data
128
- if (current && isActivity && isOpen) {
129
- current.refresh(false);
143
+ this.refreshActivitySidebar();
144
+ }
145
+
146
+ addAnnotationReply() {
147
+ const {
148
+ annotatorState: {
149
+ action,
150
+ annotation: { id: annotationId },
151
+ annotationReply,
152
+ meta: { requestId },
153
+ },
154
+ api,
155
+ currentUser,
156
+ file,
157
+ } = this.props;
158
+
159
+ if (!currentUser) {
160
+ throw getBadUserError();
161
+ }
162
+
163
+ const feedAPI = api.getFeedAPI(false);
164
+ feedAPI.file = file;
165
+
166
+ if (action === 'reply_create_start') {
167
+ feedAPI.addPendingReply(annotationId, currentUser, { ...annotationReply, id: requestId });
168
+ } else {
169
+ const { items: feedItems = [] } = feedAPI.getCachedItems(file.id) || {};
170
+ const annotationItem = feedItems.find(({ id }) => id === annotationId);
171
+
172
+ if (!annotationItem) {
173
+ return;
174
+ }
175
+
176
+ feedAPI.updateFeedItem({ total_reply_count: annotationItem.total_reply_count + 1 }, annotationId);
177
+ feedAPI.updateReplyItem({ ...annotationReply, isPending: false }, annotationId, requestId);
178
+ }
179
+
180
+ this.refreshActivitySidebar();
181
+ }
182
+
183
+ deleteAnnotation() {
184
+ const {
185
+ annotatorState: { action, annotation },
186
+ api,
187
+ file,
188
+ } = this.props;
189
+
190
+ const feedAPI = api.getFeedAPI(false);
191
+ feedAPI.file = file;
192
+
193
+ if (action === 'delete_start') {
194
+ feedAPI.updateFeedItem({ isPending: true }, annotation.id);
195
+ } else {
196
+ feedAPI.deleteFeedItem(annotation.id);
130
197
  }
198
+
199
+ this.refreshActivitySidebar();
200
+ }
201
+
202
+ deleteAnnotationReply() {
203
+ const {
204
+ annotatorState: {
205
+ action,
206
+ annotation: { id: annotationId },
207
+ annotationReply: { id: replyId },
208
+ },
209
+ api,
210
+ file,
211
+ } = this.props;
212
+
213
+ const feedAPI = api.getFeedAPI(false);
214
+ feedAPI.file = file;
215
+
216
+ if (action === 'reply_delete_start') {
217
+ feedAPI.updateReplyItem({ isPending: true }, annotationId, replyId);
218
+ } else {
219
+ const { items: feedItems = [] } = feedAPI.getCachedItems(file.id) || {};
220
+ const annotationItem = feedItems.find(({ id }) => id === annotationId);
221
+
222
+ if (!annotationItem) {
223
+ return;
224
+ }
225
+
226
+ // Check if the parent annotation has the reply currently visible
227
+ const replyItem = annotationItem.replies.find(({ id }) => id === replyId);
228
+ if (replyItem) {
229
+ feedAPI.deleteReplyItem(replyId, annotationId);
230
+ } else if (annotationItem.total_reply_count > 0) {
231
+ // Decrease the amount of replies by 1
232
+ feedAPI.updateFeedItem({ total_reply_count: annotationItem.total_reply_count - 1 }, annotationId);
233
+ }
234
+ }
235
+
236
+ this.refreshActivitySidebar();
237
+ }
238
+
239
+ updateAnnotation() {
240
+ const {
241
+ annotatorState: { action, annotation },
242
+ api,
243
+ file,
244
+ } = this.props;
245
+
246
+ const feedAPI = api.getFeedAPI(false);
247
+ const isPending = action === 'update_start';
248
+ feedAPI.file = file;
249
+
250
+ feedAPI.updateFeedItem({ ...annotation, isPending }, annotation.id);
251
+
252
+ this.refreshActivitySidebar();
253
+ }
254
+
255
+ updateAnnotationReply() {
256
+ const {
257
+ annotatorState: { action, annotation, annotationReply },
258
+ api,
259
+ file,
260
+ } = this.props;
261
+
262
+ const feedAPI = api.getFeedAPI(false);
263
+ const isPending = action === 'reply_update_start';
264
+ feedAPI.file = file;
265
+
266
+ feedAPI.updateReplyItem({ ...annotationReply, isPending }, annotation.id, annotationReply.id);
267
+
268
+ this.refreshActivitySidebar();
131
269
  }
132
270
 
133
271
  updateActiveAnnotation = () => {
@@ -169,7 +307,7 @@ export default function withSidebarAnnotations(
169
307
  const fileVersionId = getProp(match, 'params.fileVersionId');
170
308
  const { items: feedItems = [] } = feedAPI.getCachedItems(fileId) || {};
171
309
  const version = feedItems
172
- .filter(item => item.type === 'file_version')
310
+ .filter(item => item.type === FEED_ITEM_TYPE_VERSION)
173
311
  .find(item => item.id === fileVersionId);
174
312
 
175
313
  if (version) {
@@ -180,6 +318,19 @@ export default function withSidebarAnnotations(
180
318
  }
181
319
  };
182
320
 
321
+ refreshActivitySidebar = () => {
322
+ const { isOpen, location } = this.props;
323
+
324
+ const pathname = getProp(location, 'pathname', '');
325
+ const isActivity = matchPath(pathname, '/activity');
326
+ const { current } = this.sidebarPanels;
327
+
328
+ // If the activity sidebar is currently open, then force it to refresh with the updated data
329
+ if (current && isActivity && isOpen) {
330
+ current.refresh(false);
331
+ }
332
+ };
333
+
183
334
  render() {
184
335
  return <WrappedComponent ref={this.sidebarPanels} {...this.props} />;
185
336
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/elements/content-sidebar/withSidebarAnnotations.js"],"names":["React","getProp","noop","matchPath","getBadUserError","withSidebarAnnotations","WrappedComponent","WithSidebarAnnotations","props","createRef","file","getAnnotationsPath","getAnnotationsMatchPath","history","location","match","annotationId","currentFileVersionId","fileVersionId","replace","annotatorState","activeAnnotationFileVersionId","activeAnnotationId","defaultFileVersionId","newLocationState","open","state","push","pathname","api","fileId","onVersionChange","feedAPI","getFeedAPI","getCachedItems","items","feedItems","version","filter","item","type","find","id","currentVersionId","updateVersionToCurrent","redirectDeeplinkedAnnotation","prevProps","prevAnnotatorState","prevFileId","prevLocation","annotation","prevActiveAnnotationId","prevAnnotation","prevMatch","hasActiveAnnotationChanged","isAnnotationsPath","isTransitioningToAnnotationPath","prevFileVersionId","addAnnotation","updateActiveAnnotation","updateActiveVersion","action","meta","requestId","currentUser","isOpen","isActivity","isPending","hasItems","current","sidebarPanels","refresh","Component","displayName","name"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,IAAP,MAAiB,aAAjB;AACA,SAASC,SAAT,QAA8C,kBAA9C;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAiBA,eAAe,SAASC,sBAAT,CACXC,gBADW,EAEe;AAAA,MACpBC,sBADoB;AAAA;AAAA;AAAA;;AAetB,oCAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AACf,kGAAMA,KAAN;;AADe,sEAFuCR,KAAK,CAACS,SAAN,EAEvC;;AAAA,qFAMY,YAAM;AAAA,0BACgD,MAAKD,KADrD;AAAA,YACzBE,IADyB,eACzBA,IADyB;AAAA,YACnBC,kBADmB,eACnBA,kBADmB;AAAA,YACC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AAkC,EAxBlD;AAAA,YAwBGsC,QAxBH,SAwBJjC,KAxBI;;AAAA,YAyBJkC,OAzBI,GAyBQ,KAAKC,aAzBb,CAyBJD,OAzBI,EA2BZ;AACA;;AACA,YAAID,QAAJ,EAAc;AACVpC,UAAAA,OAAO,CAAC0B,aAAR,CAAsBhD,IAAtB,EAA4BsD,WAA5B,EAAyCd,UAAzC,EAAqDa,SAArD,EAAgEI,SAAhE;AACH,SA/BW,CAiCZ;;;AACA,YAAIE,OAAO,IAAIH,UAAX,IAAyBD,MAA7B,EAAqC;AACjCI,UAAAA,OAAO,CAACE,OAAR,CAAgB,KAAhB;AACH;AACJ;AA1GqB;AAAA;AAAA,+BA8Jb;AACL,eAAO,oBAAC,gBAAD;AAAkB,UAAA,GAAG,EAAE,KAAKD;AAA5B,WAA+C,KAAK9D,KAApD,EAAP;AACH;AAhKqB;;AAAA;AAAA,IACWR,KAAK,CAACwE,SADjB;;AAAA,kBACpBjE,sBADoB,kBAEA;AAClBa,IAAAA,cAAc,EAAE,EADE;AAElBR,IAAAA,uBAAuB,EAAEV,IAFP;AAGlBS,IAAAA,kBAAkB,EAAET,IAHF;AAIlB6B,IAAAA,eAAe,EAAE7B;AAJC,GAFA;;AAmK1B,MAAMuE,WAAW,GAAGnE,gBAAgB,CAACmE,WAAjB,IAAgCnE,gBAAgB,CAACoE,IAAjD,IAAyD,WAA7E;AACAnE,EAAAA,sBAAsB,CAACkE,WAAvB,oCAA+DA,WAA/D;AAEA,SAAOlE,sBAAP;AACH","sourcesContent":["// @flow\nimport * as React from 'react';\nimport getProp from 'lodash/get';\nimport noop from 'lodash/noop';\nimport { matchPath, type ContextRouter } from 'react-router-dom';\nimport { getBadUserError } from '../../utils/error';\nimport type { WithAnnotatorContextProps } from '../common/annotator-context';\nimport type { BoxItem, User } from '../../common/types/core';\n\ntype Props = {\n ...ContextRouter,\n currentUser?: User,\n file: BoxItem,\n fileId: string,\n isOpen: boolean,\n onVersionChange: Function,\n} & WithAnnotatorContextProps;\n\ntype SidebarPanelsRefType = {\n refresh: (shouldRefreshCache?: boolean) => void,\n};\n\nexport default function withSidebarAnnotations(\n WrappedComponent: React.ComponentType<Props>,\n): React.ComponentType<Props> {\n class WithSidebarAnnotations extends React.Component<Props> {\n static defaultProps = {\n annotatorState: {},\n getAnnotationsMatchPath: noop,\n getAnnotationsPath: noop,\n onVersionChange: noop,\n };\n\n static displayName: ?string;\n\n props: Props;\n\n sidebarPanels: { current: SidebarPanelsRefType | null } = React.createRef();\n\n constructor(props) {\n super(props);\n\n this.redirectDeeplinkedAnnotation();\n }\n\n redirectDeeplinkedAnnotation = () => {\n const { file, getAnnotationsPath, getAnnotationsMatchPath, history, location } = this.props;\n const match = getAnnotationsMatchPath(location);\n const annotationId = getProp(match, 'params.annotationId');\n const currentFileVersionId = getProp(file, 'file_version.id');\n const fileVersionId = getProp(match, 'params.fileVersionId');\n\n if (fileVersionId && fileVersionId !== currentFileVersionId) {\n history.replace(getAnnotationsPath(currentFileVersionId, annotationId));\n }\n };\n\n componentDidUpdate(prevProps: Props) {\n const { annotatorState, fileId, getAnnotationsMatchPath, location, onVersionChange }: Props = this.props;\n const { annotatorState: prevAnnotatorState, fileId: prevFileId, location: prevLocation }: Props = prevProps;\n const { activeAnnotationId, annotation } = annotatorState;\n const { activeAnnotationId: prevActiveAnnotationId, annotation: prevAnnotation } = prevAnnotatorState;\n\n const match = getAnnotationsMatchPath(location);\n const prevMatch = getAnnotationsMatchPath(prevLocation);\n const fileVersionId = getProp(match, 'params.fileVersionId');\n const hasActiveAnnotationChanged = prevActiveAnnotationId !== activeAnnotationId;\n const isAnnotationsPath = !!match;\n const isTransitioningToAnnotationPath = activeAnnotationId && !isAnnotationsPath;\n const prevFileVersionId = getProp(prevMatch, 'params.fileVersionId');\n\n if (annotation && prevAnnotation !== annotation) {\n this.addAnnotation();\n }\n\n // Active annotation id changed. If location is currently an annotation path or\n // if location is not currently an annotation path but the active annotation id\n // transitioned from falsy to truthy, update the location accordingly\n if (hasActiveAnnotationChanged && (isAnnotationsPath || isTransitioningToAnnotationPath)) {\n this.updateActiveAnnotation();\n }\n\n if (fileVersionId && prevFileVersionId !== fileVersionId) {\n this.updateActiveVersion();\n }\n\n if (prevFileId !== fileId) {\n // If the file id has changed, reset the current version id since the previous (possibly versioned)\n // location is no longer active\n onVersionChange(null);\n }\n }\n\n addAnnotation() {\n const {\n annotatorState: { action, annotation, meta: { requestId } = {} },\n api,\n currentUser,\n file,\n fileId,\n isOpen,\n location,\n } = this.props;\n\n if (!requestId) {\n return;\n }\n\n // TODO: need to address in follow on -- currentUser may be undefined here but is never fetched for sure until ActivitySidebar\n if (!currentUser) {\n throw getBadUserError();\n }\n\n const feedAPI = api.getFeedAPI(false);\n const pathname = getProp(location, 'pathname', '');\n const isActivity = matchPath(pathname, '/activity');\n const isPending = action === 'create_start';\n const { items: hasItems } = feedAPI.getCachedItems(fileId) || {};\n const { current } = this.sidebarPanels;\n\n // If there are existing items in the cache for this file, then patch the cache with the new annotation\n // If there are no cache entry for feeditems, then it is assumed that it has not yet been fetched.\n if (hasItems) {\n feedAPI.addAnnotation(file, currentUser, annotation, requestId, isPending);\n }\n\n // If the activity sidebar is currently open, then force it to refresh with the updated data\n if (current && isActivity && isOpen) {\n current.refresh(false);\n }\n }\n\n updateActiveAnnotation = () => {\n const {\n annotatorState: { activeAnnotationFileVersionId, activeAnnotationId },\n file,\n getAnnotationsMatchPath,\n getAnnotationsPath,\n history,\n location,\n } = this.props;\n const match = getAnnotationsMatchPath(location);\n const currentFileVersionId = getProp(file, 'file_version.id');\n const defaultFileVersionId = activeAnnotationFileVersionId || currentFileVersionId;\n const fileVersionId = getProp(match, 'params.fileVersionId', defaultFileVersionId);\n const newLocationState = activeAnnotationId ? { open: true } : location.state;\n\n // Update the location pathname and open state if transitioning to an active annotation id, force the sidebar open\n history.push({\n pathname: getAnnotationsPath(fileVersionId, activeAnnotationId),\n state: newLocationState,\n });\n };\n\n updateActiveVersion = () => {\n const {\n api,\n file,\n fileId,\n getAnnotationsMatchPath,\n getAnnotationsPath,\n history,\n location,\n onVersionChange,\n } = this.props;\n const feedAPI = api.getFeedAPI(false);\n const match = getAnnotationsMatchPath(location);\n const currentFileVersionId = getProp(file, 'file_version.id');\n const fileVersionId = getProp(match, 'params.fileVersionId');\n const { items: feedItems = [] } = feedAPI.getCachedItems(fileId) || {};\n const version = feedItems\n .filter(item => item.type === 'file_version')\n .find(item => item.id === fileVersionId);\n\n if (version) {\n onVersionChange(version, {\n currentVersionId: currentFileVersionId,\n updateVersionToCurrent: () => history.push(getAnnotationsPath(currentFileVersionId)),\n });\n }\n };\n\n render() {\n return <WrappedComponent ref={this.sidebarPanels} {...this.props} />;\n }\n }\n\n const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n WithSidebarAnnotations.displayName = `WithSidebarAnnotations(${displayName})`;\n\n return WithSidebarAnnotations;\n}\n"],"file":"withSidebarAnnotations.js"}
1
+ {"version":3,"sources":["../../../src/elements/content-sidebar/withSidebarAnnotations.js"],"names":["React","getProp","noop","matchPath","FEED_ITEM_TYPE_VERSION","getBadUserError","withSidebarAnnotations","WrappedComponent","WithSidebarAnnotations","props","createRef","file","getAnnotationsPath","getAnnotationsMatchPath","history","location","match","annotationId","currentFileVersionId","fileVersionId","replace","annotatorState","activeAnnotationFileVersionId","activeAnnotationId","defaultFileVersionId","newLocationState","open","state","push","pathname","api","fileId","onVersionChange","feedAPI","getFeedAPI","getCachedItems","items","feedItems","version","filter","item","type","find","id","currentVersionId","updateVersionToCurrent","isOpen","isActivity","current","sidebarPanels","refresh","redirectDeeplinkedAnnotation","prevProps","prevAnnotatorState","prevFileId","prevLocation","action","annotation","prevActiveAnnotationId","prevAnnotation","prevMatch","hasActiveAnnotationChanged","isAnnotationsPath","isTransitioningToAnnotationPath","prevFileVersionId","addAnnotationReply","deleteAnnotationReply","updateAnnotationReply","updateAnnotation","deleteAnnotation","addAnnotation","updateActiveAnnotation","updateActiveVersion","meta","requestId","currentUser","isPending","hasItems","refreshActivitySidebar","annotationReply","addPendingReply","annotationItem","updateFeedItem","total_reply_count","updateReplyItem","deleteFeedItem","replyId","replyItem","replies","deleteReplyItem","Component","displayName","name"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,IAAP,MAAiB,aAAjB;AACA,SAASC,SAAT,QAA8C,kBAA9C;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAiBA,eAAe,SAASC,sBAAT,CACXC,gBADW,EAEe;AAAA,MACpBC,sBADoB;AAAA;AAAA;AAAA;;AAetB,oCAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AACf,kGAAMA,KAAN;;AADe,sEAFuCT,KAAK,CAACU,SAAN,EAEvC;;AAAA,qFAMY,YAAM;AAAA,0BACgD,MAAKD,KADrD;AAAA,YACzBE,IADyB,eACzBA,IADyB;AAAA,YACnBC,kBADmB,eACnBA,kBADmB;AAAA,YACCC,uBADD,eACCA,uBADD;AAAA,YAC0BC,OAD1B,eAC0BA,OAD1B;AAAA,YACmCC,QADnC,eACmCA,QADnC;AAEjC,YAAMC,KAAK,GAAGH,uBAAuB,CAACE,QAAD,CAArC;AACA,YAAME,YAAY,GAAGhB,OAAO,CAACe,KAAD,EAAQ,qBAAR,CAA5B;AACA,YAAME,oBAAoB,GAAGjB,OAAO,CAACU,IAAD,EAAO,iBAAP,CAApC;AACA,YAAMQ,aAAa,GAAGlB,OAAO,CAACe,KAAD,EAAQ,sBAAR,CAA7B;;AAEA,YAAIG,aAAa,IAAIA,aAAa,KAAKD,oBAAvC,EAA6D;AACzDJ,UAAAA,OAAO,CAACM,OAAR,CAAgBR,kBAAkB,CAACM,oBAAD,EAAuBD,YAAvB,CAAlC;AACH;AACJ,OAhBkB;;AAAA,+EAsOM,YAAM;AAAA,2BAQvB,MAAKR,KARkB;AAAA,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oBAAC,gBAAD;AAAkB,UAAA,GAAG,EAAE,KAAK7B;AAA5B,WAA+C,KAAKxC,KAApD,EAAP;AACH;AAtTqB;;AAAA;AAAA,IACWT,KAAK,CAAC0F,SADjB;;AAAA,kBACpBlF,sBADoB,kBAEA;AAClBa,IAAAA,cAAc,EAAE,EADE;AAElBR,IAAAA,uBAAuB,EAAEX,IAFP;AAGlBU,IAAAA,kBAAkB,EAAEV,IAHF;AAIlB8B,IAAAA,eAAe,EAAE9B;AAJC,GAFA;;AAyT1B,MAAMyF,WAAW,GAAGpF,gBAAgB,CAACoF,WAAjB,IAAgCpF,gBAAgB,CAACqF,IAAjD,IAAyD,WAA7E;AACApF,EAAAA,sBAAsB,CAACmF,WAAvB,oCAA+DA,WAA/D;AAEA,SAAOnF,sBAAP;AACH","sourcesContent":["// @flow\nimport * as React from 'react';\nimport getProp from 'lodash/get';\nimport noop from 'lodash/noop';\nimport { matchPath, type ContextRouter } from 'react-router-dom';\nimport { FEED_ITEM_TYPE_VERSION } from '../../constants';\nimport { getBadUserError } from '../../utils/error';\nimport type { WithAnnotatorContextProps } from '../common/annotator-context';\nimport type { BoxItem, User } from '../../common/types/core';\n\ntype Props = {\n ...ContextRouter,\n currentUser?: User,\n file: BoxItem,\n fileId: string,\n isOpen: boolean,\n onVersionChange: Function,\n} & WithAnnotatorContextProps;\n\ntype SidebarPanelsRefType = {\n refresh: (shouldRefreshCache?: boolean) => void,\n};\n\nexport default function withSidebarAnnotations(\n WrappedComponent: React.ComponentType<Props>,\n): React.ComponentType<Props> {\n class WithSidebarAnnotations extends React.Component<Props> {\n static defaultProps = {\n annotatorState: {},\n getAnnotationsMatchPath: noop,\n getAnnotationsPath: noop,\n onVersionChange: noop,\n };\n\n static displayName: ?string;\n\n props: Props;\n\n sidebarPanels: { current: SidebarPanelsRefType | null } = React.createRef();\n\n constructor(props) {\n super(props);\n\n this.redirectDeeplinkedAnnotation();\n }\n\n redirectDeeplinkedAnnotation = () => {\n const { file, getAnnotationsPath, getAnnotationsMatchPath, history, location } = this.props;\n const match = getAnnotationsMatchPath(location);\n const annotationId = getProp(match, 'params.annotationId');\n const currentFileVersionId = getProp(file, 'file_version.id');\n const fileVersionId = getProp(match, 'params.fileVersionId');\n\n if (fileVersionId && fileVersionId !== currentFileVersionId) {\n history.replace(getAnnotationsPath(currentFileVersionId, annotationId));\n }\n };\n\n componentDidUpdate(prevProps: Props) {\n const { annotatorState, fileId, getAnnotationsMatchPath, location, onVersionChange }: Props = this.props;\n const { annotatorState: prevAnnotatorState, fileId: prevFileId, location: prevLocation }: Props = prevProps;\n const { action, activeAnnotationId, annotation } = annotatorState;\n const { activeAnnotationId: prevActiveAnnotationId, annotation: prevAnnotation } = prevAnnotatorState;\n\n const match = getAnnotationsMatchPath(location);\n const prevMatch = getAnnotationsMatchPath(prevLocation);\n const fileVersionId = getProp(match, 'params.fileVersionId');\n const hasActiveAnnotationChanged = prevActiveAnnotationId !== activeAnnotationId;\n const isAnnotationsPath = !!match;\n const isTransitioningToAnnotationPath = activeAnnotationId && !isAnnotationsPath;\n const prevFileVersionId = getProp(prevMatch, 'params.fileVersionId');\n\n if (action === 'reply_create_start' || action === 'reply_create_end') {\n this.addAnnotationReply();\n }\n\n if (action === 'reply_delete_start' || action === 'reply_delete_end') {\n this.deleteAnnotationReply();\n }\n\n if (action === 'reply_update_start' || action === 'reply_update_end') {\n this.updateAnnotationReply();\n }\n\n if (action === 'update_start' || action === 'update_end') {\n this.updateAnnotation();\n }\n\n if (action === 'delete_start' || action === 'delete_end') {\n this.deleteAnnotation();\n }\n\n if ((action === 'create_start' || action === 'create_end') && annotation && prevAnnotation !== annotation) {\n this.addAnnotation();\n }\n\n // Active annotation id changed. If location is currently an annotation path or\n // if location is not currently an annotation path but the active annotation id\n // transitioned from falsy to truthy, update the location accordingly\n if (hasActiveAnnotationChanged && (isAnnotationsPath || isTransitioningToAnnotationPath)) {\n this.updateActiveAnnotation();\n }\n\n if (fileVersionId && prevFileVersionId !== fileVersionId) {\n this.updateActiveVersion();\n }\n\n if (prevFileId !== fileId) {\n // If the file id has changed, reset the current version id since the previous (possibly versioned)\n // location is no longer active\n onVersionChange(null);\n }\n }\n\n addAnnotation() {\n const {\n annotatorState: { action, annotation, meta: { requestId } = {} },\n api,\n currentUser,\n file,\n fileId,\n } = this.props;\n\n if (!requestId) {\n return;\n }\n\n // TODO: need to address in follow on -- currentUser may be undefined here but is never fetched for sure until ActivitySidebar\n if (!currentUser) {\n throw getBadUserError();\n }\n\n const feedAPI = api.getFeedAPI(false);\n const isPending = action === 'create_start';\n const { items: hasItems } = feedAPI.getCachedItems(fileId) || {};\n\n // If there are existing items in the cache for this file, then patch the cache with the new annotation\n // If there are no cache entry for feeditems, then it is assumed that it has not yet been fetched.\n if (hasItems) {\n feedAPI.addAnnotation(file, currentUser, annotation, requestId, isPending);\n }\n\n this.refreshActivitySidebar();\n }\n\n addAnnotationReply() {\n const {\n annotatorState: {\n action,\n annotation: { id: annotationId },\n annotationReply,\n meta: { requestId },\n },\n api,\n currentUser,\n file,\n } = this.props;\n\n if (!currentUser) {\n throw getBadUserError();\n }\n\n const feedAPI = api.getFeedAPI(false);\n feedAPI.file = file;\n\n if (action === 'reply_create_start') {\n feedAPI.addPendingReply(annotationId, currentUser, { ...annotationReply, id: requestId });\n } else {\n const { items: feedItems = [] } = feedAPI.getCachedItems(file.id) || {};\n const annotationItem = feedItems.find(({ id }) => id === annotationId);\n\n if (!annotationItem) {\n return;\n }\n\n feedAPI.updateFeedItem({ total_reply_count: annotationItem.total_reply_count + 1 }, annotationId);\n feedAPI.updateReplyItem({ ...annotationReply, isPending: false }, annotationId, requestId);\n }\n\n this.refreshActivitySidebar();\n }\n\n deleteAnnotation() {\n const {\n annotatorState: { action, annotation },\n api,\n file,\n } = this.props;\n\n const feedAPI = api.getFeedAPI(false);\n feedAPI.file = file;\n\n if (action === 'delete_start') {\n feedAPI.updateFeedItem({ isPending: true }, annotation.id);\n } else {\n feedAPI.deleteFeedItem(annotation.id);\n }\n\n this.refreshActivitySidebar();\n }\n\n deleteAnnotationReply() {\n const {\n annotatorState: {\n action,\n annotation: { id: annotationId },\n annotationReply: { id: replyId },\n },\n api,\n file,\n } = this.props;\n\n const feedAPI = api.getFeedAPI(false);\n feedAPI.file = file;\n\n if (action === 'reply_delete_start') {\n feedAPI.updateReplyItem({ isPending: true }, annotationId, replyId);\n } else {\n const { items: feedItems = [] } = feedAPI.getCachedItems(file.id) || {};\n const annotationItem = feedItems.find(({ id }) => id === annotationId);\n\n if (!annotationItem) {\n return;\n }\n\n // Check if the parent annotation has the reply currently visible\n const replyItem = annotationItem.replies.find(({ id }) => id === replyId);\n if (replyItem) {\n feedAPI.deleteReplyItem(replyId, annotationId);\n } else if (annotationItem.total_reply_count > 0) {\n // Decrease the amount of replies by 1\n feedAPI.updateFeedItem({ total_reply_count: annotationItem.total_reply_count - 1 }, annotationId);\n }\n }\n\n this.refreshActivitySidebar();\n }\n\n updateAnnotation() {\n const {\n annotatorState: { action, annotation },\n api,\n file,\n } = this.props;\n\n const feedAPI = api.getFeedAPI(false);\n const isPending = action === 'update_start';\n feedAPI.file = file;\n\n feedAPI.updateFeedItem({ ...annotation, isPending }, annotation.id);\n\n this.refreshActivitySidebar();\n }\n\n updateAnnotationReply() {\n const {\n annotatorState: { action, annotation, annotationReply },\n api,\n file,\n } = this.props;\n\n const feedAPI = api.getFeedAPI(false);\n const isPending = action === 'reply_update_start';\n feedAPI.file = file;\n\n feedAPI.updateReplyItem({ ...annotationReply, isPending }, annotation.id, annotationReply.id);\n\n this.refreshActivitySidebar();\n }\n\n updateActiveAnnotation = () => {\n const {\n annotatorState: { activeAnnotationFileVersionId, activeAnnotationId },\n file,\n getAnnotationsMatchPath,\n getAnnotationsPath,\n history,\n location,\n } = this.props;\n const match = getAnnotationsMatchPath(location);\n const currentFileVersionId = getProp(file, 'file_version.id');\n const defaultFileVersionId = activeAnnotationFileVersionId || currentFileVersionId;\n const fileVersionId = getProp(match, 'params.fileVersionId', defaultFileVersionId);\n const newLocationState = activeAnnotationId ? { open: true } : location.state;\n\n // Update the location pathname and open state if transitioning to an active annotation id, force the sidebar open\n history.push({\n pathname: getAnnotationsPath(fileVersionId, activeAnnotationId),\n state: newLocationState,\n });\n };\n\n updateActiveVersion = () => {\n const {\n api,\n file,\n fileId,\n getAnnotationsMatchPath,\n getAnnotationsPath,\n history,\n location,\n onVersionChange,\n } = this.props;\n const feedAPI = api.getFeedAPI(false);\n const match = getAnnotationsMatchPath(location);\n const currentFileVersionId = getProp(file, 'file_version.id');\n const fileVersionId = getProp(match, 'params.fileVersionId');\n const { items: feedItems = [] } = feedAPI.getCachedItems(fileId) || {};\n const version = feedItems\n .filter(item => item.type === FEED_ITEM_TYPE_VERSION)\n .find(item => item.id === fileVersionId);\n\n if (version) {\n onVersionChange(version, {\n currentVersionId: currentFileVersionId,\n updateVersionToCurrent: () => history.push(getAnnotationsPath(currentFileVersionId)),\n });\n }\n };\n\n refreshActivitySidebar = () => {\n const { isOpen, location } = this.props;\n\n const pathname = getProp(location, 'pathname', '');\n const isActivity = matchPath(pathname, '/activity');\n const { current } = this.sidebarPanels;\n\n // If the activity sidebar is currently open, then force it to refresh with the updated data\n if (current && isActivity && isOpen) {\n current.refresh(false);\n }\n };\n\n render() {\n return <WrappedComponent ref={this.sidebarPanels} {...this.props} />;\n }\n }\n\n const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';\n WithSidebarAnnotations.displayName = `WithSidebarAnnotations(${displayName})`;\n\n return WithSidebarAnnotations;\n}\n"],"file":"withSidebarAnnotations.js"}