@propeller-commerce/propeller-v2-vue-ui 0.3.38 → 0.3.39

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
@@ -2041,6 +2041,7 @@ function useProductSearch(options) {
2041
2041
  const currentSortField = ref(options.sortField?.value ?? ProductSortField.RELEVANCE);
2042
2042
  const currentSortOrder = ref(options.sortOrder?.value ?? "DESC");
2043
2043
  function filterByLanguage(products, lang) {
2044
+ if (!lang) return products;
2044
2045
  return products.filter((p2) => {
2045
2046
  const names = p2.names || p2.names || [];
2046
2047
  if (!names || names.length === 0) return true;
@@ -2267,8 +2268,12 @@ function useProductSearch(options) {
2267
2268
  };
2268
2269
  const response = await service.getCategory(variables);
2269
2270
  const productsResponse = response?.products;
2270
- searchResults.value = productsResponse?.items ?? [];
2271
- searchItemsFound.value = productsResponse?.itemsFound ?? searchResults.value.length;
2271
+ const rawItems = productsResponse?.items ?? [];
2272
+ const items = filterByLanguage(rawItems, lang);
2273
+ const untranslated = rawItems.length - items.length;
2274
+ const apiTotal = productsResponse?.itemsFound ?? rawItems.length;
2275
+ searchResults.value = items;
2276
+ searchItemsFound.value = Math.max(0, apiTotal - untranslated);
2272
2277
  } catch {
2273
2278
  searchResults.value = [];
2274
2279
  searchItemsFound.value = 0;
@@ -20104,9 +20109,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
20104
20109
  const url = typeof builder === "function" ? builder(item, infra.language) : isCluster ? "/cluster/" + id + "/" + slug : "/product/" + id + "/" + slug;
20105
20110
  const priceNet = displayItem?.price?.net || 0;
20106
20111
  const priceGross = displayItem?.price?.gross || 0;
20112
+ const lang = infra.language;
20113
+ const localizedName = lang && item.names?.find((n) => n.language === lang)?.value || item.names?.[0]?.value || "Product";
20107
20114
  return {
20108
20115
  id,
20109
- name: item.names?.[0]?.value || "Product",
20116
+ name: localizedName,
20110
20117
  sku: item.sku || displayItem?.sku || "",
20111
20118
  // `price` stays gross for back-compat; the row picks net/gross per toggle.
20112
20119
  price: priceGross,