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

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/dist/index.d.cts CHANGED
@@ -5219,11 +5219,12 @@ interface OrderBonusItemsProps {
5219
5219
  * Renders an order's bonus items — free items added through incentives — as a
5220
5220
  * read-only "Bonus items" section (heading + table of OrderItemCard rows).
5221
5221
  *
5222
- * Bonus items are order items of `class === 'product'` (the free goods) with
5223
- * `isBonus === 'Y'` — whether standalone or grouped by the backend under an
5224
- * `incentive` item via `parentOrderItemId`. Any backend-side grouping is
5225
- * purely presentational; in the flat SDK item list every bonus good is
5226
- * already `product`/`isBonus === Y`, so filtering on that yields the same set.
5222
+ * Bonus items are order items of `class === 'product'` with `isBonus === 'Y'`.
5223
+ * The API models the discount as a separate sibling `incentive` item that
5224
+ * carries the negative delta and points back via `parentOrderItemId`, so the
5225
+ * product line alone still shows the undiscounted price. Each bonus line is
5226
+ * therefore netted against its incentive siblings before display — a fully
5227
+ * discounted item reaches 0, a partially discounted one keeps the remainder.
5227
5228
  *
5228
5229
  * Renders nothing when there are no bonus items, so it's safe to drop into any
5229
5230
  * order surface (thank-you, order details, quote details) unconditionally.
package/dist/index.d.ts CHANGED
@@ -5219,11 +5219,12 @@ interface OrderBonusItemsProps {
5219
5219
  * Renders an order's bonus items — free items added through incentives — as a
5220
5220
  * read-only "Bonus items" section (heading + table of OrderItemCard rows).
5221
5221
  *
5222
- * Bonus items are order items of `class === 'product'` (the free goods) with
5223
- * `isBonus === 'Y'` — whether standalone or grouped by the backend under an
5224
- * `incentive` item via `parentOrderItemId`. Any backend-side grouping is
5225
- * purely presentational; in the flat SDK item list every bonus good is
5226
- * already `product`/`isBonus === Y`, so filtering on that yields the same set.
5222
+ * Bonus items are order items of `class === 'product'` with `isBonus === 'Y'`.
5223
+ * The API models the discount as a separate sibling `incentive` item that
5224
+ * carries the negative delta and points back via `parentOrderItemId`, so the
5225
+ * product line alone still shows the undiscounted price. Each bonus line is
5226
+ * therefore netted against its incentive siblings before display — a fully
5227
+ * discounted item reaches 0, a partially discounted one keeps the remainder.
5227
5228
  *
5228
5229
  * Renders nothing when there are no bonus items, so it's safe to drop into any
5229
5230
  * order surface (thank-you, order details, quote details) unconditionally.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { getLabel, getLocalizedValue, formatPrice, getClusterSku, getClusterImageUrl, isContentHidden, getProductSku, getProductImageUrl, createServices, err, ok, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses, attributeNameMatches, getAttributeDisplayName, filterProductsBySelections, extractAttributeValues, buildInventoryFilter, MIN_STOCK_THRESHOLD, getLanguageString, collectAttributeValues, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
2
+ import { getLabel, getLocalizedValue, formatPrice, getClusterSku, getClusterImageUrl, isContentHidden, getProductSku, getProductImageUrl, createServices, err, ok, formatSurcharge, deriveUserMode, isContact, isCustomer, getAddresses, attributeNameMatches, getAttributeDisplayName, filterProductsBySelections, extractAttributeValues, buildInventoryFilter, MIN_STOCK_THRESHOLD, getNettedBonusItems, getLanguageString, collectAttributeValues, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
3
3
  export * from '@propeller-commerce/propeller-v2-core-ui';
4
4
  import * as React6 from 'react';
5
5
  import { createContext, useState, useRef, useMemo, useCallback, useContext, useEffect } from 'react';
@@ -13614,9 +13614,7 @@ var OrderItemCard_default = OrderItemCard;
13614
13614
  function OrderBonusItems(rawProps) {
13615
13615
  const props = useInfraProps(rawProps);
13616
13616
  const allItems = props.items ?? props.order?.items ?? [];
13617
- const bonusItems = allItems.filter(
13618
- (item) => item.class === OrderItemClass.product && item.isBonus === YesNo.Y
13619
- );
13617
+ const bonusItems = getNettedBonusItems(allItems);
13620
13618
  if (bonusItems.length === 0) return null;
13621
13619
  const OrderItemCardImpl = props.orderItemCardComponent ?? OrderItemCard_default;
13622
13620
  return /* @__PURE__ */ jsxs("div", { className: `propeller-order-bonus-items ${props.className || "mb-8"}`, children: [