@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
@@ -1,24 +1,5 @@
1
1
  export type Maybe<T> = T | null;
2
2
  export type InputMaybe<T> = Maybe<T>;
3
- export type Exact<T extends {
4
- [key: string]: unknown;
5
- }> = {
6
- [K in keyof T]: T[K];
7
- };
8
- export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
9
- [SubKey in K]?: Maybe<T[SubKey]>;
10
- };
11
- export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
12
- [SubKey in K]: Maybe<T[SubKey]>;
13
- };
14
- export type MakeEmpty<T extends {
15
- [key: string]: unknown;
16
- }, K extends keyof T> = {
17
- [_ in K]?: never;
18
- };
19
- export type Incremental<T> = T | {
20
- [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never;
21
- };
22
3
  /** All built-in and custom scalars, mapped to their actual values */
23
4
  export type Scalars = {
24
5
  ID: {
@@ -72,12 +53,12 @@ export type Scalars = {
72
53
  output: File;
73
54
  };
74
55
  _ScalarsPlaceholder: {
75
- input: any;
76
- output: any;
56
+ input: unknown;
57
+ output: unknown;
77
58
  };
78
59
  _SecurityMainPlaceholder: {
79
- input: any;
80
- output: any;
60
+ input: unknown;
61
+ output: unknown;
81
62
  };
82
63
  };
83
64
  export type A2AConnection = {
@@ -1,16 +1,16 @@
1
1
  import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
2
2
  import { useConditionApi as t } from "./useContainerCondition.js";
3
3
  import { reuseRecoveryContextKey as n, reuseRecoveryScope as r, sameReuseRecoveryScope as i } from "../utils/reuseRecovery.js";
4
- import { matchesFreightAcknowledgement as a } from "../utils/freightAcknowledgement.js";
5
- import { SaveFreightCostsDocument as o } from "../src/generated/freight-cost-operations.js";
6
- import { FREIGHT_RECOVERY_STORAGE as s, decodeFreightRecovery as c, encodeFreightRecovery as l } from "../utils/freightRecovery.js";
7
- import { useRef as u, useState as d } from "react";
8
- import { print as f } from "graphql";
4
+ import { SaveFreightCommercialCostsDocument as a, SaveFreightCostsDocument as o } from "../src/generated/freight-cost-operations.js";
5
+ import { matchesFreightAcknowledgement as s } from "../utils/freightAcknowledgement.js";
6
+ import { FREIGHT_RECOVERY_STORAGE as c, decodeFreightRecovery as l, encodeFreightRecovery as u } from "../utils/freightRecovery.js";
7
+ import { useRef as d, useState as f } from "react";
8
+ import { print as p } from "graphql";
9
9
  //#region src/movethewheels/hooks/useFreightRecoveryAction.ts
10
- var p = [o];
11
- function m() {
10
+ var m = [o, a];
11
+ function h() {
12
12
  try {
13
- let e = sessionStorage.getItem(s), t = c(e);
13
+ let e = sessionStorage.getItem(c), t = l(e);
14
14
  return {
15
15
  attempt: t,
16
16
  blocked: e !== null && t === null
@@ -22,8 +22,8 @@ function m() {
22
22
  };
23
23
  }
24
24
  }
25
- function h() {
26
- let o = t("SINGLE_ATTEMPT"), h = e(), g = r(h.currentUser?.id, h.workspaceId, h.tenantId, h.apiGatewayUrl, h.workspaceToken), [_] = d(m), [v, y] = d(_.attempt), [b, x] = d(_.blocked), S = u(v), C = u(!1), [w, T] = d(!1), E = n(g), [D, O] = d({
25
+ function g() {
26
+ let a = t("SINGLE_ATTEMPT"), o = e(), g = r(o.currentUser?.id, o.workspaceId, o.tenantId, o.apiGatewayUrl, o.workspaceToken), [_] = f(h), [v, y] = f(_.attempt), [b, x] = f(_.blocked), S = d(v), C = d(!1), [w, T] = f(!1), E = n(g), [D, O] = f({
27
27
  scopeKey: E,
28
28
  error: null,
29
29
  notice: null
@@ -35,25 +35,25 @@ function h() {
35
35
  scopeKey: E,
36
36
  error: null,
37
37
  notice: e
38
- }), [j, M] = d(0), N = (e, t) => {
39
- if (e) sessionStorage.setItem(s, l(e));
38
+ }), [j, M] = f(0), N = (e, t) => {
39
+ if (e) sessionStorage.setItem(c, u(e));
40
40
  else {
41
- let e = c(sessionStorage.getItem(s));
42
- (!t || e?.key === t.key && i(e.scope, t.scope)) && sessionStorage.removeItem(s);
41
+ let e = l(sessionStorage.getItem(c));
42
+ (!t || e?.key === t.key && i(e.scope, t.scope)) && sessionStorage.removeItem(c);
43
43
  }
44
44
  S.current = e, y(e), x(!1);
45
45
  }, P = async (e) => {
46
46
  if (C.current) return null;
47
47
  if (!i(e.scope, g)) return k("Return to the original account, organization, workspace and project before retrying."), null;
48
- let t = p.find((t) => f(t) === e.operation);
48
+ let t = m.find((t) => p(t) === e.operation);
49
49
  if (!t) return k("The saved operation changed. Check history before abandoning this attempt."), null;
50
50
  C.current = !0, T(!0), k(null), A(null);
51
51
  try {
52
- let n = await o(t, { input: {
52
+ let n = await a(t, { input: {
53
53
  ...e.input,
54
54
  idempotencyKey: e.key
55
55
  } });
56
- if (!a(n, e.input)) throw Error("The save reply could not be confirmed. Keep the original request and check history.");
56
+ if (!s(n, e.input)) throw Error("The save reply could not be confirmed. Keep the original request and check history.");
57
57
  return N(null, e), M((e) => e + 1), A(e.success), n;
58
58
  } catch (e) {
59
59
  return k(e instanceof Error ? e.message : "Unable to save. Check history before retrying."), null;
@@ -65,8 +65,8 @@ function h() {
65
65
  run: async (e, t, n) => {
66
66
  if (C.current || S.current || b) return k("Resolve the original request before starting another."), null;
67
67
  if (!g) return k("Wait for the current account and workspace session."), null;
68
- let r = f(e);
69
- if (!p.some((e) => f(e) === r)) return k("Unsupported freight operation."), null;
68
+ let r = p(e);
69
+ if (!m.some((e) => p(e) === r)) return k("Unsupported freight operation."), null;
70
70
  try {
71
71
  if (sessionStorage.getItem("movethewheels.freight.unresolved.v1") !== null) return k("A saved request is unresolved. Reload this page and check history before starting another."), null;
72
72
  } catch {
@@ -114,4 +114,4 @@ function h() {
114
114
  };
115
115
  }
116
116
  //#endregion
117
- export { h as useFreightRecoveryAction };
117
+ export { g as useFreightRecoveryAction };
@@ -0,0 +1,118 @@
1
+ import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
2
+ import { resolveGraphqlUrl as t } from "../utils/graphqlClient.js";
3
+ import { useConditionApi as n } from "./useContainerCondition.js";
4
+ import { INVOICE_RECOVERY_STORAGE as r, decodeInvoiceIntent as i, encodeInvoiceIntent as a, invoiceCanonical as o, invoiceRecordInput as s, matchesInvoiceReceipt as c, sameInvoiceScope as l } from "../utils/invoiceComparison.js";
5
+ import { InvoiceComparisonExactDocument as u, RecordInvoiceComparisonDocument as d, RecoverInvoiceComparisonDocument as f } from "../src/generated/freight-invoice-operations.js";
6
+ import { useLayoutEffect as p, useRef as m, useState as h } from "react";
7
+ import { useActiveContext as g } from "@burdenoff/fe-libs/shared/providers/shell";
8
+ //#region src/movethewheels/hooks/useInvoiceComparisonRecovery.ts
9
+ function _() {
10
+ try {
11
+ let e = sessionStorage.getItem(r), t = i(e);
12
+ return {
13
+ intent: t,
14
+ blocked: e !== null && t === null
15
+ };
16
+ } catch {
17
+ return {
18
+ intent: null,
19
+ blocked: !0
20
+ };
21
+ }
22
+ }
23
+ function v(n) {
24
+ let r = e(), i = g();
25
+ return !n || !r.currentUser?.id || !r.workspaceId || i.workspaceId !== r.workspaceId || !i.organizationId || r.tenantId && i.tenantId !== r.tenantId ? null : {
26
+ actorId: r.currentUser.id,
27
+ workspaceId: r.workspaceId,
28
+ tenantId: i.tenantId,
29
+ organizationId: i.organizationId,
30
+ projectId: i.projectId,
31
+ gateway: t(r.apiGatewayUrl)
32
+ };
33
+ }
34
+ function y(e, t) {
35
+ let g = n("SINGLE_ATTEMPT"), [v] = h(_), [y, b] = h(v.intent), x = m(y), [S, C] = h(v.blocked), w = m(!1), [T, E] = h(!1), [D, O] = h(0), k = o(e), A = m(e), [j, M] = h(null);
36
+ p(() => (A.current = e, () => {
37
+ A.current = null;
38
+ }), [k]);
39
+ let N = (e, t = !0) => M({
40
+ scopeKey: k,
41
+ message: e,
42
+ error: t
43
+ }), P = (e, t) => {
44
+ if (!e || !c(e, t) || !l(t.scope, A.current)) throw Error("UNCONFIRMED");
45
+ let n = i(sessionStorage.getItem(r));
46
+ if (!n || o(n) !== o(t)) throw Error("RETAINED_INTENT_CHANGED");
47
+ return sessionStorage.removeItem(r), x.current = null, b(null), C(!1), O((e) => e + 1), N("The exact immutable comparison receipt is confirmed.", !1), e;
48
+ };
49
+ return {
50
+ run: async (n, c) => {
51
+ if (w.current || x.current || S) return N("Resolve the original request before starting another."), null;
52
+ if (!e || !l(e, A.current) || !t()) return N("Current shipment update permission and workspace context are required. Nothing was sent."), null;
53
+ let u;
54
+ try {
55
+ if (sessionStorage.getItem("movethewheels.freight-invoice.unresolved.v1") !== null) throw Error("EXISTING");
56
+ u = {
57
+ version: 1,
58
+ scope: structuredClone(e),
59
+ input: s({
60
+ ...n,
61
+ idempotencyKey: crypto.randomUUID()
62
+ }),
63
+ estimate: structuredClone(c)
64
+ }, sessionStorage.setItem(r, a(u)), x.current = u, b(u);
65
+ } catch {
66
+ return N("The original request could not be retained safely. Nothing was sent; reload and inspect any retained request."), null;
67
+ }
68
+ w.current = !0, E(!0), M(null);
69
+ try {
70
+ if (!l(u.scope, A.current) || !t()) {
71
+ let e = i(sessionStorage.getItem(r));
72
+ return e && o(e) === o(u) && (sessionStorage.removeItem(r), x.current = null, b(null)), N("Context or permission changed before dispatch. Nothing was sent."), null;
73
+ }
74
+ return P((await g(d, { input: u.input })).compareMtwFreightInvoice, u);
75
+ } catch {
76
+ return N("Save outcome is UNKNOWN. Keep the original intent and use read-only recovery; do not resend it."), null;
77
+ } finally {
78
+ w.current = !1, E(!1);
79
+ }
80
+ },
81
+ reconcile: async () => {
82
+ let e = x.current;
83
+ if (w.current || !e) return null;
84
+ if (!l(e.scope, A.current)) return N("Return to the original account, organization, workspace and project to inspect its request."), null;
85
+ w.current = !0, E(!0), M(null);
86
+ try {
87
+ let t = (await g(f, {
88
+ shipmentId: e.input.shipmentId,
89
+ requestKey: e.input.idempotencyKey
90
+ })).mtwFreightInvoiceComparisonByRequestKey;
91
+ if (!t) return N("No original-context receipt was returned. This does not prove no effect; the request stays UNKNOWN and cannot be resent."), null;
92
+ if (!c(t, e)) throw Error("MISMATCH");
93
+ if (!l(e.scope, A.current)) throw Error("CONTEXT_CHANGED");
94
+ let n = await g(u, {
95
+ shipmentId: e.input.shipmentId,
96
+ id: t.id
97
+ });
98
+ if (!c(n.mtwFreightInvoiceComparison, e) || n.mtwFreightInvoiceComparison.requestFingerprint !== t.requestFingerprint || o(n.mtwFreightInvoiceComparison) !== o(t)) throw Error("MISMATCH");
99
+ return P(n.mtwFreightInvoiceComparison, e);
100
+ } catch {
101
+ return N("Read-only recovery could not confirm the exact original receipt. Keep the intent; no save was sent."), null;
102
+ } finally {
103
+ w.current = !1, E(!1);
104
+ }
105
+ },
106
+ busy: T,
107
+ pending: y,
108
+ blocked: S,
109
+ uncertain: y !== null || S,
110
+ revision: D,
111
+ scopeKey: k,
112
+ canReconcile: !!y && l(y.scope, e),
113
+ feedback: j?.scopeKey === k ? j : null,
114
+ refresh: () => O((e) => e + 1)
115
+ };
116
+ }
117
+ //#endregion
118
+ export { y as useInvoiceComparisonRecovery, v as useInvoiceComparisonScope };
@@ -2,8 +2,9 @@ import { MtwContainerEvidenceInput } from '../../generated/container-condition-o
2
2
  export interface SelectedEvidence extends MtwContainerEvidenceInput {
3
3
  label: string;
4
4
  }
5
- export declare function ContainerEvidencePicker({ value, onChange, description, }: {
5
+ export declare function ContainerEvidencePicker({ value, onChange, currentOnly, description, }: {
6
6
  value: SelectedEvidence[];
7
7
  onChange: (value: SelectedEvidence[]) => void;
8
8
  description?: string;
9
+ currentOnly?: boolean;
9
10
  }): import('react').JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { CommercialEditorState } from '../../utils/freightCommercial';
2
+ import { SelectedEvidence } from '../ContainerEvidencePicker';
3
+ export declare function FreightCommercialEditor({ value, onChange, shipmentId, evidence, }: {
4
+ value: CommercialEditorState | null;
5
+ onChange: (value: CommercialEditorState | null) => void;
6
+ shipmentId: string;
7
+ evidence: SelectedEvidence[];
8
+ }): import('react').JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { CommercialSlot, CommercialFactDraft } from '../../utils/freightCommercial';
2
+ import { SelectedEvidence } from '../ContainerEvidencePicker';
3
+ export declare function FreightCommercialFactEditor({ slot, value, onChange, evidence, }: {
4
+ slot: CommercialSlot;
5
+ value: CommercialFactDraft;
6
+ onChange: (value: CommercialFactDraft) => void;
7
+ evidence: SelectedEvidence[];
8
+ }): import('react').JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { FreightCommercialVersionQuery } from '../../../generated/freight-cost-operations';
2
+ export declare function FreightCommercialHistory({ capture, }: {
3
+ capture: FreightCommercialVersionQuery['mtwFreightEstimateVersion']['commercialCapture'];
4
+ }): import('react').JSX.Element;
@@ -1,7 +1,9 @@
1
+ import { CommercialCapture } from '../../utils/freightCommercial';
1
2
  import { MtwFreightFactsInput, PreviewFreightCostsQuery } from '../../../generated/freight-cost-operations';
2
3
  import { SelectedEvidence } from '../ContainerEvidencePicker';
3
- export declare function FreightDraftForm({ disabled, onPreview, onSave, }: {
4
+ export declare function FreightDraftForm({ disabled, shipmentId, onPreview, onSave, }: {
4
5
  disabled: boolean;
6
+ shipmentId: string;
5
7
  onPreview: (facts: MtwFreightFactsInput) => Promise<PreviewFreightCostsQuery['previewMtwFreightTotal']>;
6
- onSave: (facts: MtwFreightFactsInput, evidence: SelectedEvidence[]) => Promise<void>;
8
+ onSave: (facts: MtwFreightFactsInput, evidence: SelectedEvidence[], commercialCapture?: CommercialCapture) => Promise<void>;
7
9
  }): import('react').JSX.Element;
@@ -1,4 +1,4 @@
1
- import { FreightVersionQuery } from '../../../generated/freight-cost-operations';
1
+ import { FreightCommercialVersionQuery } from '../../../generated/freight-cost-operations';
2
2
  export declare function FreightHistory({ record, }: {
3
- record: FreightVersionQuery['mtwFreightEstimateVersion'];
3
+ record: FreightCommercialVersionQuery['mtwFreightEstimateVersion'];
4
4
  }): import('react').JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { CompareMtwFreightInvoiceInput, InvoiceEstimatePinFragment, InvoiceEstimateVersionQuery, InvoiceReceiptFragment, InvoiceStructuralPreviewQuery, MtwFreightInvoiceFactsInput } from '../../../generated/freight-invoice-operations';
2
+ export type InvoiceEstimate = InvoiceEstimateVersionQuery['mtwFreightEstimateVersion'];
3
+ export declare function invoiceEstimatePin(estimate: InvoiceEstimate): InvoiceEstimatePinFragment;
4
+ export declare function InvoiceForm({ estimate, previous, disabled, canRecord, onPreview, onSave, }: {
5
+ estimate: InvoiceEstimate;
6
+ previous: InvoiceReceiptFragment | null;
7
+ disabled: boolean;
8
+ canRecord: boolean;
9
+ onPreview: (input: {
10
+ shipmentId: string;
11
+ estimateVersionId: string;
12
+ facts: MtwFreightInvoiceFactsInput;
13
+ evidence: {
14
+ fileId: string;
15
+ versionId: string;
16
+ }[];
17
+ }) => Promise<InvoiceStructuralPreviewQuery['previewMtwFreightInvoice']>;
18
+ onSave: (input: Omit<CompareMtwFreightInvoiceInput, 'idempotencyKey'>, pin: InvoiceEstimatePinFragment) => Promise<InvoiceReceiptFragment | null | undefined>;
19
+ }): import('react').JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { InvoiceReceiptFragment, InvoiceStructuralPreviewQuery } from '../../../generated/freight-invoice-operations';
2
+ type Preview = InvoiceStructuralPreviewQuery['previewMtwFreightInvoice'];
3
+ export declare function InvoiceResults({ value }: {
4
+ value: Preview | InvoiceReceiptFragment;
5
+ }): import('react').JSX.Element;
6
+ export declare function InvoiceHistoryRecord({ record }: {
7
+ record: InvoiceReceiptFragment;
8
+ }): import('react').JSX.Element;
9
+ export {};
@@ -32,7 +32,7 @@ export interface CreateDriverInput {
32
32
  phone?: string;
33
33
  licenseNumber?: string;
34
34
  licenseClass?: string;
35
- licenseExpiry?: string;
35
+ licenseExpiry?: string | null;
36
36
  /** DriverStatus enum value, e.g. `AVAILABLE`, `OFF_DUTY`. */
37
37
  status?: string;
38
38
  vehicleId?: string | null;
@@ -5,7 +5,7 @@
5
5
  * All three sit on top of wspace-movethewheels-svc's fleet module; the ranking
6
6
  * and alert rules live server-side so every surface (web, CLI, MCP) agrees.
7
7
  */
8
- export type FleetAlertType = 'LICENSE_EXPIRED' | 'LICENSE_EXPIRING' | 'MAINTENANCE_OVERDUE' | 'MAINTENANCE_DUE_SOON';
8
+ export type FleetAlertType = 'LICENSE_UNKNOWN' | 'LICENSE_EXPIRED' | 'LICENSE_EXPIRING' | 'MAINTENANCE_OVERDUE' | 'MAINTENANCE_DUE_SOON';
9
9
  export type FleetAlertSeverity = 'CRITICAL' | 'WARNING';
10
10
  export type FleetAlertSubjectType = 'VEHICLE' | 'DRIVER';
11
11
  export interface FleetAlert {
@@ -0,0 +1,22 @@
1
+ import { CompareMtwFreightInvoiceInput, InvoiceEstimatePinFragment, InvoiceReceiptFragment } from '../../generated/freight-invoice-operations';
2
+ import { InvoiceIntent, InvoiceScope } from '../utils/invoiceComparison';
3
+ /** Canonical visible context only; never decode credentials or claim the full server context. */
4
+ export declare function useInvoiceComparisonScope(canRead: boolean): InvoiceScope | null;
5
+ /** One original business intent. UNKNOWN permits reads only, never a retry/new key or automatic resend. */
6
+ export declare function useInvoiceComparisonRecovery(scope: InvoiceScope | null, allowsWrite: () => boolean): {
7
+ run: (supplied: Omit<CompareMtwFreightInvoiceInput, "idempotencyKey">, estimate: InvoiceEstimatePinFragment) => Promise<InvoiceReceiptFragment | null>;
8
+ reconcile: () => Promise<InvoiceReceiptFragment | null>;
9
+ busy: boolean;
10
+ pending: InvoiceIntent | null;
11
+ blocked: boolean;
12
+ uncertain: boolean;
13
+ revision: number;
14
+ scopeKey: string;
15
+ canReconcile: boolean;
16
+ feedback: {
17
+ scopeKey: string;
18
+ message: string;
19
+ error: boolean;
20
+ } | null;
21
+ refresh: () => void;
22
+ };
@@ -22,15 +22,13 @@ export declare function useProcedureSelection(revision: number): {
22
22
  loading: boolean;
23
23
  };
24
24
  cycle: {
25
- __typename?: "MtwContainerCycle";
26
25
  id: string;
27
26
  version: number;
28
27
  status: import('../../generated/logistics-procedure-operations').MtwContainerCycleStatus;
29
- bookingReference?: string | null;
28
+ bookingReference: string | null;
30
29
  openedAt: string;
31
30
  } | null;
32
31
  proposal: {
33
- __typename?: "MtwReuseProposal";
34
32
  id: string;
35
33
  proposalReference: string;
36
34
  revision: number;
@@ -0,0 +1,10 @@
1
+ import { InvoiceIntent, InvoiceScope } from '../utils/invoiceComparison';
2
+ export default function FreightInvoicePage(): import('react').JSX.Element;
3
+ /** Retain the unresolved intent across context changes without displaying another context's source facts. */
4
+ export declare function InvoiceRequestRecovery({ pending, scope, busy, canReconcile, onRead, }: {
5
+ pending: InvoiceIntent | null;
6
+ scope: InvoiceScope | null;
7
+ busy: boolean;
8
+ canReconcile: boolean;
9
+ onRead: () => void;
10
+ }): import('react').JSX.Element;
@@ -0,0 +1,6 @@
1
+ /** The expiry control is explicitly UTC, independent of the browser timezone. */
2
+ export declare const driverLicenseExpiryInput: (recorded: Date | undefined) => string;
3
+ /** Empty means unrecorded; never substitute noon, end of day or the current time. */
4
+ export declare const parseDriverLicenseExpiry: (value: string) => string | null;
5
+ /** Omit unchanged updates so even server precision beyond this display is retained. */
6
+ export declare const driverLicenseExpiryUpdate: (value: string, recorded: Date | undefined) => string | null | undefined;
@@ -0,0 +1,44 @@
1
+ import { MtwFreightCommercialCaptureInput, MtwFreightCommercialStatus, FreightCommercialLegsQuery } from '../../generated/freight-cost-operations';
2
+ export declare const commercialSlots: readonly ["origin", "destination", "carrier", "service", "cargo", "weight", "volume", "equipment"];
3
+ export type CommercialSlot = (typeof commercialSlots)[number];
4
+ export type CommercialLeg = NonNullable<FreightCommercialLegsQuery['shipment']>['legs'][number];
5
+ export type CommercialCapture = MtwFreightCommercialCaptureInput;
6
+ export declare const unrecordedCommercialReason = "Not recorded for this cost version";
7
+ export interface CommercialFactDraft {
8
+ status: MtwFreightCommercialStatus;
9
+ reason: string;
10
+ label: string;
11
+ reference: string;
12
+ description: string;
13
+ kind: string;
14
+ jurisdiction: string;
15
+ amount: string;
16
+ unit: string;
17
+ zeroReason: string;
18
+ count: string;
19
+ sourceReference: string;
20
+ sourceRevision: string;
21
+ observedAt: string;
22
+ evidenceLinks: {
23
+ fileId: string;
24
+ versionId: string;
25
+ }[];
26
+ }
27
+ export type CommercialDraft = Record<CommercialSlot, CommercialFactDraft>;
28
+ export interface CommercialEditorState {
29
+ facts: CommercialDraft;
30
+ selectedLegs: CommercialCapture['selectedLegs'];
31
+ reviewed: string | null;
32
+ }
33
+ export declare function newCommercialEditor(): CommercialEditorState;
34
+ export declare function newCommercialFact(status?: MtwFreightCommercialStatus): CommercialFactDraft;
35
+ export declare function newCommercialDraft(): CommercialDraft;
36
+ /** No source values are inferred from the owner snapshot or other fact slots. */
37
+ export declare function commercialCaptureInput(draft: CommercialDraft, pins: CommercialCapture['selectedLegs'], evidence: {
38
+ fileId: string;
39
+ versionId: string;
40
+ }[]): CommercialCapture;
41
+ export declare function commercialPinsMatch(pins: CommercialCapture['selectedLegs'], legs: CommercialLeg[], shipmentId: string): boolean;
42
+ /** Compare typed GraphQL output with the canonical input without trusting __typename or key order. */
43
+ export declare function commercialCanonical(value: unknown): string;
44
+ export declare function matchesCommercialCapture(receipt: unknown, input: Record<string, unknown>): boolean;
@@ -0,0 +1,32 @@
1
+ import { CompareMtwFreightInvoiceInput, InvoiceEstimatePinFragment, InvoiceReceiptFragment, InvoiceStructuralPreviewQuery, MtwFreightInvoiceFactsInput } from '../../generated/freight-invoice-operations';
2
+ export declare const INVOICE_RECOVERY_STORAGE = "movethewheels.freight-invoice.unresolved.v1";
3
+ export interface InvoiceScope {
4
+ actorId: string;
5
+ workspaceId: string;
6
+ tenantId: string | null;
7
+ organizationId: string;
8
+ projectId: string | null;
9
+ gateway: string;
10
+ }
11
+ export interface InvoiceIntent {
12
+ version: 1;
13
+ scope: InvoiceScope;
14
+ input: CompareMtwFreightInvoiceInput;
15
+ estimate: InvoiceEstimatePinFragment;
16
+ }
17
+ export declare function invoiceCanonical(value: unknown): string;
18
+ export declare function invoiceFactsInput(value: unknown): MtwFreightInvoiceFactsInput;
19
+ export declare function invoiceRecordInput(value: unknown): CompareMtwFreightInvoiceInput;
20
+ export declare function sameInvoiceScope(a: InvoiceScope, b: InvoiceScope | null): boolean;
21
+ export declare function decodeInvoiceIntent(raw: string | null): InvoiceIntent | null;
22
+ export declare function encodeInvoiceIntent(value: InvoiceIntent): string;
23
+ /** Server owns full trusted context and fingerprint; validate visible business facts, never invent its hash. */
24
+ export declare function matchesInvoiceReceipt(receipt: InvoiceReceiptFragment | null | undefined, intent: InvoiceIntent): boolean;
25
+ /** Structural preview must match the selected exact version and current draft; it grants no save authority. */
26
+ export declare function matchesInvoicePreview(value: InvoiceStructuralPreviewQuery['previewMtwFreightInvoice'], facts: MtwFreightInvoiceFactsInput, estimate: InvoiceEstimatePinFragment): boolean;
27
+ /** Exact decimal display including signed differences; money never enters Number. */
28
+ export declare function invoiceMoney(minor: string | null | undefined, currency: {
29
+ code: string;
30
+ minorUnitDigits: number;
31
+ }): string;
32
+ export declare function invoiceRowDifference(value: Pick<InvoiceReceiptFragment, 'facts' | 'outcome'>, rowId: string): string;