@propeller-commerce/propeller-v2-react-ui 0.4.18 → 0.4.19

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,5 +1,5 @@
1
1
  "use client";
2
- import { getLabel, formatPrice, getClusterSku, getClusterImageUrl, getProductSku, getProductImageUrl, createServices, err, ok, getLocalizedValue, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses, isContentHidden, attributeNameMatches, getAttributeDisplayName, filterProductsBySelections, extractAttributeValues, getLanguageString, collectAttributeValues, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
2
+ import { getLabel, getLocalizedValue, formatPrice, getClusterSku, getClusterImageUrl, getProductSku, getProductImageUrl, createServices, err, ok, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses, isContentHidden, attributeNameMatches, getAttributeDisplayName, filterProductsBySelections, extractAttributeValues, getLanguageString, collectAttributeValues, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
3
3
  export * from '@propeller-commerce/propeller-v2-core-ui';
4
4
  import * as React6 from 'react';
5
5
  import { createContext, useState, useRef, useMemo, useCallback, useContext, useEffect } from 'react';
@@ -3934,7 +3934,7 @@ function AddToCart(rawProps) {
3934
3934
  }
3935
3935
  function getModalName() {
3936
3936
  if (addedCartItem) {
3937
- return addedCartItem.product?.names?.[0]?.value || getLocalizedValue(props.product?.names, props.language, "Product");
3937
+ return getLocalizedValue(addedCartItem.product?.names, props.language, "") || getLocalizedValue(props.product?.names, props.language, "Product");
3938
3938
  }
3939
3939
  return getLocalizedValue(props.product?.names, props.language, "Product");
3940
3940
  }
@@ -4287,7 +4287,7 @@ function AddToCart(rawProps) {
4287
4287
  {
4288
4288
  className: "propeller-add-to-cart__modal-child flex justify-between items-center text-xs text-muted-foreground",
4289
4289
  children: [
4290
- /* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: child.product?.names?.[0]?.value || "Option" }),
4290
+ /* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: getLocalizedValue(child.product?.names, props.language, "Option") }),
4291
4291
  /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: formatPrice(
4292
4292
  ((props.includeTax !== void 0 ? !!props.includeTax : includeTax) ? child.totalSumNet : child.totalSum) ?? 0,
4293
4293
  { symbol: props.currency ?? "\u20AC" }
@@ -6040,7 +6040,7 @@ function CartItem(rawProps) {
6040
6040
  const minQuantity = getMinQuantity(props.cartItem.product);
6041
6041
  const step = getStep(props.cartItem.product);
6042
6042
  function getProductName5() {
6043
- return props.cartItem.product?.names?.[0]?.value || "Product";
6043
+ return getLocalizedValue(props.cartItem.product?.names, props.language, "Product");
6044
6044
  }
6045
6045
  function getProductUrl2() {
6046
6046
  if (props.configuration?.urls && props.cartItem.product) {
@@ -6091,7 +6091,7 @@ function CartItem(rawProps) {
6091
6091
  if (!items) return "";
6092
6092
  const leader = items.find((bi) => bi.isLeader === YesNo.Y);
6093
6093
  if (!leader) return "";
6094
- return leader.product.names?.[0]?.value || "Product";
6094
+ return getLocalizedValue(leader.product.names, props.language, "Product");
6095
6095
  }
6096
6096
  function getBundleLeaderPrice() {
6097
6097
  const items = props.cartItem.bundle?.items;
@@ -6108,7 +6108,7 @@ function CartItem(rawProps) {
6108
6108
  return items.filter((bi) => bi.isLeader !== YesNo.Y);
6109
6109
  }
6110
6110
  function getBundleItemName(bundleItem) {
6111
- return bundleItem.product.names?.[0]?.value || "Product";
6111
+ return getLocalizedValue(bundleItem.product.names, props.language, "Product");
6112
6112
  }
6113
6113
  function getBundleItemPrice(bundleItem) {
6114
6114
  const price = bundleItem.price?.net;
@@ -6117,7 +6117,7 @@ function CartItem(rawProps) {
6117
6117
  }
6118
6118
  function getCrossupsellName(item) {
6119
6119
  const product = item?.productTo || item?.clusterTo;
6120
- return product?.names?.[0]?.value || "Product";
6120
+ return getLocalizedValue(product?.names, props.language, "Product");
6121
6121
  }
6122
6122
  function getCrossupsellImageUrl(item) {
6123
6123
  const product = item?.productTo || item?.clusterTo;
@@ -6442,7 +6442,7 @@ function CartItemChildItems(props = {}) {
6442
6442
  return /* @__PURE__ */ jsxs("div", { className: props.className ?? "propeller-cart-item__options mt-3 space-y-1.5 border-l-2 border-border pl-3", children: [
6443
6443
  /* @__PURE__ */ jsx("p", { className: "propeller-cart-item__options-label text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-1", children: getLabel(resolved.labels, "includedOptions", "Included Options:") }),
6444
6444
  (cartItem.childItems || []).map((child, idx) => /* @__PURE__ */ jsxs("div", { className: "propeller-cart-item__option flex flex-wrap gap-x-2 text-sm text-muted-foreground", children: [
6445
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: child.product.names?.[0]?.value || "Option" }),
6445
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: getLocalizedValue(child.product.names, resolved.language, "Option") }),
6446
6446
  /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle hidden sm:inline", children: "-" }),
6447
6447
  /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle text-xs self-center", children: child.product.sku }),
6448
6448
  /* @__PURE__ */ jsx("div", { className: "flex-1 border-b border-dotted border-border mx-1 mb-1" }),