@propeller-commerce/propeller-v2-react-ui 0.25.0 → 0.26.1
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 +70 -0
- package/dist/index.cjs +380 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +168 -6
- package/dist/index.d.ts +168 -6
- package/dist/index.js +375 -46
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +2 -1
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +11 -3
- package/dist/pure.d.ts +11 -3
- package/dist/pure.js +2 -1
- package/dist/pure.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { getLabel, getLocalizedValue, formatPrice, localeForLanguage, getClusterSku, getClusterImageUrl, isContentHidden, getProductSku, getProductImageUrl, createServices, isCheckoutAllowed, err, ok, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses, attributeNameMatches, getAttributeDisplayName, filterProductsBySelections, extractAttributeValues, buildInventoryFilter, findPurchaserPac, isOverAuthorizationLimit, MIN_STOCK_THRESHOLD, getNettedBonusItems, getLanguageString, collectAttributeValues, getCountryName, resolveLanguageEntry, getLanguageUri } 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
|
-
import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext } from 'react';
|
|
5
|
+
import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext, useSyncExternalStore } from 'react';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
import { ProductStatus, ProductSortField, SortOrder, CrossupsellType, CartStatus, CartAddressType, Gender, YesNo, AddressType, MagicTokenService, PaymentStatuses, OrderSearchFields, OrderItemClass, ProductSearchableField, machineService, PurchaseRole, AttributeType, OrderSortField, OrderType, BundleCondition, OrderDiscountType } from '@propeller-commerce/propeller-sdk-v2';
|
|
7
|
+
import { ProductStatus, ProductSortField, SortOrder, CrossupsellType, PriceDisplay, CartStatus, CartAddressType, Gender, YesNo, AddressType, MagicTokenService, PaymentStatuses, OrderSearchFields, OrderItemClass, ProductSearchableField, machineService, PurchaseRole, AttributeType, OrderSortField, OrderType, BundleCondition, OrderDiscountType } from '@propeller-commerce/propeller-sdk-v2';
|
|
8
8
|
import { clsx } from 'clsx';
|
|
9
9
|
import { twMerge } from 'tailwind-merge';
|
|
10
|
-
import { User } from 'lucide-react';
|
|
10
|
+
import { User, Trash2, Tag } from 'lucide-react';
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
var PropellerDepsContext = createContext(null);
|
|
@@ -795,7 +795,7 @@ function useCart(options) {
|
|
|
795
795
|
rememberCart(resolved);
|
|
796
796
|
return resolved;
|
|
797
797
|
}, [graphqlClient, user, companyId, language, configuration, onCartCreated]);
|
|
798
|
-
const
|
|
798
|
+
const addItem2 = useCallback(async (opts) => {
|
|
799
799
|
setLoading(true);
|
|
800
800
|
setError(null);
|
|
801
801
|
try {
|
|
@@ -842,14 +842,14 @@ function useCart(options) {
|
|
|
842
842
|
const added = [];
|
|
843
843
|
let lastCart = null;
|
|
844
844
|
for (const item of items) {
|
|
845
|
-
const result = await
|
|
845
|
+
const result = await addItem2({ createCart: true, ...item });
|
|
846
846
|
if (!result.ok) return err(result.error);
|
|
847
847
|
lastCart = result.data.cart;
|
|
848
848
|
added.push(result.data.item);
|
|
849
849
|
}
|
|
850
850
|
if (!lastCart) return err("No items to add");
|
|
851
851
|
return ok({ cart: lastCart, items: added });
|
|
852
|
-
}, [
|
|
852
|
+
}, [addItem2]);
|
|
853
853
|
const updateItemQuantity = useCallback(async (cartItemId, quantity) => {
|
|
854
854
|
if (!cartId) return void 0;
|
|
855
855
|
setLoading(true);
|
|
@@ -970,7 +970,7 @@ function useCart(options) {
|
|
|
970
970
|
return [];
|
|
971
971
|
}
|
|
972
972
|
}, [graphqlClient, language, user, resolvedCompanyId, imageSearchFilters, imageVariantFilters]);
|
|
973
|
-
return { cart, cartId, loading, error, checkoutAllowed, resolveCart, addItem, addItems, updateItemQuantity, updateItemNotes, deleteItem, addActionCode, removeActionCode, requestAuthorization, processCart, getCrossupsells, getMinQuantity, getStep };
|
|
973
|
+
return { cart, cartId, loading, error, checkoutAllowed, resolveCart, addItem: addItem2, addItems, updateItemQuantity, updateItemNotes, deleteItem, addActionCode, removeActionCode, requestAuthorization, processCart, getCrossupsells, getMinQuantity, getStep };
|
|
974
974
|
}
|
|
975
975
|
function buildAddressInput(type, addr) {
|
|
976
976
|
return {
|
|
@@ -2598,6 +2598,13 @@ function useProductSearch(options) {
|
|
|
2598
2598
|
goToPage: pagination.goToPage
|
|
2599
2599
|
};
|
|
2600
2600
|
}
|
|
2601
|
+
function isPriceOnRequest(product) {
|
|
2602
|
+
if (!product) return false;
|
|
2603
|
+
const display = product.priceData?.display ?? product.defaultProduct?.priceData?.display;
|
|
2604
|
+
return display === PriceDisplay.ON_REQUEST;
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
// src/composables/react/useQuickOrder.ts
|
|
2601
2608
|
function toMatch(item, language) {
|
|
2602
2609
|
const isCluster = "clusterId" in item;
|
|
2603
2610
|
const displayItem = isCluster ? item.defaultProduct : item;
|
|
@@ -2616,7 +2623,8 @@ function toMatch(item, language) {
|
|
|
2616
2623
|
netPrice,
|
|
2617
2624
|
grossPrice,
|
|
2618
2625
|
minQuantity,
|
|
2619
|
-
imageUrl
|
|
2626
|
+
imageUrl,
|
|
2627
|
+
priceOnRequest: isPriceOnRequest(item)
|
|
2620
2628
|
};
|
|
2621
2629
|
}
|
|
2622
2630
|
function useQuickOrder(options) {
|
|
@@ -2763,6 +2771,146 @@ function useQuickOrder(options) {
|
|
|
2763
2771
|
return { submitting, error, searchProducts, submit };
|
|
2764
2772
|
}
|
|
2765
2773
|
|
|
2774
|
+
// src/composables/shared/utils/priceRequestList.ts
|
|
2775
|
+
function containsItem(list, code) {
|
|
2776
|
+
return list.some((i) => i.code === code);
|
|
2777
|
+
}
|
|
2778
|
+
function addItem(list, item) {
|
|
2779
|
+
if (containsItem(list, item.code)) return list;
|
|
2780
|
+
return [...list, { ...item, quantity: Math.max(item.quantity, item.minQuantity) }];
|
|
2781
|
+
}
|
|
2782
|
+
function removeItem(list, code) {
|
|
2783
|
+
return list.filter((i) => i.code !== code);
|
|
2784
|
+
}
|
|
2785
|
+
function setItemQuantity(list, code, quantity) {
|
|
2786
|
+
return list.map(
|
|
2787
|
+
(i) => i.code === code ? { ...i, quantity: Math.max(quantity, i.minQuantity) } : i
|
|
2788
|
+
);
|
|
2789
|
+
}
|
|
2790
|
+
function parseStoredList(raw) {
|
|
2791
|
+
if (!raw) return [];
|
|
2792
|
+
try {
|
|
2793
|
+
const parsed = JSON.parse(raw);
|
|
2794
|
+
if (!Array.isArray(parsed)) return [];
|
|
2795
|
+
return parsed.filter(
|
|
2796
|
+
(i) => i && typeof i.code === "string" && typeof i.productId === "number"
|
|
2797
|
+
);
|
|
2798
|
+
} catch {
|
|
2799
|
+
return [];
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
// src/composables/react/usePriceRequest.ts
|
|
2804
|
+
var PRICE_REQUEST_STORAGE_KEY = "propeller_price_request";
|
|
2805
|
+
var EMPTY = [];
|
|
2806
|
+
var cachedRaw = null;
|
|
2807
|
+
var cachedItems = EMPTY;
|
|
2808
|
+
function getSnapshot(key) {
|
|
2809
|
+
let raw = null;
|
|
2810
|
+
try {
|
|
2811
|
+
raw = window.localStorage.getItem(key);
|
|
2812
|
+
} catch {
|
|
2813
|
+
return EMPTY;
|
|
2814
|
+
}
|
|
2815
|
+
if (raw !== cachedRaw) {
|
|
2816
|
+
cachedRaw = raw;
|
|
2817
|
+
cachedItems = parseStoredList(raw);
|
|
2818
|
+
}
|
|
2819
|
+
return cachedItems;
|
|
2820
|
+
}
|
|
2821
|
+
function getServerSnapshot() {
|
|
2822
|
+
return EMPTY;
|
|
2823
|
+
}
|
|
2824
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
2825
|
+
function subscribe(cb) {
|
|
2826
|
+
listeners.add(cb);
|
|
2827
|
+
window.addEventListener("storage", cb);
|
|
2828
|
+
return () => {
|
|
2829
|
+
listeners.delete(cb);
|
|
2830
|
+
window.removeEventListener("storage", cb);
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
function write(key, next) {
|
|
2834
|
+
try {
|
|
2835
|
+
window.localStorage.setItem(key, JSON.stringify(next));
|
|
2836
|
+
} catch {
|
|
2837
|
+
}
|
|
2838
|
+
listeners.forEach((l) => l());
|
|
2839
|
+
}
|
|
2840
|
+
function usePriceRequest(options = {}) {
|
|
2841
|
+
const storageKey = options.storageKey ?? PRICE_REQUEST_STORAGE_KEY;
|
|
2842
|
+
const items = useSyncExternalStore(
|
|
2843
|
+
subscribe,
|
|
2844
|
+
() => getSnapshot(storageKey),
|
|
2845
|
+
getServerSnapshot
|
|
2846
|
+
);
|
|
2847
|
+
const ready = useSyncExternalStore(
|
|
2848
|
+
subscribe,
|
|
2849
|
+
() => true,
|
|
2850
|
+
() => false
|
|
2851
|
+
);
|
|
2852
|
+
const [submitting, setSubmitting] = useState(false);
|
|
2853
|
+
const [error, setError] = useState(null);
|
|
2854
|
+
const add = useCallback(
|
|
2855
|
+
(item) => {
|
|
2856
|
+
const current = getSnapshot(storageKey);
|
|
2857
|
+
if (containsItem(current, item.code)) return false;
|
|
2858
|
+
write(storageKey, addItem(current, item));
|
|
2859
|
+
return true;
|
|
2860
|
+
},
|
|
2861
|
+
[storageKey]
|
|
2862
|
+
);
|
|
2863
|
+
const remove = useCallback(
|
|
2864
|
+
(code) => write(storageKey, removeItem(getSnapshot(storageKey), code)),
|
|
2865
|
+
[storageKey]
|
|
2866
|
+
);
|
|
2867
|
+
const setQuantity = useCallback(
|
|
2868
|
+
(code, quantity) => write(storageKey, setItemQuantity(getSnapshot(storageKey), code, quantity)),
|
|
2869
|
+
[storageKey]
|
|
2870
|
+
);
|
|
2871
|
+
const clear = useCallback(() => write(storageKey, []), [storageKey]);
|
|
2872
|
+
const has = useCallback((code) => containsItem(items, code), [items]);
|
|
2873
|
+
const submit = useCallback(
|
|
2874
|
+
async (comment) => {
|
|
2875
|
+
const current = getSnapshot(storageKey);
|
|
2876
|
+
if (!current.length) {
|
|
2877
|
+
setError("empty");
|
|
2878
|
+
return false;
|
|
2879
|
+
}
|
|
2880
|
+
if (!options.onSubmit) {
|
|
2881
|
+
setError("unsupported");
|
|
2882
|
+
return false;
|
|
2883
|
+
}
|
|
2884
|
+
setSubmitting(true);
|
|
2885
|
+
setError(null);
|
|
2886
|
+
try {
|
|
2887
|
+
await options.onSubmit(current, comment);
|
|
2888
|
+
write(storageKey, []);
|
|
2889
|
+
return true;
|
|
2890
|
+
} catch (e) {
|
|
2891
|
+
setError(e?.message || "failed");
|
|
2892
|
+
return false;
|
|
2893
|
+
} finally {
|
|
2894
|
+
setSubmitting(false);
|
|
2895
|
+
}
|
|
2896
|
+
},
|
|
2897
|
+
[options, storageKey]
|
|
2898
|
+
);
|
|
2899
|
+
return {
|
|
2900
|
+
items,
|
|
2901
|
+
ready,
|
|
2902
|
+
count: items.length,
|
|
2903
|
+
add,
|
|
2904
|
+
remove,
|
|
2905
|
+
setQuantity,
|
|
2906
|
+
clear,
|
|
2907
|
+
has,
|
|
2908
|
+
submit,
|
|
2909
|
+
submitting,
|
|
2910
|
+
error
|
|
2911
|
+
};
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2766
2914
|
// src/composables/shared/utils/machineLanguage.ts
|
|
2767
2915
|
var MACHINE_NOT_FOUND = "SPARE_PARTS_MACHINE_NOT_FOUND_ERROR";
|
|
2768
2916
|
function isMachineNotFound(error) {
|
|
@@ -4603,7 +4751,7 @@ function mergeGrouped(p) {
|
|
|
4603
4751
|
}
|
|
4604
4752
|
function AddToCart(rawProps) {
|
|
4605
4753
|
const props = mergeGrouped(useInfraProps(rawProps));
|
|
4606
|
-
const { cart, loading, checkoutAllowed, addItem, getMinQuantity, getStep } = useCart({
|
|
4754
|
+
const { cart, loading, checkoutAllowed, addItem: addItem2, getMinQuantity, getStep } = useCart({
|
|
4607
4755
|
graphqlClient: props.graphqlClient,
|
|
4608
4756
|
user: props.user ?? null,
|
|
4609
4757
|
companyId: props.companyId,
|
|
@@ -4710,7 +4858,7 @@ function AddToCart(rawProps) {
|
|
|
4710
4858
|
if (!props.graphqlClient) return;
|
|
4711
4859
|
if (props.beforeAddToCart && !props.beforeAddToCart()) return;
|
|
4712
4860
|
const cartBeforeAdd = activeFullCart ?? cart ?? null;
|
|
4713
|
-
const result = await
|
|
4861
|
+
const result = await addItem2({
|
|
4714
4862
|
product: props.product,
|
|
4715
4863
|
cluster: props.cluster,
|
|
4716
4864
|
childItems: props.childItems,
|
|
@@ -6721,7 +6869,7 @@ function useCartItemContext() {
|
|
|
6721
6869
|
}
|
|
6722
6870
|
function CartItem(rawProps) {
|
|
6723
6871
|
const props = useResolvedProps(rawProps, CART_ITEM_RESOLVE_SPEC);
|
|
6724
|
-
const { updateItemQuantity, updateItemNotes, deleteItem, getCrossupsells, addItem, getMinQuantity, getStep } = useCart({
|
|
6872
|
+
const { updateItemQuantity, updateItemNotes, deleteItem, getCrossupsells, addItem: addItem2, getMinQuantity, getStep } = useCart({
|
|
6725
6873
|
graphqlClient: props.graphqlClient,
|
|
6726
6874
|
user: props.user ?? null,
|
|
6727
6875
|
cartId: props.cartId,
|
|
@@ -6911,7 +7059,7 @@ function CartItem(rawProps) {
|
|
|
6911
7059
|
const productId = getCrossupsellProductId(item);
|
|
6912
7060
|
if (!productId) return;
|
|
6913
7061
|
setAddingCrossupsellId(productId);
|
|
6914
|
-
const result = await
|
|
7062
|
+
const result = await addItem2({ product: { productId }, quantity: 1, cartId: props.cartId });
|
|
6915
7063
|
setAddingCrossupsellId(null);
|
|
6916
7064
|
if (result.ok && props.afterCartUpdate) {
|
|
6917
7065
|
props.afterCartUpdate(result.data.cart);
|
|
@@ -7490,7 +7638,7 @@ function CartIconAndSidebar(rawProps) {
|
|
|
7490
7638
|
]
|
|
7491
7639
|
}
|
|
7492
7640
|
),
|
|
7493
|
-
props.showTotals && isHovered && totalItems > 0 ? /* @__PURE__ */ jsxs("div", { className: "propeller-cart-icon__popover absolute top-full right-0 mt-1 z-40 bg-popover border border-border rounded-container shadow-lg px-3 py-2 min-w-[140px] text-sm whitespace-nowrap", children: [
|
|
7641
|
+
props.showTotals && isHovered && totalItems > 0 ? /* @__PURE__ */ jsxs("div", { className: "propeller-cart-icon__popover absolute top-full right-0 mt-1 z-40 bg-popover text-foreground border border-border rounded-container shadow-lg px-3 py-2 min-w-[140px] text-sm whitespace-nowrap", children: [
|
|
7494
7642
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between gap-4", children: [
|
|
7495
7643
|
/* @__PURE__ */ jsx("span", { className: "propeller-cart-icon__popover-label text-muted-foreground", children: totalLabel("totalLabel") }),
|
|
7496
7644
|
/* @__PURE__ */ jsx("span", { className: "propeller-cart-icon__popover-total font-semibold text-foreground", children: totalPrice })
|
|
@@ -7518,7 +7666,7 @@ function CartIconAndSidebar(rawProps) {
|
|
|
7518
7666
|
"aria-modal": "true",
|
|
7519
7667
|
"aria-label": sidebarTitle,
|
|
7520
7668
|
"data-open": sidebarOpen ? "true" : "false",
|
|
7521
|
-
className: cn(`propeller-cart-icon__sidebar fixed inset-y-0 right-0 z-[70] w-full max-w-md bg-card shadow-2xl transform transition-transform duration-300 ease-in-out border-l border-border${sidebarOpen ? " translate-x-0" : " translate-x-full"}${props.sidebarClassName ? " " + props.sidebarClassName : ""}`),
|
|
7669
|
+
className: cn(`propeller-cart-icon__sidebar fixed inset-y-0 right-0 z-[70] w-full max-w-md bg-card text-foreground shadow-2xl transform transition-transform duration-300 ease-in-out border-l border-border${sidebarOpen ? " translate-x-0" : " translate-x-full"}${props.sidebarClassName ? " " + props.sidebarClassName : ""}`),
|
|
7522
7670
|
children: /* @__PURE__ */ jsx("div", { className: "flex flex-col h-full", children: isMounted ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7523
7671
|
/* @__PURE__ */ jsxs("div", { className: "propeller-cart-icon__sidebar-header flex items-center justify-between px-5 py-4 border-b border-border", children: [
|
|
7524
7672
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -8280,6 +8428,7 @@ function ClusterCard(rawProps) {
|
|
|
8280
8428
|
const contentHidden = isContentHidden(props.portalMode, props.user, props.isAuthenticated);
|
|
8281
8429
|
const defaultProductInventory = contentHidden ? void 0 : cluster?.defaultProduct?.inventory;
|
|
8282
8430
|
const useTax = props.includeTax !== void 0 ? !!props.includeTax : false;
|
|
8431
|
+
const priceOnRequest = isPriceOnRequest(cluster);
|
|
8283
8432
|
const priceObj = contentHidden ? void 0 : cluster?.defaultProduct?.price;
|
|
8284
8433
|
const priceValue = useTax ? priceObj?.net : priceObj?.gross;
|
|
8285
8434
|
const clusterPrice = props.showPrice === false ? "" : formatPrice(priceValue, { symbol: props.currency ?? "\u20AC", locale: localeForLanguage(props.language) });
|
|
@@ -8314,6 +8463,7 @@ function ClusterCard(rawProps) {
|
|
|
8314
8463
|
defaultProductInventory,
|
|
8315
8464
|
clusterPrice,
|
|
8316
8465
|
priceObj,
|
|
8466
|
+
priceOnRequest,
|
|
8317
8467
|
useTax,
|
|
8318
8468
|
isRow,
|
|
8319
8469
|
language,
|
|
@@ -8352,7 +8502,7 @@ function ClusterCard(rawProps) {
|
|
|
8352
8502
|
/* @__PURE__ */ jsxs("div", { className: "propeller-cluster-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: [
|
|
8353
8503
|
/* @__PURE__ */ jsxs("div", { className: "propeller-cluster-card__footer-meta flex items-center justify-between gap-3 md:contents", children: [
|
|
8354
8504
|
props.showStock && defaultProductInventory ? /* @__PURE__ */ jsx(ClusterCardStock, {}) : null,
|
|
8355
|
-
props.showPrice !== false && priceObj ? /* @__PURE__ */ jsx(ClusterCardPrice, {}) : null
|
|
8505
|
+
props.showPrice !== false && (priceObj || priceOnRequest) ? /* @__PURE__ */ jsx(ClusterCardPrice, {}) : null
|
|
8356
8506
|
] }),
|
|
8357
8507
|
/* @__PURE__ */ jsx("div", { className: "propeller-cluster-card__cta w-full md:w-auto md:flex-shrink-0 md:ml-auto", children: /* @__PURE__ */ jsx(ClusterCardViewClusterLink, {}) })
|
|
8358
8508
|
] })
|
|
@@ -8364,11 +8514,11 @@ function ClusterCard(rawProps) {
|
|
|
8364
8514
|
textLabelValues.length > 0 ? /* @__PURE__ */ jsx(ClusterCardTextLabels, {}) : null,
|
|
8365
8515
|
props.showManufacturer && manufacturer ? /* @__PURE__ */ jsx(ClusterCardManufacturer, {}) : null,
|
|
8366
8516
|
props.showShortDescription && shortDescription ? /* @__PURE__ */ jsx(ClusterCardShortDescription, {}) : null,
|
|
8367
|
-
props.showPrice !== false && priceObj ? /* @__PURE__ */ jsx("div", { className: "mt-auto hidden md:block", children: /* @__PURE__ */ jsx(ClusterCardPrice, {}) }) : null
|
|
8517
|
+
props.showPrice !== false && (priceObj || priceOnRequest) ? /* @__PURE__ */ jsx("div", { className: "mt-auto hidden md:block", children: /* @__PURE__ */ jsx(ClusterCardPrice, {}) }) : null
|
|
8368
8518
|
] }),
|
|
8369
|
-
props.showStock && defaultProductInventory || props.showPrice !== false && priceObj ? /* @__PURE__ */ jsxs("div", { className: "propeller-cluster-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: [
|
|
8519
|
+
props.showStock && defaultProductInventory || props.showPrice !== false && (priceObj || priceOnRequest) ? /* @__PURE__ */ jsxs("div", { className: "propeller-cluster-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: [
|
|
8370
8520
|
props.showStock && defaultProductInventory ? /* @__PURE__ */ jsx(ClusterCardStock, {}) : null,
|
|
8371
|
-
props.showPrice !== false && priceObj ? /* @__PURE__ */ jsx(ClusterCardPrice, {}) : null
|
|
8521
|
+
props.showPrice !== false && (priceObj || priceOnRequest) ? /* @__PURE__ */ jsx(ClusterCardPrice, {}) : null
|
|
8372
8522
|
] }) : null,
|
|
8373
8523
|
/* @__PURE__ */ jsx("div", { className: "propeller-cluster-card__cta px-3 pb-3 pt-2 sm:px-4 sm:pb-4", children: /* @__PURE__ */ jsx(ClusterCardViewClusterLink, {}) })
|
|
8374
8524
|
] })
|
|
@@ -8574,6 +8724,9 @@ function ClusterCardStock(props) {
|
|
|
8574
8724
|
}
|
|
8575
8725
|
function ClusterCardPrice(props) {
|
|
8576
8726
|
const { derived, resolved } = useClusterCard();
|
|
8727
|
+
if (derived.priceOnRequest) {
|
|
8728
|
+
return /* @__PURE__ */ jsx("div", { className: props.className ?? "propeller-cluster-card__price", children: /* @__PURE__ */ jsx("span", { className: "propeller-cluster-card__price-on-request text-sm text-foreground", children: getLabel(resolved.labels, "priceOnRequest", "Price on request") }) });
|
|
8729
|
+
}
|
|
8577
8730
|
if (!derived.priceObj) return null;
|
|
8578
8731
|
const InjectedPrice = resolved.priceComponent;
|
|
8579
8732
|
if (InjectedPrice) {
|
|
@@ -8753,7 +8906,8 @@ function ProductPriceDisplay(props) {
|
|
|
8753
8906
|
}
|
|
8754
8907
|
return /* @__PURE__ */ jsxs("div", { className: cn(`propeller-product-price ${props.className || ""}`), "data-hidden": isHidden2() ? "true" : "false", children: [
|
|
8755
8908
|
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,
|
|
8756
|
-
!isHidden2() &&
|
|
8909
|
+
!isHidden2() && props.priceOnRequest ? /* @__PURE__ */ jsx("p", { className: "propeller-product-price__on-request text-sm text-foreground", children: getLabel(props.labels, "priceOnRequest", "Price on request") }) : null,
|
|
8910
|
+
!isHidden2() && !props.priceOnRequest && !!getLeadingPrice() ? /* @__PURE__ */ jsxs("div", { className: "propeller-product-price__content flex flex-col gap-0.5", children: [
|
|
8757
8911
|
/* @__PURE__ */ jsxs("div", { className: "propeller-product-price__primary flex items-baseline gap-2", children: [
|
|
8758
8912
|
/* @__PURE__ */ jsx(
|
|
8759
8913
|
"span",
|
|
@@ -9129,6 +9283,20 @@ function ProductCardBelowName() {
|
|
|
9129
9283
|
}
|
|
9130
9284
|
function ProductCardPrice(props) {
|
|
9131
9285
|
const { product, derived, resolved } = useProductCard();
|
|
9286
|
+
const onRequest = isPriceOnRequest(product);
|
|
9287
|
+
if (onRequest) {
|
|
9288
|
+
return /* @__PURE__ */ jsx("div", { className: props.className ?? "propeller-product-card__price", children: /* @__PURE__ */ jsx(
|
|
9289
|
+
ProductPrice_default,
|
|
9290
|
+
{
|
|
9291
|
+
priceOnRequest: true,
|
|
9292
|
+
labels: resolved.priceLabels,
|
|
9293
|
+
portalMode: resolved.portalMode,
|
|
9294
|
+
isAuthenticated: resolved.isAuthenticated,
|
|
9295
|
+
user: resolved.user,
|
|
9296
|
+
showLoginPrompt: false
|
|
9297
|
+
}
|
|
9298
|
+
) });
|
|
9299
|
+
}
|
|
9132
9300
|
if (!product?.price) return null;
|
|
9133
9301
|
const InjectedPrice = resolved.priceComponent;
|
|
9134
9302
|
if (InjectedPrice) {
|
|
@@ -9159,7 +9327,7 @@ function ProductCardPrice(props) {
|
|
|
9159
9327
|
) });
|
|
9160
9328
|
}
|
|
9161
9329
|
function ProductCardAddToCart(props) {
|
|
9162
|
-
const { product, resolved } = useProductCard();
|
|
9330
|
+
const { product, derived, resolved, handleProductClick } = useProductCard();
|
|
9163
9331
|
if (isContentHidden(resolved.portalMode, resolved.user, resolved.isAuthenticated)) {
|
|
9164
9332
|
return /* @__PURE__ */ jsx(
|
|
9165
9333
|
LoginToOrderButton_default,
|
|
@@ -9170,6 +9338,19 @@ function ProductCardAddToCart(props) {
|
|
|
9170
9338
|
}
|
|
9171
9339
|
);
|
|
9172
9340
|
}
|
|
9341
|
+
if (isPriceOnRequest(product)) {
|
|
9342
|
+
return /* @__PURE__ */ jsx(
|
|
9343
|
+
"a",
|
|
9344
|
+
{
|
|
9345
|
+
href: derived.productUrl,
|
|
9346
|
+
onClick: handleProductClick,
|
|
9347
|
+
className: cn(
|
|
9348
|
+
`propeller-product-card__view-product inline-flex h-10 w-full items-center justify-center rounded-control bg-primary px-4 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 ${props.className || ""}`
|
|
9349
|
+
),
|
|
9350
|
+
children: getLabel(resolved.priceLabels, "requestPrice", "Request a price")
|
|
9351
|
+
}
|
|
9352
|
+
);
|
|
9353
|
+
}
|
|
9173
9354
|
const InjectedAddToCart = resolved.addToCartComponent;
|
|
9174
9355
|
if (InjectedAddToCart) {
|
|
9175
9356
|
return /* @__PURE__ */ jsx(
|
|
@@ -10109,7 +10290,7 @@ function GridToolbar(rawProps) {
|
|
|
10109
10290
|
const [currentSortOrder, setCurrentSortOrder] = useState(SortOrder.DESC);
|
|
10110
10291
|
const [currentOffset, setCurrentOffset] = useState(12);
|
|
10111
10292
|
const [currentViewMode, setCurrentViewMode] = useState("grid");
|
|
10112
|
-
function
|
|
10293
|
+
function getLabel61(key) {
|
|
10113
10294
|
const labels = props.labels || {};
|
|
10114
10295
|
return labels[key] !== void 0 ? labels[key] : DEFAULT_LABELS[key] || key;
|
|
10115
10296
|
}
|
|
@@ -10147,8 +10328,8 @@ function GridToolbar(rawProps) {
|
|
|
10147
10328
|
}
|
|
10148
10329
|
function getAvailabilityLabel() {
|
|
10149
10330
|
const qty = props.minStock;
|
|
10150
|
-
if (qty !== void 0 && qty > MIN_STOCK_THRESHOLD) return `${
|
|
10151
|
-
return
|
|
10331
|
+
if (qty !== void 0 && qty > MIN_STOCK_THRESHOLD) return `${getLabel61("inStock")}: ${qty}+`;
|
|
10332
|
+
return getLabel61("inStock");
|
|
10152
10333
|
}
|
|
10153
10334
|
function handleSortFieldChange(field) {
|
|
10154
10335
|
setCurrentSortField(field);
|
|
@@ -10194,7 +10375,7 @@ function GridToolbar(rawProps) {
|
|
|
10194
10375
|
/* @__PURE__ */ jsx("div", { className: "propeller-grid-toolbar__count text-sm text-muted-foreground font-medium", children: props.itemsFound > 0 ? /* @__PURE__ */ jsxs("span", { children: [
|
|
10195
10376
|
props.itemsFound,
|
|
10196
10377
|
"\xA0",
|
|
10197
|
-
props.itemsFound === 1 ?
|
|
10378
|
+
props.itemsFound === 1 ? getLabel61("productSingular") : getLabel61("productPlural")
|
|
10198
10379
|
] }) : null }),
|
|
10199
10380
|
/* @__PURE__ */ jsxs("div", { className: "propeller-grid-toolbar__controls flex flex-wrap items-center gap-3", children: [
|
|
10200
10381
|
/* @__PURE__ */ jsx(
|
|
@@ -10205,7 +10386,7 @@ function GridToolbar(rawProps) {
|
|
|
10205
10386
|
onChange: (e) => handleOffsetChange(parseInt(e.target.value)),
|
|
10206
10387
|
children: getOffsetOptions()?.map((n) => /* @__PURE__ */ jsxs("option", { value: n, children: [
|
|
10207
10388
|
n,
|
|
10208
|
-
|
|
10389
|
+
getLabel61("perPage")
|
|
10209
10390
|
] }, n))
|
|
10210
10391
|
}
|
|
10211
10392
|
),
|
|
@@ -10221,7 +10402,7 @@ function GridToolbar(rawProps) {
|
|
|
10221
10402
|
{
|
|
10222
10403
|
value: field,
|
|
10223
10404
|
disabled: field === "PRICE" && isPriceSortDisabled(),
|
|
10224
|
-
children:
|
|
10405
|
+
children: getLabel61(field)
|
|
10225
10406
|
},
|
|
10226
10407
|
field
|
|
10227
10408
|
))
|
|
@@ -10234,8 +10415,8 @@ function GridToolbar(rawProps) {
|
|
|
10234
10415
|
value: currentSortOrder,
|
|
10235
10416
|
onChange: (e) => handleSortOrderChange(e.target.value),
|
|
10236
10417
|
children: [
|
|
10237
|
-
/* @__PURE__ */ jsx("option", { value: SortOrder.ASC, children:
|
|
10238
|
-
/* @__PURE__ */ jsx("option", { value: SortOrder.DESC, children:
|
|
10418
|
+
/* @__PURE__ */ jsx("option", { value: SortOrder.ASC, children: getLabel61("ASC") }),
|
|
10419
|
+
/* @__PURE__ */ jsx("option", { value: SortOrder.DESC, children: getLabel61("DESC") })
|
|
10239
10420
|
]
|
|
10240
10421
|
}
|
|
10241
10422
|
),
|
|
@@ -10245,7 +10426,7 @@ function GridToolbar(rawProps) {
|
|
|
10245
10426
|
type: "button",
|
|
10246
10427
|
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",
|
|
10247
10428
|
onClick: (event) => handleViewChange(),
|
|
10248
|
-
title: currentViewMode === "grid" ?
|
|
10429
|
+
title: currentViewMode === "grid" ? getLabel61("switchToList") : getLabel61("switchToGrid"),
|
|
10249
10430
|
children: [
|
|
10250
10431
|
currentViewMode === "grid" ? /* @__PURE__ */ jsxs(
|
|
10251
10432
|
"svg",
|
|
@@ -10303,7 +10484,7 @@ function GridToolbar(rawProps) {
|
|
|
10303
10484
|
onClick: (event) => {
|
|
10304
10485
|
if (props.onClearFilters) props.onClearFilters();
|
|
10305
10486
|
},
|
|
10306
|
-
children:
|
|
10487
|
+
children: getLabel61("clearAll")
|
|
10307
10488
|
}
|
|
10308
10489
|
),
|
|
10309
10490
|
props.priceFilterMin !== void 0 || props.priceFilterMax !== void 0 ? /* @__PURE__ */ jsxs(
|
|
@@ -10314,7 +10495,7 @@ function GridToolbar(rawProps) {
|
|
|
10314
10495
|
if (props.onPriceFilterRemove) props.onPriceFilterRemove();
|
|
10315
10496
|
},
|
|
10316
10497
|
children: [
|
|
10317
|
-
|
|
10498
|
+
getLabel61("price"),
|
|
10318
10499
|
": ",
|
|
10319
10500
|
currencySymbol,
|
|
10320
10501
|
props.priceFilterMin ?? 0,
|
|
@@ -10366,7 +10547,7 @@ var DEFAULT_LABELS2 = {
|
|
|
10366
10547
|
of: "of"
|
|
10367
10548
|
};
|
|
10368
10549
|
function GridPagination(props) {
|
|
10369
|
-
function
|
|
10550
|
+
function getLabel61(key) {
|
|
10370
10551
|
const labels = props.labels || {};
|
|
10371
10552
|
return labels[key] !== void 0 ? labels[key] : DEFAULT_LABELS2[key] || key;
|
|
10372
10553
|
}
|
|
@@ -10439,15 +10620,15 @@ function GridPagination(props) {
|
|
|
10439
10620
|
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",
|
|
10440
10621
|
disabled: currentPage === 1,
|
|
10441
10622
|
onClick: () => handlePageChange(currentPage - 1),
|
|
10442
|
-
children:
|
|
10623
|
+
children: getLabel61("previous")
|
|
10443
10624
|
}
|
|
10444
10625
|
),
|
|
10445
10626
|
/* @__PURE__ */ jsxs("span", { className: "propeller-grid-pagination__info px-2 text-sm font-medium text-muted-foreground", children: [
|
|
10446
|
-
|
|
10627
|
+
getLabel61("page"),
|
|
10447
10628
|
"\xA0",
|
|
10448
10629
|
currentPage,
|
|
10449
10630
|
"\xA0",
|
|
10450
|
-
|
|
10631
|
+
getLabel61("of"),
|
|
10451
10632
|
"\xA0",
|
|
10452
10633
|
totalPages
|
|
10453
10634
|
] }),
|
|
@@ -10458,7 +10639,7 @@ function GridPagination(props) {
|
|
|
10458
10639
|
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",
|
|
10459
10640
|
disabled: currentPage === totalPages,
|
|
10460
10641
|
onClick: () => handlePageChange(currentPage + 1),
|
|
10461
|
-
children:
|
|
10642
|
+
children: getLabel61("next")
|
|
10462
10643
|
}
|
|
10463
10644
|
)
|
|
10464
10645
|
] }) : null,
|
|
@@ -10470,7 +10651,7 @@ function GridPagination(props) {
|
|
|
10470
10651
|
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",
|
|
10471
10652
|
disabled: currentPage === 1,
|
|
10472
10653
|
onClick: () => handlePageChange(currentPage - 1),
|
|
10473
|
-
children:
|
|
10654
|
+
children: getLabel61("previous")
|
|
10474
10655
|
}
|
|
10475
10656
|
),
|
|
10476
10657
|
getFullPages().map((item, idx) => /* @__PURE__ */ jsx(
|
|
@@ -10497,7 +10678,7 @@ function GridPagination(props) {
|
|
|
10497
10678
|
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",
|
|
10498
10679
|
disabled: currentPage === totalPages,
|
|
10499
10680
|
onClick: () => handlePageChange(currentPage + 1),
|
|
10500
|
-
children:
|
|
10681
|
+
children: getLabel61("next")
|
|
10501
10682
|
}
|
|
10502
10683
|
)
|
|
10503
10684
|
] }) : null
|
|
@@ -11725,7 +11906,7 @@ function FavoriteListItemActions(props) {
|
|
|
11725
11906
|
className: props.className ?? "propeller-favorite-list-item__actions flex items-center gap-2 flex-shrink-0",
|
|
11726
11907
|
onClick: (e) => e.stopPropagation(),
|
|
11727
11908
|
children: [
|
|
11728
|
-
resolved.allowAddToCart !== false && isProduct && !!resolved.graphqlClient ? /* @__PURE__ */ jsx(
|
|
11909
|
+
resolved.allowAddToCart !== false && isProduct && !!resolved.graphqlClient && !isPriceOnRequest(product) ? /* @__PURE__ */ jsx(
|
|
11729
11910
|
AddToCart_default,
|
|
11730
11911
|
{
|
|
11731
11912
|
className: "flex items-center gap-2",
|
|
@@ -11800,7 +11981,7 @@ function FavoriteListDetails(rawProps) {
|
|
|
11800
11981
|
graphqlClient: props.graphqlClient,
|
|
11801
11982
|
user: props.user ?? null
|
|
11802
11983
|
});
|
|
11803
|
-
const { addItem } = useCart({
|
|
11984
|
+
const { addItem: addItem2 } = useCart({
|
|
11804
11985
|
graphqlClient: props.graphqlClient,
|
|
11805
11986
|
user: props.user ?? null,
|
|
11806
11987
|
cartId: props.cartId,
|
|
@@ -11905,7 +12086,7 @@ function FavoriteListDetails(rawProps) {
|
|
|
11905
12086
|
setBulkBusy(true);
|
|
11906
12087
|
try {
|
|
11907
12088
|
for (const product of products) {
|
|
11908
|
-
await
|
|
12089
|
+
await addItem2({
|
|
11909
12090
|
product,
|
|
11910
12091
|
quantity: product.minimumQuantity && product.minimumQuantity > 0 ? product.minimumQuantity : 1,
|
|
11911
12092
|
cartId: props.cartId,
|
|
@@ -14371,6 +14552,130 @@ function OrderList(rawProps) {
|
|
|
14371
14552
|
] });
|
|
14372
14553
|
}
|
|
14373
14554
|
var OrderList_default = OrderList;
|
|
14555
|
+
function PriceRequestList(props) {
|
|
14556
|
+
const [comment, setComment] = useState("");
|
|
14557
|
+
const [sent, setSent] = useState(false);
|
|
14558
|
+
const L = (key, fallback) => getLabel(props.labels, key, fallback);
|
|
14559
|
+
async function handleSubmit(e) {
|
|
14560
|
+
e.preventDefault();
|
|
14561
|
+
if (!props.onSubmit) return;
|
|
14562
|
+
const ok4 = await props.onSubmit(comment);
|
|
14563
|
+
if (ok4) {
|
|
14564
|
+
setComment("");
|
|
14565
|
+
setSent(true);
|
|
14566
|
+
}
|
|
14567
|
+
}
|
|
14568
|
+
if (sent) {
|
|
14569
|
+
return /* @__PURE__ */ jsx("div", { className: cn(`propeller-price-request ${props.className || ""}`), children: /* @__PURE__ */ jsx("p", { className: "propeller-price-request__sent py-8 text-center text-foreground", children: L("sent", "Price request sent. We will contact you.") }) });
|
|
14570
|
+
}
|
|
14571
|
+
if (!props.items.length) {
|
|
14572
|
+
return /* @__PURE__ */ jsx("div", { className: cn(`propeller-price-request ${props.className || ""}`), children: /* @__PURE__ */ jsx("p", { className: "propeller-price-request__empty py-8 text-center text-foreground-subtle", children: L("empty", "Your price request list is empty.") }) });
|
|
14573
|
+
}
|
|
14574
|
+
return /* @__PURE__ */ jsxs(
|
|
14575
|
+
"form",
|
|
14576
|
+
{
|
|
14577
|
+
className: cn(`propeller-price-request ${props.className || ""}`),
|
|
14578
|
+
onSubmit: handleSubmit,
|
|
14579
|
+
children: [
|
|
14580
|
+
/* @__PURE__ */ jsx("h2", { className: "propeller-price-request__title mb-4 text-xl font-semibold text-foreground", children: L("title", "Price request") }),
|
|
14581
|
+
/* @__PURE__ */ jsxs("table", { className: "propeller-price-request__table w-full text-sm", children: [
|
|
14582
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border text-left text-foreground-subtle", children: [
|
|
14583
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "py-2 pr-4 font-medium", children: L("colCode", "Article no. / SKU") }),
|
|
14584
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "py-2 pr-4 font-medium", children: L("colName", "Product name") }),
|
|
14585
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "py-2 pr-4 font-medium", children: L("colQuantity", "Quantity") }),
|
|
14586
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "py-2 w-10", children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: L("remove", "Remove") }) })
|
|
14587
|
+
] }) }),
|
|
14588
|
+
/* @__PURE__ */ jsx("tbody", { children: props.items.map((item) => /* @__PURE__ */ jsxs("tr", { className: "border-b border-border-subtle", children: [
|
|
14589
|
+
/* @__PURE__ */ jsx("td", { className: "py-2 pr-4 font-mono text-xs text-foreground", children: item.code }),
|
|
14590
|
+
/* @__PURE__ */ jsx("td", { className: "py-2 pr-4 text-foreground", children: item.name }),
|
|
14591
|
+
/* @__PURE__ */ jsxs("td", { className: "py-2 pr-4", children: [
|
|
14592
|
+
/* @__PURE__ */ jsx("label", { className: "sr-only", htmlFor: `pr-qty-${item.code}`, children: L("colQuantity", "Quantity") }),
|
|
14593
|
+
/* @__PURE__ */ jsx(
|
|
14594
|
+
"input",
|
|
14595
|
+
{
|
|
14596
|
+
id: `pr-qty-${item.code}`,
|
|
14597
|
+
type: "number",
|
|
14598
|
+
min: item.minQuantity,
|
|
14599
|
+
step: item.unit || 1,
|
|
14600
|
+
value: item.quantity,
|
|
14601
|
+
onChange: (e) => props.onQuantityChange?.(item.code, parseInt(e.target.value, 10) || item.minQuantity),
|
|
14602
|
+
className: "w-20 rounded border border-border bg-background px-2 py-1"
|
|
14603
|
+
}
|
|
14604
|
+
)
|
|
14605
|
+
] }),
|
|
14606
|
+
/* @__PURE__ */ jsx("td", { className: "py-2", children: /* @__PURE__ */ jsx(
|
|
14607
|
+
"button",
|
|
14608
|
+
{
|
|
14609
|
+
type: "button",
|
|
14610
|
+
onClick: () => props.onRemove?.(item.code),
|
|
14611
|
+
"aria-label": L("remove", "Remove"),
|
|
14612
|
+
title: L("remove", "Remove"),
|
|
14613
|
+
className: "text-foreground-subtle transition-colors hover:text-destructive",
|
|
14614
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
14615
|
+
}
|
|
14616
|
+
) })
|
|
14617
|
+
] }, item.code)) })
|
|
14618
|
+
] }),
|
|
14619
|
+
/* @__PURE__ */ jsxs("div", { className: "propeller-price-request__comment mt-6", children: [
|
|
14620
|
+
/* @__PURE__ */ jsx(
|
|
14621
|
+
"label",
|
|
14622
|
+
{
|
|
14623
|
+
htmlFor: "propeller-price-request-comment",
|
|
14624
|
+
className: "mb-2 block font-medium text-foreground",
|
|
14625
|
+
children: L("comments", "Comments")
|
|
14626
|
+
}
|
|
14627
|
+
),
|
|
14628
|
+
/* @__PURE__ */ jsx(
|
|
14629
|
+
"textarea",
|
|
14630
|
+
{
|
|
14631
|
+
id: "propeller-price-request-comment",
|
|
14632
|
+
value: comment,
|
|
14633
|
+
onChange: (e) => setComment(e.target.value),
|
|
14634
|
+
rows: 4,
|
|
14635
|
+
className: "w-full rounded border border-border bg-background px-3 py-2"
|
|
14636
|
+
}
|
|
14637
|
+
)
|
|
14638
|
+
] }),
|
|
14639
|
+
/* @__PURE__ */ jsx(
|
|
14640
|
+
"button",
|
|
14641
|
+
{
|
|
14642
|
+
type: "submit",
|
|
14643
|
+
disabled: props.submitting,
|
|
14644
|
+
className: "propeller-price-request__submit mt-4 rounded-control bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-50",
|
|
14645
|
+
children: props.submitting ? L("sending", "Sending\u2026") : L("send", "Send request")
|
|
14646
|
+
}
|
|
14647
|
+
)
|
|
14648
|
+
]
|
|
14649
|
+
}
|
|
14650
|
+
);
|
|
14651
|
+
}
|
|
14652
|
+
var PriceRequestList_default = PriceRequestList;
|
|
14653
|
+
function RequestPriceButton(props) {
|
|
14654
|
+
const anonymous = !props.isAuthenticated;
|
|
14655
|
+
const label = anonymous ? getLabel(props.labels, "requestPrice", "Request a price") : props.added ? getLabel(props.labels, "priceRequested", "On your request list") : getLabel(props.labels, "requestPrice", "Request a price");
|
|
14656
|
+
return /* @__PURE__ */ jsxs(
|
|
14657
|
+
"button",
|
|
14658
|
+
{
|
|
14659
|
+
type: "button",
|
|
14660
|
+
"data-added": props.added ? "true" : "false",
|
|
14661
|
+
className: cn(
|
|
14662
|
+
`propeller-request-price inline-flex items-center justify-center gap-2 h-10 px-4 w-full rounded-control text-sm font-medium transition-opacity hover:opacity-90 ${props.added && !anonymous ? "bg-surface-hover text-foreground border border-border" : "bg-primary text-primary-foreground"} ${props.className || ""}`
|
|
14663
|
+
),
|
|
14664
|
+
onClick: () => {
|
|
14665
|
+
if (anonymous) {
|
|
14666
|
+
if (props.onLoginClick) props.onLoginClick();
|
|
14667
|
+
return;
|
|
14668
|
+
}
|
|
14669
|
+
if (props.onRequestPrice) props.onRequestPrice();
|
|
14670
|
+
},
|
|
14671
|
+
children: [
|
|
14672
|
+
/* @__PURE__ */ jsx(Tag, { className: "propeller-request-price__icon w-4 h-4", "aria-hidden": "true" }),
|
|
14673
|
+
label
|
|
14674
|
+
]
|
|
14675
|
+
}
|
|
14676
|
+
);
|
|
14677
|
+
}
|
|
14678
|
+
var RequestPriceButton_default = RequestPriceButton;
|
|
14374
14679
|
var ROW_SEQ = 0;
|
|
14375
14680
|
function blankRow() {
|
|
14376
14681
|
ROW_SEQ += 1;
|
|
@@ -14462,6 +14767,11 @@ function QuickOrderInner(props) {
|
|
|
14462
14767
|
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14463
14768
|
return;
|
|
14464
14769
|
}
|
|
14770
|
+
if (match.priceOnRequest) {
|
|
14771
|
+
setNotice(L("priceOnRequest", "Price on request \u2014 order this product from its page"));
|
|
14772
|
+
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14773
|
+
return;
|
|
14774
|
+
}
|
|
14465
14775
|
patchRow(key, {
|
|
14466
14776
|
code: match.sku,
|
|
14467
14777
|
productId: match.productId,
|
|
@@ -14522,6 +14832,10 @@ function QuickOrderInner(props) {
|
|
|
14522
14832
|
continue;
|
|
14523
14833
|
}
|
|
14524
14834
|
if (resolved.some((r) => r.productId === exact.productId)) continue;
|
|
14835
|
+
if (exact.priceOnRequest) {
|
|
14836
|
+
notFound.push(line.code);
|
|
14837
|
+
continue;
|
|
14838
|
+
}
|
|
14525
14839
|
const row = blankRow();
|
|
14526
14840
|
resolved.push({
|
|
14527
14841
|
...row,
|
|
@@ -16311,6 +16625,20 @@ function ProductInfoAddToCart(props = {}) {
|
|
|
16311
16625
|
}
|
|
16312
16626
|
);
|
|
16313
16627
|
}
|
|
16628
|
+
if (product?.orderable === YesNo.N) return null;
|
|
16629
|
+
if (isPriceOnRequest(product)) {
|
|
16630
|
+
return /* @__PURE__ */ jsx(
|
|
16631
|
+
RequestPriceButton_default,
|
|
16632
|
+
{
|
|
16633
|
+
className: props.className,
|
|
16634
|
+
labels: derived.labels,
|
|
16635
|
+
isAuthenticated: resolved.isAuthenticated,
|
|
16636
|
+
onLoginClick: resolved.onLoginClick,
|
|
16637
|
+
added: resolved.priceRequestAdded,
|
|
16638
|
+
onRequestPrice: resolved.onRequestPrice ? () => resolved.onRequestPrice(product) : void 0
|
|
16639
|
+
}
|
|
16640
|
+
);
|
|
16641
|
+
}
|
|
16314
16642
|
const Injected = resolved.addToCartComponent;
|
|
16315
16643
|
if (Injected) {
|
|
16316
16644
|
return /* @__PURE__ */ jsx(
|
|
@@ -18875,7 +19203,8 @@ function mapToSearchBarResult(item, language, urls) {
|
|
|
18875
19203
|
priceGross,
|
|
18876
19204
|
imageUrl: displayItem?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "",
|
|
18877
19205
|
url,
|
|
18878
|
-
isCluster
|
|
19206
|
+
isCluster,
|
|
19207
|
+
priceOnRequest: isPriceOnRequest(item)
|
|
18879
19208
|
};
|
|
18880
19209
|
}
|
|
18881
19210
|
function SearchBar(rawProps) {
|
|
@@ -19016,7 +19345,7 @@ function SearchBar(rawProps) {
|
|
|
19016
19345
|
// boilerplate's dark header band happened to make work: on a
|
|
19017
19346
|
// light header `bg-white/95 border-white/20` rendered as an
|
|
19018
19347
|
// invisible input.
|
|
19019
|
-
"propeller-search-bar__input w-full pl-10 pr-10 py-2 bg-card border border-input rounded-container focus:outline-none focus:ring-2 focus:ring-secondary placeholder:text-muted-foreground",
|
|
19348
|
+
"propeller-search-bar__input w-full pl-10 pr-10 py-2 bg-card text-foreground border border-input rounded-container focus:outline-none focus:ring-2 focus:ring-secondary placeholder:text-muted-foreground",
|
|
19020
19349
|
props.inputClassName
|
|
19021
19350
|
),
|
|
19022
19351
|
placeholder: props.placeholder || "Search products...",
|
|
@@ -19026,7 +19355,7 @@ function SearchBar(rawProps) {
|
|
|
19026
19355
|
),
|
|
19027
19356
|
searchLoading ? /* @__PURE__ */ jsx("div", { className: "propeller-search-bar__spinner-wrapper absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsx("div", { className: "propeller-search-bar__spinner animate-spin rounded-full h-5 w-5 border-b-2 border-primary" }) }) : null
|
|
19028
19357
|
] }) }),
|
|
19029
|
-
showDropdown ? /* @__PURE__ */ jsxs("div", { className: "propeller-search-bar__dropdown absolute top-full left-0 right-0 mt-2 bg-card rounded-container shadow-xl border border-border z-50 flex flex-col max-h-96", children: [
|
|
19358
|
+
showDropdown ? /* @__PURE__ */ jsxs("div", { className: "propeller-search-bar__dropdown absolute top-full left-0 right-0 mt-2 bg-card text-foreground rounded-container shadow-xl border border-border z-50 flex flex-col max-h-96", children: [
|
|
19030
19359
|
results.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19031
19360
|
/* @__PURE__ */ jsx("div", { className: "propeller-search-bar__results flex-1 overflow-y-auto", children: results?.map((result, index) => {
|
|
19032
19361
|
const ResultTag = props.getResultHref ? "a" : "div";
|
|
@@ -19059,7 +19388,7 @@ function SearchBar(rawProps) {
|
|
|
19059
19388
|
result.sku
|
|
19060
19389
|
] }) : null
|
|
19061
19390
|
] }),
|
|
19062
|
-
props.renderPrice ? props.renderPrice(result) : props.showPrice !== false && result.price !== void 0 && result.price !== null ? /* @__PURE__ */ jsxs("div", { className: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right", children: [
|
|
19391
|
+
props.renderPrice ? props.renderPrice(result) : props.showPrice !== false && result.priceOnRequest ? /* @__PURE__ */ jsx("div", { className: "propeller-search-bar__result-price text-sm text-foreground flex-shrink-0 text-right", children: getLabel(props.priceLabels, "priceOnRequest", "Price on request") }) : props.showPrice !== false && result.price !== void 0 && result.price !== null ? /* @__PURE__ */ jsxs("div", { className: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right", children: [
|
|
19063
19392
|
/* @__PURE__ */ jsx("span", { className: "propeller-search-bar__result-price-value", children: formatItemPrice(leadingPrice(result)) }),
|
|
19064
19393
|
/* @__PURE__ */ jsx("span", { className: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground", children: priceTaxLabel() })
|
|
19065
19394
|
] }) : null
|
|
@@ -19213,6 +19542,6 @@ function UserDetails(rawProps) {
|
|
|
19213
19542
|
}
|
|
19214
19543
|
var UserDetails_default = UserDetails;
|
|
19215
19544
|
|
|
19216
|
-
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, OrderSummaryWithProvider_default as OrderSummary, OrderTotalsWithProvider_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 };
|
|
19545
|
+
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, OrderSummaryWithProvider_default as OrderSummary, OrderTotalsWithProvider_default as OrderTotals, PRICE_REQUEST_STORAGE_KEY, PriceRequestList_default as PriceRequestList, 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, RequestPriceButton_default as RequestPriceButton, SearchBar_default as SearchBar, UserDetails_default as UserDetails, addItem as addPriceRequestItem, buildRootMachinesQuery, fetchActiveCart, initCart, isPriceOnRequest, mergeAnonymousCart, containsItem as priceRequestContains, removeItem as removePriceRequestItem, setItemQuantity as setPriceRequestItemQuantity, useAddress, useAuth, useCart, useCheckout, useClusterConfigurator, useCompany, useFavorites, useInfraProps, useMachines, useMenu, useOrders, usePriceRequest, useProductBundles, useProductGridConfig, useProductInfo, useProductSearch, useProductSlider, useProductSpecs, usePropellerContext, usePropellerDeps, usePropellerScope, usePurchaseAuthorizationConfigurator, usePurchaseAuthorizationRequests, useQuickOrder, useRequiredPropellerDeps, useResolvedProps, useServices, useSpareParts, useUserMode };
|
|
19217
19546
|
//# sourceMappingURL=index.js.map
|
|
19218
19547
|
//# sourceMappingURL=index.js.map
|