@propeller-commerce/propeller-v2-react-ui 0.7.0 → 0.8.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 +56 -0
- package/dist/index.cjs +110 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -2
- package/dist/index.d.ts +87 -2
- package/dist/index.js +111 -80
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +1 -1
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +5 -0
- package/dist/pure.d.ts +5 -0
- package/dist/pure.js +1 -1
- package/dist/pure.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getLabel, getLocalizedValue, formatPrice, getClusterSku, getClusterImageUrl, getProductSku, getProductImageUrl, createServices, err, ok, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses,
|
|
2
|
+
import { getLabel, getLocalizedValue, formatPrice, getClusterSku, getClusterImageUrl, isContentHidden, getProductSku, getProductImageUrl, createServices, err, ok, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses, 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';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { ProductStatus, ProductSortField, SortOrder, PurchaseRole, CrossupsellType, CartStatus, CartAddressType, Gender, YesNo, AddressType, PaymentStatuses, OrderSearchFields, OrderItemClass, ProductSearchableField, machineService, AttributeType, OrderSortField, OrderType, OrderDiscountType, BundleCondition } from '@propeller-commerce/propeller-sdk-v2';
|
|
8
|
+
import { User } from 'lucide-react';
|
|
8
9
|
|
|
9
10
|
// src/index.ts
|
|
10
11
|
var PropellerDepsContext = createContext(null);
|
|
@@ -868,6 +869,25 @@ function useCart(options) {
|
|
|
868
869
|
}, [graphqlClient, language, configuration, user]);
|
|
869
870
|
return { cart, cartId, loading, error, checkoutAllowed, resolveCart, addItem, updateItemQuantity, updateItemNotes, deleteItem, addActionCode, removeActionCode, requestAuthorization, processCart, getCrossupsells, getMinQuantity, getStep };
|
|
870
871
|
}
|
|
872
|
+
function buildAddressInput(type, addr) {
|
|
873
|
+
return {
|
|
874
|
+
type,
|
|
875
|
+
firstName: addr.firstName || "",
|
|
876
|
+
lastName: addr.lastName || "",
|
|
877
|
+
street: addr.street || "",
|
|
878
|
+
postalCode: addr.postalCode || "",
|
|
879
|
+
city: addr.city || "",
|
|
880
|
+
...addr.company && { company: addr.company },
|
|
881
|
+
...addr.gender && { gender: addr.gender },
|
|
882
|
+
...addr.middleName && { middleName: addr.middleName },
|
|
883
|
+
...addr.number && { number: addr.number },
|
|
884
|
+
...addr.numberExtension && { numberExtension: addr.numberExtension },
|
|
885
|
+
...addr.country && { country: addr.country },
|
|
886
|
+
...addr.email && { email: addr.email },
|
|
887
|
+
...addr.mobile && { mobile: addr.mobile },
|
|
888
|
+
...addr.phone && { phone: addr.phone }
|
|
889
|
+
};
|
|
890
|
+
}
|
|
871
891
|
function useCheckout(options) {
|
|
872
892
|
const { graphqlClient, user, companyId } = options;
|
|
873
893
|
const language = options.language ?? "NL";
|
|
@@ -908,26 +928,9 @@ function useCheckout(options) {
|
|
|
908
928
|
if (!hasInvoice) {
|
|
909
929
|
const defaultInvoice = getUserDefaultAddress("invoice");
|
|
910
930
|
if (defaultInvoice) {
|
|
911
|
-
const input = {
|
|
912
|
-
type: CartAddressType.INVOICE,
|
|
913
|
-
firstName: defaultInvoice.firstName || "",
|
|
914
|
-
lastName: defaultInvoice.lastName || "",
|
|
915
|
-
street: defaultInvoice.street || "",
|
|
916
|
-
postalCode: defaultInvoice.postalCode || "",
|
|
917
|
-
city: defaultInvoice.city || "",
|
|
918
|
-
company: defaultInvoice.company,
|
|
919
|
-
gender: defaultInvoice.gender,
|
|
920
|
-
middleName: defaultInvoice.middleName,
|
|
921
|
-
number: defaultInvoice.number,
|
|
922
|
-
numberExtension: defaultInvoice.numberExtension,
|
|
923
|
-
country: defaultInvoice.country,
|
|
924
|
-
email: defaultInvoice.email,
|
|
925
|
-
mobile: defaultInvoice.mobile,
|
|
926
|
-
phone: defaultInvoice.phone
|
|
927
|
-
};
|
|
928
931
|
updatedCart = await cartService.updateCartAddress({
|
|
929
932
|
id: updatedCart.cartId,
|
|
930
|
-
input,
|
|
933
|
+
input: buildAddressInput(CartAddressType.INVOICE, defaultInvoice),
|
|
931
934
|
imageVariantFilters,
|
|
932
935
|
imageSearchFilters,
|
|
933
936
|
language
|
|
@@ -937,26 +940,9 @@ function useCheckout(options) {
|
|
|
937
940
|
if (!hasDelivery) {
|
|
938
941
|
const defaultDelivery = getUserDefaultAddress("delivery");
|
|
939
942
|
if (defaultDelivery) {
|
|
940
|
-
const input = {
|
|
941
|
-
type: CartAddressType.DELIVERY,
|
|
942
|
-
firstName: defaultDelivery.firstName || "",
|
|
943
|
-
lastName: defaultDelivery.lastName || "",
|
|
944
|
-
street: defaultDelivery.street || "",
|
|
945
|
-
postalCode: defaultDelivery.postalCode || "",
|
|
946
|
-
city: defaultDelivery.city || "",
|
|
947
|
-
company: defaultDelivery.company,
|
|
948
|
-
gender: defaultDelivery.gender,
|
|
949
|
-
middleName: defaultDelivery.middleName,
|
|
950
|
-
number: defaultDelivery.number,
|
|
951
|
-
numberExtension: defaultDelivery.numberExtension,
|
|
952
|
-
country: defaultDelivery.country,
|
|
953
|
-
email: defaultDelivery.email,
|
|
954
|
-
mobile: defaultDelivery.mobile,
|
|
955
|
-
phone: defaultDelivery.phone
|
|
956
|
-
};
|
|
957
943
|
updatedCart = await cartService.updateCartAddress({
|
|
958
944
|
id: updatedCart.cartId,
|
|
959
|
-
input,
|
|
945
|
+
input: buildAddressInput(CartAddressType.DELIVERY, defaultDelivery),
|
|
960
946
|
imageVariantFilters,
|
|
961
947
|
imageSearchFilters,
|
|
962
948
|
language
|
|
@@ -5045,6 +5031,7 @@ function AddToFavorite(rawProps) {
|
|
|
5045
5031
|
] }) }) : null });
|
|
5046
5032
|
}
|
|
5047
5033
|
var AddToFavorite_default = AddToFavorite;
|
|
5034
|
+
var EMAIL_PATTERN = "[^@\\s]+@[^@\\s.]+(?:\\.[^@\\s.]+)*\\.[A-Za-z]{2,}";
|
|
5048
5035
|
var AddressCardContext = React6.createContext(null);
|
|
5049
5036
|
function useAddressCardContext() {
|
|
5050
5037
|
const ctx = React6.useContext(AddressCardContext);
|
|
@@ -5490,10 +5477,7 @@ function AddressCard(rawProps) {
|
|
|
5490
5477
|
] }),
|
|
5491
5478
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
5492
5479
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
5493
|
-
/* @__PURE__ */
|
|
5494
|
-
getLabel(props.labels, "email", "Email"),
|
|
5495
|
-
" *"
|
|
5496
|
-
] }),
|
|
5480
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium mb-1", children: getLabel(props.labels, "email", "Email") }),
|
|
5497
5481
|
/* @__PURE__ */ jsx(
|
|
5498
5482
|
"input",
|
|
5499
5483
|
{
|
|
@@ -5503,7 +5487,7 @@ function AddressCard(rawProps) {
|
|
|
5503
5487
|
onChange: (e) => {
|
|
5504
5488
|
setEditEmail(e.target.value);
|
|
5505
5489
|
},
|
|
5506
|
-
|
|
5490
|
+
pattern: EMAIL_PATTERN
|
|
5507
5491
|
}
|
|
5508
5492
|
)
|
|
5509
5493
|
] }),
|
|
@@ -5783,10 +5767,7 @@ function AddressCard(rawProps) {
|
|
|
5783
5767
|
] }),
|
|
5784
5768
|
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
5785
5769
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
5786
|
-
/* @__PURE__ */
|
|
5787
|
-
getLabel(props.labels, "email", "Email"),
|
|
5788
|
-
" *"
|
|
5789
|
-
] }),
|
|
5770
|
+
/* @__PURE__ */ jsx("label", { className: "block text-sm font-medium mb-1", children: getLabel(props.labels, "email", "Email") }),
|
|
5790
5771
|
/* @__PURE__ */ jsx(
|
|
5791
5772
|
"input",
|
|
5792
5773
|
{
|
|
@@ -5796,7 +5777,7 @@ function AddressCard(rawProps) {
|
|
|
5796
5777
|
onChange: (e) => {
|
|
5797
5778
|
setEditEmail(e.target.value);
|
|
5798
5779
|
},
|
|
5799
|
-
|
|
5780
|
+
pattern: EMAIL_PATTERN
|
|
5800
5781
|
}
|
|
5801
5782
|
)
|
|
5802
5783
|
] }),
|
|
@@ -7958,6 +7939,8 @@ var RESOLVE_SPEC = {
|
|
|
7958
7939
|
includeTax: { infra: "includeTax" },
|
|
7959
7940
|
language: { infra: "language", default: "NL" },
|
|
7960
7941
|
currency: { infra: "currency", default: "\u20AC" },
|
|
7942
|
+
user: { infra: "user", default: null },
|
|
7943
|
+
portalMode: { infra: "portalMode" },
|
|
7961
7944
|
columns: { grid: "columns", default: 3 },
|
|
7962
7945
|
showPrice: { grid: "showPrice" },
|
|
7963
7946
|
showStock: { grid: "showStock" },
|
|
@@ -8001,9 +7984,10 @@ function ClusterCard(rawProps) {
|
|
|
8001
7984
|
const textLabelValues = resolveAttributeValues(cluster, props.textLabels).map((value) => ({
|
|
8002
7985
|
value
|
|
8003
7986
|
}));
|
|
8004
|
-
const
|
|
7987
|
+
const contentHidden = isContentHidden(props.portalMode, props.user);
|
|
7988
|
+
const defaultProductInventory = contentHidden ? void 0 : cluster?.defaultProduct?.inventory;
|
|
8005
7989
|
const useTax = props.includeTax !== void 0 ? !!props.includeTax : false;
|
|
8006
|
-
const priceObj = cluster?.defaultProduct?.price;
|
|
7990
|
+
const priceObj = contentHidden ? void 0 : cluster?.defaultProduct?.price;
|
|
8007
7991
|
const priceValue = useTax ? priceObj?.net : priceObj?.gross;
|
|
8008
7992
|
const clusterPrice = props.showPrice === false ? "" : formatPrice(priceValue, { symbol: props.currency ?? "\u20AC" });
|
|
8009
7993
|
function handleClusterClick(e) {
|
|
@@ -8408,6 +8392,23 @@ function MachineCard(props) {
|
|
|
8408
8392
|
}
|
|
8409
8393
|
);
|
|
8410
8394
|
}
|
|
8395
|
+
function LoginToOrderButton(props) {
|
|
8396
|
+
return /* @__PURE__ */ jsxs(
|
|
8397
|
+
"button",
|
|
8398
|
+
{
|
|
8399
|
+
type: "button",
|
|
8400
|
+
className: `propeller-login-to-order inline-flex items-center justify-center gap-2 h-10 px-4 w-full rounded-control bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 transition-opacity ${props.className || ""}`,
|
|
8401
|
+
onClick: () => {
|
|
8402
|
+
if (props.onLoginClick) props.onLoginClick();
|
|
8403
|
+
},
|
|
8404
|
+
children: [
|
|
8405
|
+
/* @__PURE__ */ jsx(User, { className: "propeller-login-to-order__icon w-4 h-4", "aria-hidden": "true" }),
|
|
8406
|
+
getLabel(props.labels, "loginToOrder", "Log in to order")
|
|
8407
|
+
]
|
|
8408
|
+
}
|
|
8409
|
+
);
|
|
8410
|
+
}
|
|
8411
|
+
var LoginToOrderButton_default = LoginToOrderButton;
|
|
8411
8412
|
function ProductPriceDisplay(props) {
|
|
8412
8413
|
function isHidden2() {
|
|
8413
8414
|
return isContentHidden(props.portalMode, props.user);
|
|
@@ -8458,7 +8459,7 @@ function ProductPriceDisplay(props) {
|
|
|
8458
8459
|
return props.includeTax ? getLabel(props.labels, "exclTax", "excl. VAT") : getLabel(props.labels, "inclTax", "incl. VAT");
|
|
8459
8460
|
}
|
|
8460
8461
|
return /* @__PURE__ */ jsxs("div", { className: `propeller-product-price ${props.className || ""}`, "data-hidden": isHidden2() ? "true" : "false", children: [
|
|
8461
|
-
isHidden2() ? /* @__PURE__ */ jsx("p", { className: "propeller-product-price__login-prompt text-sm text-muted-foreground italic", children: getLabel(props.labels, "loginToSeePrices", "Log in to see prices") }) : null,
|
|
8462
|
+
isHidden2() && props.showLoginPrompt !== false ? /* @__PURE__ */ jsx("p", { className: "propeller-product-price__login-prompt text-sm text-muted-foreground italic", children: getLabel(props.labels, "loginToSeePrices", "Log in to see prices") }) : null,
|
|
8462
8463
|
!isHidden2() && !!getLeadingPrice() ? /* @__PURE__ */ jsxs("div", { className: "propeller-product-price__content flex flex-col gap-0.5", children: [
|
|
8463
8464
|
/* @__PURE__ */ jsxs("div", { className: "propeller-product-price__primary flex items-baseline gap-2", children: [
|
|
8464
8465
|
/* @__PURE__ */ jsx(
|
|
@@ -8501,6 +8502,7 @@ var RESOLVE_SPEC2 = {
|
|
|
8501
8502
|
companyId: { infra: "companyId" },
|
|
8502
8503
|
language: { infra: "language", default: "NL" },
|
|
8503
8504
|
includeTax: { infra: "includeTax" },
|
|
8505
|
+
portalMode: { infra: "portalMode" },
|
|
8504
8506
|
configuration: { infra: "configuration" },
|
|
8505
8507
|
columns: { grid: "columns", default: 3 },
|
|
8506
8508
|
showPrice: { grid: "showPrice" },
|
|
@@ -8522,6 +8524,7 @@ var RESOLVE_SPEC2 = {
|
|
|
8522
8524
|
onCartCreated: { grid: "onCartCreated" },
|
|
8523
8525
|
afterAddToCart: { grid: "afterAddToCart" },
|
|
8524
8526
|
onProceedToCheckout: { grid: "onProceedToCheckout" },
|
|
8527
|
+
onLoginClick: { grid: "onLoginClick" },
|
|
8525
8528
|
onRequestQuoteClick: { grid: "onRequestQuoteClick" },
|
|
8526
8529
|
onProductClick: { grid: "onProductClick" },
|
|
8527
8530
|
onToggleFavorite: {
|
|
@@ -8553,6 +8556,9 @@ function ProductCardRoot(rawProps) {
|
|
|
8553
8556
|
const language = props.language || "NL";
|
|
8554
8557
|
const product = props.product;
|
|
8555
8558
|
const isRow = props.columns === 1;
|
|
8559
|
+
const contentHidden = isContentHidden(props.portalMode, props.user);
|
|
8560
|
+
const showStock = !!props.showStock && !contentHidden;
|
|
8561
|
+
const showCta = props.allowAddToCart !== false || contentHidden;
|
|
8556
8562
|
const name = getProductName(product, language);
|
|
8557
8563
|
const sku = getProductSku(product);
|
|
8558
8564
|
const imageUrl = getProductImageUrl(product);
|
|
@@ -8623,10 +8629,10 @@ function ProductCardRoot(rawProps) {
|
|
|
8623
8629
|
] }) }),
|
|
8624
8630
|
/* @__PURE__ */ jsxs("div", { className: "propeller-product-card__footer w-full md:w-auto flex flex-col gap-2 md:flex-row md:items-center md:gap-3 px-4 py-2 md:py-0 border-t md:border-t-0 border-border-subtle", children: [
|
|
8625
8631
|
/* @__PURE__ */ jsxs("div", { className: "propeller-product-card__footer-meta flex items-center justify-between gap-3 md:contents", children: [
|
|
8626
|
-
|
|
8632
|
+
showStock && !!product.inventory ? /* @__PURE__ */ jsx(ProductCardStock, {}) : null,
|
|
8627
8633
|
props.showPrice !== false && !!product?.price ? /* @__PURE__ */ jsx(ProductCardPrice, { priceSize: "text-sm" }) : null
|
|
8628
8634
|
] }),
|
|
8629
|
-
|
|
8635
|
+
showCta ? /* @__PURE__ */ jsx("div", { className: "propeller-product-card__cta w-full md:w-auto md:flex-shrink-0 md:ml-auto", children: /* @__PURE__ */ jsx(ProductCardAddToCart, {}) }) : null
|
|
8630
8636
|
] })
|
|
8631
8637
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8632
8638
|
/* @__PURE__ */ jsxs("div", { className: "propeller-product-card__body flex flex-1 flex-col gap-1.5 p-3 sm:gap-2 sm:p-4", children: [
|
|
@@ -8634,16 +8640,16 @@ function ProductCardRoot(rawProps) {
|
|
|
8634
8640
|
props.showName !== false ? /* @__PURE__ */ jsx(ProductCardName, { linkable: true }) : null,
|
|
8635
8641
|
/* @__PURE__ */ jsx(ProductCardBelowName, {}),
|
|
8636
8642
|
textLabelValues.length > 0 ? /* @__PURE__ */ jsx(ProductCardTextLabels, {}) : null,
|
|
8637
|
-
|
|
8643
|
+
showStock && !!product.inventory ? /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(ProductCardStock, {}) }) : null,
|
|
8638
8644
|
props.showManufacturer && manufacturer ? /* @__PURE__ */ jsx(ProductCardManufacturer, {}) : null,
|
|
8639
8645
|
props.showShortDescription && shortDescription ? /* @__PURE__ */ jsx(ProductCardShortDescription, {}) : null,
|
|
8640
8646
|
props.showPrice !== false && !!product?.price ? /* @__PURE__ */ jsx("div", { className: "propeller-product-card__price mt-auto pt-1 hidden md:block", children: /* @__PURE__ */ jsx(ProductCardPrice, { priceSize: "text-base sm:text-lg" }) }) : null
|
|
8641
8647
|
] }),
|
|
8642
|
-
|
|
8643
|
-
|
|
8648
|
+
showStock && !!product.inventory || props.showPrice !== false && !!product?.price ? /* @__PURE__ */ jsxs("div", { className: "propeller-product-card__footer-meta flex flex-wrap items-center justify-between gap-x-2 gap-y-1 px-3 pt-1 sm:px-4 md:hidden", children: [
|
|
8649
|
+
showStock && !!product.inventory ? /* @__PURE__ */ jsx(ProductCardStock, {}) : null,
|
|
8644
8650
|
props.showPrice !== false && !!product?.price ? /* @__PURE__ */ jsx(ProductCardPrice, { priceSize: "text-base", className: "propeller-product-card__price min-w-0 text-right" }) : null
|
|
8645
8651
|
] }) : null,
|
|
8646
|
-
|
|
8652
|
+
showCta ? /* @__PURE__ */ jsx("div", { className: "propeller-product-card__cta px-3 pb-3 pt-2 sm:px-4 sm:pb-4", children: /* @__PURE__ */ jsx(ProductCardAddToCart, {}) }) : null
|
|
8647
8653
|
] })
|
|
8648
8654
|
]
|
|
8649
8655
|
}
|
|
@@ -8842,12 +8848,25 @@ function ProductCardPrice(props) {
|
|
|
8842
8848
|
price: product.price,
|
|
8843
8849
|
includeTax: derived.useTax,
|
|
8844
8850
|
priceSize: props.priceSize ?? "text-base sm:text-lg",
|
|
8845
|
-
labels: resolved.priceLabels
|
|
8851
|
+
labels: resolved.priceLabels,
|
|
8852
|
+
portalMode: resolved.portalMode,
|
|
8853
|
+
user: resolved.user,
|
|
8854
|
+
showLoginPrompt: false
|
|
8846
8855
|
}
|
|
8847
8856
|
) });
|
|
8848
8857
|
}
|
|
8849
8858
|
function ProductCardAddToCart(props) {
|
|
8850
8859
|
const { product, resolved } = useProductCard();
|
|
8860
|
+
if (isContentHidden(resolved.portalMode, resolved.user)) {
|
|
8861
|
+
return /* @__PURE__ */ jsx(
|
|
8862
|
+
LoginToOrderButton_default,
|
|
8863
|
+
{
|
|
8864
|
+
className: props.className,
|
|
8865
|
+
labels: resolved.addToCartLabels,
|
|
8866
|
+
onLoginClick: resolved.onLoginClick
|
|
8867
|
+
}
|
|
8868
|
+
);
|
|
8869
|
+
}
|
|
8851
8870
|
const InjectedAddToCart = resolved.addToCartComponent;
|
|
8852
8871
|
if (InjectedAddToCart) {
|
|
8853
8872
|
return /* @__PURE__ */ jsx(
|
|
@@ -8980,9 +8999,8 @@ function ProductGrid(rawProps) {
|
|
|
8980
8999
|
return !!props.isLoading || isLoading;
|
|
8981
9000
|
}
|
|
8982
9001
|
function showAddToCart() {
|
|
8983
|
-
const mode = props.portalMode || "open";
|
|
8984
9002
|
const allow = props.allowAddToCart !== false;
|
|
8985
|
-
return
|
|
9003
|
+
return !isContentHidden(props.portalMode, props.user) && allow;
|
|
8986
9004
|
}
|
|
8987
9005
|
function getSkeletonItems() {
|
|
8988
9006
|
const cols = props.columns || 3;
|
|
@@ -9009,6 +9027,7 @@ function ProductGrid(rawProps) {
|
|
|
9009
9027
|
onCartCreated: props.onCartCreated,
|
|
9010
9028
|
afterAddToCart: props.afterAddToCart,
|
|
9011
9029
|
onProceedToCheckout: props.onProceedToCheckout,
|
|
9030
|
+
onLoginClick: props.onLoginClick,
|
|
9012
9031
|
onRequestQuoteClick: props.onRequestQuoteClick,
|
|
9013
9032
|
onToggleFavorite: (item, isFav) => props.onToggleFavorite?.(item, isFav),
|
|
9014
9033
|
onProductClick: (p) => props.onProductClick?.(p),
|
|
@@ -9657,7 +9676,7 @@ function GridToolbar(rawProps) {
|
|
|
9657
9676
|
const [currentSortOrder, setCurrentSortOrder] = useState(SortOrder.DESC);
|
|
9658
9677
|
const [currentOffset, setCurrentOffset] = useState(12);
|
|
9659
9678
|
const [currentViewMode, setCurrentViewMode] = useState("grid");
|
|
9660
|
-
function
|
|
9679
|
+
function getLabel56(key) {
|
|
9661
9680
|
const labels = props.labels || {};
|
|
9662
9681
|
return labels[key] !== void 0 ? labels[key] : DEFAULT_LABELS[key] || key;
|
|
9663
9682
|
}
|
|
@@ -9736,7 +9755,7 @@ function GridToolbar(rawProps) {
|
|
|
9736
9755
|
/* @__PURE__ */ jsx("div", { className: "propeller-grid-toolbar__count text-sm text-muted-foreground font-medium", children: props.itemsFound > 0 ? /* @__PURE__ */ jsxs("span", { children: [
|
|
9737
9756
|
props.itemsFound,
|
|
9738
9757
|
"\xA0",
|
|
9739
|
-
props.itemsFound === 1 ?
|
|
9758
|
+
props.itemsFound === 1 ? getLabel56("productSingular") : getLabel56("productPlural")
|
|
9740
9759
|
] }) : null }),
|
|
9741
9760
|
/* @__PURE__ */ jsxs("div", { className: "propeller-grid-toolbar__controls flex flex-wrap items-center gap-3", children: [
|
|
9742
9761
|
/* @__PURE__ */ jsx(
|
|
@@ -9747,7 +9766,7 @@ function GridToolbar(rawProps) {
|
|
|
9747
9766
|
onChange: (e) => handleOffsetChange(parseInt(e.target.value)),
|
|
9748
9767
|
children: getOffsetOptions()?.map((n) => /* @__PURE__ */ jsxs("option", { value: n, children: [
|
|
9749
9768
|
n,
|
|
9750
|
-
|
|
9769
|
+
getLabel56("perPage")
|
|
9751
9770
|
] }, n))
|
|
9752
9771
|
}
|
|
9753
9772
|
),
|
|
@@ -9763,7 +9782,7 @@ function GridToolbar(rawProps) {
|
|
|
9763
9782
|
{
|
|
9764
9783
|
value: field,
|
|
9765
9784
|
disabled: field === "PRICE" && isPriceSortDisabled(),
|
|
9766
|
-
children:
|
|
9785
|
+
children: getLabel56(field)
|
|
9767
9786
|
},
|
|
9768
9787
|
field
|
|
9769
9788
|
))
|
|
@@ -9776,8 +9795,8 @@ function GridToolbar(rawProps) {
|
|
|
9776
9795
|
value: currentSortOrder,
|
|
9777
9796
|
onChange: (e) => handleSortOrderChange(e.target.value),
|
|
9778
9797
|
children: [
|
|
9779
|
-
/* @__PURE__ */ jsx("option", { value: SortOrder.ASC, children:
|
|
9780
|
-
/* @__PURE__ */ jsx("option", { value: SortOrder.DESC, children:
|
|
9798
|
+
/* @__PURE__ */ jsx("option", { value: SortOrder.ASC, children: getLabel56("ASC") }),
|
|
9799
|
+
/* @__PURE__ */ jsx("option", { value: SortOrder.DESC, children: getLabel56("DESC") })
|
|
9781
9800
|
]
|
|
9782
9801
|
}
|
|
9783
9802
|
),
|
|
@@ -9787,7 +9806,7 @@ function GridToolbar(rawProps) {
|
|
|
9787
9806
|
type: "button",
|
|
9788
9807
|
className: "propeller-grid-toolbar__view-toggle h-9 w-9 flex items-center justify-center rounded-control border border-input bg-transparent hover:bg-accent hover:text-accent-foreground transition-colors",
|
|
9789
9808
|
onClick: (event) => handleViewChange(),
|
|
9790
|
-
title: currentViewMode === "grid" ?
|
|
9809
|
+
title: currentViewMode === "grid" ? getLabel56("switchToList") : getLabel56("switchToGrid"),
|
|
9791
9810
|
children: [
|
|
9792
9811
|
currentViewMode === "grid" ? /* @__PURE__ */ jsxs(
|
|
9793
9812
|
"svg",
|
|
@@ -9845,7 +9864,7 @@ function GridToolbar(rawProps) {
|
|
|
9845
9864
|
onClick: (event) => {
|
|
9846
9865
|
if (props.onClearFilters) props.onClearFilters();
|
|
9847
9866
|
},
|
|
9848
|
-
children:
|
|
9867
|
+
children: getLabel56("clearAll")
|
|
9849
9868
|
}
|
|
9850
9869
|
),
|
|
9851
9870
|
props.priceFilterMin !== void 0 || props.priceFilterMax !== void 0 ? /* @__PURE__ */ jsxs(
|
|
@@ -9856,7 +9875,7 @@ function GridToolbar(rawProps) {
|
|
|
9856
9875
|
if (props.onPriceFilterRemove) props.onPriceFilterRemove();
|
|
9857
9876
|
},
|
|
9858
9877
|
children: [
|
|
9859
|
-
|
|
9878
|
+
getLabel56("price"),
|
|
9860
9879
|
": \u20AC",
|
|
9861
9880
|
props.priceFilterMin ?? 0,
|
|
9862
9881
|
" \u2013 \u20AC",
|
|
@@ -9893,7 +9912,7 @@ var DEFAULT_LABELS2 = {
|
|
|
9893
9912
|
of: "of"
|
|
9894
9913
|
};
|
|
9895
9914
|
function GridPagination(props) {
|
|
9896
|
-
function
|
|
9915
|
+
function getLabel56(key) {
|
|
9897
9916
|
const labels = props.labels || {};
|
|
9898
9917
|
return labels[key] !== void 0 ? labels[key] : DEFAULT_LABELS2[key] || key;
|
|
9899
9918
|
}
|
|
@@ -9966,15 +9985,15 @@ function GridPagination(props) {
|
|
|
9966
9985
|
className: "propeller-grid-pagination__btn propeller-grid-pagination__btn--prev inline-flex items-center rounded-control border border-input bg-card px-4 py-2 text-sm font-medium text-foreground shadow-sm hover:bg-surface-hover disabled:opacity-40 disabled:cursor-not-allowed",
|
|
9967
9986
|
disabled: currentPage === 1,
|
|
9968
9987
|
onClick: () => handlePageChange(currentPage - 1),
|
|
9969
|
-
children:
|
|
9988
|
+
children: getLabel56("previous")
|
|
9970
9989
|
}
|
|
9971
9990
|
),
|
|
9972
9991
|
/* @__PURE__ */ jsxs("span", { className: "propeller-grid-pagination__info px-2 text-sm font-medium text-muted-foreground", children: [
|
|
9973
|
-
|
|
9992
|
+
getLabel56("page"),
|
|
9974
9993
|
"\xA0",
|
|
9975
9994
|
currentPage,
|
|
9976
9995
|
"\xA0",
|
|
9977
|
-
|
|
9996
|
+
getLabel56("of"),
|
|
9978
9997
|
"\xA0",
|
|
9979
9998
|
totalPages
|
|
9980
9999
|
] }),
|
|
@@ -9985,7 +10004,7 @@ function GridPagination(props) {
|
|
|
9985
10004
|
className: "propeller-grid-pagination__btn propeller-grid-pagination__btn--next inline-flex items-center rounded-control border border-input bg-card px-4 py-2 text-sm font-medium text-foreground shadow-sm hover:bg-surface-hover disabled:opacity-40 disabled:cursor-not-allowed",
|
|
9986
10005
|
disabled: currentPage === totalPages,
|
|
9987
10006
|
onClick: () => handlePageChange(currentPage + 1),
|
|
9988
|
-
children:
|
|
10007
|
+
children: getLabel56("next")
|
|
9989
10008
|
}
|
|
9990
10009
|
)
|
|
9991
10010
|
] }) : null,
|
|
@@ -9997,7 +10016,7 @@ function GridPagination(props) {
|
|
|
9997
10016
|
className: "propeller-grid-pagination__btn propeller-grid-pagination__btn--prev inline-flex items-center rounded-control border border-input bg-card px-3 py-2 text-sm font-medium text-foreground shadow-sm hover:bg-surface-hover disabled:opacity-40 disabled:cursor-not-allowed",
|
|
9998
10017
|
disabled: currentPage === 1,
|
|
9999
10018
|
onClick: () => handlePageChange(currentPage - 1),
|
|
10000
|
-
children:
|
|
10019
|
+
children: getLabel56("previous")
|
|
10001
10020
|
}
|
|
10002
10021
|
),
|
|
10003
10022
|
getFullPages().map((item, idx) => /* @__PURE__ */ jsx(
|
|
@@ -10024,7 +10043,7 @@ function GridPagination(props) {
|
|
|
10024
10043
|
className: "propeller-grid-pagination__btn propeller-grid-pagination__btn--next inline-flex items-center rounded-control border border-input bg-card px-3 py-2 text-sm font-medium text-foreground shadow-sm hover:bg-surface-hover disabled:opacity-40 disabled:cursor-not-allowed",
|
|
10025
10044
|
disabled: currentPage === totalPages,
|
|
10026
10045
|
onClick: () => handlePageChange(currentPage + 1),
|
|
10027
|
-
children:
|
|
10046
|
+
children: getLabel56("next")
|
|
10028
10047
|
}
|
|
10029
10048
|
)
|
|
10030
10049
|
] }) : null
|
|
@@ -10516,13 +10535,14 @@ function ClusterOptions(props) {
|
|
|
10516
10535
|
function getOptionsForRender() {
|
|
10517
10536
|
const options = props.options || [];
|
|
10518
10537
|
const sel = selectedProductIds;
|
|
10538
|
+
const hidePrices = isContentHidden(props.portalMode, props.user);
|
|
10519
10539
|
return options.filter((option) => option.hidden !== YesNo.Y).map((option) => {
|
|
10520
10540
|
const idStr = option.id.toString();
|
|
10521
10541
|
const selectedProductId = sel[idStr] || "";
|
|
10522
10542
|
const products = (option.products || []).map((p) => ({
|
|
10523
10543
|
productId: p.productId,
|
|
10524
10544
|
productIdStr: p.productId.toString(),
|
|
10525
|
-
label: `${getProductName2(p)} \u2014 ${formatPrice9(p.price?.gross || 0, props.currency ?? "\u20AC")}`
|
|
10545
|
+
label: hidePrices ? getProductName2(p) : `${getProductName2(p)} \u2014 ${formatPrice9(p.price?.gross || 0, props.currency ?? "\u20AC")}`
|
|
10526
10546
|
}));
|
|
10527
10547
|
let previewImageUrl = "";
|
|
10528
10548
|
let previewName = "";
|
|
@@ -10534,7 +10554,7 @@ function ClusterOptions(props) {
|
|
|
10534
10554
|
if (selectedProduct) {
|
|
10535
10555
|
previewImageUrl = getProductImageUrl4(selectedProduct);
|
|
10536
10556
|
previewName = getProductName2(selectedProduct);
|
|
10537
|
-
previewPrice = formatPrice9(selectedProduct.price?.gross || 0, props.currency ?? "\u20AC");
|
|
10557
|
+
previewPrice = hidePrices ? "" : formatPrice9(selectedProduct.price?.gross || 0, props.currency ?? "\u20AC");
|
|
10538
10558
|
}
|
|
10539
10559
|
}
|
|
10540
10560
|
const isRequired = option.isRequired === YesNo.Y;
|
|
@@ -15006,11 +15026,11 @@ function ProductBundles(rawProps) {
|
|
|
15006
15026
|
children: addingBundleId === bundle.id ? getLabel(props.labels, "adding", "Adding...") : getLabel(props.labels, "addToCart", "In cart")
|
|
15007
15027
|
}
|
|
15008
15028
|
)
|
|
15009
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "propeller-product-bundles__login-prompt text-center text-sm text-muted-foreground py-2", children: getLabel(
|
|
15029
|
+
] }) : props.showLoginPrompt !== false ? /* @__PURE__ */ jsx("div", { className: "propeller-product-bundles__login-prompt text-center text-sm text-muted-foreground py-2", children: getLabel(
|
|
15010
15030
|
props.labels,
|
|
15011
15031
|
"loginToSeePrices",
|
|
15012
15032
|
"Log in to see prices and add to cart"
|
|
15013
|
-
) })
|
|
15033
|
+
) }) : null
|
|
15014
15034
|
] })
|
|
15015
15035
|
] })
|
|
15016
15036
|
},
|
|
@@ -15793,6 +15813,7 @@ function ProductInfoPrice(props = {}) {
|
|
|
15793
15813
|
function ProductInfoStock(props = {}) {
|
|
15794
15814
|
const { product, resolved, derived } = useProductInfoContext();
|
|
15795
15815
|
if (!product.inventory) return null;
|
|
15816
|
+
if (isContentHidden(derived.portalMode, resolved.user)) return null;
|
|
15796
15817
|
const Injected = resolved.stockComponent;
|
|
15797
15818
|
if (Injected) {
|
|
15798
15819
|
return /* @__PURE__ */ jsx(
|
|
@@ -15819,6 +15840,16 @@ function ProductInfoStock(props = {}) {
|
|
|
15819
15840
|
}
|
|
15820
15841
|
function ProductInfoAddToCart(props = {}) {
|
|
15821
15842
|
const { product, resolved, derived } = useProductInfoContext();
|
|
15843
|
+
if (isContentHidden(derived.portalMode, resolved.user)) {
|
|
15844
|
+
return /* @__PURE__ */ jsx(
|
|
15845
|
+
LoginToOrderButton_default,
|
|
15846
|
+
{
|
|
15847
|
+
className: props.className,
|
|
15848
|
+
labels: derived.labels,
|
|
15849
|
+
onLoginClick: resolved.onLoginClick
|
|
15850
|
+
}
|
|
15851
|
+
);
|
|
15852
|
+
}
|
|
15822
15853
|
const Injected = resolved.addToCartComponent;
|
|
15823
15854
|
if (Injected) {
|
|
15824
15855
|
return /* @__PURE__ */ jsx(Injected, { product, labels: derived.labels, className: props.className });
|
|
@@ -18653,6 +18684,6 @@ function UserDetails(rawProps) {
|
|
|
18653
18684
|
}
|
|
18654
18685
|
var UserDetails_default = UserDetails;
|
|
18655
18686
|
|
|
18656
|
-
export { AccountIconAndMenu_default as AccountIconAndMenu, ActionCode_default as ActionCode, AddToCart_default as AddToCart, AddToFavorite_default as AddToFavorite, AddressCard_default as AddressCard, AddressSelector_default as AddressSelector, BreadcrumbsWithProvider_default as Breadcrumbs, CartBonusItems_default as CartBonusItems, CartCarriers_default as CartCarriers, CartIconAndSidebar_default as CartIconAndSidebar, CartItem_default as CartItem, CartOverview_default as CartOverview, CartPaymethods_default as CartPaymethods, CartSummary_default as CartSummary, CategoryDescription_default as CategoryDescription, CategoryShortDescriptionWithProvider_default as CategoryShortDescription, ClusterCard_default as ClusterCard, ClusterConfigurator_default as ClusterConfigurator, ClusterInfo_default as ClusterInfo, ClusterOptions_default as ClusterOptions, CompanySwitcher_default as CompanySwitcher, AddToCart_default as DefaultAddToCart, AddToFavorite_default as DefaultAddToFavorite, ItemStock_default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices_default as DefaultProductBulkPrices, ProductBundles_default as DefaultProductBundles, DefaultProductImage, ProductPrice_default as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate_default as DeliveryDate, FavoriteListDetails_default as FavoriteListDetails, FavoriteListItem_default as FavoriteListItem, FavoriteLists_default as FavoriteLists, ForgotPassword_default as ForgotPassword, GridFilters_default as GridFilters, GridFiltersPanel, GridPagination_default as GridPagination, GridTitleWithProvider_default as GridTitle, GridToolbar_default as GridToolbar, ItemStock_default as ItemStock, ItemsOverview_default as ItemsOverview, LoginForm_default as LoginForm, MachineCard, MachineGrid, Menu_default as Menu, OrderActions_default as OrderActions, OrderBonusItems_default as OrderBonusItems, OrderItemCard_default as OrderItemCard, OrderList_default as OrderList, OrderShipments_default as OrderShipments, OrderSummary_default as OrderSummary, OrderTotals_default as OrderTotals, PriceToggle_default as PriceToggle, ProductBulkPricesWithProvider_default as ProductBulkPrices, ProductBundles_default as ProductBundles, ProductCard_default as ProductCard, ProductDescription_default as ProductDescription, ProductDownloads_default as ProductDownloads, ProductGallery_default as ProductGallery, ProductGrid_default as ProductGrid, ProductGridConfigProvider, ProductInfo_default as ProductInfo, ProductPriceWithProvider_default as ProductPrice, ProductShortDescriptionWithProvider_default as ProductShortDescription, ProductSlider_default as ProductSlider, ProductSpecifications_default as ProductSpecifications, ProductTabs_default as ProductTabs, ProductVideos_default as ProductVideos, PropellerDepsProvider, PropellerProvider, PurchaseAuthorizationConfigurator_default as PurchaseAuthorizationConfigurator, PurchaseAuthorizationRequests_default as PurchaseAuthorizationRequests, QuickOrder, QuoteActions_default as QuoteActions, RegisterForm_default as RegisterForm, SearchBar_default as SearchBar, UserDetails_default as UserDetails, buildRootMachinesQuery, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useQuickOrder, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|
|
18687
|
+
export { AccountIconAndMenu_default as AccountIconAndMenu, ActionCode_default as ActionCode, AddToCart_default as AddToCart, AddToFavorite_default as AddToFavorite, AddressCard_default as AddressCard, AddressSelector_default as AddressSelector, BreadcrumbsWithProvider_default as Breadcrumbs, CartBonusItems_default as CartBonusItems, CartCarriers_default as CartCarriers, CartIconAndSidebar_default as CartIconAndSidebar, CartItem_default as CartItem, CartOverview_default as CartOverview, CartPaymethods_default as CartPaymethods, CartSummary_default as CartSummary, CategoryDescription_default as CategoryDescription, CategoryShortDescriptionWithProvider_default as CategoryShortDescription, ClusterCard_default as ClusterCard, ClusterConfigurator_default as ClusterConfigurator, ClusterInfo_default as ClusterInfo, ClusterOptions_default as ClusterOptions, CompanySwitcher_default as CompanySwitcher, AddToCart_default as DefaultAddToCart, AddToFavorite_default as DefaultAddToFavorite, ItemStock_default as DefaultItemStock, DefaultProductBadges, ProductBulkPrices_default as DefaultProductBulkPrices, ProductBundles_default as DefaultProductBundles, DefaultProductImage, ProductPrice_default as DefaultProductPrice, DefaultProductSurcharges, DeliveryDate_default as DeliveryDate, FavoriteListDetails_default as FavoriteListDetails, FavoriteListItem_default as FavoriteListItem, FavoriteLists_default as FavoriteLists, ForgotPassword_default as ForgotPassword, GridFilters_default as GridFilters, GridFiltersPanel, GridPagination_default as GridPagination, GridTitleWithProvider_default as GridTitle, GridToolbar_default as GridToolbar, ItemStock_default as ItemStock, ItemsOverview_default as ItemsOverview, LoginForm_default as LoginForm, LoginToOrderButton_default as LoginToOrderButton, MachineCard, MachineGrid, Menu_default as Menu, OrderActions_default as OrderActions, OrderBonusItems_default as OrderBonusItems, OrderItemCard_default as OrderItemCard, OrderList_default as OrderList, OrderShipments_default as OrderShipments, OrderSummary_default as OrderSummary, OrderTotals_default as OrderTotals, PriceToggle_default as PriceToggle, ProductBulkPricesWithProvider_default as ProductBulkPrices, ProductBundles_default as ProductBundles, ProductCard_default as ProductCard, ProductDescription_default as ProductDescription, ProductDownloads_default as ProductDownloads, ProductGallery_default as ProductGallery, ProductGrid_default as ProductGrid, ProductGridConfigProvider, ProductInfo_default as ProductInfo, ProductPriceWithProvider_default as ProductPrice, ProductShortDescriptionWithProvider_default as ProductShortDescription, ProductSlider_default as ProductSlider, ProductSpecifications_default as ProductSpecifications, ProductTabs_default as ProductTabs, ProductVideos_default as ProductVideos, PropellerDepsProvider, PropellerProvider, PurchaseAuthorizationConfigurator_default as PurchaseAuthorizationConfigurator, PurchaseAuthorizationRequests_default as PurchaseAuthorizationRequests, QuickOrder, QuoteActions_default as QuoteActions, RegisterForm_default as RegisterForm, SearchBar_default as SearchBar, UserDetails_default as UserDetails, buildRootMachinesQuery, fetchActiveCart, initCart, mergeAnonymousCart, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useQuickOrder, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|
|
18657
18688
|
//# sourceMappingURL=index.js.map
|
|
18658
18689
|
//# sourceMappingURL=index.js.map
|