@bindu-dashing/dam-solution-v2 5.8.102 → 5.8.104

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.
@@ -195,7 +195,7 @@ export default function EditAssetTemplate({ assetTemplate, inputTypes, }) {
195
195
  onChange: (val) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { name: val }))),
196
196
  icon: _jsx(FiEdit2Icon, { size: 15, className: "md-lib-ml-2" }),
197
197
  }, children: name })] })),
198
- right: (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-ml-auto", children: [imagePickerOutputFormatError && (_jsx("p", { className: "md-lib-text-sm md-lib-text-red-500", children: "Please fix the errors in the Image Picker Output format" })), _jsx(CustomButton, { label: "Cancel", onClick: () => {
198
+ right: (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-ml-auto", children: [imagePickerOutputFormatError && (_jsx("p", { className: "md-lib-text-sm md-lib-text-red-500", children: "Please ensure that all required fields (except the last one) have separators configured" })), _jsx(CustomButton, { label: "Cancel", onClick: () => {
199
199
  if (navigate) {
200
200
  navigate(ASSETS_SCREEN);
201
201
  }
@@ -6,7 +6,7 @@ import { IoArchiveOutline, IoLinkOutline } from "react-icons/io5";
6
6
  import { concat, find, first, get, join, map } from "lodash";
7
7
  import MoveToAnotherFolder from "./files/MoveToAnotherFolder";
8
8
  import { useMutation, useQueryClient } from "react-query";
9
- import { deleteFiles, downloadFiles, restoreFiles, } from "../react-query/services/file-services";
9
+ import { deleteFiles, downloadFiles, restoreFiles, useFile, } from "../react-query/services/file-services";
10
10
  import { DeleteConfirmationModal } from "../common/CustomElements";
11
11
  import { DeleteOutlined, RedoOutlined } from "@ant-design/icons";
12
12
  import { generateFoldersQueryKey, invalidateData, } from "../utilities/constants/queryKeys";
@@ -45,7 +45,6 @@ const ActionsBar = ({ fileIds, folderIds, onCloseSelection, selectedFilesData =
45
45
  setState((prevState) => (Object.assign(Object.assign({}, prevState), { showShareModal: !prevState.showShareModal })));
46
46
  };
47
47
  const folders = getFolderData(queryClient, folderId ? folderId : rootFolderId, generateFoldersQueryKey(type));
48
- // Use selectedFilesData if provided, otherwise fall back to cache lookup
49
48
  const selectedFolder = useMemo(() => {
50
49
  if (get(folderIds, "length") === 1) {
51
50
  // First try from selectedFilesData
@@ -72,6 +71,20 @@ const ActionsBar = ({ fileIds, folderIds, onCloseSelection, selectedFilesData =
72
71
  return null;
73
72
  }
74
73
  }, [fileIds, folders, selectedFilesData]);
74
+ // Fetch file data from API if selectedFile is null but we have a single fileId
75
+ const singleFileId = useMemo(() => {
76
+ if (selectedFile)
77
+ return ""; // Already have file data
78
+ if (get(fileIds, "length") === 1) {
79
+ return first(fileIds) || "";
80
+ }
81
+ return "";
82
+ }, [selectedFile, fileIds, folderIds]);
83
+ const { data: fetchedFileData } = useFile(api, singleFileId);
84
+ // Use fetched file data if selectedFile is null
85
+ const effectiveFile = useMemo(() => {
86
+ return selectedFile || fetchedFileData || null;
87
+ }, [selectedFile, fetchedFileData]);
75
88
  const toggleConfirmPopup = (actionType = "") => {
76
89
  setState((prevState) => (Object.assign(Object.assign({}, prevState), { actionType, showConfirmModal: !prevState.showConfirmModal })));
77
90
  };
@@ -137,6 +150,7 @@ const ActionsBar = ({ fileIds, folderIds, onCloseSelection, selectedFilesData =
137
150
  },
138
151
  });
139
152
  const onDownloadFiles = () => {
153
+ // Always use API endpoint to ensure download history is tracked
140
154
  downloadFileMutation.mutate({
141
155
  fileIds,
142
156
  folderIds,
@@ -212,21 +212,12 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
212
212
  const fileToUse = effectiveFile;
213
213
  // Build fileIds list - use file._id if file exists, otherwise use fileIds prop
214
214
  const fileIdsList = fileToUse && get(fileToUse, "_id") ? [get(fileToUse, "_id")] : fileIds;
215
- const downloadUrl = get(fileToUse, "downloadUrl") || get(fileToUse, "s3Url") || get(fileToUse, "thumbnailUrl");
216
- const isSingleFile = get(fileIdsList, "length", 0) === 1 && get(folderIds, "length", 0) === 0;
217
- console.log("## onDownloadFile - effectiveFile:", fileToUse, "downloadUrl:", downloadUrl, "isSingleFile:", isSingleFile);
218
- // If single file with downloadUrl available, open directly in new tab
219
- if (isSingleFile && downloadUrl) {
220
- window.open(downloadUrl, "_blank");
221
- }
222
- else {
223
- // For multiple files/folders or when downloadUrl is not available, use API
224
- downloadFileMutation.mutate({
225
- fileIds: fileIdsList,
226
- folderIds: folderIds,
227
- api,
228
- });
229
- }
215
+ // Always use API endpoint to ensure download history is tracked
216
+ downloadFileMutation.mutate({
217
+ fileIds: fileIdsList,
218
+ folderIds: folderIds,
219
+ api,
220
+ });
230
221
  };
231
222
  const onFavSuccess = (message) => {
232
223
  invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : rootFolderId);
@@ -102,7 +102,6 @@ const FileDetails = ({ open, handleClose, file, files, fileIds, onCloseSelection
102
102
  }, [open]);
103
103
  if (!open && !visible)
104
104
  return null;
105
- console.log("currentFile", currentFile);
106
105
  const modalContent = (_jsxs("div", { className: `md-lib-fixed md-lib-inset-0 md-lib-z-[1000] md-lib-w-screen md-lib-h-screen md-lib-bg-white dark:md-lib-bg-darkPrimary md-lib-text-black dark:md-lib-text-white md-lib-overflow-auto md-lib-transform md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out ${open && visible
107
106
  ? "md-lib-opacity-100 md-lib-translate-y-0"
108
107
  : "md-lib-opacity-0 md-lib-translate-y-4"}`, onTransitionEnd: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.8.102",
3
+ "version": "5.8.104",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",