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 CHANGED
@@ -1888,6 +1888,7 @@ function mapSessionData(sessionData) {
1888
1888
  }
1889
1889
  function mapProduct(backendProduct) {
1890
1890
  const images = backendProduct.productMedia?.map((media) => media.file) || [];
1891
+ const categoryName = typeof backendProduct.parentCategories?.[0] === "object" ? backendProduct.parentCategories[0]?.name || "" : backendProduct.parentCategories?.[0] || "";
1891
1892
  return {
1892
1893
  id: backendProduct.id || backendProduct._id || "",
1893
1894
  name: backendProduct.name || "",
@@ -1895,7 +1896,7 @@ function mapProduct(backendProduct) {
1895
1896
  price: backendProduct.finalPrice || 0,
1896
1897
  compareAtPrice: backendProduct.isDiscounted ? backendProduct.priceBeforeDiscount : void 0,
1897
1898
  images: images.filter(Boolean),
1898
- category: backendProduct.parentCategories?.[0] || "",
1899
+ category: categoryName,
1899
1900
  inStock: (backendProduct.inventoryCount || 0) > 0,
1900
1901
  stock: backendProduct.inventoryCount,
1901
1902
  sku: backendProduct.sku,