@bindu-dashing/dam-solution-v2 5.8.104 → 5.8.106
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.
|
@@ -53,9 +53,48 @@ function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile,
|
|
|
53
53
|
return Object.assign(Object.assign({}, field), { fieldId: get(metaField, "_id") });
|
|
54
54
|
});
|
|
55
55
|
// console.log(formattedOutputFormat);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
// Get the actual file s3Url from fileData (from API response) or fileForConfirmation
|
|
57
|
+
const actualFileS3Url = get(fileData, "s3Url") || (fileForConfirmation === null || fileForConfirmation === void 0 ? void 0 : fileForConfirmation.s3Url);
|
|
58
|
+
const formattedValue = getFormattedValue(formattedOutputFormat, actualFileS3Url, get(fileData, "metadata", {}));
|
|
59
|
+
console.log('DAM ImagePicker - Formatted value:', formattedValue);
|
|
60
|
+
console.log('DAM ImagePicker - File s3Url from API (fileData.s3Url):', get(fileData, "s3Url"));
|
|
61
|
+
console.log('DAM ImagePicker - File s3Url from fileForConfirmation:', fileForConfirmation === null || fileForConfirmation === void 0 ? void 0 : fileForConfirmation.s3Url);
|
|
62
|
+
console.log('DAM ImagePicker - Actual file s3Url being used:', actualFileS3Url);
|
|
63
|
+
console.log('DAM ImagePicker - File data:', fileData);
|
|
64
|
+
console.log('DAM ImagePicker - File for confirmation:', fileForConfirmation);
|
|
65
|
+
// FIX: Ensure we always use the actual file s3Url, not thumbnail URL
|
|
66
|
+
// The preview API needs the actual file URL, not thumbnail URL
|
|
67
|
+
let finalValue = formattedValue;
|
|
68
|
+
if (actualFileS3Url) {
|
|
69
|
+
const formattedValueStr = String(formattedValue || '');
|
|
70
|
+
// Check if formatted value is a thumbnail URL (contains '/thumbnails/' in path)
|
|
71
|
+
if (formattedValueStr.includes('/thumbnails/')) {
|
|
72
|
+
// Use the actual file s3Url instead of thumbnail URL
|
|
73
|
+
finalValue = actualFileS3Url;
|
|
74
|
+
console.log('DAM ImagePicker - FIXED: Replaced thumbnail URL with file s3Url');
|
|
75
|
+
console.log('DAM ImagePicker - Thumbnail URL was:', formattedValueStr);
|
|
76
|
+
console.log('DAM ImagePicker - File s3Url is:', finalValue);
|
|
77
|
+
}
|
|
78
|
+
else if (formattedValueStr.includes('/files/')) {
|
|
79
|
+
// Formatted value already contains file URL, use it
|
|
80
|
+
finalValue = formattedValueStr; // Remove query params if any
|
|
81
|
+
console.log('DAM ImagePicker - Formatted value is already a file URL, using it');
|
|
82
|
+
}
|
|
83
|
+
else if (formattedValueStr !== actualFileS3Url && actualFileS3Url.includes('/files/')) {
|
|
84
|
+
// If formatted value is different and s3Url is a file URL, use s3Url
|
|
85
|
+
finalValue = actualFileS3Url;
|
|
86
|
+
console.log('DAM ImagePicker - FIXED: Using file s3Url (formatted value was not file URL)');
|
|
87
|
+
console.log('DAM ImagePicker - Final value (file s3Url):', finalValue);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.log('DAM ImagePicker - Using formatted value as-is:', finalValue);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
console.warn('DAM ImagePicker - WARNING: No file s3Url available!');
|
|
95
|
+
console.warn('DAM ImagePicker - Using formatted value:', finalValue);
|
|
96
|
+
}
|
|
97
|
+
setSelectedFile(fileForConfirmation === null || fileForConfirmation === void 0 ? void 0 : fileForConfirmation.thumbnailUrl, finalValue);
|
|
59
98
|
});
|
|
60
99
|
return (_jsx(Modal, { title: `Test ${get(imagePicker, "name", "Image picker")}`, open: open, onCancel: toggleModal, okText: "Create", maskClosable: false, width: get(imagePicker, "assetId") ? 600 : 1000, footer: get(fileForConfirmation, "thumbnailUrl") ? (_jsx(CustomButton, { type: "primary", label: "Confirm", onClick: () => {
|
|
61
100
|
onSelectFile();
|
|
@@ -65,7 +104,9 @@ function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile,
|
|
|
65
104
|
console.log("local file", file);
|
|
66
105
|
setState((prevState) => (Object.assign(Object.assign({}, prevState), { fileForConfirmation: file })));
|
|
67
106
|
if (localFile) {
|
|
68
|
-
|
|
107
|
+
// For local files, pass thumbnailUrl first (for display) and s3Url second (for value)
|
|
108
|
+
setSelectedFile(get(file, "thumbnailUrl", ""), get(file, "s3Url", "") // Use actual file s3Url, not thumbnail
|
|
109
|
+
);
|
|
69
110
|
}
|
|
70
111
|
}, parentFolderId: parentFolderId, setParentFolderId: (id) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { parentFolderId: id, fileForConfirmation: {} }))), pickerFolderId: get(imagePicker, "folderId"), selectedPickerFile: fileForConfirmation, imagePicker: imagePicker, globalSearch: globalSearch, setGlobalSearch: setGlobalSearch }) })) }));
|
|
71
112
|
}
|