@q2devel/q2-core 1.0.57 → 1.0.59
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapProducts.d.ts","sourceRoot":"","sources":["../../utils/mapProducts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAuB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"mapProducts.d.ts","sourceRoot":"","sources":["../../utils/mapProducts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAuB,MAAM,2BAA2B,CAAC;AA0JzE,wBAAgB,UAAU,CACxB,cAAc,EAAE,GAAG,EACnB,gBAAgB,EAAE,GAAG,EACrB,GAAG,EAAE,GAAG,GACP,OAAO,CAeT;AAED,wBAAgB,cAAc,CAC5B,cAAc,EAAE,GAAG,EACnB,gBAAgB,EAAE,GAAG,EACrB,GAAG,EAAE,GAAG,GACP,GAAG,CAKL"}
|
|
@@ -9,14 +9,17 @@ function getImageUrl(img) {
|
|
|
9
9
|
return undefined;
|
|
10
10
|
}
|
|
11
11
|
function mapImages(images, ctx) {
|
|
12
|
+
console.log("images", images);
|
|
12
13
|
const imagesArray = Array.isArray(images) ? images : images ? [images] : [];
|
|
14
|
+
console.log("imagesArray", imagesArray);
|
|
13
15
|
if (imagesArray.length === 0) {
|
|
14
16
|
return [{ href: ctx.logoUrl || "/logo.png", alt: "Q2" }];
|
|
15
17
|
}
|
|
16
18
|
const result = imagesArray.map((img) => ({
|
|
17
|
-
href: ctx.makeAbsoluteUrl(getImageUrl(img) || ctx.logoUrl || "/logo.png"
|
|
19
|
+
href: ctx.makeAbsoluteUrl(getImageUrl(img) || "") || ctx.logoUrl || "/logo.png",
|
|
18
20
|
alt: img.name ?? "Image",
|
|
19
21
|
}));
|
|
22
|
+
console.log("result", result);
|
|
20
23
|
return result;
|
|
21
24
|
}
|
|
22
25
|
function mapVariations(variations = []) {
|
|
@@ -38,13 +41,14 @@ function mapVariations(variations = []) {
|
|
|
38
41
|
function mapProductBase(defaultProduct, variationProduct, ctx) {
|
|
39
42
|
const defaultImages = defaultProduct.field_image;
|
|
40
43
|
const variationImages = variationProduct.field_image;
|
|
41
|
-
const imosImage = variationProduct?.field_image_url
|
|
42
|
-
console.log(
|
|
44
|
+
const imosImage = variationProduct?.field_image_url;
|
|
45
|
+
console.log("imosImage", imosImage);
|
|
43
46
|
const allImages = [imosImage, variationImages, defaultImages]
|
|
44
47
|
.filter(Boolean)
|
|
45
48
|
.flat();
|
|
46
|
-
console.log(allImages);
|
|
49
|
+
console.log("allImages", allImages);
|
|
47
50
|
const discountPercent = getDiscountPercent(variationProduct.price, variationProduct.list_price);
|
|
51
|
+
console.log("mapped images", mapImages(allImages, ctx));
|
|
48
52
|
const badges = [
|
|
49
53
|
...(variationProduct.field_news
|
|
50
54
|
? [{ text: "Novinka", color: "bg-green-100 text-green-800" }]
|