@propeller-commerce/propeller-v2-react-ui 0.15.6 → 0.15.8

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,49 @@ 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.15.8] - 2026-08-11
12
+
13
+ ### Fixed
14
+
15
+ - **Quick order could add products from outside the user's catalogue.** Both the
16
+ row typeahead and the XLSX upload resolved codes through the flat `products`
17
+ resolver with no catalog scope and no user context. Orderlist (contract)
18
+ scoping is honoured by `category.products` but **silently ignored** on the flat
19
+ resolver, so quick order surfaced the full catalogue while the grid and the
20
+ search preview stayed scoped — the same bug fixed for the SearchBar preview in
21
+ 0.4.28. `searchProducts` now queries `category.getCategory` over
22
+ `configuration.baseCategoryId` and passes `userId` / `companyId` /
23
+ `applyOrderlists`, plus `hidden: false`, matching `ProductGrid`, the SearchBar
24
+ and the WordPress plugin's quick-order flow. Codes outside the catalogue are
25
+ reported through `onMissingCodes` instead of being added.
26
+
27
+ ### Changed
28
+
29
+ - **`QuickOrder` needs `configuration.baseCategoryId`.** Without it the
30
+ typeahead and the upload resolve nothing rather than falling back to an
31
+ unscoped search — failing closed is the point of the fix. Apps already
32
+ resolving a base category for `ProductGrid` / `SearchBar` should pass the same
33
+ value.
34
+
35
+ ### Added
36
+
37
+ - `QuickOrder` accepts `taxZone` (defaults to `'NL'`), `orderlistIds` and
38
+ `applyOrderlists`, forwarded to the scoped search.
39
+
40
+ ## [0.15.7] - 2026-08-10
41
+
42
+ ### Fixed
43
+
44
+ - **`OrderBonusItems` showed the list price of a free item.** The API models a
45
+ bonus as two order lines: the product line at its list price, plus a sibling
46
+ `class: 'incentive'` line carrying the negative delta and pointing back via
47
+ `parentOrderItemId`. The component rendered the product line and ignored the
48
+ sibling, so a bonus that reads € 0,00 in the cart and at checkout reappeared
49
+ at its list price on the thank-you page and in order details. Bonus lines are
50
+ now netted against their incentive siblings via `getNettedBonusItems()`
51
+ (core-ui 0.6.2); partial discounts keep their remainder instead of collapsing
52
+ to zero. Order totals were already correct — this was display-only.
53
+
11
54
  ## [0.15.6] - 2026-08-10
12
55
 
13
56
  ### Fixed
package/dist/index.cjs CHANGED
@@ -2596,21 +2596,33 @@ function useQuickOrder(options) {
2596
2596
  } = options;
2597
2597
  const language = options.language || "NL";
2598
2598
  const searchLimit = options.searchLimit ?? 8;
2599
+ const taxZone = options.taxZone || "NL";
2600
+ const { orderlistIds, applyOrderlists } = options;
2599
2601
  const [submitting, setSubmitting] = React6.useState(false);
2600
2602
  const [error, setError] = React6.useState(null);
2601
2603
  const searchProducts = React6.useCallback(
2602
2604
  async (term) => {
2603
2605
  const trimmed = term.trim();
2604
2606
  if (!trimmed || !graphqlClient) return [];
2607
+ const catId = configuration.baseCategoryId ?? 0;
2608
+ if (!catId) return [];
2605
2609
  try {
2606
- const service = propellerV2CoreUi.createServices(graphqlClient).product;
2610
+ const service = propellerV2CoreUi.createServices(graphqlClient).category;
2611
+ const orderlistScope = orderlistIds && orderlistIds.length > 0 ? { applyOrderlists: applyOrderlists !== false, orderlistIds } : { applyOrderlists: false };
2612
+ const userId = user && "contactId" in user ? user.contactId : user && "customerId" in user ? user.customerId : void 0;
2613
+ const contactId = user && "contactId" in user ? user.contactId : void 0;
2614
+ const customerId = user && "customerId" in user ? user.customerId : void 0;
2607
2615
  const input = {
2608
2616
  term: trimmed,
2609
2617
  language,
2610
2618
  page: 1,
2611
2619
  offset: searchLimit,
2612
2620
  statuses: [propellerSdkV2.ProductStatus.A, propellerSdkV2.ProductStatus.P, propellerSdkV2.ProductStatus.T, propellerSdkV2.ProductStatus.S],
2621
+ hidden: false,
2613
2622
  sortInputs: [{ field: propellerSdkV2.ProductSortField.RELEVANCE, order: propellerSdkV2.SortOrder.DESC }],
2623
+ ...companyId && { companyId },
2624
+ ...userId !== void 0 && { userId },
2625
+ ...orderlistScope,
2614
2626
  searchFields: [
2615
2627
  {
2616
2628
  fieldNames: [
@@ -2634,18 +2646,36 @@ function useQuickOrder(options) {
2634
2646
  ]
2635
2647
  };
2636
2648
  const variables = {
2637
- input,
2649
+ categoryId: catId,
2638
2650
  language,
2651
+ categoryProductSearchInput: input,
2652
+ priceCalculateProductInput: {
2653
+ taxZone,
2654
+ ...companyId && { companyId },
2655
+ ...contactId !== void 0 && { contactId },
2656
+ ...customerId !== void 0 && { customerId }
2657
+ },
2658
+ imageSearchFilters: configuration.imageSearchFiltersGrid,
2639
2659
  imageVariantFilters: configuration.imageVariantFiltersSmall
2640
2660
  };
2641
- const result = await service.getProducts(variables);
2642
- const items = result?.items ?? [];
2661
+ const response = await service.getCategory(variables);
2662
+ const items = response?.products?.items ?? [];
2643
2663
  return items.map((it) => toMatch(it, language));
2644
2664
  } catch {
2645
2665
  return [];
2646
2666
  }
2647
2667
  },
2648
- [graphqlClient, language, searchLimit, configuration]
2668
+ [
2669
+ graphqlClient,
2670
+ language,
2671
+ searchLimit,
2672
+ configuration,
2673
+ user,
2674
+ companyId,
2675
+ taxZone,
2676
+ orderlistIds,
2677
+ applyOrderlists
2678
+ ]
2649
2679
  );
2650
2680
  const submit = React6.useCallback(
2651
2681
  async (lines) => {
@@ -13634,9 +13664,7 @@ var OrderItemCard_default = OrderItemCard;
13634
13664
  function OrderBonusItems(rawProps) {
13635
13665
  const props = useInfraProps(rawProps);
13636
13666
  const allItems = props.items ?? props.order?.items ?? [];
13637
- const bonusItems = allItems.filter(
13638
- (item) => item.class === propellerSdkV2.OrderItemClass.product && item.isBonus === propellerSdkV2.YesNo.Y
13639
- );
13667
+ const bonusItems = propellerV2CoreUi.getNettedBonusItems(allItems);
13640
13668
  if (bonusItems.length === 0) return null;
13641
13669
  const OrderItemCardImpl = props.orderItemCardComponent ?? OrderItemCard_default;
13642
13670
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `propeller-order-bonus-items ${props.className || "mb-8"}`, children: [
@@ -14162,6 +14190,9 @@ function QuickOrderInner(props) {
14162
14190
  companyId,
14163
14191
  language,
14164
14192
  configuration,
14193
+ taxZone: props.taxZone,
14194
+ orderlistIds: props.orderlistIds,
14195
+ applyOrderlists: props.applyOrderlists,
14165
14196
  onCartCreated,
14166
14197
  afterAddToCart
14167
14198
  });