@bindu-dashing/dam-solution-v2 5.8.78 → 5.8.83
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.
|
@@ -45,7 +45,7 @@ function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile,
|
|
|
45
45
|
const productId = extractShopifyProductId((shopifyProduct === null || shopifyProduct === void 0 ? void 0 : shopifyProduct.id) || get(fileForConfirmation, "_id", ""));
|
|
46
46
|
console.log("Fetching Shopify product details for:", productId);
|
|
47
47
|
// Static token for Shopify API access
|
|
48
|
-
const shopifyStaticToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
48
|
+
const shopifyStaticToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTAyOSwicGVybWlzc2lvbnMiOiJbe1wicmVzb3VyY2VfaWRcIjoyLFwiYWNjZXNzXCI6W1wicmVhZFwiXX0se1wicmVzb3VyY2VfaWRcIjoxLFwiYWNjZXNzXCI6W1wicmVhZFwiXX0se1wicmVzb3VyY2VfaWRcIjo1LFwiYWNjZXNzXCI6W1wiY3JlYXRlXCJdfSx7XCJyZXNvdXJjZV9pZFwiOjUsXCJhY2Nlc3NcIjpbXCJyZWFkXCJdfSx7XCJyZXNvdXJjZV9pZFwiOjUsXCJhY2Nlc3NcIjpbXCJ1cGRhdGVcIl19XSIsInRlYW1zIjoiWzE1OCwxNjUsMTA0XSIsInRlYW1JRCI6MTU4LCJicmFuZFRlYW1JRCI6MTA0LCJ0aGVtZUlEIjoxLCJlbWFpbCI6Im1haGVuZHJha29uZGFkYXN1QGdtYWlsLmNvbSIsImZpcnN0TmFtZSI6Ik1haGVuZHJhIiwibGFzdE5hbWUiOiJLb25kYWRhc3UiLCJpYXQiOjE3NjUzMzQzNDEsImV4cCI6MTc2NTM5NDM0MX0.vh-w5QF52L1w9KFMB32HZIUtcCxreTZ0l-Gl1ryxGEM";
|
|
49
49
|
const response = yield axios.get(`https://staging-api.dashingone.com.au${FETCH_SHOPIFY_PRODUCT_DETAIL_URL.replace(":productId", productId)}`, {
|
|
50
50
|
headers: {
|
|
51
51
|
Authorization: `Bearer ${shopifyStaticToken}`,
|
|
@@ -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 })));
|
|
@@ -261,7 +261,7 @@ function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pi
|
|
|
261
261
|
// Hardcoded Shopify API URL and token for now
|
|
262
262
|
const shopifyApiBaseUrl = "https://staging-api.dashingone.com.au";
|
|
263
263
|
// Static token for Shopify API access - TODO: Replace with proper auth mechanism later
|
|
264
|
-
const shopifyStaticToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
264
|
+
const shopifyStaticToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTAyOSwicGVybWlzc2lvbnMiOiJbe1wicmVzb3VyY2VfaWRcIjoyLFwiYWNjZXNzXCI6W1wicmVhZFwiXX0se1wicmVzb3VyY2VfaWRcIjoxLFwiYWNjZXNzXCI6W1wicmVhZFwiXX0se1wicmVzb3VyY2VfaWRcIjo1LFwiYWNjZXNzXCI6W1wiY3JlYXRlXCJdfSx7XCJyZXNvdXJjZV9pZFwiOjUsXCJhY2Nlc3NcIjpbXCJyZWFkXCJdfSx7XCJyZXNvdXJjZV9pZFwiOjUsXCJhY2Nlc3NcIjpbXCJ1cGRhdGVcIl19XSIsInRlYW1zIjoiWzE1OCwxNjUsMTA0XSIsInRlYW1JRCI6MTU4LCJicmFuZFRlYW1JRCI6MTA0LCJ0aGVtZUlEIjoxLCJlbWFpbCI6Im1haGVuZHJha29uZGFkYXN1QGdtYWlsLmNvbSIsImZpcnN0TmFtZSI6Ik1haGVuZHJhIiwibGFzdE5hbWUiOiJLb25kYWRhc3UiLCJpYXQiOjE3NjUzMzQzNDEsImV4cCI6MTc2NTM5NDM0MX0.vh-w5QF52L1w9KFMB32HZIUtcCxreTZ0l-Gl1ryxGEM";
|
|
265
265
|
console.log("Shopify API Base URL:", shopifyApiBaseUrl);
|
|
266
266
|
const response = yield axios.get(`${shopifyApiBaseUrl}${FETCH_SHOPIFY_PRODUCTS_URL}`, {
|
|
267
267
|
params: { title: searchTerm },
|