@propeller-commerce/propeller-v2-react-ui 0.4.27 → 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 CHANGED
@@ -8,6 +8,21 @@ 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
+
11
26
  ## [0.4.27] - 2026-07-21
12
27
 
13
28
  ### Fixed
package/dist/index.cjs CHANGED
@@ -2364,13 +2364,21 @@ function useProductSearch(options) {
2364
2364
  if (!graphqlClient) return;
2365
2365
  setSearchLoading(true);
2366
2366
  try {
2367
- const service = propellerV2CoreUi.createServices(graphqlClient).product;
2367
+ const service = propellerV2CoreUi.createServices(graphqlClient).category;
2368
+ const catId = configuration?.baseCategoryId ?? 0;
2369
+ if (!catId) {
2370
+ setSearchResults([]);
2371
+ setSearchItemsFound(0);
2372
+ return;
2373
+ }
2368
2374
  const orderlistScope = options.orderlistIds && options.orderlistIds.length > 0 ? {
2369
2375
  applyOrderlists: options.applyOrderlists !== false,
2370
2376
  orderlistIds: options.orderlistIds
2371
2377
  } : { applyOrderlists: false };
2372
- const input = {
2373
- term,
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 = {
2374
2382
  language,
2375
2383
  page: 1,
2376
2384
  offset: 10,
@@ -2380,8 +2388,8 @@ function useProductSearch(options) {
2380
2388
  propellerSdkV2.ProductStatus.T,
2381
2389
  propellerSdkV2.ProductStatus.S
2382
2390
  ],
2383
- ...orderlistScope,
2384
- sortInputs: [{ field: propellerSdkV2.ProductSortField.RELEVANCE, order: propellerSdkV2.SortOrder.DESC }],
2391
+ hidden: false,
2392
+ term,
2385
2393
  searchFields: [
2386
2394
  {
2387
2395
  fieldNames: [
@@ -2408,17 +2416,31 @@ function useProductSearch(options) {
2408
2416
  ],
2409
2417
  boost: 1
2410
2418
  }
2411
- ]
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 }
2412
2430
  };
2413
2431
  const variables = {
2414
- input,
2432
+ categoryId: catId,
2415
2433
  language,
2434
+ categoryProductSearchInput,
2435
+ priceCalculateProductInput,
2436
+ imageSearchFilters: configuration?.imageSearchFiltersGrid,
2416
2437
  imageVariantFilters: configuration?.imageVariantFiltersMedium
2417
2438
  };
2418
- const result = await service.getProducts(variables);
2419
- const items = result?.items ?? [];
2439
+ const response = await service.getCategory(variables);
2440
+ const productsResponse = response?.products;
2441
+ const items = productsResponse?.items ?? [];
2420
2442
  setSearchResults(items);
2421
- setSearchItemsFound(result?.itemsFound ?? items.length);
2443
+ setSearchItemsFound(productsResponse?.itemsFound ?? items.length);
2422
2444
  } catch {
2423
2445
  setSearchResults([]);
2424
2446
  setSearchItemsFound(0);