@bindu-dashing/dam-solution-v2 5.8.78 → 5.8.82
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.
|
@@ -56,8 +56,21 @@ function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile,
|
|
|
56
56
|
const productData = get(response, "data.data", get(response, "data", {}));
|
|
57
57
|
// Get image URL from image.src
|
|
58
58
|
const thumbnailUrl = get(productData, "image.src", get(productData, "images[0].src", fileForConfirmation === null || fileForConfirmation === void 0 ? void 0 : fileForConfirmation.thumbnailUrl));
|
|
59
|
-
//
|
|
60
|
-
|
|
59
|
+
// Extract title, vendor, and price
|
|
60
|
+
const title = get(productData, "title", "");
|
|
61
|
+
const vendor = get(productData, "vendor", "");
|
|
62
|
+
const price = get(productData, "variants[0].price", "");
|
|
63
|
+
// Pass structured product data as JSON string
|
|
64
|
+
const productInfo = {
|
|
65
|
+
title,
|
|
66
|
+
vendor,
|
|
67
|
+
price,
|
|
68
|
+
thumbnailUrl,
|
|
69
|
+
productId: get(productData, "id", ""),
|
|
70
|
+
};
|
|
71
|
+
console.log("Shopify product info:", productInfo);
|
|
72
|
+
// Pass the thumbnail URL and product info as value
|
|
73
|
+
setSelectedFile(thumbnailUrl, JSON.stringify(productInfo));
|
|
61
74
|
}
|
|
62
75
|
catch (error) {
|
|
63
76
|
console.error("Error fetching Shopify product details:", error);
|
|
@@ -85,7 +98,10 @@ function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile,
|
|
|
85
98
|
console.log(value);
|
|
86
99
|
setSelectedFile(fileForConfirmation === null || fileForConfirmation === void 0 ? void 0 : fileForConfirmation.thumbnailUrl, value);
|
|
87
100
|
});
|
|
88
|
-
|
|
101
|
+
// Check if a product/file is selected (for showing Confirm button)
|
|
102
|
+
const hasSelectedFile = get(fileForConfirmation, "thumbnailUrl") || get(fileForConfirmation, "_id");
|
|
103
|
+
console.log("fileForConfirmation:", fileForConfirmation, "hasSelectedFile:", hasSelectedFile, "isShopifyProduct:", isShopifyProduct);
|
|
104
|
+
return (_jsx(Modal, { title: searchOnly ? "Shopify Product Picker" : `Test ${get(imagePicker, "name", "Image picker")}`, open: open, onCancel: toggleModal, okText: "Create", maskClosable: false, width: get(imagePicker, "assetId") ? 600 : 1000, footer: hasSelectedFile ? (_jsx(CustomButton, { type: "primary", label: "Confirm", onClick: () => {
|
|
89
105
|
onSelectFile();
|
|
90
106
|
} }, "confirm")) : null, children: get(imagePicker, "assetId") ? (_jsx(TestImageFromMetalData, { imagePicker: imagePicker, selectedPickerFile: fileForConfirmation, setSelectedFile: (file) => {
|
|
91
107
|
setState((prevState) => (Object.assign(Object.assign({}, prevState), { fileForConfirmation: file })));
|