@bindu-dashing/dam-solution-v2 5.8.63 → 5.8.64

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.
@@ -46,7 +46,6 @@ const AddDrive = ({ parentFolderId }) => {
46
46
  const { folderId } = useAppParams();
47
47
  // Use parentFolderId (current folder from selection) > folderId (from URL) > rootFolderId
48
48
  const currentFolderId = parentFolderId || folderId || rootFolderId;
49
- console.log('## currentFolderId', currentFolderId, 'parentFolderId', parentFolderId, 'folderId', folderId, 'rootFolderId', rootFolderId);
50
49
  const fileInputRef = useRef(null);
51
50
  const api = useMemo(() => createApiClient(damConfig), [damConfig]);
52
51
  const [state, setState] = useState({
@@ -168,6 +167,6 @@ const AddDrive = ({ parentFolderId }) => {
168
167
  },
169
168
  ];
170
169
  const toggleGenerateThumbnails = () => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showGenerateThumbnails: !prevState.showGenerateThumbnails })));
171
- 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: toggleOpenMapFile, filesList: filesList, fromUpload: true })), 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 }))] }));
170
+ 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: toggleOpenMapFile, 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 }))] }));
172
171
  };
173
172
  export default AddDrive;
@@ -1,8 +1,9 @@
1
1
  import { FileEntity, ResponseFile } from "../../utilities/constants/interface";
2
- declare function MapFile({ open, handleCancel, filesList, fromUpload, }: {
2
+ declare function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, }: {
3
3
  open?: boolean;
4
4
  handleCancel?: () => void;
5
5
  filesList: ResponseFile[] | FileEntity[];
6
6
  fromUpload?: boolean;
7
+ parentFolderId?: string;
7
8
  }): JSX.Element;
8
9
  export default MapFile;
@@ -27,12 +27,14 @@ import { DATE_FORMAT, DATE_WITH_TIME_FORMAT } from "../../hocs/appConstants";
27
27
  import dayjs from "dayjs";
28
28
  import useAppNavigate from "../../utilities/useAppNavigate";
29
29
  import { addQueryParams } from "../../hocs/helpers";
30
- function MapFile({ open, handleCancel, filesList, fromUpload, }) {
30
+ function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, }) {
31
31
  const { folderId, type } = useAppParams();
32
32
  const damConfig = useDamConfig();
33
33
  const externalTeams = (damConfig === null || damConfig === void 0 ? void 0 : damConfig.teams) || [];
34
34
  const { rootFolderId, brand } = damConfig;
35
35
  const brandId = get(brand, "_id");
36
+ // Use parentFolderId (current folder from selection) > folderId (from URL) > rootFolderId
37
+ const currentFolderId = parentFolderId || folderId || rootFolderId;
36
38
  const queryClient = useQueryClient();
37
39
  const [form] = Form.useForm();
38
40
  const api = useMemo(() => createApiClient(damConfig), [damConfig]);
@@ -92,7 +94,7 @@ function MapFile({ open, handleCancel, filesList, fromUpload, }) {
92
94
  mutationFn: updateFile,
93
95
  onSuccess: (response) => {
94
96
  invalidateData(queryClient, QueryKeys.FILE, get(file, "_id"));
95
- invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : rootFolderId);
97
+ invalidateData(queryClient, generateFoldersQueryKey(type), currentFolderId);
96
98
  setState((prevState) => (Object.assign(Object.assign({}, prevState), { editTemplate: false, editForm: false })));
97
99
  showNotification(get(response, "data.message", UPDATE_SUCCESS), NotificationStatus.SUCCESS);
98
100
  },
@@ -115,7 +117,7 @@ function MapFile({ open, handleCancel, filesList, fromUpload, }) {
115
117
  const formattedValues = getFormattedMetadata(values);
116
118
  const expiryDate = values.expiryDate || null;
117
119
  delete values.expiryDate;
118
- const response = yield api.post(CREATE_FILE_URL, Object.assign(Object.assign({}, values), { folderId: folderId || rootFolderId, files: map(filesList, (file) => {
120
+ const response = yield api.post(CREATE_FILE_URL, Object.assign(Object.assign({}, values), { folderId: currentFolderId, files: map(filesList, (file) => {
119
121
  const fileData = {
120
122
  name: get(file, "name"),
121
123
  path: get(file, "filePath"),
@@ -136,8 +138,8 @@ function MapFile({ open, handleCancel, filesList, fromUpload, }) {
136
138
  showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
137
139
  }
138
140
  finally {
139
- invalidateData(queryClient, QueryKeys.FILE, folderId || rootFolderId);
140
- invalidateData(queryClient, QueryKeys.FOLDERS, folderId || rootFolderId);
141
+ invalidateData(queryClient, QueryKeys.FILE, currentFolderId);
142
+ invalidateData(queryClient, QueryKeys.FOLDERS, currentFolderId);
141
143
  setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false })));
142
144
  }
143
145
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.8.63",
3
+ "version": "5.8.64",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",