hey-pharmacist-ecommerce 1.0.3 → 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
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  'use strict';
2
3
 
3
4
  var React15 = require('react');
@@ -1887,6 +1888,7 @@ function mapSessionData(sessionData) {
1887
1888
  }
1888
1889
  function mapProduct(backendProduct) {
1889
1890
  const images = backendProduct.productMedia?.map((media) => media.file) || [];
1891
+ const categoryName = typeof backendProduct.parentCategories?.[0] === "object" ? backendProduct.parentCategories[0]?.name || "" : backendProduct.parentCategories?.[0] || "";
1890
1892
  return {
1891
1893
  id: backendProduct.id || backendProduct._id || "",
1892
1894
  name: backendProduct.name || "",
@@ -1894,7 +1896,7 @@ function mapProduct(backendProduct) {
1894
1896
  price: backendProduct.finalPrice || 0,
1895
1897
  compareAtPrice: backendProduct.isDiscounted ? backendProduct.priceBeforeDiscount : void 0,
1896
1898
  images: images.filter(Boolean),
1897
- category: backendProduct.parentCategories?.[0] || "",
1899
+ category: categoryName,
1898
1900
  inStock: (backendProduct.inventoryCount || 0) > 0,
1899
1901
  stock: backendProduct.inventoryCount,
1900
1902
  sku: backendProduct.sku,