@scaleflex/widget-explorer 0.0.1
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/CHANGELOG.md +11924 -0
- package/LICENSE +21 -0
- package/README.md +1258 -0
- package/dist/style.css +1850 -0
- package/dist/style.min.css +1 -0
- package/lib/Explorer.styled.js +48 -0
- package/lib/components/ActionBar/ActionBar.styled.js +103 -0
- package/lib/components/ActionBar/DownloadWithExportButton.js +202 -0
- package/lib/components/ActionBar/SelectionMenu.js +129 -0
- package/lib/components/ActionBar/index.js +105 -0
- package/lib/components/AddFilesPanel/AddFiles.js +174 -0
- package/lib/components/AddFilesPanel/AddFiles.styled.js +137 -0
- package/lib/components/AddFilesPanel/index.js +59 -0
- package/lib/components/AiSwitcher/AiSwitcher.constants.js +1 -0
- package/lib/components/AiSwitcher/AiSwitcher.styled.js +24 -0
- package/lib/components/AiSwitcher/index.js +81 -0
- package/lib/components/AssetsList/AssetsList.styled.js +219 -0
- package/lib/components/AssetsList/GridView/FilesAccordion.js +76 -0
- package/lib/components/AssetsList/GridView/FilesSection/FileCell.js +276 -0
- package/lib/components/AssetsList/GridView/FilesSection/FileOverlayOptions.js +140 -0
- package/lib/components/AssetsList/GridView/FilesSection/FilesSection.styled.js +15 -0
- package/lib/components/AssetsList/GridView/FilesSection/index.js +31 -0
- package/lib/components/AssetsList/GridView/FilesSkeleton.js +47 -0
- package/lib/components/AssetsList/GridView/FoldersSection/FolderCell.js +239 -0
- package/lib/components/AssetsList/GridView/FoldersSection/FolderPreviewGrid.js +106 -0
- package/lib/components/AssetsList/GridView/FoldersSection/FolderTopOptions.js +70 -0
- package/lib/components/AssetsList/GridView/FoldersSection/index.js +23 -0
- package/lib/components/AssetsList/GridView/FoldersSkeleton.js +77 -0
- package/lib/components/AssetsList/GridView/GridView.styled.js +11 -0
- package/lib/components/AssetsList/GridView/SearchGridView/SearchGridView.styled.js +15 -0
- package/lib/components/AssetsList/GridView/SearchGridView/SearchGridViewSkeleton.js +30 -0
- package/lib/components/AssetsList/GridView/SearchGridView/index.js +97 -0
- package/lib/components/AssetsList/GridView/index.js +196 -0
- package/lib/components/AssetsList/ListView/AssetsSection/AssetsSectionTableHeader.js +152 -0
- package/lib/components/AssetsList/ListView/AssetsSection/AssetsSectionTableRow.js +333 -0
- package/lib/components/AssetsList/ListView/AssetsSection/index.js +99 -0
- package/lib/components/AssetsList/ListView/ColumnsMenu.js +89 -0
- package/lib/components/AssetsList/ListView/FilesAccordion.js +74 -0
- package/lib/components/AssetsList/ListView/FilesSkeleton.js +68 -0
- package/lib/components/AssetsList/ListView/FoldersSection/FoldersSectionTableHeader.js +98 -0
- package/lib/components/AssetsList/ListView/FoldersSection/FoldersSectionTableRow.js +156 -0
- package/lib/components/AssetsList/ListView/FoldersSection/index.js +54 -0
- package/lib/components/AssetsList/ListView/FoldersSkeleton.js +67 -0
- package/lib/components/AssetsList/ListView/ListView.styled.js +181 -0
- package/lib/components/AssetsList/ListView/ListView.utils.js +30 -0
- package/lib/components/AssetsList/ListView/SearchListView/index.js +109 -0
- package/lib/components/AssetsList/ListView/index.js +203 -0
- package/lib/components/AssetsList/ScrollToTop.js +70 -0
- package/lib/components/AssetsList/SearchView.hook.js +241 -0
- package/lib/components/AssetsList/__SearchTestPannel.js +238 -0
- package/lib/components/AssetsList/__SearchTestPannel.mock.js +1 -0
- package/lib/components/AssetsList/index.js +266 -0
- package/lib/components/AssetsList/relevanceBadge.js +15 -0
- package/lib/components/AssetsView/AssetsView.styled.js +25 -0
- package/lib/components/AssetsView/AssetsView.thunks.js +64 -0
- package/lib/components/AssetsView/index.js +142 -0
- package/lib/components/AuthExplorerView.js +79 -0
- package/lib/components/Breadcrumbs/BreadCrumbViews/BreadCrumbsViews.styled.js +30 -0
- package/lib/components/Breadcrumbs/BreadCrumbViews/index.js +32 -0
- package/lib/components/Breadcrumbs/Breadcrumb.js +52 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.styled.js +81 -0
- package/lib/components/Breadcrumbs/BreadcrumbsSkeleton.js +12 -0
- package/lib/components/Breadcrumbs/index.js +187 -0
- package/lib/components/BulkEditPanel/BulkEdit.js +330 -0
- package/lib/components/BulkEditPanel/BulkEditPanel.styled.js +62 -0
- package/lib/components/BulkEditPanel/BulkEditPanel.utils.js +55 -0
- package/lib/components/BulkEditPanel/components/AssetsList/AssetsList.constants.js +29 -0
- package/lib/components/BulkEditPanel/components/AssetsList/AssetsList.js +148 -0
- package/lib/components/BulkEditPanel/components/AssetsList/AssetsList.styled.js +81 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/Columns.styled.js +99 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/FileMetadataField.js +263 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/FileTagField.js +228 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/FileTextField.js +107 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/MetadataColumn.js +142 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/TableRow.js +139 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/TagsColumn.js +58 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/TagsField.js +80 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/TextColumn.js +53 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/columns.utils.js +272 -0
- package/lib/components/BulkEditPanel/components/AssetsList/Columns/getActiveColumn.js +23 -0
- package/lib/components/BulkEditPanel/components/AssetsList/FloatyPreview.js +55 -0
- package/lib/components/BulkEditPanel/components/AssetsList/FloatyPreview.styled.js +21 -0
- package/lib/components/BulkEditPanel/components/AssetsList/TableBody.js +64 -0
- package/lib/components/BulkEditPanel/components/AssetsList/TableHeader.js +67 -0
- package/lib/components/BulkEditPanel/components/BulkEditFooter.js +33 -0
- package/lib/components/BulkEditPanel/components/ConfirmationModal/ConfirmationModal.js +47 -0
- package/lib/components/BulkEditPanel/components/ConfirmationModal/ConfirmationModal.styled.js +25 -0
- package/lib/components/BulkEditPanel/components/MainContent/MainContent.js +110 -0
- package/lib/components/BulkEditPanel/components/MainContent/MainContent.styled.js +12 -0
- package/lib/components/BulkEditPanel/components/MainContent/index.js +2 -0
- package/lib/components/BulkEditPanel/components/Sidebar/Sidebar.styled.js +53 -0
- package/lib/components/BulkEditPanel/components/Sidebar/Sidebar.utils.js +28 -0
- package/lib/components/BulkEditPanel/components/Sidebar/index.js +158 -0
- package/lib/components/BulkEditPanel/components/Tabs/Metadata/Metadata.js +246 -0
- package/lib/components/BulkEditPanel/components/Tabs/Metadata/Metadata.styled.js +17 -0
- package/lib/components/BulkEditPanel/components/Tabs/Tags/Tags.js +222 -0
- package/lib/components/BulkEditPanel/components/Tabs/Tags/Tags.mixin.js +20 -0
- package/lib/components/BulkEditPanel/components/Tabs/Tags/Tags.styled.js +123 -0
- package/lib/components/BulkEditPanel/components/Tabs/Tags/TagsContianer.js +31 -0
- package/lib/components/BulkEditPanel/components/Tabs/Tags/TagsPaper.js +95 -0
- package/lib/components/BulkEditPanel/components/Tabs/Text/Text.js +167 -0
- package/lib/components/BulkEditPanel/components/Tabs/Text/Text.styled.js +15 -0
- package/lib/components/BulkEditPanel/components/Tabs/tabs.constants.js +113 -0
- package/lib/components/BulkEditPanel/components/Tabs/tabs.js +43 -0
- package/lib/components/BulkEditPanel/components/Tabs/tabs.utils.js +239 -0
- package/lib/components/BulkEditPanel/index.js +28 -0
- package/lib/components/ContextMenu/BeforeUploadMenu/index.js +51 -0
- package/lib/components/ContextMenu/ContextMenu.constants.js +64 -0
- package/lib/components/ContextMenu/ContextMenu.hooks.js +35 -0
- package/lib/components/ContextMenu/ContextMenu.styled.js +107 -0
- package/lib/components/ContextMenu/ContextMenuContent.js +202 -0
- package/lib/components/ContextMenu/ContextMenuItem.js +142 -0
- package/lib/components/ContextMenu/FileMenu/CollaborateSection/index.js +33 -0
- package/lib/components/ContextMenu/FileMenu/DeleteSection/index.js +25 -0
- package/lib/components/ContextMenu/FileMenu/EditSection/index.js +42 -0
- package/lib/components/ContextMenu/FileMenu/FindSection/index.js +29 -0
- package/lib/components/ContextMenu/FileMenu/index.js +15 -0
- package/lib/components/ContextMenu/FolderMenu/CollaborateSection/index.js +17 -0
- package/lib/components/ContextMenu/FolderMenu/DeleteSection/index.js +41 -0
- package/lib/components/ContextMenu/FolderMenu/EditSection/index.js +49 -0
- package/lib/components/ContextMenu/FolderMenu/FindSection/index.js +49 -0
- package/lib/components/ContextMenu/FolderMenu/FolderMenu.utils.js +31 -0
- package/lib/components/ContextMenu/FolderMenu/index.js +14 -0
- package/lib/components/ContextMenu/MenuOptions/AddVariationOption.js +59 -0
- package/lib/components/ContextMenu/MenuOptions/BulkEditOption.js +47 -0
- package/lib/components/ContextMenu/MenuOptions/CdnLinkOption.js +54 -0
- package/lib/components/ContextMenu/MenuOptions/DeleteOption.js +70 -0
- package/lib/components/ContextMenu/MenuOptions/DownloadOption.js +88 -0
- package/lib/components/ContextMenu/MenuOptions/EditImageOption.js +63 -0
- package/lib/components/ContextMenu/MenuOptions/EditVideoOption.js +87 -0
- package/lib/components/ContextMenu/MenuOptions/LocateFileOption.js +45 -0
- package/lib/components/ContextMenu/MenuOptions/ManagaAccessOption.js +67 -0
- package/lib/components/ContextMenu/MenuOptions/ManageDetailsOption.js +52 -0
- package/lib/components/ContextMenu/MenuOptions/MoveOption.js +54 -0
- package/lib/components/ContextMenu/MenuOptions/PreviewOption.js +35 -0
- package/lib/components/ContextMenu/MenuOptions/RenameOption.js +66 -0
- package/lib/components/ContextMenu/MenuOptions/TransformationOption.js +63 -0
- package/lib/components/ContextMenu/MultipleMenu/CollaborateSection/index.js +31 -0
- package/lib/components/ContextMenu/MultipleMenu/DeleteSection/index.js +6 -0
- package/lib/components/ContextMenu/MultipleMenu/EditSection/index.js +14 -0
- package/lib/components/ContextMenu/MultipleMenu/FindSection/index.js +14 -0
- package/lib/components/ContextMenu/MultipleMenu/index.js +14 -0
- package/lib/components/ContextMenu/SharedMenus/DownloadFolderSubMenu.js +36 -0
- package/lib/components/ContextMenu/SharedMenus/DownloadSubMenu.js +70 -0
- package/lib/components/ContextMenu/index.js +34 -0
- package/lib/components/ContextMenu/utils/calculateMenuHeight.js +20 -0
- package/lib/components/ContextMenu/utils/calculateMenuPosition.js +42 -0
- package/lib/components/ContextMenu/utils/createSeparator.js +14 -0
- package/lib/components/ContextMenu/utils/editMedia.js +17 -0
- package/lib/components/ContextMenu/utils/getFileLocation.js +8 -0
- package/lib/components/ContextMenu/utils/getFilteredOptions.js +20 -0
- package/lib/components/ContextMenu/utils/getProperFolderSelections.js +7 -0
- package/lib/components/ContextMenu/utils/isEmptyFolderSelection.js +5 -0
- package/lib/components/ContextMenu/utils/isFileContextMenu.js +5 -0
- package/lib/components/ContextMenu/utils/isFirstFileVisibilityPublic.js +9 -0
- package/lib/components/ContextMenu/utils/isMenuItemVisible.js +5 -0
- package/lib/components/ContextMenu/utils/isMixedFiles.js +9 -0
- package/lib/components/ContextMenu/utils/isMultipleSelection.js +6 -0
- package/lib/components/ContextMenu/utils/isSeparatorHidden.js +7 -0
- package/lib/components/ContextMenu/utils/triggerDownload.js +45 -0
- package/lib/components/CropPanel/CropOptions.js +155 -0
- package/lib/components/CropPanel/CropPanel.constants.js +44 -0
- package/lib/components/CropPanel/CropPanel.styled.js +107 -0
- package/lib/components/CropPanel/CropPanel.utils.js +48 -0
- package/lib/components/CropPanel/CropPanelContent.js +209 -0
- package/lib/components/CropPanel/ImageOptions.js +326 -0
- package/lib/components/CropPanel/ImageResize.js +207 -0
- package/lib/components/CropPanel/Option.js +113 -0
- package/lib/components/CropPanel/index.js +22 -0
- package/lib/components/CropPanel/index.scss +55 -0
- package/lib/components/Details/Details.constants.js +70 -0
- package/lib/components/Details/Details.utils.js +232 -0
- package/lib/components/Details/DetailsSideBar.styled.js +139 -0
- package/lib/components/Details/EditActionButtons/EditActionButtons.styled.js +27 -0
- package/lib/components/Details/EditActionButtons/index.js +38 -0
- package/lib/components/Details/FileDetails.js +31 -0
- package/lib/components/Details/FileItem/CustomMetadataTab.js +45 -0
- package/lib/components/Details/FileItem/FileItem.styled.js +47 -0
- package/lib/components/Details/FileItem/GeneralTab.js +113 -0
- package/lib/components/Details/FileItem/SharedFileEditData.js +97 -0
- package/lib/components/Details/FileItem/index.js +2 -0
- package/lib/components/Details/FileItem/style.scss +11 -0
- package/lib/components/Details/FolderDetails.js +138 -0
- package/lib/components/Details/FolderItemList/FolderListItem.js +77 -0
- package/lib/components/Details/FolderItemList/index.js +62 -0
- package/lib/components/Details/MultiItemsDetails.js +69 -0
- package/lib/components/Details/MultipleItems.js +71 -0
- package/lib/components/Details/TabChips.js +46 -0
- package/lib/components/Details/TabPanels.js +42 -0
- package/lib/components/Details/Title.js +52 -0
- package/lib/components/Details/index.js +53 -0
- package/lib/components/DnD/Dnd.styled.js +11 -0
- package/lib/components/DnD/DragImage.js +61 -0
- package/lib/components/DnD/index.js +218 -0
- package/lib/components/Drawer/Drawer.styled.js +45 -0
- package/lib/components/Drawer/Drawer.utils.js +163 -0
- package/lib/components/Drawer/Resizer.js +141 -0
- package/lib/components/Drawer/ResizerCore.js +213 -0
- package/lib/components/Drawer/index.js +68 -0
- package/lib/components/EmptyViewPlaceholder/EmptyViewPlaceholder.styled.js +39 -0
- package/lib/components/EmptyViewPlaceholder/index.js +58 -0
- package/lib/components/ExploreView.js +46 -0
- package/lib/components/ExplorerUI.js +17 -0
- package/lib/components/ExplorerWrapper.js +113 -0
- package/lib/components/FacetedSearch/DrawerBody/index.js +42 -0
- package/lib/components/FacetedSearch/DrawerWrapper/index.js +83 -0
- package/lib/components/FacetedSearch/FacetedSearch.constants.js +27 -0
- package/lib/components/FacetedSearch/FacetedSearch.styled.js +101 -0
- package/lib/components/FacetedSearch/FacetedSearch.utils.js +3 -0
- package/lib/components/FacetedSearch/Field/Date.js +69 -0
- package/lib/components/FacetedSearch/Field/Placeholder.js +20 -0
- package/lib/components/FacetedSearch/Field/Select.js +136 -0
- package/lib/components/FacetedSearch/Field/Switch.js +59 -0
- package/lib/components/FacetedSearch/Field/index.js +27 -0
- package/lib/components/FacetedSearch/GroupWrapper/index.js +129 -0
- package/lib/components/FacetedSearch/StaticFields/Date.js +152 -0
- package/lib/components/FacetedSearch/index.js +12 -0
- package/lib/components/FileItem/FileInfo/FileInfo.styled.js +126 -0
- package/lib/components/FileItem/FileInfo/FileInfo.utils.js +13 -0
- package/lib/components/FileItem/FileInfo/FileMetadata.js +37 -0
- package/lib/components/FileItem/FileInfo/FileName.js +197 -0
- package/lib/components/FileItem/FileInfo/index.js +194 -0
- package/lib/components/FileItem/FileItem.mixin.js +22 -0
- package/lib/components/FileItem/FileItem.styled.js +54 -0
- package/lib/components/FileItem/FileUploadTopOptions.js +87 -0
- package/lib/components/FileItem/PreUploadFileThumbnail/FileThumbnail.js +61 -0
- package/lib/components/FileItem/PreUploadFileThumbnail/PreUploadFileThumbnail.styled.js +8 -0
- package/lib/components/FileItem/PreUploadFileThumbnail/index.js +27 -0
- package/lib/components/FileItem/PreUploadFileThumbnail/index.scss +19 -0
- package/lib/components/FileItem/index.js +162 -0
- package/lib/components/FileItem/index.scss +0 -0
- package/lib/components/FileWindowPanel/Body/ActionButtons.js +69 -0
- package/lib/components/FileWindowPanel/Body/Body.constants.js +5 -0
- package/lib/components/FileWindowPanel/Body/Body.styled.js +196 -0
- package/lib/components/FileWindowPanel/Body/BodyFile.js +165 -0
- package/lib/components/FileWindowPanel/Body/Footer.js +58 -0
- package/lib/components/FileWindowPanel/Body/Preview.js +232 -0
- package/lib/components/FileWindowPanel/Body/PreviewPlaceholder.js +20 -0
- package/lib/components/FileWindowPanel/Body/VideoEmbed.js +80 -0
- package/lib/components/FileWindowPanel/Body/index.js +106 -0
- package/lib/components/FileWindowPanel/FileTabs/FileTabButtons.js +98 -0
- package/lib/components/FileWindowPanel/FileTabs/FileTabs.constants.js +46 -0
- package/lib/components/FileWindowPanel/FileTabs/FileTabs.styled.js +99 -0
- package/lib/components/FileWindowPanel/FileTabs/FileTabsList.js +88 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/EditableField.js +78 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/FieldLabel.js +40 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/FieldRow.js +57 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/FieldValue.js +20 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/FieldWithTooltip.js +29 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/GeneralSection.js +182 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/GeneralTab.constants.js +2 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/GeneralTab.styled.js +112 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/GeneralTabSkeleton.js +70 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/TableSeparator.js +10 -0
- package/lib/components/FileWindowPanel/FileTabs/GeneralTab/index.js +100 -0
- package/lib/components/FileWindowPanel/FileTabs/MetadataTab/CustomMetadataSection.js +234 -0
- package/lib/components/FileWindowPanel/FileTabs/MetadataTab/EmbeddedMetadataSection.js +31 -0
- package/lib/components/FileWindowPanel/FileTabs/MetadataTab/MetadataTab.constants.js +2 -0
- package/lib/components/FileWindowPanel/FileTabs/MetadataTab/MetadataTab.styled.js +134 -0
- package/lib/components/FileWindowPanel/FileTabs/MetadataTab/MetadataTabSkeleton.js +70 -0
- package/lib/components/FileWindowPanel/FileTabs/MetadataTab/index.js +181 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationItem.js +78 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.constants.js +22 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.styled.js +175 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.thunks.js +54 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/Variations.utils.js +23 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsContent.js +76 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsEditModalContent.js +57 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsSearch.js +44 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsSkeleton.js +35 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTabNavigator.js +38 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTabs.js +32 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/VariationsTopOptions.js +204 -0
- package/lib/components/FileWindowPanel/FileTabs/VariationsTab/index.js +431 -0
- package/lib/components/FileWindowPanel/FileTabs/index.js +83 -0
- package/lib/components/FileWindowPanel/FileWindow.js +220 -0
- package/lib/components/FileWindowPanel/FileWindow.styled.js +19 -0
- package/lib/components/FileWindowPanel/FileWindow.utils.js +38 -0
- package/lib/components/FileWindowPanel/Header/AfterUploadActionBtns.js +69 -0
- package/lib/components/FileWindowPanel/Header/BeforeUploadActionBtns.js +100 -0
- package/lib/components/FileWindowPanel/Header/FileWindowHeader.styled.js +56 -0
- package/lib/components/FileWindowPanel/Header/MutualActionBtns.js +92 -0
- package/lib/components/FileWindowPanel/Header/index.js +109 -0
- package/lib/components/FileWindowPanel/index.js +60 -0
- package/lib/components/Filters/Filters.constants.js +358 -0
- package/lib/components/Filters/Filters.styled.js +235 -0
- package/lib/components/Filters/Filters.utils.js +536 -0
- package/lib/components/Filters/FiltersContext.js +59 -0
- package/lib/components/Filters/FiltersSkeleton.js +14 -0
- package/lib/components/Filters/Groups/Date/index.js +201 -0
- package/lib/components/Filters/Groups/Folders/FoldersSkeleton.js +43 -0
- package/lib/components/Filters/Groups/Folders/index.js +109 -0
- package/lib/components/Filters/Groups/Image/Colors.js +73 -0
- package/lib/components/Filters/Groups/Image/Faces.js +64 -0
- package/lib/components/Filters/Groups/Image/Orientations.js +64 -0
- package/lib/components/Filters/Groups/Image/Resolutions.js +65 -0
- package/lib/components/Filters/Groups/Image/Tooltip.js +14 -0
- package/lib/components/Filters/Groups/Image/index.js +104 -0
- package/lib/components/Filters/Groups/LicenseExpiry/LicenseExpiry.styled.js +17 -0
- package/lib/components/Filters/Groups/LicenseExpiry/index.js +97 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/ConditionSelector.js +40 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/ExtraRow/ConditionSelector.js +35 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/ExtraRow/ValueSelector.js +33 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/ExtraRow/index.js +18 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/AutoComplete.js +56 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/Boolean.js +35 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/Date.js +36 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/GeoPointField.js +30 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/Numeric.js +32 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/Select.js +55 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/Tags.js +21 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/Text.js +39 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Field/index.js +52 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/KeySelector.js +34 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/Row.js +53 -0
- package/lib/components/Filters/Groups/Metadata/Advanced/index.js +48 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/Date.js +45 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/Field.utils.js +58 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/Numeric.js +51 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/OptionsPopup.js +87 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/Select.js +168 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/Switch.js +41 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/Tags.js +38 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/Text.js +57 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/Uri.js +54 -0
- package/lib/components/Filters/Groups/Metadata/Basic/Field/index.js +46 -0
- package/lib/components/Filters/Groups/Metadata/Basic/GroupWrapper.js +79 -0
- package/lib/components/Filters/Groups/Metadata/Basic/index.js +80 -0
- package/lib/components/Filters/Groups/Metadata/Metadata.constants.js +42 -0
- package/lib/components/Filters/Groups/Metadata/Metadata.styled.js +150 -0
- package/lib/components/Filters/Groups/Metadata/Metadata.utils.js +160 -0
- package/lib/components/Filters/Groups/Metadata/MetadataFiltersContext.js +329 -0
- package/lib/components/Filters/Groups/Metadata/Placeholder.js +25 -0
- package/lib/components/Filters/Groups/Metadata/common/TagsField/TagsMenu.js +81 -0
- package/lib/components/Filters/Groups/Metadata/common/TagsField/TagsSearchPlaceholder.js +18 -0
- package/lib/components/Filters/Groups/Metadata/common/TagsField/index.js +142 -0
- package/lib/components/Filters/Groups/Metadata/index.js +111 -0
- package/lib/components/Filters/Groups/Size/index.js +125 -0
- package/lib/components/Filters/Groups/Tags/FilteredTags.js +62 -0
- package/lib/components/Filters/Groups/Tags/SelectedTags.js +51 -0
- package/lib/components/Filters/Groups/Tags/SuggestedTags.js +43 -0
- package/lib/components/Filters/Groups/Tags/index.js +146 -0
- package/lib/components/Filters/Groups/TypeAndFormat/Format.js +65 -0
- package/lib/components/Filters/Groups/TypeAndFormat/Type.js +85 -0
- package/lib/components/Filters/Groups/TypeAndFormat/index.js +114 -0
- package/lib/components/Filters/Groups/common/DateRangeField/DateRangeField.styled.js +10 -0
- package/lib/components/Filters/Groups/common/DateRangeField/index.js +72 -0
- package/lib/components/Filters/Groups/common/FilterFooter.js +67 -0
- package/lib/components/Filters/Groups/common/FilterOptions.js +29 -0
- package/lib/components/Filters/Groups/common/FilterSearch.js +22 -0
- package/lib/components/Filters/Groups/common/FilterSearch.styled.js +15 -0
- package/lib/components/Filters/Groups/common/FilterSkeleton.js +44 -0
- package/lib/components/Filters/Groups/common/TimeFrames.js +35 -0
- package/lib/components/Filters/Groups/index.js +55 -0
- package/lib/components/Filters/Placeholder.js +29 -0
- package/lib/components/Filters/hooks/useDateTypeFilterValues.js +182 -0
- package/lib/components/Filters/hooks/useFilters.js +78 -0
- package/lib/components/Filters/index.js +78 -0
- package/lib/components/FoldersView/FoldersTree/FoldersTree.styled.js +193 -0
- package/lib/components/FoldersView/FoldersTree/FoldersTree.utils.js +78 -0
- package/lib/components/FoldersView/FoldersTree/FoldersTreeHeader.js +52 -0
- package/lib/components/FoldersView/FoldersTree/FoldersTreeList.js +64 -0
- package/lib/components/FoldersView/FoldersTree/FoldersTreeListItem.js +270 -0
- package/lib/components/FoldersView/FoldersTree/FoldersTreeSearch.js +70 -0
- package/lib/components/FoldersView/FoldersTree/FoldersTreeSkeleton.js +23 -0
- package/lib/components/FoldersView/FoldersTree/NoFoldersResult.js +19 -0
- package/lib/components/FoldersView/FoldersTree/SearchedFoldersItem.js +113 -0
- package/lib/components/FoldersView/FoldersTree/index.js +163 -0
- package/lib/components/FoldersView/hooks/useAddFolder.js +60 -0
- package/lib/components/FoldersView/index.js +256 -0
- package/lib/components/GalleryRoleSelect/CustomRolesTab.js +47 -0
- package/lib/components/GalleryRoleSelect/CustomRolesTab.styled.js +10 -0
- package/lib/components/GalleryRoleSelect/GalleryRoleSelect.constants.js +11 -0
- package/lib/components/GalleryRoleSelect/GalleryRoleSelect.styled.js +132 -0
- package/lib/components/GalleryRoleSelect/GalleryRoleSelect.utils.js +87 -0
- package/lib/components/GalleryRoleSelect/StandardRolesTab.js +58 -0
- package/lib/components/GalleryRoleSelect/index.js +234 -0
- package/lib/components/HeaderBar/FacetedSearchToggleButton.js +28 -0
- package/lib/components/HeaderBar/HeaderBar.styled.js +25 -0
- package/lib/components/HeaderBar/RightSide.js +127 -0
- package/lib/components/HeaderBar/index.js +77 -0
- package/lib/components/ImageEditorPanel/index.js +33 -0
- package/lib/components/InfiniteScroll/InfiniteScroll.js +97 -0
- package/lib/components/InfiniteScroll/InfiniteScroll.styled.js +11 -0
- package/lib/components/Informer/index.js +9 -0
- package/lib/components/LoginScreen/LoginScreen.styled.js +39 -0
- package/lib/components/LoginScreen/index.js +133 -0
- package/lib/components/MainMenu/MainMenu.styled.js +12 -0
- package/lib/components/MainMenu/index.js +77 -0
- package/lib/components/Modals/ConfirmationModal/ConfirmationModal.hooks.js +101 -0
- package/lib/components/Modals/ConfirmationModal/index.js +1 -0
- package/lib/components/Modals/DeleteItems/DeleteItems.hooks.js +233 -0
- package/lib/components/Modals/DeleteItems/index.js +1 -0
- package/lib/components/Modals/DeleteModal/DeleteModal.hooks.js +87 -0
- package/lib/components/Modals/DeleteModal/index.js +1 -0
- package/lib/components/Modals/DownloadConsent/DownlaodConsent.styled.js +8 -0
- package/lib/components/Modals/DownloadConsent/DownloadConsent.hooks.js +90 -0
- package/lib/components/Modals/DownloadConsent/DownloadConsentContent.js +52 -0
- package/lib/components/Modals/DownloadConsent/index.js +2 -0
- package/lib/components/Modals/Modals.js +384 -0
- package/lib/components/Modals/Modals.styled.js +80 -0
- package/lib/components/Modals/MoveItems/MoveItems.hooks.js +88 -0
- package/lib/components/Modals/MoveItems/index.js +1 -0
- package/lib/components/Modals/TransformedDownload/PdfModalContent.js +109 -0
- package/lib/components/Modals/TransformedDownload/TransformedDownload.hooks.js +188 -0
- package/lib/components/Modals/TransformedDownload/TransformedDownload.styled.js +29 -0
- package/lib/components/Modals/TransformedDownload/TransformedDownload.utils.js +46 -0
- package/lib/components/Modals/TransformedDownload/index.js +2 -0
- package/lib/components/Modals/index.js +7 -0
- package/lib/components/Modals/index.scss +0 -0
- package/lib/components/NoItems/NoItems.styled.js +54 -0
- package/lib/components/NoItems/index.js +50 -0
- package/lib/components/PdftronPanel/index.js +31 -0
- package/lib/components/PickerPanel/PickerPanel.styled.js +41 -0
- package/lib/components/PickerPanel/PickerPanelContent.js +95 -0
- package/lib/components/PickerPanel/index.js +21 -0
- package/lib/components/ProgressPanel/ProgressPanel.utils.js +29 -0
- package/lib/components/ProgressPanel/index.js +37 -0
- package/lib/components/TopBar/AppliedFilterChips/AppliedFilterChips.styled.js +11 -0
- package/lib/components/TopBar/AppliedFilterChips/index.js +77 -0
- package/lib/components/TopBar/Search/ContextDropdown/ContextDropdown.styled.js +59 -0
- package/lib/components/TopBar/Search/ContextDropdown/ContextDropdown.utils.js +67 -0
- package/lib/components/TopBar/Search/ContextDropdown/index.js +170 -0
- package/lib/components/TopBar/Search/PrependedOptions/TempFilterRegexInput.js +133 -0
- package/lib/components/TopBar/Search/Search.utils.js +88 -0
- package/lib/components/TopBar/Search/SimilarSearchTag.js +60 -0
- package/lib/components/TopBar/Search/index.js +278 -0
- package/lib/components/TopBar/TopBar.styled.js +37 -0
- package/lib/components/TopBar/index.js +61 -0
- package/lib/components/TopBar/index.scss +20 -0
- package/lib/components/TopSection/TopSection.styled.js +22 -0
- package/lib/components/TopSection/index.js +58 -0
- package/lib/components/UploadBar/UploadBar.styled.js +84 -0
- package/lib/components/UploadBar/index.js +212 -0
- package/lib/components/UploadStatus/index.js +20 -0
- package/lib/components/UploadsPanel/UploadsList/Header.js +19 -0
- package/lib/components/UploadsPanel/UploadsList/List.js +29 -0
- package/lib/components/UploadsPanel/UploadsList/PreUploadPlugins.js +22 -0
- package/lib/components/UploadsPanel/UploadsList/UploadsList.styled.js +64 -0
- package/lib/components/UploadsPanel/UploadsList/UploadsList.utils.js +17 -0
- package/lib/components/UploadsPanel/UploadsList/UploadsVirtualGrid.js +25 -0
- package/lib/components/UploadsPanel/UploadsList/index.js +55 -0
- package/lib/components/UploadsPanel/UploadsPanel.styled.js +24 -0
- package/lib/components/UploadsPanel/UploadsPanelTopBar.js +16 -0
- package/lib/components/UploadsPanel/index.js +36 -0
- package/lib/components/UrlBuilderModal/UrlBuilderModal.styled.js +9 -0
- package/lib/components/UrlBuilderModal/index.js +93 -0
- package/lib/components/Views/ErroredViewPlaceholder.js +48 -0
- package/lib/components/Views/Views.constants.js +29 -0
- package/lib/components/Views/Views.styled.js +87 -0
- package/lib/components/Views/index.js +100 -0
- package/lib/components/common/DeleteModalItemText/DeleteModalItemText.styled.js +8 -0
- package/lib/components/common/DeleteModalItemText/index.js +24 -0
- package/lib/components/common/EditDetailsButton/EditDetailsButton.styled.js +35 -0
- package/lib/components/common/EditDetailsButton/index.js +28 -0
- package/lib/components/common/ExpiryDateTooltipContent/ExpiryDateTooltipContent.styled.js +16 -0
- package/lib/components/common/ExpiryDateTooltipContent/index.js +29 -0
- package/lib/components/common/FileApprovalsInfoPopup/index.js +46 -0
- package/lib/components/common/FileMetadataFieldValue/CustomMetadataFieldValue.js +48 -0
- package/lib/components/common/FileMetadataFieldValue/FileMetadataFieldValue.styled.js +66 -0
- package/lib/components/common/FileMetadataFieldValue/FileMetadataFieldValue.utils.js +311 -0
- package/lib/components/common/FileMetadataFieldValue/GeneralMetadataFieldValue.js +120 -0
- package/lib/components/common/FileMetadataFieldValue/index.js +26 -0
- package/lib/components/common/FileMetadataFieldValue/utils/getFontInfo.js +78 -0
- package/lib/components/common/FolderSelector/BrowseFoldersMenu.js +114 -0
- package/lib/components/common/FolderSelector/FolderSearchMenu.js +45 -0
- package/lib/components/common/FolderSelector/FolderSelector.styled.js +41 -0
- package/lib/components/common/FolderSelector/index.js +186 -0
- package/lib/components/common/FormattedUriLink/FormattedUriLink.styled.js +15 -0
- package/lib/components/common/FormattedUriLink/index.js +21 -0
- package/lib/components/common/OriginalBadge/OriginalBadge.styled.js +17 -0
- package/lib/components/common/OriginalBadge/index.js +14 -0
- package/lib/components/common/SanitizedHtmlElement/index.js +11 -0
- package/lib/components/common/Sort/Sort.constants.js +61 -0
- package/lib/components/common/Sort/Sort.styled.js +47 -0
- package/lib/components/common/Sort/Sort.utils.js +14 -0
- package/lib/components/common/Sort/index.js +183 -0
- package/lib/components/common/TextWithCopyIcon/TextWithCopyIcon.styled.js +44 -0
- package/lib/components/common/TextWithCopyIcon/index.js +71 -0
- package/lib/components/common/TopBarUploadButton/index.js +40 -0
- package/lib/components/common/TrimmedFilePathWithLocate/TrimmedFilePathWithLocate.utils.js +3 -0
- package/lib/components/common/TrimmedFilePathWithLocate/index.js +34 -0
- package/lib/components/common/TrimmedFolderPathWithLocate/index.js +13 -0
- package/lib/components/common/TrimmedPathWithLocate/TrimmedPathWithLocate.styled.js +30 -0
- package/lib/components/common/TrimmedPathWithLocate/index.js +40 -0
- package/lib/components/metadata.adapter.js +365 -0
- package/lib/defaultLocale.js +1353 -0
- package/lib/hooks/index.js +16 -0
- package/lib/hooks/useAssetPicker.js +213 -0
- package/lib/hooks/useDownloadFilesCsv.js +20 -0
- package/lib/hooks/useEditFileDetails.js +505 -0
- package/lib/hooks/useExplorer.js +6 -0
- package/lib/hooks/useExplorerI18n.js +10 -0
- package/lib/hooks/useExplorerInformer.js +10 -0
- package/lib/hooks/useFetchFileFolderPermissions.js +31 -0
- package/lib/hooks/useFetchMetadataTagsBySearchQuery.js +38 -0
- package/lib/hooks/useFileMetadata.js +115 -0
- package/lib/hooks/useFilterSearch.js +37 -0
- package/lib/hooks/useForcedFilters.js +39 -0
- package/lib/hooks/useIsOverflow.js +25 -0
- package/lib/hooks/useIsSmallScreen.js +20 -0
- package/lib/hooks/useLocateFile.js +231 -0
- package/lib/hooks/usePrevious.js +9 -0
- package/lib/hooks/useSearchSuggestions.js +168 -0
- package/lib/hooks/useStartUpload.js +43 -0
- package/lib/hooks/useToLocaleNumber.js +14 -0
- package/lib/hooks/useValidateFileName.js +324 -0
- package/lib/index.js +1560 -0
- package/lib/slices/common.slice.js +254 -0
- package/lib/slices/drag.slice.js +75 -0
- package/lib/slices/files.slice.js +1307 -0
- package/lib/slices/filters.slice.js +382 -0
- package/lib/slices/folders.slice.js +964 -0
- package/lib/slices/foldersTree.slice.js +501 -0
- package/lib/slices/index.js +32 -0
- package/lib/slices/metadata.slice.js +487 -0
- package/lib/slices/panels.slice.js +351 -0
- package/lib/slices/search.slice.js +995 -0
- package/lib/slices/selections.slice.js +315 -0
- package/lib/slices/targets.slice.js +44 -0
- package/lib/slices/topSection.slice.js +71 -0
- package/lib/slices/views.slice.js +346 -0
- package/lib/style.scss +265 -0
- package/lib/thunks/archive.thunks.js +175 -0
- package/lib/thunks/downloads.thunks.js +416 -0
- package/lib/thunks/items.thunks.js +274 -0
- package/lib/thunks/permissions.thunks.js +66 -0
- package/lib/thunks/uploads.thunks.js +235 -0
- package/lib/utils/SearchSuggestions/SearchSuggestionsMenu.js +95 -0
- package/lib/utils/SearchSuggestions/SuggestionMode.js +70 -0
- package/lib/utils/SearchSuggestions/SuggestionModeAttribute.js +87 -0
- package/lib/utils/SearchSuggestions/SuggestionModeExpression.js +121 -0
- package/lib/utils/SearchSuggestions/SuggestionModeTag.js +87 -0
- package/lib/utils/SearchSuggestions/SuggestionsManager.js +242 -0
- package/lib/utils/SearchSuggestions/constants.js +14 -0
- package/lib/utils/SearchSuggestions/index.js +4 -0
- package/lib/utils/SearchSuggestions/styled.js +12 -0
- package/lib/utils/availableScreenSizes.js +4 -0
- package/lib/utils/constants.js +14 -0
- package/lib/utils/convertItemsToFilesFoldersUuids.js +12 -0
- package/lib/utils/convertItemstoFoldersParentUuids.js +12 -0
- package/lib/utils/createPromise.js +9 -0
- package/lib/utils/createSuperFocus.js +43 -0
- package/lib/utils/decodeB64ToStr.js +11 -0
- package/lib/utils/filters.js +333 -0
- package/lib/utils/formatFolderPath.js +10 -0
- package/lib/utils/formatPinSubTitle.js +17 -0
- package/lib/utils/getAcquirerTitle.js +10 -0
- package/lib/utils/getActiveOverlayEl.js +11 -0
- package/lib/utils/getApiPathtype.js +10 -0
- package/lib/utils/getClosestStr.js +22 -0
- package/lib/utils/getItemUuids.js +12 -0
- package/lib/utils/getLabelsTotalAssetsCount.js +6 -0
- package/lib/utils/getMoveAndDeleteData.js +15 -0
- package/lib/utils/getParentFolderPath.js +4 -0
- package/lib/utils/getQueryStringFromUrl.js +6 -0
- package/lib/utils/getScrollableParent.js +15 -0
- package/lib/utils/getStringValueExistedInObj.js +9 -0
- package/lib/utils/isEmbeddableAsset.js +6 -0
- package/lib/utils/isFileVersion.js +9 -0
- package/lib/utils/mapArrayKeysToObjValues.js +33 -0
- package/lib/utils/mapFiltersToShownFormat.js +252 -0
- package/lib/utils/prepareExportedFilesLinks.js +12 -0
- package/lib/utils/prepareSearchUrl.js +65 -0
- package/lib/utils/removeBackground.js +60 -0
- package/lib/utils/removeExtraUrlParams.js +13 -0
- package/lib/utils/scrollToAndFocusItemElement.js +16 -0
- package/lib/utils/toggleFolderNotFoundModal.js +25 -0
- package/lib/utils/trapFocus.js +59 -0
- package/lib/utils/truncateString.js +28 -0
- package/package.json +55 -0
- package/types/index.d.ts +108 -0
|
@@ -0,0 +1,1307 @@
|
|
|
1
|
+
var _excluded = ["method"],
|
|
2
|
+
_excluded2 = ["recursive", "path", "noPagination"],
|
|
3
|
+
_excluded3 = ["requestProgress", "abortFunction", "sendStatsReq", "responseType", "headers", "replaceOldFiles"],
|
|
4
|
+
_excluded4 = ["addNotFound"];
|
|
5
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
6
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
9
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
10
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
11
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
12
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
13
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
16
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
17
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
import { createSlice, createSelector, isAnyOf } from '@reduxjs/toolkit';
|
|
24
|
+
import { PLUGINS_IDS, PERMISSIONS, SEARCH_METHODS, REMOVE_BACKGROUND_ENDPOINT, REMOVE_BACKGROUND_LINK_PLACEHOLDER, FMAW_URL_QUERY_PARAMS, DESCRIBE_AI_SUPPORTED_LANGUAGES } from '@scaleflex/widget-utils/lib/constants';
|
|
25
|
+
import createThunk from '@scaleflex/widget-utils/lib/createThunk';
|
|
26
|
+
import { selectUploads, selectUploadsIds } from '@scaleflex/widget-core/lib/slices/uploads.slice';
|
|
27
|
+
import getFileLink from '@scaleflex/widget-utils/lib/getFileLink';
|
|
28
|
+
import getActionErrorState from '@scaleflex/widget-utils/lib/getActionErrorState';
|
|
29
|
+
import getNormalizedItems from '@scaleflex/widget-utils/lib/getNormalizedItems';
|
|
30
|
+
import copyText from '@scaleflex/widget-utils/lib/copyText';
|
|
31
|
+
import prepareSearchUrl from '../utils/prepareSearchUrl';
|
|
32
|
+
import { fileWindowUpdated, selectFileWindowFor, selectIsUploadsPanelOpened } from './panels.slice';
|
|
33
|
+
import { selectAppliedFilters } from './filters.slice';
|
|
34
|
+
import { exactAndExtendedFilesUpdated, searchFilesWithAiText, searchSimilarFiles, selectAllSearchFiles, selectAllSearchFilesUuids, selectExactSearchFileByUuid, selectExtendedSearchFileByUuid, selectIsAiSearch, selectIsExtendFetching, selectIsQuickFetching, selectSearchQuery, selectSearchSuggestionsFilters, selectSearchSuggestionsTags } from './search.slice';
|
|
35
|
+
import { selectAllSelectedItemsCount, selectionsCleared } from './selections.slice';
|
|
36
|
+
import { DEFAULT_SORT_OPTION, SORT_BY } from '../components/common/Sort/Sort.constants';
|
|
37
|
+
import { selectIsSearchOrFiltersMode, selectIsSearchMode, selectIsFoldersView, viewChanged, selectIsAssetsView, viewCachedFetchFilesQueries, changeViewFetchFilesCachedQueries, selectActiveViewItem } from './views.slice';
|
|
38
|
+
import { FILTER_SECTION_KEYS } from '../components/Filters/Filters.constants';
|
|
39
|
+
import { selectCurrentFolderPath, selectIsFolderFilesRecursiveFetch } from './folders.slice';
|
|
40
|
+
import decodeB64ToStr from '../utils/decodeB64ToStr';
|
|
41
|
+
import { getMetaRegionalGroupsLanguagesApiValues } from '../components/metadata.adapter';
|
|
42
|
+
import { selectActiveRegionalLang, selectIsCdnPermalinkEnabled, selectMetadataRegionalGroups } from './metadata.slice';
|
|
43
|
+
import { adaptFiltersToBackendNotation } from '../utils/filters';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The order of the code in slice file is:
|
|
47
|
+
* 1. initialState (*No* export needed)
|
|
48
|
+
* 2. automated thunks functions -- uses createThunk API-- (export needed)
|
|
49
|
+
* 3. createSlice (*No* export needed)
|
|
50
|
+
* 4. actions exports
|
|
51
|
+
* 5. selectors (export needed)
|
|
52
|
+
* 6. default reducer export
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
var slicePropName = 'files';
|
|
56
|
+
export var sliceName = "".concat(PLUGINS_IDS.EXPLORER, "/").concat(slicePropName);
|
|
57
|
+
export var ACTION_TYPE = {
|
|
58
|
+
FETCH_FILES: "".concat(sliceName, "/fetchFiles"),
|
|
59
|
+
FETCH_FILES_STATS: "".concat(sliceName, "/fetchFilesStats")
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// Changed from object to function to always re-calculate the object on calling to have the latest value of referenced objects (sorting...etc if changed.
|
|
63
|
+
var getInitialState = function getInitialState() {
|
|
64
|
+
return {
|
|
65
|
+
uuids: [],
|
|
66
|
+
entities: {},
|
|
67
|
+
stats: {
|
|
68
|
+
loading: false,
|
|
69
|
+
filesCount: 0,
|
|
70
|
+
filesCountMethod: null,
|
|
71
|
+
filesSize: 0
|
|
72
|
+
},
|
|
73
|
+
tmpFile: null,
|
|
74
|
+
// used to show a file temporary from any place after fetching it for ex. (showing a file in file window if not existed in entities)
|
|
75
|
+
loading: true,
|
|
76
|
+
variations: {},
|
|
77
|
+
offset: 0,
|
|
78
|
+
noMoreFiles: false,
|
|
79
|
+
sortOrder: DEFAULT_SORT_OPTION.order,
|
|
80
|
+
sortedBy: DEFAULT_SORT_OPTION.by
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export var getQueryForSearchAndFilters = function getQueryForSearchAndFilters(state) {
|
|
84
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
85
|
+
_ref$noSearch = _ref.noSearch,
|
|
86
|
+
noSearch = _ref$noSearch === void 0 ? false : _ref$noSearch,
|
|
87
|
+
_ref$noFilters = _ref.noFilters,
|
|
88
|
+
noFilters = _ref$noFilters === void 0 ? false : _ref$noFilters,
|
|
89
|
+
_ref$moreFilters = _ref.moreFilters,
|
|
90
|
+
moreFilters = _ref$moreFilters === void 0 ? {} : _ref$moreFilters,
|
|
91
|
+
_ref$filterKeysToDisr = _ref.filterKeysToDisregard,
|
|
92
|
+
filterKeysToDisregard = _ref$filterKeysToDisr === void 0 ? [] : _ref$filterKeysToDisr;
|
|
93
|
+
var searchSuggestionsFilters = selectSearchSuggestionsFilters(state);
|
|
94
|
+
var searchSuggestionsTags = selectSearchSuggestionsTags(state);
|
|
95
|
+
var searchQuery = selectSearchQuery(state);
|
|
96
|
+
// De-structuring to make it possible to delete filters.
|
|
97
|
+
var filters = _objectSpread(_objectSpread({}, moreFilters), selectAppliedFilters(state));
|
|
98
|
+
var queries = [];
|
|
99
|
+
if (!noSearch) {
|
|
100
|
+
queries.push.apply(queries, [searchQuery].concat(_toConsumableArray((searchSuggestionsFilters || []).map(function (filter) {
|
|
101
|
+
var _filter$value;
|
|
102
|
+
return "".concat(filter.key, ":\"").concat(((_filter$value = filter.value) === null || _filter$value === void 0 ? void 0 : _filter$value.sys_key) || filter.value, "\"");
|
|
103
|
+
})), _toConsumableArray((searchSuggestionsTags || []).map(function (tag) {
|
|
104
|
+
return tag.input;
|
|
105
|
+
}))));
|
|
106
|
+
}
|
|
107
|
+
if (!noFilters) {
|
|
108
|
+
if (Array.isArray(filterKeysToDisregard) && filterKeysToDisregard.length > 0) {
|
|
109
|
+
filterKeysToDisregard.forEach(function (filterKey) {
|
|
110
|
+
return delete filters[filterKey];
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
queries.push.apply(queries, _toConsumableArray(adaptFiltersToBackendNotation(filters)));
|
|
114
|
+
}
|
|
115
|
+
return queries.filter(Boolean).join(' ');
|
|
116
|
+
};
|
|
117
|
+
export var updateFiles = createThunk(function (_ref2, thunkApi) {
|
|
118
|
+
var _ref2$files = _ref2.files,
|
|
119
|
+
files = _ref2$files === void 0 ? [] : _ref2$files,
|
|
120
|
+
_ref2$addNotFoundSing = _ref2.addNotFoundSingleFile,
|
|
121
|
+
addNotFoundSingleFile = _ref2$addNotFoundSing === void 0 ? false : _ref2$addNotFoundSing;
|
|
122
|
+
var state = thunkApi.getState();
|
|
123
|
+
var isSearchMode = selectIsSearchMode(state);
|
|
124
|
+
if (isSearchMode) {
|
|
125
|
+
thunkApi.dispatch(exactAndExtendedFilesUpdated({
|
|
126
|
+
files: files
|
|
127
|
+
}));
|
|
128
|
+
} else if (Array.isArray(files) && files.length === 1 && addNotFoundSingleFile) {
|
|
129
|
+
var singleFile = files[0];
|
|
130
|
+
if (singleFile !== null && singleFile !== void 0 && singleFile.uuid) {
|
|
131
|
+
thunkApi.dispatch(fileUpdated(_objectSpread(_objectSpread({}, singleFile), {}, {
|
|
132
|
+
addNotFound: addNotFoundSingleFile
|
|
133
|
+
})));
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
thunkApi.dispatch(filesUpdated(files));
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
export var removeFilesBackground = createThunk(function () {
|
|
140
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
141
|
+
files = _ref3.files,
|
|
142
|
+
removeBackgroundFolder = _ref3.removeBackgroundFolder;
|
|
143
|
+
var thunkApi = arguments.length > 1 ? arguments[1] : undefined;
|
|
144
|
+
var dispatch = thunkApi.dispatch,
|
|
145
|
+
_thunkApi$extra = thunkApi.extra,
|
|
146
|
+
apiClient = _thunkApi$extra.apiClient,
|
|
147
|
+
_thunkApi$extra$filer = _thunkApi$extra.filerobot,
|
|
148
|
+
opts = _thunkApi$extra$filer.opts,
|
|
149
|
+
info = _thunkApi$extra$filer.info;
|
|
150
|
+
var container = opts.container;
|
|
151
|
+
var _thunkApi$extra$filer2 = thunkApi.extra.filerobot.getPlugin(PLUGINS_IDS.EXPLORER),
|
|
152
|
+
i18n = _thunkApi$extra$filer2.i18n;
|
|
153
|
+
var isInternalFolder = removeBackgroundFolder === 'internal';
|
|
154
|
+
info(i18n('backgroundRemovedProcessingInfo'), 'success');
|
|
155
|
+
var updatedFiles = files.map(function (file) {
|
|
156
|
+
var uuid = file.uuid,
|
|
157
|
+
_file$folder = file.folder,
|
|
158
|
+
_file$folder2 = _file$folder === void 0 ? {} : _file$folder,
|
|
159
|
+
folderPath = _file$folder2.name;
|
|
160
|
+
var fileLink = getFileLink(file);
|
|
161
|
+
var endpointWithFileLink = REMOVE_BACKGROUND_ENDPOINT.replace(REMOVE_BACKGROUND_LINK_PLACEHOLDER, fileLink);
|
|
162
|
+
apiClient.get(endpointWithFileLink, {
|
|
163
|
+
checkOnlySuccessStatus: true,
|
|
164
|
+
headers: _objectSpread({
|
|
165
|
+
'Filerobot-Token': container,
|
|
166
|
+
'Filerobot-uuid': uuid
|
|
167
|
+
}, !isInternalFolder && {
|
|
168
|
+
'Filerobot-folder': folderPath
|
|
169
|
+
})
|
|
170
|
+
}).then(function () {
|
|
171
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
172
|
+
status = _ref4.status;
|
|
173
|
+
setTimeout(function () {
|
|
174
|
+
return dispatch(handleFileBackgroundRemoval({
|
|
175
|
+
originalFile: file,
|
|
176
|
+
statusUrl: status,
|
|
177
|
+
info: info,
|
|
178
|
+
i18n: i18n
|
|
179
|
+
}));
|
|
180
|
+
}, 3000);
|
|
181
|
+
});
|
|
182
|
+
return _objectSpread(_objectSpread({}, file), {}, {
|
|
183
|
+
isRemovingBackground: true
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
return thunkApi.dispatch(updateFiles({
|
|
187
|
+
files: updatedFiles
|
|
188
|
+
}));
|
|
189
|
+
});
|
|
190
|
+
var handleFileBackgroundRemoval = createThunk(async function (_ref5, thunkApi) {
|
|
191
|
+
var originalFile = _ref5.originalFile,
|
|
192
|
+
statusUrl = _ref5.statusUrl,
|
|
193
|
+
info = _ref5.info,
|
|
194
|
+
i18n = _ref5.i18n,
|
|
195
|
+
signal = _ref5.signal;
|
|
196
|
+
if (!statusUrl) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
var _ref6 = (await thunkApi.extra.apiClient.get(statusUrl, {
|
|
200
|
+
abortSignal: signal,
|
|
201
|
+
checkOnlySuccessStatus: true
|
|
202
|
+
})) || {},
|
|
203
|
+
status = _ref6.status,
|
|
204
|
+
result = _ref6.result;
|
|
205
|
+
if (status === 'success') {
|
|
206
|
+
var _file$folder3;
|
|
207
|
+
var _ref7 = result || {},
|
|
208
|
+
_ref7$filerobot_info = _ref7.filerobot_info,
|
|
209
|
+
_ref7$filerobot_info2 = _ref7$filerobot_info === void 0 ? {} : _ref7$filerobot_info,
|
|
210
|
+
file = _ref7$filerobot_info2.file;
|
|
211
|
+
var fileFolderPath = file === null || file === void 0 ? void 0 : (_file$folder3 = file.folder) === null || _file$folder3 === void 0 ? void 0 : _file$folder3.name;
|
|
212
|
+
var state = thunkApi.getState();
|
|
213
|
+
var currentFolderPath = selectCurrentFolderPath(state);
|
|
214
|
+
if (fileFolderPath === currentFolderPath || selectIsAssetsView(state)) {
|
|
215
|
+
thunkApi.dispatch(fileUpdated(_objectSpread(_objectSpread({}, originalFile), {}, {
|
|
216
|
+
isRemovingBackground: false,
|
|
217
|
+
removedBackground: true
|
|
218
|
+
})));
|
|
219
|
+
if (file) {
|
|
220
|
+
thunkApi.dispatch(fileAdded(file));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
info(i18n('backgroundRemovedSuccessfullyInfo', {
|
|
224
|
+
fileName: originalFile.name,
|
|
225
|
+
folder: fileFolderPath || '.internal'
|
|
226
|
+
}), 'success');
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (status === 'error') {
|
|
230
|
+
info(i18n('backgroundRemovedFailInfo', {
|
|
231
|
+
fileName: originalFile.name
|
|
232
|
+
}), 'error');
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
setTimeout(function () {
|
|
236
|
+
return !(signal !== null && signal !== void 0 && signal.aborted) && thunkApi.dispatch(handleFileBackgroundRemoval({
|
|
237
|
+
originalFile: originalFile,
|
|
238
|
+
statusUrl: statusUrl,
|
|
239
|
+
info: info,
|
|
240
|
+
i18n: i18n,
|
|
241
|
+
signal: signal
|
|
242
|
+
}));
|
|
243
|
+
}, 3000);
|
|
244
|
+
});
|
|
245
|
+
export var fetchFilesStats = createThunk(async function (_ref8, thunkApi) {
|
|
246
|
+
var _stats$approx_files_c, _stats$approx_files_c2, _stats$approx_files_s;
|
|
247
|
+
var path = _ref8.path,
|
|
248
|
+
queryParams = _ref8.queryParams,
|
|
249
|
+
fetchArgs = _ref8.fetchArgs;
|
|
250
|
+
var _ref9 = (fetchArgs === null || fetchArgs === void 0 ? void 0 : fetchArgs.moreQueries) || {},
|
|
251
|
+
method = _ref9.method,
|
|
252
|
+
moreQueries = _objectWithoutProperties(_ref9, _excluded);
|
|
253
|
+
var _ref10 = (await thunkApi.extra.apiClient.fetch("".concat(path, "/stats").concat((queryParams === null || queryParams === void 0 ? void 0 : queryParams.length) > 0 ? "?".concat(queryParams.join('&')) : ''), _objectSpread(_objectSpread({}, fetchArgs), {}, {
|
|
254
|
+
moreQueries: moreQueries,
|
|
255
|
+
abortSignal: fetchArgs.abortSignal || thunkApi.signal,
|
|
256
|
+
noPagination: true,
|
|
257
|
+
noFormatAndSortParams: true
|
|
258
|
+
}))) || {},
|
|
259
|
+
_ref10$stats = _ref10.stats,
|
|
260
|
+
stats = _ref10$stats === void 0 ? {} : _ref10$stats;
|
|
261
|
+
return {
|
|
262
|
+
filesCount: (_stats$approx_files_c = stats.approx_files_count) !== null && _stats$approx_files_c !== void 0 ? _stats$approx_files_c : selectFilesUuids(thunkApi.getState()).length,
|
|
263
|
+
filesCountMethod: (_stats$approx_files_c2 = stats.approx_files_count_method) !== null && _stats$approx_files_c2 !== void 0 ? _stats$approx_files_c2 : null,
|
|
264
|
+
filesSize: (_stats$approx_files_s = stats.approx_files_size) !== null && _stats$approx_files_s !== void 0 ? _stats$approx_files_s : Object.values(selectFiles(thunkApi.getState())).reduce(function (acc, file) {
|
|
265
|
+
var _file$size;
|
|
266
|
+
return acc + (file === null || file === void 0 ? void 0 : (_file$size = file.size) === null || _file$size === void 0 ? void 0 : _file$size.bytes) || 0;
|
|
267
|
+
}, 0)
|
|
268
|
+
};
|
|
269
|
+
}, {
|
|
270
|
+
actionType: ACTION_TYPE.FETCH_FILES_STATS
|
|
271
|
+
});
|
|
272
|
+
var updateFilesSorting = function updateFilesSorting(_ref11) {
|
|
273
|
+
var state = _ref11.state,
|
|
274
|
+
sorting = _ref11.sorting,
|
|
275
|
+
thunkApi = _ref11.thunkApi;
|
|
276
|
+
var dispatch = thunkApi.dispatch,
|
|
277
|
+
extra = thunkApi.extra;
|
|
278
|
+
var sortBy;
|
|
279
|
+
var sortOrder;
|
|
280
|
+
// If there is custom sorting provided, then let's update it while using.
|
|
281
|
+
if (Array.isArray(sorting) || typeof sorting === 'string') {
|
|
282
|
+
var _ref12 = Array.isArray(sorting) ? sorting : sorting.split(':');
|
|
283
|
+
var _ref13 = _slicedToArray(_ref12, 2);
|
|
284
|
+
sortBy = _ref13[0];
|
|
285
|
+
sortOrder = _ref13[1];
|
|
286
|
+
if (sortBy && sortOrder) {
|
|
287
|
+
dispatch(filesSortingUpdated({
|
|
288
|
+
sortBy: sortBy,
|
|
289
|
+
order: sortOrder
|
|
290
|
+
}));
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
sortOrder = selectFilesSortOrder(state);
|
|
294
|
+
sortBy = selectFilesSortedBy(state);
|
|
295
|
+
if (!selectIsSearchMode(state)) {
|
|
296
|
+
var _extra$filerobot$getP2, _extra$filerobot$getP3;
|
|
297
|
+
var _extra$filerobot$getP = extra === null || extra === void 0 ? void 0 : (_extra$filerobot$getP2 = extra.filerobot.getPlugin(PLUGINS_IDS.EXPLORER)) === null || _extra$filerobot$getP2 === void 0 ? void 0 : (_extra$filerobot$getP3 = _extra$filerobot$getP2.opts) === null || _extra$filerobot$getP3 === void 0 ? void 0 : _extra$filerobot$getP3.config,
|
|
298
|
+
defaultSort = _extra$filerobot$getP.defaultSort;
|
|
299
|
+
sortBy = sortBy || defaultSort.by || DEFAULT_SORT_OPTION.by;
|
|
300
|
+
sortOrder = sortOrder || defaultSort.order || DEFAULT_SORT_OPTION.order;
|
|
301
|
+
if (sortBy === SORT_BY.RELEVANCE) {
|
|
302
|
+
sortBy = defaultSort.by || DEFAULT_SORT_OPTION.by;
|
|
303
|
+
}
|
|
304
|
+
dispatch(filesSortingUpdated({
|
|
305
|
+
sortBy: sortBy,
|
|
306
|
+
order: sortOrder
|
|
307
|
+
}));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return !sortBy ? undefined : "".concat(sortBy, ":").concat(sortOrder);
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* cachedViewQueries === { [key]: value }, means we are fetching the files for which view-mode/feature (folder/label/...etc), examples:
|
|
314
|
+
* { folder: 'folderUuid' } or { labels: 'labelSid' }
|
|
315
|
+
* or { search: 'searchQuery' } or { search: 'searchQuery', folder: 'folderPath' }
|
|
316
|
+
* -- u could add `recursive: true` to be cached with the view also to be considered always in the request till changing the view.
|
|
317
|
+
*
|
|
318
|
+
*/
|
|
319
|
+
// `lastViewOptions` - used to keep tracked of the last applied view for fetchFiles...
|
|
320
|
+
// to be used in fetching files again for the same query without providing query one more time (easier to call the thunk from anyplace without query or complex/spaghetti logic).
|
|
321
|
+
export var fetchInitialFiles = function fetchInitialFiles(args) {
|
|
322
|
+
return fetchFiles(_objectSpread(_objectSpread({
|
|
323
|
+
withStats: true
|
|
324
|
+
}, args), {}, {
|
|
325
|
+
offset: 0
|
|
326
|
+
}));
|
|
327
|
+
};
|
|
328
|
+
export var fetchFiles = createThunk(async function () {
|
|
329
|
+
var _selectIsFolderFilesR;
|
|
330
|
+
var _ref14 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
331
|
+
_ref14$cachedViewQuer = _ref14.cachedViewQueries,
|
|
332
|
+
cachedViewQueries = _ref14$cachedViewQuer === void 0 ? viewCachedFetchFilesQueries : _ref14$cachedViewQuer,
|
|
333
|
+
queries = _ref14.queries,
|
|
334
|
+
offset = _ref14.offset,
|
|
335
|
+
limit = _ref14.limit,
|
|
336
|
+
filters = _ref14.filters,
|
|
337
|
+
format = _ref14.format,
|
|
338
|
+
_ref14$recursive = _ref14.recursive,
|
|
339
|
+
recursive = _ref14$recursive === void 0 ? false : _ref14$recursive,
|
|
340
|
+
sorting = _ref14.sorting,
|
|
341
|
+
_ref14$path = _ref14.path,
|
|
342
|
+
path = _ref14$path === void 0 ? 'files' : _ref14$path,
|
|
343
|
+
_ref14$abortSignal = _ref14.abortSignal,
|
|
344
|
+
abortSignal = _ref14$abortSignal === void 0 ? null : _ref14$abortSignal,
|
|
345
|
+
_ref14$withStats = _ref14.withStats,
|
|
346
|
+
withStats = _ref14$withStats === void 0 ? false : _ref14$withStats,
|
|
347
|
+
_ref14$replaceOldFile = _ref14.replaceOldFiles,
|
|
348
|
+
replaceOldFiles = _ref14$replaceOldFile === void 0 ? false : _ref14$replaceOldFile,
|
|
349
|
+
_ref14$noPagination = _ref14.noPagination,
|
|
350
|
+
noPagination = _ref14$noPagination === void 0 ? false : _ref14$noPagination,
|
|
351
|
+
_ref14$id = _ref14.id,
|
|
352
|
+
id = _ref14$id === void 0 ? 'listFiles' : _ref14$id,
|
|
353
|
+
_ref14$useSameApiStat = _ref14.useSameApiStats,
|
|
354
|
+
useSameApiStats = _ref14$useSameApiStat === void 0 ? false : _ref14$useSameApiStat,
|
|
355
|
+
_ref14$skipDispatch = _ref14.skipDispatch,
|
|
356
|
+
skipDispatch = _ref14$skipDispatch === void 0 ? false : _ref14$skipDispatch,
|
|
357
|
+
_ref14$skipPendingDis = _ref14.skipPendingDispatch,
|
|
358
|
+
skipPendingDispatch = _ref14$skipPendingDis === void 0 ? false : _ref14$skipPendingDis,
|
|
359
|
+
_ref14$returnBlob = _ref14.returnBlob,
|
|
360
|
+
returnBlob = _ref14$returnBlob === void 0 ? false : _ref14$returnBlob,
|
|
361
|
+
_ref14$xhrOptions = _ref14.xhrOptions,
|
|
362
|
+
xhrOptions = _ref14$xhrOptions === void 0 ? {} : _ref14$xhrOptions,
|
|
363
|
+
_ref14$noSearch = _ref14.noSearch,
|
|
364
|
+
noSearch = _ref14$noSearch === void 0 ? false : _ref14$noSearch,
|
|
365
|
+
_ref14$noFilters = _ref14.noFilters,
|
|
366
|
+
noFilters = _ref14$noFilters === void 0 ? false : _ref14$noFilters,
|
|
367
|
+
_ref14$noSorting = _ref14.noSorting,
|
|
368
|
+
noSorting = _ref14$noSorting === void 0 ? false : _ref14$noSorting,
|
|
369
|
+
_ref14$deleteFiltersA = _ref14.deleteFiltersAndSearchUrlQueries,
|
|
370
|
+
deleteFiltersAndSearchUrlQueries = _ref14$deleteFiltersA === void 0 ? false : _ref14$deleteFiltersA,
|
|
371
|
+
_ref14$applyActiveVie = _ref14.applyActiveViewItemCheck,
|
|
372
|
+
applyActiveViewItemCheck = _ref14$applyActiveVie === void 0 ? true : _ref14$applyActiveVie;
|
|
373
|
+
var thunkApi = arguments.length > 1 ? arguments[1] : undefined;
|
|
374
|
+
if (applyActiveViewItemCheck && !selectActiveViewItem(thunkApi.getState())) {
|
|
375
|
+
thunkApi.skipDispatch();
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
if (skipDispatch) {
|
|
379
|
+
thunkApi.skipDispatch();
|
|
380
|
+
} else if (skipPendingDispatch) {
|
|
381
|
+
thunkApi.skipPendingDispatch();
|
|
382
|
+
}
|
|
383
|
+
var _thunkApi$extra$filer3 = thunkApi.extra.filerobot.getPlugin(PLUGINS_IDS.EXPLORER),
|
|
384
|
+
opts = _thunkApi$extra$filer3.opts,
|
|
385
|
+
replaceUrlQueryParams = _thunkApi$extra$filer3.replaceUrlQueryParams;
|
|
386
|
+
var defaultFilters = opts.defaultFilters,
|
|
387
|
+
forceFilters = opts.forceFilters,
|
|
388
|
+
disableFiltersAndSearch = opts.disableFiltersAndSearch,
|
|
389
|
+
_opts$config = opts.config,
|
|
390
|
+
config = _opts$config === void 0 ? {} : _opts$config;
|
|
391
|
+
var filesLimit = config.filesLimit;
|
|
392
|
+
var fetch = thunkApi.extra.apiClient.fetch;
|
|
393
|
+
var state = thunkApi.getState();
|
|
394
|
+
var currentOffset = (['undefined', 'null'].includes(_typeof(offset)) && !replaceOldFiles ? selectFilesOffset(state) : offset) || 0;
|
|
395
|
+
var currentLimit = limit || filesLimit;
|
|
396
|
+
if (!disableFiltersAndSearch && deleteFiltersAndSearchUrlQueries) {
|
|
397
|
+
replaceUrlQueryParams({
|
|
398
|
+
keysToDelete: [!forceFilters && FMAW_URL_QUERY_PARAMS.FILTER_PREFIX, FMAW_URL_QUERY_PARAMS.SEARCH_PREFIX]
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// If there is custom sorting provided, then let's update it while using.
|
|
403
|
+
var currentSorting = updateFilesSorting({
|
|
404
|
+
state: state,
|
|
405
|
+
sorting: sorting,
|
|
406
|
+
thunkApi: thunkApi
|
|
407
|
+
});
|
|
408
|
+
changeViewFetchFilesCachedQueries(cachedViewQueries);
|
|
409
|
+
var _ref15 = cachedViewQueries || {},
|
|
410
|
+
isRecursiveView = _ref15.recursive,
|
|
411
|
+
viewPath = _ref15.path,
|
|
412
|
+
isNoPaginationView = _ref15.noPagination,
|
|
413
|
+
viewQueries = _objectWithoutProperties(_ref15, _excluded2);
|
|
414
|
+
var customQueries = _objectSpread(_objectSpread({}, viewQueries), queries);
|
|
415
|
+
var filterKeysToDisregard = [];
|
|
416
|
+
var isFoldersView = selectIsFoldersView(state);
|
|
417
|
+
if (!noFilters && (isFoldersView || customQueries.folder)) {
|
|
418
|
+
filterKeysToDisregard.push(FILTER_SECTION_KEYS.FOLDERS);
|
|
419
|
+
}
|
|
420
|
+
var searchAndFiltersQuery = getQueryForSearchAndFilters(state, {
|
|
421
|
+
noSearch: noSearch,
|
|
422
|
+
noFilters: noFilters,
|
|
423
|
+
filterKeysToDisregard: filterKeysToDisregard,
|
|
424
|
+
moreFilters: _objectSpread(_objectSpread({}, filters), defaultFilters)
|
|
425
|
+
});
|
|
426
|
+
var isCdnPermalinkEnabled = selectIsCdnPermalinkEnabled(state);
|
|
427
|
+
var moreQueries = _objectSpread(_objectSpread(_objectSpread({}, searchAndFiltersQuery && {
|
|
428
|
+
q: searchAndFiltersQuery
|
|
429
|
+
}), customQueries), isCdnPermalinkEnabled && {
|
|
430
|
+
fields: 'cdn_permalink'
|
|
431
|
+
});
|
|
432
|
+
if (!noFilters && moreQueries.folder && selectAppliedFilters(state)[FILTER_SECTION_KEYS.FOLDERS]) {
|
|
433
|
+
var _selectAppliedFilters;
|
|
434
|
+
moreQueries.folder = ((_selectAppliedFilters = selectAppliedFilters(state)[FILTER_SECTION_KEYS.FOLDERS].value) === null || _selectAppliedFilters === void 0 ? void 0 : _selectAppliedFilters[0]) || moreQueries.folder;
|
|
435
|
+
}
|
|
436
|
+
var fetchArgs = _objectSpread(_objectSpread({}, xhrOptions), {}, {
|
|
437
|
+
id: id,
|
|
438
|
+
offset: currentOffset,
|
|
439
|
+
limit: currentLimit,
|
|
440
|
+
sorting: noSorting ? undefined : currentSorting,
|
|
441
|
+
format: format,
|
|
442
|
+
noPagination: isNoPaginationView || noPagination,
|
|
443
|
+
abortSignal: abortSignal || thunkApi.signal,
|
|
444
|
+
moreQueries: moreQueries,
|
|
445
|
+
recursive: (_selectIsFolderFilesR = selectIsFolderFilesRecursiveFetch(state)) !== null && _selectIsFolderFilesR !== void 0 ? _selectIsFolderFilesR : isRecursiveView || recursive,
|
|
446
|
+
noRecursiveParam: false,
|
|
447
|
+
useCustomEncoding: true
|
|
448
|
+
});
|
|
449
|
+
var selectedItemsCount = selectAllSelectedItemsCount(state);
|
|
450
|
+
if ((replaceOldFiles || currentOffset === 0) && selectedItemsCount > 0) {
|
|
451
|
+
thunkApi.dispatch(selectionsCleared());
|
|
452
|
+
}
|
|
453
|
+
var filesRequest = fetch("".concat(viewPath || path, "?preview=2301"), fetchArgs);
|
|
454
|
+
if (returnBlob) {
|
|
455
|
+
var filesResponse = await filesRequest;
|
|
456
|
+
return filesResponse;
|
|
457
|
+
}
|
|
458
|
+
if (withStats) {
|
|
459
|
+
thunkApi.dispatch(fetchFilesStats({
|
|
460
|
+
path: path,
|
|
461
|
+
fetchArgs: _objectSpread(_objectSpread({}, fetchArgs), {}, {
|
|
462
|
+
id: 'listFilesStats'
|
|
463
|
+
})
|
|
464
|
+
}));
|
|
465
|
+
}
|
|
466
|
+
var _ref16 = (await filesRequest) || {},
|
|
467
|
+
folder = _ref16.base,
|
|
468
|
+
_ref16$files = _ref16.files,
|
|
469
|
+
files = _ref16$files === void 0 ? [] : _ref16$files,
|
|
470
|
+
_ref16$info = _ref16.info,
|
|
471
|
+
info = _ref16$info === void 0 ? {} : _ref16$info,
|
|
472
|
+
type = _ref16.type;
|
|
473
|
+
return _objectSpread(_objectSpread({
|
|
474
|
+
fetchType: type
|
|
475
|
+
}, isFoldersView && {
|
|
476
|
+
folder: folder
|
|
477
|
+
}), {}, {
|
|
478
|
+
files: files,
|
|
479
|
+
// if `replace` is provided, then the files response will contain `replace` for the reducer
|
|
480
|
+
// to replace current files in the store, otherwise they will get appended.
|
|
481
|
+
replaceOldFiles: replaceOldFiles || currentOffset === 0,
|
|
482
|
+
noMoreFiles: files.length < currentLimit * 0.5,
|
|
483
|
+
// TODO: Remove "* 0.5" when BE fix issue and send correct number of files, now sometimes they send less. To avoid lazy loading stops we need this hack.
|
|
484
|
+
newOffset: currentLimit + currentOffset
|
|
485
|
+
}, useSameApiStats && {
|
|
486
|
+
stats: {
|
|
487
|
+
loading: false,
|
|
488
|
+
filesCountMethod: null,
|
|
489
|
+
filesCount: info.total_files_count || files.length,
|
|
490
|
+
filesSize: info.total_files_size || files.reduce(function (acc, file) {
|
|
491
|
+
var _file$size2;
|
|
492
|
+
return acc + (file === null || file === void 0 ? void 0 : (_file$size2 = file.size) === null || _file$size2 === void 0 ? void 0 : _file$size2.bytes) || 0;
|
|
493
|
+
}, 0)
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}, {
|
|
497
|
+
actionType: ACTION_TYPE.FETCH_FILES
|
|
498
|
+
});
|
|
499
|
+
var getCdnPermalinkFieldsQueryParams = function getCdnPermalinkFieldsQueryParams(isEnabled) {
|
|
500
|
+
return isEnabled ? '?fields=cdn_permalink' : '';
|
|
501
|
+
};
|
|
502
|
+
export var fetchFileByUuid = createThunk(async function () {
|
|
503
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
504
|
+
var thunkApi = arguments.length > 1 ? arguments[1] : undefined;
|
|
505
|
+
// To support old params type in-case of not modified one, but in-fact as a new there is no use-case for it and we should provide object.
|
|
506
|
+
var _ref17 = typeof params === 'string' ? {
|
|
507
|
+
uuid: params,
|
|
508
|
+
addNotFound: true
|
|
509
|
+
} : params,
|
|
510
|
+
uuid = _ref17.uuid,
|
|
511
|
+
_ref17$addNotFound = _ref17.addNotFound,
|
|
512
|
+
addNotFound = _ref17$addNotFound === void 0 ? true : _ref17$addNotFound,
|
|
513
|
+
_ref17$skipDispatch = _ref17.skipDispatch,
|
|
514
|
+
skipDispatch = _ref17$skipDispatch === void 0 ? false : _ref17$skipDispatch;
|
|
515
|
+
var isCdnPermalinkEnabled = selectIsCdnPermalinkEnabled(thunkApi.getState());
|
|
516
|
+
if (skipDispatch) {
|
|
517
|
+
thunkApi.skipDispatch();
|
|
518
|
+
}
|
|
519
|
+
var _await$thunkApi$extra = await thunkApi.extra.apiClient.get("file/".concat(uuid).concat(getCdnPermalinkFieldsQueryParams(isCdnPermalinkEnabled)), {
|
|
520
|
+
id: 'getFile',
|
|
521
|
+
abortSignal: thunkApi.signal
|
|
522
|
+
}),
|
|
523
|
+
_await$thunkApi$extra2 = _await$thunkApi$extra.file,
|
|
524
|
+
file = _await$thunkApi$extra2 === void 0 ? {} : _await$thunkApi$extra2;
|
|
525
|
+
return _objectSpread(_objectSpread({}, file), {}, {
|
|
526
|
+
addNotFound: addNotFound
|
|
527
|
+
});
|
|
528
|
+
}, {
|
|
529
|
+
actionType: "".concat(sliceName, "/updateFileByUuid")
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
// gets the file from the state only without fetching to be used in places that not able to use selectors.
|
|
533
|
+
export var getFileByUuidFromState = createThunk(function (uuid, thunkApi) {
|
|
534
|
+
return selectFileByUuid(thunkApi.getState(), uuid);
|
|
535
|
+
});
|
|
536
|
+
export var renameFile = createThunk(async function (_ref18, thunkApi) {
|
|
537
|
+
var uuid = _ref18.uuid,
|
|
538
|
+
name = _ref18.name,
|
|
539
|
+
_ref18$skipPendingDis = _ref18.skipPendingDispatch,
|
|
540
|
+
skipPendingDispatch = _ref18$skipPendingDis === void 0 ? false : _ref18$skipPendingDis;
|
|
541
|
+
if (skipPendingDispatch) {
|
|
542
|
+
thunkApi.skipPendingDispatch();
|
|
543
|
+
}
|
|
544
|
+
var _await$thunkApi$extra3 = await thunkApi.extra.apiClient.put("file/".concat(uuid, "/name"), {
|
|
545
|
+
data: {
|
|
546
|
+
name: name
|
|
547
|
+
},
|
|
548
|
+
permissionsToCheck: [PERMISSIONS.FILE_RENAME],
|
|
549
|
+
abortSignal: thunkApi.signal
|
|
550
|
+
}),
|
|
551
|
+
_await$thunkApi$extra4 = _await$thunkApi$extra3.file,
|
|
552
|
+
file = _await$thunkApi$extra4 === void 0 ? {} : _await$thunkApi$extra4;
|
|
553
|
+
return file;
|
|
554
|
+
}, {
|
|
555
|
+
actionType: "".concat(sliceName, "/updateFileName")
|
|
556
|
+
});
|
|
557
|
+
export var updateFileMeta = createThunk(async function (_ref19, thunkApi) {
|
|
558
|
+
var uuid = _ref19.uuid,
|
|
559
|
+
meta = _ref19.meta,
|
|
560
|
+
_ref19$skipPendingDis = _ref19.skipPendingDispatch,
|
|
561
|
+
skipPendingDispatch = _ref19$skipPendingDis === void 0 ? false : _ref19$skipPendingDis;
|
|
562
|
+
if (skipPendingDispatch) {
|
|
563
|
+
thunkApi.skipPendingDispatch();
|
|
564
|
+
}
|
|
565
|
+
if (Object.keys(meta).length < 1) {
|
|
566
|
+
return selectFileByUuid(thunkApi.getState(), uuid);
|
|
567
|
+
}
|
|
568
|
+
var _await$thunkApi$extra5 = await thunkApi.extra.apiClient.put("file/".concat(uuid, "/meta"), {
|
|
569
|
+
data: {
|
|
570
|
+
meta: meta
|
|
571
|
+
},
|
|
572
|
+
permissionToCheck: [PERMISSIONS.FILE_META],
|
|
573
|
+
enabledAbort: false,
|
|
574
|
+
abortSignal: thunkApi.signal
|
|
575
|
+
}),
|
|
576
|
+
_await$thunkApi$extra6 = _await$thunkApi$extra5.file,
|
|
577
|
+
file = _await$thunkApi$extra6 === void 0 ? {} : _await$thunkApi$extra6;
|
|
578
|
+
return file;
|
|
579
|
+
}, {
|
|
580
|
+
actionType: "".concat(sliceName, "/updateFileMeta")
|
|
581
|
+
});
|
|
582
|
+
export var updateFileTags = createThunk(async function (_ref20, thunkApi) {
|
|
583
|
+
var uuid = _ref20.uuid,
|
|
584
|
+
languageKey = _ref20.languageKey,
|
|
585
|
+
existingTags = _ref20.existingTags,
|
|
586
|
+
newTags = _ref20.newTags,
|
|
587
|
+
_ref20$skipPendingDis = _ref20.skipPendingDispatch,
|
|
588
|
+
skipPendingDispatch = _ref20$skipPendingDis === void 0 ? false : _ref20$skipPendingDis;
|
|
589
|
+
if (skipPendingDispatch) {
|
|
590
|
+
thunkApi.skipPendingDispatch();
|
|
591
|
+
}
|
|
592
|
+
var _await$thunkApi$extra7 = await thunkApi.extra.apiClient.put("file/".concat(uuid, "/tags"), {
|
|
593
|
+
data: _objectSpread(_objectSpread({
|
|
594
|
+
lang: languageKey
|
|
595
|
+
}, existingTags ? {
|
|
596
|
+
existing_tags: existingTags
|
|
597
|
+
} : {}), newTags ? {
|
|
598
|
+
new_tags: newTags
|
|
599
|
+
} : {}),
|
|
600
|
+
permissionToCheck: [PERMISSIONS.FILE_META],
|
|
601
|
+
abortSignal: thunkApi.signal
|
|
602
|
+
}),
|
|
603
|
+
_await$thunkApi$extra8 = _await$thunkApi$extra7.file,
|
|
604
|
+
file = _await$thunkApi$extra8 === void 0 ? {} : _await$thunkApi$extra8;
|
|
605
|
+
return file;
|
|
606
|
+
}, {
|
|
607
|
+
actionType: "".concat(sliceName, "/updateFileTags")
|
|
608
|
+
});
|
|
609
|
+
export var updateFileProduct = createThunk(async function (_ref21, thunkApi) {
|
|
610
|
+
var uuid = _ref21.uuid,
|
|
611
|
+
product = _ref21.product,
|
|
612
|
+
_ref21$skipPendingDis = _ref21.skipPendingDispatch,
|
|
613
|
+
skipPendingDispatch = _ref21$skipPendingDis === void 0 ? false : _ref21$skipPendingDis;
|
|
614
|
+
if (skipPendingDispatch) {
|
|
615
|
+
thunkApi.skipPendingDispatch();
|
|
616
|
+
}
|
|
617
|
+
var _await$thunkApi$extra9 = await thunkApi.extra.apiClient.put("file/".concat(uuid, "/product"), {
|
|
618
|
+
data: {
|
|
619
|
+
product: product
|
|
620
|
+
},
|
|
621
|
+
permissionToCheck: [PERMISSIONS.FILE_PRODUCT_CHANGE],
|
|
622
|
+
abortSignal: thunkApi.signal
|
|
623
|
+
}),
|
|
624
|
+
_await$thunkApi$extra10 = _await$thunkApi$extra9.file,
|
|
625
|
+
file = _await$thunkApi$extra10 === void 0 ? {} : _await$thunkApi$extra10;
|
|
626
|
+
return file;
|
|
627
|
+
}, {
|
|
628
|
+
actionType: "".concat(sliceName, "/updateFileProduct")
|
|
629
|
+
});
|
|
630
|
+
export var generateFileTags = createThunk(async function (_ref22, thunkApi) {
|
|
631
|
+
var _ref22$uuid = _ref22.uuid,
|
|
632
|
+
uuid = _ref22$uuid === void 0 ? '' : _ref22$uuid,
|
|
633
|
+
_ref22$provider = _ref22.provider,
|
|
634
|
+
provider = _ref22$provider === void 0 ? 'google' : _ref22$provider,
|
|
635
|
+
_ref22$confidence = _ref22.confidence,
|
|
636
|
+
confidence = _ref22$confidence === void 0 ? 60 : _ref22$confidence,
|
|
637
|
+
_ref22$limit = _ref22.limit,
|
|
638
|
+
limit = _ref22$limit === void 0 ? 10 : _ref22$limit,
|
|
639
|
+
_ref22$languages = _ref22.languages,
|
|
640
|
+
languages = _ref22$languages === void 0 ? ['en'] : _ref22$languages;
|
|
641
|
+
var _await$thunkApi$extra11 = await thunkApi.extra.apiClient.post('process/autotag', {
|
|
642
|
+
data: {
|
|
643
|
+
file: {
|
|
644
|
+
uuid: uuid
|
|
645
|
+
},
|
|
646
|
+
meta: {
|
|
647
|
+
languages: languages,
|
|
648
|
+
provider: provider,
|
|
649
|
+
limit: limit,
|
|
650
|
+
confidence: confidence
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
permissionToCheck: [PERMISSIONS.FILE_META],
|
|
654
|
+
id: 'generateTags',
|
|
655
|
+
abortSignal: thunkApi.signal
|
|
656
|
+
}),
|
|
657
|
+
file = _await$thunkApi$extra11.file;
|
|
658
|
+
return file;
|
|
659
|
+
});
|
|
660
|
+
export var generateFileDescription = createThunk(async function (_ref23, thunkApi) {
|
|
661
|
+
var _ref23$uuid = _ref23.uuid,
|
|
662
|
+
uuid = _ref23$uuid === void 0 ? '' : _ref23$uuid;
|
|
663
|
+
var state = thunkApi.getState();
|
|
664
|
+
var metaRegionalGroups = selectMetadataRegionalGroups(state);
|
|
665
|
+
var activeRegionalLangKey = selectActiveRegionalLang(state);
|
|
666
|
+
var regionalLanguages = getMetaRegionalGroupsLanguagesApiValues(metaRegionalGroups);
|
|
667
|
+
var includeActiveLang = DESCRIBE_AI_SUPPORTED_LANGUAGES[activeRegionalLangKey];
|
|
668
|
+
var supportedLanguages = regionalLanguages.filter(function (lang) {
|
|
669
|
+
return lang !== activeRegionalLangKey && lang !== 'en' && DESCRIBE_AI_SUPPORTED_LANGUAGES[lang];
|
|
670
|
+
});
|
|
671
|
+
var languages = [].concat(_toConsumableArray(includeActiveLang ? [activeRegionalLangKey] : []), _toConsumableArray(supportedLanguages)).slice(0, 5);
|
|
672
|
+
var response = await thunkApi.extra.apiClient.post('process/describe', {
|
|
673
|
+
data: {
|
|
674
|
+
file: {
|
|
675
|
+
uuid: uuid
|
|
676
|
+
},
|
|
677
|
+
meta: {
|
|
678
|
+
languages: languages
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
abortSignal: thunkApi.signal
|
|
682
|
+
});
|
|
683
|
+
if (response !== null && response !== void 0 && response.translations) {
|
|
684
|
+
return _objectSpread({
|
|
685
|
+
en: response.response
|
|
686
|
+
}, response.translations);
|
|
687
|
+
}
|
|
688
|
+
return _defineProperty({}, languages[0], response === null || response === void 0 ? void 0 : response.response);
|
|
689
|
+
});
|
|
690
|
+
export var searchFilesService = async function searchFilesService(params, thunkApi) {
|
|
691
|
+
var requestProgress = params.requestProgress,
|
|
692
|
+
abortFunction = params.abortFunction,
|
|
693
|
+
sendStatsReq = params.sendStatsReq,
|
|
694
|
+
responseType = params.responseType,
|
|
695
|
+
headers = params.headers,
|
|
696
|
+
replaceOldFiles = params.replaceOldFiles,
|
|
697
|
+
searchParams = _objectWithoutProperties(params, _excluded3);
|
|
698
|
+
var url = prepareSearchUrl(_objectSpread(_objectSpread({}, searchParams), {}, {
|
|
699
|
+
apiPath: 'files?preview=2301'
|
|
700
|
+
}), function (queryItems) {
|
|
701
|
+
if (sendStatsReq) {
|
|
702
|
+
thunkApi.dispatch(fetchFilesStats({
|
|
703
|
+
path: 'files',
|
|
704
|
+
queryParams: queryItems,
|
|
705
|
+
fetchArgs: {
|
|
706
|
+
id: 'searchFilesStats',
|
|
707
|
+
abortSignal: thunkApi.signal
|
|
708
|
+
}
|
|
709
|
+
}));
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
var searchResponse = (await thunkApi.extra.apiClient.get(url, {
|
|
713
|
+
id: searchParams.method === SEARCH_METHODS.EXTENDED ? 'searchFilesExtended' : 'searchFiles',
|
|
714
|
+
onProgress: requestProgress,
|
|
715
|
+
onAbort: abortFunction,
|
|
716
|
+
headers: headers,
|
|
717
|
+
responseType: responseType,
|
|
718
|
+
abortSignal: thunkApi.signal
|
|
719
|
+
})) || {};
|
|
720
|
+
return responseType === 'blob' ? searchResponse : {
|
|
721
|
+
files: searchResponse.files,
|
|
722
|
+
replaceOldFiles: replaceOldFiles
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
export var moveFiles = createThunk(async function (_ref25, thunkApi) {
|
|
726
|
+
var _ref25$fileUuids = _ref25.fileUuids,
|
|
727
|
+
fileUuids = _ref25$fileUuids === void 0 ? [] : _ref25$fileUuids,
|
|
728
|
+
folderPath = _ref25.folderPath;
|
|
729
|
+
var response = await thunkApi.extra.apiClient.post("files".concat(getCdnPermalinkFieldsQueryParams(selectIsCdnPermalinkEnabled(thunkApi.getState()))), {
|
|
730
|
+
data: {
|
|
731
|
+
files_uuids: fileUuids,
|
|
732
|
+
new_folder_name: folderPath
|
|
733
|
+
},
|
|
734
|
+
permissionToCheck: [PERMISSIONS.FILE_MOVE],
|
|
735
|
+
abortSignal: thunkApi.signal
|
|
736
|
+
});
|
|
737
|
+
return response.files.map(function (file) {
|
|
738
|
+
return file.uuid;
|
|
739
|
+
});
|
|
740
|
+
}, {
|
|
741
|
+
actionType: "".concat(sliceName, "/moveFiles")
|
|
742
|
+
});
|
|
743
|
+
export var deleteFiles = createThunk(async function (uuids, thunkApi) {
|
|
744
|
+
var response = await thunkApi.extra.apiClient["delete"]("files".concat(getCdnPermalinkFieldsQueryParams(selectIsCdnPermalinkEnabled(thunkApi.getState()))), {
|
|
745
|
+
data: {
|
|
746
|
+
files_uuids: uuids
|
|
747
|
+
},
|
|
748
|
+
permissionToCheck: [PERMISSIONS.FILE_DELETE],
|
|
749
|
+
abortSignal: thunkApi.signal
|
|
750
|
+
});
|
|
751
|
+
thunkApi.extra.filerobot.emit('objects-removed', uuids, 'files');
|
|
752
|
+
return response.files_uuids;
|
|
753
|
+
}, {
|
|
754
|
+
actionType: "".concat(sliceName, "/deleteFiles")
|
|
755
|
+
});
|
|
756
|
+
export var openFileWindowFromUrl = createThunk(function (_, thunkApi) {
|
|
757
|
+
var _thunkApi$extra$filer4 = thunkApi.extra.filerobot.getPlugin(PLUGINS_IDS.EXPLORER),
|
|
758
|
+
getUrlQueryParam = _thunkApi$extra$filer4.getUrlQueryParam;
|
|
759
|
+
var fileUuidFromUrl = decodeB64ToStr(getUrlQueryParam(FMAW_URL_QUERY_PARAMS.FILE_WINDOW));
|
|
760
|
+
var currentFileWindowUuid = selectFileWindowFor(thunkApi.getState());
|
|
761
|
+
if (fileUuidFromUrl && fileUuidFromUrl !== currentFileWindowUuid) {
|
|
762
|
+
var tabToOpen = getUrlQueryParam(FMAW_URL_QUERY_PARAMS.FILE_WINDOW_TAB);
|
|
763
|
+
thunkApi.dispatch(fileWindowUpdated({
|
|
764
|
+
"for": fileUuidFromUrl,
|
|
765
|
+
tabId: tabToOpen
|
|
766
|
+
}));
|
|
767
|
+
return thunkApi.dispatch(fetchFileByUuid({
|
|
768
|
+
uuid: fileUuidFromUrl
|
|
769
|
+
}));
|
|
770
|
+
}
|
|
771
|
+
});
|
|
772
|
+
export var getFileConfiguredCdnLink = createThunk(function (file, thunkApi) {
|
|
773
|
+
if (!file || _typeof(file) !== 'object') {
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
var isCdnPermalinkEnabled = selectIsCdnPermalinkEnabled(thunkApi.getState());
|
|
777
|
+
var cdnPermalink = isCdnPermalinkEnabled && getFileLink(file, 'cdn_permalink');
|
|
778
|
+
return cdnPermalink || getFileLink(file);
|
|
779
|
+
});
|
|
780
|
+
export var copyFileCdnLink = createThunk(function (file, thunkApi) {
|
|
781
|
+
if (!file || _typeof(file) !== 'object') {
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
var _thunkApi$extra$filer5 = thunkApi.extra.filerobot.getPlugin(PLUGINS_IDS.EXPLORER),
|
|
785
|
+
info = _thunkApi$extra$filer5.info,
|
|
786
|
+
i18n = _thunkApi$extra$filer5.i18n;
|
|
787
|
+
var link = thunkApi.dispatch(getFileConfiguredCdnLink(file));
|
|
788
|
+
copyText({
|
|
789
|
+
text: link,
|
|
790
|
+
i18n: i18n,
|
|
791
|
+
info: info
|
|
792
|
+
});
|
|
793
|
+
return link;
|
|
794
|
+
});
|
|
795
|
+
var filesSlice = createSlice({
|
|
796
|
+
name: sliceName,
|
|
797
|
+
initialState: getInitialState(),
|
|
798
|
+
reducers: {
|
|
799
|
+
filesAdded: function filesAdded(state, action) {
|
|
800
|
+
var _action$payload = action.payload,
|
|
801
|
+
files = _action$payload.files,
|
|
802
|
+
newOffset = _action$payload.newOffset,
|
|
803
|
+
noMoreFiles = _action$payload.noMoreFiles,
|
|
804
|
+
stats = _action$payload.stats;
|
|
805
|
+
var _getNormalizedItems = getNormalizedItems(files, {
|
|
806
|
+
extraProps: {
|
|
807
|
+
loading: false,
|
|
808
|
+
error: null
|
|
809
|
+
}
|
|
810
|
+
}),
|
|
811
|
+
normalizedSlices = _getNormalizedItems.normalizedSlices;
|
|
812
|
+
var newFiles = _objectSpread(_objectSpread({}, state.entities), normalizedSlices);
|
|
813
|
+
var newUuids = Object.keys(newFiles);
|
|
814
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
815
|
+
entities: newFiles,
|
|
816
|
+
uuids: newUuids,
|
|
817
|
+
loading: false,
|
|
818
|
+
error: null,
|
|
819
|
+
offset: newOffset,
|
|
820
|
+
noMoreFiles: noMoreFiles
|
|
821
|
+
}, stats && {
|
|
822
|
+
stats: stats
|
|
823
|
+
});
|
|
824
|
+
},
|
|
825
|
+
fileAdded: function fileAdded(state, action) {
|
|
826
|
+
var _state$stats$filesCou;
|
|
827
|
+
var newUuids = state.uuids;
|
|
828
|
+
var addedFile = action.payload;
|
|
829
|
+
var newFiles = _objectSpread({}, state.entities);
|
|
830
|
+
// This case for handling the case when we upload a file that same considered as version for a current file, we recognize that through their names
|
|
831
|
+
var foundFile = Object.values(state.entities).find(function (file) {
|
|
832
|
+
return file.name === addedFile.name;
|
|
833
|
+
});
|
|
834
|
+
if (foundFile) {
|
|
835
|
+
delete newFiles[foundFile.uuid];
|
|
836
|
+
newUuids = newUuids.filter(function (uuid) {
|
|
837
|
+
return uuid !== foundFile.uuid;
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
newFiles[addedFile.uuid] = addedFile;
|
|
841
|
+
newUuids = [addedFile.uuid].concat(_toConsumableArray(newUuids));
|
|
842
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
843
|
+
stats: _objectSpread(_objectSpread({}, state.stats), {}, {
|
|
844
|
+
// if `foundFile` true then don't increase the files count, as the file is replacing the current one.
|
|
845
|
+
filesCount: ((_state$stats$filesCou = state.stats.filesCount) !== null && _state$stats$filesCou !== void 0 ? _state$stats$filesCou : 0) + (foundFile ? 0 : 1)
|
|
846
|
+
}),
|
|
847
|
+
entities: newFiles,
|
|
848
|
+
uuids: newUuids,
|
|
849
|
+
loading: false,
|
|
850
|
+
error: null
|
|
851
|
+
});
|
|
852
|
+
},
|
|
853
|
+
filesReplaced: function filesReplaced(state, action) {
|
|
854
|
+
var _action$payload2 = action.payload,
|
|
855
|
+
files = _action$payload2.files,
|
|
856
|
+
_action$payload2$newO = _action$payload2.newOffset,
|
|
857
|
+
newOffset = _action$payload2$newO === void 0 ? 0 : _action$payload2$newO,
|
|
858
|
+
noMoreFiles = _action$payload2.noMoreFiles,
|
|
859
|
+
_action$payload2$erro = _action$payload2.error,
|
|
860
|
+
error = _action$payload2$erro === void 0 ? null : _action$payload2$erro,
|
|
861
|
+
stats = _action$payload2.stats,
|
|
862
|
+
overrideLoading = _action$payload2.overrideLoading;
|
|
863
|
+
var newFiles = {};
|
|
864
|
+
var newFilesUuids = [];
|
|
865
|
+
if (Array.isArray(files)) {
|
|
866
|
+
var _getNormalizedItems2 = getNormalizedItems(files, {
|
|
867
|
+
extraProps: _objectSpread(_objectSpread({}, !overrideLoading && {
|
|
868
|
+
loading: false
|
|
869
|
+
}), {}, {
|
|
870
|
+
error: null
|
|
871
|
+
})
|
|
872
|
+
}),
|
|
873
|
+
normalizedSlices = _getNormalizedItems2.normalizedSlices,
|
|
874
|
+
uuids = _getNormalizedItems2.uuids;
|
|
875
|
+
newFiles = normalizedSlices;
|
|
876
|
+
newFilesUuids = uuids;
|
|
877
|
+
} else {
|
|
878
|
+
newFiles = _objectSpread({}, files);
|
|
879
|
+
newFilesUuids = Object.keys(newFiles);
|
|
880
|
+
}
|
|
881
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
882
|
+
entities: newFiles,
|
|
883
|
+
uuids: newFilesUuids,
|
|
884
|
+
loading: false,
|
|
885
|
+
error: error,
|
|
886
|
+
offset: newOffset,
|
|
887
|
+
noMoreFiles: noMoreFiles
|
|
888
|
+
}, stats && {
|
|
889
|
+
stats: stats
|
|
890
|
+
});
|
|
891
|
+
},
|
|
892
|
+
fileReplacedByNewer: function fileReplacedByNewer(state, action) {
|
|
893
|
+
var _action$payload3 = action.payload,
|
|
894
|
+
oldFileUuid = _action$payload3.oldFileUuid,
|
|
895
|
+
newFile = _action$payload3.newFile,
|
|
896
|
+
_action$payload3$erro = _action$payload3.error,
|
|
897
|
+
error = _action$payload3$erro === void 0 ? null : _action$payload3$erro;
|
|
898
|
+
var newFiles = _objectSpread({}, state.entities);
|
|
899
|
+
var newUuids = _toConsumableArray(state.uuids);
|
|
900
|
+
delete newFiles[oldFileUuid];
|
|
901
|
+
newFiles[newFile.uuid] = newFile;
|
|
902
|
+
var findOlderUuidIndex = newUuids.indexOf(oldFileUuid);
|
|
903
|
+
if (findOlderUuidIndex > -1) {
|
|
904
|
+
newUuids[findOlderUuidIndex] = newFile.uuid;
|
|
905
|
+
}
|
|
906
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
907
|
+
loading: false,
|
|
908
|
+
error: error,
|
|
909
|
+
entities: newFiles,
|
|
910
|
+
uuids: newUuids
|
|
911
|
+
});
|
|
912
|
+
},
|
|
913
|
+
filesRemoved: function filesRemoved(state) {
|
|
914
|
+
var _state$stats, _state$stats2;
|
|
915
|
+
var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
916
|
+
var removedFileUuids = action.payload;
|
|
917
|
+
if (!Array.isArray(removedFileUuids)) {
|
|
918
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
919
|
+
entities: {},
|
|
920
|
+
uuids: [],
|
|
921
|
+
loading: false,
|
|
922
|
+
error: null,
|
|
923
|
+
stats: _objectSpread(_objectSpread({}, state.stats), {}, {
|
|
924
|
+
filesCount: 0,
|
|
925
|
+
filesSize: 0
|
|
926
|
+
})
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
var currentFiles = _objectSpread({}, state.entities);
|
|
930
|
+
var newUuids = state.uuids;
|
|
931
|
+
var isFileRemoved = false;
|
|
932
|
+
var removedFilesSize = 0;
|
|
933
|
+
removedFileUuids.forEach(function (fileUuid) {
|
|
934
|
+
if (currentFiles[fileUuid]) {
|
|
935
|
+
var _currentFiles$fileUui;
|
|
936
|
+
removedFilesSize += ((_currentFiles$fileUui = currentFiles[fileUuid].size) === null || _currentFiles$fileUui === void 0 ? void 0 : _currentFiles$fileUui.bytes) || 0;
|
|
937
|
+
delete currentFiles[fileUuid];
|
|
938
|
+
newUuids = newUuids.filter(function (uuid) {
|
|
939
|
+
return fileUuid !== uuid;
|
|
940
|
+
});
|
|
941
|
+
isFileRemoved = true;
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
if (!isFileRemoved) {
|
|
945
|
+
return state;
|
|
946
|
+
}
|
|
947
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
948
|
+
entities: currentFiles,
|
|
949
|
+
uuids: newUuids,
|
|
950
|
+
stats: _objectSpread(_objectSpread({}, state.stats), {}, {
|
|
951
|
+
filesSize: Math.max(0, (((_state$stats = state.stats) === null || _state$stats === void 0 ? void 0 : _state$stats.filesSize) || 0) - removedFilesSize),
|
|
952
|
+
filesCount: Math.max(0, (((_state$stats2 = state.stats) === null || _state$stats2 === void 0 ? void 0 : _state$stats2.filesCount) || 0) - removedFileUuids.length)
|
|
953
|
+
})
|
|
954
|
+
});
|
|
955
|
+
},
|
|
956
|
+
filesUpdated: function filesUpdated(state, action) {
|
|
957
|
+
var files = action.payload;
|
|
958
|
+
var updatedFiles = _objectSpread({}, state.entities);
|
|
959
|
+
files.forEach(function (file) {
|
|
960
|
+
if (!updatedFiles[file.uuid]) {
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
updatedFiles[file.uuid] = _objectSpread(_objectSpread({}, state.entities[file.uuid]), {}, {
|
|
964
|
+
// Those will get overridden if their values are assigned inside the filesUpdated
|
|
965
|
+
loading: false,
|
|
966
|
+
error: null
|
|
967
|
+
}, file);
|
|
968
|
+
});
|
|
969
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
970
|
+
entities: updatedFiles
|
|
971
|
+
});
|
|
972
|
+
},
|
|
973
|
+
fileUpdated: function fileUpdated(state, action) {
|
|
974
|
+
var _ref26 = action.payload || {},
|
|
975
|
+
fileUuid = _ref26.uuid,
|
|
976
|
+
_ref26$addNotFound = _ref26.addNotFound,
|
|
977
|
+
addNotFound = _ref26$addNotFound === void 0 ? false : _ref26$addNotFound;
|
|
978
|
+
if (!fileUuid) {
|
|
979
|
+
return state;
|
|
980
|
+
}
|
|
981
|
+
var updatedFiles = _objectSpread({}, state.entities);
|
|
982
|
+
if (!updatedFiles[fileUuid] && !addNotFound) {
|
|
983
|
+
return state;
|
|
984
|
+
}
|
|
985
|
+
var _action$payload4 = action.payload,
|
|
986
|
+
_ = _action$payload4.addNotFound,
|
|
987
|
+
newFile = _objectWithoutProperties(_action$payload4, _excluded4);
|
|
988
|
+
updatedFiles[fileUuid] = _objectSpread(_objectSpread({}, updatedFiles[fileUuid]), newFile);
|
|
989
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
990
|
+
entities: updatedFiles
|
|
991
|
+
}, addNotFound && {
|
|
992
|
+
tmpFile: updatedFiles[fileUuid]
|
|
993
|
+
});
|
|
994
|
+
},
|
|
995
|
+
removingBackgroundUuidsUpdated: function removingBackgroundUuidsUpdated(state, action) {
|
|
996
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
997
|
+
removingBackgroundUuids: action.payload
|
|
998
|
+
});
|
|
999
|
+
},
|
|
1000
|
+
filesLoadingSet: function filesLoadingSet(state, action) {
|
|
1001
|
+
var isLoading = action.payload;
|
|
1002
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1003
|
+
loading: isLoading
|
|
1004
|
+
}, isLoading && {
|
|
1005
|
+
entities: {},
|
|
1006
|
+
uuids: [],
|
|
1007
|
+
stats: _objectSpread(_objectSpread({}, state.stats), {}, {
|
|
1008
|
+
filesCount: 0,
|
|
1009
|
+
filesSize: 0
|
|
1010
|
+
})
|
|
1011
|
+
});
|
|
1012
|
+
},
|
|
1013
|
+
filesSortingUpdated: function filesSortingUpdated(state, action) {
|
|
1014
|
+
var _action$payload5 = action.payload,
|
|
1015
|
+
_action$payload5$sort = _action$payload5.sortBy,
|
|
1016
|
+
sortBy = _action$payload5$sort === void 0 ? state.sortedBy : _action$payload5$sort,
|
|
1017
|
+
_action$payload5$orde = _action$payload5.order,
|
|
1018
|
+
order = _action$payload5$orde === void 0 ? state.sortOrder : _action$payload5$orde;
|
|
1019
|
+
var isTheSameSort = sortBy === state.sortedBy && order === state.sortOrder;
|
|
1020
|
+
if (isTheSameSort) {
|
|
1021
|
+
return state;
|
|
1022
|
+
}
|
|
1023
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1024
|
+
sortedBy: sortBy,
|
|
1025
|
+
sortOrder: order
|
|
1026
|
+
});
|
|
1027
|
+
},
|
|
1028
|
+
filesVariationsUpdated: function filesVariationsUpdated(state, action) {
|
|
1029
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1030
|
+
variations: action.payload
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
extraReducers: function extraReducers(builder) {
|
|
1035
|
+
builder.addCase(moveFiles.fulfilled, function (state, action) {
|
|
1036
|
+
return filesSlice.caseReducers.filesRemoved(state, action);
|
|
1037
|
+
}).addCase(deleteFiles.fulfilled, function (state, action) {
|
|
1038
|
+
return filesSlice.caseReducers.filesRemoved(state, action);
|
|
1039
|
+
}).addCase(fetchFilesStats.pending, function (state) {
|
|
1040
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1041
|
+
stats: _objectSpread(_objectSpread({}, state.stats), {}, {
|
|
1042
|
+
filesCount: 0,
|
|
1043
|
+
filesSize: 0,
|
|
1044
|
+
loading: true
|
|
1045
|
+
})
|
|
1046
|
+
});
|
|
1047
|
+
}).addCase(viewChanged.type, getInitialState).addCase(fileWindowUpdated.type, function (state, action) {
|
|
1048
|
+
return action.payload === null ? _objectSpread(_objectSpread({}, state), {}, {
|
|
1049
|
+
tmpFile: null
|
|
1050
|
+
}) : state;
|
|
1051
|
+
}).addMatcher(isAnyOf(fetchFiles.pending, searchFilesWithAiText.pending, searchSimilarFiles.pending), function (state) {
|
|
1052
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1053
|
+
uuids: [],
|
|
1054
|
+
entities: {},
|
|
1055
|
+
loading: true,
|
|
1056
|
+
error: null
|
|
1057
|
+
});
|
|
1058
|
+
}).addMatcher(isAnyOf(fetchFiles.fulfilled, searchFilesWithAiText.fulfilled, searchSimilarFiles.fulfilled), function (state, action) {
|
|
1059
|
+
return action.payload.replaceOldFiles ? filesSlice.caseReducers.filesReplaced(state, action) : filesSlice.caseReducers.filesAdded(state, action);
|
|
1060
|
+
}).addMatcher(isAnyOf(fetchFiles.rejected, searchFilesWithAiText.rejected, searchSimilarFiles.rejected), function (state, action) {
|
|
1061
|
+
return _objectSpread(_objectSpread({}, getActionErrorState(state, action)), {}, {
|
|
1062
|
+
uuids: [],
|
|
1063
|
+
entities: {}
|
|
1064
|
+
});
|
|
1065
|
+
}).addMatcher(isAnyOf(fetchFilesStats.fulfilled, fetchFilesStats.rejected), function (state, action) {
|
|
1066
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
1067
|
+
stats: _objectSpread(_objectSpread(_objectSpread({}, state.stats), action.payload), {}, {
|
|
1068
|
+
loading: false
|
|
1069
|
+
})
|
|
1070
|
+
});
|
|
1071
|
+
}).addMatcher(function (_ref27) {
|
|
1072
|
+
var type = _ref27.type;
|
|
1073
|
+
return type.startsWith(sliceName) && Boolean(type.match(/\/updateFile.*\/pending/));
|
|
1074
|
+
}, function (state, action) {
|
|
1075
|
+
var _action$meta$arg, _action$meta$arg2;
|
|
1076
|
+
return filesSlice.caseReducers.fileUpdated(state, {
|
|
1077
|
+
payload: {
|
|
1078
|
+
uuid: ((_action$meta$arg = action.meta.arg) === null || _action$meta$arg === void 0 ? void 0 : _action$meta$arg.uuid) || ((_action$meta$arg2 = action.meta.arg) === null || _action$meta$arg2 === void 0 ? void 0 : _action$meta$arg2.fileUuid) || action.meta.arg,
|
|
1079
|
+
loading: true,
|
|
1080
|
+
error: null
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
}).addMatcher(function (_ref28) {
|
|
1084
|
+
var type = _ref28.type;
|
|
1085
|
+
return type.startsWith(sliceName) && Boolean(type.match(/\/updateFile.*\/fulfilled/));
|
|
1086
|
+
}, function (state, action) {
|
|
1087
|
+
return filesSlice.caseReducers.fileUpdated(state, {
|
|
1088
|
+
payload: _objectSpread(_objectSpread({}, action.payload), {}, {
|
|
1089
|
+
loading: false,
|
|
1090
|
+
error: null
|
|
1091
|
+
})
|
|
1092
|
+
});
|
|
1093
|
+
}).addMatcher(function (_ref29) {
|
|
1094
|
+
var type = _ref29.type;
|
|
1095
|
+
return type.startsWith(sliceName) && Boolean(type.match(/\/updateFile.*\/rejected/));
|
|
1096
|
+
}, function (state, action) {
|
|
1097
|
+
var _action$meta$arg3, _action$meta$arg4;
|
|
1098
|
+
return filesSlice.caseReducers.fileUpdated(state, {
|
|
1099
|
+
payload: {
|
|
1100
|
+
uuid: ((_action$meta$arg3 = action.meta.arg) === null || _action$meta$arg3 === void 0 ? void 0 : _action$meta$arg3.uuid) || ((_action$meta$arg4 = action.meta.arg) === null || _action$meta$arg4 === void 0 ? void 0 : _action$meta$arg4.fileUuid) || action.meta.arg,
|
|
1101
|
+
loading: false,
|
|
1102
|
+
error: getActionErrorState(state, action, true)
|
|
1103
|
+
}
|
|
1104
|
+
});
|
|
1105
|
+
}).addMatcher(function (_ref30) {
|
|
1106
|
+
var type = _ref30.type;
|
|
1107
|
+
return type.startsWith(sliceName) && Boolean(type.match(/\/updateFiles.*\/pending/));
|
|
1108
|
+
}, function (state, action) {
|
|
1109
|
+
var _action$meta$arg5, _action$meta$arg6;
|
|
1110
|
+
return filesSlice.caseReducers.filesUpdated(state, {
|
|
1111
|
+
payload: (((_action$meta$arg5 = action.meta.arg) === null || _action$meta$arg5 === void 0 ? void 0 : _action$meta$arg5.filesUuids) || ((_action$meta$arg6 = action.meta.arg) === null || _action$meta$arg6 === void 0 ? void 0 : _action$meta$arg6.uuids) || action.meta.arg || []).map(function (uuid) {
|
|
1112
|
+
return {
|
|
1113
|
+
uuid: uuid,
|
|
1114
|
+
loading: true,
|
|
1115
|
+
error: null
|
|
1116
|
+
};
|
|
1117
|
+
})
|
|
1118
|
+
});
|
|
1119
|
+
}).addMatcher(function (_ref31) {
|
|
1120
|
+
var type = _ref31.type;
|
|
1121
|
+
return type.startsWith(sliceName) && Boolean(type.match(/\/updateFiles.*\/fulfilled/));
|
|
1122
|
+
}, function (state, action) {
|
|
1123
|
+
return action.payload.removeFiles ? filesSlice.caseReducers.filesRemoved(state, {
|
|
1124
|
+
payload: action.payload.filesUuids
|
|
1125
|
+
}) : filesSlice.caseReducers.filesUpdated(state, action);
|
|
1126
|
+
}).addMatcher(function (_ref32) {
|
|
1127
|
+
var type = _ref32.type;
|
|
1128
|
+
return type.startsWith(sliceName) && Boolean(type.match(/\/updateFiles.*\/rejected/));
|
|
1129
|
+
}, function (state, action) {
|
|
1130
|
+
var _action$meta$arg7, _action$meta$arg8;
|
|
1131
|
+
return filesSlice.caseReducers.filesUpdated(state, {
|
|
1132
|
+
payload: (((_action$meta$arg7 = action.meta.arg) === null || _action$meta$arg7 === void 0 ? void 0 : _action$meta$arg7.filesUuids) || ((_action$meta$arg8 = action.meta.arg) === null || _action$meta$arg8 === void 0 ? void 0 : _action$meta$arg8.uuids) || action.meta.arg || []).map(function (uuid) {
|
|
1133
|
+
return {
|
|
1134
|
+
uuid: uuid,
|
|
1135
|
+
loading: false,
|
|
1136
|
+
error: getActionErrorState(state, action, true)
|
|
1137
|
+
};
|
|
1138
|
+
})
|
|
1139
|
+
});
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
var _filesSlice$actions = filesSlice.actions,
|
|
1144
|
+
filesAdded = _filesSlice$actions.filesAdded,
|
|
1145
|
+
fileAdded = _filesSlice$actions.fileAdded,
|
|
1146
|
+
filesReplaced = _filesSlice$actions.filesReplaced,
|
|
1147
|
+
filesRemoved = _filesSlice$actions.filesRemoved,
|
|
1148
|
+
filesUpdated = _filesSlice$actions.filesUpdated,
|
|
1149
|
+
fileUpdated = _filesSlice$actions.fileUpdated,
|
|
1150
|
+
fileReplacedByNewer = _filesSlice$actions.fileReplacedByNewer,
|
|
1151
|
+
removingBackgroundUuidsUpdated = _filesSlice$actions.removingBackgroundUuidsUpdated,
|
|
1152
|
+
filesLoadingSet = _filesSlice$actions.filesLoadingSet,
|
|
1153
|
+
filesSortingUpdated = _filesSlice$actions.filesSortingUpdated,
|
|
1154
|
+
filesVariationsUpdated = _filesSlice$actions.filesVariationsUpdated;
|
|
1155
|
+
export { filesAdded, fileAdded, filesReplaced, filesRemoved, filesUpdated, fileUpdated, fileReplacedByNewer, removingBackgroundUuidsUpdated, filesLoadingSet, filesSortingUpdated, filesVariationsUpdated };
|
|
1156
|
+
export var selectFilesState = function selectFilesState(state) {
|
|
1157
|
+
var _state$PLUGINS_IDS$EX;
|
|
1158
|
+
return ((_state$PLUGINS_IDS$EX = state[PLUGINS_IDS.EXPLORER]) === null || _state$PLUGINS_IDS$EX === void 0 ? void 0 : _state$PLUGINS_IDS$EX[slicePropName]) || getInitialState();
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
// returns the files entities object that are relative to folder's/backend's files not searched nor being uploaded.
|
|
1162
|
+
export var selectFiles = function selectFiles(state) {
|
|
1163
|
+
return selectFilesState(state).entities;
|
|
1164
|
+
};
|
|
1165
|
+
export var selectFilesArray = createSelector(selectFiles, function (files) {
|
|
1166
|
+
return Object.values(files);
|
|
1167
|
+
});
|
|
1168
|
+
export var selectFilesUuids = function selectFilesUuids(state) {
|
|
1169
|
+
return selectFilesState(state).uuids;
|
|
1170
|
+
};
|
|
1171
|
+
export var selectFilesStats = function selectFilesStats(state) {
|
|
1172
|
+
return selectFilesState(state).stats;
|
|
1173
|
+
};
|
|
1174
|
+
export var selectFileByUuid = function selectFileByUuid(state, fileUuid) {
|
|
1175
|
+
return selectFiles(state)[fileUuid];
|
|
1176
|
+
};
|
|
1177
|
+
export var selectFilesByUuids = createSelector([selectFiles, function (_state, fileUuids) {
|
|
1178
|
+
return fileUuids;
|
|
1179
|
+
}], function (files, fileUuids) {
|
|
1180
|
+
return fileUuids.map(function (fileUuid) {
|
|
1181
|
+
return files[fileUuid];
|
|
1182
|
+
});
|
|
1183
|
+
});
|
|
1184
|
+
export var selectIsFilesLoading = function selectIsFilesLoading(state) {
|
|
1185
|
+
return selectFilesState(state).loading;
|
|
1186
|
+
};
|
|
1187
|
+
export var selectFilesOffset = function selectFilesOffset(state) {
|
|
1188
|
+
return selectFilesState(state).offset;
|
|
1189
|
+
};
|
|
1190
|
+
export var selectIsNoMoreFiles = function selectIsNoMoreFiles(state) {
|
|
1191
|
+
return selectFilesState(state).noMoreFiles;
|
|
1192
|
+
};
|
|
1193
|
+
export var selectCurrentFiles = function selectCurrentFiles(state) {
|
|
1194
|
+
var isUploadsPanelShown = selectIsUploadsPanelOpened(state);
|
|
1195
|
+
if (isUploadsPanelShown) {
|
|
1196
|
+
return selectUploads(state);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// If search view (exact & extended) files, if filters only applied then deal with it as files normally.
|
|
1200
|
+
if (selectIsSearchMode(state)) {
|
|
1201
|
+
return selectAllSearchFiles(state);
|
|
1202
|
+
}
|
|
1203
|
+
return selectFiles(state);
|
|
1204
|
+
};
|
|
1205
|
+
export var selectCurrentFilesUuids = function selectCurrentFilesUuids(state) {
|
|
1206
|
+
// If search view (exact & extended) files, if filters only applied then deal with it as files normally.
|
|
1207
|
+
if (selectIsSearchMode(state) && !selectIsAiSearch(state)) {
|
|
1208
|
+
return selectAllSearchFilesUuids(state);
|
|
1209
|
+
}
|
|
1210
|
+
return selectFilesUuids(state);
|
|
1211
|
+
};
|
|
1212
|
+
export var selectIsCurrentFilesLoading = function selectIsCurrentFilesLoading(state) {
|
|
1213
|
+
// If search view (exact & extended) files, if filters only applied then deal with it as files normally.
|
|
1214
|
+
if (selectIsSearchMode(state) && !selectIsAiSearch(state)) {
|
|
1215
|
+
return selectIsQuickFetching(state) && selectIsQuickFetching(state);
|
|
1216
|
+
}
|
|
1217
|
+
return selectIsFilesLoading(state);
|
|
1218
|
+
};
|
|
1219
|
+
export var selectCurrentFilesIdsOrUuids = function selectCurrentFilesIdsOrUuids(state) {
|
|
1220
|
+
var isUploadsPanelShown = selectIsUploadsPanelOpened(state);
|
|
1221
|
+
if (isUploadsPanelShown) {
|
|
1222
|
+
return selectUploadsIds(state);
|
|
1223
|
+
}
|
|
1224
|
+
return selectCurrentFilesUuids(state);
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
// Once files uploaded in contextual menu we need to get file data from server
|
|
1228
|
+
var getAlreadyUploadedFilesFromCurrentUploads = function getAlreadyUploadedFilesFromCurrentUploads(currentUploads) {
|
|
1229
|
+
return Object.values(currentUploads).reduce(function (acc, currentFileInUpload) {
|
|
1230
|
+
if (currentFileInUpload.response) {
|
|
1231
|
+
var file = currentFileInUpload.response.body.file;
|
|
1232
|
+
if (file !== null && file !== void 0 && file.uuid) {
|
|
1233
|
+
acc[file.uuid] = file;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
return acc;
|
|
1237
|
+
}, {});
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
// Selectors for the file window/bulk edit modal...etc, as they are possible to be opened through upload panel or items' browser.
|
|
1241
|
+
// priority goes for uploads so if we found the passed files in uploads then use them instead of current files.
|
|
1242
|
+
export var selectCurrentFilesByIdsOrUuids = createSelector([function (state) {
|
|
1243
|
+
return selectIsSearchOrFiltersMode(state);
|
|
1244
|
+
},
|
|
1245
|
+
// called like that to avoid initialization issue
|
|
1246
|
+
function (state) {
|
|
1247
|
+
return selectAllSearchFiles(state);
|
|
1248
|
+
}, selectFiles, selectUploads, function (_state, filesIdsOrUuids) {
|
|
1249
|
+
return filesIdsOrUuids;
|
|
1250
|
+
}], function (isSearchView, searchedFiles, files, uploads, filesIdsOrUuids) {
|
|
1251
|
+
return (filesIdsOrUuids || []).map(function (idOrUuid) {
|
|
1252
|
+
return isSearchView && searchedFiles[idOrUuid] || files[idOrUuid] || uploads[idOrUuid];
|
|
1253
|
+
}).filter(Boolean);
|
|
1254
|
+
});
|
|
1255
|
+
export var selectCurrentFileByIdOrUuid = function selectCurrentFileByIdOrUuid(state, fileIdOrUuid) {
|
|
1256
|
+
// In case it's not a string then we expect it to be file object.
|
|
1257
|
+
if (typeof fileIdOrUuid !== 'string') return fileIdOrUuid;
|
|
1258
|
+
|
|
1259
|
+
// If in searchView find the file using fileIdOrUuid in the searched files
|
|
1260
|
+
if (selectIsSearchOrFiltersMode(state)) {
|
|
1261
|
+
var searchedFile = selectAllSearchFiles(state)[fileIdOrUuid];
|
|
1262
|
+
// Return file if found in the searched files
|
|
1263
|
+
if (searchedFile) return searchedFile;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
// Find the file using fileIdOrUuid in the uploaded files
|
|
1267
|
+
var files = selectFiles(state);
|
|
1268
|
+
var selectedFile = files[fileIdOrUuid];
|
|
1269
|
+
|
|
1270
|
+
// Return file if found in the already uploaded files
|
|
1271
|
+
if (selectedFile) return selectedFile;
|
|
1272
|
+
|
|
1273
|
+
// Find the file using fileIdOrUuid in the staging uploads
|
|
1274
|
+
var uploads = selectUploads(state);
|
|
1275
|
+
return uploads[fileIdOrUuid] || getAlreadyUploadedFilesFromCurrentUploads(uploads)[fileIdOrUuid] || selectCurrentTmpFile(state, fileIdOrUuid);
|
|
1276
|
+
};
|
|
1277
|
+
export var selectCurrentTmpFile = function selectCurrentTmpFile(state, fileUuid) {
|
|
1278
|
+
var file = selectFilesState(state).tmpFile;
|
|
1279
|
+
return !fileUuid || (file === null || file === void 0 ? void 0 : file.uuid) === fileUuid ? file : undefined;
|
|
1280
|
+
};
|
|
1281
|
+
export var selectCurrentFileByUuid = function selectCurrentFileByUuid(state, fileUuid) {
|
|
1282
|
+
return selectExactSearchFileByUuid(state, fileUuid) || selectExtendedSearchFileByUuid(state, fileUuid) || selectFileByUuid(state, fileUuid) || selectCurrentTmpFile(state, fileUuid);
|
|
1283
|
+
};
|
|
1284
|
+
export var selectCurrentFilesArray = createSelector(selectCurrentFiles, function () {
|
|
1285
|
+
var files = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1286
|
+
return Object.values(files);
|
|
1287
|
+
});
|
|
1288
|
+
export var selectFilesSortedBy = function selectFilesSortedBy(state) {
|
|
1289
|
+
return selectFilesState(state).sortedBy;
|
|
1290
|
+
};
|
|
1291
|
+
export var selectFilesSortOrder = function selectFilesSortOrder(state) {
|
|
1292
|
+
return selectFilesState(state).sortOrder;
|
|
1293
|
+
};
|
|
1294
|
+
export var selectFilesError = function selectFilesError(state) {
|
|
1295
|
+
return selectFilesState(state).error;
|
|
1296
|
+
};
|
|
1297
|
+
export var selectIsNoFilesFound = function selectIsNoFilesFound(state) {
|
|
1298
|
+
var _selectCurrentFilesUu;
|
|
1299
|
+
return ((_selectCurrentFilesUu = selectCurrentFilesUuids(state)) === null || _selectCurrentFilesUu === void 0 ? void 0 : _selectCurrentFilesUu.length) === 0;
|
|
1300
|
+
};
|
|
1301
|
+
export var selectFilesVariations = function selectFilesVariations(state) {
|
|
1302
|
+
return selectFilesState(state).variations;
|
|
1303
|
+
};
|
|
1304
|
+
export var selectIsSearchOrFilesLoading = function selectIsSearchOrFilesLoading(state) {
|
|
1305
|
+
return selectIsSearchMode(state) && !selectIsAiSearch(state) ? selectIsQuickFetching(state) || selectIsExtendFetching(state) : selectIsFilesLoading(state);
|
|
1306
|
+
};
|
|
1307
|
+
export default filesSlice.reducer;
|