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