@bindu-dashing/dam-solution-v2 5.8.89 → 5.8.91
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.
|
@@ -11,7 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
import { Modal } from "antd";
|
|
12
12
|
import { get } from "lodash";
|
|
13
13
|
import DriveContainer from "../MyDrive/DriveContainer";
|
|
14
|
-
import { useMemo, useState } from "react";
|
|
14
|
+
import { useEffect, useMemo, useState } from "react";
|
|
15
15
|
import CustomButton from "../common/Button";
|
|
16
16
|
import TestImageFromMetalData from "./TestImgFromMetaData";
|
|
17
17
|
import { getFormattedValue } from "../hocs/helpers";
|
|
@@ -20,14 +20,25 @@ import { useDamConfig } from "../hocs/DamConfigContext";
|
|
|
20
20
|
import { FETCH_ASSET_URL, FETCH_SHARED_FILE_URL, } from "../utilities/constants/apiUrls";
|
|
21
21
|
import { FoldersProvider } from "../utilities/FoldersContext";
|
|
22
22
|
function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile, }) {
|
|
23
|
+
const damConfig = useDamConfig();
|
|
24
|
+
const { rootFolderId } = damConfig;
|
|
25
|
+
const pickerFolderId = get(imagePicker, "folderId");
|
|
26
|
+
console.log('## TestImagePickerModal - imagePicker:', imagePicker);
|
|
27
|
+
console.log('## TestImagePickerModal - pickerFolderId:', pickerFolderId, 'rootFolderId:', rootFolderId);
|
|
23
28
|
const [state, setState] = useState({
|
|
24
|
-
parentFolderId:
|
|
29
|
+
parentFolderId: pickerFolderId || rootFolderId || '',
|
|
25
30
|
fileForConfirmation: {},
|
|
26
31
|
});
|
|
27
32
|
const [folders, setFolders] = useState([]);
|
|
28
33
|
const [globalSearch, setGlobalSearch] = useState("");
|
|
29
|
-
const damConfig = useDamConfig();
|
|
30
34
|
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
35
|
+
// Update parentFolderId when imagePicker or rootFolderId changes
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const newFolderId = pickerFolderId || rootFolderId || '';
|
|
38
|
+
if (newFolderId && newFolderId !== state.parentFolderId) {
|
|
39
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { parentFolderId: newFolderId })));
|
|
40
|
+
}
|
|
41
|
+
}, [pickerFolderId, rootFolderId]);
|
|
31
42
|
const { parentFolderId, fileForConfirmation } = state;
|
|
32
43
|
const onSelectFile = () => __awaiter(this, void 0, void 0, function* () {
|
|
33
44
|
// console.log(fileForConfirmation);
|
|
@@ -39,6 +39,8 @@ function ImagePicker({ id, onSelect, url, }) {
|
|
|
39
39
|
try {
|
|
40
40
|
setLoading(true);
|
|
41
41
|
const response = yield api.get(FETCH_IMAGEPICKER_URL.replace(":id", id));
|
|
42
|
+
console.log("## ImagePicker config response:", response);
|
|
43
|
+
console.log("## ImagePicker includeSubFolders:", get(response, "data.includeSubFolders"));
|
|
42
44
|
setPicker(get(response, "data", {}));
|
|
43
45
|
setLoading(false);
|
|
44
46
|
}
|
|
@@ -73,7 +73,9 @@ function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pi
|
|
|
73
73
|
return params;
|
|
74
74
|
};
|
|
75
75
|
console.log('## folderId', parentFolderId);
|
|
76
|
-
|
|
76
|
+
console.log('## imagePicker config:', imagePicker);
|
|
77
|
+
console.log('## imagePicker.includeSubFolders:', get(imagePicker, "includeSubFolders"));
|
|
78
|
+
const folderParams = merge({}, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ page: DEFAULT_PAGE }, (type ? { category: type } : {})), (!!imagePicker
|
|
77
79
|
? {
|
|
78
80
|
includeSubFolders: get(imagePicker, "includeSubFolders", true),
|
|
79
81
|
teamVisibility: get(imagePicker, "teamVisibility", true),
|
|
@@ -82,15 +84,12 @@ function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pi
|
|
|
82
84
|
? { metadataKey: metadataKey, metadataValue: metadataValue }
|
|
83
85
|
: {})), (!!folderSearch ? { name: folderSearch } : {})), (!!globalSearch && ((parentFolderId || folderId || id) === rootFolderId || !(parentFolderId || folderId || id))
|
|
84
86
|
? { globalSearch }
|
|
85
|
-
: {})), { sortBy: sortBy, sortOrder: sortOrder }), Object.assign(Object.assign({}, getDateRangeFromKey(selectedDateKey)), (!!selectedType ? { type: selectedType } : {})))
|
|
86
|
-
//
|
|
87
|
-
parentFolderId
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
: id
|
|
92
|
-
? id
|
|
93
|
-
: rootFolderId);
|
|
87
|
+
: {})), { sortBy: sortBy, sortOrder: sortOrder }), Object.assign(Object.assign({}, getDateRangeFromKey(selectedDateKey)), (!!selectedType ? { type: selectedType } : {})));
|
|
88
|
+
// Compute the effective folderId with proper fallback
|
|
89
|
+
const effectiveFolderId = parentFolderId || folderId || id || rootFolderId || '';
|
|
90
|
+
console.log('## folderParams being sent to useFolders:', folderParams);
|
|
91
|
+
console.log('## effectiveFolderId:', effectiveFolderId, 'parentFolderId:', parentFolderId, 'folderId:', folderId, 'id:', id, 'rootFolderId:', rootFolderId);
|
|
92
|
+
const { data: foldersPaginatedData, isLoading, hasNextPage, fetchNextPage, refetch, isFetching, error, } = useFolders(api, generateFoldersQueryKey(type), folderParams, effectiveFolderId);
|
|
94
93
|
useEffect(() => {
|
|
95
94
|
if (typeof window !== "undefined") {
|
|
96
95
|
const isMobile = window.innerWidth < 768;
|