@bindu-dashing/dam-solution-v2 5.8.111 → 5.8.113

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.
@@ -170,6 +170,6 @@ const AddDrive = ({ parentFolderId }) => {
170
170
  },
171
171
  ];
172
172
  const toggleGenerateThumbnails = () => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showGenerateThumbnails: !prevState.showGenerateThumbnails })));
173
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "md-lib-flex md-lib-gap-3", children: [_jsx(CustomButton, { label: "Generate Thumbnails", icon: _jsx(RiGalleryLineIcon, {}), size: "large", onClick: toggleGenerateThumbnails }), _jsx(Dropdown, { menu: { items }, trigger: ["click"], placement: "bottomRight", children: _jsxs(Button, { icon: _jsx(GoPlusIcon, { size: 16 }), type: "primary", size: "large", children: ["Add ", _jsx(MdKeyboardArrowDownIconIcon, {})] }) })] }), _jsx("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleNativeFileUpload }), openFolderModal && (_jsx(AddFolder, { open: openFolderModal, handleCancel: toggleFolderModal, parentFolderId: currentFolderId })), openMapFile && (_jsx(MapFile, { open: openMapFile, handleCancel: handleMapFileCancel, filesList: filesList, fromUpload: true, parentFolderId: currentFolderId })), showUploadStatus && (_jsx(UploadStatusModal, { open: showUploadStatus, statusList: uploadStatusList, onClose: () => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showUploadStatus: false }))) })), openBlukUploadModal && (_jsx(BulkUploadModal, { toggleUpload: toggleFolderBulkModal, folderId: currentFolderId })), showGenerateThumbnails && (_jsx(BulkUploadModal, { toggleUpload: toggleGenerateThumbnails, thumbnailsOnly: true, folderId: currentFolderId }))] }));
173
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "md-lib-flex md-lib-gap-3", children: [_jsx(CustomButton, { label: "Generate Thumbnails", icon: _jsx(RiGalleryLineIcon, {}), size: "large", onClick: toggleGenerateThumbnails }), _jsx(Dropdown, { menu: { items }, trigger: ["click"], placement: "bottomRight", children: _jsxs(Button, { icon: _jsx(GoPlusIcon, { size: 16 }), type: "primary", size: "large", children: ["Add ", _jsx(MdKeyboardArrowDownIconIcon, {})] }) })] }), _jsx("input", { ref: fileInputRef, type: "file", multiple: true, style: { display: 'none' }, onChange: handleNativeFileUpload }), openFolderModal && (_jsx(AddFolder, { open: openFolderModal, handleCancel: toggleFolderModal, parentFolderId: currentFolderId })), openMapFile && (_jsx(MapFile, { open: openMapFile, handleCancel: handleMapFileCancel, filesList: filesList, fromUpload: true, parentFolderId: currentFolderId })), showUploadStatus && (_jsx(UploadStatusModal, { open: showUploadStatus, statusList: uploadStatusList, onClose: () => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showUploadStatus: false }))) })), openBlukUploadModal && (_jsx(BulkUploadModal, { toggleUpload: toggleFolderBulkModal, folderId: currentFolderId })), showGenerateThumbnails && (_jsx(BulkUploadModal, { toggleUpload: toggleGenerateThumbnails, thumbnailsOnly: true, folderId: currentFolderId }))] }));
174
174
  };
175
175
  export default AddDrive;
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
11
  import { Dropdown } from "antd";
3
12
  import { BsThreeDotsVertical } from "react-icons/bs";
@@ -178,17 +187,27 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
178
187
  };
179
188
  const duplicateFileMutation = useMutation({
180
189
  mutationFn: duplicateFiles,
181
- onSuccess: (response) => {
182
- invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : rootFolderId);
190
+ onSuccess: (response) => __awaiter(this, void 0, void 0, function* () {
191
+ const foldersQueryKey = generateFoldersQueryKey(type);
192
+ const currentFolderId = folderId ? folderId : rootFolderId;
193
+ invalidateData(queryClient, foldersQueryKey, currentFolderId);
194
+ yield queryClient.refetchQueries({
195
+ queryKey: [foldersQueryKey, currentFolderId],
196
+ });
183
197
  showNotification(get(response, "data.message", CREATE_SUCCESS), NotificationStatus.SUCCESS);
184
- },
198
+ }),
185
199
  onError: (error) => {
186
200
  onFailure(get(error, "message", SOMETHING_WENT_WRONG));
187
201
  },
188
202
  });
189
203
  const onDuplicateFile = () => {
204
+ const fileToUse = effectiveFile;
205
+ if (!fileToUse || !get(fileToUse, "_id")) {
206
+ onFailure("File not found");
207
+ return;
208
+ }
190
209
  duplicateFileMutation.mutate({
191
- fileIds: [get(file, "_id")],
210
+ fileIds: [get(fileToUse, "_id")],
192
211
  api,
193
212
  });
194
213
  };
@@ -302,17 +321,13 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
302
321
  onClick: () => toggleDisplayUpdateName(),
303
322
  disabled: isMultiSelection || !isAdmin,
304
323
  },
305
- // {
306
- // key: FileActionsList.DUPLICATE,
307
- // label: "Duplicate",
308
- // icon: duplicateFileMutation.isLoading ? (
309
- // <CustomLoader />
310
- // ) : (
311
- // <IoDuplicateOutlineIcon />
312
- // ),
313
- // onClick: () => onDuplicateFile(),
314
- // disabled: isMultiSelection || !isAdmin,
315
- // },
324
+ {
325
+ key: FileActionsList.DUPLICATE,
326
+ label: "Duplicate",
327
+ icon: duplicateFileMutation.isLoading ? (_jsx(CustomLoader, {})) : (_jsx(IoDuplicateOutlineIcon, {})),
328
+ onClick: () => onDuplicateFile(),
329
+ disabled: isMultiSelection || !isAdmin,
330
+ },
316
331
  {
317
332
  key: FileActionsList.DELETE,
318
333
  label: "Delete",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.8.111",
3
+ "version": "5.8.113",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",