@burdenoff/microfe-movethewheels 2026.1016.2 → 2026.1016.4

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 (113) hide show
  1. package/README.md +10 -0
  2. package/dist/MoveTheWheelsRoot.js +5 -0
  3. package/dist/MoveTheWheelsRoutes.js +25 -21
  4. package/dist/components/ContainerEvidencePicker.js +55 -55
  5. package/dist/components/FleetAlertsPanel.js +2 -2
  6. package/dist/components/freight-cost/FreightCommercialEditor.js +217 -0
  7. package/dist/components/freight-cost/FreightCommercialFactEditor.js +217 -0
  8. package/dist/components/freight-cost/FreightCommercialHistory.js +115 -0
  9. package/dist/components/freight-cost/FreightDraftForm.js +106 -91
  10. package/dist/components/freight-cost/FreightHistory.js +42 -40
  11. package/dist/components/freight-invoice/InvoiceForm.js +366 -0
  12. package/dist/components/freight-invoice/InvoiceResults.js +240 -0
  13. package/dist/generated/consolidation-operations.d.ts +195 -265
  14. package/dist/generated/container-condition-operations.d.ts +124 -187
  15. package/dist/generated/container-operations.d.ts +59 -85
  16. package/dist/generated/empty-reuse-operations.d.ts +165 -271
  17. package/dist/generated/free-time-operations.d.ts +120 -184
  18. package/dist/generated/freight-cost-operations.d.ts +955 -165
  19. package/dist/generated/freight-invoice-operations.d.ts +1447 -0
  20. package/dist/generated/logistics-procedure-operations.d.ts +100 -156
  21. package/dist/generated/pending-pick-operations.d.ts +769 -1025
  22. package/dist/generated/shipment-status-authority-operations.d.ts +82 -103
  23. package/dist/generated/stock-binding-operations.d.ts +188 -260
  24. package/dist/generated/stock-observation-operations.d.ts +103 -138
  25. package/dist/generated/tracking-quality-operations.d.ts +27 -41
  26. package/dist/generated/trip-utilization-operations.d.ts +137 -185
  27. package/dist/generated/wspace-operations.d.ts +628 -2272
  28. package/dist/generated/wspace-types.d.ts +4 -23
  29. package/dist/hooks/useFreightRecoveryAction.js +20 -20
  30. package/dist/hooks/useInvoiceComparisonRecovery.js +118 -0
  31. package/dist/movethewheels/components/ContainerEvidencePicker.d.ts +2 -1
  32. package/dist/movethewheels/components/freight-cost/FreightCommercialEditor.d.ts +8 -0
  33. package/dist/movethewheels/components/freight-cost/FreightCommercialFactEditor.d.ts +8 -0
  34. package/dist/movethewheels/components/freight-cost/FreightCommercialHistory.d.ts +4 -0
  35. package/dist/movethewheels/components/freight-cost/FreightDraftForm.d.ts +4 -2
  36. package/dist/movethewheels/components/freight-cost/FreightHistory.d.ts +2 -2
  37. package/dist/movethewheels/components/freight-invoice/InvoiceForm.d.ts +19 -0
  38. package/dist/movethewheels/components/freight-invoice/InvoiceResults.d.ts +9 -0
  39. package/dist/movethewheels/hooks/useFleet.d.ts +1 -1
  40. package/dist/movethewheels/hooks/useFleetIntelligence.d.ts +1 -1
  41. package/dist/movethewheels/hooks/useInvoiceComparisonRecovery.d.ts +22 -0
  42. package/dist/movethewheels/hooks/useProcedureSelection.d.ts +1 -3
  43. package/dist/movethewheels/pages/FreightInvoicePage.d.ts +10 -0
  44. package/dist/movethewheels/utils/driverLicenseExpiry.d.ts +6 -0
  45. package/dist/movethewheels/utils/freightCommercial.d.ts +44 -0
  46. package/dist/movethewheels/utils/invoiceComparison.d.ts +32 -0
  47. package/dist/pages/DriverDetailsPage.js +306 -282
  48. package/dist/pages/FreightEstimatePage.js +97 -92
  49. package/dist/pages/FreightInvoicePage.js +346 -0
  50. package/dist/src/generated/consolidation-operations.js +3961 -503
  51. package/dist/src/generated/container-condition-operations.js +2968 -206
  52. package/dist/src/generated/container-operations.js +997 -99
  53. package/dist/src/generated/empty-reuse-operations.js +4811 -747
  54. package/dist/src/generated/free-time-operations.js +2824 -233
  55. package/dist/src/generated/freight-cost-operations.js +4852 -323
  56. package/dist/src/generated/freight-invoice-operations.js +4894 -0
  57. package/dist/src/generated/logistics-procedure-operations.js +2707 -360
  58. package/dist/src/generated/pending-pick-operations.js +8244 -1196
  59. package/dist/src/generated/shipment-status-authority-operations.js +1157 -84
  60. package/dist/src/generated/stock-binding-operations.js +2779 -173
  61. package/dist/src/generated/stock-observation-operations.js +1274 -91
  62. package/dist/src/generated/tracking-quality-operations.js +407 -42
  63. package/dist/src/generated/trip-utilization-operations.js +1765 -138
  64. package/dist/src/generated/wspace-operations.js +428 -706
  65. package/dist/utils/driverLicenseExpiry.js +14 -0
  66. package/dist/utils/freightAcknowledgement.js +6 -5
  67. package/dist/utils/freightCommercial.js +194 -0
  68. package/dist/utils/freightRecovery.js +22 -22
  69. package/dist/utils/invoiceComparison.js +272 -0
  70. package/package.json +30 -29
  71. package/src/generated/consolidation-operations.ts +60 -559
  72. package/src/generated/container-condition-operations.ts +63 -265
  73. package/src/generated/container-operations.ts +37 -132
  74. package/src/generated/empty-reuse-operations.ts +83 -824
  75. package/src/generated/free-time-operations.ts +55 -284
  76. package/src/generated/freight-cost-operations.ts +373 -349
  77. package/src/generated/freight-invoice-operations.ts +830 -0
  78. package/src/generated/logistics-procedure-operations.ts +60 -414
  79. package/src/generated/pending-pick-operations.ts +48 -1239
  80. package/src/generated/shipment-status-authority-operations.ts +33 -113
  81. package/src/generated/stock-binding-operations.ts +29 -198
  82. package/src/generated/stock-observation-operations.ts +24 -111
  83. package/src/generated/tracking-quality-operations.ts +19 -57
  84. package/src/generated/trip-utilization-operations.ts +32 -166
  85. package/src/generated/wspace-operations.ts +284 -2906
  86. package/src/generated/wspace-types.ts +2 -8
  87. package/src/movethewheels/MoveTheWheelsRoot.tsx +6 -0
  88. package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
  89. package/src/movethewheels/components/ContainerEvidencePicker.tsx +12 -4
  90. package/src/movethewheels/components/FleetAlertsPanel.tsx +4 -2
  91. package/src/movethewheels/components/freight-cost/FreightCommercialEditor.tsx +236 -0
  92. package/src/movethewheels/components/freight-cost/FreightCommercialFactEditor.tsx +258 -0
  93. package/src/movethewheels/components/freight-cost/FreightCommercialHistory.tsx +90 -0
  94. package/src/movethewheels/components/freight-cost/FreightDraftForm.tsx +33 -4
  95. package/src/movethewheels/components/freight-cost/FreightHistory.tsx +4 -2
  96. package/src/movethewheels/components/freight-invoice/InvoiceForm.tsx +412 -0
  97. package/src/movethewheels/components/freight-invoice/InvoiceResults.tsx +162 -0
  98. package/src/movethewheels/hooks/useFleet.ts +1 -1
  99. package/src/movethewheels/hooks/useFleetIntelligence.ts +5 -1
  100. package/src/movethewheels/hooks/useFreightRecoveryAction.ts +2 -1
  101. package/src/movethewheels/hooks/useInvoiceComparisonRecovery.ts +227 -0
  102. package/src/movethewheels/pages/DriverDetailsPage.tsx +35 -9
  103. package/src/movethewheels/pages/FreightEstimatePage.tsx +15 -7
  104. package/src/movethewheels/pages/FreightInvoicePage.tsx +477 -0
  105. package/src/movethewheels/utils/driverLicenseExpiry.ts +25 -0
  106. package/src/movethewheels/utils/freightAcknowledgement.ts +3 -1
  107. package/src/movethewheels/utils/freightCommercial.ts +388 -0
  108. package/src/movethewheels/utils/freightRecovery.ts +6 -2
  109. package/src/movethewheels/utils/invoiceComparison.ts +520 -0
  110. package/src/operations/freight-cost/commercial.graphql +483 -0
  111. package/src/operations/freight-invoice/comparison.graphql +40 -0
  112. package/src/operations/wspace/freight-invoice-evidence.graphql +6 -0
  113. package/patches/braces@3.0.3.patch +0 -87
package/README.md CHANGED
@@ -87,3 +87,13 @@ Proprietary - Copyright Burdenoff Consultancy Services Pvt. Ltd.
87
87
  The existing pending-plan receipt can open an independent review panel. It reuses canonical workspace permissions and the shared Files exact-version picker, typed owning candidate operations, bounded history, explicit handling/SOP references, action/quantity/exclusive validity and approve/reject/revoke decisions. Before dispatch, the panel preserves the intended nonsecret idempotency UUID in tab sessionStorage scoped to actor/workspace/task/intent. A missing storage capability holds before submission; an uncertain result stops further decisions and remains stopped across a same-tab refresh. The owning mutation receipt must match its kind, task, intent hash, subject, request key, reviewer, predecessor/version and declared action/quantity/time scope before the saved key is cleared or success shown. A missing/null/mismatched receipt remains unknown with the key retained. Read-only receipts display request keys for reconciliation; an absent paginated result is not proof of no commit. There is no resend/clear control or automatic mutation retry. Closing the tab/clearing storage is not a durable no-replay certificate; preserve the intended key and reconcile the unknown before another decision. The backend's exact-body idempotency remains authoritative.
88
88
 
89
89
  An approval is review-only: reserved/staged quantities stay zero. No stock move, scan execution, safety/qualification certificate, live deployment or full F04/UI acceptance is claimed by this source candidate. `graphql/pending-pick.graphql` is regenerated from the owning backend candidate and explicitly is not a published Hive contract; actual Both schema/package/host/ordinary-actor/Files and Playwright acceptance remain release gates.
90
+
91
+ ### Manual freight invoice comparison candidate — BOFF-4395 / BOFF-8598
92
+
93
+ The finance page compares manually reported supplier invoice rows with one explicitly selected immutable estimate/quote version. It preserves unknown amounts and source dates, explicit row mappings, supplier/invoice references, payer and currency conventions. Sourced amounts use exact decimal input and currency display; the existing amount editor accepts up to 20 whole digits and rejects excess fractional precision without rounding. The wire contract retains integer minor-unit strings, including larger existing receipts. Changing an unsent currency convention clears its amount rather than reinterpreting it. Quantity/rate differences, incomparable rows, unknown expected-charge coverage and comparable-only subtotals remain distinct. This does not establish acceptance, contracted liability, approval, FX conversion or payment.
94
+
95
+ Structural preview must match the exact version and current source facts. Recording additionally requires current shipment update permission, current readable exact Files versions, and an owning immutable receipt. Corrections append against the latest loaded predecessor. Known receipt history opens after confirmation and survives a bookmarked URL; complete supplier/invoice discovery is not implemented by the five-operation backend contract. Manual identity lookup is available only in the advanced disclosure.
96
+
97
+ Before one mutation dispatch, the complete normalized business intent and original request key are retained in tab sessionStorage. A lost/malformed reply remains unresolved across refresh and prevents another save or new key. Recovery rechecks the original public scope between its original-key read and exact-receipt read, then before confirmation; null never proves no effect or permits retry. Confirmation checks the full business tuple, exact evidence, visible direct actor, revision/predecessor and stable server fingerprint. Retained source facts are hidden whenever that readable public scope is unavailable or different. Public canonical actor/workspace/organization/project/tenant scope is compared locally; it does not reproduce the server's full trusted context or recompute its fingerprint. No token or credential is decoded, persisted or logged by this feature. Storage is tab-scoped; closing the tab or clearing browser data is not proof of no commit.
98
+
99
+ Generate the additive typed snapshot with `bun scripts/generate-freight-invoice-contract.ts <owning-combined-SDL>` and normal `bun run codegen`; generated TypeScript is not hand-edited. `verify:freight-invoice` runs strict source/receipt and actual recovery-hook controls in normal sanity and PR CI. The existing live-contract gate includes the new project. Source/local synthetic browser checks do not establish deployed schema, genuine permissions, Files eligibility or end-to-end acceptance. Official backend/schema, MFE/host publication and ordinary-account Alpha/Production acceptance remain separate gates. Existing BOFF-9129 dependency findings remain unwaived; the unrelated responsive PR is not included.
@@ -223,6 +223,11 @@ var E = ({ registerNavItems: v, basePath: b = "/" }) => {
223
223
  icon: /* @__PURE__ */ S(a, { size: 16 }),
224
224
  order: 9,
225
225
  children: [{
226
+ id: "mtw-freight-invoice-comparisons",
227
+ label: C("movethewheels.root.nav.freightInvoices", "Freight invoice comparisons"),
228
+ path: E(b, "finance/freight-invoice-comparisons"),
229
+ icon: /* @__PURE__ */ S(a, { size: 16 })
230
+ }, {
226
231
  id: "mtw-freight-estimates",
227
232
  label: C("movethewheels.root.nav.freightEstimates", "Freight cost estimates"),
228
233
  path: E(b, "finance/freight-estimates"),
@@ -28,8 +28,8 @@ function d() {
28
28
  })
29
29
  });
30
30
  }
31
- var f = r(() => import("./pages/DashboardPage.js")), p = r(() => import("./pages/OrdersListPage.js")), m = r(() => import("./pages/OrderDetailsPage.js")), h = r(() => import("./pages/CreateOrderPage.js")), g = r(() => import("./pages/TrackingPage.js")), _ = r(() => import("./pages/TrackingEventQualityPage.js")), v = r(() => import("./pages/ShipmentStatusAuthorityPage.js")), y = r(() => import("./pages/LiveTrackingPage.js")), b = r(() => import("./pages/FleetPage.js")), x = r(() => import("./pages/VehiclesPage.js")), S = r(() => import("./pages/VehicleDetailsPage.js")), C = r(() => import("./pages/DriversPage.js")), w = r(() => import("./pages/DriverDetailsPage.js")), T = r(() => import("./pages/InventoryPage.js")), E = r(() => import("./pages/ProductsPage.js")), D = r(() => import("./pages/ProductDetailsPage.js")), O = r(() => import("./pages/WarehousesPage.js")), k = r(() => import("./pages/WarehouseDetailsPage.js")), A = r(() => import("./pages/CustomersPage.js")), j = r(() => import("./pages/CustomerDetailsPage.js")), M = r(() => import("./pages/RoutesPage.js")), N = r(() => import("./pages/RouteDetailsPage.js")), P = r(() => import("./pages/AnalyticsPage.js")), ee = r(() => import("./pages/FinancePage.js")), F = r(() => import("./pages/FreightEstimatePage.js")), I = r(() => import("./pages/ConsolidationPage.js")), L = r(() => import("./pages/LogisticsProceduresPage.js")), R = r(() => import("./pages/MarketplacePage.js")), z = r(() => import("./pages/ImportExportPage.js")), B = r(() => import("./pages/ReportsPage.js")), V = r(() => import("./pages/SettingsPage.js")), H = r(() => import("./pages/AIAssistantPage.js")), U = r(() => import("./pages/DeliveryCapturePage.js")), W = r(() => import("./pages/MultiModalShipmentPage.js")), G = r(() => import("./pages/ShippingRatesPage.js")), K = r(() => import("./pages/ContainersPage.js")), q = r(() => import("./pages/ContainerConditionPage.js")), J = r(() => import("./pages/FreeTimePage.js")), Y = r(() => import("./pages/PendingPickPage.js")), X = r(() => import("./pages/StockObservationsPage.js")), Z = r(() => import("./pages/StockBindingPage.js")), Q = r(() => import("./pages/TripUtilizationPage.js")), $ = r(() => import("./pages/EmptyReusePage.js"));
32
- function te() {
31
+ var f = r(() => import("./pages/DashboardPage.js")), p = r(() => import("./pages/OrdersListPage.js")), m = r(() => import("./pages/OrderDetailsPage.js")), h = r(() => import("./pages/CreateOrderPage.js")), g = r(() => import("./pages/TrackingPage.js")), _ = r(() => import("./pages/TrackingEventQualityPage.js")), v = r(() => import("./pages/ShipmentStatusAuthorityPage.js")), y = r(() => import("./pages/LiveTrackingPage.js")), b = r(() => import("./pages/FleetPage.js")), x = r(() => import("./pages/VehiclesPage.js")), S = r(() => import("./pages/VehicleDetailsPage.js")), C = r(() => import("./pages/DriversPage.js")), w = r(() => import("./pages/DriverDetailsPage.js")), T = r(() => import("./pages/InventoryPage.js")), E = r(() => import("./pages/ProductsPage.js")), D = r(() => import("./pages/ProductDetailsPage.js")), O = r(() => import("./pages/WarehousesPage.js")), k = r(() => import("./pages/WarehouseDetailsPage.js")), A = r(() => import("./pages/CustomersPage.js")), j = r(() => import("./pages/CustomerDetailsPage.js")), M = r(() => import("./pages/RoutesPage.js")), N = r(() => import("./pages/RouteDetailsPage.js")), P = r(() => import("./pages/AnalyticsPage.js")), ee = r(() => import("./pages/FinancePage.js")), F = r(() => import("./pages/FreightEstimatePage.js")), I = r(() => import("./pages/FreightInvoicePage.js")), L = r(() => import("./pages/ConsolidationPage.js")), R = r(() => import("./pages/LogisticsProceduresPage.js")), z = r(() => import("./pages/MarketplacePage.js")), B = r(() => import("./pages/ImportExportPage.js")), V = r(() => import("./pages/ReportsPage.js")), H = r(() => import("./pages/SettingsPage.js")), U = r(() => import("./pages/AIAssistantPage.js")), W = r(() => import("./pages/DeliveryCapturePage.js")), G = r(() => import("./pages/MultiModalShipmentPage.js")), K = r(() => import("./pages/ShippingRatesPage.js")), q = r(() => import("./pages/ContainersPage.js")), J = r(() => import("./pages/ContainerConditionPage.js")), Y = r(() => import("./pages/FreeTimePage.js")), X = r(() => import("./pages/PendingPickPage.js")), Z = r(() => import("./pages/StockObservationsPage.js")), Q = r(() => import("./pages/StockBindingPage.js")), $ = r(() => import("./pages/TripUtilizationPage.js")), te = r(() => import("./pages/EmptyReusePage.js"));
32
+ function ne() {
33
33
  return /* @__PURE__ */ s(n, {
34
34
  fallback: /* @__PURE__ */ s(d, {}),
35
35
  children: /* @__PURE__ */ c(a, { children: [
@@ -71,39 +71,39 @@ function te() {
71
71
  }),
72
72
  /* @__PURE__ */ s(i, {
73
73
  path: "deliveries/mine",
74
- element: /* @__PURE__ */ s(U, {})
74
+ element: /* @__PURE__ */ s(W, {})
75
75
  }),
76
76
  /* @__PURE__ */ s(i, {
77
77
  path: "shipments/multi-modal",
78
- element: /* @__PURE__ */ s(W, {})
78
+ element: /* @__PURE__ */ s(G, {})
79
79
  }),
80
80
  /* @__PURE__ */ s(i, {
81
81
  path: "shipments/rates",
82
- element: /* @__PURE__ */ s(G, {})
82
+ element: /* @__PURE__ */ s(K, {})
83
83
  }),
84
84
  /* @__PURE__ */ s(i, {
85
85
  path: "containers",
86
- element: /* @__PURE__ */ s(K, {})
86
+ element: /* @__PURE__ */ s(q, {})
87
87
  }),
88
88
  /* @__PURE__ */ s(i, {
89
89
  path: "containers/condition",
90
- element: /* @__PURE__ */ s(q, {})
90
+ element: /* @__PURE__ */ s(J, {})
91
91
  }),
92
92
  /* @__PURE__ */ s(i, {
93
93
  path: "containers/free-time",
94
- element: /* @__PURE__ */ s(J, {})
94
+ element: /* @__PURE__ */ s(Y, {})
95
95
  }),
96
96
  /* @__PURE__ */ s(i, {
97
97
  path: "containers/empty-reuse",
98
- element: /* @__PURE__ */ s($, {})
98
+ element: /* @__PURE__ */ s(te, {})
99
99
  }),
100
100
  /* @__PURE__ */ s(i, {
101
101
  path: "containers/consolidation",
102
- element: /* @__PURE__ */ s(I, {})
102
+ element: /* @__PURE__ */ s(L, {})
103
103
  }),
104
104
  /* @__PURE__ */ s(i, {
105
105
  path: "containers/procedures",
106
- element: /* @__PURE__ */ s(L, {})
106
+ element: /* @__PURE__ */ s(R, {})
107
107
  }),
108
108
  /* @__PURE__ */ s(i, {
109
109
  path: "fleet",
@@ -147,15 +147,15 @@ function te() {
147
147
  }),
148
148
  /* @__PURE__ */ s(i, {
149
149
  path: "inventory/source-assessments",
150
- element: /* @__PURE__ */ s(Z, {})
150
+ element: /* @__PURE__ */ s(Q, {})
151
151
  }),
152
152
  /* @__PURE__ */ s(i, {
153
153
  path: "inventory/reported-issues",
154
- element: /* @__PURE__ */ s(X, {})
154
+ element: /* @__PURE__ */ s(Z, {})
155
155
  }),
156
156
  /* @__PURE__ */ s(i, {
157
157
  path: "inventory/pending-picks",
158
- element: /* @__PURE__ */ s(Y, {})
158
+ element: /* @__PURE__ */ s(X, {})
159
159
  }),
160
160
  /* @__PURE__ */ s(i, {
161
161
  path: "inventory/products",
@@ -207,7 +207,7 @@ function te() {
207
207
  }),
208
208
  /* @__PURE__ */ s(i, {
209
209
  path: "routes/trip-utilization",
210
- element: /* @__PURE__ */ s(Q, {})
210
+ element: /* @__PURE__ */ s($, {})
211
211
  }),
212
212
  /* @__PURE__ */ s(i, {
213
213
  path: "routes/new",
@@ -233,25 +233,29 @@ function te() {
233
233
  path: "finance/freight-estimates",
234
234
  element: /* @__PURE__ */ s(F, {})
235
235
  }),
236
+ /* @__PURE__ */ s(i, {
237
+ path: "finance/freight-invoice-comparisons",
238
+ element: /* @__PURE__ */ s(I, {})
239
+ }),
236
240
  /* @__PURE__ */ s(i, {
237
241
  path: "marketplace",
238
- element: /* @__PURE__ */ s(R, {})
242
+ element: /* @__PURE__ */ s(z, {})
239
243
  }),
240
244
  /* @__PURE__ */ s(i, {
241
245
  path: "import-export",
242
- element: /* @__PURE__ */ s(z, {})
246
+ element: /* @__PURE__ */ s(B, {})
243
247
  }),
244
248
  /* @__PURE__ */ s(i, {
245
249
  path: "reports",
246
- element: /* @__PURE__ */ s(B, {})
250
+ element: /* @__PURE__ */ s(V, {})
247
251
  }),
248
252
  /* @__PURE__ */ s(i, {
249
253
  path: "ai-assistant",
250
- element: /* @__PURE__ */ s(H, {})
254
+ element: /* @__PURE__ */ s(U, {})
251
255
  }),
252
256
  /* @__PURE__ */ s(i, {
253
257
  path: "settings",
254
- element: /* @__PURE__ */ s(V, {})
258
+ element: /* @__PURE__ */ s(H, {})
255
259
  }),
256
260
  /* @__PURE__ */ s(i, {
257
261
  path: "*",
@@ -261,4 +265,4 @@ function te() {
261
265
  });
262
266
  }
263
267
  //#endregion
264
- export { te as MoveTheWheelsRoutes };
268
+ export { ne as MoveTheWheelsRoutes };
@@ -1,138 +1,138 @@
1
1
  import { Button as e } from "./ui.js";
2
2
  import { useConditionQuery as t } from "../hooks/useContainerCondition.js";
3
- import { ContainerEvidenceFilesDocument as n, ContainerEvidenceVersionsDocument as r } from "../src/generated/wspace-operations.js";
4
- import { useState as i } from "react";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
3
+ import { ContainerEvidenceFilesDocument as n, ContainerEvidenceVersionsDocument as r, InvoiceEvidenceVersionsDocument as i } from "../src/generated/wspace-operations.js";
4
+ import { useState as a } from "react";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
6
  //#region src/movethewheels/components/ContainerEvidencePicker.tsx
7
- function s({ value: s, onChange: c, description: l = "Choose exact versions from shared Files. Evidence integrity does not confirm the issuer or certify the container." }) {
8
- let [u, d] = i(""), [f, p] = i(0), [m, h] = i(0), g = t(n, { pagination: {
7
+ function c({ value: c, onChange: l, currentOnly: u = !1, description: d = "Choose exact versions from shared Files. Evidence integrity does not confirm the issuer or certify the container." }) {
8
+ let [f, p] = a(""), [m, h] = a(0), [g, _] = a(0), v = t(n, { pagination: {
9
9
  limit: 25,
10
- offset: f
11
- } }), _ = t(r, u ? {
12
- fileId: u,
10
+ offset: m
11
+ } }), y = t(u ? i : r, f ? {
12
+ fileId: f,
13
13
  pagination: {
14
14
  limit: 25,
15
- offset: m
15
+ offset: g
16
16
  }
17
17
  } : null);
18
- return /* @__PURE__ */ o("fieldset", {
18
+ return /* @__PURE__ */ s("fieldset", {
19
19
  className: "space-y-3 rounded-lg border p-4",
20
20
  children: [
21
- /* @__PURE__ */ a("legend", {
21
+ /* @__PURE__ */ o("legend", {
22
22
  className: "px-1 font-medium",
23
23
  children: "Evidence for this record"
24
24
  }),
25
- /* @__PURE__ */ a("p", {
25
+ /* @__PURE__ */ o("p", {
26
26
  className: "text-sm",
27
- children: l
27
+ children: d
28
28
  }),
29
- g.error && /* @__PURE__ */ o("p", {
29
+ v.error && /* @__PURE__ */ s("p", {
30
30
  role: "alert",
31
- children: ["Evidence files unavailable: ", g.error]
31
+ children: ["Evidence files unavailable: ", v.error]
32
32
  }),
33
- /* @__PURE__ */ o("label", {
33
+ /* @__PURE__ */ s("label", {
34
34
  className: "block",
35
- children: ["File", /* @__PURE__ */ o("select", {
35
+ children: ["File", /* @__PURE__ */ s("select", {
36
36
  "aria-label": "Evidence file",
37
37
  className: "mt-1 w-full rounded-md border p-2",
38
- value: u,
38
+ value: f,
39
39
  onChange: (e) => {
40
- d(e.target.value), h(0);
40
+ p(e.target.value), _(0);
41
41
  },
42
- children: [/* @__PURE__ */ a("option", {
42
+ children: [/* @__PURE__ */ o("option", {
43
43
  value: "",
44
44
  children: "Choose a readable file"
45
- }), g.data?.getFiles.files.filter((e) => e.canRead === !0).map((e) => /* @__PURE__ */ a("option", {
45
+ }), v.data?.getFiles.files.filter((e) => e.canRead === !0).map((e) => /* @__PURE__ */ o("option", {
46
46
  value: e.id,
47
47
  children: e.name
48
48
  }, e.id))]
49
49
  })]
50
50
  }),
51
- g.loading && /* @__PURE__ */ a("p", {
51
+ v.loading && /* @__PURE__ */ o("p", {
52
52
  role: "status",
53
53
  children: "Loading evidence files…"
54
54
  }),
55
- /* @__PURE__ */ o("div", {
55
+ /* @__PURE__ */ s("div", {
56
56
  className: "flex gap-2",
57
- children: [/* @__PURE__ */ a(e, {
57
+ children: [/* @__PURE__ */ o(e, {
58
58
  type: "button",
59
59
  variant: "outline",
60
- disabled: f === 0 || g.loading,
60
+ disabled: m === 0 || v.loading,
61
61
  onClick: () => {
62
- p(Math.max(0, f - 25)), d("");
62
+ h(Math.max(0, m - 25)), p("");
63
63
  },
64
64
  children: "Previous files"
65
- }), /* @__PURE__ */ a(e, {
65
+ }), /* @__PURE__ */ o(e, {
66
66
  type: "button",
67
67
  variant: "outline",
68
- disabled: !g.data?.getFiles.hasMore || g.loading,
68
+ disabled: !v.data?.getFiles.hasMore || v.loading,
69
69
  onClick: () => {
70
- p(f + 25), d("");
70
+ h(m + 25), p("");
71
71
  },
72
72
  children: "Next files"
73
73
  })]
74
74
  }),
75
- _.error && /* @__PURE__ */ o("p", {
75
+ y.error && /* @__PURE__ */ s("p", {
76
76
  role: "alert",
77
- children: ["File versions unavailable: ", _.error]
77
+ children: ["File versions unavailable: ", y.error]
78
78
  }),
79
- _.loading && /* @__PURE__ */ a("p", {
79
+ y.loading && /* @__PURE__ */ o("p", {
80
80
  role: "status",
81
81
  children: "Loading file versions…"
82
82
  }),
83
- _.data?.getFileVersions.versions.map((e) => {
84
- let t = s.some((t) => t.versionId === e.id), n = /^[a-fA-F0-9]{64}$/.test(e.sha256Hash ?? ""), r = `${e.name} — version ${e.versionLabel ?? e.versionNumber}`;
85
- return /* @__PURE__ */ o("label", {
83
+ y.data?.getFileVersions.versions.map((e) => {
84
+ let t = c.some((t) => t.versionId === e.id), n = !u || "isCurrentVersion" in e && e.isCurrentVersion === !0, r = n && /^[a-fA-F0-9]{64}$/.test(e.sha256Hash ?? ""), i = `${e.name} — version ${e.versionLabel ?? e.versionNumber}`;
85
+ return /* @__PURE__ */ s("label", {
86
86
  className: "flex gap-2 text-sm",
87
87
  children: [
88
- /* @__PURE__ */ a("input", {
88
+ /* @__PURE__ */ o("input", {
89
89
  type: "checkbox",
90
90
  checked: t,
91
- disabled: !n || !t && s.length >= 10,
92
- onChange: () => c(t ? s.filter((t) => t.versionId !== e.id) : [...s, {
91
+ disabled: !r || !t && c.length >= 10,
92
+ onChange: () => l(t ? c.filter((t) => t.versionId !== e.id) : [...c, {
93
93
  fileId: e.fileId,
94
94
  versionId: e.id,
95
- label: r
95
+ label: i
96
96
  }])
97
97
  }),
98
- r,
99
- !n && " (integrity fingerprint unavailable)"
98
+ i,
99
+ n ? !r && " (integrity fingerprint unavailable)" : " (not confirmed current)"
100
100
  ]
101
101
  }, e.id);
102
102
  }),
103
- u && /* @__PURE__ */ o("div", {
103
+ f && /* @__PURE__ */ s("div", {
104
104
  className: "flex gap-2",
105
- children: [/* @__PURE__ */ a(e, {
105
+ children: [/* @__PURE__ */ o(e, {
106
106
  type: "button",
107
107
  variant: "outline",
108
- disabled: m === 0 || _.loading,
109
- onClick: () => h(Math.max(0, m - 25)),
108
+ disabled: g === 0 || y.loading,
109
+ onClick: () => _(Math.max(0, g - 25)),
110
110
  children: "Previous versions"
111
- }), /* @__PURE__ */ a(e, {
111
+ }), /* @__PURE__ */ o(e, {
112
112
  type: "button",
113
113
  variant: "outline",
114
- disabled: !_.data?.getFileVersions.hasMore || _.loading,
115
- onClick: () => h(m + 25),
114
+ disabled: !y.data?.getFileVersions.hasMore || y.loading,
115
+ onClick: () => _(g + 25),
116
116
  children: "Next versions"
117
117
  })]
118
118
  }),
119
- /* @__PURE__ */ o("p", {
119
+ /* @__PURE__ */ s("p", {
120
120
  className: "text-sm",
121
121
  children: [
122
122
  "Selected ",
123
- s.length,
123
+ c.length,
124
124
  " of 10 versions."
125
125
  ]
126
126
  }),
127
- s.map((t) => /* @__PURE__ */ o("div", {
127
+ c.map((t) => /* @__PURE__ */ s("div", {
128
128
  className: "flex items-center justify-between gap-2 text-sm",
129
- children: [/* @__PURE__ */ a("span", {
129
+ children: [/* @__PURE__ */ o("span", {
130
130
  className: "break-words",
131
131
  children: t.label
132
- }), /* @__PURE__ */ a(e, {
132
+ }), /* @__PURE__ */ o(e, {
133
133
  type: "button",
134
134
  variant: "outline",
135
- onClick: () => c(s.filter((e) => e.versionId !== t.versionId)),
135
+ onClick: () => l(c.filter((e) => e.versionId !== t.versionId)),
136
136
  children: "Remove"
137
137
  })]
138
138
  }, t.versionId))
@@ -140,4 +140,4 @@ function s({ value: s, onChange: c, description: l = "Choose exact versions from
140
140
  });
141
141
  }
142
142
  //#endregion
143
- export { s as ContainerEvidencePicker };
143
+ export { c as ContainerEvidencePicker };
@@ -57,7 +57,7 @@ function h({ alerts: p, isLoading: h, error: g, onRetry: _, onOpen: v, t: y }) {
57
57
  }), b]
58
58
  }) }), /* @__PURE__ */ u(a, { children: /* @__PURE__ */ u("p", {
59
59
  className: "text-sm text-text-secondary",
60
- children: y("movethewheels.fleet.alerts.allClear", "All clear — every licence is valid and no vehicle is due for service.")
60
+ children: y("movethewheels.fleet.alerts.allClear", "No recorded fleet alerts. This does not certify legal driving eligibility or duty-hours availability.")
61
61
  }) })] }) : /* @__PURE__ */ d(i, { children: [/* @__PURE__ */ u(o, { children: /* @__PURE__ */ d(s, {
62
62
  className: "flex items-center gap-2",
63
63
  children: [
@@ -92,7 +92,7 @@ function h({ alerts: p, isLoading: h, error: g, onRetry: _, onOpen: v, t: y }) {
92
92
  /* @__PURE__ */ d("span", {
93
93
  className: "flex-1 min-w-0",
94
94
  children: [/* @__PURE__ */ u("span", {
95
- className: "block text-sm font-medium truncate",
95
+ className: "block text-sm font-medium whitespace-normal break-words",
96
96
  children: t.message
97
97
  }), n && /* @__PURE__ */ u("span", {
98
98
  className: "block text-xs text-text-secondary",
@@ -0,0 +1,217 @@
1
+ import { Button as e } from "../ui.js";
2
+ import { useConditionQuery as t } from "../../hooks/useContainerCondition.js";
3
+ import { ReuseState as n } from "../ReuseControls.js";
4
+ import { commercialCanonical as r, commercialSlots as i, newCommercialEditor as a } from "../../utils/freightCommercial.js";
5
+ import { FreightCommercialLegsDocument as o } from "../../src/generated/freight-cost-operations.js";
6
+ import { FreightCommercialFactEditor as s } from "./FreightCommercialFactEditor.js";
7
+ import { useState as c } from "react";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import { OptionalFields as d } from "@burdenoff/fe-libs/ui";
10
+ //#region src/movethewheels/components/freight-cost/FreightCommercialEditor.tsx
11
+ function f({ value: e, onChange: t, shipmentId: n, evidence: r }) {
12
+ return /* @__PURE__ */ u(d, {
13
+ title: "Commercial context (optional)",
14
+ description: "Source declarations only. Off by default; no quote acceptance or completeness is inferred.",
15
+ defaultOpen: !1,
16
+ children: [/* @__PURE__ */ u("label", {
17
+ className: "flex min-h-11 items-center gap-2",
18
+ children: [/* @__PURE__ */ l("input", {
19
+ type: "checkbox",
20
+ checked: e !== null,
21
+ onChange: (e) => t(e.target.checked ? a() : null)
22
+ }), "Include commercial context"]
23
+ }), e && /* @__PURE__ */ l(p, {
24
+ value: e,
25
+ onChange: t,
26
+ shipmentId: n,
27
+ evidence: r
28
+ })]
29
+ });
30
+ }
31
+ function p({ value: a, onChange: d, shipmentId: f, evidence: p }) {
32
+ let [m, h] = c(0), [g, _] = c(0), v = t(o, {
33
+ shipmentId: f,
34
+ pagination: {
35
+ limit: 25,
36
+ offset: g
37
+ }
38
+ }, m), y = v.data?.shipment?.id === f ? v.data.shipment.legs : void 0, b = !!y && y.every((e) => e.shipmentId === f && !a.selectedLegs.some((t) => t.id === e.id && t.expectedUpdatedAt !== e.updatedAt)), x = (e) => {
39
+ d({
40
+ ...a,
41
+ reviewed: null
42
+ }), _(e);
43
+ };
44
+ return /* @__PURE__ */ u("div", {
45
+ className: "min-w-0 space-y-5",
46
+ children: [
47
+ /* @__PURE__ */ l("p", {
48
+ className: "text-sm",
49
+ children: "All eight facts start Unknown: “Not recorded for this cost version”. Edit that explanation when useful. Sourced and not-applicable declarations require explicit provenance; shipment details are never copied into these facts."
50
+ }),
51
+ /* @__PURE__ */ u("section", {
52
+ className: "space-y-3 rounded border p-3",
53
+ children: [
54
+ /* @__PURE__ */ l("h3", {
55
+ className: "font-semibold",
56
+ children: "Review selected shipment legs"
57
+ }),
58
+ /* @__PURE__ */ l("p", {
59
+ className: "text-sm",
60
+ children: "Select only the legs covered by this source. No selection does not mean all legs. Review the loaded selection explicitly before saving."
61
+ }),
62
+ /* @__PURE__ */ l(n, {
63
+ loading: v.loading,
64
+ error: v.error
65
+ }),
66
+ y?.map((e) => {
67
+ let t = a.selectedLegs.some((t) => t.id === e.id);
68
+ return /* @__PURE__ */ u("label", {
69
+ className: "flex min-h-11 items-center gap-2",
70
+ children: [/* @__PURE__ */ l("input", {
71
+ type: "checkbox",
72
+ checked: t,
73
+ disabled: !t && a.selectedLegs.length >= 16,
74
+ onChange: () => d({
75
+ ...a,
76
+ reviewed: null,
77
+ selectedLegs: t ? a.selectedLegs.filter((t) => t.id !== e.id) : [...a.selectedLegs, {
78
+ id: e.id,
79
+ expectedUpdatedAt: e.updatedAt
80
+ }]
81
+ })
82
+ }), /* @__PURE__ */ u("span", { children: [
83
+ "Leg ",
84
+ e.legNumber,
85
+ " — ",
86
+ e.mode,
87
+ "; carrier ",
88
+ e.carrierName ?? "not recorded",
89
+ "; updated ",
90
+ e.updatedAt
91
+ ] })]
92
+ }, e.id);
93
+ }),
94
+ y?.length === 0 && /* @__PURE__ */ l("p", { children: "No legs on this loaded page." }),
95
+ /* @__PURE__ */ u("p", {
96
+ className: "text-sm",
97
+ children: [
98
+ "Leg page ",
99
+ Math.floor(g / 25) + 1,
100
+ "; at most 25 records per page. Off-page selections keep their original revisions."
101
+ ]
102
+ }),
103
+ /* @__PURE__ */ u("div", {
104
+ className: "flex flex-wrap gap-3",
105
+ children: [/* @__PURE__ */ l(e, {
106
+ type: "button",
107
+ variant: "outline",
108
+ disabled: g === 0 || v.loading,
109
+ onClick: () => x(Math.max(0, g - 25)),
110
+ children: "Previous leg page"
111
+ }), /* @__PURE__ */ l(e, {
112
+ type: "button",
113
+ variant: "outline",
114
+ disabled: v.loading || !!v.error || y?.length !== 25,
115
+ onClick: () => x(g + 25),
116
+ children: "Next leg page"
117
+ })]
118
+ }),
119
+ a.selectedLegs.map((t) => /* @__PURE__ */ u("div", {
120
+ className: "flex flex-wrap items-center gap-2 break-all text-sm",
121
+ children: [/* @__PURE__ */ u("p", { children: [
122
+ "Selected leg ",
123
+ t.id,
124
+ "; pinned revision ",
125
+ t.expectedUpdatedAt,
126
+ "."
127
+ ] }), /* @__PURE__ */ u(e, {
128
+ type: "button",
129
+ variant: "outline",
130
+ onClick: () => d({
131
+ ...a,
132
+ reviewed: null,
133
+ selectedLegs: a.selectedLegs.filter((e) => e.id !== t.id)
134
+ }),
135
+ children: ["Remove selected leg ", t.id]
136
+ })]
137
+ }, t.id)),
138
+ /* @__PURE__ */ u("p", { children: [a.selectedLegs.length, " of 16 legs selected."] }),
139
+ !b && a.selectedLegs.length > 0 && /* @__PURE__ */ l("p", {
140
+ role: "alert",
141
+ children: "A selected leg on this page changed or the page does not match this shipment. Explicitly remove it and review the current selection; no revision is rebound automatically."
142
+ }),
143
+ /* @__PURE__ */ u("div", {
144
+ className: "flex flex-wrap gap-3",
145
+ children: [/* @__PURE__ */ l(e, {
146
+ type: "button",
147
+ variant: "outline",
148
+ onClick: () => {
149
+ d({
150
+ ...a,
151
+ reviewed: null
152
+ }), h((e) => e + 1);
153
+ },
154
+ children: "Refresh legs for review"
155
+ }), /* @__PURE__ */ l(e, {
156
+ type: "button",
157
+ variant: "outline",
158
+ disabled: v.loading || !!v.error || !b,
159
+ onClick: () => d({
160
+ ...a,
161
+ reviewed: r(a.selectedLegs)
162
+ }),
163
+ children: "I reviewed this leg selection"
164
+ })]
165
+ }),
166
+ a.reviewed === r(a.selectedLegs) && b && /* @__PURE__ */ l("p", {
167
+ role: "status",
168
+ children: "This explicit selection of IDs and revisions is reviewed. The server checks every selected leg on save, including off-page pins."
169
+ })
170
+ ]
171
+ }),
172
+ [
173
+ ["origin", "destination"],
174
+ [
175
+ "carrier",
176
+ "service",
177
+ "cargo"
178
+ ],
179
+ [
180
+ "weight",
181
+ "volume",
182
+ "equipment"
183
+ ]
184
+ ].map((e, t) => /* @__PURE__ */ u("section", {
185
+ className: "space-y-3",
186
+ children: [/* @__PURE__ */ l("h3", {
187
+ className: "font-semibold",
188
+ children: [
189
+ "Locations",
190
+ "Carrier, service and cargo",
191
+ "Measurements and equipment"
192
+ ][t]
193
+ }), /* @__PURE__ */ l("div", {
194
+ className: "grid min-w-0 gap-3 md:grid-cols-2",
195
+ children: e.map((e) => /* @__PURE__ */ l(s, {
196
+ slot: e,
197
+ value: a.facts[e],
198
+ evidence: p,
199
+ onChange: (t) => d({
200
+ ...a,
201
+ facts: {
202
+ ...a.facts,
203
+ [e]: t
204
+ }
205
+ })
206
+ }, e))
207
+ })]
208
+ }, e[0])),
209
+ /* @__PURE__ */ u("p", {
210
+ className: "text-sm",
211
+ children: [i.length, " declared facts. Owner shipment and leg snapshots are recorded separately by the server."]
212
+ })
213
+ ]
214
+ });
215
+ }
216
+ //#endregion
217
+ export { f as FreightCommercialEditor };