hey-pharmacist-ecommerce 1.0.4 → 1.0.5
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.
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/api-adapter/mappers.ts +7 -2
package/dist/index.mjs
CHANGED
|
@@ -1879,6 +1879,7 @@ function mapSessionData(sessionData) {
|
|
|
1879
1879
|
}
|
|
1880
1880
|
function mapProduct(backendProduct) {
|
|
1881
1881
|
const images = backendProduct.productMedia?.map((media) => media.file) || [];
|
|
1882
|
+
const categoryName = typeof backendProduct.parentCategories?.[0] === "object" ? backendProduct.parentCategories[0]?.name || "" : backendProduct.parentCategories?.[0] || "";
|
|
1882
1883
|
return {
|
|
1883
1884
|
id: backendProduct.id || backendProduct._id || "",
|
|
1884
1885
|
name: backendProduct.name || "",
|
|
@@ -1886,7 +1887,7 @@ function mapProduct(backendProduct) {
|
|
|
1886
1887
|
price: backendProduct.finalPrice || 0,
|
|
1887
1888
|
compareAtPrice: backendProduct.isDiscounted ? backendProduct.priceBeforeDiscount : void 0,
|
|
1888
1889
|
images: images.filter(Boolean),
|
|
1889
|
-
category:
|
|
1890
|
+
category: categoryName,
|
|
1890
1891
|
inStock: (backendProduct.inventoryCount || 0) > 0,
|
|
1891
1892
|
stock: backendProduct.inventoryCount,
|
|
1892
1893
|
sku: backendProduct.sku,
|