@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.cjs
CHANGED
|
@@ -815,7 +815,7 @@ function useCart(options) {
|
|
|
815
815
|
rememberCart(resolved);
|
|
816
816
|
return resolved;
|
|
817
817
|
}, [graphqlClient, user, companyId, language, configuration, onCartCreated]);
|
|
818
|
-
const
|
|
818
|
+
const addItem2 = React6.useCallback(async (opts) => {
|
|
819
819
|
setLoading(true);
|
|
820
820
|
setError(null);
|
|
821
821
|
try {
|
|
@@ -862,14 +862,14 @@ function useCart(options) {
|
|
|
862
862
|
const added = [];
|
|
863
863
|
let lastCart = null;
|
|
864
864
|
for (const item of items) {
|
|
865
|
-
const result = await
|
|
865
|
+
const result = await addItem2({ createCart: true, ...item });
|
|
866
866
|
if (!result.ok) return propellerV2CoreUi.err(result.error);
|
|
867
867
|
lastCart = result.data.cart;
|
|
868
868
|
added.push(result.data.item);
|
|
869
869
|
}
|
|
870
870
|
if (!lastCart) return propellerV2CoreUi.err("No items to add");
|
|
871
871
|
return propellerV2CoreUi.ok({ cart: lastCart, items: added });
|
|
872
|
-
}, [
|
|
872
|
+
}, [addItem2]);
|
|
873
873
|
const updateItemQuantity = React6.useCallback(async (cartItemId, quantity) => {
|
|
874
874
|
if (!cartId) return void 0;
|
|
875
875
|
setLoading(true);
|
|
@@ -990,7 +990,7 @@ function useCart(options) {
|
|
|
990
990
|
return [];
|
|
991
991
|
}
|
|
992
992
|
}, [graphqlClient, language, user, resolvedCompanyId, imageSearchFilters, imageVariantFilters]);
|
|
993
|
-
return { cart, cartId, loading, error, checkoutAllowed, resolveCart, addItem, addItems, updateItemQuantity, updateItemNotes, deleteItem, addActionCode, removeActionCode, requestAuthorization, processCart, getCrossupsells, getMinQuantity, getStep };
|
|
993
|
+
return { cart, cartId, loading, error, checkoutAllowed, resolveCart, addItem: addItem2, addItems, updateItemQuantity, updateItemNotes, deleteItem, addActionCode, removeActionCode, requestAuthorization, processCart, getCrossupsells, getMinQuantity, getStep };
|
|
994
994
|
}
|
|
995
995
|
function buildAddressInput(type, addr) {
|
|
996
996
|
return {
|
|
@@ -2618,6 +2618,13 @@ function useProductSearch(options) {
|
|
|
2618
2618
|
goToPage: pagination.goToPage
|
|
2619
2619
|
};
|
|
2620
2620
|
}
|
|
2621
|
+
function isPriceOnRequest(product) {
|
|
2622
|
+
if (!product) return false;
|
|
2623
|
+
const display = product.priceData?.display ?? product.defaultProduct?.priceData?.display;
|
|
2624
|
+
return display === propellerSdkV2.PriceDisplay.ON_REQUEST;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
// src/composables/react/useQuickOrder.ts
|
|
2621
2628
|
function toMatch(item, language) {
|
|
2622
2629
|
const isCluster = "clusterId" in item;
|
|
2623
2630
|
const displayItem = isCluster ? item.defaultProduct : item;
|
|
@@ -2636,7 +2643,8 @@ function toMatch(item, language) {
|
|
|
2636
2643
|
netPrice,
|
|
2637
2644
|
grossPrice,
|
|
2638
2645
|
minQuantity,
|
|
2639
|
-
imageUrl
|
|
2646
|
+
imageUrl,
|
|
2647
|
+
priceOnRequest: isPriceOnRequest(item)
|
|
2640
2648
|
};
|
|
2641
2649
|
}
|
|
2642
2650
|
function useQuickOrder(options) {
|
|
@@ -2783,6 +2791,146 @@ function useQuickOrder(options) {
|
|
|
2783
2791
|
return { submitting, error, searchProducts, submit };
|
|
2784
2792
|
}
|
|
2785
2793
|
|
|
2794
|
+
// src/composables/shared/utils/priceRequestList.ts
|
|
2795
|
+
function containsItem(list, code) {
|
|
2796
|
+
return list.some((i) => i.code === code);
|
|
2797
|
+
}
|
|
2798
|
+
function addItem(list, item) {
|
|
2799
|
+
if (containsItem(list, item.code)) return list;
|
|
2800
|
+
return [...list, { ...item, quantity: Math.max(item.quantity, item.minQuantity) }];
|
|
2801
|
+
}
|
|
2802
|
+
function removeItem(list, code) {
|
|
2803
|
+
return list.filter((i) => i.code !== code);
|
|
2804
|
+
}
|
|
2805
|
+
function setItemQuantity(list, code, quantity) {
|
|
2806
|
+
return list.map(
|
|
2807
|
+
(i) => i.code === code ? { ...i, quantity: Math.max(quantity, i.minQuantity) } : i
|
|
2808
|
+
);
|
|
2809
|
+
}
|
|
2810
|
+
function parseStoredList(raw) {
|
|
2811
|
+
if (!raw) return [];
|
|
2812
|
+
try {
|
|
2813
|
+
const parsed = JSON.parse(raw);
|
|
2814
|
+
if (!Array.isArray(parsed)) return [];
|
|
2815
|
+
return parsed.filter(
|
|
2816
|
+
(i) => i && typeof i.code === "string" && typeof i.productId === "number"
|
|
2817
|
+
);
|
|
2818
|
+
} catch {
|
|
2819
|
+
return [];
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
// src/composables/react/usePriceRequest.ts
|
|
2824
|
+
var PRICE_REQUEST_STORAGE_KEY = "propeller_price_request";
|
|
2825
|
+
var EMPTY = [];
|
|
2826
|
+
var cachedRaw = null;
|
|
2827
|
+
var cachedItems = EMPTY;
|
|
2828
|
+
function getSnapshot(key) {
|
|
2829
|
+
let raw = null;
|
|
2830
|
+
try {
|
|
2831
|
+
raw = window.localStorage.getItem(key);
|
|
2832
|
+
} catch {
|
|
2833
|
+
return EMPTY;
|
|
2834
|
+
}
|
|
2835
|
+
if (raw !== cachedRaw) {
|
|
2836
|
+
cachedRaw = raw;
|
|
2837
|
+
cachedItems = parseStoredList(raw);
|
|
2838
|
+
}
|
|
2839
|
+
return cachedItems;
|
|
2840
|
+
}
|
|
2841
|
+
function getServerSnapshot() {
|
|
2842
|
+
return EMPTY;
|
|
2843
|
+
}
|
|
2844
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
2845
|
+
function subscribe(cb) {
|
|
2846
|
+
listeners.add(cb);
|
|
2847
|
+
window.addEventListener("storage", cb);
|
|
2848
|
+
return () => {
|
|
2849
|
+
listeners.delete(cb);
|
|
2850
|
+
window.removeEventListener("storage", cb);
|
|
2851
|
+
};
|
|
2852
|
+
}
|
|
2853
|
+
function write(key, next) {
|
|
2854
|
+
try {
|
|
2855
|
+
window.localStorage.setItem(key, JSON.stringify(next));
|
|
2856
|
+
} catch {
|
|
2857
|
+
}
|
|
2858
|
+
listeners.forEach((l) => l());
|
|
2859
|
+
}
|
|
2860
|
+
function usePriceRequest(options = {}) {
|
|
2861
|
+
const storageKey = options.storageKey ?? PRICE_REQUEST_STORAGE_KEY;
|
|
2862
|
+
const items = React6.useSyncExternalStore(
|
|
2863
|
+
subscribe,
|
|
2864
|
+
() => getSnapshot(storageKey),
|
|
2865
|
+
getServerSnapshot
|
|
2866
|
+
);
|
|
2867
|
+
const ready = React6.useSyncExternalStore(
|
|
2868
|
+
subscribe,
|
|
2869
|
+
() => true,
|
|
2870
|
+
() => false
|
|
2871
|
+
);
|
|
2872
|
+
const [submitting, setSubmitting] = React6.useState(false);
|
|
2873
|
+
const [error, setError] = React6.useState(null);
|
|
2874
|
+
const add = React6.useCallback(
|
|
2875
|
+
(item) => {
|
|
2876
|
+
const current = getSnapshot(storageKey);
|
|
2877
|
+
if (containsItem(current, item.code)) return false;
|
|
2878
|
+
write(storageKey, addItem(current, item));
|
|
2879
|
+
return true;
|
|
2880
|
+
},
|
|
2881
|
+
[storageKey]
|
|
2882
|
+
);
|
|
2883
|
+
const remove = React6.useCallback(
|
|
2884
|
+
(code) => write(storageKey, removeItem(getSnapshot(storageKey), code)),
|
|
2885
|
+
[storageKey]
|
|
2886
|
+
);
|
|
2887
|
+
const setQuantity = React6.useCallback(
|
|
2888
|
+
(code, quantity) => write(storageKey, setItemQuantity(getSnapshot(storageKey), code, quantity)),
|
|
2889
|
+
[storageKey]
|
|
2890
|
+
);
|
|
2891
|
+
const clear = React6.useCallback(() => write(storageKey, []), [storageKey]);
|
|
2892
|
+
const has = React6.useCallback((code) => containsItem(items, code), [items]);
|
|
2893
|
+
const submit = React6.useCallback(
|
|
2894
|
+
async (comment) => {
|
|
2895
|
+
const current = getSnapshot(storageKey);
|
|
2896
|
+
if (!current.length) {
|
|
2897
|
+
setError("empty");
|
|
2898
|
+
return false;
|
|
2899
|
+
}
|
|
2900
|
+
if (!options.onSubmit) {
|
|
2901
|
+
setError("unsupported");
|
|
2902
|
+
return false;
|
|
2903
|
+
}
|
|
2904
|
+
setSubmitting(true);
|
|
2905
|
+
setError(null);
|
|
2906
|
+
try {
|
|
2907
|
+
await options.onSubmit(current, comment);
|
|
2908
|
+
write(storageKey, []);
|
|
2909
|
+
return true;
|
|
2910
|
+
} catch (e) {
|
|
2911
|
+
setError(e?.message || "failed");
|
|
2912
|
+
return false;
|
|
2913
|
+
} finally {
|
|
2914
|
+
setSubmitting(false);
|
|
2915
|
+
}
|
|
2916
|
+
},
|
|
2917
|
+
[options, storageKey]
|
|
2918
|
+
);
|
|
2919
|
+
return {
|
|
2920
|
+
items,
|
|
2921
|
+
ready,
|
|
2922
|
+
count: items.length,
|
|
2923
|
+
add,
|
|
2924
|
+
remove,
|
|
2925
|
+
setQuantity,
|
|
2926
|
+
clear,
|
|
2927
|
+
has,
|
|
2928
|
+
submit,
|
|
2929
|
+
submitting,
|
|
2930
|
+
error
|
|
2931
|
+
};
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2786
2934
|
// src/composables/shared/utils/machineLanguage.ts
|
|
2787
2935
|
var MACHINE_NOT_FOUND = "SPARE_PARTS_MACHINE_NOT_FOUND_ERROR";
|
|
2788
2936
|
function isMachineNotFound(error) {
|
|
@@ -4623,7 +4771,7 @@ function mergeGrouped(p) {
|
|
|
4623
4771
|
}
|
|
4624
4772
|
function AddToCart(rawProps) {
|
|
4625
4773
|
const props = mergeGrouped(useInfraProps(rawProps));
|
|
4626
|
-
const { cart, loading, checkoutAllowed, addItem, getMinQuantity, getStep } = useCart({
|
|
4774
|
+
const { cart, loading, checkoutAllowed, addItem: addItem2, getMinQuantity, getStep } = useCart({
|
|
4627
4775
|
graphqlClient: props.graphqlClient,
|
|
4628
4776
|
user: props.user ?? null,
|
|
4629
4777
|
companyId: props.companyId,
|
|
@@ -4730,7 +4878,7 @@ function AddToCart(rawProps) {
|
|
|
4730
4878
|
if (!props.graphqlClient) return;
|
|
4731
4879
|
if (props.beforeAddToCart && !props.beforeAddToCart()) return;
|
|
4732
4880
|
const cartBeforeAdd = activeFullCart ?? cart ?? null;
|
|
4733
|
-
const result = await
|
|
4881
|
+
const result = await addItem2({
|
|
4734
4882
|
product: props.product,
|
|
4735
4883
|
cluster: props.cluster,
|
|
4736
4884
|
childItems: props.childItems,
|
|
@@ -6741,7 +6889,7 @@ function useCartItemContext() {
|
|
|
6741
6889
|
}
|
|
6742
6890
|
function CartItem(rawProps) {
|
|
6743
6891
|
const props = useResolvedProps(rawProps, CART_ITEM_RESOLVE_SPEC);
|
|
6744
|
-
const { updateItemQuantity, updateItemNotes, deleteItem, getCrossupsells, addItem, getMinQuantity, getStep } = useCart({
|
|
6892
|
+
const { updateItemQuantity, updateItemNotes, deleteItem, getCrossupsells, addItem: addItem2, getMinQuantity, getStep } = useCart({
|
|
6745
6893
|
graphqlClient: props.graphqlClient,
|
|
6746
6894
|
user: props.user ?? null,
|
|
6747
6895
|
cartId: props.cartId,
|
|
@@ -6931,7 +7079,7 @@ function CartItem(rawProps) {
|
|
|
6931
7079
|
const productId = getCrossupsellProductId(item);
|
|
6932
7080
|
if (!productId) return;
|
|
6933
7081
|
setAddingCrossupsellId(productId);
|
|
6934
|
-
const result = await
|
|
7082
|
+
const result = await addItem2({ product: { productId }, quantity: 1, cartId: props.cartId });
|
|
6935
7083
|
setAddingCrossupsellId(null);
|
|
6936
7084
|
if (result.ok && props.afterCartUpdate) {
|
|
6937
7085
|
props.afterCartUpdate(result.data.cart);
|
|
@@ -7510,7 +7658,7 @@ function CartIconAndSidebar(rawProps) {
|
|
|
7510
7658
|
]
|
|
7511
7659
|
}
|
|
7512
7660
|
),
|
|
7513
|
-
props.showTotals && isHovered && totalItems > 0 ? /* @__PURE__ */ jsxRuntime.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: [
|
|
7661
|
+
props.showTotals && isHovered && totalItems > 0 ? /* @__PURE__ */ jsxRuntime.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: [
|
|
7514
7662
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between gap-4", children: [
|
|
7515
7663
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-icon__popover-label text-muted-foreground", children: totalLabel("totalLabel") }),
|
|
7516
7664
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cart-icon__popover-total font-semibold text-foreground", children: totalPrice })
|
|
@@ -7538,7 +7686,7 @@ function CartIconAndSidebar(rawProps) {
|
|
|
7538
7686
|
"aria-modal": "true",
|
|
7539
7687
|
"aria-label": sidebarTitle,
|
|
7540
7688
|
"data-open": sidebarOpen ? "true" : "false",
|
|
7541
|
-
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 : ""}`),
|
|
7689
|
+
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 : ""}`),
|
|
7542
7690
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col h-full", children: isMounted ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7543
7691
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-cart-icon__sidebar-header flex items-center justify-between px-5 py-4 border-b border-border", children: [
|
|
7544
7692
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -8300,6 +8448,7 @@ function ClusterCard(rawProps) {
|
|
|
8300
8448
|
const contentHidden = propellerV2CoreUi.isContentHidden(props.portalMode, props.user, props.isAuthenticated);
|
|
8301
8449
|
const defaultProductInventory = contentHidden ? void 0 : cluster?.defaultProduct?.inventory;
|
|
8302
8450
|
const useTax = props.includeTax !== void 0 ? !!props.includeTax : false;
|
|
8451
|
+
const priceOnRequest = isPriceOnRequest(cluster);
|
|
8303
8452
|
const priceObj = contentHidden ? void 0 : cluster?.defaultProduct?.price;
|
|
8304
8453
|
const priceValue = useTax ? priceObj?.net : priceObj?.gross;
|
|
8305
8454
|
const clusterPrice = props.showPrice === false ? "" : propellerV2CoreUi.formatPrice(priceValue, { symbol: props.currency ?? "\u20AC", locale: propellerV2CoreUi.localeForLanguage(props.language) });
|
|
@@ -8334,6 +8483,7 @@ function ClusterCard(rawProps) {
|
|
|
8334
8483
|
defaultProductInventory,
|
|
8335
8484
|
clusterPrice,
|
|
8336
8485
|
priceObj,
|
|
8486
|
+
priceOnRequest,
|
|
8337
8487
|
useTax,
|
|
8338
8488
|
isRow,
|
|
8339
8489
|
language,
|
|
@@ -8372,7 +8522,7 @@ function ClusterCard(rawProps) {
|
|
|
8372
8522
|
/* @__PURE__ */ jsxRuntime.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: [
|
|
8373
8523
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-cluster-card__footer-meta flex items-center justify-between gap-3 md:contents", children: [
|
|
8374
8524
|
props.showStock && defaultProductInventory ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardStock, {}) : null,
|
|
8375
|
-
props.showPrice !== false && priceObj ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardPrice, {}) : null
|
|
8525
|
+
props.showPrice !== false && (priceObj || priceOnRequest) ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardPrice, {}) : null
|
|
8376
8526
|
] }),
|
|
8377
8527
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-cluster-card__cta w-full md:w-auto md:flex-shrink-0 md:ml-auto", children: /* @__PURE__ */ jsxRuntime.jsx(ClusterCardViewClusterLink, {}) })
|
|
8378
8528
|
] })
|
|
@@ -8384,11 +8534,11 @@ function ClusterCard(rawProps) {
|
|
|
8384
8534
|
textLabelValues.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardTextLabels, {}) : null,
|
|
8385
8535
|
props.showManufacturer && manufacturer ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardManufacturer, {}) : null,
|
|
8386
8536
|
props.showShortDescription && shortDescription ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardShortDescription, {}) : null,
|
|
8387
|
-
props.showPrice !== false && priceObj ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto hidden md:block", children: /* @__PURE__ */ jsxRuntime.jsx(ClusterCardPrice, {}) }) : null
|
|
8537
|
+
props.showPrice !== false && (priceObj || priceOnRequest) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto hidden md:block", children: /* @__PURE__ */ jsxRuntime.jsx(ClusterCardPrice, {}) }) : null
|
|
8388
8538
|
] }),
|
|
8389
|
-
props.showStock && defaultProductInventory || props.showPrice !== false && priceObj ? /* @__PURE__ */ jsxRuntime.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: [
|
|
8539
|
+
props.showStock && defaultProductInventory || props.showPrice !== false && (priceObj || priceOnRequest) ? /* @__PURE__ */ jsxRuntime.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: [
|
|
8390
8540
|
props.showStock && defaultProductInventory ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardStock, {}) : null,
|
|
8391
|
-
props.showPrice !== false && priceObj ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardPrice, {}) : null
|
|
8541
|
+
props.showPrice !== false && (priceObj || priceOnRequest) ? /* @__PURE__ */ jsxRuntime.jsx(ClusterCardPrice, {}) : null
|
|
8392
8542
|
] }) : null,
|
|
8393
8543
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-cluster-card__cta px-3 pb-3 pt-2 sm:px-4 sm:pb-4", children: /* @__PURE__ */ jsxRuntime.jsx(ClusterCardViewClusterLink, {}) })
|
|
8394
8544
|
] })
|
|
@@ -8594,6 +8744,9 @@ function ClusterCardStock(props) {
|
|
|
8594
8744
|
}
|
|
8595
8745
|
function ClusterCardPrice(props) {
|
|
8596
8746
|
const { derived, resolved } = useClusterCard();
|
|
8747
|
+
if (derived.priceOnRequest) {
|
|
8748
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: props.className ?? "propeller-cluster-card__price", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-cluster-card__price-on-request text-sm text-foreground", children: propellerV2CoreUi.getLabel(resolved.labels, "priceOnRequest", "Price on request") }) });
|
|
8749
|
+
}
|
|
8597
8750
|
if (!derived.priceObj) return null;
|
|
8598
8751
|
const InjectedPrice = resolved.priceComponent;
|
|
8599
8752
|
if (InjectedPrice) {
|
|
@@ -8773,7 +8926,8 @@ function ProductPriceDisplay(props) {
|
|
|
8773
8926
|
}
|
|
8774
8927
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(`propeller-product-price ${props.className || ""}`), "data-hidden": isHidden2() ? "true" : "false", children: [
|
|
8775
8928
|
isHidden2() && props.showLoginPrompt !== false ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-product-price__login-prompt text-sm text-muted-foreground italic", children: propellerV2CoreUi.getLabel(props.labels, "loginToSeePrices", "Log in to see prices") }) : null,
|
|
8776
|
-
!isHidden2() &&
|
|
8929
|
+
!isHidden2() && props.priceOnRequest ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-product-price__on-request text-sm text-foreground", children: propellerV2CoreUi.getLabel(props.labels, "priceOnRequest", "Price on request") }) : null,
|
|
8930
|
+
!isHidden2() && !props.priceOnRequest && !!getLeadingPrice() ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-product-price__content flex flex-col gap-0.5", children: [
|
|
8777
8931
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-product-price__primary flex items-baseline gap-2", children: [
|
|
8778
8932
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8779
8933
|
"span",
|
|
@@ -9149,6 +9303,20 @@ function ProductCardBelowName() {
|
|
|
9149
9303
|
}
|
|
9150
9304
|
function ProductCardPrice(props) {
|
|
9151
9305
|
const { product, derived, resolved } = useProductCard();
|
|
9306
|
+
const onRequest = isPriceOnRequest(product);
|
|
9307
|
+
if (onRequest) {
|
|
9308
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: props.className ?? "propeller-product-card__price", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9309
|
+
ProductPrice_default,
|
|
9310
|
+
{
|
|
9311
|
+
priceOnRequest: true,
|
|
9312
|
+
labels: resolved.priceLabels,
|
|
9313
|
+
portalMode: resolved.portalMode,
|
|
9314
|
+
isAuthenticated: resolved.isAuthenticated,
|
|
9315
|
+
user: resolved.user,
|
|
9316
|
+
showLoginPrompt: false
|
|
9317
|
+
}
|
|
9318
|
+
) });
|
|
9319
|
+
}
|
|
9152
9320
|
if (!product?.price) return null;
|
|
9153
9321
|
const InjectedPrice = resolved.priceComponent;
|
|
9154
9322
|
if (InjectedPrice) {
|
|
@@ -9179,7 +9347,7 @@ function ProductCardPrice(props) {
|
|
|
9179
9347
|
) });
|
|
9180
9348
|
}
|
|
9181
9349
|
function ProductCardAddToCart(props) {
|
|
9182
|
-
const { product, resolved } = useProductCard();
|
|
9350
|
+
const { product, derived, resolved, handleProductClick } = useProductCard();
|
|
9183
9351
|
if (propellerV2CoreUi.isContentHidden(resolved.portalMode, resolved.user, resolved.isAuthenticated)) {
|
|
9184
9352
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9185
9353
|
LoginToOrderButton_default,
|
|
@@ -9190,6 +9358,19 @@ function ProductCardAddToCart(props) {
|
|
|
9190
9358
|
}
|
|
9191
9359
|
);
|
|
9192
9360
|
}
|
|
9361
|
+
if (isPriceOnRequest(product)) {
|
|
9362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9363
|
+
"a",
|
|
9364
|
+
{
|
|
9365
|
+
href: derived.productUrl,
|
|
9366
|
+
onClick: handleProductClick,
|
|
9367
|
+
className: cn(
|
|
9368
|
+
`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 || ""}`
|
|
9369
|
+
),
|
|
9370
|
+
children: propellerV2CoreUi.getLabel(resolved.priceLabels, "requestPrice", "Request a price")
|
|
9371
|
+
}
|
|
9372
|
+
);
|
|
9373
|
+
}
|
|
9193
9374
|
const InjectedAddToCart = resolved.addToCartComponent;
|
|
9194
9375
|
if (InjectedAddToCart) {
|
|
9195
9376
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10129,7 +10310,7 @@ function GridToolbar(rawProps) {
|
|
|
10129
10310
|
const [currentSortOrder, setCurrentSortOrder] = React6.useState(propellerSdkV2.SortOrder.DESC);
|
|
10130
10311
|
const [currentOffset, setCurrentOffset] = React6.useState(12);
|
|
10131
10312
|
const [currentViewMode, setCurrentViewMode] = React6.useState("grid");
|
|
10132
|
-
function
|
|
10313
|
+
function getLabel61(key) {
|
|
10133
10314
|
const labels = props.labels || {};
|
|
10134
10315
|
return labels[key] !== void 0 ? labels[key] : DEFAULT_LABELS[key] || key;
|
|
10135
10316
|
}
|
|
@@ -10167,8 +10348,8 @@ function GridToolbar(rawProps) {
|
|
|
10167
10348
|
}
|
|
10168
10349
|
function getAvailabilityLabel() {
|
|
10169
10350
|
const qty = props.minStock;
|
|
10170
|
-
if (qty !== void 0 && qty > propellerV2CoreUi.MIN_STOCK_THRESHOLD) return `${
|
|
10171
|
-
return
|
|
10351
|
+
if (qty !== void 0 && qty > propellerV2CoreUi.MIN_STOCK_THRESHOLD) return `${getLabel61("inStock")}: ${qty}+`;
|
|
10352
|
+
return getLabel61("inStock");
|
|
10172
10353
|
}
|
|
10173
10354
|
function handleSortFieldChange(field) {
|
|
10174
10355
|
setCurrentSortField(field);
|
|
@@ -10214,7 +10395,7 @@ function GridToolbar(rawProps) {
|
|
|
10214
10395
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-grid-toolbar__count text-sm text-muted-foreground font-medium", children: props.itemsFound > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10215
10396
|
props.itemsFound,
|
|
10216
10397
|
"\xA0",
|
|
10217
|
-
props.itemsFound === 1 ?
|
|
10398
|
+
props.itemsFound === 1 ? getLabel61("productSingular") : getLabel61("productPlural")
|
|
10218
10399
|
] }) : null }),
|
|
10219
10400
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-grid-toolbar__controls flex flex-wrap items-center gap-3", children: [
|
|
10220
10401
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10225,7 +10406,7 @@ function GridToolbar(rawProps) {
|
|
|
10225
10406
|
onChange: (e) => handleOffsetChange(parseInt(e.target.value)),
|
|
10226
10407
|
children: getOffsetOptions()?.map((n) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: n, children: [
|
|
10227
10408
|
n,
|
|
10228
|
-
|
|
10409
|
+
getLabel61("perPage")
|
|
10229
10410
|
] }, n))
|
|
10230
10411
|
}
|
|
10231
10412
|
),
|
|
@@ -10241,7 +10422,7 @@ function GridToolbar(rawProps) {
|
|
|
10241
10422
|
{
|
|
10242
10423
|
value: field,
|
|
10243
10424
|
disabled: field === "PRICE" && isPriceSortDisabled(),
|
|
10244
|
-
children:
|
|
10425
|
+
children: getLabel61(field)
|
|
10245
10426
|
},
|
|
10246
10427
|
field
|
|
10247
10428
|
))
|
|
@@ -10254,8 +10435,8 @@ function GridToolbar(rawProps) {
|
|
|
10254
10435
|
value: currentSortOrder,
|
|
10255
10436
|
onChange: (e) => handleSortOrderChange(e.target.value),
|
|
10256
10437
|
children: [
|
|
10257
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: propellerSdkV2.SortOrder.ASC, children:
|
|
10258
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: propellerSdkV2.SortOrder.DESC, children:
|
|
10438
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: propellerSdkV2.SortOrder.ASC, children: getLabel61("ASC") }),
|
|
10439
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: propellerSdkV2.SortOrder.DESC, children: getLabel61("DESC") })
|
|
10259
10440
|
]
|
|
10260
10441
|
}
|
|
10261
10442
|
),
|
|
@@ -10265,7 +10446,7 @@ function GridToolbar(rawProps) {
|
|
|
10265
10446
|
type: "button",
|
|
10266
10447
|
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",
|
|
10267
10448
|
onClick: (event) => handleViewChange(),
|
|
10268
|
-
title: currentViewMode === "grid" ?
|
|
10449
|
+
title: currentViewMode === "grid" ? getLabel61("switchToList") : getLabel61("switchToGrid"),
|
|
10269
10450
|
children: [
|
|
10270
10451
|
currentViewMode === "grid" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10271
10452
|
"svg",
|
|
@@ -10323,7 +10504,7 @@ function GridToolbar(rawProps) {
|
|
|
10323
10504
|
onClick: (event) => {
|
|
10324
10505
|
if (props.onClearFilters) props.onClearFilters();
|
|
10325
10506
|
},
|
|
10326
|
-
children:
|
|
10507
|
+
children: getLabel61("clearAll")
|
|
10327
10508
|
}
|
|
10328
10509
|
),
|
|
10329
10510
|
props.priceFilterMin !== void 0 || props.priceFilterMax !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -10334,7 +10515,7 @@ function GridToolbar(rawProps) {
|
|
|
10334
10515
|
if (props.onPriceFilterRemove) props.onPriceFilterRemove();
|
|
10335
10516
|
},
|
|
10336
10517
|
children: [
|
|
10337
|
-
|
|
10518
|
+
getLabel61("price"),
|
|
10338
10519
|
": ",
|
|
10339
10520
|
currencySymbol,
|
|
10340
10521
|
props.priceFilterMin ?? 0,
|
|
@@ -10386,7 +10567,7 @@ var DEFAULT_LABELS2 = {
|
|
|
10386
10567
|
of: "of"
|
|
10387
10568
|
};
|
|
10388
10569
|
function GridPagination(props) {
|
|
10389
|
-
function
|
|
10570
|
+
function getLabel61(key) {
|
|
10390
10571
|
const labels = props.labels || {};
|
|
10391
10572
|
return labels[key] !== void 0 ? labels[key] : DEFAULT_LABELS2[key] || key;
|
|
10392
10573
|
}
|
|
@@ -10459,15 +10640,15 @@ function GridPagination(props) {
|
|
|
10459
10640
|
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",
|
|
10460
10641
|
disabled: currentPage === 1,
|
|
10461
10642
|
onClick: () => handlePageChange(currentPage - 1),
|
|
10462
|
-
children:
|
|
10643
|
+
children: getLabel61("previous")
|
|
10463
10644
|
}
|
|
10464
10645
|
),
|
|
10465
10646
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "propeller-grid-pagination__info px-2 text-sm font-medium text-muted-foreground", children: [
|
|
10466
|
-
|
|
10647
|
+
getLabel61("page"),
|
|
10467
10648
|
"\xA0",
|
|
10468
10649
|
currentPage,
|
|
10469
10650
|
"\xA0",
|
|
10470
|
-
|
|
10651
|
+
getLabel61("of"),
|
|
10471
10652
|
"\xA0",
|
|
10472
10653
|
totalPages
|
|
10473
10654
|
] }),
|
|
@@ -10478,7 +10659,7 @@ function GridPagination(props) {
|
|
|
10478
10659
|
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",
|
|
10479
10660
|
disabled: currentPage === totalPages,
|
|
10480
10661
|
onClick: () => handlePageChange(currentPage + 1),
|
|
10481
|
-
children:
|
|
10662
|
+
children: getLabel61("next")
|
|
10482
10663
|
}
|
|
10483
10664
|
)
|
|
10484
10665
|
] }) : null,
|
|
@@ -10490,7 +10671,7 @@ function GridPagination(props) {
|
|
|
10490
10671
|
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",
|
|
10491
10672
|
disabled: currentPage === 1,
|
|
10492
10673
|
onClick: () => handlePageChange(currentPage - 1),
|
|
10493
|
-
children:
|
|
10674
|
+
children: getLabel61("previous")
|
|
10494
10675
|
}
|
|
10495
10676
|
),
|
|
10496
10677
|
getFullPages().map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10517,7 +10698,7 @@ function GridPagination(props) {
|
|
|
10517
10698
|
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",
|
|
10518
10699
|
disabled: currentPage === totalPages,
|
|
10519
10700
|
onClick: () => handlePageChange(currentPage + 1),
|
|
10520
|
-
children:
|
|
10701
|
+
children: getLabel61("next")
|
|
10521
10702
|
}
|
|
10522
10703
|
)
|
|
10523
10704
|
] }) : null
|
|
@@ -11745,7 +11926,7 @@ function FavoriteListItemActions(props) {
|
|
|
11745
11926
|
className: props.className ?? "propeller-favorite-list-item__actions flex items-center gap-2 flex-shrink-0",
|
|
11746
11927
|
onClick: (e) => e.stopPropagation(),
|
|
11747
11928
|
children: [
|
|
11748
|
-
resolved.allowAddToCart !== false && isProduct && !!resolved.graphqlClient ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11929
|
+
resolved.allowAddToCart !== false && isProduct && !!resolved.graphqlClient && !isPriceOnRequest(product) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11749
11930
|
AddToCart_default,
|
|
11750
11931
|
{
|
|
11751
11932
|
className: "flex items-center gap-2",
|
|
@@ -11820,7 +12001,7 @@ function FavoriteListDetails(rawProps) {
|
|
|
11820
12001
|
graphqlClient: props.graphqlClient,
|
|
11821
12002
|
user: props.user ?? null
|
|
11822
12003
|
});
|
|
11823
|
-
const { addItem } = useCart({
|
|
12004
|
+
const { addItem: addItem2 } = useCart({
|
|
11824
12005
|
graphqlClient: props.graphqlClient,
|
|
11825
12006
|
user: props.user ?? null,
|
|
11826
12007
|
cartId: props.cartId,
|
|
@@ -11925,7 +12106,7 @@ function FavoriteListDetails(rawProps) {
|
|
|
11925
12106
|
setBulkBusy(true);
|
|
11926
12107
|
try {
|
|
11927
12108
|
for (const product of products) {
|
|
11928
|
-
await
|
|
12109
|
+
await addItem2({
|
|
11929
12110
|
product,
|
|
11930
12111
|
quantity: product.minimumQuantity && product.minimumQuantity > 0 ? product.minimumQuantity : 1,
|
|
11931
12112
|
cartId: props.cartId,
|
|
@@ -14391,6 +14572,130 @@ function OrderList(rawProps) {
|
|
|
14391
14572
|
] });
|
|
14392
14573
|
}
|
|
14393
14574
|
var OrderList_default = OrderList;
|
|
14575
|
+
function PriceRequestList(props) {
|
|
14576
|
+
const [comment, setComment] = React6.useState("");
|
|
14577
|
+
const [sent, setSent] = React6.useState(false);
|
|
14578
|
+
const L = (key, fallback) => propellerV2CoreUi.getLabel(props.labels, key, fallback);
|
|
14579
|
+
async function handleSubmit(e) {
|
|
14580
|
+
e.preventDefault();
|
|
14581
|
+
if (!props.onSubmit) return;
|
|
14582
|
+
const ok4 = await props.onSubmit(comment);
|
|
14583
|
+
if (ok4) {
|
|
14584
|
+
setComment("");
|
|
14585
|
+
setSent(true);
|
|
14586
|
+
}
|
|
14587
|
+
}
|
|
14588
|
+
if (sent) {
|
|
14589
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(`propeller-price-request ${props.className || ""}`), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-price-request__sent py-8 text-center text-foreground", children: L("sent", "Price request sent. We will contact you.") }) });
|
|
14590
|
+
}
|
|
14591
|
+
if (!props.items.length) {
|
|
14592
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(`propeller-price-request ${props.className || ""}`), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-price-request__empty py-8 text-center text-foreground-subtle", children: L("empty", "Your price request list is empty.") }) });
|
|
14593
|
+
}
|
|
14594
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14595
|
+
"form",
|
|
14596
|
+
{
|
|
14597
|
+
className: cn(`propeller-price-request ${props.className || ""}`),
|
|
14598
|
+
onSubmit: handleSubmit,
|
|
14599
|
+
children: [
|
|
14600
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "propeller-price-request__title mb-4 text-xl font-semibold text-foreground", children: L("title", "Price request") }),
|
|
14601
|
+
/* @__PURE__ */ jsxRuntime.jsxs("table", { className: "propeller-price-request__table w-full text-sm", children: [
|
|
14602
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-b border-border text-left text-foreground-subtle", children: [
|
|
14603
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "py-2 pr-4 font-medium", children: L("colCode", "Article no. / SKU") }),
|
|
14604
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "py-2 pr-4 font-medium", children: L("colName", "Product name") }),
|
|
14605
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "py-2 pr-4 font-medium", children: L("colQuantity", "Quantity") }),
|
|
14606
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "py-2 w-10", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: L("remove", "Remove") }) })
|
|
14607
|
+
] }) }),
|
|
14608
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: props.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-b border-border-subtle", children: [
|
|
14609
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-2 pr-4 font-mono text-xs text-foreground", children: item.code }),
|
|
14610
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-2 pr-4 text-foreground", children: item.name }),
|
|
14611
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "py-2 pr-4", children: [
|
|
14612
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "sr-only", htmlFor: `pr-qty-${item.code}`, children: L("colQuantity", "Quantity") }),
|
|
14613
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14614
|
+
"input",
|
|
14615
|
+
{
|
|
14616
|
+
id: `pr-qty-${item.code}`,
|
|
14617
|
+
type: "number",
|
|
14618
|
+
min: item.minQuantity,
|
|
14619
|
+
step: item.unit || 1,
|
|
14620
|
+
value: item.quantity,
|
|
14621
|
+
onChange: (e) => props.onQuantityChange?.(item.code, parseInt(e.target.value, 10) || item.minQuantity),
|
|
14622
|
+
className: "w-20 rounded border border-border bg-background px-2 py-1"
|
|
14623
|
+
}
|
|
14624
|
+
)
|
|
14625
|
+
] }),
|
|
14626
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "py-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14627
|
+
"button",
|
|
14628
|
+
{
|
|
14629
|
+
type: "button",
|
|
14630
|
+
onClick: () => props.onRemove?.(item.code),
|
|
14631
|
+
"aria-label": L("remove", "Remove"),
|
|
14632
|
+
title: L("remove", "Remove"),
|
|
14633
|
+
className: "text-foreground-subtle transition-colors hover:text-destructive",
|
|
14634
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
14635
|
+
}
|
|
14636
|
+
) })
|
|
14637
|
+
] }, item.code)) })
|
|
14638
|
+
] }),
|
|
14639
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-price-request__comment mt-6", children: [
|
|
14640
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14641
|
+
"label",
|
|
14642
|
+
{
|
|
14643
|
+
htmlFor: "propeller-price-request-comment",
|
|
14644
|
+
className: "mb-2 block font-medium text-foreground",
|
|
14645
|
+
children: L("comments", "Comments")
|
|
14646
|
+
}
|
|
14647
|
+
),
|
|
14648
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14649
|
+
"textarea",
|
|
14650
|
+
{
|
|
14651
|
+
id: "propeller-price-request-comment",
|
|
14652
|
+
value: comment,
|
|
14653
|
+
onChange: (e) => setComment(e.target.value),
|
|
14654
|
+
rows: 4,
|
|
14655
|
+
className: "w-full rounded border border-border bg-background px-3 py-2"
|
|
14656
|
+
}
|
|
14657
|
+
)
|
|
14658
|
+
] }),
|
|
14659
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14660
|
+
"button",
|
|
14661
|
+
{
|
|
14662
|
+
type: "submit",
|
|
14663
|
+
disabled: props.submitting,
|
|
14664
|
+
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",
|
|
14665
|
+
children: props.submitting ? L("sending", "Sending\u2026") : L("send", "Send request")
|
|
14666
|
+
}
|
|
14667
|
+
)
|
|
14668
|
+
]
|
|
14669
|
+
}
|
|
14670
|
+
);
|
|
14671
|
+
}
|
|
14672
|
+
var PriceRequestList_default = PriceRequestList;
|
|
14673
|
+
function RequestPriceButton(props) {
|
|
14674
|
+
const anonymous = !props.isAuthenticated;
|
|
14675
|
+
const label = anonymous ? propellerV2CoreUi.getLabel(props.labels, "requestPrice", "Request a price") : props.added ? propellerV2CoreUi.getLabel(props.labels, "priceRequested", "On your request list") : propellerV2CoreUi.getLabel(props.labels, "requestPrice", "Request a price");
|
|
14676
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14677
|
+
"button",
|
|
14678
|
+
{
|
|
14679
|
+
type: "button",
|
|
14680
|
+
"data-added": props.added ? "true" : "false",
|
|
14681
|
+
className: cn(
|
|
14682
|
+
`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 || ""}`
|
|
14683
|
+
),
|
|
14684
|
+
onClick: () => {
|
|
14685
|
+
if (anonymous) {
|
|
14686
|
+
if (props.onLoginClick) props.onLoginClick();
|
|
14687
|
+
return;
|
|
14688
|
+
}
|
|
14689
|
+
if (props.onRequestPrice) props.onRequestPrice();
|
|
14690
|
+
},
|
|
14691
|
+
children: [
|
|
14692
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Tag, { className: "propeller-request-price__icon w-4 h-4", "aria-hidden": "true" }),
|
|
14693
|
+
label
|
|
14694
|
+
]
|
|
14695
|
+
}
|
|
14696
|
+
);
|
|
14697
|
+
}
|
|
14698
|
+
var RequestPriceButton_default = RequestPriceButton;
|
|
14394
14699
|
var ROW_SEQ = 0;
|
|
14395
14700
|
function blankRow() {
|
|
14396
14701
|
ROW_SEQ += 1;
|
|
@@ -14482,6 +14787,11 @@ function QuickOrderInner(props) {
|
|
|
14482
14787
|
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14483
14788
|
return;
|
|
14484
14789
|
}
|
|
14790
|
+
if (match.priceOnRequest) {
|
|
14791
|
+
setNotice(L("priceOnRequest", "Price on request \u2014 order this product from its page"));
|
|
14792
|
+
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14793
|
+
return;
|
|
14794
|
+
}
|
|
14485
14795
|
patchRow(key, {
|
|
14486
14796
|
code: match.sku,
|
|
14487
14797
|
productId: match.productId,
|
|
@@ -14542,6 +14852,10 @@ function QuickOrderInner(props) {
|
|
|
14542
14852
|
continue;
|
|
14543
14853
|
}
|
|
14544
14854
|
if (resolved.some((r) => r.productId === exact.productId)) continue;
|
|
14855
|
+
if (exact.priceOnRequest) {
|
|
14856
|
+
notFound.push(line.code);
|
|
14857
|
+
continue;
|
|
14858
|
+
}
|
|
14545
14859
|
const row = blankRow();
|
|
14546
14860
|
resolved.push({
|
|
14547
14861
|
...row,
|
|
@@ -16331,6 +16645,20 @@ function ProductInfoAddToCart(props = {}) {
|
|
|
16331
16645
|
}
|
|
16332
16646
|
);
|
|
16333
16647
|
}
|
|
16648
|
+
if (product?.orderable === propellerSdkV2.YesNo.N) return null;
|
|
16649
|
+
if (isPriceOnRequest(product)) {
|
|
16650
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16651
|
+
RequestPriceButton_default,
|
|
16652
|
+
{
|
|
16653
|
+
className: props.className,
|
|
16654
|
+
labels: derived.labels,
|
|
16655
|
+
isAuthenticated: resolved.isAuthenticated,
|
|
16656
|
+
onLoginClick: resolved.onLoginClick,
|
|
16657
|
+
added: resolved.priceRequestAdded,
|
|
16658
|
+
onRequestPrice: resolved.onRequestPrice ? () => resolved.onRequestPrice(product) : void 0
|
|
16659
|
+
}
|
|
16660
|
+
);
|
|
16661
|
+
}
|
|
16334
16662
|
const Injected = resolved.addToCartComponent;
|
|
16335
16663
|
if (Injected) {
|
|
16336
16664
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -18895,7 +19223,8 @@ function mapToSearchBarResult(item, language, urls) {
|
|
|
18895
19223
|
priceGross,
|
|
18896
19224
|
imageUrl: displayItem?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "",
|
|
18897
19225
|
url,
|
|
18898
|
-
isCluster
|
|
19226
|
+
isCluster,
|
|
19227
|
+
priceOnRequest: isPriceOnRequest(item)
|
|
18899
19228
|
};
|
|
18900
19229
|
}
|
|
18901
19230
|
function SearchBar(rawProps) {
|
|
@@ -19036,7 +19365,7 @@ function SearchBar(rawProps) {
|
|
|
19036
19365
|
// boilerplate's dark header band happened to make work: on a
|
|
19037
19366
|
// light header `bg-white/95 border-white/20` rendered as an
|
|
19038
19367
|
// invisible input.
|
|
19039
|
-
"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",
|
|
19368
|
+
"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",
|
|
19040
19369
|
props.inputClassName
|
|
19041
19370
|
),
|
|
19042
19371
|
placeholder: props.placeholder || "Search products...",
|
|
@@ -19046,7 +19375,7 @@ function SearchBar(rawProps) {
|
|
|
19046
19375
|
),
|
|
19047
19376
|
searchLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__spinner-wrapper absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__spinner animate-spin rounded-full h-5 w-5 border-b-2 border-primary" }) }) : null
|
|
19048
19377
|
] }) }),
|
|
19049
|
-
showDropdown ? /* @__PURE__ */ jsxRuntime.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: [
|
|
19378
|
+
showDropdown ? /* @__PURE__ */ jsxRuntime.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: [
|
|
19050
19379
|
results.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19051
19380
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__results flex-1 overflow-y-auto", children: results?.map((result, index) => {
|
|
19052
19381
|
const ResultTag = props.getResultHref ? "a" : "div";
|
|
@@ -19079,7 +19408,7 @@ function SearchBar(rawProps) {
|
|
|
19079
19408
|
result.sku
|
|
19080
19409
|
] }) : null
|
|
19081
19410
|
] }),
|
|
19082
|
-
props.renderPrice ? props.renderPrice(result) : props.showPrice !== false && result.price !== void 0 && result.price !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right", children: [
|
|
19411
|
+
props.renderPrice ? props.renderPrice(result) : props.showPrice !== false && result.priceOnRequest ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-search-bar__result-price text-sm text-foreground flex-shrink-0 text-right", children: propellerV2CoreUi.getLabel(props.priceLabels, "priceOnRequest", "Price on request") }) : props.showPrice !== false && result.price !== void 0 && result.price !== null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-search-bar__result-price text-sm font-semibold text-foreground flex-shrink-0 text-right", children: [
|
|
19083
19412
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-value", children: formatItemPrice(leadingPrice(result)) }),
|
|
19084
19413
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground", children: priceTaxLabel() })
|
|
19085
19414
|
] }) : null
|
|
@@ -19287,6 +19616,8 @@ exports.OrderList = OrderList_default;
|
|
|
19287
19616
|
exports.OrderShipments = OrderShipments_default;
|
|
19288
19617
|
exports.OrderSummary = OrderSummaryWithProvider_default;
|
|
19289
19618
|
exports.OrderTotals = OrderTotalsWithProvider_default;
|
|
19619
|
+
exports.PRICE_REQUEST_STORAGE_KEY = PRICE_REQUEST_STORAGE_KEY;
|
|
19620
|
+
exports.PriceRequestList = PriceRequestList_default;
|
|
19290
19621
|
exports.PriceToggle = PriceToggle_default;
|
|
19291
19622
|
exports.ProductBulkPrices = ProductBulkPricesWithProvider_default;
|
|
19292
19623
|
exports.ProductBundles = ProductBundles_default;
|
|
@@ -19310,12 +19641,18 @@ exports.PurchaseAuthorizationRequests = PurchaseAuthorizationRequests_default;
|
|
|
19310
19641
|
exports.QuickOrder = QuickOrder;
|
|
19311
19642
|
exports.QuoteActions = QuoteActions_default;
|
|
19312
19643
|
exports.RegisterForm = RegisterForm_default;
|
|
19644
|
+
exports.RequestPriceButton = RequestPriceButton_default;
|
|
19313
19645
|
exports.SearchBar = SearchBar_default;
|
|
19314
19646
|
exports.UserDetails = UserDetails_default;
|
|
19647
|
+
exports.addPriceRequestItem = addItem;
|
|
19315
19648
|
exports.buildRootMachinesQuery = buildRootMachinesQuery;
|
|
19316
19649
|
exports.fetchActiveCart = fetchActiveCart;
|
|
19317
19650
|
exports.initCart = initCart;
|
|
19651
|
+
exports.isPriceOnRequest = isPriceOnRequest;
|
|
19318
19652
|
exports.mergeAnonymousCart = mergeAnonymousCart;
|
|
19653
|
+
exports.priceRequestContains = containsItem;
|
|
19654
|
+
exports.removePriceRequestItem = removeItem;
|
|
19655
|
+
exports.setPriceRequestItemQuantity = setItemQuantity;
|
|
19319
19656
|
exports.useAddress = useAddress;
|
|
19320
19657
|
exports.useAuth = useAuth;
|
|
19321
19658
|
exports.useCart = useCart;
|
|
@@ -19327,6 +19664,7 @@ exports.useInfraProps = useInfraProps;
|
|
|
19327
19664
|
exports.useMachines = useMachines;
|
|
19328
19665
|
exports.useMenu = useMenu;
|
|
19329
19666
|
exports.useOrders = useOrders;
|
|
19667
|
+
exports.usePriceRequest = usePriceRequest;
|
|
19330
19668
|
exports.useProductBundles = useProductBundles;
|
|
19331
19669
|
exports.useProductGridConfig = useProductGridConfig;
|
|
19332
19670
|
exports.useProductInfo = useProductInfo;
|