@metron-labs/quote-react 0.1.27 → 0.1.29

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.
@@ -11,6 +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
15
  export declare function getPricingBreakdown(item: CartItem, options?: {
15
16
  wasteFactorEnabled?: boolean;
16
17
  wasteFactorOverride?: number | null;
@@ -111,6 +111,9 @@ const coverageFromDescription = (item, requestedUnit, sellUnit) => {
111
111
  const coverage = Number.parseFloat(match[1].replace(",", "."));
112
112
  return Number.isFinite(coverage) && coverage > 0 ? coverage : null;
113
113
  };
114
+ export function getCartSubtotal(items, options) {
115
+ return items.reduce((sum, item) => sum + (getPricingBreakdown(item, options).lineTotal ?? 0), 0);
116
+ }
114
117
  export function getPricingBreakdown(item, options) {
115
118
  const requestedAmount = item.qty;
116
119
  const requestedUnit = canonicalUnit(item.unit) || "-";
@@ -37,6 +37,12 @@ export interface CartItem {
37
37
  quoteQtyFormulaType?: string | null;
38
38
  conversionConfidence?: string | null;
39
39
  conversionNotes?: string | null;
40
+ linkedContext?: Array<{
41
+ description: string;
42
+ qty: number | null;
43
+ unit: string | null;
44
+ role?: string | null;
45
+ }>;
40
46
  wasteFactorEnabled?: boolean;
41
47
  wasteFactorOverride?: number | null;
42
48
  calculatorWasteIncluded?: boolean;
@@ -49,7 +55,7 @@ export interface PhotoExtractedLine {
49
55
  linked_group_id: string | null;
50
56
  linked_group_label: string | null;
51
57
  linked_group_role: "anchor" | "dependent" | null;
52
- linked_group_rule: "shared_width_family" | null;
58
+ linked_group_rule: "shared_width_family" | "generic" | null;
53
59
  compatibility_note?: string | null;
54
60
  }
55
61
  export interface PhotoExtractResponse {
@@ -92,7 +98,7 @@ export interface LineItem {
92
98
  linked_group_id?: string | null;
93
99
  linked_group_label?: string | null;
94
100
  linked_group_role?: "anchor" | "dependent" | null;
95
- linked_group_rule?: "shared_width_family" | null;
101
+ linked_group_rule?: "shared_width_family" | "generic" | null;
96
102
  linked_group_shared_width_mm?: number | null;
97
103
  linked_group_visible?: boolean;
98
104
  decomposition_debug?: {
package/package.json CHANGED
@@ -1,53 +1,53 @@
1
- {
2
- "name": "@metron-labs/quote-react",
3
- "version": "0.1.27",
4
- "description": "Metron Labs quote and estimating calculator components for React",
5
- "license": "UNLICENSED",
6
- "sideEffects": [
7
- "*.css"
8
- ],
9
- "main": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./dist/index.d.ts",
14
- "default": "./dist/index.js"
15
- },
16
- "./styles.css": "./dist/styles.css",
17
- "./*": {
18
- "types": "./dist/*.d.ts",
19
- "default": "./dist/*.js"
20
- }
21
- },
22
- "files": [
23
- "dist"
24
- ],
25
- "publishConfig": {
26
- "access": "restricted"
27
- },
28
- "scripts": {
29
- "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && node scripts/copyStatic.mjs && node scripts/buildEmbed.mjs",
30
- "typecheck": "tsc --noEmit",
31
- "test": "vitest run",
32
- "prepublishOnly": "npm run typecheck && npm run build",
33
- "check:embed": "node scripts/checkEmbed.mjs"
34
- },
35
- "peerDependencies": {
36
- "react": "^18.3.0 || ^19.0.0",
37
- "react-dom": "^18.3.0 || ^19.0.0"
38
- },
39
- "dependencies": {
40
- "xlsx": "^0.18.5"
41
- },
42
- "devDependencies": {
43
- "@types/node": "^20",
44
- "@types/react": "^19",
45
- "@types/react-dom": "^19",
46
- "esbuild": "^0.28.2",
47
- "react": "19.2.3",
48
- "react-dom": "19.2.3",
49
- "tsx": "^4",
50
- "typescript": "^5",
51
- "vitest": "^3"
52
- }
53
- }
1
+ {
2
+ "name": "@metron-labs/quote-react",
3
+ "version": "0.1.29",
4
+ "description": "Metron Labs quote and estimating calculator components for React",
5
+ "license": "UNLICENSED",
6
+ "sideEffects": [
7
+ "*.css"
8
+ ],
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./styles.css": "./dist/styles.css",
17
+ "./*": {
18
+ "types": "./dist/*.d.ts",
19
+ "default": "./dist/*.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "restricted"
27
+ },
28
+ "scripts": {
29
+ "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && node scripts/copyStatic.mjs && node scripts/buildEmbed.mjs",
30
+ "typecheck": "tsc --noEmit",
31
+ "test": "vitest run",
32
+ "prepublishOnly": "npm run typecheck && npm run build",
33
+ "check:embed": "node scripts/checkEmbed.mjs"
34
+ },
35
+ "peerDependencies": {
36
+ "react": "^18.3.0 || ^19.0.0",
37
+ "react-dom": "^18.3.0 || ^19.0.0"
38
+ },
39
+ "dependencies": {
40
+ "xlsx": "^0.18.5"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^20",
44
+ "@types/react": "^19",
45
+ "@types/react-dom": "^19",
46
+ "esbuild": "^0.28.2",
47
+ "react": "19.2.3",
48
+ "react-dom": "19.2.3",
49
+ "tsx": "^4",
50
+ "typescript": "^5",
51
+ "vitest": "^3"
52
+ }
53
+ }