@burdenoff/microfe-movethewheels 2026.1102.1 → 2026.1102.2

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 (27) hide show
  1. package/dist/components/freight-cost/FreightCommercialFactEditor.js +46 -46
  2. package/dist/components/freight-cost/FreightCommercialHistory.js +7 -7
  3. package/dist/components/freight-cost/FreightDraftForm.js +20 -20
  4. package/dist/components/freight-invoice/InvoiceReviewPanel.js +255 -0
  5. package/dist/components/freight-invoice/InvoiceReviewQueue.js +93 -0
  6. package/dist/generated/freight-invoice-operations.d.ts +461 -0
  7. package/dist/hooks/useInvoiceComparisonRecovery.js +26 -26
  8. package/dist/hooks/useInvoiceReviewPermissions.js +14 -0
  9. package/dist/movethewheels/components/freight-invoice/InvoiceReviewPanel.d.ts +11 -0
  10. package/dist/movethewheels/components/freight-invoice/InvoiceReviewQueue.d.ts +22 -0
  11. package/dist/movethewheels/hooks/useInvoiceReviewPermissions.d.ts +5 -0
  12. package/dist/movethewheels/pages/FinancePage.d.ts +3 -1
  13. package/dist/movethewheels/utils/invoiceReview.d.ts +26 -0
  14. package/dist/pages/FinancePage.js +109 -67
  15. package/dist/pages/FreightEstimatePage.js +89 -89
  16. package/dist/pages/FreightInvoicePage.js +138 -120
  17. package/dist/src/generated/freight-invoice-operations.js +2100 -1
  18. package/dist/utils/invoiceReview.js +84 -0
  19. package/package.json +2 -2
  20. package/src/generated/freight-invoice-operations.ts +245 -1
  21. package/src/movethewheels/components/freight-invoice/InvoiceReviewPanel.tsx +319 -0
  22. package/src/movethewheels/components/freight-invoice/InvoiceReviewQueue.tsx +96 -0
  23. package/src/movethewheels/hooks/useInvoiceReviewPermissions.ts +25 -0
  24. package/src/movethewheels/pages/FinancePage.tsx +34 -2
  25. package/src/movethewheels/pages/FreightInvoicePage.tsx +44 -3
  26. package/src/movethewheels/utils/invoiceReview.ts +146 -0
  27. package/src/operations/freight-invoice/review.graphql +26 -0
@@ -3,67 +3,67 @@ import { Button as t } from "../components/ui.js";
3
3
  import { PageLayout as n } from "../components/PageLayout.js";
4
4
  import { useConditionApi as r, useConditionQuery as i } from "../hooks/useContainerCondition.js";
5
5
  import { PinnedSelect as a, ReusePager as o, ReuseState as s, reuseCard as c } from "../components/ReuseControls.js";
6
- import { FreightCommercialVersionDocument as l, FreightHistoryDocument as u, FreightShipmentDocument as d, FreightShipmentsDocument as f, PreviewFreightCostsDocument as ee, SaveFreightCommercialCostsDocument as p, SaveFreightCostsDocument as m } from "../src/generated/freight-cost-operations.js";
7
- import { FreightText as h } from "../components/freight-cost/FreightFields.js";
8
- import { freightPinMatches as g, freightSaveInput as _ } from "../utils/freightDraft.js";
9
- import { FreightDraftForm as v } from "../components/freight-cost/FreightDraftForm.js";
10
- import { FreightHistory as te } from "../components/freight-cost/FreightHistory.js";
11
- import { useFreightRecoveryAction as y } from "../hooks/useFreightRecoveryAction.js";
12
- import { useEffect as b, useRef as x, useState as S } from "react";
13
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
6
+ import { FreightText as l } from "../components/freight-cost/FreightFields.js";
7
+ import { freightPinMatches as u, freightSaveInput as d } from "../utils/freightDraft.js";
8
+ import { FreightCommercialVersionDocument as f, FreightHistoryDocument as p, FreightShipmentDocument as m, FreightShipmentsDocument as h, PreviewFreightCostsDocument as g, SaveFreightCommercialCostsDocument as _, SaveFreightCostsDocument as v } from "../src/generated/freight-cost-operations.js";
9
+ import { FreightDraftForm as y } from "../components/freight-cost/FreightDraftForm.js";
10
+ import { FreightHistory as ee } from "../components/freight-cost/FreightHistory.js";
11
+ import { useFreightRecoveryAction as b } from "../hooks/useFreightRecoveryAction.js";
12
+ import { useEffect as x, useRef as S, useState as C } from "react";
13
+ import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
14
14
  //#region src/movethewheels/pages/FreightEstimatePage.tsx
15
- function E() {
16
- let t = y();
17
- return /* @__PURE__ */ w(n, {
15
+ function D() {
16
+ let t = b();
17
+ return /* @__PURE__ */ T(n, {
18
18
  title: "Freight cost estimates",
19
19
  subtitle: "Dated source costs, visible unknowns and immutable versions.",
20
- icon: /* @__PURE__ */ w(e, { "aria-hidden": "true" }),
21
- children: /* @__PURE__ */ w(D, { actions: t }, t.contextKey)
20
+ icon: /* @__PURE__ */ T(e, { "aria-hidden": "true" }),
21
+ children: /* @__PURE__ */ T(O, { actions: t }, t.contextKey)
22
22
  });
23
23
  }
24
- function D({ actions: e }) {
25
- let n = r(), [y, E] = S(0), [D, O] = S(0), [k, A] = S(null), [j, M] = S(""), [N, P] = S(null), [F, I] = S(null), [ne, L] = S(!1), [R, z] = S(!1), [B, V] = S(null), H = x(!0), U = x(!1);
26
- b(() => (H.current = !0, () => {
24
+ function O({ actions: e }) {
25
+ let n = r(), [b, D] = C(0), [O, k] = C(0), [A, te] = C(null), [j, ne] = C(""), [M, N] = C(null), [P, F] = C(null), [I, L] = C(!1), [R, z] = C(!1), [B, V] = C(null), H = S(!0), U = S(!1);
26
+ x(() => (H.current = !0, () => {
27
27
  H.current = !1;
28
28
  }), []);
29
- let W = i(f, { pagination: {
29
+ let W = i(h, { pagination: {
30
30
  limit: 25,
31
- offset: y
32
- } }, e.revision), G = i(d, k ? { id: k.id } : null, e.revision), K = i(u, k && j.trim() ? {
33
- shipmentId: k.id,
31
+ offset: b
32
+ } }, e.revision), G = i(m, A ? { id: A.id } : null, e.revision), K = i(p, A && j.trim() ? {
33
+ shipmentId: A.id,
34
34
  estimateReference: j.trim(),
35
35
  pagination: {
36
36
  limit: 1,
37
37
  offset: 0
38
38
  }
39
- } : null, e.revision), q = e.uncertain ? e.originalHistoryTarget : k ? {
40
- shipmentId: k.id,
39
+ } : null, e.revision), q = e.uncertain ? e.originalHistoryTarget : A ? {
40
+ shipmentId: A.id,
41
41
  estimateReference: void 0
42
- } : null, J = i(u, q ? {
42
+ } : null, J = i(p, q ? {
43
43
  shipmentId: q.shipmentId,
44
44
  estimateReference: q.estimateReference,
45
45
  pagination: {
46
46
  limit: 10,
47
- offset: D
47
+ offset: O
48
48
  }
49
- } : null, e.revision), Y = i(l, q && N ? {
49
+ } : null, e.revision), Y = i(f, q && M ? {
50
50
  shipmentId: q.shipmentId,
51
- id: N
52
- } : null, e.revision), X = K.data?.mtwFreightEstimatePage.items[0] ?? null, Z = !!F && !!G.data && !!K.data && !g(F, G.data.shipment, X), Q = e.busy || ne || e.uncertain, $ = W.data?.shipments.map((e) => ({
51
+ id: M
52
+ } : null, e.revision), X = K.data?.mtwFreightEstimatePage.items[0] ?? null, Z = !!P && !!G.data && !!K.data && !u(P, G.data.shipment, X), Q = e.busy || I || e.uncertain, $ = W.data?.shipments.map((e) => ({
53
53
  id: e.id,
54
54
  label: `${e.shipmentNumber} — ${e.primaryMode} — ${e.status}`
55
55
  })) ?? [];
56
- k && !$.some((e) => e.id === k.id) && $.unshift({
57
- id: k.id,
58
- label: `${k.label} — selected outside this page`
56
+ A && !$.some((e) => e.id === A.id) && $.unshift({
57
+ id: A.id,
58
+ label: `${A.label} — selected outside this page`
59
59
  });
60
60
  let re = async (t, r, i) => {
61
61
  if (U.current || Q) return;
62
- if (!F) throw Error("Review the shipment and current cost history first.");
62
+ if (!P) throw Error("Review the shipment and current cost history first.");
63
63
  U.current = !0, L(!0), V(null);
64
- let a = F;
64
+ let a = P;
65
65
  try {
66
- let o = await n(d, { id: a.shipmentId }), s = await n(u, {
66
+ let o = await n(m, { id: a.shipmentId }), s = await n(p, {
67
67
  shipmentId: a.shipmentId,
68
68
  estimateReference: a.estimateReference,
69
69
  pagination: {
@@ -73,77 +73,77 @@ function D({ actions: e }) {
73
73
  });
74
74
  if (!H.current) throw Error("The current workspace changed. Nothing was sent.");
75
75
  let c = s.mtwFreightEstimatePage.items[0] ?? null;
76
- g(a, o.shipment, c) || z(!0);
77
- let l = _(a, o.shipment, c, t, r.map(({ fileId: e, versionId: t }) => ({
76
+ u(a, o.shipment, c) || z(!0);
77
+ let l = d(a, o.shipment, c, t, r.map(({ fileId: e, versionId: t }) => ({
78
78
  fileId: e,
79
79
  versionId: t
80
- }))), f = await e.run(i ? p : m, i ? {
80
+ }))), f = await e.run(i ? _ : v, i ? {
81
81
  ...l,
82
82
  commercialCapture: i
83
83
  } : l, "Sourced cost version recorded.");
84
- f && H.current && (P(f.saveMtwFreightEstimate.id), I(null), O(0));
84
+ f && H.current && (N(f.saveMtwFreightEstimate.id), F(null), k(0));
85
85
  } finally {
86
86
  H.current && L(!1), U.current = !1;
87
87
  }
88
88
  }, ie = W.data ? {
89
89
  total: W.data.shipmentsCount,
90
90
  limit: 25,
91
- offset: y,
92
- hasMore: y + W.data.shipments.length < W.data.shipmentsCount,
93
- nextOffset: y + 25
91
+ offset: b,
92
+ hasMore: b + W.data.shipments.length < W.data.shipmentsCount,
93
+ nextOffset: b + 25
94
94
  } : void 0;
95
- return /* @__PURE__ */ T("div", {
95
+ return /* @__PURE__ */ E("div", {
96
96
  className: "min-w-0 space-y-6 break-words",
97
97
  children: [
98
- /* @__PURE__ */ w("p", {
98
+ /* @__PURE__ */ T("p", {
99
99
  className: "rounded border p-4 text-sm",
100
100
  children: "Record the costs stated by your source. Missing facts are not zero. Saving does not book freight, accept a quote or settle an invoice."
101
101
  }),
102
- /* @__PURE__ */ T("section", {
102
+ /* @__PURE__ */ E("section", {
103
103
  className: c,
104
104
  children: [
105
- /* @__PURE__ */ w("h2", {
105
+ /* @__PURE__ */ T("h2", {
106
106
  className: "text-lg font-semibold",
107
107
  children: "Shipment and cost sheet"
108
108
  }),
109
- /* @__PURE__ */ w(a, {
109
+ /* @__PURE__ */ T(a, {
110
110
  label: "Shipment",
111
- value: k?.id ?? "",
111
+ value: A?.id ?? "",
112
112
  options: $,
113
113
  disabled: Q,
114
114
  onChange: (e) => {
115
115
  let t = $.find((t) => t.id === e);
116
- A(t ? {
116
+ te(t ? {
117
117
  id: t.id,
118
118
  label: t.label
119
- } : null), I(null), P(null), O(0), z(!1);
119
+ } : null), F(null), N(null), k(0), z(!1);
120
120
  }
121
121
  }),
122
- /* @__PURE__ */ w(s, {
122
+ /* @__PURE__ */ T(s, {
123
123
  loading: W.loading,
124
124
  error: W.error
125
125
  }),
126
- /* @__PURE__ */ w(o, {
126
+ /* @__PURE__ */ T(o, {
127
127
  page: ie,
128
128
  busy: W.loading || Q,
129
- offset: y,
130
- onChange: E
129
+ offset: b,
130
+ onChange: D
131
131
  }),
132
- /* @__PURE__ */ w(h, {
132
+ /* @__PURE__ */ T(l, {
133
133
  label: "Cost sheet reference",
134
134
  value: j,
135
- disabled: Q || F !== null,
136
- onChange: M
135
+ disabled: Q || P !== null,
136
+ onChange: ne
137
137
  }),
138
- /* @__PURE__ */ w(s, {
138
+ /* @__PURE__ */ T(s, {
139
139
  loading: G.loading,
140
140
  error: G.error
141
141
  }),
142
- /* @__PURE__ */ w(s, {
142
+ /* @__PURE__ */ T(s, {
143
143
  loading: K.loading,
144
144
  error: K.error
145
145
  }),
146
- G.data?.shipment && /* @__PURE__ */ T("p", { children: [
146
+ G.data?.shipment && /* @__PURE__ */ E("p", { children: [
147
147
  G.data.shipment.shipmentNumber,
148
148
  " — ",
149
149
  G.data.shipment.primaryMode,
@@ -152,20 +152,20 @@ function D({ actions: e }) {
152
152
  X ? `latest sheet version ${X.version}` : "no version in the loaded sheet",
153
153
  "."
154
154
  ] }),
155
- /* @__PURE__ */ T("div", {
155
+ /* @__PURE__ */ E("div", {
156
156
  className: "flex flex-wrap gap-3",
157
- children: [/* @__PURE__ */ w(t, {
157
+ children: [/* @__PURE__ */ T(t, {
158
158
  type: "button",
159
159
  variant: "outline",
160
160
  disabled: Q,
161
161
  onClick: e.refresh,
162
162
  children: "Refresh current records"
163
- }), /* @__PURE__ */ w(t, {
163
+ }), /* @__PURE__ */ T(t, {
164
164
  type: "button",
165
165
  disabled: Q || G.loading || K.loading || !!G.error || !!K.error || !G.data?.shipment || !K.data || !j.trim(),
166
166
  onClick: () => {
167
167
  let e = G.data?.shipment;
168
- e && K.data && (I({
168
+ e && K.data && (F({
169
169
  shipmentId: e.id,
170
170
  shipmentUpdatedAt: e.updatedAt,
171
171
  estimateReference: j.trim(),
@@ -179,43 +179,43 @@ function D({ actions: e }) {
179
179
  })
180
180
  ]
181
181
  }),
182
- (Z || R) && /* @__PURE__ */ w("p", {
182
+ (Z || R) && /* @__PURE__ */ T("p", {
183
183
  role: "alert",
184
184
  children: "The shipment or cost history changed. Review the current records and explicitly start a new draft; entered facts were not rebound."
185
185
  }),
186
- F && !Z && !R && /* @__PURE__ */ w(v, {
187
- shipmentId: F.shipmentId,
186
+ P && !Z && !R && /* @__PURE__ */ T(y, {
187
+ shipmentId: P.shipmentId,
188
188
  disabled: Q || G.loading || K.loading || !!G.error || !!K.error,
189
- onPreview: async (e) => (await n(ee, { input: e })).previewMtwFreightTotal,
189
+ onPreview: async (e) => (await n(g, { input: e })).previewMtwFreightTotal,
190
190
  onSave: re
191
- }, F.generation),
192
- B && /* @__PURE__ */ w("p", {
191
+ }, P.generation),
192
+ B && /* @__PURE__ */ T("p", {
193
193
  role: "alert",
194
194
  children: B
195
195
  }),
196
- e.error && /* @__PURE__ */ w("p", {
196
+ e.error && /* @__PURE__ */ T("p", {
197
197
  role: "alert",
198
198
  children: e.error
199
199
  }),
200
- e.notice && /* @__PURE__ */ w("p", {
200
+ e.notice && /* @__PURE__ */ T("p", {
201
201
  role: "status",
202
202
  children: e.notice
203
203
  }),
204
- e.uncertain && /* @__PURE__ */ T("section", {
204
+ e.uncertain && /* @__PURE__ */ E("section", {
205
205
  className: "space-y-4 rounded-xl border bg-bg-surface p-5",
206
206
  children: [
207
- /* @__PURE__ */ w("h2", {
207
+ /* @__PURE__ */ T("h2", {
208
208
  className: "font-semibold",
209
209
  children: "Resolve the original save"
210
210
  }),
211
- /* @__PURE__ */ w("p", { children: "The server may already have recorded it. Check history first. Return to the original account, organization, workspace and project before retrying." }),
212
- /* @__PURE__ */ w(t, {
211
+ /* @__PURE__ */ T("p", { children: "The server may already have recorded it. Check history first. Return to the original account, organization, workspace and project before retrying." }),
212
+ /* @__PURE__ */ T(t, {
213
213
  type: "button",
214
214
  disabled: !e.canRetry || e.busy,
215
215
  onClick: () => void e.retryOriginal(),
216
216
  children: "Retry original request"
217
217
  }),
218
- /* @__PURE__ */ w(t, {
218
+ /* @__PURE__ */ T(t, {
219
219
  type: "button",
220
220
  variant: "outline",
221
221
  disabled: e.busy,
@@ -226,39 +226,39 @@ function D({ actions: e }) {
226
226
  })
227
227
  ]
228
228
  }),
229
- e.uncertain && !e.originalHistoryTarget && /* @__PURE__ */ w("p", {
229
+ e.uncertain && !e.originalHistoryTarget && /* @__PURE__ */ T("p", {
230
230
  role: "status",
231
231
  children: "Original history is unavailable in this context. Return to the original account, organization, workspace and project. A malformed saved request cannot supply a history target."
232
232
  }),
233
- q && /* @__PURE__ */ T("section", {
233
+ q && /* @__PURE__ */ E("section", {
234
234
  className: "space-y-4 rounded-xl border bg-bg-surface p-5",
235
235
  children: [
236
- /* @__PURE__ */ w("h2", {
236
+ /* @__PURE__ */ T("h2", {
237
237
  className: "text-lg font-semibold",
238
238
  children: e.uncertain ? "Original request cost history" : "Immutable cost history"
239
239
  }),
240
- e.uncertain && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("p", { children: [
240
+ e.uncertain && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ E("p", { children: [
241
241
  "Shipment ",
242
242
  q.shipmentId,
243
243
  "; sheet ",
244
244
  q.estimateReference,
245
245
  ". Reading these records does not confirm the original request key or clear recovery."
246
- ] }), /* @__PURE__ */ w(t, {
246
+ ] }), /* @__PURE__ */ T(t, {
247
247
  type: "button",
248
248
  variant: "outline",
249
249
  disabled: e.busy,
250
250
  onClick: e.refresh,
251
251
  children: "Refresh original history"
252
252
  })] }),
253
- /* @__PURE__ */ w(s, {
253
+ /* @__PURE__ */ T(s, {
254
254
  loading: J.loading,
255
255
  error: J.error
256
256
  }),
257
- J.data?.mtwFreightEstimatePage.items.map((e) => /* @__PURE__ */ T(t, {
257
+ J.data?.mtwFreightEstimatePage.items.map((e) => /* @__PURE__ */ E(t, {
258
258
  type: "button",
259
259
  variant: "outline",
260
260
  className: "h-auto w-full max-w-full justify-start whitespace-normal break-all text-left",
261
- onClick: () => P(e.id),
261
+ onClick: () => N(e.id),
262
262
  children: [
263
263
  e.facts.title,
264
264
  " / ",
@@ -270,20 +270,20 @@ function D({ actions: e }) {
270
270
  new Date(e.recordedAt).toLocaleString()
271
271
  ]
272
272
  }, e.id)),
273
- /* @__PURE__ */ w(o, {
273
+ /* @__PURE__ */ T(o, {
274
274
  page: J.data?.mtwFreightEstimatePage,
275
275
  busy: J.loading,
276
- offset: D,
277
- onChange: O
276
+ offset: O,
277
+ onChange: k
278
278
  })
279
279
  ]
280
280
  }),
281
- q && N && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(s, {
281
+ q && M && /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(s, {
282
282
  loading: Y.loading,
283
283
  error: Y.error
284
- }), Y.data && /* @__PURE__ */ w(te, { record: Y.data.mtwFreightEstimateVersion })] })
284
+ }), Y.data && /* @__PURE__ */ T(ee, { record: Y.data.mtwFreightEstimateVersion })] })
285
285
  ]
286
286
  });
287
287
  }
288
288
  //#endregion
289
- export { E as default };
289
+ export { D as default };