@metron-labs/quote-react 0.1.47 → 0.1.48

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.
@@ -13,6 +13,8 @@ interface CartApi {
13
13
  /** Show the basket. Each app decides what that means for its own navigation. */
14
14
  openBasket: () => void;
15
15
  }
16
+ /** The inputs that can change a conversion, including the selected parent of a dependent line. */
17
+ export declare function conversionInputKey(item: Pick<CartItem, "productId" | "qty" | "unit" | "linkedContext">): string;
16
18
  export declare function refreshLinkedDependents(cart: Record<string, CartItem>, anchorItem: CartItem): Record<string, CartItem>;
17
19
  /**
18
20
  * One basket per app. BoQApp and EstimatingToolsApp each mount their own provider, so a
@@ -1,6 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { createContext, useCallback, useContext, useMemo, useState } from "react";
4
+ /** The inputs that can change a conversion, including the selected parent of a dependent line. */
5
+ export function conversionInputKey(item) {
6
+ return JSON.stringify([item.productId, item.qty, item.unit, item.linkedContext ?? []]);
7
+ }
4
8
  export function refreshLinkedDependents(cart, anchorItem) {
5
9
  const next = { ...cart, [anchorItem.lineId]: anchorItem };
6
10
  for (const [lineId, dependent] of Object.entries(next)) {
package/dist/styles.css CHANGED
@@ -5813,12 +5813,11 @@
5813
5813
  }
5814
5814
 
5815
5815
  :where(.app-wrapper) .results-total-action small {
5816
- margin-bottom: 2px;
5817
- color: var(--text-mid);
5818
- font-size: 11px;
5816
+ color: var(--text);
5817
+ font-size: 15px;
5819
5818
  font-weight: 600;
5820
- letter-spacing: 0.04em;
5821
- text-transform: uppercase;
5819
+ letter-spacing: 0;
5820
+ text-transform: none;
5822
5821
  }
5823
5822
 
5824
5823
  :where(.app-wrapper) .results-total-action strong {
@@ -11,7 +11,7 @@ export interface PricingBreakdown {
11
11
  calculation: string;
12
12
  costingMode: "direct" | "derived" | "review";
13
13
  }
14
- export declare function getCartSubtotal(items: CartItem[], options?: Parameters<typeof getPricingBreakdown>[1]): number;
14
+ export declare function getCartSubtotal(items: CartItem[], options?: Parameters<typeof getPricingBreakdown>[1]): number | null;
15
15
  export declare function getPricingBreakdown(item: CartItem, options?: {
16
16
  wasteFactorEnabled?: boolean;
17
17
  wasteFactorOverride?: number | null;
@@ -112,7 +112,8 @@ const coverageFromDescription = (item, requestedUnit, sellUnit) => {
112
112
  return Number.isFinite(coverage) && coverage > 0 ? coverage : null;
113
113
  };
114
114
  export function getCartSubtotal(items, options) {
115
- return items.reduce((sum, item) => sum + (getPricingBreakdown(item, options).lineTotal ?? 0), 0);
115
+ const totals = items.map((item) => getPricingBreakdown(item, options).lineTotal);
116
+ return totals.some((total) => total == null) ? null : totals.reduce((sum, total) => sum + (total ?? 0), 0);
116
117
  }
117
118
  export function getPricingBreakdown(item, options) {
118
119
  const requestedAmount = item.qty;
@@ -137,6 +138,8 @@ export function getPricingBreakdown(item, options) {
137
138
  calculation: overriddenSellUnits != null ? `${reason} Manually set to ${overriddenSellUnits} ${sellUnit}.` : reason,
138
139
  costingMode: "review",
139
140
  });
141
+ if (!Number.isFinite(requestedAmount) || requestedAmount <= 0)
142
+ return review("Quantity needs confirmation.");
140
143
  if (!supportsRequestedUnit(item, requestedUnit)) {
141
144
  return review("Requested unit is not supported by this catalogue conversion.");
142
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metron-labs/quote-react",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "description": "Metron Labs quote and estimating calculator components for React",
5
5
  "license": "UNLICENSED",
6
6
  "sideEffects": [