box-ui-elements 16.1.0-beta.9 → 17.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/CONTRIBUTING.md +4 -0
- package/README.md +7 -1
- package/dist/explorer.css +1 -1
- package/dist/explorer.js +19 -19
- 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 -17
- package/dist/sharing.css +1 -1
- package/dist/sharing.js +16 -55
- package/dist/sidebar.css +1 -1
- package/dist/sidebar.js +17 -17
- package/dist/uploader.css +1 -1
- package/dist/uploader.js +12 -12
- package/es/api/Feed.js +85 -38
- package/es/api/Feed.js.flow +46 -1
- package/es/api/Feed.js.map +1 -1
- package/es/api/Item.js +16 -10
- package/es/api/Item.js.flow +7 -4
- package/es/api/Item.js.map +1 -1
- package/es/api/ThreadedComments.js +58 -23
- package/es/api/ThreadedComments.js.flow +40 -0
- package/es/api/ThreadedComments.js.map +1 -1
- package/es/common/types/feed.js +1 -1
- package/es/common/types/feed.js.flow +34 -0
- package/es/common/types/feed.js.map +1 -1
- package/es/components/avatar/Avatar.js +22 -5
- package/es/components/avatar/Avatar.js.flow +24 -7
- package/es/components/avatar/Avatar.js.map +1 -1
- package/es/components/avatar/Avatar.scss +42 -0
- package/es/components/avatar/Avatar.stories.js +58 -0
- package/es/components/avatar/Avatar.stories.js.map +1 -1
- package/es/components/avatar/messages.js +9 -0
- package/es/components/avatar/messages.js.map +1 -0
- package/es/components/badgeable/Badgeable.scss +1 -1
- package/es/components/breadcrumb/Breadcrumb.js +1 -1
- package/es/components/breadcrumb/Breadcrumb.js.flow +1 -1
- package/es/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/es/components/button-group/ButtonGroup.scss +2 -2
- package/es/components/checkbox/Checkbox.js +5 -1
- package/es/components/checkbox/Checkbox.js.flow +7 -0
- package/es/components/checkbox/Checkbox.js.map +1 -1
- package/es/components/checkbox/Checkbox.scss +2 -2
- package/es/components/close-button/CloseButton.js +2 -2
- package/es/components/close-button/CloseButton.js.flow +2 -2
- package/es/components/close-button/CloseButton.js.map +1 -1
- package/es/components/contact-datalist-item/ContactDatalistItem.scss +1 -1
- package/es/components/date-picker/DatePicker.js +2 -2
- package/es/components/date-picker/DatePicker.js.map +1 -1
- package/es/components/date-picker/DatePicker.scss +1 -1
- package/es/components/draft-js-editor/DraftJSEditor.scss +1 -1
- package/es/components/dropdown-menu/DropdownMenu.js +5 -3
- package/es/components/dropdown-menu/DropdownMenu.js.flow +8 -2
- package/es/components/dropdown-menu/DropdownMenu.js.map +1 -1
- package/es/components/dropdown-menu/DropdownMenu.scss +6 -4
- package/es/components/error-mask/ErrorMask.scss +1 -1
- package/es/components/flyout/Flyout.js +9 -0
- package/es/components/flyout/Flyout.js.flow +13 -0
- package/es/components/flyout/Flyout.js.map +1 -1
- package/es/components/flyout/Flyout.scss +1 -1
- package/es/components/flyout/Overlay.js +2 -1
- package/es/components/flyout/Overlay.js.flow +2 -1
- package/es/components/flyout/Overlay.js.map +1 -1
- package/es/components/grid-view/GridView.js +3 -1
- package/es/components/grid-view/GridView.js.flow +3 -2
- package/es/components/grid-view/GridView.js.map +1 -1
- package/es/components/grid-view/GridViewSlider.js +5 -2
- package/es/components/grid-view/GridViewSlider.js.flow +5 -2
- package/es/components/grid-view/GridViewSlider.js.map +1 -1
- package/es/components/grid-view/GridViewSlider.scss +0 -10
- package/es/components/inline-error/InlineError.stories.js +12 -0
- package/es/components/inline-error/InlineError.stories.js.flow +9 -0
- package/es/components/inline-error/InlineError.stories.js.map +1 -0
- package/es/components/inline-notice/InlineNotice.stories.js +42 -0
- package/es/components/inline-notice/InlineNotice.stories.js.flow +59 -0
- package/es/components/inline-notice/InlineNotice.stories.js.map +1 -0
- package/es/components/label/InfoIconWithTooltip.js +2 -2
- package/es/components/label/InfoIconWithTooltip.js.map +1 -1
- package/es/components/label/Label.scss +1 -1
- package/es/components/media-query/stories/MediaQuery.stories.js +4 -2
- package/es/components/media-query/stories/MediaQuery.stories.js.flow +11 -2
- package/es/components/media-query/stories/MediaQuery.stories.js.map +1 -1
- package/es/components/media-query/types.js.flow +1 -0
- package/es/components/media-query/types.js.map +1 -1
- package/es/components/media-query/useMediaQuery.js +3 -1
- package/es/components/media-query/useMediaQuery.js.flow +3 -0
- package/es/components/media-query/useMediaQuery.js.map +1 -1
- package/es/components/menu/MenuHeader.scss +1 -1
- package/es/components/menu/SubmenuItem.js +3 -1
- package/es/components/menu/SubmenuItem.js.map +1 -1
- package/es/components/modal/Modal.scss +15 -0
- package/es/components/modal/ModalDialog.js +40 -10
- package/es/components/modal/ModalDialog.js.flow +44 -5
- package/es/components/modal/ModalDialog.js.map +1 -1
- package/es/components/nav-sidebar/NavSidebar.scss +1 -1
- package/es/components/nav-sidebar/NavSidebar.stories.js +37 -0
- package/es/components/nav-sidebar/NavSidebar.stories.js.flow +54 -0
- package/es/components/nav-sidebar/NavSidebar.stories.js.map +1 -0
- package/es/components/pill-cloud/PillCloud.stories.js +88 -0
- package/es/components/pill-cloud/PillCloud.stories.js.flow +48 -0
- package/es/components/pill-cloud/PillCloud.stories.js.map +1 -0
- package/es/components/pill-selector-dropdown/PillSelector.js +20 -11
- package/es/components/pill-selector-dropdown/PillSelector.js.flow +26 -4
- package/es/components/pill-selector-dropdown/PillSelector.js.map +1 -1
- package/es/components/pill-selector-dropdown/PillSelector.scss +4 -0
- package/es/components/pill-selector-dropdown/PillSelectorDropdown.js +1 -0
- package/es/components/pill-selector-dropdown/PillSelectorDropdown.js.flow +1 -0
- package/es/components/pill-selector-dropdown/PillSelectorDropdown.js.map +1 -1
- package/es/components/pill-selector-dropdown/_mixins.scss +1 -1
- package/es/components/popper/PopperComponent.js +3 -1
- package/es/components/popper/PopperComponent.js.flow +3 -2
- package/es/components/popper/PopperComponent.js.map +1 -1
- package/es/components/radio/RadioButton.scss +1 -1
- package/es/components/search-form/SearchForm.js +21 -11
- package/es/components/search-form/SearchForm.js.flow +30 -6
- package/es/components/search-form/SearchForm.js.map +1 -1
- package/es/components/select-button/SelectButton.js +6 -2
- package/es/components/select-button/SelectButton.js.flow +23 -2
- package/es/components/select-button/SelectButton.js.map +1 -1
- package/es/components/select-field/BaseSelectField.js +6 -2
- package/es/components/select-field/BaseSelectField.js.flow +19 -2
- package/es/components/select-field/BaseSelectField.js.map +1 -1
- package/es/components/select-field/SelectField.scss +8 -1
- package/es/components/selector-dropdown/SelectorDropdown.js +11 -3
- package/es/components/selector-dropdown/SelectorDropdown.js.flow +22 -5
- package/es/components/selector-dropdown/SelectorDropdown.js.map +1 -1
- package/es/components/selector-dropdown/SelectorDropdown.scss +2 -2
- package/es/components/table/makeSelectable.js +38 -7
- package/es/components/table/makeSelectable.js.flow +33 -6
- package/es/components/table/makeSelectable.js.map +1 -1
- package/es/components/text-area/TextArea.scss +1 -1
- package/es/components/text-input/TextInput.scss +1 -1
- package/es/components/text-input-with-copy-button/TextInputWithCopyButton.js +3 -2
- package/es/components/text-input-with-copy-button/TextInputWithCopyButton.js.flow +4 -1
- package/es/components/text-input-with-copy-button/TextInputWithCopyButton.js.map +1 -1
- package/es/components/text-input-with-copy-button/TextInputWithCopyButton.scss +11 -7
- package/es/components/thumbnail-card/ThumbnailCard.scss +1 -1
- package/es/components/time/ReadableTime.stories.js +46 -0
- package/es/components/time/ReadableTime.stories.js.flow +56 -0
- package/es/components/time/ReadableTime.stories.js.map +1 -0
- package/es/components/toggle/Toggle.js +11 -4
- package/es/components/toggle/Toggle.js.flow +16 -5
- package/es/components/toggle/Toggle.js.map +1 -1
- package/es/components/toggle/Toggle.scss +3 -3
- package/es/components/tooltip/CloseButton.js +24 -0
- package/es/components/tooltip/CloseButton.js.map +1 -0
- package/es/components/tooltip/Tooltip.js +4 -10
- package/es/components/tooltip/Tooltip.js.map +1 -1
- package/es/constants.js +7 -0
- package/es/constants.js.flow +7 -0
- package/es/constants.js.map +1 -1
- package/es/elements/common/_variables.scss +7 -2
- package/es/elements/common/base.scss +14 -0
- package/es/elements/common/breadcrumbs/Breadcrumb.scss +1 -1
- package/es/elements/common/breadcrumbs/BreadcrumbDropdown.scss +1 -1
- package/es/elements/common/breadcrumbs/InlineBreadcrumbs.scss +2 -2
- package/es/elements/common/header/Header.js +6 -2
- package/es/elements/common/header/Header.js.flow +7 -2
- package/es/elements/common/header/Header.js.map +1 -1
- package/es/elements/common/header/Logo.js +2 -1
- package/es/elements/common/header/Logo.js.flow +5 -1
- package/es/elements/common/header/Logo.js.map +1 -1
- package/es/elements/common/item/IconCell.js +68 -0
- package/es/elements/common/item/IconCell.js.flow +55 -0
- package/es/elements/common/item/IconCell.js.map +1 -0
- package/es/elements/common/item/ItemDetails.scss +1 -1
- package/es/elements/common/item/iconCellRenderer.js +5 -36
- package/es/elements/common/item/iconCellRenderer.js.flow +6 -22
- package/es/elements/common/item/iconCellRenderer.js.map +1 -1
- package/es/elements/common/messages.js +28 -0
- package/es/elements/common/messages.js.flow +35 -0
- package/es/elements/common/messages.js.map +1 -1
- package/es/elements/common/modal.scss +0 -2
- package/es/elements/common/share-access-select/ShareAccessSelect.scss +1 -1
- package/es/elements/common/sub-header/AddButton.js +4 -1
- package/es/elements/common/sub-header/AddButton.js.flow +2 -1
- package/es/elements/common/sub-header/AddButton.js.map +1 -1
- package/es/elements/common/sub-header/Sort.js +4 -10
- package/es/elements/common/sub-header/Sort.js.flow +7 -6
- package/es/elements/common/sub-header/Sort.js.map +1 -1
- package/es/elements/common/sub-header/SortButton.js +19 -6
- package/es/elements/common/sub-header/SortButton.js.flow +23 -10
- package/es/elements/common/sub-header/SortButton.js.map +1 -1
- package/es/elements/common/sub-header/ViewModeChangeButton.js +3 -3
- package/es/elements/common/sub-header/ViewModeChangeButton.js.flow +3 -3
- package/es/elements/common/sub-header/ViewModeChangeButton.js.map +1 -1
- package/es/elements/content-explorer/Content.js.flow +2 -1
- package/es/elements/content-explorer/Content.js.map +1 -1
- package/es/elements/content-explorer/ContentExplorer.js +63 -20
- package/es/elements/content-explorer/ContentExplorer.js.flow +50 -13
- package/es/elements/content-explorer/ContentExplorer.js.map +1 -1
- package/es/elements/content-explorer/ItemGrid.js +55 -7
- package/es/elements/content-explorer/ItemGrid.js.flow +60 -9
- package/es/elements/content-explorer/ItemGrid.js.map +1 -1
- package/es/elements/content-explorer/ItemGridThumbnail.js +5 -2
- package/es/elements/content-explorer/ItemGridThumbnail.js.flow +5 -2
- package/es/elements/content-explorer/ItemGridThumbnail.js.map +1 -1
- package/es/elements/content-explorer/ItemList.js +4 -2
- package/es/elements/content-explorer/ItemList.js.flow +4 -2
- package/es/elements/content-explorer/ItemList.js.map +1 -1
- package/es/elements/content-explorer/ItemList.scss +16 -8
- package/es/elements/content-explorer/MoreOptions.js +6 -4
- package/es/elements/content-explorer/MoreOptions.js.flow +11 -4
- package/es/elements/content-explorer/MoreOptions.js.map +1 -1
- package/es/elements/content-open-with/ContentOpenWith.scss +1 -1
- package/es/elements/content-picker/Footer.js +15 -6
- package/es/elements/content-picker/Footer.js.flow +62 -51
- package/es/elements/content-picker/Footer.js.map +1 -1
- package/es/elements/content-picker/ItemList.scss +1 -1
- package/es/elements/content-preview/ContentPreview.js +44 -12
- package/es/elements/content-preview/ContentPreview.js.flow +43 -6
- package/es/elements/content-preview/ContentPreview.js.map +1 -1
- package/es/elements/content-preview/preview-header/PreviewHeader.scss +1 -1
- package/es/elements/content-sharing/ContentSharing.js +2 -2
- package/es/elements/content-sharing/ContentSharing.js.flow +2 -2
- package/es/elements/content-sharing/ContentSharing.js.map +1 -1
- package/es/elements/content-sidebar/ActivitySidebar.js +291 -62
- package/es/elements/content-sidebar/ActivitySidebar.js.flow +262 -17
- package/es/elements/content-sidebar/ActivitySidebar.js.map +1 -1
- package/es/elements/content-sidebar/ActivitySidebar.scss +7 -0
- package/es/elements/content-sidebar/ActivitySidebarFilter.js +36 -18
- package/es/elements/content-sidebar/ActivitySidebarFilter.js.flow +64 -23
- package/es/elements/content-sidebar/ActivitySidebarFilter.js.map +1 -1
- package/es/elements/content-sidebar/AddTaskMenu.scss +1 -1
- package/es/elements/content-sidebar/SidebarContent.js +2 -2
- package/es/elements/content-sidebar/SidebarContent.js.flow +1 -1
- package/es/elements/content-sidebar/SidebarContent.js.map +1 -1
- package/es/elements/content-sidebar/SidebarContent.scss +3 -3
- package/es/elements/content-sidebar/SidebarNav.js +3 -17
- package/es/elements/content-sidebar/SidebarNav.js.flow +3 -15
- package/es/elements/content-sidebar/SidebarNav.js.map +1 -1
- package/es/elements/content-sidebar/SidebarNavSign.js +48 -69
- package/es/elements/content-sidebar/SidebarNavSign.js.map +1 -1
- package/es/elements/content-sidebar/SidebarNavSign.scss +3 -25
- package/es/elements/content-sidebar/SidebarNavSignButton.js +79 -0
- package/es/elements/content-sidebar/SidebarNavSignButton.js.map +1 -0
- package/es/elements/content-sidebar/SidebarNavSignButton.scss +27 -0
- package/es/elements/content-sidebar/activity-feed/Avatar.js +4 -2
- package/es/elements/content-sidebar/activity-feed/Avatar.js.flow +5 -2
- package/es/elements/content-sidebar/activity-feed/Avatar.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +61 -15
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js.flow +73 -28
- 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 +122 -53
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js.flow +80 -13
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.scss +11 -0
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.js +9 -2
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.scss +28 -0
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js +27 -7
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js.flow +48 -29
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.scss +69 -6
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js +35 -4
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js.flow +42 -5
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.scss +15 -0
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js +21 -8
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js.flow +30 -5
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.scss +4 -7
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js +45 -15
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js.flow +43 -13
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.scss +26 -3
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js +29 -48
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js.flow +67 -56
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.scss +1 -1
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js +14 -53
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js.flow +16 -51
- package/es/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotation-thread/errors.js +3 -2
- package/es/elements/content-sidebar/activity-feed/annotation-thread/errors.js.flow +5 -4
- package/es/elements/content-sidebar/activity-feed/annotation-thread/errors.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotation-thread/types.js +2 -0
- package/es/elements/content-sidebar/activity-feed/annotation-thread/types.js.flow +7 -0
- package/es/elements/content-sidebar/activity-feed/annotation-thread/types.js.map +1 -0
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js +29 -17
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js.flow +32 -10
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationThread.js +317 -63
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationThread.js.flow +249 -55
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationThread.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js +27 -93
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js.flow +42 -83
- package/es/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js +15 -6
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js.flow +27 -12
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.scss +11 -8
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivityLink.scss +1 -1
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js +3 -1
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js.flow +3 -1
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.scss +5 -0
- package/es/elements/content-sidebar/activity-feed/comment/BaseComment.js +385 -0
- package/es/elements/content-sidebar/activity-feed/comment/BaseComment.js.flow +456 -0
- package/es/elements/content-sidebar/activity-feed/comment/BaseComment.js.map +1 -0
- package/es/elements/content-sidebar/activity-feed/comment/BaseComment.scss +30 -0
- package/es/elements/content-sidebar/activity-feed/comment/Comment.js +53 -9
- package/es/elements/content-sidebar/activity-feed/comment/Comment.js.flow +42 -5
- package/es/elements/content-sidebar/activity-feed/comment/Comment.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/comment/Comment.scss +10 -0
- package/es/elements/content-sidebar/activity-feed/comment/CreateReply.js +54 -0
- package/es/elements/content-sidebar/activity-feed/comment/CreateReply.js.flow +72 -0
- package/es/elements/content-sidebar/activity-feed/comment/CreateReply.js.map +1 -0
- package/es/elements/content-sidebar/activity-feed/comment/CreateReply.scss +21 -0
- package/es/elements/content-sidebar/activity-feed/comment/Replies.scss +41 -0
- package/es/elements/content-sidebar/activity-feed/comment/RepliesToggle.js +44 -0
- package/es/elements/content-sidebar/activity-feed/comment/RepliesToggle.js.flow +41 -0
- package/es/elements/content-sidebar/activity-feed/comment/RepliesToggle.js.map +1 -0
- package/es/elements/content-sidebar/activity-feed/comment/RepliesToggle.scss +6 -0
- package/es/elements/content-sidebar/activity-feed/comment/messages.js +16 -0
- package/es/elements/content-sidebar/activity-feed/comment/messages.js.flow +20 -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 +1 -1
- package/es/elements/content-sidebar/activity-feed/comment-form/CommentForm.js.flow +3 -3
- package/es/elements/content-sidebar/activity-feed/comment-form/CommentForm.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/comment-form/CommentForm.scss +1 -1
- package/es/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.scss +1 -1
- package/es/elements/content-sidebar/activity-feed/common/activity-message/messages.js +1 -1
- package/es/elements/content-sidebar/activity-feed/common/activity-message/messages.js.flow +2 -2
- 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.scss +1 -1
- package/es/elements/content-sidebar/activity-feed/task-form/TaskForm.js +1 -0
- package/es/elements/content-sidebar/activity-feed/task-form/TaskForm.js.flow +1 -0
- package/es/elements/content-sidebar/activity-feed/task-form/TaskForm.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/task-new/AssigneeDetails.scss +1 -1
- package/es/elements/content-sidebar/activity-feed/task-new/AvatarGroupAvatar.js +7 -8
- package/es/elements/content-sidebar/activity-feed/task-new/AvatarGroupAvatar.js.flow +11 -7
- package/es/elements/content-sidebar/activity-feed/task-new/AvatarGroupAvatar.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/task-new/AvatarGroupAvatar.scss +1 -5
- package/es/elements/content-sidebar/activity-feed/task-new/Task.js +2 -5
- package/es/elements/content-sidebar/activity-feed/task-new/Task.js.flow +1 -2
- package/es/elements/content-sidebar/activity-feed/task-new/Task.js.map +1 -1
- package/es/elements/content-sidebar/activity-feed/task-new/Task.scss +1 -8
- package/es/elements/content-sidebar/messages.js +22 -2
- package/es/elements/content-sidebar/messages.js.flow +29 -4
- package/es/elements/content-sidebar/messages.js.map +1 -1
- package/es/elements/content-sidebar/skills/timeline/Timeline.scss +1 -1
- package/es/elements/content-sidebar/skills/transcript/Transcript.scss +1 -1
- package/es/elements/content-sidebar/versions/VersionsGroup.scss +1 -1
- package/es/elements/content-sidebar/versions/VersionsItem.scss +3 -3
- package/es/elements/content-uploader/Footer.js +9 -3
- package/es/elements/content-uploader/Footer.js.flow +23 -3
- package/es/elements/content-uploader/Footer.js.map +1 -1
- package/es/elements/content-uploader/Footer.scss +0 -1
- package/es/elements/content-uploader/ItemAction.js +8 -4
- package/es/elements/content-uploader/ItemAction.js.flow +6 -3
- package/es/elements/content-uploader/ItemAction.js.map +1 -1
- package/es/elements/content-uploader/ItemRemove.js +11 -6
- package/es/elements/content-uploader/ItemRemove.js.flow +18 -6
- package/es/elements/content-uploader/ItemRemove.js.map +1 -1
- package/es/elements/content-uploader/UploadInput.js +21 -9
- package/es/elements/content-uploader/UploadInput.js.flow +19 -9
- package/es/elements/content-uploader/UploadInput.js.map +1 -1
- package/es/features/advanced-content-insights/AdvancedContentInsightsToggle.js +44 -0
- package/es/features/advanced-content-insights/AdvancedContentInsightsToggle.js.map +1 -0
- package/es/features/advanced-content-insights/AdvancedContentInsightsToggle.scss +19 -0
- package/es/features/advanced-content-insights/messages.js +17 -0
- package/es/features/advanced-content-insights/messages.js.map +1 -0
- package/es/features/classification/classificationColorsMap.js +1 -1
- package/es/features/classification/classificationColorsMap.js.flow +1 -1
- package/es/features/classification/classificationColorsMap.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorAvatarItem.js +13 -9
- package/es/features/collaborator-avatars/CollaboratorAvatarItem.js.flow +11 -8
- package/es/features/collaborator-avatars/CollaboratorAvatarItem.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorAvatars.scss +1 -1
- package/es/features/collaborator-avatars/CollaboratorList.js +4 -5
- package/es/features/collaborator-avatars/CollaboratorList.js.flow +3 -4
- package/es/features/collaborator-avatars/CollaboratorList.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorListItem.js +7 -9
- package/es/features/collaborator-avatars/CollaboratorListItem.js.flow +7 -13
- package/es/features/collaborator-avatars/CollaboratorListItem.js.map +1 -1
- package/es/features/collaborator-avatars/CollaboratorListItem.scss +7 -3
- package/es/features/collapsible-sidebar/CollapsibleSidebar.js +3 -2
- package/es/features/collapsible-sidebar/CollapsibleSidebar.js.flow +5 -2
- package/es/features/collapsible-sidebar/CollapsibleSidebar.js.map +1 -1
- package/es/features/collapsible-sidebar/CollapsibleSidebar.scss +4 -7
- package/es/features/collapsible-sidebar/CollapsibleSidebarLogo.js +3 -1
- package/es/features/collapsible-sidebar/CollapsibleSidebarLogo.js.flow +15 -11
- package/es/features/collapsible-sidebar/CollapsibleSidebarLogo.js.map +1 -1
- package/es/features/content-explorer/content-explorer/ContentExplorer.js +146 -58
- package/es/features/content-explorer/content-explorer/ContentExplorer.js.flow +97 -20
- package/es/features/content-explorer/content-explorer/ContentExplorer.js.map +1 -1
- package/es/features/content-explorer/content-explorer/ContentExplorer.scss +67 -8
- package/es/features/content-explorer/content-explorer/ContentExplorerActionButtons.js +58 -11
- package/es/features/content-explorer/content-explorer/ContentExplorerActionButtons.js.flow +53 -13
- package/es/features/content-explorer/content-explorer/ContentExplorerActionButtons.js.map +1 -1
- package/es/features/content-explorer/content-explorer/ContentExplorerFolderTreeBreadcrumbs.js +68 -0
- package/es/features/content-explorer/content-explorer/ContentExplorerFolderTreeBreadcrumbs.js.flow +82 -0
- package/es/features/content-explorer/content-explorer/ContentExplorerFolderTreeBreadcrumbs.js.map +1 -0
- package/es/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js +13 -2
- package/es/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js.flow +22 -7
- package/es/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js.map +1 -1
- package/es/features/content-explorer/content-explorer/ContentExplorerIncludeSubfolders.js +33 -0
- package/es/features/content-explorer/content-explorer/ContentExplorerIncludeSubfolders.js.flow +30 -0
- package/es/features/content-explorer/content-explorer/ContentExplorerIncludeSubfolders.js.map +1 -0
- package/es/features/content-explorer/content-explorer/ContentExplorerSelectAll.js +16 -10
- package/es/features/content-explorer/content-explorer/ContentExplorerSelectAll.js.flow +34 -20
- package/es/features/content-explorer/content-explorer/ContentExplorerSelectAll.js.map +1 -1
- package/es/features/content-explorer/content-explorer/constants.js +7 -0
- package/es/features/content-explorer/content-explorer/constants.js.flow +6 -0
- package/es/features/content-explorer/content-explorer/constants.js.map +1 -0
- package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js +1 -0
- package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js.flow +13 -0
- package/es/features/content-explorer/content-explorer-modal/ContentExplorerModal.js.map +1 -1
- package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js +42 -0
- package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js.flow +31 -0
- package/es/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js.map +1 -1
- package/es/features/content-explorer/item-list/ItemList.js +20 -5
- package/es/features/content-explorer/item-list/ItemList.js.flow +17 -1
- package/es/features/content-explorer/item-list/ItemList.js.map +1 -1
- package/es/features/content-explorer/item-list/ItemList.scss +1 -1
- package/es/features/content-explorer/item-list/ItemListButton.js +4 -1
- package/es/features/content-explorer/item-list/ItemListButton.js.flow +10 -2
- package/es/features/content-explorer/item-list/ItemListButton.js.map +1 -1
- package/es/features/content-explorer/item-list/ItemListIcon.js +12 -45
- package/es/features/content-explorer/item-list/ItemListIcon.js.flow +5 -33
- package/es/features/content-explorer/item-list/ItemListIcon.js.map +1 -1
- package/es/features/content-explorer/item-list/ItemListName.js +2 -2
- package/es/features/content-explorer/item-list/ItemListName.js.flow +3 -2
- package/es/features/content-explorer/item-list/ItemListName.js.map +1 -1
- package/es/features/content-explorer/messages.js +23 -19
- package/es/features/content-explorer/messages.js.flow +41 -24
- package/es/features/content-explorer/messages.js.map +1 -1
- package/es/features/content-explorer/prop-types.js +2 -2
- package/es/features/content-explorer/prop-types.js.flow +2 -2
- package/es/features/content-explorer/prop-types.js.map +1 -1
- package/es/features/content-insights/_mixins.scss +1 -1
- package/es/features/content-insights/charts/bar/Bar.js +21 -2
- package/es/features/content-insights/charts/bar/Bar.js.map +1 -1
- package/es/features/content-insights/charts/bar/BarChart.js +6 -3
- package/es/features/content-insights/charts/bar/BarChart.js.map +1 -1
- package/es/features/invite-collaborators-modal/InviteCollaboratorsModal.scss +1 -1
- package/es/features/message-center/components/templates/common/styles/MessageFooter.scss +1 -1
- package/es/features/metadata-based-view/IconWithTooltip.js +4 -4
- package/es/features/metadata-based-view/IconWithTooltip.js.flow +4 -4
- package/es/features/metadata-based-view/IconWithTooltip.js.map +1 -1
- package/es/features/metadata-based-view/MetadataBasedItemList.scss +1 -1
- package/es/features/metadata-instance-editor/CascadePolicy.scss +1 -1
- package/es/features/metadata-instance-editor/TemplateDropdown.js +9 -21
- package/es/features/metadata-instance-editor/TemplateDropdown.js.flow +4 -10
- package/es/features/metadata-instance-editor/TemplateDropdown.js.map +1 -1
- package/es/features/metadata-instance-editor/TemplateDropdown.scss +2 -2
- package/es/features/metadata-instance-fields/EnumMetadataField.scss +2 -2
- package/es/features/metadata-instance-fields/MultiSelectMetadataField.scss +1 -1
- package/es/features/metadata-instance-fields/ReadOnlyMetadataField.scss +2 -2
- package/es/features/presence/PresenceAvatarList.scss +1 -1
- package/es/features/presence/PresenceCollaborator.scss +1 -1
- package/es/features/query-bar/styles/Condition.scss +2 -2
- package/es/features/quick-search/QuickSearchItem.js +4 -3
- package/es/features/quick-search/QuickSearchItem.js.flow +4 -3
- package/es/features/quick-search/QuickSearchItem.js.map +1 -1
- package/es/features/shared-link-settings-modal/ExpirationSection.js +5 -0
- package/es/features/shared-link-settings-modal/ExpirationSection.js.flow +4 -0
- package/es/features/shared-link-settings-modal/ExpirationSection.js.map +1 -1
- package/es/features/shared-link-settings-modal/SharedLinkSettingsModal.js +9 -3
- package/es/features/shared-link-settings-modal/SharedLinkSettingsModal.js.flow +9 -5
- package/es/features/shared-link-settings-modal/SharedLinkSettingsModal.js.map +1 -1
- package/es/features/shared-link-settings-modal/SharedLinkSettingsModal.scss +3 -3
- package/es/features/shared-link-settings-modal/VanityNameSection.js +2 -2
- package/es/features/shared-link-settings-modal/VanityNameSection.js.flow +2 -2
- package/es/features/shared-link-settings-modal/VanityNameSection.js.map +1 -1
- package/es/features/unified-share-modal/InviteePermissionsMenu.js +2 -1
- package/es/features/unified-share-modal/InviteePermissionsMenu.js.flow +1 -0
- package/es/features/unified-share-modal/InviteePermissionsMenu.js.map +1 -1
- package/es/features/unified-share-modal/SharedLinkAccessMenu.js +2 -1
- package/es/features/unified-share-modal/SharedLinkAccessMenu.js.flow +1 -0
- package/es/features/unified-share-modal/SharedLinkAccessMenu.js.map +1 -1
- package/es/features/unified-share-modal/SharedLinkPermissionMenu.js +2 -1
- package/es/features/unified-share-modal/SharedLinkPermissionMenu.js.flow +1 -0
- package/es/features/unified-share-modal/SharedLinkPermissionMenu.js.map +1 -1
- package/es/features/unified-share-modal/SharedLinkSection.js +18 -18
- package/es/features/unified-share-modal/SharedLinkSection.js.flow +30 -38
- package/es/features/unified-share-modal/SharedLinkSection.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareForm.js +27 -16
- package/es/features/unified-share-modal/UnifiedShareForm.js.flow +38 -25
- package/es/features/unified-share-modal/UnifiedShareForm.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareModal.js +10 -1
- package/es/features/unified-share-modal/UnifiedShareModal.js.flow +9 -1
- package/es/features/unified-share-modal/UnifiedShareModal.js.map +1 -1
- package/es/features/unified-share-modal/UnifiedShareModal.scss +24 -13
- package/es/features/unified-share-modal/flowTypes.js.flow +10 -2
- package/es/features/unified-share-modal/flowTypes.js.map +1 -1
- package/es/features/unified-share-modal/messages.js +12 -4
- package/es/features/unified-share-modal/messages.js.flow +17 -5
- package/es/features/unified-share-modal/messages.js.map +1 -1
- package/es/features/virtualized-table/VirtualizedTable.scss +1 -1
- package/es/features/virtualized-table-renderers/_mixins.scss +1 -1
- package/es/icons/badges/MetadataDefaultBadge.js +3 -3
- package/es/icons/badges/MetadataDefaultBadge.js.flow +3 -3
- package/es/icons/badges/MetadataDefaultBadge.js.map +1 -1
- package/es/icons/general/IconAnyTask.js +2 -2
- package/es/icons/general/IconAnyTask.js.flow +2 -2
- package/es/icons/general/IconAnyTask.js.map +1 -1
- package/es/icons/general/IconEdit.js +2 -1
- package/es/icons/general/IconEdit.js.flow +2 -1
- package/es/icons/general/IconEdit.js.map +1 -1
- package/es/icons/metadata-view/IconMetadataView.js +2 -1
- package/es/icons/metadata-view/IconMetadataView.js.flow +2 -1
- package/es/icons/metadata-view/IconMetadataView.js.map +1 -1
- package/es/icons/two-toned/IconAnnotation.js +36 -0
- package/es/icons/two-toned/IconAnnotation.js.flow +27 -0
- package/es/icons/two-toned/IconAnnotation.js.map +1 -0
- package/es/icons/two-toned/_IconAnnotation.mixins.scss +9 -0
- package/es/src/components/avatar/Avatar.d.ts +18 -2
- package/es/src/components/avatar/Avatar.stories.d.ts +7 -2
- package/es/src/components/avatar/messages.d.ts +8 -0
- package/es/src/components/checkbox/Checkbox.d.ts +4 -1
- package/es/src/components/checkbox/Checkbox.stories.d.ts +1 -1
- package/es/src/components/tooltip/CloseButton.d.ts +14 -0
- package/es/src/components/tooltip/__tests__/CloseButton.test.d.ts +1 -0
- package/es/src/elements/content-sidebar/SidebarNavSign.d.ts +2 -24
- package/es/src/elements/content-sidebar/SidebarNavSignButton.d.ts +25 -0
- package/es/src/elements/content-sidebar/__tests__/SidebarNavSignButton.test.d.ts +1 -0
- package/es/src/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.d.ts +3 -0
- package/es/src/features/advanced-content-insights/AdvancedContentInsightsToggle.d.ts +10 -0
- package/es/src/features/advanced-content-insights/__tests__/AdvancedContentInsightsToggle.test.d.ts +1 -0
- package/es/src/features/advanced-content-insights/messages.d.ts +18 -0
- package/es/src/features/content-insights/charts/bar/Bar.d.ts +6 -2
- package/es/src/features/content-insights/charts/bar/BarChart.d.ts +7 -2
- package/es/src/icons/two-toned/IconAnnotation.d.ts +3 -0
- package/es/src/icons/two-toned/__tests__/IconAnnotation.test.d.ts +1 -0
- package/es/src/styles/typography.stories.d.ts +8 -0
- package/es/src/styles/variables.d.ts +1 -1
- package/es/styles/_deprecated.scss +1 -0
- package/es/styles/_inputs.scss +2 -3
- package/es/styles/common/_buttons.scss +2 -2
- package/es/styles/common/_forms.scss +2 -0
- package/es/styles/common/_links.scss +1 -1
- package/es/styles/constants/_colors.scss +1 -1
- package/es/styles/constants/_themes.scss +1 -1
- package/es/styles/typography.stories.js +55 -0
- package/es/styles/typography.stories.js.map +1 -0
- package/es/styles/typography.stories.scss +60 -0
- package/es/styles/variables.js +2 -2
- package/es/styles/variables.js.flow +2 -2
- package/es/styles/variables.js.map +1 -1
- package/es/utils/createTheme.js +2 -2
- package/es/utils/createTheme.js.flow +2 -2
- package/es/utils/createTheme.js.map +1 -1
- package/i18n/bn-IN.js +46 -22
- package/i18n/bn-IN.properties +79 -31
- package/i18n/da-DK.js +46 -22
- package/i18n/da-DK.properties +79 -31
- package/i18n/de-DE.js +45 -21
- package/i18n/de-DE.properties +78 -30
- package/i18n/en-AU.js +33 -9
- package/i18n/en-AU.properties +66 -18
- package/i18n/en-CA.js +32 -8
- package/i18n/en-CA.properties +65 -17
- package/i18n/en-GB.js +33 -9
- package/i18n/en-GB.properties +66 -18
- package/i18n/en-US.js +32 -8
- package/i18n/en-US.properties +65 -17
- package/i18n/en-x-pseudo.js +39 -8
- package/i18n/es-419.js +46 -22
- package/i18n/es-419.properties +79 -31
- package/i18n/es-ES.js +46 -22
- package/i18n/es-ES.properties +79 -31
- package/i18n/fi-FI.js +45 -21
- package/i18n/fi-FI.properties +78 -30
- package/i18n/fr-CA.js +44 -20
- package/i18n/fr-CA.properties +78 -30
- package/i18n/fr-FR.js +44 -20
- package/i18n/fr-FR.properties +78 -30
- package/i18n/hi-IN.js +46 -22
- package/i18n/hi-IN.properties +79 -31
- package/i18n/it-IT.js +45 -21
- package/i18n/it-IT.properties +78 -30
- package/i18n/ja-JP.js +55 -31
- package/i18n/ja-JP.properties +88 -40
- package/i18n/ko-KR.js +44 -20
- package/i18n/ko-KR.properties +78 -30
- package/i18n/nb-NO.js +45 -21
- package/i18n/nb-NO.properties +78 -30
- package/i18n/nl-NL.js +46 -22
- package/i18n/nl-NL.properties +79 -31
- package/i18n/pl-PL.js +45 -21
- package/i18n/pl-PL.properties +78 -30
- package/i18n/pt-BR.js +45 -21
- package/i18n/pt-BR.properties +78 -30
- package/i18n/ru-RU.js +45 -21
- package/i18n/ru-RU.properties +78 -30
- package/i18n/sv-SE.js +46 -22
- package/i18n/sv-SE.properties +79 -31
- package/i18n/tr-TR.js +45 -21
- package/i18n/tr-TR.properties +78 -30
- package/i18n/zh-CN.js +45 -21
- package/i18n/zh-CN.properties +78 -30
- package/i18n/zh-TW.js +45 -21
- package/i18n/zh-TW.properties +78 -30
- package/package.json +3 -3
- package/src/api/Feed.js +46 -1
- package/src/api/Item.js +7 -4
- package/src/api/ThreadedComments.js +40 -0
- package/src/api/__tests__/Feed.test.js +48 -0
- package/src/api/__tests__/Item.test.js +14 -0
- package/src/api/__tests__/ThreadedComments.test.js +46 -0
- package/src/common/types/feed.js +34 -0
- package/src/components/avatar/Avatar.js.flow +24 -7
- package/src/components/avatar/Avatar.scss +42 -0
- package/src/components/avatar/Avatar.stories.tsx +45 -0
- package/src/components/avatar/Avatar.tsx +39 -9
- package/src/components/avatar/__tests__/Avatar.test.tsx +39 -29
- package/src/components/avatar/messages.ts +11 -0
- package/src/components/badgeable/Badgeable.scss +1 -1
- package/src/components/breadcrumb/Breadcrumb.js +1 -1
- package/src/components/breadcrumb/__tests__/Breadcrumb.test.js +1 -1
- package/src/components/button-group/ButtonGroup.scss +2 -2
- package/src/components/checkbox/Checkbox.js.flow +7 -0
- package/src/components/checkbox/Checkbox.scss +2 -2
- package/src/components/checkbox/Checkbox.tsx +7 -0
- package/src/components/checkbox/__tests__/Checkbox.test.tsx +19 -2
- package/src/components/close-button/CloseButton.js.flow +2 -2
- package/src/components/close-button/CloseButton.tsx +2 -2
- package/src/components/contact-datalist-item/ContactDatalistItem.scss +1 -1
- package/src/components/date-picker/DatePicker.scss +1 -1
- package/src/components/date-picker/DatePicker.tsx +2 -2
- package/src/components/date-picker/__tests__/DatePicker.test.tsx +4 -4
- package/src/components/draft-js-editor/DraftJSEditor.scss +1 -1
- package/src/components/dropdown-menu/DropdownMenu.js +8 -2
- package/src/components/dropdown-menu/DropdownMenu.scss +6 -4
- package/src/components/dropdown-menu/__tests__/DropdownMenu.test.js +18 -0
- package/src/components/error-mask/ErrorMask.scss +1 -1
- package/src/components/flyout/Flyout.js +13 -0
- package/src/components/flyout/Flyout.scss +1 -1
- package/src/components/flyout/Overlay.js +2 -1
- package/src/components/flyout/__tests__/Flyout.test.js +22 -1
- package/src/components/flyout/__tests__/Overlay.test.js +1 -1
- package/src/components/grid-view/GridView.js +3 -2
- package/src/components/grid-view/GridViewSlider.js +5 -2
- package/src/components/grid-view/GridViewSlider.scss +0 -10
- package/src/components/grid-view/__tests__/GridViewSlider.test.js +35 -2
- package/src/components/grid-view/__tests__/__snapshots__/GridView.test.js.snap +2 -0
- package/src/components/grid-view/__tests__/__snapshots__/GridViewSlider.test.js.snap +38 -13
- package/src/components/inline-error/InlineError.stories.js +9 -0
- package/src/components/inline-error/InlineError.stories.md +3 -0
- package/src/components/inline-notice/InlineNotice.stories.js +59 -0
- package/src/components/inline-notice/InlineNotice.stories.md +1 -0
- package/src/components/label/InfoIconWithTooltip.tsx +2 -2
- package/src/components/label/Label.scss +1 -1
- package/src/components/label/__tests__/__snapshots__/InfoIconWithTooltip.test.tsx.snap +1 -1
- package/src/components/media-query/__tests__/withMediaQuery.test.js +1 -0
- package/src/components/media-query/stories/MediaQuery.stories.js +11 -2
- package/src/components/media-query/stories/MediaQuery.stories.md +10 -9
- package/src/components/media-query/types.js +1 -0
- package/src/components/media-query/useMediaQuery.js +3 -0
- package/src/components/menu/MenuHeader.scss +1 -1
- package/src/components/menu/SubmenuItem.tsx +4 -1
- package/src/components/modal/Modal.scss +15 -0
- package/src/components/modal/ModalDialog.js +44 -5
- package/src/components/modal/__tests__/ModalDialog.test.js +22 -1
- package/src/components/nav-sidebar/NavSidebar.scss +1 -1
- package/src/components/nav-sidebar/NavSidebar.stories.js +54 -0
- package/src/components/nav-sidebar/NavSidebar.stories.md +1 -0
- package/src/components/pill-cloud/PillCloud.stories.js +48 -0
- package/src/components/pill-cloud/PillCloud.stories.md +1 -0
- package/src/components/pill-selector-dropdown/PillSelector.js +26 -4
- package/src/components/pill-selector-dropdown/PillSelector.scss +4 -0
- package/src/components/pill-selector-dropdown/PillSelectorDropdown.js +1 -0
- package/src/components/pill-selector-dropdown/__tests__/PillSelector.test.js +1 -1
- package/src/components/pill-selector-dropdown/__tests__/PillSelectorDropdown.test.js +4 -4
- package/src/components/pill-selector-dropdown/__tests__/__snapshots__/PillSelector.test.js.snap +1 -1
- package/src/components/pill-selector-dropdown/__tests__/__snapshots__/PillSelectorDropdown.test.js.snap +1 -1
- package/src/components/pill-selector-dropdown/_mixins.scss +1 -1
- package/src/components/popper/PopperComponent.js +3 -2
- package/src/components/radio/RadioButton.scss +1 -1
- package/src/components/search-form/SearchForm.js +30 -6
- package/src/components/search-form/__tests__/SearchForm.test.js +1 -1
- package/src/components/select-button/SelectButton.js +23 -2
- package/src/components/select-button/__tests__/SelectButton.test.js +8 -0
- package/src/components/select-field/BaseSelectField.js +19 -2
- package/src/components/select-field/SelectField.scss +8 -1
- package/src/components/select-field/__tests__/BaseSelectField.test.js +9 -0
- package/src/components/selector-dropdown/SelectorDropdown.js +22 -5
- package/src/components/selector-dropdown/SelectorDropdown.scss +2 -2
- package/src/components/selector-dropdown/__tests__/SelectorDropdown.test.js +2 -1
- package/src/components/table/__tests__/makeSelectable.test.js +65 -3
- package/src/components/table/makeSelectable.js +33 -6
- package/src/components/text-area/TextArea.scss +1 -1
- package/src/components/text-input/TextInput.scss +1 -1
- package/src/components/text-input-with-copy-button/TextInputWithCopyButton.js +4 -1
- package/src/components/text-input-with-copy-button/TextInputWithCopyButton.scss +11 -7
- package/src/components/thumbnail-card/ThumbnailCard.scss +1 -1
- package/src/components/time/ReadableTime.stories.js +56 -0
- package/src/components/time/ReadableTime.stories.md +1 -0
- package/src/components/toggle/Toggle.js +16 -5
- package/src/components/toggle/Toggle.scss +3 -3
- package/src/components/toggle/__tests__/__snapshots__/Toggle.test.js.snap +2 -0
- package/src/components/tooltip/CloseButton.tsx +22 -0
- package/src/components/tooltip/Tooltip.tsx +3 -8
- package/src/components/tooltip/__tests__/CloseButton.test.tsx +32 -0
- package/src/components/tooltip/__tests__/Tooltip.test.tsx +21 -0
- package/src/components/tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +3 -10
- package/src/constants.js +7 -0
- package/src/elements/common/_variables.scss +7 -2
- package/src/elements/common/base.scss +14 -0
- package/src/elements/common/breadcrumbs/Breadcrumb.scss +1 -1
- package/src/elements/common/breadcrumbs/BreadcrumbDropdown.scss +1 -1
- package/src/elements/common/breadcrumbs/InlineBreadcrumbs.scss +2 -2
- package/src/elements/common/header/Header.js +7 -2
- package/src/elements/common/header/Logo.js +5 -1
- package/src/elements/common/header/__tests__/Header.test.js +40 -0
- package/src/elements/common/item/IconCell.js +55 -0
- package/src/elements/common/item/ItemDetails.scss +1 -1
- package/src/elements/common/item/__tests__/IconCell.test.js +88 -0
- package/src/elements/common/item/iconCellRenderer.js +6 -22
- package/src/elements/common/messages.js +35 -0
- package/src/elements/common/modal.scss +0 -2
- package/src/elements/common/share-access-select/ShareAccessSelect.scss +1 -1
- package/src/elements/common/sub-header/AddButton.js +2 -1
- package/src/elements/common/sub-header/Sort.js +7 -6
- package/src/elements/common/sub-header/SortButton.js +23 -10
- package/src/elements/common/sub-header/ViewModeChangeButton.js +3 -3
- package/src/elements/common/sub-header/__tests__/Sort.test.js +12 -62
- package/src/elements/common/sub-header/__tests__/SortButton.test.js +24 -0
- package/src/elements/common/sub-header/__tests__/SubHeaderRight.test.js +1 -1
- package/src/elements/content-explorer/Content.js +2 -1
- package/src/elements/content-explorer/ContentExplorer.js +50 -13
- package/src/elements/content-explorer/ItemGrid.js +60 -9
- package/src/elements/content-explorer/ItemGridThumbnail.js +5 -2
- package/src/elements/content-explorer/ItemList.js +4 -2
- package/src/elements/content-explorer/ItemList.scss +16 -8
- package/src/elements/content-explorer/MoreOptions.js +11 -4
- package/src/elements/content-explorer/__tests__/ContentExplorer.test.js +44 -0
- package/src/elements/content-explorer/__tests__/MoreOptions.test.js +30 -0
- package/src/elements/content-open-with/ContentOpenWith.scss +1 -1
- package/src/elements/content-picker/Footer.js +62 -51
- package/src/elements/content-picker/ItemList.scss +1 -1
- package/src/elements/content-picker/__tests__/Footer.test.js +17 -0
- package/src/elements/content-preview/ContentPreview.js +43 -6
- package/src/elements/content-preview/__tests__/ContentPreview.test.js +96 -0
- package/src/elements/content-preview/preview-header/PreviewHeader.scss +1 -1
- package/src/elements/content-sharing/ContentSharing.js +2 -2
- package/src/elements/content-sidebar/ActivitySidebar.js +262 -17
- package/src/elements/content-sidebar/ActivitySidebar.scss +7 -0
- package/src/elements/content-sidebar/ActivitySidebarFilter.js +64 -23
- package/src/elements/content-sidebar/AddTaskMenu.scss +1 -1
- package/src/elements/content-sidebar/SidebarContent.js +1 -1
- package/src/elements/content-sidebar/SidebarContent.scss +3 -3
- package/src/elements/content-sidebar/SidebarNav.js +3 -15
- package/src/elements/content-sidebar/SidebarNavSign.scss +3 -25
- package/src/elements/content-sidebar/SidebarNavSign.tsx +53 -55
- package/src/elements/content-sidebar/SidebarNavSignButton.scss +27 -0
- package/src/elements/content-sidebar/SidebarNavSignButton.tsx +73 -0
- package/src/elements/content-sidebar/__tests__/ActivitySidebar.test.js +545 -16
- package/src/elements/content-sidebar/__tests__/ActivitySidebarFilter.test.js +47 -18
- package/src/elements/content-sidebar/__tests__/SidebarNav.test.js +3 -3
- package/src/elements/content-sidebar/__tests__/SidebarNavSign.test.tsx +72 -52
- package/src/elements/content-sidebar/__tests__/SidebarNavSignButton.test.tsx +60 -0
- package/src/elements/content-sidebar/__tests__/__snapshots__/ActivitySidebar.test.js.snap +2 -0
- package/src/elements/content-sidebar/activity-feed/Avatar.js +5 -2
- package/src/elements/content-sidebar/activity-feed/__tests__/Avatar.test.js +0 -10
- package/src/elements/content-sidebar/activity-feed/__tests__/__snapshots__/Avatar.test.js.snap +13 -10
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActiveState.js +73 -28
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.js +80 -13
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityFeed.scss +11 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.scss +28 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityItem.tsx +16 -2
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.js +48 -29
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThread.scss +69 -6
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.js +42 -5
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplies.scss +15 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.js +30 -5
- package/src/elements/content-sidebar/activity-feed/activity-feed/ActivityThreadReplyForm.scss +4 -7
- package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActiveState.test.js +11 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityFeed.test.js +74 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityItem.test.tsx +20 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThread.test.js +8 -3
- package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThreadReplies.test.js +12 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/ActivityThreadRepliesForm.test.js +20 -5
- package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/__snapshots__/ActiveState.test.js.snap +7 -0
- package/src/elements/content-sidebar/activity-feed/activity-feed/__tests__/__snapshots__/ActivityFeed.test.js.snap +3 -0
- package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.js +43 -13
- package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThread.scss +26 -3
- package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.js +67 -56
- package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadContent.scss +1 -1
- package/src/elements/content-sidebar/activity-feed/annotation-thread/AnnotationThreadCreate.js +16 -51
- package/src/elements/content-sidebar/activity-feed/annotation-thread/__mocks__/useAnnotationThread.js +19 -0
- package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThread.test.js +12 -1
- package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThreadContent.test.js +18 -52
- package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/AnnotationThreadCreate.test.js +23 -54
- package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/useAnnotationAPI.test.js +40 -3
- package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/useAnnotationThread.test.js +429 -25
- package/src/elements/content-sidebar/activity-feed/annotation-thread/__tests__/useRepliesAPI.test.js +15 -13
- package/src/elements/content-sidebar/activity-feed/annotation-thread/errors.js +5 -4
- package/src/elements/content-sidebar/activity-feed/annotation-thread/types.js +7 -0
- package/src/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationAPI.js +32 -10
- package/src/elements/content-sidebar/activity-feed/annotation-thread/useAnnotationThread.js +249 -55
- package/src/elements/content-sidebar/activity-feed/annotation-thread/useRepliesAPI.js +42 -83
- package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js +27 -12
- package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.scss +11 -8
- package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivityLink.scss +1 -1
- package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.js +3 -1
- package/src/elements/content-sidebar/activity-feed/annotations/AnnotationActivityMenu.scss +5 -0
- package/src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js +26 -0
- package/src/elements/content-sidebar/activity-feed/comment/BaseComment.js +456 -0
- package/src/elements/content-sidebar/activity-feed/comment/BaseComment.scss +30 -0
- package/src/elements/content-sidebar/activity-feed/comment/Comment.js +42 -5
- package/src/elements/content-sidebar/activity-feed/comment/Comment.scss +10 -0
- package/src/elements/content-sidebar/activity-feed/comment/CreateReply.js +72 -0
- package/src/elements/content-sidebar/activity-feed/comment/CreateReply.scss +21 -0
- package/src/elements/content-sidebar/activity-feed/comment/Replies.scss +41 -0
- package/src/elements/content-sidebar/activity-feed/comment/RepliesToggle.js +41 -0
- package/src/elements/content-sidebar/activity-feed/comment/RepliesToggle.scss +6 -0
- package/src/elements/content-sidebar/activity-feed/comment/__tests__/BaseComment.test.js +373 -0
- package/src/elements/content-sidebar/activity-feed/comment/__tests__/Comment.test.js +14 -6
- package/src/elements/content-sidebar/activity-feed/comment/__tests__/CreateReply.test.js +127 -0
- package/src/elements/content-sidebar/activity-feed/comment/__tests__/Replies.test.js +219 -0
- package/src/elements/content-sidebar/activity-feed/comment/__tests__/RepliesToggle.test.js +82 -0
- package/src/elements/content-sidebar/activity-feed/comment/__tests__/__snapshots__/Comment.test.js.snap +18 -4
- package/src/elements/content-sidebar/activity-feed/comment/messages.js +20 -0
- package/src/elements/content-sidebar/activity-feed/comment-form/CommentForm.js +3 -3
- package/src/elements/content-sidebar/activity-feed/comment-form/CommentForm.scss +1 -1
- package/src/elements/content-sidebar/activity-feed/common/activity-message/ActivityMessage.scss +1 -1
- package/src/elements/content-sidebar/activity-feed/common/activity-message/messages.js +2 -2
- package/src/elements/content-sidebar/activity-feed/common/activity-status/ActivityStatus.scss +1 -1
- package/src/elements/content-sidebar/activity-feed/task-form/TaskForm.js +1 -0
- package/src/elements/content-sidebar/activity-feed/task-new/AssigneeDetails.scss +1 -1
- package/src/elements/content-sidebar/activity-feed/task-new/AvatarGroupAvatar.js +11 -7
- package/src/elements/content-sidebar/activity-feed/task-new/AvatarGroupAvatar.scss +1 -5
- package/src/elements/content-sidebar/activity-feed/task-new/Task.js +1 -2
- package/src/elements/content-sidebar/activity-feed/task-new/Task.scss +1 -8
- package/src/elements/content-sidebar/activity-feed/task-new/__tests__/__snapshots__/Task.test.js.snap +1 -5
- package/src/elements/content-sidebar/messages.js +29 -4
- package/src/elements/content-sidebar/skills/keywords/__tests__/__snapshots__/EditableKeywords.test.js.snap +0 -6
- package/src/elements/content-sidebar/skills/timeline/Timeline.scss +1 -1
- package/src/elements/content-sidebar/skills/transcript/Transcript.scss +1 -1
- package/src/elements/content-sidebar/versions/VersionsGroup.scss +1 -1
- package/src/elements/content-sidebar/versions/VersionsItem.scss +3 -3
- package/src/elements/content-uploader/Footer.js +23 -3
- package/src/elements/content-uploader/Footer.scss +0 -1
- package/src/elements/content-uploader/ItemAction.js +6 -3
- package/src/elements/content-uploader/ItemRemove.js +18 -6
- package/src/elements/content-uploader/UploadInput.js +19 -9
- package/src/elements/content-uploader/__tests__/Footer.test.js +59 -0
- package/src/elements/content-uploader/__tests__/ItemAction.test.js +11 -1
- package/src/elements/content-uploader/__tests__/ItemRemove.test.js +22 -0
- package/src/elements/content-uploader/__tests__/__snapshots__/ItemAction.test.js.snap +36 -0
- package/src/elements/content-uploader/__tests__/__snapshots__/UploadInput.test.js.snap +4 -0
- package/src/features/advanced-content-insights/AdvancedContentInsightsToggle.scss +19 -0
- package/src/features/advanced-content-insights/AdvancedContentInsightsToggle.tsx +59 -0
- package/src/features/advanced-content-insights/__tests__/AdvancedContentInsightsToggle.test.tsx +33 -0
- package/src/features/advanced-content-insights/__tests__/__snapshots__/AdvancedContentInsightsToggle.test.tsx.snap +42 -0
- package/src/features/advanced-content-insights/messages.ts +22 -0
- package/src/features/classification/classificationColorsMap.js +1 -1
- package/src/features/collaborator-avatars/CollaboratorAvatarItem.js +11 -8
- package/src/features/collaborator-avatars/CollaboratorAvatars.scss +1 -1
- package/src/features/collaborator-avatars/CollaboratorList.js +3 -4
- package/src/features/collaborator-avatars/CollaboratorListItem.js +7 -13
- package/src/features/collaborator-avatars/CollaboratorListItem.scss +7 -3
- package/src/features/collaborator-avatars/__tests__/CollaboratorAvatarItem.test.js +6 -2
- package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorAvatarItem.test.js.snap +5 -12
- package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorList.test.js.snap +6 -8
- package/src/features/collaborator-avatars/__tests__/__snapshots__/CollaboratorListItem.test.js.snap +36 -40
- package/src/features/collapsible-sidebar/CollapsibleSidebar.js +5 -2
- package/src/features/collapsible-sidebar/CollapsibleSidebar.scss +4 -7
- package/src/features/collapsible-sidebar/CollapsibleSidebarLogo.js +15 -11
- package/src/features/collapsible-sidebar/__tests__/CollapsibleSidebar.test.js +1 -0
- package/src/features/collapsible-sidebar/__tests__/CollapsibleSidebarLogo.test.js +14 -0
- package/src/features/collapsible-sidebar/__tests__/__snapshots__/CollapsibleSidebar.test.js.snap +1 -1
- package/src/features/content-explorer/content-explorer/ContentExplorer.js +97 -20
- package/src/features/content-explorer/content-explorer/ContentExplorer.scss +67 -8
- package/src/features/content-explorer/content-explorer/ContentExplorerActionButtons.js +53 -13
- package/src/features/content-explorer/content-explorer/ContentExplorerFolderTreeBreadcrumbs.js +82 -0
- package/src/features/content-explorer/content-explorer/ContentExplorerHeaderActions.js +22 -7
- package/src/features/content-explorer/content-explorer/ContentExplorerIncludeSubfolders.js +30 -0
- package/src/features/content-explorer/content-explorer/ContentExplorerSelectAll.js +34 -20
- package/src/features/content-explorer/content-explorer/__tests__/ContentExplorer.test.js +28 -0
- package/src/features/content-explorer/content-explorer/__tests__/ContentExplorerActionButtons.test.js +96 -8
- package/src/features/content-explorer/content-explorer/__tests__/ContentExplorerFolderTreeBreadcrumbs.test.js +91 -0
- package/src/features/content-explorer/content-explorer/__tests__/ContentExplorerHeaderActions.test.js +8 -0
- package/src/features/content-explorer/content-explorer/__tests__/ContentExplorerIncludeSubfolders.test.js +50 -0
- package/src/features/content-explorer/content-explorer/__tests__/__snapshots__/ContentExplorer.test.js.snap +4 -0
- package/src/features/content-explorer/content-explorer/constants.js +6 -0
- package/src/features/content-explorer/content-explorer-modal/ContentExplorerModal.js +13 -0
- package/src/features/content-explorer/content-explorer-modal-container/ContentExplorerModalContainer.js +31 -0
- package/src/features/content-explorer/item-list/ItemList.js +17 -1
- package/src/features/content-explorer/item-list/ItemList.scss +1 -1
- package/src/features/content-explorer/item-list/ItemListButton.js +10 -2
- package/src/features/content-explorer/item-list/ItemListIcon.js +5 -33
- package/src/features/content-explorer/item-list/ItemListName.js +3 -2
- package/src/features/content-explorer/item-list/__tests__/ItemList.test.js +72 -0
- package/src/features/content-explorer/item-list/__tests__/ItemListButton.test.js +8 -0
- package/src/features/content-explorer/item-list/__tests__/ItemListIcon.test.js +24 -18
- package/src/features/content-explorer/item-list/__tests__/__snapshots__/ItemListIcon.test.js.snap +37 -24
- package/src/features/content-explorer/messages.js +41 -24
- package/src/features/content-explorer/prop-types.js +2 -2
- package/src/features/content-insights/_mixins.scss +1 -1
- package/src/features/content-insights/charts/bar/Bar.tsx +24 -3
- package/src/features/content-insights/charts/bar/BarChart.tsx +10 -3
- package/src/features/content-insights/charts/bar/__tests__/Bar.test.tsx +51 -0
- package/src/features/content-insights/charts/bar/__tests__/BarChart.test.tsx +7 -1
- package/src/features/invite-collaborators-modal/InviteCollaboratorsModal.scss +1 -1
- package/src/features/message-center/components/templates/common/styles/MessageFooter.scss +1 -1
- package/src/features/metadata-based-view/IconWithTooltip.js +4 -4
- package/src/features/metadata-based-view/MetadataBasedItemList.scss +1 -1
- package/src/features/metadata-based-view/__tests__/__snapshots__/IconWithTooltip.test.js.snap +3 -3
- package/src/features/metadata-instance-editor/CascadePolicy.scss +1 -1
- package/src/features/metadata-instance-editor/TemplateDropdown.js +4 -10
- package/src/features/metadata-instance-editor/TemplateDropdown.scss +2 -2
- package/src/features/metadata-instance-editor/__tests__/__snapshots__/TemplateDropdown.test.js.snap +28 -7
- package/src/features/metadata-instance-fields/EnumMetadataField.scss +2 -2
- package/src/features/metadata-instance-fields/MultiSelectMetadataField.scss +1 -1
- package/src/features/metadata-instance-fields/ReadOnlyMetadataField.scss +2 -2
- package/src/features/presence/PresenceAvatarList.scss +1 -1
- package/src/features/presence/PresenceCollaborator.scss +1 -1
- package/src/features/query-bar/styles/Condition.scss +2 -2
- package/src/features/quick-search/QuickSearchItem.js +4 -3
- package/src/features/shared-link-settings-modal/ExpirationSection.js +4 -0
- package/src/features/shared-link-settings-modal/SharedLinkSettingsModal.js +9 -5
- package/src/features/shared-link-settings-modal/SharedLinkSettingsModal.scss +3 -3
- package/src/features/shared-link-settings-modal/VanityNameSection.js +2 -2
- package/src/features/shared-link-settings-modal/__tests__/ExpirationSection.test.js +9 -0
- package/src/features/shared-link-settings-modal/__tests__/SharedLinkSettingsModal.test.js +9 -4
- package/src/features/unified-share-modal/InviteePermissionsMenu.js +1 -0
- package/src/features/unified-share-modal/SharedLinkAccessMenu.js +1 -0
- package/src/features/unified-share-modal/SharedLinkPermissionMenu.js +1 -0
- package/src/features/unified-share-modal/SharedLinkSection.js +30 -38
- package/src/features/unified-share-modal/UnifiedShareForm.js +38 -25
- package/src/features/unified-share-modal/UnifiedShareModal.js +9 -1
- package/src/features/unified-share-modal/UnifiedShareModal.scss +24 -13
- package/src/features/unified-share-modal/__tests__/SharedLinkSection.test.js +19 -3
- package/src/features/unified-share-modal/__tests__/UnifiedShareForm.test.js +10 -0
- package/src/features/unified-share-modal/__tests__/UnifiedShareModal.test.js +9 -0
- package/src/features/unified-share-modal/__tests__/__snapshots__/InviteePermissionsMenu.test.js.snap +16 -0
- package/src/features/unified-share-modal/__tests__/__snapshots__/SharedLinkAccessMenu.test.js.snap +6 -0
- package/src/features/unified-share-modal/__tests__/__snapshots__/SharedLinkPermissionMenu.test.js.snap +6 -0
- package/src/features/unified-share-modal/__tests__/__snapshots__/SharedLinkSection.test.js.snap +211 -313
- package/src/features/unified-share-modal/flowTypes.js +10 -2
- package/src/features/unified-share-modal/messages.js +17 -5
- package/src/features/virtualized-table/VirtualizedTable.scss +1 -1
- package/src/features/virtualized-table/__tests__/__snapshots__/BaseVirtualizedTable.test.js.snap +3 -0
- package/src/features/virtualized-table/__tests__/__snapshots__/DraggableVirtualizedTable.test.js.snap +3 -0
- package/src/features/virtualized-table/__tests__/__snapshots__/VirtualizedTable.test.js.snap +8 -0
- package/src/features/virtualized-table-renderers/_mixins.scss +1 -1
- package/src/icons/badges/MetadataDefaultBadge.js.flow +3 -3
- package/src/icons/badges/MetadataDefaultBadge.tsx +3 -3
- package/src/icons/badges/__tests__/__snapshots__/MetadataDefaultBadge.test.tsx.snap +2 -2
- package/src/icons/general/IconAnyTask.js.flow +2 -2
- package/src/icons/general/IconAnyTask.tsx +2 -2
- package/src/icons/general/IconEdit.js.flow +2 -1
- package/src/icons/general/IconEdit.tsx +2 -1
- package/src/icons/general/__tests__/__snapshots__/IconAnyTask.test.tsx.snap +1 -1
- package/src/icons/general/__tests__/__snapshots__/IconEdit.test.tsx.snap +2 -2
- package/src/icons/metadata-view/IconMetadataView.js.flow +2 -1
- package/src/icons/metadata-view/IconMetadataView.tsx +3 -1
- package/src/icons/metadata-view/__tests__/__snapshots__/IconMetadataView.test.tsx.snap +1 -1
- package/src/icons/two-toned/IconAnnotation.js.flow +27 -0
- package/src/icons/two-toned/IconAnnotation.tsx +26 -0
- package/src/icons/two-toned/_IconAnnotation.mixins.scss +9 -0
- package/src/icons/two-toned/__tests__/IconAnnotation.test.tsx +28 -0
- package/src/icons/two-toned/__tests__/__snapshots__/IconAnnotation.test.tsx.snap +28 -0
- package/src/styles/_deprecated.scss +1 -0
- package/src/styles/_inputs.scss +2 -3
- package/src/styles/colors.md +1 -1
- package/src/styles/common/_buttons.scss +2 -2
- package/src/styles/common/_forms.scss +2 -0
- package/src/styles/common/_links.scss +1 -1
- package/src/styles/constants/_colors.scss +1 -1
- package/src/styles/constants/_themes.scss +1 -1
- package/src/styles/typography.stories.scss +60 -0
- package/src/styles/typography.stories.tsx +70 -0
- package/src/styles/variables.js +2 -2
- package/src/styles/variables.json +2 -2
- package/src/styles/variables.ts +2 -2
- package/src/utils/__tests__/__snapshots__/createTheme.test.js.snap +4 -4
- package/src/utils/createTheme.js +2 -2
- package/es/elements/common/sub-header/Sort.scss +0 -8
- package/es/elements/content-sidebar/activity-feed/task-new/_mixins.scss +0 -10
- package/es/features/content-explorer/item-types.js +0 -6
- package/es/features/content-explorer/item-types.js.flow +0 -5
- package/es/features/content-explorer/item-types.js.map +0 -1
- package/src/components/inline-error/README.md +0 -10
- package/src/components/inline-notice/README.md +0 -57
- package/src/components/nav-sidebar/README.md +0 -57
- package/src/components/pill-cloud/README.md +0 -39
- package/src/components/time/README.md +0 -58
- package/src/elements/common/sub-header/Sort.scss +0 -8
- package/src/elements/content-sidebar/activity-feed/task-new/_mixins.scss +0 -10
- package/src/features/content-explorer/item-types.js +0 -5
package/es/api/Item.js
CHANGED
|
@@ -358,10 +358,13 @@ function (_Base) {
|
|
|
358
358
|
*
|
|
359
359
|
* @param {string|void} itemID - ID of item to share
|
|
360
360
|
* @param {BoxItemPermission|void} itemPermissions - Permissions for item
|
|
361
|
+
* @param {boolean|void} canSkipSetShareAccess - skip the check for can_set_share_access when creating a new shared link
|
|
361
362
|
* @throws {Error}
|
|
362
363
|
* @return {void}
|
|
363
364
|
*/
|
|
364
365
|
value: function validateRequest(itemID, itemPermissions) {
|
|
366
|
+
var canSkipSetShareAccess = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
367
|
+
|
|
365
368
|
if (!itemID || !itemPermissions) {
|
|
366
369
|
this.errorCode = ERROR_CODE_SHARE_ITEM;
|
|
367
370
|
throw getBadItemError();
|
|
@@ -370,13 +373,13 @@ function (_Base) {
|
|
|
370
373
|
var can_share = itemPermissions.can_share,
|
|
371
374
|
can_set_share_access = itemPermissions.can_set_share_access;
|
|
372
375
|
|
|
373
|
-
if (!can_share || !can_set_share_access) {
|
|
376
|
+
if (!can_share || !canSkipSetShareAccess && !can_set_share_access) {
|
|
374
377
|
this.errorCode = ERROR_CODE_SHARE_ITEM;
|
|
375
378
|
throw getBadPermissionsError();
|
|
376
379
|
}
|
|
377
380
|
}
|
|
378
381
|
/**
|
|
379
|
-
* API to create or remove a shared link
|
|
382
|
+
* API to create, modify (change access) or remove a shared link
|
|
380
383
|
*
|
|
381
384
|
* @param {Object} item - Item to share
|
|
382
385
|
* @param {string} access - Shared access level
|
|
@@ -397,6 +400,7 @@ function (_Base) {
|
|
|
397
400
|
options,
|
|
398
401
|
id,
|
|
399
402
|
permissions,
|
|
403
|
+
canSkipSetShareAccess,
|
|
400
404
|
fields,
|
|
401
405
|
requestData,
|
|
402
406
|
_ref2,
|
|
@@ -422,8 +426,10 @@ function (_Base) {
|
|
|
422
426
|
id = item.id, permissions = item.permissions;
|
|
423
427
|
this.id = id;
|
|
424
428
|
this.successCallback = successCallback;
|
|
425
|
-
this.errorCallback = errorCallback;
|
|
426
|
-
|
|
429
|
+
this.errorCallback = errorCallback; // if we use the default access level, we don't need permission to set the access level
|
|
430
|
+
|
|
431
|
+
canSkipSetShareAccess = access === undefined;
|
|
432
|
+
this.validateRequest(id, permissions, canSkipSetShareAccess);
|
|
427
433
|
fields = options.fields;
|
|
428
434
|
requestData = {
|
|
429
435
|
url: this.getUrl(this.id),
|
|
@@ -440,25 +446,25 @@ function (_Base) {
|
|
|
440
446
|
};
|
|
441
447
|
}
|
|
442
448
|
|
|
443
|
-
_context.next =
|
|
449
|
+
_context.next = 16;
|
|
444
450
|
return this.xhr.put(requestData);
|
|
445
451
|
|
|
446
|
-
case
|
|
452
|
+
case 16:
|
|
447
453
|
_ref2 = _context.sent;
|
|
448
454
|
data = _ref2.data;
|
|
449
455
|
return _context.abrupt("return", this.shareSuccessHandler(data, fields));
|
|
450
456
|
|
|
451
|
-
case
|
|
452
|
-
_context.prev =
|
|
457
|
+
case 21:
|
|
458
|
+
_context.prev = 21;
|
|
453
459
|
_context.t0 = _context["catch"](4);
|
|
454
460
|
return _context.abrupt("return", this.errorHandler(_context.t0));
|
|
455
461
|
|
|
456
|
-
case
|
|
462
|
+
case 24:
|
|
457
463
|
case "end":
|
|
458
464
|
return _context.stop();
|
|
459
465
|
}
|
|
460
466
|
}
|
|
461
|
-
}, _callee, this, [[4,
|
|
467
|
+
}, _callee, this, [[4, 21]]);
|
|
462
468
|
}));
|
|
463
469
|
|
|
464
470
|
function share(_x, _x2, _x3) {
|
package/es/api/Item.js.flow
CHANGED
|
@@ -290,24 +290,25 @@ class Item extends Base {
|
|
|
290
290
|
*
|
|
291
291
|
* @param {string|void} itemID - ID of item to share
|
|
292
292
|
* @param {BoxItemPermission|void} itemPermissions - Permissions for item
|
|
293
|
+
* @param {boolean|void} canSkipSetShareAccess - skip the check for can_set_share_access when creating a new shared link
|
|
293
294
|
* @throws {Error}
|
|
294
295
|
* @return {void}
|
|
295
296
|
*/
|
|
296
|
-
validateRequest(itemID: ?string, itemPermissions: ?BoxItemPermission) {
|
|
297
|
+
validateRequest(itemID: ?string, itemPermissions: ?BoxItemPermission, canSkipSetShareAccess: boolean = false) {
|
|
297
298
|
if (!itemID || !itemPermissions) {
|
|
298
299
|
this.errorCode = ERROR_CODE_SHARE_ITEM;
|
|
299
300
|
throw getBadItemError();
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
const { can_share, can_set_share_access }: BoxItemPermission = itemPermissions;
|
|
303
|
-
if (!can_share || !can_set_share_access) {
|
|
304
|
+
if (!can_share || (!canSkipSetShareAccess && !can_set_share_access)) {
|
|
304
305
|
this.errorCode = ERROR_CODE_SHARE_ITEM;
|
|
305
306
|
throw getBadPermissionsError();
|
|
306
307
|
}
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
/**
|
|
310
|
-
* API to create or remove a shared link
|
|
311
|
+
* API to create, modify (change access) or remove a shared link
|
|
311
312
|
*
|
|
312
313
|
* @param {Object} item - Item to share
|
|
313
314
|
* @param {string} access - Shared access level
|
|
@@ -333,7 +334,9 @@ class Item extends Base {
|
|
|
333
334
|
this.successCallback = successCallback;
|
|
334
335
|
this.errorCallback = errorCallback;
|
|
335
336
|
|
|
336
|
-
|
|
337
|
+
// if we use the default access level, we don't need permission to set the access level
|
|
338
|
+
const canSkipSetShareAccess = access === undefined;
|
|
339
|
+
this.validateRequest(id, permissions, canSkipSetShareAccess);
|
|
337
340
|
|
|
338
341
|
const { fields } = options;
|
|
339
342
|
const requestData: RequestData = {
|
package/es/api/Item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/Item.js"],"names":["noop","setProp","getBadItemError","getBadPermissionsError","fillMissingProperties","Base","ACCESS_NONE","CACHE_PREFIX_SEARCH","CACHE_PREFIX_FOLDER","TYPE_FOLDER","ERROR_CODE_DELETE_ITEM","ERROR_CODE_RENAME_ITEM","ERROR_CODE_SHARE_ITEM","Item","isDestroyed","parentKey","getParentCacheKey","parentId","folder","getCache","get","postDeleteCleanup","item_collection","entries","total_count","Array","isArray","childKey","getCacheKey","id","oldCount","length","newEntries","filter","entry","newCount","updatedObject","merge","successCallback","data","unsetAll","name","fields","dataWithMissingFields","cache","key","has","set","cacheKey","value","item","errorCallback","Promise","reject","errorCode","permissions","parent","type","can_delete","url","getUrl","xhr","delete","then","deleteSuccessHandler","catch","e","errorHandler","can_rename","put","renameSuccessHandler","itemID","itemPermissions","can_share","can_set_share_access","access","options","validateRequest","requestData","shared_link","params","toString","shareSuccessHandler","sharedLinkParams"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAMA,OAAOA,IAAP,MAAiB,aAAjB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAASC,eAAT,EAA0BC,sBAA1B,QAAwD,gBAAxD;AACA,SAASC,qBAAT,QAAsC,iBAAtC;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,SACIC,WADJ,EAEIC,mBAFJ,EAGIC,mBAHJ,EAIIC,WAJJ,EAKIC,sBALJ,EAMIC,sBANJ,EAOIC,qBAPJ,QAQO,cARP;;IAmBMC,I;;;;;;;;;;;;;;;;;;2EAuFqB,YAAY;AAC/B,UAAI,MAAKC,WAAL,EAAJ,EAAwB;AACpB;AACH,OAH8B,CAK/B;AACA;AACA;AACA;;;AACA,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AAE;AACFwC,oBAAAA,WAAW,EAAEI;AADX;AAFuB,iB;;AAMjC,oBAAIzC,MAAJ,EAAY;AACRoC,kBAAAA,WAAW,CAACE,MAAZ,GAAqB;AAAEtC,oBAAAA,MAAM,EAAEA,MAAM,CAACuC,QAAP;AAAV,mBAArB;AACH;;;uBAEsB,KAAKpB,GAAL,CAASQ,GAAT,CAAaS,WAAb,C;;;;AAAfvC,gBAAAA,I,SAAAA,I;kDACD,KAAK2C,mBAAL,CAAyB3C,IAAzB,EAA+BG,MAA/B,C;;;;;kDAEA,KAAKyB,YAAL,c;;;;;;;;;;;;;;;;;;;EAhXA9D,I;;AAqXnB,eAAeQ,IAAf","sourcesContent":["/**\n * @flow\n * @file Helper for the box item API\n * @author Box\n */\n\nimport noop from 'lodash/noop';\nimport setProp from 'lodash/set';\nimport { getBadItemError, getBadPermissionsError } from '../utils/error';\nimport { fillMissingProperties } from '../utils/fields';\nimport Base from './Base';\nimport {\n ACCESS_NONE,\n CACHE_PREFIX_SEARCH,\n CACHE_PREFIX_FOLDER,\n TYPE_FOLDER,\n ERROR_CODE_DELETE_ITEM,\n ERROR_CODE_RENAME_ITEM,\n ERROR_CODE_SHARE_ITEM,\n} from '../constants';\nimport type { ElementsErrorCallback, RequestData, RequestOptions } from '../common/types/api';\nimport type {\n BoxItem,\n BoxItemPermission,\n FlattenedBoxItem,\n FlattenedBoxItemCollection,\n SharedLink,\n} from '../common/types/core';\nimport type APICache from '../utils/Cache';\n\nclass Item extends Base {\n /**\n * @property {string}\n */\n id: string;\n\n /**\n * @property {string}\n */\n parentId: string;\n\n /**\n * @property {Function}\n */\n successCallback: Function;\n\n /**\n * @property {Function}\n */\n errorCallback: ElementsErrorCallback;\n\n /**\n * Creates a key for the item's parent\n * This is always a folder\n *\n * @param {string} Id - folder id\n * @return {string} Key\n */\n getParentCacheKey(id: string): string {\n return `${CACHE_PREFIX_FOLDER}${id}`;\n }\n\n /**\n * Creates a key for the cache\n *\n * @param {string} Id - Folder id\n * @return {string} Key\n */\n getCacheKey(id: string): string {\n return `getCacheKey(${id}) should be overriden`;\n }\n\n /**\n * API URL for items\n *\n * @param {string} id - Item id\n * @protected\n * @return {string} Base url for files\n */\n getUrl(id: string): string {\n return `getUrl(${id}) should be overriden`;\n }\n\n /**\n * Merges new data with old data and returns new data\n *\n * @param {String} cacheKey - The cache key of item to merge\n * @param {String} key - The attribute to merge\n * @param {Object} value - The value to merge\n * @return {BoxItem} The newly updated object from the cache\n */\n merge(cacheKey: string, key: string, value: any): BoxItem {\n const cache: APICache = this.getCache();\n cache.merge(cacheKey, setProp({}, key, value));\n return cache.get(cacheKey);\n }\n\n /**\n * Steps to do after deletion\n *\n * @return {void}\n */\n postDeleteCleanup(): void {\n if (this.isDestroyed()) {\n return;\n }\n\n // Get rid of all searches\n this.getCache().unsetAll(CACHE_PREFIX_SEARCH);\n this.successCallback();\n }\n\n /**\n * Handles response for deletion\n *\n * @return {void}\n */\n deleteSuccessHandler = (): void => {\n if (this.isDestroyed()) {\n return;\n }\n\n // When fetching the parent folder from the cache\n // we have no guarantees that it will be there since\n // search results happen across folders and we only\n // add those folders to cache that have been navigated to.\n const parentKey: string = this.getParentCacheKey(this.parentId);\n const folder: ?FlattenedBoxItem = this.getCache().get(parentKey);\n if (!folder) {\n this.postDeleteCleanup();\n return;\n }\n\n // Same logic as above but in this case we may have the parent\n // folders meta data in cache but not its contents.\n const { item_collection }: FlattenedBoxItem = folder;\n if (!item_collection) {\n this.postDeleteCleanup();\n return;\n }\n\n const { entries, total_count }: FlattenedBoxItemCollection = item_collection;\n if (!Array.isArray(entries) || typeof total_count !== 'number') {\n throw getBadItemError();\n }\n\n const childKey: string = this.getCacheKey(this.id);\n const oldCount: number = entries.length;\n const newEntries: string[] = entries.filter((entry: string) => entry !== childKey);\n const newCount: number = newEntries.length;\n\n const updatedObject: BoxItem = this.merge(\n parentKey,\n 'item_collection',\n Object.assign(item_collection, {\n entries: newEntries,\n total_count: total_count - (oldCount - newCount),\n }),\n );\n\n this.successCallback(updatedObject);\n this.postDeleteCleanup();\n };\n\n /**\n * API to delete an Item\n *\n * @param {Object} item - Item to delete\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n deleteItem(item: BoxItem, successCallback: Function, errorCallback: ElementsErrorCallback = noop): Promise<void> {\n if (this.isDestroyed()) {\n return Promise.reject();\n }\n\n this.errorCode = ERROR_CODE_DELETE_ITEM;\n const { id, permissions, parent, type }: BoxItem = item;\n if (!id || !permissions || !parent || !type) {\n errorCallback(getBadItemError(), this.errorCode);\n return Promise.reject();\n }\n\n const { id: parentId } = parent;\n const { can_delete }: BoxItemPermission = permissions;\n if (!can_delete || !parentId) {\n errorCallback(getBadPermissionsError(), this.errorCode);\n return Promise.reject();\n }\n\n this.id = id;\n this.parentId = parentId;\n this.successCallback = successCallback;\n this.errorCallback = errorCallback;\n\n const url = `${this.getUrl(id)}${type === TYPE_FOLDER ? '?recursive=true' : ''}`;\n return this.xhr\n .delete({ url })\n .then(this.deleteSuccessHandler)\n .catch((e: $AxiosError<any>) => {\n this.errorHandler(e);\n });\n }\n\n /**\n * Handles response for rename\n *\n * @param {BoxItem} data - The updated item\n * @return {void}\n */\n renameSuccessHandler = ({ data }: { data: BoxItem }): void => {\n if (!this.isDestroyed()) {\n // Get rid of all searches\n this.getCache().unsetAll(CACHE_PREFIX_SEARCH);\n const updatedObject: BoxItem = this.merge(this.getCacheKey(this.id), 'name', data.name);\n this.successCallback(updatedObject);\n }\n };\n\n /**\n * API to rename an Item\n *\n * @param {Object} item - Item to rename\n * @param {string} name - Item new name\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n rename(\n item: BoxItem,\n name: string,\n successCallback: Function,\n errorCallback: ElementsErrorCallback = noop,\n ): Promise<void> {\n if (this.isDestroyed()) {\n return Promise.reject();\n }\n\n this.errorCode = ERROR_CODE_RENAME_ITEM;\n const { id, permissions }: BoxItem = item;\n if (!id || !permissions) {\n errorCallback(getBadItemError(), this.errorCode);\n return Promise.reject();\n }\n\n const { can_rename }: BoxItemPermission = permissions;\n if (!can_rename) {\n errorCallback(getBadPermissionsError(), this.errorCode);\n return Promise.reject();\n }\n\n this.id = id;\n this.successCallback = successCallback;\n this.errorCallback = errorCallback;\n\n return this.xhr\n .put({ url: `${this.getUrl(id)}`, data: { name } })\n .then(this.renameSuccessHandler)\n .catch((e: $AxiosError<any>) => {\n this.errorHandler(e);\n });\n }\n\n /**\n * Handles response for shared link\n *\n * @param {BoxItem} data - The updated item\n * @param {Array<string>} [fields] - Optional fields from request\n * @return {void}\n */\n shareSuccessHandler = (data: BoxItem, fields?: Array<string>): void => {\n if (!this.isDestroyed()) {\n // Add fields that were requested but not returned\n const dataWithMissingFields = fields ? fillMissingProperties(data, fields) : data;\n const cache: APICache = this.getCache();\n const key = this.getCacheKey(this.id);\n\n if (cache.has(key)) {\n cache.merge(key, dataWithMissingFields);\n } else {\n cache.set(key, dataWithMissingFields);\n }\n this.successCallback(cache.get(key));\n }\n };\n\n /**\n * Validate an item update request\n *\n * @param {string|void} itemID - ID of item to share\n * @param {BoxItemPermission|void} itemPermissions - Permissions for item\n * @throws {Error}\n * @return {void}\n */\n validateRequest(itemID: ?string, itemPermissions: ?BoxItemPermission) {\n if (!itemID || !itemPermissions) {\n this.errorCode = ERROR_CODE_SHARE_ITEM;\n throw getBadItemError();\n }\n\n const { can_share, can_set_share_access }: BoxItemPermission = itemPermissions;\n if (!can_share || !can_set_share_access) {\n this.errorCode = ERROR_CODE_SHARE_ITEM;\n throw getBadPermissionsError();\n }\n }\n\n /**\n * API to create or remove a shared link\n *\n * @param {Object} item - Item to share\n * @param {string} access - Shared access level\n * @param {Function} successCallback - Success callback\n * @param {Function|void} errorCallback - Error callback\n * @param {Array<string>|void} [options.fields] - Optionally include specific fields\n * @return {Promise<void>}\n */\n async share(\n item: BoxItem,\n access: ?string, // if \"access\" is undefined, the backend will set the default access level for the shared link\n successCallback: Function,\n errorCallback: ElementsErrorCallback = noop,\n options: RequestOptions = {},\n ): Promise<void> {\n if (this.isDestroyed()) {\n return Promise.reject();\n }\n\n try {\n const { id, permissions }: BoxItem = item;\n this.id = id;\n this.successCallback = successCallback;\n this.errorCallback = errorCallback;\n\n this.validateRequest(id, permissions);\n\n const { fields } = options;\n const requestData: RequestData = {\n url: this.getUrl(this.id),\n data: {\n shared_link: access === ACCESS_NONE ? null : { access },\n },\n };\n if (fields) {\n requestData.params = { fields: fields.toString() };\n }\n\n const { data } = await this.xhr.put(requestData);\n return this.shareSuccessHandler(data, fields);\n } catch (e) {\n return this.errorHandler(e);\n }\n }\n\n /**\n * API to update a shared link\n *\n * @param {BoxItem} item - Item to update\n * @param {$Shape<SharedLink>} sharedLinkParams - New shared link parameters\n * @param {Function} successCallback - Success callback\n * @param {Function|void} errorCallback - Error callback\n * @param {Array<string>|void} [options.fields] - Optionally include specific fields\n * @return {Promise<void>}\n */\n async updateSharedLink(\n item: BoxItem,\n sharedLinkParams: $Shape<SharedLink>,\n successCallback: Function,\n errorCallback: ElementsErrorCallback = noop,\n options: RequestOptions = {},\n ): Promise<void> {\n if (this.isDestroyed()) {\n return Promise.reject();\n }\n\n try {\n const { id, permissions }: BoxItem = item;\n this.id = id;\n this.successCallback = successCallback;\n this.errorCallback = errorCallback;\n\n this.validateRequest(id, permissions);\n\n const { fields } = options;\n const requestData: RequestData = {\n url: this.getUrl(this.id),\n data: {\n shared_link: sharedLinkParams,\n },\n };\n if (fields) {\n requestData.params = { fields: fields.toString() };\n }\n\n const { data } = await this.xhr.put(requestData);\n return this.shareSuccessHandler(data, fields);\n } catch (e) {\n return this.errorHandler(e);\n }\n }\n}\n\nexport default Item;\n"],"file":"Item.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/api/Item.js"],"names":["noop","setProp","getBadItemError","getBadPermissionsError","fillMissingProperties","Base","ACCESS_NONE","CACHE_PREFIX_SEARCH","CACHE_PREFIX_FOLDER","TYPE_FOLDER","ERROR_CODE_DELETE_ITEM","ERROR_CODE_RENAME_ITEM","ERROR_CODE_SHARE_ITEM","Item","isDestroyed","parentKey","getParentCacheKey","parentId","folder","getCache","get","postDeleteCleanup","item_collection","entries","total_count","Array","isArray","childKey","getCacheKey","id","oldCount","length","newEntries","filter","entry","newCount","updatedObject","merge","successCallback","data","unsetAll","name","fields","dataWithMissingFields","cache","key","has","set","cacheKey","value","item","errorCallback","Promise","reject","errorCode","permissions","parent","type","can_delete","url","getUrl","xhr","delete","then","deleteSuccessHandler","catch","e","errorHandler","can_rename","put","renameSuccessHandler","itemID","itemPermissions","canSkipSetShareAccess","can_share","can_set_share_access","access","options","undefined","validateRequest","requestData","shared_link","params","toString","shareSuccessHandler","sharedLinkParams"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAMA,OAAOA,IAAP,MAAiB,aAAjB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAASC,eAAT,EAA0BC,sBAA1B,QAAwD,gBAAxD;AACA,SAASC,qBAAT,QAAsC,iBAAtC;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,SACIC,WADJ,EAEIC,mBAFJ,EAGIC,mBAHJ,EAIIC,WAJJ,EAKIC,sBALJ,EAMIC,sBANJ,EAOIC,qBAPJ,QAQO,cARP;;IAmBMC,I;;;;;;;;;;;;;;;;;;2EAuFqB,YAAY;AAC/B,UAAI,MAAKC,WAAL,EAAJ,EAAwB;AACpB;AACH,OAH8B,CAK/B;AACA;AACA;AACA;;;AACA,UAAMC,SAAiB,GAAG,MAAKC,iBAAL,CAAuB,MAAKC,QAA5B,CAA1B;;AACA,UAAMC,MAAyB,GAAG,MAAKC,QAAL,GAAgBC,GAAhB,CAAoBL,SAApB,CAAlC;;AACA,UAAI,CAACG,MAAL,EAAa;AACT,cAAKG,iBAAL;;AACA;AACH,OAd8B,CAgB/B;AACA;;;AAjB+B,UAkBvBC,eAlBuB,GAkBeJ,MAlBf,CAkBvBI,eAlBuB;;AAmB/B,UAAI,C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;AAAV,mBAArB;AACH;;;uBAEsB,KAAKtB,GAAL,CAASQ,GAAT,CAAaW,WAAb,C;;;;AAAfzC,gBAAAA,I,SAAAA,I;kDACD,KAAK6C,mBAAL,CAAyB7C,IAAzB,EAA+BG,MAA/B,C;;;;;kDAEA,KAAKyB,YAAL,c;;;;;;;;;;;;;;;;;;;EAnXA9D,I;;AAwXnB,eAAeQ,IAAf","sourcesContent":["/**\n * @flow\n * @file Helper for the box item API\n * @author Box\n */\n\nimport noop from 'lodash/noop';\nimport setProp from 'lodash/set';\nimport { getBadItemError, getBadPermissionsError } from '../utils/error';\nimport { fillMissingProperties } from '../utils/fields';\nimport Base from './Base';\nimport {\n ACCESS_NONE,\n CACHE_PREFIX_SEARCH,\n CACHE_PREFIX_FOLDER,\n TYPE_FOLDER,\n ERROR_CODE_DELETE_ITEM,\n ERROR_CODE_RENAME_ITEM,\n ERROR_CODE_SHARE_ITEM,\n} from '../constants';\nimport type { ElementsErrorCallback, RequestData, RequestOptions } from '../common/types/api';\nimport type {\n BoxItem,\n BoxItemPermission,\n FlattenedBoxItem,\n FlattenedBoxItemCollection,\n SharedLink,\n} from '../common/types/core';\nimport type APICache from '../utils/Cache';\n\nclass Item extends Base {\n /**\n * @property {string}\n */\n id: string;\n\n /**\n * @property {string}\n */\n parentId: string;\n\n /**\n * @property {Function}\n */\n successCallback: Function;\n\n /**\n * @property {Function}\n */\n errorCallback: ElementsErrorCallback;\n\n /**\n * Creates a key for the item's parent\n * This is always a folder\n *\n * @param {string} Id - folder id\n * @return {string} Key\n */\n getParentCacheKey(id: string): string {\n return `${CACHE_PREFIX_FOLDER}${id}`;\n }\n\n /**\n * Creates a key for the cache\n *\n * @param {string} Id - Folder id\n * @return {string} Key\n */\n getCacheKey(id: string): string {\n return `getCacheKey(${id}) should be overriden`;\n }\n\n /**\n * API URL for items\n *\n * @param {string} id - Item id\n * @protected\n * @return {string} Base url for files\n */\n getUrl(id: string): string {\n return `getUrl(${id}) should be overriden`;\n }\n\n /**\n * Merges new data with old data and returns new data\n *\n * @param {String} cacheKey - The cache key of item to merge\n * @param {String} key - The attribute to merge\n * @param {Object} value - The value to merge\n * @return {BoxItem} The newly updated object from the cache\n */\n merge(cacheKey: string, key: string, value: any): BoxItem {\n const cache: APICache = this.getCache();\n cache.merge(cacheKey, setProp({}, key, value));\n return cache.get(cacheKey);\n }\n\n /**\n * Steps to do after deletion\n *\n * @return {void}\n */\n postDeleteCleanup(): void {\n if (this.isDestroyed()) {\n return;\n }\n\n // Get rid of all searches\n this.getCache().unsetAll(CACHE_PREFIX_SEARCH);\n this.successCallback();\n }\n\n /**\n * Handles response for deletion\n *\n * @return {void}\n */\n deleteSuccessHandler = (): void => {\n if (this.isDestroyed()) {\n return;\n }\n\n // When fetching the parent folder from the cache\n // we have no guarantees that it will be there since\n // search results happen across folders and we only\n // add those folders to cache that have been navigated to.\n const parentKey: string = this.getParentCacheKey(this.parentId);\n const folder: ?FlattenedBoxItem = this.getCache().get(parentKey);\n if (!folder) {\n this.postDeleteCleanup();\n return;\n }\n\n // Same logic as above but in this case we may have the parent\n // folders meta data in cache but not its contents.\n const { item_collection }: FlattenedBoxItem = folder;\n if (!item_collection) {\n this.postDeleteCleanup();\n return;\n }\n\n const { entries, total_count }: FlattenedBoxItemCollection = item_collection;\n if (!Array.isArray(entries) || typeof total_count !== 'number') {\n throw getBadItemError();\n }\n\n const childKey: string = this.getCacheKey(this.id);\n const oldCount: number = entries.length;\n const newEntries: string[] = entries.filter((entry: string) => entry !== childKey);\n const newCount: number = newEntries.length;\n\n const updatedObject: BoxItem = this.merge(\n parentKey,\n 'item_collection',\n Object.assign(item_collection, {\n entries: newEntries,\n total_count: total_count - (oldCount - newCount),\n }),\n );\n\n this.successCallback(updatedObject);\n this.postDeleteCleanup();\n };\n\n /**\n * API to delete an Item\n *\n * @param {Object} item - Item to delete\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n deleteItem(item: BoxItem, successCallback: Function, errorCallback: ElementsErrorCallback = noop): Promise<void> {\n if (this.isDestroyed()) {\n return Promise.reject();\n }\n\n this.errorCode = ERROR_CODE_DELETE_ITEM;\n const { id, permissions, parent, type }: BoxItem = item;\n if (!id || !permissions || !parent || !type) {\n errorCallback(getBadItemError(), this.errorCode);\n return Promise.reject();\n }\n\n const { id: parentId } = parent;\n const { can_delete }: BoxItemPermission = permissions;\n if (!can_delete || !parentId) {\n errorCallback(getBadPermissionsError(), this.errorCode);\n return Promise.reject();\n }\n\n this.id = id;\n this.parentId = parentId;\n this.successCallback = successCallback;\n this.errorCallback = errorCallback;\n\n const url = `${this.getUrl(id)}${type === TYPE_FOLDER ? '?recursive=true' : ''}`;\n return this.xhr\n .delete({ url })\n .then(this.deleteSuccessHandler)\n .catch((e: $AxiosError<any>) => {\n this.errorHandler(e);\n });\n }\n\n /**\n * Handles response for rename\n *\n * @param {BoxItem} data - The updated item\n * @return {void}\n */\n renameSuccessHandler = ({ data }: { data: BoxItem }): void => {\n if (!this.isDestroyed()) {\n // Get rid of all searches\n this.getCache().unsetAll(CACHE_PREFIX_SEARCH);\n const updatedObject: BoxItem = this.merge(this.getCacheKey(this.id), 'name', data.name);\n this.successCallback(updatedObject);\n }\n };\n\n /**\n * API to rename an Item\n *\n * @param {Object} item - Item to rename\n * @param {string} name - Item new name\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n rename(\n item: BoxItem,\n name: string,\n successCallback: Function,\n errorCallback: ElementsErrorCallback = noop,\n ): Promise<void> {\n if (this.isDestroyed()) {\n return Promise.reject();\n }\n\n this.errorCode = ERROR_CODE_RENAME_ITEM;\n const { id, permissions }: BoxItem = item;\n if (!id || !permissions) {\n errorCallback(getBadItemError(), this.errorCode);\n return Promise.reject();\n }\n\n const { can_rename }: BoxItemPermission = permissions;\n if (!can_rename) {\n errorCallback(getBadPermissionsError(), this.errorCode);\n return Promise.reject();\n }\n\n this.id = id;\n this.successCallback = successCallback;\n this.errorCallback = errorCallback;\n\n return this.xhr\n .put({ url: `${this.getUrl(id)}`, data: { name } })\n .then(this.renameSuccessHandler)\n .catch((e: $AxiosError<any>) => {\n this.errorHandler(e);\n });\n }\n\n /**\n * Handles response for shared link\n *\n * @param {BoxItem} data - The updated item\n * @param {Array<string>} [fields] - Optional fields from request\n * @return {void}\n */\n shareSuccessHandler = (data: BoxItem, fields?: Array<string>): void => {\n if (!this.isDestroyed()) {\n // Add fields that were requested but not returned\n const dataWithMissingFields = fields ? fillMissingProperties(data, fields) : data;\n const cache: APICache = this.getCache();\n const key = this.getCacheKey(this.id);\n\n if (cache.has(key)) {\n cache.merge(key, dataWithMissingFields);\n } else {\n cache.set(key, dataWithMissingFields);\n }\n this.successCallback(cache.get(key));\n }\n };\n\n /**\n * Validate an item update request\n *\n * @param {string|void} itemID - ID of item to share\n * @param {BoxItemPermission|void} itemPermissions - Permissions for item\n * @param {boolean|void} canSkipSetShareAccess - skip the check for can_set_share_access when creating a new shared link\n * @throws {Error}\n * @return {void}\n */\n validateRequest(itemID: ?string, itemPermissions: ?BoxItemPermission, canSkipSetShareAccess: boolean = false) {\n if (!itemID || !itemPermissions) {\n this.errorCode = ERROR_CODE_SHARE_ITEM;\n throw getBadItemError();\n }\n\n const { can_share, can_set_share_access }: BoxItemPermission = itemPermissions;\n if (!can_share || (!canSkipSetShareAccess && !can_set_share_access)) {\n this.errorCode = ERROR_CODE_SHARE_ITEM;\n throw getBadPermissionsError();\n }\n }\n\n /**\n * API to create, modify (change access) or remove a shared link\n *\n * @param {Object} item - Item to share\n * @param {string} access - Shared access level\n * @param {Function} successCallback - Success callback\n * @param {Function|void} errorCallback - Error callback\n * @param {Array<string>|void} [options.fields] - Optionally include specific fields\n * @return {Promise<void>}\n */\n async share(\n item: BoxItem,\n access: ?string, // if \"access\" is undefined, the backend will set the default access level for the shared link\n successCallback: Function,\n errorCallback: ElementsErrorCallback = noop,\n options: RequestOptions = {},\n ): Promise<void> {\n if (this.isDestroyed()) {\n return Promise.reject();\n }\n\n try {\n const { id, permissions }: BoxItem = item;\n this.id = id;\n this.successCallback = successCallback;\n this.errorCallback = errorCallback;\n\n // if we use the default access level, we don't need permission to set the access level\n const canSkipSetShareAccess = access === undefined;\n this.validateRequest(id, permissions, canSkipSetShareAccess);\n\n const { fields } = options;\n const requestData: RequestData = {\n url: this.getUrl(this.id),\n data: {\n shared_link: access === ACCESS_NONE ? null : { access },\n },\n };\n if (fields) {\n requestData.params = { fields: fields.toString() };\n }\n\n const { data } = await this.xhr.put(requestData);\n return this.shareSuccessHandler(data, fields);\n } catch (e) {\n return this.errorHandler(e);\n }\n }\n\n /**\n * API to update a shared link\n *\n * @param {BoxItem} item - Item to update\n * @param {$Shape<SharedLink>} sharedLinkParams - New shared link parameters\n * @param {Function} successCallback - Success callback\n * @param {Function|void} errorCallback - Error callback\n * @param {Array<string>|void} [options.fields] - Optionally include specific fields\n * @return {Promise<void>}\n */\n async updateSharedLink(\n item: BoxItem,\n sharedLinkParams: $Shape<SharedLink>,\n successCallback: Function,\n errorCallback: ElementsErrorCallback = noop,\n options: RequestOptions = {},\n ): Promise<void> {\n if (this.isDestroyed()) {\n return Promise.reject();\n }\n\n try {\n const { id, permissions }: BoxItem = item;\n this.id = id;\n this.successCallback = successCallback;\n this.errorCallback = errorCallback;\n\n this.validateRequest(id, permissions);\n\n const { fields } = options;\n const requestData: RequestData = {\n url: this.getUrl(this.id),\n data: {\n shared_link: sharedLinkParams,\n },\n };\n if (fields) {\n requestData.params = { fields: fields.toString() };\n }\n\n const { data } = await this.xhr.put(requestData);\n return this.shareSuccessHandler(data, fields);\n } catch (e) {\n return this.errorHandler(e);\n }\n }\n}\n\nexport default Item;\n"],"file":"Item.js"}
|
|
@@ -28,7 +28,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
28
28
|
* @author Box
|
|
29
29
|
*/
|
|
30
30
|
import MarkerBasedApi from './MarkerBasedAPI';
|
|
31
|
-
import { PERMISSION_CAN_COMMENT, PERMISSION_CAN_DELETE, PERMISSION_CAN_EDIT, ERROR_CODE_CREATE_COMMENT, ERROR_CODE_UPDATE_COMMENT, ERROR_CODE_DELETE_COMMENT, ERROR_CODE_FETCH_COMMENTS, PERMISSION_CAN_RESOLVE, ERROR_CODE_FETCH_REPLIES, ERROR_CODE_CREATE_REPLY } from '../constants';
|
|
31
|
+
import { PERMISSION_CAN_COMMENT, PERMISSION_CAN_DELETE, PERMISSION_CAN_EDIT, ERROR_CODE_CREATE_COMMENT, ERROR_CODE_UPDATE_COMMENT, ERROR_CODE_DELETE_COMMENT, ERROR_CODE_FETCH_COMMENT, ERROR_CODE_FETCH_COMMENTS, PERMISSION_CAN_RESOLVE, ERROR_CODE_FETCH_REPLIES, ERROR_CODE_CREATE_REPLY } from '../constants';
|
|
32
32
|
import { formatComment } from './utils';
|
|
33
33
|
|
|
34
34
|
var ThreadedComments =
|
|
@@ -252,6 +252,41 @@ function (_MarkerBasedApi) {
|
|
|
252
252
|
errorCallback: errorCallback
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* API for fetching comment
|
|
257
|
+
*
|
|
258
|
+
* @param {string} commentId - comment id
|
|
259
|
+
* @param {string} fileId - the file id
|
|
260
|
+
* @param {BoxItemPermission} permissions - the permissions for the file
|
|
261
|
+
* @param {Function} successCallback - the success callback
|
|
262
|
+
* @param {Function} errorCallback - the error callback
|
|
263
|
+
* @returns {void}
|
|
264
|
+
*/
|
|
265
|
+
|
|
266
|
+
}, {
|
|
267
|
+
key: "getComment",
|
|
268
|
+
value: function getComment(_ref4) {
|
|
269
|
+
var commentId = _ref4.commentId,
|
|
270
|
+
errorCallback = _ref4.errorCallback,
|
|
271
|
+
fileId = _ref4.fileId,
|
|
272
|
+
permissions = _ref4.permissions,
|
|
273
|
+
successCallback = _ref4.successCallback;
|
|
274
|
+
this.errorCode = ERROR_CODE_FETCH_COMMENT;
|
|
275
|
+
|
|
276
|
+
try {
|
|
277
|
+
this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);
|
|
278
|
+
} catch (e) {
|
|
279
|
+
errorCallback(e, this.errorCode);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
this.get({
|
|
284
|
+
id: fileId,
|
|
285
|
+
errorCallback: errorCallback,
|
|
286
|
+
successCallback: successCallback,
|
|
287
|
+
url: this.getUrlForId(commentId)
|
|
288
|
+
});
|
|
289
|
+
}
|
|
255
290
|
/**
|
|
256
291
|
* API for fetching comments
|
|
257
292
|
*
|
|
@@ -269,15 +304,15 @@ function (_MarkerBasedApi) {
|
|
|
269
304
|
|
|
270
305
|
}, {
|
|
271
306
|
key: "getComments",
|
|
272
|
-
value: function getComments(
|
|
273
|
-
var fileId =
|
|
274
|
-
permissions =
|
|
275
|
-
successCallback =
|
|
276
|
-
errorCallback =
|
|
277
|
-
marker =
|
|
278
|
-
limit =
|
|
279
|
-
shouldFetchAll =
|
|
280
|
-
repliesCount =
|
|
307
|
+
value: function getComments(_ref5) {
|
|
308
|
+
var fileId = _ref5.fileId,
|
|
309
|
+
permissions = _ref5.permissions,
|
|
310
|
+
successCallback = _ref5.successCallback,
|
|
311
|
+
errorCallback = _ref5.errorCallback,
|
|
312
|
+
marker = _ref5.marker,
|
|
313
|
+
limit = _ref5.limit,
|
|
314
|
+
shouldFetchAll = _ref5.shouldFetchAll,
|
|
315
|
+
repliesCount = _ref5.repliesCount;
|
|
281
316
|
this.errorCode = ERROR_CODE_FETCH_COMMENTS;
|
|
282
317
|
|
|
283
318
|
try {
|
|
@@ -309,12 +344,12 @@ function (_MarkerBasedApi) {
|
|
|
309
344
|
|
|
310
345
|
}, {
|
|
311
346
|
key: "getCommentReplies",
|
|
312
|
-
value: function getCommentReplies(
|
|
313
|
-
var fileId =
|
|
314
|
-
commentId =
|
|
315
|
-
permissions =
|
|
316
|
-
successCallback =
|
|
317
|
-
errorCallback =
|
|
347
|
+
value: function getCommentReplies(_ref6) {
|
|
348
|
+
var fileId = _ref6.fileId,
|
|
349
|
+
commentId = _ref6.commentId,
|
|
350
|
+
permissions = _ref6.permissions,
|
|
351
|
+
successCallback = _ref6.successCallback,
|
|
352
|
+
errorCallback = _ref6.errorCallback;
|
|
318
353
|
this.errorCode = ERROR_CODE_FETCH_REPLIES;
|
|
319
354
|
|
|
320
355
|
try {
|
|
@@ -342,13 +377,13 @@ function (_MarkerBasedApi) {
|
|
|
342
377
|
|
|
343
378
|
}, {
|
|
344
379
|
key: "createCommentReply",
|
|
345
|
-
value: function createCommentReply(
|
|
346
|
-
var fileId =
|
|
347
|
-
commentId =
|
|
348
|
-
permissions =
|
|
349
|
-
successCallback =
|
|
350
|
-
errorCallback =
|
|
351
|
-
message =
|
|
380
|
+
value: function createCommentReply(_ref7) {
|
|
381
|
+
var fileId = _ref7.fileId,
|
|
382
|
+
commentId = _ref7.commentId,
|
|
383
|
+
permissions = _ref7.permissions,
|
|
384
|
+
successCallback = _ref7.successCallback,
|
|
385
|
+
errorCallback = _ref7.errorCallback,
|
|
386
|
+
message = _ref7.message;
|
|
352
387
|
this.errorCode = ERROR_CODE_CREATE_REPLY;
|
|
353
388
|
|
|
354
389
|
try {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
ERROR_CODE_CREATE_COMMENT,
|
|
13
13
|
ERROR_CODE_UPDATE_COMMENT,
|
|
14
14
|
ERROR_CODE_DELETE_COMMENT,
|
|
15
|
+
ERROR_CODE_FETCH_COMMENT,
|
|
15
16
|
ERROR_CODE_FETCH_COMMENTS,
|
|
16
17
|
PERMISSION_CAN_RESOLVE,
|
|
17
18
|
ERROR_CODE_FETCH_REPLIES,
|
|
@@ -228,6 +229,45 @@ class ThreadedComments extends MarkerBasedApi {
|
|
|
228
229
|
});
|
|
229
230
|
}
|
|
230
231
|
|
|
232
|
+
/**
|
|
233
|
+
* API for fetching comment
|
|
234
|
+
*
|
|
235
|
+
* @param {string} commentId - comment id
|
|
236
|
+
* @param {string} fileId - the file id
|
|
237
|
+
* @param {BoxItemPermission} permissions - the permissions for the file
|
|
238
|
+
* @param {Function} successCallback - the success callback
|
|
239
|
+
* @param {Function} errorCallback - the error callback
|
|
240
|
+
* @returns {void}
|
|
241
|
+
*/
|
|
242
|
+
getComment({
|
|
243
|
+
commentId,
|
|
244
|
+
errorCallback,
|
|
245
|
+
fileId,
|
|
246
|
+
permissions,
|
|
247
|
+
successCallback,
|
|
248
|
+
}: {
|
|
249
|
+
commentId: string,
|
|
250
|
+
errorCallback: (e: ElementsXhrError, code: string) => void,
|
|
251
|
+
fileId: string,
|
|
252
|
+
permissions: BoxItemPermission,
|
|
253
|
+
successCallback: (comment: Comment) => void,
|
|
254
|
+
}): void {
|
|
255
|
+
this.errorCode = ERROR_CODE_FETCH_COMMENT;
|
|
256
|
+
try {
|
|
257
|
+
this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);
|
|
258
|
+
} catch (e) {
|
|
259
|
+
errorCallback(e, this.errorCode);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
this.get({
|
|
264
|
+
id: fileId,
|
|
265
|
+
errorCallback,
|
|
266
|
+
successCallback,
|
|
267
|
+
url: this.getUrlForId(commentId),
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
231
271
|
/**
|
|
232
272
|
* API for fetching comments
|
|
233
273
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/ThreadedComments.js"],"names":["MarkerBasedApi","PERMISSION_CAN_COMMENT","PERMISSION_CAN_DELETE","PERMISSION_CAN_EDIT","ERROR_CODE_CREATE_COMMENT","ERROR_CODE_UPDATE_COMMENT","ERROR_CODE_DELETE_COMMENT","ERROR_CODE_FETCH_COMMENTS","PERMISSION_CAN_RESOLVE","ERROR_CODE_FETCH_REPLIES","ERROR_CODE_CREATE_REPLY","formatComment","ThreadedComments","data","isDestroyed","successCallback","entries","comments","map","fileId","getBaseApiUrl","commentId","getUrl","getUrlForId","file","message","errorCallback","errorCode","id","permissions","checkApiCallValidity","e","post","url","status","requestData","put","delete","marker","limit","shouldFetchAll","repliesCount","markerGet","replies_count","get","getUrlWithRepliesForId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAMA,OAAOA,cAAP,MAA2B,kBAA3B;AACA,SACIC,sBADJ,EAEIC,qBAFJ,EAGIC,mBAHJ,EAIIC,yBAJJ,EAKIC,yBALJ,EAMIC,yBANJ,EAOIC,yBAPJ,EAQIC,sBARJ,EASIC,wBATJ,EAUIC,uBAVJ,QAWO,cAXP;AAYA,SAASC,aAAT,QAA8B,SAA9B;;IAWMC,gB;;;;;;;;;;;;;;;;;;qEAoCe,UAACC,IAAD,EAAwB;AACrC,UAAI,MAAKC,WAAL,MAAsB,OAAO,MAAKC,eAAZ,KAAgC,UAA1D,EAAsE;AAClE;AACH,OAHoC,CAKrC;;;AACA,UAAI,CAACF,IAAL,EAAW;AACP,cAAKE,eAAL;;AACA;AACH,OAToC,CAWrC;;;AACA,UAAI,CAACF,IAAI,CAACG,OAAV,EAAmB;AACf,cAAKD,eAAL,CAAqBJ,aAAa,CAACE,IAAD,CAAlC;;AACA;AACH;;AAED,UAAMI,QAAQ,GAAGJ,IAAI,CAACG,OAAL,CAAaE,GAAb,CAAiBP,aAAjB,CAAjB;;AACA,YAAKI,eAAL,mBAA0BF,IAA1B;AAAgCG,QAAAA,OAAO,EAAEC;AAAzC;AACH,K;;;;;;;;AAtDD;;;;;;2BAMOE,M,EAAyB;AAC5B,uBAAU,KAAKC,aAAL,EAAV,4BAAgDD,MAAM,sBAAeA,MAAf,IAA0B,EAAhF;AACH;AAED;;;;;;;;;gCAMYE,S,EAA2B;AACnC,uBAAU,KAAKC,MAAL,EAAV,cAA2BD,SAA3B;AACH;AAED;;;;;;;;;;2CAOuBA,S,EAAmBF,M,EAAyB;AAC/D,uBAAU,KAAKI,WAAL,CAAiBF,SAAjB,CAAV,qBAAgDF,MAAM,sBAAeA,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AAa,CAACK,CAAD,EAAI,KAAKJ,SAAT,CAAb;AACA;AACH;;AAED,WAAKiB,GAAL,CAAS;AACLhB,QAAAA,EAAE,EAAET,MADC;AAELO,QAAAA,aAAa,EAAbA,aAFK;AAGLX,QAAAA,eAAe,EAAfA,eAHK;AAILkB,QAAAA,GAAG,EAAE,KAAKY,sBAAL,CAA4BxB,SAA5B;AAJA,OAAT;AAMH;AAED;;;;;;;;;;;8CAsBS;AAAA,UAbLF,MAaK,SAbLA,MAaK;AAAA,UAZLE,SAYK,SAZLA,SAYK;AAAA,UAXLQ,WAWK,SAXLA,WAWK;AAAA,UAVLd,eAUK,SAVLA,eAUK;AAAA,UATLW,aASK,SATLA,aASK;AAAA,UARLD,OAQK,SARLA,OAQK;AACL,WAAKE,SAAL,GAAiBjB,uBAAjB;;AAEA,UAAI;AACA,aAAKoB,oBAAL,CAA0B7B,sBAA1B,EAAkD4B,WAAlD,EAA+DV,MAA/D;AACH,OAFD,CAEE,OAAOY,CAAP,EAAU;AACRL,QAAAA,aAAa,CAACK,CAAD,EAAI,KAAKJ,SAAT,CAAb;AACA;AACH;;AAED,WAAKK,IAAL,CAAU;AACNJ,QAAAA,EAAE,EAAET,MADE;AAENN,QAAAA,IAAI,EAAE;AAAEA,UAAAA,IAAI,EAAE;AAAEY,YAAAA,OAAO,EAAPA;AAAF;AAAR,SAFA;AAGNC,QAAAA,aAAa,EAAbA,aAHM;AAINX,QAAAA,eAAe,EAAfA,eAJM;AAKNkB,QAAAA,GAAG,EAAE,KAAKY,sBAAL,CAA4BxB,SAA5B,EAAuCF,MAAvC;AALC,OAAV;AAOH;;;;EA1U0BnB,c;;AA6U/B,eAAeY,gBAAf","sourcesContent":["/**\n * @flow\n * @file Helper for the box threadedComments API\n * @author Box\n */\n\nimport MarkerBasedApi from './MarkerBasedAPI';\nimport {\n PERMISSION_CAN_COMMENT,\n PERMISSION_CAN_DELETE,\n PERMISSION_CAN_EDIT,\n ERROR_CODE_CREATE_COMMENT,\n ERROR_CODE_UPDATE_COMMENT,\n ERROR_CODE_DELETE_COMMENT,\n ERROR_CODE_FETCH_COMMENTS,\n PERMISSION_CAN_RESOLVE,\n ERROR_CODE_FETCH_REPLIES,\n ERROR_CODE_CREATE_REPLY,\n} from '../constants';\nimport { formatComment } from './utils';\n\nimport type { ElementsXhrError, ElementsErrorCallback } from '../common/types/api';\nimport type { BoxItem, BoxItemPermission } from '../common/types/core';\nimport type {\n BoxCommentPermission,\n Comment,\n FeedItemStatus,\n ThreadedComments as ThreadedCommentsType,\n} from '../common/types/feed';\n\nclass ThreadedComments extends MarkerBasedApi {\n /**\n * API URL for comments\n *\n * @param {string} [fileId]\n * @return {string} base url for comments\n */\n getUrl(fileId?: string): string {\n return `${this.getBaseApiUrl()}/undoc/comments${fileId ? `?file_id=${fileId}` : ''}`;\n }\n\n /**\n * API URL for specific comment\n *\n * @param {string} [commentId]\n * @return {string} base url for specific comment\n */\n getUrlForId(commentId: string): string {\n return `${this.getUrl()}/${commentId}`;\n }\n\n /**\n * API URL for specific comment\n *\n * @param {string} commentId\n * @param {string} [fileId]\n * @return {string} base url for specific comment replies\n */\n getUrlWithRepliesForId(commentId: string, fileId?: string): string {\n return `${this.getUrlForId(commentId)}/replies${fileId ? `?file_id=${fileId}` : ''}`;\n }\n\n /**\n * Formats the threaded comments api response to usable data\n * @param {Object} data the api response data\n */\n successHandler = (data: Object): void => {\n if (this.isDestroyed() || typeof this.successCallback !== 'function') {\n return;\n }\n\n // There is no response data when deleting a comment\n if (!data) {\n this.successCallback();\n return;\n }\n\n // We don't have entries when updating/creating a comment\n if (!data.entries) {\n this.successCallback(formatComment(data));\n return;\n }\n\n const comments = data.entries.map(formatComment);\n this.successCallback({ ...data, entries: comments });\n };\n\n /**\n * API for creating a comment on a file\n *\n * @param {BoxItem} file - File object for which we are creating a comment\n * @param {string} message - Comment message\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n createComment({\n file,\n message,\n successCallback,\n errorCallback,\n }: {\n errorCallback: ElementsErrorCallback,\n file: BoxItem,\n message?: string,\n successCallback: (comment: Comment) => void,\n }): void {\n this.errorCode = ERROR_CODE_CREATE_COMMENT;\n const { id, permissions } = file;\n\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, id);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.post({\n id,\n url: this.getUrl(id),\n data: {\n data: { message },\n },\n successCallback,\n errorCallback,\n });\n }\n\n /**\n * API for updating a comment\n *\n * @param {string} fileId - File id for which we are updating a comment\n * @param {string} commentId - Comment to be edited\n * @param {FeedItemStatus} status - Comment status\n * @param {string} message - Comment message\n * @param {BoxCommentPermission} permissions - The known permissions of the comment we're updating\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n updateComment({\n fileId,\n commentId,\n status,\n message,\n permissions,\n successCallback,\n errorCallback,\n }: {\n commentId: string,\n errorCallback: ElementsErrorCallback,\n fileId: string,\n message?: string,\n permissions: BoxCommentPermission,\n status?: FeedItemStatus,\n successCallback: (comment: Comment) => void,\n }): void {\n this.errorCode = ERROR_CODE_UPDATE_COMMENT;\n\n if (message) {\n try {\n this.checkApiCallValidity(PERMISSION_CAN_EDIT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n }\n\n if (status) {\n try {\n this.checkApiCallValidity(PERMISSION_CAN_RESOLVE, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n }\n\n const requestData = {\n data: { status, message },\n };\n\n this.put({\n id: fileId,\n url: this.getUrlForId(commentId),\n data: requestData,\n successCallback,\n errorCallback,\n });\n }\n\n /**\n * API for deleting a comment or reply\n *\n * @param {string} fileId - Id of an object for which we are deleting a comment\n * @param {string} commentId - Id of the comment we are deleting\n * @param {BoxCommentPermission} permissions - The known permissions of the comment we're deleting\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n deleteComment({\n fileId,\n commentId,\n permissions,\n successCallback,\n errorCallback,\n }: {\n commentId: string,\n errorCallback: ElementsErrorCallback,\n fileId: string,\n permissions: BoxCommentPermission,\n successCallback: Function,\n }): void {\n this.errorCode = ERROR_CODE_DELETE_COMMENT;\n\n try {\n this.checkApiCallValidity(PERMISSION_CAN_DELETE, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.delete({\n id: fileId,\n url: this.getUrlForId(commentId),\n successCallback,\n errorCallback,\n });\n }\n\n /**\n * API for fetching comments\n *\n * @param {string} fileId - the file id\n * @param {BoxItemPermission} permissions - the permissions for the file\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @param {array} fields - the fields to fetch\n * @param {string} marker the marker from the start to start fetching at\n * @param {number} limit - the number of items to fetch\n * @param {boolean} shouldFetchAll - true if should get all the pages before calling the sucessCallback\n * @param {number} repliesCount - number of replies to return, by deafult all replies all returned\n * @returns {void}\n */\n getComments({\n fileId,\n permissions,\n successCallback,\n errorCallback,\n marker,\n limit,\n shouldFetchAll,\n repliesCount,\n }: {\n errorCallback: (e: ElementsXhrError, code: string) => void,\n fileId: string,\n limit?: number,\n marker?: string,\n permissions: BoxItemPermission,\n repliesCount?: number,\n shouldFetchAll?: boolean,\n successCallback: (threadedComments: ThreadedCommentsType) => void,\n }): void {\n this.errorCode = ERROR_CODE_FETCH_COMMENTS;\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.markerGet({\n id: fileId,\n successCallback,\n errorCallback,\n marker,\n limit,\n requestData: {\n ...(repliesCount ? { replies_count: repliesCount } : null),\n },\n shouldFetchAll,\n });\n }\n\n /**\n * @param {string} fileId - the file id\n * @param {string} commentId - id of a Comment\n * @param {BoxItemPermission} permissions - The known permissions of the comment\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n */\n getCommentReplies({\n fileId,\n commentId,\n permissions,\n successCallback,\n errorCallback,\n }: {\n commentId: string,\n errorCallback: (e: ElementsXhrError, code: string) => void,\n fileId: string,\n permissions: BoxItemPermission,\n successCallback: (comments: ThreadedCommentsType) => void,\n }): void {\n this.errorCode = ERROR_CODE_FETCH_REPLIES;\n\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.get({\n id: fileId,\n errorCallback,\n successCallback,\n url: this.getUrlWithRepliesForId(commentId),\n });\n }\n\n /**\n * @param {string} fileId - the file id\n * @param {string} commentId - id of a Comment for which we createing Reply\n * @param {BoxItemPermission} permissions - The known permissions of the comment\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @param {string} message - message of the Reply\n */\n createCommentReply({\n fileId,\n commentId,\n permissions,\n successCallback,\n errorCallback,\n message,\n }: {\n commentId: string,\n errorCallback: (e: ElementsXhrError, code: string) => void,\n fileId: string,\n message: string,\n permissions: BoxItemPermission,\n successCallback: (comment: Comment) => void,\n }): void {\n this.errorCode = ERROR_CODE_CREATE_REPLY;\n\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.post({\n id: fileId,\n data: { data: { message } },\n errorCallback,\n successCallback,\n url: this.getUrlWithRepliesForId(commentId, fileId),\n });\n }\n}\n\nexport default ThreadedComments;\n"],"file":"ThreadedComments.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/api/ThreadedComments.js"],"names":["MarkerBasedApi","PERMISSION_CAN_COMMENT","PERMISSION_CAN_DELETE","PERMISSION_CAN_EDIT","ERROR_CODE_CREATE_COMMENT","ERROR_CODE_UPDATE_COMMENT","ERROR_CODE_DELETE_COMMENT","ERROR_CODE_FETCH_COMMENT","ERROR_CODE_FETCH_COMMENTS","PERMISSION_CAN_RESOLVE","ERROR_CODE_FETCH_REPLIES","ERROR_CODE_CREATE_REPLY","formatComment","ThreadedComments","data","isDestroyed","successCallback","entries","comments","map","fileId","getBaseApiUrl","commentId","getUrl","getUrlForId","file","message","errorCallback","errorCode","id","permissions","checkApiCallValidity","e","post","url","status","requestData","put","delete","get","marker","limit","shouldFetchAll","repliesCount","markerGet","replies_count","getUrlWithRepliesForId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAMA,OAAOA,cAAP,MAA2B,kBAA3B;AACA,SACIC,sBADJ,EAEIC,qBAFJ,EAGIC,mBAHJ,EAIIC,yBAJJ,EAKIC,yBALJ,EAMIC,yBANJ,EAOIC,wBAPJ,EAQIC,yBARJ,EASIC,sBATJ,EAUIC,wBAVJ,EAWIC,uBAXJ,QAYO,cAZP;AAaA,SAASC,aAAT,QAA8B,SAA9B;;IAWMC,gB;;;;;;;;;;;;;;;;;;qEAoCe,UAACC,IAAD,EAAwB;AACrC,UAAI,MAAKC,WAAL,MAAsB,OAAO,MAAKC,eAAZ,KAAgC,UAA1D,EAAsE;AAClE;AACH,OAHoC,CAKrC;;;AACA,UAAI,CAACF,IAAL,EAAW;AACP,cAAKE,eAAL;;AACA;AACH,OAToC,CAWrC;;;AACA,UAAI,CAACF,IAAI,CAACG,OAAV,EAAmB;AACf,cAAKD,eAAL,CAAqBJ,aAAa,CAACE,IAAD,CAAlC;;AACA;AACH;;AAED,UAAMI,QAAQ,GAAGJ,IAAI,CAACG,OAAL,CAAaE,GAAb,CAAiBP,aAAjB,CAAjB;;AACA,YAAKI,eAAL,mBAA0BF,IAA1B;AAAgCG,QAAAA,OAAO,EAAEC;AAAzC;AACH,K;;;;;;;;AAtDD;;;;;;2BAMOE,M,EAAyB;AAC5B,uBAAU,KAAKC,aAAL,EAAV,4BAAgDD,MAAM,sBAAeA,MAAf,IAA0B,EAAhF;AACH;AAED;;;;;;;;;gCAMYE,S,EAA2B;AACnC,uBAAU,KAAKC,MAAL,EAAV,cAA2BD,SAA3B;AACH;AAED;;;;;;;;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,oBAAL,CAA0B9B,sBAA1B,EAAkD6B,WAAlD,EAA+DV,MAA/D;AACH,OAFD,CAEE,OAAOY,CAAP,EAAU;AACRL,QAAAA,aAAa,CAACK,CAAD,EAAI,KAAKJ,SAAT,CAAb;AACA;AACH;;AAED,WAAKK,IAAL,CAAU;AACNJ,QAAAA,EAAE,EAAET,MADE;AAENN,QAAAA,IAAI,EAAE;AAAEA,UAAAA,IAAI,EAAE;AAAEY,YAAAA,OAAO,EAAPA;AAAF;AAAR,SAFA;AAGNC,QAAAA,aAAa,EAAbA,aAHM;AAINX,QAAAA,eAAe,EAAfA,eAJM;AAKNkB,QAAAA,GAAG,EAAE,KAAKY,sBAAL,CAA4BxB,SAA5B,EAAuCF,MAAvC;AALC,OAAV;AAOH;;;;EAjX0BpB,c;;AAoX/B,eAAea,gBAAf","sourcesContent":["/**\n * @flow\n * @file Helper for the box threadedComments API\n * @author Box\n */\n\nimport MarkerBasedApi from './MarkerBasedAPI';\nimport {\n PERMISSION_CAN_COMMENT,\n PERMISSION_CAN_DELETE,\n PERMISSION_CAN_EDIT,\n ERROR_CODE_CREATE_COMMENT,\n ERROR_CODE_UPDATE_COMMENT,\n ERROR_CODE_DELETE_COMMENT,\n ERROR_CODE_FETCH_COMMENT,\n ERROR_CODE_FETCH_COMMENTS,\n PERMISSION_CAN_RESOLVE,\n ERROR_CODE_FETCH_REPLIES,\n ERROR_CODE_CREATE_REPLY,\n} from '../constants';\nimport { formatComment } from './utils';\n\nimport type { ElementsXhrError, ElementsErrorCallback } from '../common/types/api';\nimport type { BoxItem, BoxItemPermission } from '../common/types/core';\nimport type {\n BoxCommentPermission,\n Comment,\n FeedItemStatus,\n ThreadedComments as ThreadedCommentsType,\n} from '../common/types/feed';\n\nclass ThreadedComments extends MarkerBasedApi {\n /**\n * API URL for comments\n *\n * @param {string} [fileId]\n * @return {string} base url for comments\n */\n getUrl(fileId?: string): string {\n return `${this.getBaseApiUrl()}/undoc/comments${fileId ? `?file_id=${fileId}` : ''}`;\n }\n\n /**\n * API URL for specific comment\n *\n * @param {string} [commentId]\n * @return {string} base url for specific comment\n */\n getUrlForId(commentId: string): string {\n return `${this.getUrl()}/${commentId}`;\n }\n\n /**\n * API URL for specific comment\n *\n * @param {string} commentId\n * @param {string} [fileId]\n * @return {string} base url for specific comment replies\n */\n getUrlWithRepliesForId(commentId: string, fileId?: string): string {\n return `${this.getUrlForId(commentId)}/replies${fileId ? `?file_id=${fileId}` : ''}`;\n }\n\n /**\n * Formats the threaded comments api response to usable data\n * @param {Object} data the api response data\n */\n successHandler = (data: Object): void => {\n if (this.isDestroyed() || typeof this.successCallback !== 'function') {\n return;\n }\n\n // There is no response data when deleting a comment\n if (!data) {\n this.successCallback();\n return;\n }\n\n // We don't have entries when updating/creating a comment\n if (!data.entries) {\n this.successCallback(formatComment(data));\n return;\n }\n\n const comments = data.entries.map(formatComment);\n this.successCallback({ ...data, entries: comments });\n };\n\n /**\n * API for creating a comment on a file\n *\n * @param {BoxItem} file - File object for which we are creating a comment\n * @param {string} message - Comment message\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n createComment({\n file,\n message,\n successCallback,\n errorCallback,\n }: {\n errorCallback: ElementsErrorCallback,\n file: BoxItem,\n message?: string,\n successCallback: (comment: Comment) => void,\n }): void {\n this.errorCode = ERROR_CODE_CREATE_COMMENT;\n const { id, permissions } = file;\n\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, id);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.post({\n id,\n url: this.getUrl(id),\n data: {\n data: { message },\n },\n successCallback,\n errorCallback,\n });\n }\n\n /**\n * API for updating a comment\n *\n * @param {string} fileId - File id for which we are updating a comment\n * @param {string} commentId - Comment to be edited\n * @param {FeedItemStatus} status - Comment status\n * @param {string} message - Comment message\n * @param {BoxCommentPermission} permissions - The known permissions of the comment we're updating\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n updateComment({\n fileId,\n commentId,\n status,\n message,\n permissions,\n successCallback,\n errorCallback,\n }: {\n commentId: string,\n errorCallback: ElementsErrorCallback,\n fileId: string,\n message?: string,\n permissions: BoxCommentPermission,\n status?: FeedItemStatus,\n successCallback: (comment: Comment) => void,\n }): void {\n this.errorCode = ERROR_CODE_UPDATE_COMMENT;\n\n if (message) {\n try {\n this.checkApiCallValidity(PERMISSION_CAN_EDIT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n }\n\n if (status) {\n try {\n this.checkApiCallValidity(PERMISSION_CAN_RESOLVE, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n }\n\n const requestData = {\n data: { status, message },\n };\n\n this.put({\n id: fileId,\n url: this.getUrlForId(commentId),\n data: requestData,\n successCallback,\n errorCallback,\n });\n }\n\n /**\n * API for deleting a comment or reply\n *\n * @param {string} fileId - Id of an object for which we are deleting a comment\n * @param {string} commentId - Id of the comment we are deleting\n * @param {BoxCommentPermission} permissions - The known permissions of the comment we're deleting\n * @param {Function} successCallback - Success callback\n * @param {Function} errorCallback - Error callback\n * @return {void}\n */\n deleteComment({\n fileId,\n commentId,\n permissions,\n successCallback,\n errorCallback,\n }: {\n commentId: string,\n errorCallback: ElementsErrorCallback,\n fileId: string,\n permissions: BoxCommentPermission,\n successCallback: Function,\n }): void {\n this.errorCode = ERROR_CODE_DELETE_COMMENT;\n\n try {\n this.checkApiCallValidity(PERMISSION_CAN_DELETE, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.delete({\n id: fileId,\n url: this.getUrlForId(commentId),\n successCallback,\n errorCallback,\n });\n }\n\n /**\n * API for fetching comment\n *\n * @param {string} commentId - comment id\n * @param {string} fileId - the file id\n * @param {BoxItemPermission} permissions - the permissions for the file\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @returns {void}\n */\n getComment({\n commentId,\n errorCallback,\n fileId,\n permissions,\n successCallback,\n }: {\n commentId: string,\n errorCallback: (e: ElementsXhrError, code: string) => void,\n fileId: string,\n permissions: BoxItemPermission,\n successCallback: (comment: Comment) => void,\n }): void {\n this.errorCode = ERROR_CODE_FETCH_COMMENT;\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.get({\n id: fileId,\n errorCallback,\n successCallback,\n url: this.getUrlForId(commentId),\n });\n }\n\n /**\n * API for fetching comments\n *\n * @param {string} fileId - the file id\n * @param {BoxItemPermission} permissions - the permissions for the file\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @param {array} fields - the fields to fetch\n * @param {string} marker the marker from the start to start fetching at\n * @param {number} limit - the number of items to fetch\n * @param {boolean} shouldFetchAll - true if should get all the pages before calling the sucessCallback\n * @param {number} repliesCount - number of replies to return, by deafult all replies all returned\n * @returns {void}\n */\n getComments({\n fileId,\n permissions,\n successCallback,\n errorCallback,\n marker,\n limit,\n shouldFetchAll,\n repliesCount,\n }: {\n errorCallback: (e: ElementsXhrError, code: string) => void,\n fileId: string,\n limit?: number,\n marker?: string,\n permissions: BoxItemPermission,\n repliesCount?: number,\n shouldFetchAll?: boolean,\n successCallback: (threadedComments: ThreadedCommentsType) => void,\n }): void {\n this.errorCode = ERROR_CODE_FETCH_COMMENTS;\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.markerGet({\n id: fileId,\n successCallback,\n errorCallback,\n marker,\n limit,\n requestData: {\n ...(repliesCount ? { replies_count: repliesCount } : null),\n },\n shouldFetchAll,\n });\n }\n\n /**\n * @param {string} fileId - the file id\n * @param {string} commentId - id of a Comment\n * @param {BoxItemPermission} permissions - The known permissions of the comment\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n */\n getCommentReplies({\n fileId,\n commentId,\n permissions,\n successCallback,\n errorCallback,\n }: {\n commentId: string,\n errorCallback: (e: ElementsXhrError, code: string) => void,\n fileId: string,\n permissions: BoxItemPermission,\n successCallback: (comments: ThreadedCommentsType) => void,\n }): void {\n this.errorCode = ERROR_CODE_FETCH_REPLIES;\n\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.get({\n id: fileId,\n errorCallback,\n successCallback,\n url: this.getUrlWithRepliesForId(commentId),\n });\n }\n\n /**\n * @param {string} fileId - the file id\n * @param {string} commentId - id of a Comment for which we createing Reply\n * @param {BoxItemPermission} permissions - The known permissions of the comment\n * @param {Function} successCallback - the success callback\n * @param {Function} errorCallback - the error callback\n * @param {string} message - message of the Reply\n */\n createCommentReply({\n fileId,\n commentId,\n permissions,\n successCallback,\n errorCallback,\n message,\n }: {\n commentId: string,\n errorCallback: (e: ElementsXhrError, code: string) => void,\n fileId: string,\n message: string,\n permissions: BoxItemPermission,\n successCallback: (comment: Comment) => void,\n }): void {\n this.errorCode = ERROR_CODE_CREATE_REPLY;\n\n try {\n this.checkApiCallValidity(PERMISSION_CAN_COMMENT, permissions, fileId);\n } catch (e) {\n errorCallback(e, this.errorCode);\n return;\n }\n\n this.post({\n id: fileId,\n data: { data: { message } },\n errorCallback,\n successCallback,\n url: this.getUrlWithRepliesForId(commentId, fileId),\n });\n }\n}\n\nexport default ThreadedComments;\n"],"file":"ThreadedComments.js"}
|
package/es/common/types/feed.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { COMMENT_STATUS_OPEN, COMMENT_STATUS_RESOLVED, FEED_ITEM_TYPE_ANNOTATION, FEED_ITEM_TYPE_APP_ACTIVITY, FEED_ITEM_TYPE_COMMENT, FEED_ITEM_TYPE_TASK } from '../../constants';
|
|
1
|
+
import { ACTIVITY_FILTER_OPTION_ALL, ACTIVITY_FILTER_OPTION_RESOLVED, ACTIVITY_FILTER_OPTION_TASKS, ACTIVITY_FILTER_OPTION_UNRESOLVED, COMMENT_STATUS_OPEN, COMMENT_STATUS_RESOLVED, FEED_ITEM_TYPE_ANNOTATION, FEED_ITEM_TYPE_APP_ACTIVITY, FEED_ITEM_TYPE_COMMENT, FEED_ITEM_TYPE_VERSION, FEED_ITEM_TYPE_TASK } from '../../constants';
|
|
2
2
|
//# sourceMappingURL=feed.js.map
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
import type { MessageDescriptor } from 'react-intl';
|
|
3
3
|
import {
|
|
4
|
+
ACTIVITY_FILTER_OPTION_ALL,
|
|
5
|
+
ACTIVITY_FILTER_OPTION_RESOLVED,
|
|
6
|
+
ACTIVITY_FILTER_OPTION_TASKS,
|
|
7
|
+
ACTIVITY_FILTER_OPTION_UNRESOLVED,
|
|
4
8
|
COMMENT_STATUS_OPEN,
|
|
5
9
|
COMMENT_STATUS_RESOLVED,
|
|
6
10
|
FEED_ITEM_TYPE_ANNOTATION,
|
|
7
11
|
FEED_ITEM_TYPE_APP_ACTIVITY,
|
|
8
12
|
FEED_ITEM_TYPE_COMMENT,
|
|
13
|
+
FEED_ITEM_TYPE_VERSION,
|
|
9
14
|
FEED_ITEM_TYPE_TASK,
|
|
10
15
|
} from '../../constants';
|
|
11
16
|
import type { BoxItemPermission, BoxItemVersion, Reply, User } from './core';
|
|
12
17
|
import type { Annotation, AnnotationPermission, Annotations } from './annotations';
|
|
13
18
|
|
|
19
|
+
type FeedItemType =
|
|
20
|
+
| typeof FEED_ITEM_TYPE_ANNOTATION
|
|
21
|
+
| typeof FEED_ITEM_TYPE_APP_ACTIVITY
|
|
22
|
+
| typeof FEED_ITEM_TYPE_COMMENT
|
|
23
|
+
| typeof FEED_ITEM_TYPE_VERSION
|
|
24
|
+
| typeof FEED_ITEM_TYPE_TASK;
|
|
25
|
+
|
|
14
26
|
// Feed item types that can receive deeplinks inline in the feed
|
|
15
27
|
type FocusableFeedItemType =
|
|
16
28
|
| typeof FEED_ITEM_TYPE_TASK
|
|
@@ -55,6 +67,7 @@ type Tasks = {
|
|
|
55
67
|
|
|
56
68
|
type Comment = {
|
|
57
69
|
...BaseFeedItem,
|
|
70
|
+
isPending?: boolean,
|
|
58
71
|
isRepliesLoading?: boolean,
|
|
59
72
|
is_reply_comment?: boolean,
|
|
60
73
|
message?: string,
|
|
@@ -128,6 +141,10 @@ type FeedItem = Annotation | Comment | Task | BoxItemVersion | AppActivityItem;
|
|
|
128
141
|
|
|
129
142
|
type FeedItems = Array<FeedItem>;
|
|
130
143
|
|
|
144
|
+
type FocusableFeedItem = Annotation | Comment | Task;
|
|
145
|
+
|
|
146
|
+
type CommentFeedItem = Annotation | Comment;
|
|
147
|
+
|
|
131
148
|
type ActionItemError = {
|
|
132
149
|
action?: {
|
|
133
150
|
onAction: () => void,
|
|
@@ -137,8 +154,22 @@ type ActionItemError = {
|
|
|
137
154
|
title: MessageDescriptor,
|
|
138
155
|
};
|
|
139
156
|
|
|
157
|
+
type ActivityFilterOption =
|
|
158
|
+
| typeof ACTIVITY_FILTER_OPTION_ALL
|
|
159
|
+
| typeof ACTIVITY_FILTER_OPTION_UNRESOLVED
|
|
160
|
+
| typeof ACTIVITY_FILTER_OPTION_RESOLVED
|
|
161
|
+
| typeof ACTIVITY_FILTER_OPTION_TASKS;
|
|
162
|
+
|
|
163
|
+
type ActivityFilterItemType =
|
|
164
|
+
| typeof ACTIVITY_FILTER_OPTION_ALL
|
|
165
|
+
| typeof COMMENT_STATUS_OPEN
|
|
166
|
+
| typeof COMMENT_STATUS_RESOLVED
|
|
167
|
+
| typeof FEED_ITEM_TYPE_TASK;
|
|
168
|
+
|
|
140
169
|
export type {
|
|
141
170
|
ActionItemError,
|
|
171
|
+
ActivityFilterItemType,
|
|
172
|
+
ActivityFilterOption,
|
|
142
173
|
ActivityTemplateItem,
|
|
143
174
|
Annotation,
|
|
144
175
|
AnnotationPermission,
|
|
@@ -150,11 +181,14 @@ export type {
|
|
|
150
181
|
AppItem,
|
|
151
182
|
BoxCommentPermission,
|
|
152
183
|
Comment,
|
|
184
|
+
CommentFeedItem,
|
|
153
185
|
CommentFeedItemType,
|
|
154
186
|
Comments,
|
|
155
187
|
FeedItem,
|
|
156
188
|
FeedItems,
|
|
157
189
|
FeedItemStatus,
|
|
190
|
+
FeedItemType,
|
|
191
|
+
FocusableFeedItem,
|
|
158
192
|
FocusableFeedItemType,
|
|
159
193
|
Reply,
|
|
160
194
|
Task,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/types/feed.js"],"names":["COMMENT_STATUS_OPEN","COMMENT_STATUS_RESOLVED","FEED_ITEM_TYPE_ANNOTATION","FEED_ITEM_TYPE_APP_ACTIVITY","FEED_ITEM_TYPE_COMMENT","FEED_ITEM_TYPE_TASK"],"mappings":"AAEA,SACIA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/types/feed.js"],"names":["ACTIVITY_FILTER_OPTION_ALL","ACTIVITY_FILTER_OPTION_RESOLVED","ACTIVITY_FILTER_OPTION_TASKS","ACTIVITY_FILTER_OPTION_UNRESOLVED","COMMENT_STATUS_OPEN","COMMENT_STATUS_RESOLVED","FEED_ITEM_TYPE_ANNOTATION","FEED_ITEM_TYPE_APP_ACTIVITY","FEED_ITEM_TYPE_COMMENT","FEED_ITEM_TYPE_VERSION","FEED_ITEM_TYPE_TASK"],"mappings":"AAEA,SACIA,0BADJ,EAEIC,+BAFJ,EAGIC,4BAHJ,EAIIC,iCAJJ,EAKIC,mBALJ,EAMIC,uBANJ,EAOIC,yBAPJ,EAQIC,2BARJ,EASIC,sBATJ,EAUIC,sBAVJ,EAWIC,mBAXJ,QAYO,iBAZP","sourcesContent":["// @flow strict\nimport type { MessageDescriptor } from 'react-intl';\nimport {\n ACTIVITY_FILTER_OPTION_ALL,\n ACTIVITY_FILTER_OPTION_RESOLVED,\n ACTIVITY_FILTER_OPTION_TASKS,\n ACTIVITY_FILTER_OPTION_UNRESOLVED,\n COMMENT_STATUS_OPEN,\n COMMENT_STATUS_RESOLVED,\n FEED_ITEM_TYPE_ANNOTATION,\n FEED_ITEM_TYPE_APP_ACTIVITY,\n FEED_ITEM_TYPE_COMMENT,\n FEED_ITEM_TYPE_VERSION,\n FEED_ITEM_TYPE_TASK,\n} from '../../constants';\nimport type { BoxItemPermission, BoxItemVersion, Reply, User } from './core';\nimport type { Annotation, AnnotationPermission, Annotations } from './annotations';\n\ntype FeedItemType =\n | typeof FEED_ITEM_TYPE_ANNOTATION\n | typeof FEED_ITEM_TYPE_APP_ACTIVITY\n | typeof FEED_ITEM_TYPE_COMMENT\n | typeof FEED_ITEM_TYPE_VERSION\n | typeof FEED_ITEM_TYPE_TASK;\n\n// Feed item types that can receive deeplinks inline in the feed\ntype FocusableFeedItemType =\n | typeof FEED_ITEM_TYPE_TASK\n | typeof FEED_ITEM_TYPE_COMMENT\n | typeof FEED_ITEM_TYPE_ANNOTATION;\n\n// Feed item types that represent user's written response (that also can have replies)\ntype CommentFeedItemType = typeof FEED_ITEM_TYPE_COMMENT | typeof FEED_ITEM_TYPE_ANNOTATION;\n\ntype BoxCommentPermission = {\n can_delete?: boolean,\n can_edit?: boolean,\n can_reply?: boolean,\n can_resolve?: boolean,\n};\n\ntype BoxTaskPermission = {\n can_delete?: boolean,\n can_update?: boolean,\n};\n\ntype BaseFeedItem = {|\n created_at: string,\n created_by: User,\n id: string,\n|};\n\n// Used in Annotation and Comment\ntype FeedItemStatus = typeof COMMENT_STATUS_OPEN | typeof COMMENT_STATUS_RESOLVED;\n\n// this is a subset of TaskNew, which imports as `any`\ntype Task = {\n ...BaseFeedItem,\n permissions: BoxTaskPermission,\n type: typeof FEED_ITEM_TYPE_TASK,\n};\n\ntype Tasks = {\n entries: Array<Task>,\n next_marker: ?string,\n};\n\ntype Comment = {\n ...BaseFeedItem,\n isPending?: boolean,\n isRepliesLoading?: boolean,\n is_reply_comment?: boolean,\n message?: string,\n modified_at: string,\n parent?: {\n id: string,\n type: CommentFeedItemType,\n },\n permissions: BoxCommentPermission,\n replies?: Array<Comment>,\n status?: FeedItemStatus,\n tagged_message: string,\n total_reply_count?: number,\n type: typeof FEED_ITEM_TYPE_COMMENT,\n};\n\ntype Comments = {\n entries: Array<Comment>,\n total_count: number,\n};\n\ntype ThreadedComments = {\n entries: Array<Comment>,\n limit: number,\n next_marker: string,\n};\n\ntype ActivityTemplateItem = {|\n id: string,\n type: 'activity_template',\n|};\n\ntype AppItem = {|\n icon_url: string,\n id: string,\n name: string,\n type: 'app',\n|};\n\ntype BaseAppActivityItem = {|\n activity_template: ActivityTemplateItem,\n app: AppItem,\n created_by: User,\n id: string,\n rendered_text: string,\n type: typeof FEED_ITEM_TYPE_APP_ACTIVITY,\n|};\n\ntype AppActivityAPIItem = {|\n occurred_at: string,\n ...BaseAppActivityItem,\n|};\n\ntype AppActivityAPIItems = {\n entries: Array<AppActivityAPIItem>,\n total_count: number,\n};\n\ntype AppActivityItem = {|\n created_at: string,\n permissions: BoxItemPermission,\n ...BaseAppActivityItem,\n|};\n\ntype AppActivityItems = {\n entries: Array<AppActivityItem>,\n total_count: number,\n};\n\ntype FeedItem = Annotation | Comment | Task | BoxItemVersion | AppActivityItem;\n\ntype FeedItems = Array<FeedItem>;\n\ntype FocusableFeedItem = Annotation | Comment | Task;\n\ntype CommentFeedItem = Annotation | Comment;\n\ntype ActionItemError = {\n action?: {\n onAction: () => void,\n text: MessageDescriptor,\n },\n message: MessageDescriptor,\n title: MessageDescriptor,\n};\n\ntype ActivityFilterOption =\n | typeof ACTIVITY_FILTER_OPTION_ALL\n | typeof ACTIVITY_FILTER_OPTION_UNRESOLVED\n | typeof ACTIVITY_FILTER_OPTION_RESOLVED\n | typeof ACTIVITY_FILTER_OPTION_TASKS;\n\ntype ActivityFilterItemType =\n | typeof ACTIVITY_FILTER_OPTION_ALL\n | typeof COMMENT_STATUS_OPEN\n | typeof COMMENT_STATUS_RESOLVED\n | typeof FEED_ITEM_TYPE_TASK;\n\nexport type {\n ActionItemError,\n ActivityFilterItemType,\n ActivityFilterOption,\n ActivityTemplateItem,\n Annotation,\n AnnotationPermission,\n Annotations,\n AppActivityAPIItem,\n AppActivityAPIItems,\n AppActivityItem,\n AppActivityItems,\n AppItem,\n BoxCommentPermission,\n Comment,\n CommentFeedItem,\n CommentFeedItemType,\n Comments,\n FeedItem,\n FeedItems,\n FeedItemStatus,\n FeedItemType,\n FocusableFeedItem,\n FocusableFeedItemType,\n Reply,\n Task,\n Tasks,\n ThreadedComments,\n};\n"],"file":"feed.js"}
|