@propeller-commerce/propeller-v2-react-ui 0.15.10 → 0.16.0
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/CHANGELOG.md +67 -0
- package/dist/index.cjs +76 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +76 -62
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +10 -10
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +10 -0
- package/dist/pure.d.ts +10 -0
- package/dist/pure.js +11 -11
- package/dist/pure.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4109,6 +4109,11 @@ interface ClusterOptionsProps {
|
|
|
4109
4109
|
currency?: string;
|
|
4110
4110
|
/** Authenticated user. Resolved from PropellerProvider when omitted. */
|
|
4111
4111
|
user?: Contact | Customer | null;
|
|
4112
|
+
/**
|
|
4113
|
+
* Language used to resolve option and product names. Resolved from
|
|
4114
|
+
* PropellerProvider when omitted.
|
|
4115
|
+
*/
|
|
4116
|
+
language?: string;
|
|
4112
4117
|
/**
|
|
4113
4118
|
* Portal access mode. In `'semi-closed'` option prices are omitted from the
|
|
4114
4119
|
* dropdown labels and preview for anonymous visitors. Resolved from
|
|
@@ -4123,7 +4128,7 @@ interface ClusterOptionsProps {
|
|
|
4123
4128
|
* with a preview of the chosen product. Surfaces validation errors for unset
|
|
4124
4129
|
* required options when `showErrors` is enabled.
|
|
4125
4130
|
*/
|
|
4126
|
-
declare function ClusterOptions(
|
|
4131
|
+
declare function ClusterOptions(rawProps: ClusterOptionsProps): React$1.JSX.Element;
|
|
4127
4132
|
|
|
4128
4133
|
/**
|
|
4129
4134
|
* @rsc-blocked — Client-only component: browser-only APIs (window/document/storage).
|
|
@@ -5184,6 +5189,16 @@ interface OrderItemCardProps {
|
|
|
5184
5189
|
orderItem: OrderItem;
|
|
5185
5190
|
/** Child order items (rendered as indented sub-rows beneath the parent) */
|
|
5186
5191
|
childItems?: OrderItem[];
|
|
5192
|
+
/**
|
|
5193
|
+
* Language used to resolve localized product names and the slugs in the
|
|
5194
|
+
* item's PDP link. Defaults to the catalog's default language.
|
|
5195
|
+
*
|
|
5196
|
+
* This component is RSC-safe (no hooks, no context), so the host has to pass
|
|
5197
|
+
* it — there is nothing to read it from. Without it a non-default storefront
|
|
5198
|
+
* renders default-language names and, worse, default-language slugs in the
|
|
5199
|
+
* links (PWP-940).
|
|
5200
|
+
*/
|
|
5201
|
+
language?: string;
|
|
5187
5202
|
/** Should the item title be a link to the PDP */
|
|
5188
5203
|
titleLinkable?: boolean;
|
|
5189
5204
|
/** Display a small thumbnail of the order item */
|
package/dist/index.d.ts
CHANGED
|
@@ -4109,6 +4109,11 @@ interface ClusterOptionsProps {
|
|
|
4109
4109
|
currency?: string;
|
|
4110
4110
|
/** Authenticated user. Resolved from PropellerProvider when omitted. */
|
|
4111
4111
|
user?: Contact | Customer | null;
|
|
4112
|
+
/**
|
|
4113
|
+
* Language used to resolve option and product names. Resolved from
|
|
4114
|
+
* PropellerProvider when omitted.
|
|
4115
|
+
*/
|
|
4116
|
+
language?: string;
|
|
4112
4117
|
/**
|
|
4113
4118
|
* Portal access mode. In `'semi-closed'` option prices are omitted from the
|
|
4114
4119
|
* dropdown labels and preview for anonymous visitors. Resolved from
|
|
@@ -4123,7 +4128,7 @@ interface ClusterOptionsProps {
|
|
|
4123
4128
|
* with a preview of the chosen product. Surfaces validation errors for unset
|
|
4124
4129
|
* required options when `showErrors` is enabled.
|
|
4125
4130
|
*/
|
|
4126
|
-
declare function ClusterOptions(
|
|
4131
|
+
declare function ClusterOptions(rawProps: ClusterOptionsProps): React$1.JSX.Element;
|
|
4127
4132
|
|
|
4128
4133
|
/**
|
|
4129
4134
|
* @rsc-blocked — Client-only component: browser-only APIs (window/document/storage).
|
|
@@ -5184,6 +5189,16 @@ interface OrderItemCardProps {
|
|
|
5184
5189
|
orderItem: OrderItem;
|
|
5185
5190
|
/** Child order items (rendered as indented sub-rows beneath the parent) */
|
|
5186
5191
|
childItems?: OrderItem[];
|
|
5192
|
+
/**
|
|
5193
|
+
* Language used to resolve localized product names and the slugs in the
|
|
5194
|
+
* item's PDP link. Defaults to the catalog's default language.
|
|
5195
|
+
*
|
|
5196
|
+
* This component is RSC-safe (no hooks, no context), so the host has to pass
|
|
5197
|
+
* it — there is nothing to read it from. Without it a non-default storefront
|
|
5198
|
+
* renders default-language names and, worse, default-language slugs in the
|
|
5199
|
+
* links (PWP-940).
|
|
5200
|
+
*/
|
|
5201
|
+
language?: string;
|
|
5187
5202
|
/** Should the item title be a link to the PDP */
|
|
5188
5203
|
titleLinkable?: boolean;
|
|
5189
5204
|
/** Display a small thumbnail of the order item */
|
package/dist/index.js
CHANGED
|
@@ -718,7 +718,8 @@ function useCart(options) {
|
|
|
718
718
|
const { graphqlClient, user, companyId, configuration, onCartCreated } = options;
|
|
719
719
|
const language = options.language || configuration?.language || "NL";
|
|
720
720
|
const [cart, setCart] = useState(null);
|
|
721
|
-
const [
|
|
721
|
+
const [createdCartId, setCreatedCartId] = useState("");
|
|
722
|
+
const cartId = options.cartId || createdCartId;
|
|
722
723
|
const [loading, setLoading] = useState(false);
|
|
723
724
|
const [error, setError] = useState(null);
|
|
724
725
|
const notesTimers = useRef({});
|
|
@@ -754,13 +755,13 @@ function useCart(options) {
|
|
|
754
755
|
imageVariantFilters: configuration?.imageVariantFiltersSmall,
|
|
755
756
|
onCartCreated: (c) => {
|
|
756
757
|
setCart(c);
|
|
757
|
-
|
|
758
|
+
setCreatedCartId(c.cartId);
|
|
758
759
|
onCartCreated?.(c);
|
|
759
760
|
}
|
|
760
761
|
};
|
|
761
762
|
const resolved = await initCart(config);
|
|
762
763
|
setCart(resolved);
|
|
763
|
-
|
|
764
|
+
setCreatedCartId(resolved.cartId);
|
|
764
765
|
return resolved;
|
|
765
766
|
}, [graphqlClient, user, companyId, language, configuration, onCartCreated]);
|
|
766
767
|
const addItem = useCallback(async (opts) => {
|
|
@@ -775,7 +776,7 @@ function useCart(options) {
|
|
|
775
776
|
if (opts.onAddToCart) {
|
|
776
777
|
const resultCart2 = opts.onAddToCart(opts.product, opts.cluster?.clusterId, opts.quantity, childItemInputs, opts.notes, opts.price);
|
|
777
778
|
setCart(resultCart2);
|
|
778
|
-
|
|
779
|
+
setCreatedCartId(resultCart2.cartId);
|
|
779
780
|
const addedItem2 = resultCart2.items?.find((i) => i.productId === opts.product.productId) ?? null;
|
|
780
781
|
opts.afterAddToCart?.(resultCart2, addedItem2);
|
|
781
782
|
return ok({ cart: resultCart2, item: addedItem2 });
|
|
@@ -796,7 +797,7 @@ function useCart(options) {
|
|
|
796
797
|
imageVariantFilters: configuration?.imageVariantFiltersSmall
|
|
797
798
|
});
|
|
798
799
|
setCart(resultCart);
|
|
799
|
-
|
|
800
|
+
setCreatedCartId(resultCart.cartId);
|
|
800
801
|
const addedItem = resultCart.items?.find((i) => i.productId === opts.product.productId) ?? null;
|
|
801
802
|
opts.afterAddToCart?.(resultCart, addedItem);
|
|
802
803
|
return ok({ cart: resultCart, item: addedItem });
|
|
@@ -6407,6 +6408,12 @@ function CartBonusItems(rawProps) {
|
|
|
6407
6408
|
] });
|
|
6408
6409
|
}
|
|
6409
6410
|
var CartBonusItems_default = CartBonusItems;
|
|
6411
|
+
|
|
6412
|
+
// src/composables/shared/utils/preselect.ts
|
|
6413
|
+
function pickPreselected(items, stored, keyOf) {
|
|
6414
|
+
const list = items || [];
|
|
6415
|
+
return (stored ? list.find((item) => keyOf(item) === stored) : void 0) || list[0];
|
|
6416
|
+
}
|
|
6410
6417
|
function CartCarriers(props) {
|
|
6411
6418
|
const [selectedName, setSelectedName] = useState("");
|
|
6412
6419
|
const containerClass = props.carriersContainerClass || "cart-carriers";
|
|
@@ -6420,16 +6427,16 @@ function CartCarriers(props) {
|
|
|
6420
6427
|
setSelectedName(carrier.name);
|
|
6421
6428
|
if (props.onCarrierSelect) props.onCarrierSelect(carrier);
|
|
6422
6429
|
}
|
|
6430
|
+
const preselected = pickPreselected(
|
|
6431
|
+
carriers,
|
|
6432
|
+
props.cart?.postageData?.carrier,
|
|
6433
|
+
(c) => c.name
|
|
6434
|
+
);
|
|
6435
|
+
const activeName = selectedName || preselected?.name || "";
|
|
6423
6436
|
useEffect(() => {
|
|
6424
|
-
if (
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
if (props.onCarrierSelect) {
|
|
6428
|
-
const match = carriers.find((c) => c.name === name);
|
|
6429
|
-
if (match) props.onCarrierSelect(match);
|
|
6430
|
-
}
|
|
6431
|
-
}
|
|
6432
|
-
}, [props.cart, selectedName, props.onCarrierSelect, carriers, props]);
|
|
6437
|
+
if (selectedName || !preselected) return;
|
|
6438
|
+
if (props.onCarrierSelect) props.onCarrierSelect(preselected);
|
|
6439
|
+
}, [preselected?.name]);
|
|
6433
6440
|
return /* @__PURE__ */ jsxs("div", { className: `propeller-cart-carriers ${containerClass}`, children: [
|
|
6434
6441
|
carriers.length > 0 ? /* @__PURE__ */ jsx("div", { className: "propeller-cart-carriers__grid grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3", children: carriers.map((carrier, index) => {
|
|
6435
6442
|
const logoUrl = showLogo ? carrier.logo || "" : "";
|
|
@@ -6437,8 +6444,8 @@ function CartCarriers(props) {
|
|
|
6437
6444
|
"div",
|
|
6438
6445
|
{
|
|
6439
6446
|
onClick: () => handleSelect(carrier),
|
|
6440
|
-
"data-selected":
|
|
6441
|
-
className: `propeller-cart-carriers__carrier relative cursor-pointer border rounded-container p-3 flex flex-col items-center justify-center gap-2 text-center aspect-square transition-all ${
|
|
6447
|
+
"data-selected": activeName === carrier.name ? "true" : "false",
|
|
6448
|
+
className: `propeller-cart-carriers__carrier relative cursor-pointer border rounded-container p-3 flex flex-col items-center justify-center gap-2 text-center aspect-square transition-all ${activeName === carrier.name ? "border-secondary bg-secondary/5 shadow-sm" : "border-border hover:border-secondary/30"}`,
|
|
6442
6449
|
children: [
|
|
6443
6450
|
props.showPrice !== false ? /* @__PURE__ */ jsx("span", { className: "propeller-cart-carriers__carrier-price absolute top-2 right-2 text-xs bg-surface-hover text-muted-foreground px-2 py-0.5 rounded-full", children: formatCarrierPrice(carrier.price) }) : null,
|
|
6444
6451
|
logoUrl ? /* @__PURE__ */ jsx("span", { className: "propeller-cart-carriers__carrier-logo-wrap flex items-center justify-center h-10 w-full", children: /* @__PURE__ */ jsx("img", { className: "propeller-cart-carriers__carrier-logo max-h-10 max-w-[80%] w-auto object-contain", src: logoUrl, alt: carrier.name }) }) : null,
|
|
@@ -7742,16 +7749,16 @@ function CartPaymethods(rawProps) {
|
|
|
7742
7749
|
setSelectedCode(method.code);
|
|
7743
7750
|
if (props.onPaymethodSelect) props.onPaymethodSelect(method);
|
|
7744
7751
|
}
|
|
7752
|
+
const preselected = pickPreselected(
|
|
7753
|
+
payMethods,
|
|
7754
|
+
props.cart?.paymentData?.method,
|
|
7755
|
+
(m) => m.code
|
|
7756
|
+
);
|
|
7757
|
+
const activeCode = selectedCode || preselected?.code || "";
|
|
7745
7758
|
useEffect(() => {
|
|
7746
|
-
if (
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
if (props.onPaymethodSelect) {
|
|
7750
|
-
const match = payMethods.find((m) => m.code === code);
|
|
7751
|
-
if (match) props.onPaymethodSelect(match);
|
|
7752
|
-
}
|
|
7753
|
-
}
|
|
7754
|
-
}, [props.cart, selectedCode, props.onPaymethodSelect, payMethods, props]);
|
|
7759
|
+
if (selectedCode || !preselected) return;
|
|
7760
|
+
if (props.onPaymethodSelect) props.onPaymethodSelect(preselected);
|
|
7761
|
+
}, [preselected?.code]);
|
|
7755
7762
|
return /* @__PURE__ */ jsxs("div", { className: `propeller-cart-paymethods ${containerClass}`, children: [
|
|
7756
7763
|
payMethods.length > 0 ? /* @__PURE__ */ jsx("div", { className: "propeller-cart-paymethods__grid grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3", children: payMethods.map((method, index) => {
|
|
7757
7764
|
const logoUrl = showLogo ? getLogoUrl(method) : "";
|
|
@@ -7759,8 +7766,8 @@ function CartPaymethods(rawProps) {
|
|
|
7759
7766
|
"div",
|
|
7760
7767
|
{
|
|
7761
7768
|
onClick: () => handleSelect(method),
|
|
7762
|
-
"data-selected":
|
|
7763
|
-
className: `propeller-cart-paymethods__method relative cursor-pointer border rounded-container p-3 flex flex-col items-center justify-center gap-2 text-center aspect-square transition-all ${
|
|
7769
|
+
"data-selected": activeCode === method.code ? "true" : "false",
|
|
7770
|
+
className: `propeller-cart-paymethods__method relative cursor-pointer border rounded-container p-3 flex flex-col items-center justify-center gap-2 text-center aspect-square transition-all ${activeCode === method.code ? "border-secondary bg-secondary/5 shadow-sm" : "border-border hover:border-secondary/30"}`,
|
|
7764
7771
|
children: [
|
|
7765
7772
|
method.price > 0 ? /* @__PURE__ */ jsx("span", { className: "propeller-cart-paymethods__method-price absolute top-2 right-2 text-xs bg-surface-hover text-muted-foreground px-2 py-0.5 rounded-full", children: formatMethodPrice(method.price) }) : null,
|
|
7766
7773
|
logoUrl ? /* @__PURE__ */ jsx("span", { className: "propeller-cart-paymethods__method-logo-wrap flex items-center justify-center h-10 w-full", children: /* @__PURE__ */ jsx(
|
|
@@ -10789,8 +10796,8 @@ var ClusterInfo_default = ClusterInfo;
|
|
|
10789
10796
|
function formatPrice9(price, currency) {
|
|
10790
10797
|
return formatPrice(price, { symbol: currency });
|
|
10791
10798
|
}
|
|
10792
|
-
function getProductName2(product) {
|
|
10793
|
-
return product.names
|
|
10799
|
+
function getProductName2(product, language) {
|
|
10800
|
+
return getLocalizedValue(product.names, language, `Product ${product.productId}`);
|
|
10794
10801
|
}
|
|
10795
10802
|
function getProductImageUrl4(product) {
|
|
10796
10803
|
const media = product.media;
|
|
@@ -10800,9 +10807,11 @@ function getProductImageUrl4(product) {
|
|
|
10800
10807
|
}
|
|
10801
10808
|
return "";
|
|
10802
10809
|
}
|
|
10803
|
-
function ClusterOptions(
|
|
10810
|
+
function ClusterOptions(rawProps) {
|
|
10811
|
+
const props = useInfraProps(rawProps);
|
|
10804
10812
|
const [selectedProductIds, setSelectedProductIds] = useState({});
|
|
10805
10813
|
function getOptionsForRender() {
|
|
10814
|
+
const language = props.language;
|
|
10806
10815
|
const options = props.options || [];
|
|
10807
10816
|
const sel = selectedProductIds;
|
|
10808
10817
|
const hidePrices = isContentHidden(props.portalMode, props.user);
|
|
@@ -10812,7 +10821,7 @@ function ClusterOptions(props) {
|
|
|
10812
10821
|
const products = (option.products || []).map((p) => ({
|
|
10813
10822
|
productId: p.productId,
|
|
10814
10823
|
productIdStr: p.productId.toString(),
|
|
10815
|
-
label: hidePrices ? getProductName2(p) : `${getProductName2(p)} \u2014 ${formatPrice9(p.price?.gross || 0, props.currency ?? "\u20AC")}`
|
|
10824
|
+
label: hidePrices ? getProductName2(p, language) : `${getProductName2(p, language)} \u2014 ${formatPrice9(p.price?.gross || 0, props.currency ?? "\u20AC")}`
|
|
10816
10825
|
}));
|
|
10817
10826
|
let previewImageUrl = "";
|
|
10818
10827
|
let previewName = "";
|
|
@@ -10823,7 +10832,7 @@ function ClusterOptions(props) {
|
|
|
10823
10832
|
);
|
|
10824
10833
|
if (selectedProduct) {
|
|
10825
10834
|
previewImageUrl = getProductImageUrl4(selectedProduct);
|
|
10826
|
-
previewName = getProductName2(selectedProduct);
|
|
10835
|
+
previewName = getProductName2(selectedProduct, language);
|
|
10827
10836
|
previewPrice = hidePrices ? "" : formatPrice9(selectedProduct.price?.gross || 0, props.currency ?? "\u20AC");
|
|
10828
10837
|
}
|
|
10829
10838
|
}
|
|
@@ -10831,7 +10840,7 @@ function ClusterOptions(props) {
|
|
|
10831
10840
|
return {
|
|
10832
10841
|
id: option.id,
|
|
10833
10842
|
idStr,
|
|
10834
|
-
name: option.names
|
|
10843
|
+
name: getLocalizedValue(option.names, language, `Option ${option.id}`),
|
|
10835
10844
|
isRequired,
|
|
10836
10845
|
selectedProductId,
|
|
10837
10846
|
hasSelection: !!selectedProductId,
|
|
@@ -11299,7 +11308,8 @@ function FavoriteListItem(rawProps) {
|
|
|
11299
11308
|
const isProduct = "productId" in props.item;
|
|
11300
11309
|
const product = props.item;
|
|
11301
11310
|
const cluster = props.item;
|
|
11302
|
-
const
|
|
11311
|
+
const nameLanguage = props.language;
|
|
11312
|
+
const name = isProduct ? getLocalizedValue(product?.names, nameLanguage, "Product") : getLocalizedValue(cluster?.names, nameLanguage, "") || getLocalizedValue(cluster?.defaultProduct?.names, nameLanguage, "Cluster");
|
|
11303
11313
|
const sku = isProduct ? product?.sku || "" : cluster?.sku || cluster?.defaultProduct?.sku || "";
|
|
11304
11314
|
const imageUrl = isProduct ? product?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "" : cluster?.defaultProduct?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "";
|
|
11305
11315
|
const itemUrl = isProduct ? props.configuration?.urls?.getProductUrl?.(props.item) || "" : props.configuration?.urls?.getClusterUrl?.(props.item) || "";
|
|
@@ -11733,9 +11743,10 @@ function FavoriteListDetails(rawProps) {
|
|
|
11733
11743
|
}
|
|
11734
11744
|
}
|
|
11735
11745
|
function getSearchItemName(item) {
|
|
11736
|
-
|
|
11746
|
+
const language = props.language;
|
|
11747
|
+
if ("productId" in item) return getLocalizedValue(item.names, language, "Product");
|
|
11737
11748
|
const cluster = item;
|
|
11738
|
-
return cluster.names
|
|
11749
|
+
return getLocalizedValue(cluster.names, language, "") || getLocalizedValue(cluster.defaultProduct?.names, language, "Cluster");
|
|
11739
11750
|
}
|
|
11740
11751
|
function getSearchItemSku(item) {
|
|
11741
11752
|
if ("productId" in item) return item.sku || "";
|
|
@@ -11978,7 +11989,7 @@ function FavoriteListDetails(rawProps) {
|
|
|
11978
11989
|
type: "button",
|
|
11979
11990
|
className: "propeller-favorite-list-details__add-btn inline-flex items-center justify-center rounded-control bg-secondary px-4 py-2 text-sm font-medium text-secondary-foreground transition-colors hover:bg-secondary/90",
|
|
11980
11991
|
onClick: () => setShowAddModal(true),
|
|
11981
|
-
children: getLabel(props.labels, "addProductDirectly", "Add product
|
|
11992
|
+
children: getLabel(props.labels, "addProductDirectly", "Add product to favorite list")
|
|
11982
11993
|
}
|
|
11983
11994
|
) }),
|
|
11984
11995
|
allItems.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "propeller-favorite-list-details__empty border border-border rounded-container p-12 text-center space-y-4", children: [
|
|
@@ -12854,8 +12865,8 @@ function GridTitleWithProvider(rawProps) {
|
|
|
12854
12865
|
return /* @__PURE__ */ jsx(GridTitle_default, { ...props });
|
|
12855
12866
|
}
|
|
12856
12867
|
var GridTitleWithProvider_default = GridTitleWithProvider;
|
|
12857
|
-
function getItemName(item) {
|
|
12858
|
-
return item.product?.names
|
|
12868
|
+
function getItemName(item, language) {
|
|
12869
|
+
return getLocalizedValue(item.product?.names, language, "Product");
|
|
12859
12870
|
}
|
|
12860
12871
|
function getItemImageUrl(item) {
|
|
12861
12872
|
const url = item.product?.media?.images?.items?.[0]?.imageVariants?.[0]?.url;
|
|
@@ -12876,6 +12887,7 @@ function getBundleNonLeaders(item) {
|
|
|
12876
12887
|
}
|
|
12877
12888
|
function ItemsOverview(rawProps) {
|
|
12878
12889
|
const props = useInfraProps(rawProps);
|
|
12890
|
+
const language = props.language;
|
|
12879
12891
|
const useTax = !!props.includeTax;
|
|
12880
12892
|
const containerClass = props.itemsOverviewContainerClass || "cart-items-overview";
|
|
12881
12893
|
const itemNameClickable = props.itemNameClickable !== void 0 ? props.itemNameClickable : true;
|
|
@@ -12937,7 +12949,7 @@ function ItemsOverview(rawProps) {
|
|
|
12937
12949
|
{
|
|
12938
12950
|
className: "propeller-items-overview__item-image w-full h-full object-contain p-1.5",
|
|
12939
12951
|
src: getItemImageUrl(item),
|
|
12940
|
-
alt: getItemName(item)
|
|
12952
|
+
alt: getItemName(item, language)
|
|
12941
12953
|
}
|
|
12942
12954
|
) : /* @__PURE__ */ jsx(
|
|
12943
12955
|
"svg",
|
|
@@ -12965,7 +12977,7 @@ function ItemsOverview(rawProps) {
|
|
|
12965
12977
|
] }),
|
|
12966
12978
|
/* @__PURE__ */ jsxs("div", { className: "propeller-items-overview__item-bundle mt-1.5 space-y-1 border-l-2 border-secondary/10 pl-2", children: [
|
|
12967
12979
|
leader ? /* @__PURE__ */ jsxs("div", { className: "propeller-items-overview__item-bundle-leader flex justify-between items-center text-xs", children: [
|
|
12968
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: leader.product.names
|
|
12980
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: getLocalizedValue(leader.product.names, language, "Product") }),
|
|
12969
12981
|
money(bundlePrice(leader.price)) ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground whitespace-nowrap ml-2", children: money(bundlePrice(leader.price)) }) : null
|
|
12970
12982
|
] }) : null,
|
|
12971
12983
|
getBundleNonLeaders(item).map((bundleItem, idx) => /* @__PURE__ */ jsxs(
|
|
@@ -12973,7 +12985,7 @@ function ItemsOverview(rawProps) {
|
|
|
12973
12985
|
{
|
|
12974
12986
|
className: "propeller-items-overview__item-bundle-item flex justify-between items-center text-xs text-muted-foreground",
|
|
12975
12987
|
children: [
|
|
12976
|
-
/* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: bundleItem.product?.names
|
|
12988
|
+
/* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: getLocalizedValue(bundleItem.product?.names, language, "Product") }),
|
|
12977
12989
|
money(bundlePrice(bundleItem.price)) ? /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: money(bundlePrice(bundleItem.price)) }) : null
|
|
12978
12990
|
]
|
|
12979
12991
|
},
|
|
@@ -12994,9 +13006,9 @@ function ItemsOverview(rawProps) {
|
|
|
12994
13006
|
{
|
|
12995
13007
|
className: "propeller-items-overview__item-title font-medium text-sm leading-tight cursor-pointer hover:text-secondary transition-colors line-clamp-2",
|
|
12996
13008
|
onClick: () => handleItemNameClick(item),
|
|
12997
|
-
children: getItemName(item)
|
|
13009
|
+
children: getItemName(item, language)
|
|
12998
13010
|
}
|
|
12999
|
-
) : /* @__PURE__ */ jsx("p", { className: "propeller-items-overview__item-title font-medium text-sm leading-tight line-clamp-2", children: getItemName(item) }),
|
|
13011
|
+
) : /* @__PURE__ */ jsx("p", { className: "propeller-items-overview__item-title font-medium text-sm leading-tight line-clamp-2", children: getItemName(item, language) }),
|
|
13000
13012
|
showPrice ? /* @__PURE__ */ jsx("span", { className: "propeller-items-overview__item-price font-semibold text-sm text-foreground whitespace-nowrap", children: formatItemPrice(lineTotal(item)) }) : null
|
|
13001
13013
|
] }),
|
|
13002
13014
|
showSku && itemSku ? /* @__PURE__ */ jsxs("p", { className: "propeller-items-overview__item-sku text-xs text-muted-foreground mt-0.5", children: [
|
|
@@ -13012,7 +13024,7 @@ function ItemsOverview(rawProps) {
|
|
|
13012
13024
|
{
|
|
13013
13025
|
className: "propeller-items-overview__item-option flex justify-between items-center text-xs text-muted-foreground",
|
|
13014
13026
|
children: [
|
|
13015
|
-
/* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: child.product?.names
|
|
13027
|
+
/* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: getLocalizedValue(child.product?.names, language, "Option") }),
|
|
13016
13028
|
/* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: formatItemPrice(lineTotal(child)) })
|
|
13017
13029
|
]
|
|
13018
13030
|
},
|
|
@@ -13490,22 +13502,22 @@ function OrderActions(rawProps) {
|
|
|
13490
13502
|
);
|
|
13491
13503
|
}
|
|
13492
13504
|
var OrderActions_default = OrderActions;
|
|
13493
|
-
function getProductName3(orderItem) {
|
|
13494
|
-
return orderItem?.product?.names
|
|
13505
|
+
function getProductName3(orderItem, language) {
|
|
13506
|
+
return getLocalizedValue(orderItem?.product?.names, language, "") || orderItem?.name || "Unknown Product";
|
|
13495
13507
|
}
|
|
13496
|
-
function getClusterUrl(orderItem) {
|
|
13508
|
+
function getClusterUrl(orderItem, language) {
|
|
13497
13509
|
const cluster = orderItem?.product?.cluster;
|
|
13498
13510
|
if (!cluster) return "";
|
|
13499
13511
|
const id = cluster.clusterId;
|
|
13500
|
-
const slug = cluster.slugs
|
|
13512
|
+
const slug = getLocalizedValue(cluster.slugs, language, "");
|
|
13501
13513
|
if (!id || !slug) return "";
|
|
13502
13514
|
return `/cluster/${id}/${slug}`;
|
|
13503
13515
|
}
|
|
13504
|
-
function getProductUrl(orderItem) {
|
|
13505
|
-
const cu = getClusterUrl(orderItem);
|
|
13516
|
+
function getProductUrl(orderItem, language) {
|
|
13517
|
+
const cu = getClusterUrl(orderItem, language);
|
|
13506
13518
|
if (cu) return cu;
|
|
13507
13519
|
const id = orderItem?.product?.productId;
|
|
13508
|
-
const slug = orderItem?.product?.slugs
|
|
13520
|
+
const slug = getLocalizedValue(orderItem?.product?.slugs, language, "");
|
|
13509
13521
|
if (id && slug) return `/product/${id}/${slug}`;
|
|
13510
13522
|
return "";
|
|
13511
13523
|
}
|
|
@@ -13520,10 +13532,10 @@ function OrderItemCard(props) {
|
|
|
13520
13532
|
const showDiscount = props.showDiscount !== void 0 ? props.showDiscount : false;
|
|
13521
13533
|
const showStockComponent = props.showStockComponent !== void 0 ? props.showStockComponent : false;
|
|
13522
13534
|
const showItemNotes = props.showItemNotes !== void 0 ? props.showItemNotes : false;
|
|
13523
|
-
const productName = getProductName3(item);
|
|
13535
|
+
const productName = getProductName3(item, props.language);
|
|
13524
13536
|
const productSku = item?.product?.sku || item?.sku || "";
|
|
13525
13537
|
const productImage = item?.product?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "";
|
|
13526
|
-
const productUrl = getProductUrl(item);
|
|
13538
|
+
const productUrl = getProductUrl(item, props.language);
|
|
13527
13539
|
const quantity = item?.quantity || 0;
|
|
13528
13540
|
const priceTotal = item?.priceTotal || 0;
|
|
13529
13541
|
const discount = item?.discount || 0;
|
|
@@ -13638,7 +13650,7 @@ function OrderItemCard(props) {
|
|
|
13638
13650
|
className: "propeller-order-item-card__child-row border-0",
|
|
13639
13651
|
"data-child": "true",
|
|
13640
13652
|
children: [
|
|
13641
|
-
/* @__PURE__ */ jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--product px-6 py-2 pl-28", children: /* @__PURE__ */ jsx("span", { className: "propeller-order-item-card__child-title text-sm text-muted-foreground", children: child.product?.names
|
|
13653
|
+
/* @__PURE__ */ jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--product px-6 py-2 pl-28", children: /* @__PURE__ */ jsx("span", { className: "propeller-order-item-card__child-title text-sm text-muted-foreground", children: getLocalizedValue(child.product?.names, props.language, "") || child.name || "Unknown" }) }),
|
|
13642
13654
|
showQuantity ? /* @__PURE__ */ jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--quantity px-6 py-2 text-center text-sm text-muted-foreground", children: child.quantity || 0 }) : null,
|
|
13643
13655
|
showDiscount ? /* @__PURE__ */ jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--discount px-6 py-2 text-right text-sm text-muted-foreground" }) : null,
|
|
13644
13656
|
showPrice ? /* @__PURE__ */ jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--price px-6 py-2 text-right whitespace-nowrap text-sm text-muted-foreground", children: formatItemPrice(child.priceTotal || 0) }) : null
|
|
@@ -13662,7 +13674,8 @@ function OrderBonusItems(rawProps) {
|
|
|
13662
13674
|
{
|
|
13663
13675
|
orderItem: item,
|
|
13664
13676
|
titleLinkable: false,
|
|
13665
|
-
currency: props.currency
|
|
13677
|
+
currency: props.currency,
|
|
13678
|
+
language: props.language
|
|
13666
13679
|
},
|
|
13667
13680
|
item.id
|
|
13668
13681
|
)) }) })
|
|
@@ -15033,11 +15046,12 @@ function getItemPrice(item, includeTax) {
|
|
|
15033
15046
|
function getProductImage(product) {
|
|
15034
15047
|
return product?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "";
|
|
15035
15048
|
}
|
|
15036
|
-
function getProductName4(product) {
|
|
15037
|
-
return product?.names
|
|
15049
|
+
function getProductName4(product, language) {
|
|
15050
|
+
return getLocalizedValue(product?.names, language, "");
|
|
15038
15051
|
}
|
|
15039
15052
|
function ProductBundles(rawProps) {
|
|
15040
15053
|
const props = useInfraProps(rawProps);
|
|
15054
|
+
const language = props.language;
|
|
15041
15055
|
const currencySymbol = props.currency ?? "\u20AC";
|
|
15042
15056
|
const money = (value) => formatPrice(value, { symbol: currencySymbol });
|
|
15043
15057
|
const [isMounted, setIsMounted] = useState(false);
|
|
@@ -15176,10 +15190,10 @@ function ProductBundles(rawProps) {
|
|
|
15176
15190
|
{
|
|
15177
15191
|
className: "propeller-product-bundles__item-image w-full h-full object-contain p-2",
|
|
15178
15192
|
src: getProductImage(item.product),
|
|
15179
|
-
alt: getProductName4(item.product)
|
|
15193
|
+
alt: getProductName4(item.product, language)
|
|
15180
15194
|
}
|
|
15181
15195
|
) : null }),
|
|
15182
|
-
/* @__PURE__ */ jsx("div", { className: "propeller-product-bundles__item-name text-sm font-medium text-muted-foreground leading-tight mb-1", children: getProductName4(item.product) || "Product " + item.productId }),
|
|
15196
|
+
/* @__PURE__ */ jsx("div", { className: "propeller-product-bundles__item-name text-sm font-medium text-muted-foreground leading-tight mb-1", children: getProductName4(item.product, language) || "Product " + item.productId }),
|
|
15183
15197
|
!hidePrices && item.price ? /* @__PURE__ */ jsxs("div", { className: "propeller-product-bundles__item-price text-sm font-semibold text-foreground", children: [
|
|
15184
15198
|
money(getItemPrice(item, includeTax)),
|
|
15185
15199
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-normal text-muted-foreground ml-1", children: includeTax ? getLabel(props.labels, "inclTax", "incl. VAT") : getLabel(props.labels, "exclTax", "excl. VAT") })
|
|
@@ -15379,7 +15393,7 @@ function ProductBundles(rawProps) {
|
|
|
15379
15393
|
{
|
|
15380
15394
|
className: "propeller-product-bundles__modal-child flex justify-between items-center text-xs text-muted-foreground",
|
|
15381
15395
|
children: [
|
|
15382
|
-
/* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: getProductName4(item.product) || "Product" }),
|
|
15396
|
+
/* @__PURE__ */ jsx("span", { className: "line-clamp-1", children: getProductName4(item.product, language) || "Product" }),
|
|
15383
15397
|
!hidePrices && item.price ? /* @__PURE__ */ jsx("span", { className: "text-foreground-subtle whitespace-nowrap ml-2", children: money(getItemPrice(item, includeTax)) }) : null
|
|
15384
15398
|
]
|
|
15385
15399
|
},
|
|
@@ -18594,7 +18608,7 @@ function mapToSearchBarResult(item, language) {
|
|
|
18594
18608
|
const isCluster = "clusterId" in item;
|
|
18595
18609
|
const displayItem = isCluster ? item.defaultProduct : item;
|
|
18596
18610
|
const id = isCluster ? item.clusterId : item.productId;
|
|
18597
|
-
const slug = item.slugs
|
|
18611
|
+
const slug = getLocalizedValue(item.slugs, language, "");
|
|
18598
18612
|
const url = isCluster ? "/cluster/" + id + "/" + slug : "/product/" + id + "/" + slug;
|
|
18599
18613
|
const priceNet = displayItem?.price?.net || 0;
|
|
18600
18614
|
const priceGross = displayItem?.price?.gross || 0;
|