@metron-labs/quote-react 0.1.66 → 0.1.67

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.
Files changed (63) hide show
  1. package/dist/app/EstimatingTools.js +5 -5
  2. package/dist/app/QuickQuote.js +7 -7
  3. package/dist/app/stages/BasketStage.js +8 -8
  4. package/dist/app/stages/EntryStage.js +5 -5
  5. package/dist/app/stages/ScheduleResultsStage.js +8 -8
  6. package/dist/components/estimators/ArchitraveEstimator.js +1 -1
  7. package/dist/components/estimators/DeckingEstimator.js +2 -2
  8. package/dist/components/estimators/EstimatorResults.d.ts +1 -1
  9. package/dist/components/estimators/EstimatorResults.js +6 -6
  10. package/dist/components/estimators/EstimatorReviewStage.d.ts +1 -1
  11. package/dist/components/estimators/EstimatorReviewStage.js +1 -1
  12. package/dist/components/estimators/FencingEstimator.js +2 -2
  13. package/dist/components/estimators/PaintEstimator.js +1 -1
  14. package/dist/components/estimators/RoofTrussEstimator.js +1 -1
  15. package/dist/components/estimators/registry.d.ts +1 -1
  16. package/dist/components/estimators/useFixedBasket.js +3 -3
  17. package/dist/embed/quote.js +1 -1
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.js +3 -3
  20. package/dist/{lib → util}/api/fetchSchedule.d.ts +1 -1
  21. package/dist/{lib → util}/cart/CartContext.d.ts +1 -2
  22. package/dist/{lib/boq → util/cart}/toCartItem.d.ts +1 -1
  23. package/dist/{lib → util}/estimators/requestUnit.d.ts +1 -1
  24. package/dist/{lib → util}/estimators/resolveProducts.d.ts +1 -1
  25. package/dist/util/exportScheduleExcel.js +17 -3
  26. package/package.json +1 -1
  27. /package/dist/{app/components → components/unit}/UnitDisplay.d.ts +0 -0
  28. /package/dist/{app/components → components/unit}/UnitDisplay.js +0 -0
  29. /package/dist/{app/components → components/unit}/UnitLabel.d.ts +0 -0
  30. /package/dist/{app/components → components/unit}/UnitLabel.js +0 -0
  31. /package/dist/{lib → util}/ProductImage.d.ts +0 -0
  32. /package/dist/{lib → util}/ProductImage.js +0 -0
  33. /package/dist/{lib → util}/QuoteProvider.d.ts +0 -0
  34. /package/dist/{lib → util}/QuoteProvider.js +0 -0
  35. /package/dist/{lib → util}/analytics.d.ts +0 -0
  36. /package/dist/{lib → util}/analytics.js +0 -0
  37. /package/dist/{lib → util}/api/boqClient.d.ts +0 -0
  38. /package/dist/{lib → util}/api/boqClient.js +0 -0
  39. /package/dist/{lib → util}/api/boqSession.d.ts +0 -0
  40. /package/dist/{lib → util}/api/boqSession.js +0 -0
  41. /package/dist/{lib → util}/api/fetchSchedule.js +0 -0
  42. /package/dist/{lib → util}/api/pollJob.d.ts +0 -0
  43. /package/dist/{lib → util}/api/pollJob.js +0 -0
  44. /package/dist/{lib → util}/assets.d.ts +0 -0
  45. /package/dist/{lib → util}/assets.js +0 -0
  46. /package/dist/{lib → util}/cart/CartContext.js +0 -0
  47. /package/dist/{lib/boq → util/cart}/toCartItem.js +0 -0
  48. /package/dist/{lib → util}/config.d.ts +0 -0
  49. /package/dist/{lib → util}/config.js +0 -0
  50. /package/dist/{lib → util}/estimators/fixedProducts.d.ts +0 -0
  51. /package/dist/{lib → util}/estimators/fixedProducts.js +0 -0
  52. /package/dist/{lib → util}/estimators/requestUnit.js +0 -0
  53. /package/dist/{lib → util}/estimators/resolveProducts.js +0 -0
  54. /package/dist/{lib → util}/estimators/types.d.ts +0 -0
  55. /package/dist/{lib → util}/estimators/types.js +0 -0
  56. /package/dist/{lib → util}/formatters.d.ts +0 -0
  57. /package/dist/{lib → util}/formatters.js +0 -0
  58. /package/dist/{lib/boq → util}/inputLimits.d.ts +0 -0
  59. /package/dist/{lib/boq → util}/inputLimits.js +0 -0
  60. /package/dist/{lib → util}/quoteHistory.d.ts +0 -0
  61. /package/dist/{lib → util}/quoteHistory.js +0 -0
  62. /package/dist/{lib → util}/useEscapeKey.d.ts +0 -0
  63. /package/dist/{lib → util}/useEscapeKey.js +0 -0
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useRef, useState } from "react";
4
- import { assetUrl } from "../lib/assets";
5
- import { getQuoteConfig } from "../lib/config";
6
- import { TrackContext, useTracker } from "../lib/analytics";
4
+ import { assetUrl } from "../util/assets";
5
+ import { getQuoteConfig } from "../util/config";
6
+ import { TrackContext, useTracker } from "../util/analytics";
7
7
  import { ESTIMATOR_TOOLS } from "../components/estimators/registry";
8
- import { fixedBasketLines } from "../lib/estimators/fixedProducts";
8
+ import { fixedBasketLines } from "../util/estimators/fixedProducts";
9
9
  import { EstimatorBasketLoading, useFixedBasket } from "../components/estimators/useFixedBasket";
10
- import { CartProvider, useCart } from "../lib/cart/CartContext";
10
+ import { CartProvider, useCart } from "../util/cart/CartContext";
11
11
  import BasketStage from "./stages/BasketStage";
12
12
  import EstimatorReviewStage from "../components/estimators/EstimatorReviewStage";
13
13
  export default function EstimatingTools(props) {
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useRef, useEffect, useCallback } from "react";
4
- import { getQuoteConfig } from "../lib/config";
5
- import { TrackContext, useTracker } from "../lib/analytics";
6
- import { submitSchedule, pollScheduleJob } from "../lib/api/fetchSchedule";
7
- import { pollJob } from "../lib/api/pollJob";
4
+ import { getQuoteConfig } from "../util/config";
5
+ import { TrackContext, useTracker } from "../util/analytics";
6
+ import { submitSchedule, pollScheduleJob } from "../util/api/fetchSchedule";
7
+ import { pollJob } from "../util/api/pollJob";
8
8
  import { ENTRY_DRAFT_KEY } from "./stages/EntryStage";
9
- import { CartProvider, useCart } from "../lib/cart/CartContext";
10
- import { installQuoteHistory, setStep, stepBack } from "../lib/quoteHistory";
9
+ import { CartProvider, useCart } from "../util/cart/CartContext";
10
+ import { installQuoteHistory, setStep, stepBack } from "../util/quoteHistory";
11
11
  import BasketStage from "./stages/BasketStage";
12
12
  import EntryStage from "./stages/EntryStage";
13
13
  import ScheduleResultsStage from "./stages/ScheduleResultsStage";
@@ -110,7 +110,7 @@ function QuickQuoteInner({ fullPage = false, hideHeader = false, internal = fals
110
110
  }, []);
111
111
  const leavingBasket = useRef(false);
112
112
  useEffect(() => {
113
- // Host routers (Turbo, Salesfire) are kept out of these by lib/quoteHistory.
113
+ // Host routers (Turbo, Salesfire) are kept out of these by util/quoteHistory.
114
114
  const onPopState = () => {
115
115
  leavingBasket.current = false;
116
116
  const hash = window.location.hash;
@@ -1,18 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useId, useRef, useState } from "react";
3
- import { apiUrl } from "../../lib/config";
4
- import { useTrack } from "../../lib/analytics";
5
- import { fmtCurrency } from "../../lib/formatters";
3
+ import { apiUrl } from "../../util/config";
4
+ import { useTrack } from "../../util/analytics";
5
+ import { fmtCurrency } from "../../util/formatters";
6
6
  import { getCartSubtotal, getPricingBreakdown } from "../../util/pricing";
7
7
  import { exportBasketExcel } from "../../util/exportScheduleExcel";
8
- import { renderDisplayUnit, unitDisplayText } from "../components/UnitDisplay";
9
- import { clientHeaders, getBoqClientId, readJson } from "../../lib/api/boqClient";
10
- import { MAX_ORDER_QTY } from "../../lib/boq/inputLimits";
11
- import { conversionInputKey } from "../../lib/cart/CartContext";
8
+ import { renderDisplayUnit, unitDisplayText } from "../../components/unit/UnitDisplay";
9
+ import { clientHeaders, getBoqClientId, readJson } from "../../util/api/boqClient";
10
+ import { MAX_ORDER_QTY } from "../../util/inputLimits";
11
+ import { conversionInputKey } from "../../util/cart/CartContext";
12
12
  import BackArrow from "../../components/BackArrow";
13
13
  import ChevronIcon from "../../components/ChevronIcon";
14
14
  import TrashIcon from "../../components/TrashIcon";
15
- import ProductImage from "../../lib/ProductImage";
15
+ import ProductImage from "../../util/ProductImage";
16
16
  const VAT_RATE = 0.2; //Flat UK VAT rate, matching fmtCurrency's GBP-only assumption elsewhere in this app.
17
17
  const PAGE_SIZE = 10;
18
18
  const INVALID_EMAIL_MESSAGE = "Enter a valid email address so we can send your quote.";
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from "react";
3
- import { assetUrl } from "../../lib/assets";
4
- import { useTrack } from "../../lib/analytics";
5
- import { FILE_EXTENSIONS, isPhotoFile, shrinkPhoto, validateLines, validateUploadFile } from "../../lib/boq/inputLimits";
3
+ import { assetUrl } from "../../util/assets";
4
+ import { useTrack } from "../../util/analytics";
5
+ import { FILE_EXTENSIONS, isPhotoFile, shrinkPhoto, validateLines, validateUploadFile } from "../../util/inputLimits";
6
6
  import { ProcessingContent } from "./ProcessingStage";
7
- import { useEscapeKey } from "../../lib/useEscapeKey";
8
- import { setStep, stepBack } from "../../lib/quoteHistory";
7
+ import { useEscapeKey } from "../../util/useEscapeKey";
8
+ import { setStep, stepBack } from "../../util/quoteHistory";
9
9
  import ForwardArrow from "../../components/ForwardArrow";
10
10
  import CloseIcon from "../../components/CloseIcon";
11
11
  const UPLOAD_ACCEPT = [...FILE_EXTENSIONS.schedule, ...FILE_EXTENSIONS.photo].join(",");
@@ -1,19 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Fragment, useEffect, useRef, useState } from "react";
3
- import { apiUrl, getQuoteConfig } from "../../lib/config";
4
- import { useTrack } from "../../lib/analytics";
5
- import { renderDisplayUnit, formatPriceBasis } from "../components/UnitDisplay";
6
- import { fmtCurrency, fmtQty } from "../../lib/formatters";
7
- import { candidateToCartItem } from "../../lib/boq/toCartItem";
8
- import { apiHeaders, getBoqClientId, readJson } from "../../lib/api/boqClient";
3
+ import { apiUrl, getQuoteConfig } from "../../util/config";
4
+ import { useTrack } from "../../util/analytics";
5
+ import { renderDisplayUnit, formatPriceBasis } from "../../components/unit/UnitDisplay";
6
+ import { fmtCurrency, fmtQty } from "../../util/formatters";
7
+ import { candidateToCartItem } from "../../util/cart/toCartItem";
8
+ import { apiHeaders, getBoqClientId, readJson } from "../../util/api/boqClient";
9
9
  import { exportScheduleExcel } from "../../util/exportScheduleExcel";
10
- import { useEscapeKey } from "../../lib/useEscapeKey";
10
+ import { useEscapeKey } from "../../util/useEscapeKey";
11
11
  import { getCartSubtotal, getPricingBreakdown } from "../../util/pricing";
12
12
  import BackArrow from "../../components/BackArrow";
13
13
  import RefreshIcon from "../../components/RefreshIcon";
14
14
  import ForwardArrow from "../../components/ForwardArrow";
15
15
  import CloseIcon from "../../components/CloseIcon";
16
- import ProductImage from "../../lib/ProductImage";
16
+ import ProductImage from "../../util/ProductImage";
17
17
  const NO_SELECTION = "__none__";
18
18
  const PAGE_SIZE = 24;
19
19
  const SORT_OPTIONS = [
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
- import { offersOption } from "../../lib/estimators/fixedProducts";
4
+ import { offersOption } from "../../util/estimators/fixedProducts";
5
5
  const PROFILES = [
6
6
  { id: "ogee", label: "Ogee", blurb: "Traditional curved profile" },
7
7
  { id: "torus", label: "Torus", blurb: "Soft rounded detail" },
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useRef, useState } from "react";
4
- import { assetUrl } from "../../lib/assets";
5
- import { offersOption } from "../../lib/estimators/fixedProducts";
4
+ import { assetUrl } from "../../util/assets";
5
+ import { offersOption } from "../../util/estimators/fixedProducts";
6
6
  import ForwardArrow from "../ForwardArrow";
7
7
  const CANVAS_WIDTH_M = 12;
8
8
  const CANVAS_HEIGHT_M = 8;
@@ -1,4 +1,4 @@
1
- import type { EstimatorRequirement } from "../../lib/estimators/types";
1
+ import type { EstimatorRequirement } from "../../util/estimators/types";
2
2
  import type { EstimatorToolId } from "./registry";
3
3
  interface EstimatorResultsProps {
4
4
  toolId: EstimatorToolId;
@@ -4,12 +4,12 @@ import { Fragment, useEffect, useMemo, useRef, useState } from "react";
4
4
  import BackArrow from "../BackArrow";
5
5
  import BrickWall from "../BrickWall";
6
6
  import ForwardArrow from "../ForwardArrow";
7
- import { renderDisplayUnit, formatPriceBasis } from "../../app/components/UnitDisplay";
8
- import { useOptionalCart } from "../../lib/cart/CartContext";
9
- import { candidateToCartItem } from "../../lib/boq/toCartItem";
10
- import { estimateRequestUnit, fetchCatalogueStatus, resolveRequirements, searchCatalogue } from "../../lib/estimators/resolveProducts";
11
- import { fmtCurrency, fmtQty } from "../../lib/formatters";
12
- import ProductImage from "../../lib/ProductImage";
7
+ import { renderDisplayUnit, formatPriceBasis } from "../../components/unit/UnitDisplay";
8
+ import { useOptionalCart } from "../../util/cart/CartContext";
9
+ import { candidateToCartItem } from "../../util/cart/toCartItem";
10
+ import { estimateRequestUnit, fetchCatalogueStatus, resolveRequirements, searchCatalogue } from "../../util/estimators/resolveProducts";
11
+ import { fmtCurrency, fmtQty } from "../../util/formatters";
12
+ import ProductImage from "../../util/ProductImage";
13
13
  import { getPricingBreakdown } from "../../util/pricing";
14
14
  const SORT_OPTIONS = [
15
15
  { dir: "asc", label: "Description (A-Z)" },
@@ -1,5 +1,5 @@
1
1
  import type { EstimatorToolId } from "./registry";
2
- import type { EstimatorRequirement } from "../../lib/estimators/types";
2
+ import type { EstimatorRequirement } from "../../util/estimators/types";
3
3
  interface EstimatorReviewStageProps {
4
4
  toolId: EstimatorToolId;
5
5
  toolTitle: string;
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useCallback, useState } from "react";
4
4
  import EstimatorResults from "./EstimatorResults";
5
- import { fmtCurrency } from "../../lib/formatters";
5
+ import { fmtCurrency } from "../../util/formatters";
6
6
  /**
7
7
  * The product-matching step. Its own screen between the calculator and the basket,
8
8
  * mirroring the Quick Quote results stage.
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useRef, useState } from "react";
4
- import { assetUrl } from "../../lib/assets";
5
- import { offersOption } from "../../lib/estimators/fixedProducts";
4
+ import { assetUrl } from "../../util/assets";
5
+ import { offersOption } from "../../util/estimators/fixedProducts";
6
6
  import ForwardArrow from "../ForwardArrow";
7
7
  const GRID_SIZE = 12;
8
8
  const CELL_PX = 30;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
- import { fixedProductSearch } from "../../lib/estimators/fixedProducts";
4
+ import { fixedProductSearch } from "../../util/estimators/fixedProducts";
5
5
  const PAINT_COVERAGE_M2_PER_LITRE = 10;
6
6
  const DOOR_AREA_M2 = 1.9 * 0.762;
7
7
  const DOUBLE_DOOR_AREA_M2 = 1.9 * 1.524;
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import ForwardArrow from "../ForwardArrow";
5
- import { fmtCurrency } from "../../lib/formatters";
5
+ import { fmtCurrency } from "../../util/formatters";
6
6
  const CONFIG = {
7
7
  ranges: {
8
8
  standard: {
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType } from "react";
2
- import type { EstimatorRequirement } from "../../lib/estimators/types";
2
+ import type { EstimatorRequirement } from "../../util/estimators/types";
3
3
  export type EstimatorToolId = "truss" | "fencing" | "decking" | "brick-block" | "paint" | "skirting" | "architrave" | "concrete-aggregate" | "plasterboard" | "insulation" | "timber" | "paving";
4
4
  /** How a merchant thinks about the jobs, not how the components are filed. */
5
5
  export type EstimatorGroup = "Structure & Envelope" | "Outdoor" | "Interiors" | "Groundwork";
@@ -2,9 +2,9 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import BrickWall from "../BrickWall";
5
- import { useCart } from "../../lib/cart/CartContext";
6
- import { candidateToCartItem } from "../../lib/boq/toCartItem";
7
- import { estimateRequestUnit, searchCatalogue } from "../../lib/estimators/resolveProducts";
5
+ import { useCart } from "../../util/cart/CartContext";
6
+ import { candidateToCartItem } from "../../util/cart/toCartItem";
7
+ import { estimateRequestUnit, searchCatalogue } from "../../util/estimators/resolveProducts";
8
8
  const MIN_BASKET_LOADING_MS = 1500;
9
9
  export function useFixedBasket(toolTitle) {
10
10
  const { addManyToCart, clearCart, openBasket } = useCart();