@propeller-commerce/propeller-v2-react-ui 0.4.26 → 0.4.28
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 +37 -0
- package/dist/index.cjs +39 -11
- 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 +39 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,43 @@ once it reaches 1.0. Until then (the `0.x` line) the public API may change
|
|
|
8
8
|
between minor versions; breaking changes are called out below and in
|
|
9
9
|
[MIGRATION.md](./MIGRATION.md).
|
|
10
10
|
|
|
11
|
+
## [0.4.28] - 2026-07-21
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **`SearchBar` autosuggest orderlist scoping — real fix.** 0.4.27 set
|
|
16
|
+
`orderlistIds`/`applyOrderlists` on the flat `products` search input, but the
|
|
17
|
+
server's `products` resolver does not honour orderlist scoping (only the
|
|
18
|
+
`category.products` resolver does), so the preview still leaked the full
|
|
19
|
+
catalogue inside a contract. The debounced autosuggest now runs the **same
|
|
20
|
+
category term-search the grid uses** (`getCategory` over the base category)
|
|
21
|
+
instead of the flat `getProducts`, so contract scoping is applied server-side
|
|
22
|
+
and the preview matches the grid exactly. Requires
|
|
23
|
+
`configuration.baseCategoryId` (already provided by all consumers); previews
|
|
24
|
+
no-op without it, as before.
|
|
25
|
+
|
|
26
|
+
## [0.4.27] - 2026-07-21
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **`SearchBar` autosuggest now respects orderlist (contract) scoping.** The
|
|
31
|
+
debounced live-search query built a plain `ProductSearchInput` that never
|
|
32
|
+
passed `orderlistIds`/`applyOrderlists`, so the dropdown previewed the full
|
|
33
|
+
catalogue even inside a B2B contract catalogue (the submitted results were
|
|
34
|
+
already correctly scoped — only the preview leaked). It now threads the same
|
|
35
|
+
orderlist scope as the grid fetch, so previews and results agree and a PDP
|
|
36
|
+
outside the contract is no longer reachable from the preview.
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **`SearchBar`: `renderPrice` + `showPrice` props.** `renderPrice(result)`
|
|
41
|
+
replaces the price cell of each result with custom content (return any node,
|
|
42
|
+
or `null` to render nothing) — e.g. a "Price by quotation" label for a
|
|
43
|
+
contract catalogue where prices are quote-only; it fully overrides the
|
|
44
|
+
default price rendering. `showPrice` (default `true`) is a simpler boolean to
|
|
45
|
+
hide the price column outright. Both default to the previous behaviour, so
|
|
46
|
+
the change is backward-compatible.
|
|
47
|
+
|
|
11
48
|
## [0.4.26] - 2026-07-21
|
|
12
49
|
|
|
13
50
|
### Added
|
package/dist/index.cjs
CHANGED
|
@@ -2364,9 +2364,21 @@ function useProductSearch(options) {
|
|
|
2364
2364
|
if (!graphqlClient) return;
|
|
2365
2365
|
setSearchLoading(true);
|
|
2366
2366
|
try {
|
|
2367
|
-
const service = propellerV2CoreUi.createServices(graphqlClient).
|
|
2368
|
-
const
|
|
2369
|
-
|
|
2367
|
+
const service = propellerV2CoreUi.createServices(graphqlClient).category;
|
|
2368
|
+
const catId = configuration?.baseCategoryId ?? 0;
|
|
2369
|
+
if (!catId) {
|
|
2370
|
+
setSearchResults([]);
|
|
2371
|
+
setSearchItemsFound(0);
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2374
|
+
const orderlistScope = options.orderlistIds && options.orderlistIds.length > 0 ? {
|
|
2375
|
+
applyOrderlists: options.applyOrderlists !== false,
|
|
2376
|
+
orderlistIds: options.orderlistIds
|
|
2377
|
+
} : { applyOrderlists: false };
|
|
2378
|
+
const userId = options.user && "contactId" in options.user ? options.user.contactId : options.user && "customerId" in options.user ? options.user.customerId : void 0;
|
|
2379
|
+
const contactId = options.user && "contactId" in options.user ? options.user.contactId : void 0;
|
|
2380
|
+
const customerId = options.user && "customerId" in options.user ? options.user.customerId : void 0;
|
|
2381
|
+
const categoryProductSearchInput = {
|
|
2370
2382
|
language,
|
|
2371
2383
|
page: 1,
|
|
2372
2384
|
offset: 10,
|
|
@@ -2376,7 +2388,8 @@ function useProductSearch(options) {
|
|
|
2376
2388
|
propellerSdkV2.ProductStatus.T,
|
|
2377
2389
|
propellerSdkV2.ProductStatus.S
|
|
2378
2390
|
],
|
|
2379
|
-
|
|
2391
|
+
hidden: false,
|
|
2392
|
+
term,
|
|
2380
2393
|
searchFields: [
|
|
2381
2394
|
{
|
|
2382
2395
|
fieldNames: [
|
|
@@ -2403,17 +2416,31 @@ function useProductSearch(options) {
|
|
|
2403
2416
|
],
|
|
2404
2417
|
boost: 1
|
|
2405
2418
|
}
|
|
2406
|
-
]
|
|
2419
|
+
],
|
|
2420
|
+
sortInputs: [{ field: propellerSdkV2.ProductSortField.RELEVANCE, order: propellerSdkV2.SortOrder.DESC }],
|
|
2421
|
+
...options.companyId && { companyId: options.companyId },
|
|
2422
|
+
...userId !== void 0 && { userId },
|
|
2423
|
+
...orderlistScope
|
|
2424
|
+
};
|
|
2425
|
+
const priceCalculateProductInput = {
|
|
2426
|
+
taxZone,
|
|
2427
|
+
...options.companyId && { companyId: options.companyId },
|
|
2428
|
+
...contactId !== void 0 && { contactId },
|
|
2429
|
+
...customerId !== void 0 && { customerId }
|
|
2407
2430
|
};
|
|
2408
2431
|
const variables = {
|
|
2409
|
-
|
|
2432
|
+
categoryId: catId,
|
|
2410
2433
|
language,
|
|
2434
|
+
categoryProductSearchInput,
|
|
2435
|
+
priceCalculateProductInput,
|
|
2436
|
+
imageSearchFilters: configuration?.imageSearchFiltersGrid,
|
|
2411
2437
|
imageVariantFilters: configuration?.imageVariantFiltersMedium
|
|
2412
2438
|
};
|
|
2413
|
-
const
|
|
2414
|
-
const
|
|
2439
|
+
const response = await service.getCategory(variables);
|
|
2440
|
+
const productsResponse = response?.products;
|
|
2441
|
+
const items = productsResponse?.items ?? [];
|
|
2415
2442
|
setSearchResults(items);
|
|
2416
|
-
setSearchItemsFound(
|
|
2443
|
+
setSearchItemsFound(productsResponse?.itemsFound ?? items.length);
|
|
2417
2444
|
} catch {
|
|
2418
2445
|
setSearchResults([]);
|
|
2419
2446
|
setSearchItemsFound(0);
|
|
@@ -2422,7 +2449,8 @@ function useProductSearch(options) {
|
|
|
2422
2449
|
}
|
|
2423
2450
|
}, 300);
|
|
2424
2451
|
},
|
|
2425
|
-
|
|
2452
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2453
|
+
[graphqlClient, language, configuration, userKey, JSON.stringify(options.orderlistIds ?? []), options.applyOrderlists]
|
|
2426
2454
|
);
|
|
2427
2455
|
React6.useEffect(() => {
|
|
2428
2456
|
if (!isControlled) fetchProducts();
|
|
@@ -17382,7 +17410,7 @@ function SearchBar(rawProps) {
|
|
|
17382
17410
|
result.sku
|
|
17383
17411
|
] }) : null
|
|
17384
17412
|
] }),
|
|
17385
|
-
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: [
|
|
17413
|
+
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: [
|
|
17386
17414
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-value", children: formatItemPrice(leadingPrice(result)) }),
|
|
17387
17415
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-search-bar__result-price-label block text-xs font-normal text-muted-foreground", children: priceTaxLabel() })
|
|
17388
17416
|
] }) : null
|