@propeller-commerce/propeller-v2-react-ui 0.4.26 → 0.4.27
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 +22 -0
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -6624,6 +6624,21 @@ interface SearchBarProps {
|
|
|
6624
6624
|
* Omit to keep the div-based fallback.
|
|
6625
6625
|
*/
|
|
6626
6626
|
getViewAllHref?: (term: string) => string;
|
|
6627
|
+
/**
|
|
6628
|
+
* Show the price column on each autosuggest result. Defaults to `true`.
|
|
6629
|
+
* Set `false` to hide prices entirely in the dropdown — e.g. a B2B
|
|
6630
|
+
* contract-catalogue context where prices are quote-only and shouldn't
|
|
6631
|
+
* appear in the live preview. Ignored when {@link renderPrice} is provided.
|
|
6632
|
+
*/
|
|
6633
|
+
showPrice?: boolean;
|
|
6634
|
+
/**
|
|
6635
|
+
* Replace the price cell of each result with custom content. When provided,
|
|
6636
|
+
* this fully overrides the default price rendering (and `showPrice`) — return
|
|
6637
|
+
* any node (e.g. a "Price by quotation" label for a contract catalogue), or
|
|
6638
|
+
* `null` to render nothing for that result. Keeps price/quotation wording
|
|
6639
|
+
* app-specific rather than baked into the package.
|
|
6640
|
+
*/
|
|
6641
|
+
renderPrice?: (result: SearchBarResult) => React$1.ReactNode;
|
|
6627
6642
|
/** Custom price formatting function */
|
|
6628
6643
|
formatPrice?: (price: number) => string;
|
|
6629
6644
|
/** Currency symbol for prices. Resolved from PropellerProvider when omitted; defaults to '€'. */
|
package/dist/index.d.ts
CHANGED
|
@@ -6624,6 +6624,21 @@ interface SearchBarProps {
|
|
|
6624
6624
|
* Omit to keep the div-based fallback.
|
|
6625
6625
|
*/
|
|
6626
6626
|
getViewAllHref?: (term: string) => string;
|
|
6627
|
+
/**
|
|
6628
|
+
* Show the price column on each autosuggest result. Defaults to `true`.
|
|
6629
|
+
* Set `false` to hide prices entirely in the dropdown — e.g. a B2B
|
|
6630
|
+
* contract-catalogue context where prices are quote-only and shouldn't
|
|
6631
|
+
* appear in the live preview. Ignored when {@link renderPrice} is provided.
|
|
6632
|
+
*/
|
|
6633
|
+
showPrice?: boolean;
|
|
6634
|
+
/**
|
|
6635
|
+
* Replace the price cell of each result with custom content. When provided,
|
|
6636
|
+
* this fully overrides the default price rendering (and `showPrice`) — return
|
|
6637
|
+
* any node (e.g. a "Price by quotation" label for a contract catalogue), or
|
|
6638
|
+
* `null` to render nothing for that result. Keeps price/quotation wording
|
|
6639
|
+
* app-specific rather than baked into the package.
|
|
6640
|
+
*/
|
|
6641
|
+
renderPrice?: (result: SearchBarResult) => React$1.ReactNode;
|
|
6627
6642
|
/** Custom price formatting function */
|
|
6628
6643
|
formatPrice?: (price: number) => string;
|
|
6629
6644
|
/** Currency symbol for prices. Resolved from PropellerProvider when omitted; defaults to '€'. */
|
package/dist/index.js
CHANGED
|
@@ -2345,6 +2345,10 @@ function useProductSearch(options) {
|
|
|
2345
2345
|
setSearchLoading(true);
|
|
2346
2346
|
try {
|
|
2347
2347
|
const service = createServices(graphqlClient).product;
|
|
2348
|
+
const orderlistScope = options.orderlistIds && options.orderlistIds.length > 0 ? {
|
|
2349
|
+
applyOrderlists: options.applyOrderlists !== false,
|
|
2350
|
+
orderlistIds: options.orderlistIds
|
|
2351
|
+
} : { applyOrderlists: false };
|
|
2348
2352
|
const input = {
|
|
2349
2353
|
term,
|
|
2350
2354
|
language,
|
|
@@ -2356,6 +2360,7 @@ function useProductSearch(options) {
|
|
|
2356
2360
|
ProductStatus.T,
|
|
2357
2361
|
ProductStatus.S
|
|
2358
2362
|
],
|
|
2363
|
+
...orderlistScope,
|
|
2359
2364
|
sortInputs: [{ field: ProductSortField.RELEVANCE, order: SortOrder.DESC }],
|
|
2360
2365
|
searchFields: [
|
|
2361
2366
|
{
|
|
@@ -2402,7 +2407,8 @@ function useProductSearch(options) {
|
|
|
2402
2407
|
}
|
|
2403
2408
|
}, 300);
|
|
2404
2409
|
},
|
|
2405
|
-
|
|
2410
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2411
|
+
[graphqlClient, language, configuration, userKey, JSON.stringify(options.orderlistIds ?? []), options.applyOrderlists]
|
|
2406
2412
|
);
|
|
2407
2413
|
useEffect(() => {
|
|
2408
2414
|
if (!isControlled) fetchProducts();
|
|
@@ -17362,7 +17368,7 @@ function SearchBar(rawProps) {
|
|
|
17362
17368
|
result.sku
|
|
17363
17369
|
] }) : null
|
|
17364
17370
|
] }),
|
|
17365
|
-
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: [
|
|
17371
|
+
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: [
|
|
17366
17372
|
/* @__PURE__ */ jsx("span", { className: "propeller-search-bar__result-price-value", children: formatItemPrice(leadingPrice(result)) }),
|
|
17367
17373
|
/* @__PURE__ */ jsx("span", { className: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground", children: priceTaxLabel() })
|
|
17368
17374
|
] }) : null
|