@metron-labs/quote-react 0.1.66 → 0.1.68
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/LICENSE +31 -31
- package/README.md +253 -253
- package/dist/app/EstimatingTools.js +5 -5
- package/dist/app/QuickQuote.js +7 -7
- package/dist/app/stages/BasketStage.js +10 -19
- package/dist/app/stages/EntryStage.js +5 -5
- package/dist/app/stages/ScheduleResultsStage.js +8 -9
- package/dist/components/estimators/ArchitraveEstimator.js +1 -1
- package/dist/components/estimators/DeckingEstimator.js +2 -2
- package/dist/components/estimators/EstimatorResults.d.ts +1 -1
- package/dist/components/estimators/EstimatorResults.js +6 -6
- package/dist/components/estimators/EstimatorReviewStage.d.ts +1 -1
- package/dist/components/estimators/EstimatorReviewStage.js +1 -1
- package/dist/components/estimators/FencingEstimator.js +2 -2
- package/dist/components/estimators/PaintEstimator.js +1 -1
- package/dist/components/estimators/RoofTrussEstimator.js +1 -1
- package/dist/components/estimators/registry.d.ts +1 -1
- package/dist/components/estimators/useFixedBasket.js +3 -3
- package/dist/embed/quote.js +6964 -6964
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -3
- package/dist/styles.css +6961 -6961
- package/dist/{lib → util}/api/fetchSchedule.d.ts +1 -1
- package/dist/{lib → util}/cart/CartContext.d.ts +1 -2
- package/dist/{lib/boq → util/cart}/toCartItem.d.ts +1 -1
- package/dist/{lib → util}/estimators/requestUnit.d.ts +1 -1
- package/dist/{lib → util}/estimators/resolveProducts.d.ts +1 -1
- package/dist/util/exportScheduleExcel.js +17 -3
- package/dist/util/pricing.js +1 -1
- package/dist/util/types.d.ts +0 -1
- package/package.json +53 -53
- /package/dist/{app/components → components/unit}/UnitDisplay.d.ts +0 -0
- /package/dist/{app/components → components/unit}/UnitDisplay.js +0 -0
- /package/dist/{app/components → components/unit}/UnitLabel.d.ts +0 -0
- /package/dist/{app/components → components/unit}/UnitLabel.js +0 -0
- /package/dist/{lib → util}/ProductImage.d.ts +0 -0
- /package/dist/{lib → util}/ProductImage.js +0 -0
- /package/dist/{lib → util}/QuoteProvider.d.ts +0 -0
- /package/dist/{lib → util}/QuoteProvider.js +0 -0
- /package/dist/{lib → util}/analytics.d.ts +0 -0
- /package/dist/{lib → util}/analytics.js +0 -0
- /package/dist/{lib → util}/api/boqClient.d.ts +0 -0
- /package/dist/{lib → util}/api/boqClient.js +0 -0
- /package/dist/{lib → util}/api/boqSession.d.ts +0 -0
- /package/dist/{lib → util}/api/boqSession.js +0 -0
- /package/dist/{lib → util}/api/fetchSchedule.js +0 -0
- /package/dist/{lib → util}/api/pollJob.d.ts +0 -0
- /package/dist/{lib → util}/api/pollJob.js +0 -0
- /package/dist/{lib → util}/assets.d.ts +0 -0
- /package/dist/{lib → util}/assets.js +0 -0
- /package/dist/{lib → util}/cart/CartContext.js +0 -0
- /package/dist/{lib/boq → util/cart}/toCartItem.js +0 -0
- /package/dist/{lib → util}/config.d.ts +0 -0
- /package/dist/{lib → util}/config.js +0 -0
- /package/dist/{lib → util}/estimators/fixedProducts.d.ts +0 -0
- /package/dist/{lib → util}/estimators/fixedProducts.js +0 -0
- /package/dist/{lib → util}/estimators/requestUnit.js +0 -0
- /package/dist/{lib → util}/estimators/resolveProducts.js +0 -0
- /package/dist/{lib → util}/estimators/types.d.ts +0 -0
- /package/dist/{lib → util}/estimators/types.js +0 -0
- /package/dist/{lib → util}/formatters.d.ts +0 -0
- /package/dist/{lib → util}/formatters.js +0 -0
- /package/dist/{lib/boq → util}/inputLimits.d.ts +0 -0
- /package/dist/{lib/boq → util}/inputLimits.js +0 -0
- /package/dist/{lib → util}/quoteHistory.d.ts +0 -0
- /package/dist/{lib → util}/quoteHistory.js +0 -0
- /package/dist/{lib → util}/useEscapeKey.d.ts +0 -0
- /package/dist/{lib → util}/useEscapeKey.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PhotoExtractedLine, ScheduleResult } from "
|
|
1
|
+
import type { PhotoExtractedLine, ScheduleResult } from "../types";
|
|
2
2
|
export interface ScheduleJobStatus {
|
|
3
3
|
status: "pending" | "processing" | "completed" | "failed";
|
|
4
4
|
result: ScheduleResult | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { CartItem } from "
|
|
2
|
+
import type { CartItem } from "../types";
|
|
3
3
|
interface CartApi {
|
|
4
4
|
cart: Record<string, CartItem>;
|
|
5
5
|
count: number;
|
|
@@ -10,7 +10,6 @@ interface CartApi {
|
|
|
10
10
|
updateCartSellUnits: (lineId: string, sellUnitsOverride: number) => void;
|
|
11
11
|
updateCartConversions: (conversions: Record<string, Partial<CartItem>>) => void;
|
|
12
12
|
clearCart: () => void;
|
|
13
|
-
/** Show the basket. Each app decides what that means for its own navigation. */
|
|
14
13
|
openBasket: () => void;
|
|
15
14
|
}
|
|
16
15
|
/** The inputs that can change a conversion, including the selected parent of a dependent line. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CartItem, MatchCandidate } from "
|
|
1
|
+
import type { CartItem, MatchCandidate } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Flattens a catalogue candidate's nested `conversion` block onto a CartItem, which
|
|
4
4
|
* util/pricing.ts reads to derive sell units. Extracted from ScheduleResultsStage so
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MatchCandidate } from "
|
|
1
|
+
import type { MatchCandidate } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* The unit to ask the basket for, given the product chosen for an estimator line. Only for
|
|
4
4
|
* estimator lines: a customer's "3 rolls" matched to a 2-roll pack is a different question.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MatchCandidate } from "
|
|
1
|
+
import type { MatchCandidate } from "../types";
|
|
2
2
|
import type { EstimatorToolId } from "../../components/estimators/registry";
|
|
3
3
|
import type { EstimatorRequirement } from "./types";
|
|
4
4
|
export interface ResolvedRequirement {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unitDisplayText } from "../
|
|
1
|
+
import { unitDisplayText } from "../components/unit/UnitDisplay";
|
|
2
2
|
import { getPricingBreakdown } from "./pricing";
|
|
3
3
|
// xlsx is several hundred KB and only needed on download, so it loads on first use.
|
|
4
4
|
const loadXlsx = () => import("xlsx");
|
|
@@ -95,7 +95,10 @@ export async function exportScheduleExcel(rows) {
|
|
|
95
95
|
totalRow[0] = "Estimated total";
|
|
96
96
|
totalRow[TOTAL_COL] = grandTotal;
|
|
97
97
|
wsData.push(totalRow);
|
|
98
|
-
wsData.push([
|
|
98
|
+
wsData.push([
|
|
99
|
+
"DISCLAIMER: These matches are generated automatically and should be reviewed before procurement, especially any items flagged as medium or low confidence.",
|
|
100
|
+
...Array(HEADER.length - 1).fill(null),
|
|
101
|
+
]);
|
|
99
102
|
const ws = XLSX.utils.aoa_to_sheet(wsData);
|
|
100
103
|
ws["!cols"] = [
|
|
101
104
|
{ wch: 12 },
|
|
@@ -130,7 +133,18 @@ export async function exportScheduleExcel(rows) {
|
|
|
130
133
|
XLSX.utils.book_append_sheet(wb, ws, "Schedule match");
|
|
131
134
|
XLSX.writeFile(wb, `schedule-quote-${dateStr}.xlsx`);
|
|
132
135
|
}
|
|
133
|
-
const BASKET_HEADER = [
|
|
136
|
+
const BASKET_HEADER = [
|
|
137
|
+
"Product ID",
|
|
138
|
+
"Description",
|
|
139
|
+
"Costing mode",
|
|
140
|
+
"Required amount",
|
|
141
|
+
"Req unit",
|
|
142
|
+
"Sell unit size",
|
|
143
|
+
"Sell unit",
|
|
144
|
+
"Required sell units",
|
|
145
|
+
"Unit price",
|
|
146
|
+
"Line total",
|
|
147
|
+
];
|
|
134
148
|
/** Basket has its own (much smaller) row shape than the full schedule match, so it gets its own export rather than forcing CartItem into ScheduleExportRow. */
|
|
135
149
|
export async function exportBasketExcel(items, account) {
|
|
136
150
|
const XLSX = await loadXlsx();
|
package/dist/util/pricing.js
CHANGED
|
@@ -155,7 +155,7 @@ export function getPricingBreakdown(item, options) {
|
|
|
155
155
|
requiredSellUnits: overriddenSellUnits,
|
|
156
156
|
unitPrice: item.price,
|
|
157
157
|
lineTotal: item.price != null && overriddenSellUnits != null ? item.price * overriddenSellUnits : null,
|
|
158
|
-
calculation: overriddenSellUnits != null ? `${reason}
|
|
158
|
+
calculation: overriddenSellUnits != null ? `${reason} Order quantity set to ${overriddenSellUnits} ${sellUnit}.` : reason,
|
|
159
159
|
costingMode: "review",
|
|
160
160
|
});
|
|
161
161
|
if (!Number.isFinite(requestedAmount) || requestedAmount <= 0)
|
package/dist/util/types.d.ts
CHANGED
|
@@ -245,7 +245,6 @@ export interface MatchResult {
|
|
|
245
245
|
dependent_rerank_applied: boolean;
|
|
246
246
|
linked_parent_selected_candidate_id: string | null;
|
|
247
247
|
linked_parent_selected_candidate_description: string | null;
|
|
248
|
-
dimension_reason_overridden: boolean;
|
|
249
248
|
rerank_line_item_input: {
|
|
250
249
|
procurement_intent: string;
|
|
251
250
|
procurement_aliases: string[];
|
package/package.json
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@metron-labs/quote-react",
|
|
3
|
-
"version": "0.1.
|
|
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.68",
|
|
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
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|