@q2devel/q2-core 1.0.46 → 1.0.48
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":"Product.d.ts","sourceRoot":"","sources":["../../../types/products/Product.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,GAAG,CAAC;IACd,gBAAgB,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;KACb,EAAE,CAAC;IACJ,cAAc,EAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;KACb,EAAE,CAAC;IACJ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAGhC,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IAEH,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,GAA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,EAAE;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,WAAW,CAAC,EAAE;QACZ,iBAAiB,CAAC,EAAE;YAClB,GAAG,CAAC,EAAE;gBACJ,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;SACH,CAAC;QACF,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;KACb,EAAE,CAAC;IACJ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapProducts.d.ts","sourceRoot":"","sources":["../../utils/mapProducts.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"mapProducts.d.ts","sourceRoot":"","sources":["../../utils/mapProducts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAuB,MAAM,2BAA2B,CAAA;AAmIxE,wBAAgB,UAAU,CAAC,cAAc,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAexF;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAKxF"}
|
|
@@ -39,8 +39,12 @@ function mapProductBase(defaultProduct, variationProduct, ctx) {
|
|
|
39
39
|
const variationImages = variationProduct.field_image;
|
|
40
40
|
const discountPercent = getDiscountPercent(variationProduct.price, variationProduct.list_price);
|
|
41
41
|
const badges = [
|
|
42
|
-
...(variationProduct.field_news
|
|
43
|
-
|
|
42
|
+
...(variationProduct.field_news
|
|
43
|
+
? [{ text: 'Novinka', color: 'bg-green-100 text-green-800' }]
|
|
44
|
+
: []),
|
|
45
|
+
...(variationProduct.field_aftersale
|
|
46
|
+
? [{ text: 'Doprodej', color: 'bg-red-100 text-red-800' }]
|
|
47
|
+
: []),
|
|
44
48
|
];
|
|
45
49
|
return {
|
|
46
50
|
variation_id: variationProduct.drupal_internal__variation_id,
|
|
@@ -50,7 +54,9 @@ function mapProductBase(defaultProduct, variationProduct, ctx) {
|
|
|
50
54
|
sku: variationProduct.sku,
|
|
51
55
|
ean: variationProduct.field_ean,
|
|
52
56
|
description: defaultProduct.field_description?.processed ?? '',
|
|
53
|
-
price: variationProduct?.list_price?.number
|
|
57
|
+
price: variationProduct?.list_price?.number
|
|
58
|
+
? variationProduct.list_price.number
|
|
59
|
+
: variationProduct.price?.number ?? 0,
|
|
54
60
|
discountPercent,
|
|
55
61
|
product_id: defaultProduct.drupal_internal__product_id,
|
|
56
62
|
product_name: defaultProduct.title,
|
|
@@ -62,31 +68,55 @@ function mapProductBase(defaultProduct, variationProduct, ctx) {
|
|
|
62
68
|
variations: mapVariations(defaultProduct.variations),
|
|
63
69
|
field_news: variationProduct.field_news ?? false,
|
|
64
70
|
field_aftersale: variationProduct.field_aftersale ?? false,
|
|
71
|
+
field_gateway_payment: variationProduct.field_gateway_payment ?? false,
|
|
65
72
|
field_care: defaultProduct.field_care ?? [],
|
|
66
73
|
field_features: defaultProduct.field_features ?? [],
|
|
67
74
|
field_returns: defaultProduct.field_returns ?? [],
|
|
68
75
|
field_shipping: defaultProduct.field_shipping ?? [],
|
|
69
76
|
...(variationProduct.packaging ? { packaging: variationProduct.packaging } : {}),
|
|
70
77
|
...(variationProduct.country ? { country: variationProduct.country } : {}),
|
|
71
|
-
...(variationProduct.weight &&
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
...(variationProduct.weight &&
|
|
79
|
+
variationProduct.weight.number &&
|
|
80
|
+
variationProduct.weight.unit
|
|
81
|
+
? {
|
|
82
|
+
weight: `${Number(variationProduct.weight.number).toFixed(2).toString()} ${variationProduct.weight.unit}`,
|
|
83
|
+
}
|
|
84
|
+
: {}),
|
|
85
|
+
...(variationProduct.weight && variationProduct.weight.unit
|
|
86
|
+
? { volume_unit: variationProduct.weight.unit }
|
|
87
|
+
: {}),
|
|
88
|
+
...(variationProduct.weight && variationProduct.weight.number
|
|
89
|
+
? { volume_number: variationProduct.weight.number }
|
|
90
|
+
: {}),
|
|
91
|
+
...(variationProduct.field_discount
|
|
92
|
+
? { field_discount: variationProduct.field_discount }
|
|
93
|
+
: {}),
|
|
94
|
+
...(variationProduct.field_composition
|
|
95
|
+
? { field_composition: variationProduct.field_composition }
|
|
96
|
+
: {}),
|
|
97
|
+
...(variationProduct.field_nutritional_info
|
|
98
|
+
? { field_nutritional_info: variationProduct.field_nutritional_info }
|
|
99
|
+
: {}),
|
|
100
|
+
...(variationProduct.field_species
|
|
101
|
+
? { field_species: variationProduct.field_species }
|
|
102
|
+
: {}),
|
|
78
103
|
...(variationProduct.field_volume ? { field_volume: variationProduct.field_volume } : {}),
|
|
79
|
-
...(defaultProduct.field_manufacturer
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
104
|
+
...(defaultProduct.field_manufacturer
|
|
105
|
+
? {
|
|
106
|
+
field_manufacturer: {
|
|
107
|
+
title: defaultProduct.field_manufacturer.title,
|
|
108
|
+
status: defaultProduct.field_manufacturer.status,
|
|
109
|
+
body: defaultProduct.field_manufacturer.body.processed,
|
|
110
|
+
field_image: mapImages(defaultProduct.field_manufacturer.field_image, ctx),
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
: {}),
|
|
85
114
|
};
|
|
86
115
|
}
|
|
87
116
|
export function mapProduct(defaultProduct, variationProduct, ctx) {
|
|
88
117
|
const base = mapProductBase(defaultProduct, variationProduct, ctx);
|
|
89
|
-
const relatedProducts = Array.isArray(defaultProduct.field_related_products) &&
|
|
118
|
+
const relatedProducts = Array.isArray(defaultProduct.field_related_products) &&
|
|
119
|
+
defaultProduct.field_related_products[0]?.default_variation
|
|
90
120
|
? defaultProduct.field_related_products.map((related) => mapProductLite(related, related.default_variation, ctx))
|
|
91
121
|
: [];
|
|
92
122
|
return {
|