@burdenoff/microfe-movethewheels 2026.1016.3 → 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.
- package/README.md +10 -0
- package/dist/MoveTheWheelsRoot.js +5 -0
- package/dist/MoveTheWheelsRoutes.js +25 -21
- package/dist/components/ContainerEvidencePicker.js +55 -55
- package/dist/components/FleetAlertsPanel.js +2 -2
- package/dist/components/freight-invoice/InvoiceForm.js +366 -0
- package/dist/components/freight-invoice/InvoiceResults.js +240 -0
- package/dist/generated/consolidation-operations.d.ts +195 -265
- package/dist/generated/container-condition-operations.d.ts +124 -187
- package/dist/generated/container-operations.d.ts +59 -85
- package/dist/generated/empty-reuse-operations.d.ts +165 -271
- package/dist/generated/free-time-operations.d.ts +120 -184
- package/dist/generated/freight-cost-operations.d.ts +307 -476
- package/dist/generated/freight-invoice-operations.d.ts +1447 -0
- package/dist/generated/logistics-procedure-operations.d.ts +100 -156
- package/dist/generated/pending-pick-operations.d.ts +769 -1025
- package/dist/generated/shipment-status-authority-operations.d.ts +82 -103
- package/dist/generated/stock-binding-operations.d.ts +188 -260
- package/dist/generated/stock-observation-operations.d.ts +103 -138
- package/dist/generated/tracking-quality-operations.d.ts +27 -41
- package/dist/generated/trip-utilization-operations.d.ts +137 -185
- package/dist/generated/wspace-operations.d.ts +628 -2272
- package/dist/generated/wspace-types.d.ts +4 -23
- package/dist/hooks/useInvoiceComparisonRecovery.js +118 -0
- package/dist/movethewheels/components/ContainerEvidencePicker.d.ts +2 -1
- package/dist/movethewheels/components/freight-invoice/InvoiceForm.d.ts +19 -0
- package/dist/movethewheels/components/freight-invoice/InvoiceResults.d.ts +9 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +1 -1
- package/dist/movethewheels/hooks/useFleetIntelligence.d.ts +1 -1
- package/dist/movethewheels/hooks/useInvoiceComparisonRecovery.d.ts +22 -0
- package/dist/movethewheels/hooks/useProcedureSelection.d.ts +1 -3
- package/dist/movethewheels/pages/FreightInvoicePage.d.ts +10 -0
- package/dist/movethewheels/utils/driverLicenseExpiry.d.ts +6 -0
- package/dist/movethewheels/utils/invoiceComparison.d.ts +32 -0
- package/dist/pages/DriverDetailsPage.js +306 -282
- package/dist/pages/FreightEstimatePage.js +1 -0
- package/dist/pages/FreightInvoicePage.js +346 -0
- package/dist/src/generated/consolidation-operations.js +3961 -503
- package/dist/src/generated/container-condition-operations.js +2968 -206
- package/dist/src/generated/container-operations.js +997 -99
- package/dist/src/generated/empty-reuse-operations.js +4811 -747
- package/dist/src/generated/free-time-operations.js +2824 -233
- package/dist/src/generated/freight-cost-operations.js +4852 -812
- package/dist/src/generated/freight-invoice-operations.js +4894 -0
- package/dist/src/generated/logistics-procedure-operations.js +2707 -360
- package/dist/src/generated/pending-pick-operations.js +8244 -1196
- package/dist/src/generated/shipment-status-authority-operations.js +1157 -84
- package/dist/src/generated/stock-binding-operations.js +2779 -173
- package/dist/src/generated/stock-observation-operations.js +1274 -91
- package/dist/src/generated/tracking-quality-operations.js +407 -42
- package/dist/src/generated/trip-utilization-operations.js +1765 -138
- package/dist/src/generated/wspace-operations.js +428 -706
- package/dist/utils/driverLicenseExpiry.js +14 -0
- package/dist/utils/invoiceComparison.js +272 -0
- package/package.json +29 -29
- package/src/generated/consolidation-operations.ts +60 -559
- package/src/generated/container-condition-operations.ts +63 -265
- package/src/generated/container-operations.ts +37 -132
- package/src/generated/empty-reuse-operations.ts +83 -824
- package/src/generated/free-time-operations.ts +55 -284
- package/src/generated/freight-cost-operations.ts +42 -848
- package/src/generated/freight-invoice-operations.ts +830 -0
- package/src/generated/logistics-procedure-operations.ts +60 -414
- package/src/generated/pending-pick-operations.ts +48 -1239
- package/src/generated/shipment-status-authority-operations.ts +33 -113
- package/src/generated/stock-binding-operations.ts +29 -198
- package/src/generated/stock-observation-operations.ts +24 -111
- package/src/generated/tracking-quality-operations.ts +19 -57
- package/src/generated/trip-utilization-operations.ts +32 -166
- package/src/generated/wspace-operations.ts +284 -2906
- package/src/generated/wspace-types.ts +2 -8
- package/src/movethewheels/MoveTheWheelsRoot.tsx +6 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
- package/src/movethewheels/components/ContainerEvidencePicker.tsx +12 -4
- package/src/movethewheels/components/FleetAlertsPanel.tsx +4 -2
- package/src/movethewheels/components/freight-invoice/InvoiceForm.tsx +412 -0
- package/src/movethewheels/components/freight-invoice/InvoiceResults.tsx +162 -0
- package/src/movethewheels/hooks/useFleet.ts +1 -1
- package/src/movethewheels/hooks/useFleetIntelligence.ts +5 -1
- package/src/movethewheels/hooks/useInvoiceComparisonRecovery.ts +227 -0
- package/src/movethewheels/pages/DriverDetailsPage.tsx +35 -9
- package/src/movethewheels/pages/FreightEstimatePage.tsx +1 -0
- package/src/movethewheels/pages/FreightInvoicePage.tsx +477 -0
- package/src/movethewheels/utils/driverLicenseExpiry.ts +25 -0
- package/src/movethewheels/utils/invoiceComparison.ts +520 -0
- package/src/operations/freight-invoice/comparison.graphql +40 -0
- package/src/operations/wspace/freight-invoice-evidence.graphql +6 -0
- package/patches/braces@3.0.3.patch +0 -87
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/movethewheels/utils/driverLicenseExpiry.ts
|
|
2
|
+
var e = (e) => e ? e.toISOString().slice(0, -1) : "", t = (e) => {
|
|
3
|
+
if (e === "") return null;
|
|
4
|
+
let t = /^(\d{4}-\d\d-\d\dT\d\d:\d\d)(?::(\d\d)(?:\.(\d{1,3}))?)?$/.exec(e);
|
|
5
|
+
if (!t) throw Error("Enter a valid licence expiry date and time in UTC.");
|
|
6
|
+
let n = `${t[1]}:${t[2] ?? "00"}.${(t[3] ?? "").padEnd(3, "0")}Z`, r = new Date(n);
|
|
7
|
+
if (!Number.isFinite(r.getTime()) || r.toISOString() !== n) throw Error("Enter a valid licence expiry date and time in UTC.");
|
|
8
|
+
return n;
|
|
9
|
+
}, n = (e, n) => {
|
|
10
|
+
let r = t(e);
|
|
11
|
+
return r === (n?.toISOString() ?? null) ? void 0 : r;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { e as driverLicenseExpiryInput, n as driverLicenseExpiryUpdate, t as parseDriverLicenseExpiry };
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { freightMoney as e } from "./freightDraft.js";
|
|
2
|
+
//#region src/movethewheels/utils/invoiceComparison.ts
|
|
3
|
+
var t = "movethewheels.freight-invoice.unresolved.v1";
|
|
4
|
+
function n(e) {
|
|
5
|
+
throw Error(e);
|
|
6
|
+
}
|
|
7
|
+
function r(e, t) {
|
|
8
|
+
return (!e || typeof e != "object" || Array.isArray(e) || Object.keys(e).some((e) => !t.includes(e))) && n("Invoice fields are not supported. Nothing was sent."), Object.fromEntries(Object.entries(e));
|
|
9
|
+
}
|
|
10
|
+
function i(e, t) {
|
|
11
|
+
return (typeof e != "string" || !e.trim() || e.trim().length > t) && n("Complete the bounded invoice source fields. Nothing was sent."), e.trim();
|
|
12
|
+
}
|
|
13
|
+
function a(e, t) {
|
|
14
|
+
return e == null || e === "" ? null : i(e, t);
|
|
15
|
+
}
|
|
16
|
+
function o(e, t) {
|
|
17
|
+
return (typeof e != "number" || !Number.isInteger(e) || e < 0 || e > t) && n("Invoice numeric convention is invalid. Nothing was sent."), e;
|
|
18
|
+
}
|
|
19
|
+
function s(e) {
|
|
20
|
+
let t = r(e, ["code", "minorUnitDigits"]), a = i(t.code, 3);
|
|
21
|
+
return /^[A-Z]{3}$/.test(a) || n("Declare an uppercase three-letter invoice currency."), {
|
|
22
|
+
code: a,
|
|
23
|
+
minorUnitDigits: o(t.minorUnitDigits, 4)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function c(e) {
|
|
27
|
+
if (e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e)) return JSON.stringify(e);
|
|
28
|
+
if (Array.isArray(e)) return "[" + e.map(c).join(",") + "]";
|
|
29
|
+
if (e && typeof e == "object") {
|
|
30
|
+
let t = Object.fromEntries(Object.entries(e)), n = Object.keys(t).filter((e) => t[e] !== void 0);
|
|
31
|
+
return n.sort((e, t) => e < t ? -1 : +(e > t)), "{" + n.map((e) => JSON.stringify(e) + ":" + c(t[e])).join(",") + "}";
|
|
32
|
+
}
|
|
33
|
+
return n("Cannot safely retain this invoice intent. Nothing was sent.");
|
|
34
|
+
}
|
|
35
|
+
function l(e) {
|
|
36
|
+
let t = r(e, [
|
|
37
|
+
"schemaVersion",
|
|
38
|
+
"supplierReference",
|
|
39
|
+
"supplierLabel",
|
|
40
|
+
"invoiceReference",
|
|
41
|
+
"sourceReference",
|
|
42
|
+
"sourceRevision",
|
|
43
|
+
"invoiceDate",
|
|
44
|
+
"currency",
|
|
45
|
+
"rows"
|
|
46
|
+
]);
|
|
47
|
+
(t.schemaVersion !== 1 || !Array.isArray(t.rows) || t.rows.length < 1 || t.rows.length > 100) && n("Provide 1–100 reported invoice rows.");
|
|
48
|
+
let o = s(t.currency), l = a(t.invoiceDate, 10);
|
|
49
|
+
if (l !== null) {
|
|
50
|
+
let e = /* @__PURE__ */ new Date(l + "T00:00:00.000Z");
|
|
51
|
+
(!/^\d{4}-\d{2}-\d{2}$/.test(l) || l.startsWith("0000") || !Number.isFinite(e.getTime()) || e.toISOString().slice(0, 10) !== l) && n("Invoice date must be an exact source date or left unknown.");
|
|
52
|
+
}
|
|
53
|
+
let u = t.rows.map((e) => {
|
|
54
|
+
let t = r(e, [
|
|
55
|
+
"id",
|
|
56
|
+
"description",
|
|
57
|
+
"estimateLineId",
|
|
58
|
+
"currency",
|
|
59
|
+
"payerReference",
|
|
60
|
+
"payerLabel",
|
|
61
|
+
"quantity",
|
|
62
|
+
"unit",
|
|
63
|
+
"unitRateMajor",
|
|
64
|
+
"amountMinor",
|
|
65
|
+
"zeroReason"
|
|
66
|
+
]), l = {
|
|
67
|
+
id: i(t.id, 120),
|
|
68
|
+
description: i(t.description, 1e3),
|
|
69
|
+
estimateLineId: a(t.estimateLineId, 120),
|
|
70
|
+
currency: s(t.currency),
|
|
71
|
+
payerReference: a(t.payerReference, 255),
|
|
72
|
+
payerLabel: a(t.payerLabel, 255),
|
|
73
|
+
quantity: a(t.quantity, 40),
|
|
74
|
+
unit: a(t.unit, 255),
|
|
75
|
+
unitRateMajor: a(t.unitRateMajor, 40),
|
|
76
|
+
amountMinor: a(t.amountMinor, 38),
|
|
77
|
+
zeroReason: a(t.zeroReason, 255)
|
|
78
|
+
};
|
|
79
|
+
c(l.currency) !== c(o) && n("Every row must declare the same invoice currency and scale."), l.payerReference === null != (l.payerLabel === null) && n("Supply both payer reference and label, or leave both unknown.");
|
|
80
|
+
for (let e of [l.quantity, l.unitRateMajor]) e !== null && !/^(0|[1-9]\d{0,19})(\.\d{1,18})?$/.test(e) && n("Quantity and rate require nonnegative decimal strings; no credits or exponent notation.");
|
|
81
|
+
return l.amountMinor !== null && !/^(0|[1-9]\d{0,37})$/.test(l.amountMinor) && n("Amount requires a nonnegative integer minor-unit string or unknown."), l.amountMinor === "0" && l.zeroReason === null && n("Record the source reason for an explicit zero charge."), l;
|
|
82
|
+
});
|
|
83
|
+
return u.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id)), new Set(u.map((e) => e.id)).size !== u.length && n("Invoice row IDs must be unique."), {
|
|
84
|
+
schemaVersion: 1,
|
|
85
|
+
supplierReference: a(t.supplierReference, 255),
|
|
86
|
+
supplierLabel: a(t.supplierLabel, 255),
|
|
87
|
+
invoiceReference: a(t.invoiceReference, 120),
|
|
88
|
+
sourceReference: i(t.sourceReference, 255),
|
|
89
|
+
sourceRevision: i(t.sourceRevision, 255),
|
|
90
|
+
invoiceDate: l,
|
|
91
|
+
currency: o,
|
|
92
|
+
rows: u
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function u(e) {
|
|
96
|
+
let t = r(e, [
|
|
97
|
+
"shipmentId",
|
|
98
|
+
"estimateVersionId",
|
|
99
|
+
"facts",
|
|
100
|
+
"evidence",
|
|
101
|
+
"expectedPreviousComparisonId",
|
|
102
|
+
"expectedRevision",
|
|
103
|
+
"correctionReason",
|
|
104
|
+
"idempotencyKey"
|
|
105
|
+
]), s = l(t.facts);
|
|
106
|
+
(!s.supplierReference || !s.invoiceReference) && n("Source stable supplier and invoice references before recording."), (!Array.isArray(t.evidence) || t.evidence.length < 1 || t.evidence.length > 10) && n("Select 1–10 current exact evidence versions.");
|
|
107
|
+
let u = t.evidence.map((e) => {
|
|
108
|
+
let t = r(e, ["fileId", "versionId"]);
|
|
109
|
+
return {
|
|
110
|
+
fileId: i(t.fileId, 255),
|
|
111
|
+
versionId: i(t.versionId, 255)
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
u.sort((e, t) => {
|
|
115
|
+
let n = JSON.stringify([e.fileId, e.versionId]), r = JSON.stringify([t.fileId, t.versionId]);
|
|
116
|
+
return n < r ? -1 : +(n > r);
|
|
117
|
+
}), new Set(u.map((e) => e.versionId)).size !== u.length && n("Select distinct exact evidence versions.");
|
|
118
|
+
let d = o(t.expectedRevision, 2147483646), f = a(t.expectedPreviousComparisonId, 255), p = a(t.correctionReason, 1e3);
|
|
119
|
+
(d === 0 != (f === null) || d === 0 != (p === null)) && n("A correction needs the exact previous revision and a reason.");
|
|
120
|
+
let m = {
|
|
121
|
+
shipmentId: i(t.shipmentId, 255),
|
|
122
|
+
estimateVersionId: i(t.estimateVersionId, 255),
|
|
123
|
+
facts: s,
|
|
124
|
+
evidence: u,
|
|
125
|
+
expectedPreviousComparisonId: f,
|
|
126
|
+
expectedRevision: d,
|
|
127
|
+
correctionReason: p,
|
|
128
|
+
idempotencyKey: i(t.idempotencyKey, 120)
|
|
129
|
+
};
|
|
130
|
+
return new TextEncoder().encode(c(m)).byteLength > 131072 && n("This normalized invoice request exceeds 131072 bytes."), m;
|
|
131
|
+
}
|
|
132
|
+
function d(e, t) {
|
|
133
|
+
return t !== null && c(e) === c(t);
|
|
134
|
+
}
|
|
135
|
+
function f(e) {
|
|
136
|
+
if (!e || new TextEncoder().encode(e).byteLength > 2e5) return null;
|
|
137
|
+
try {
|
|
138
|
+
let t = r(JSON.parse(e), [
|
|
139
|
+
"version",
|
|
140
|
+
"scope",
|
|
141
|
+
"input",
|
|
142
|
+
"estimate"
|
|
143
|
+
]);
|
|
144
|
+
if (t.version !== 1) return null;
|
|
145
|
+
let n = r(t.scope, [
|
|
146
|
+
"actorId",
|
|
147
|
+
"workspaceId",
|
|
148
|
+
"tenantId",
|
|
149
|
+
"organizationId",
|
|
150
|
+
"projectId",
|
|
151
|
+
"gateway"
|
|
152
|
+
]), s = {
|
|
153
|
+
actorId: i(n.actorId, 255),
|
|
154
|
+
workspaceId: i(n.workspaceId, 255),
|
|
155
|
+
tenantId: a(n.tenantId, 255),
|
|
156
|
+
organizationId: i(n.organizationId, 255),
|
|
157
|
+
projectId: a(n.projectId, 255),
|
|
158
|
+
gateway: i(n.gateway, 2048)
|
|
159
|
+
}, c = u(t.input), l = r(t.estimate, [
|
|
160
|
+
"id",
|
|
161
|
+
"estimateReference",
|
|
162
|
+
"version",
|
|
163
|
+
"kind",
|
|
164
|
+
"sourceReference",
|
|
165
|
+
"sourceRevision",
|
|
166
|
+
"quotedAt",
|
|
167
|
+
"validFrom",
|
|
168
|
+
"validUntil",
|
|
169
|
+
"acceptance"
|
|
170
|
+
]);
|
|
171
|
+
if (l.kind !== "ESTIMATE" && l.kind !== "QUOTE" || l.acceptance !== "NOT_ESTABLISHED" || l.id !== c.estimateVersionId) return null;
|
|
172
|
+
let d = o(l.version, 2147483647);
|
|
173
|
+
return d < 1 ? null : {
|
|
174
|
+
version: 1,
|
|
175
|
+
scope: s,
|
|
176
|
+
input: c,
|
|
177
|
+
estimate: {
|
|
178
|
+
id: i(l.id, 255),
|
|
179
|
+
estimateReference: i(l.estimateReference, 120),
|
|
180
|
+
version: d,
|
|
181
|
+
kind: l.kind,
|
|
182
|
+
sourceReference: i(l.sourceReference, 255),
|
|
183
|
+
sourceRevision: i(l.sourceRevision, 255),
|
|
184
|
+
quotedAt: a(l.quotedAt, 32),
|
|
185
|
+
validFrom: a(l.validFrom, 32),
|
|
186
|
+
validUntil: a(l.validUntil, 32),
|
|
187
|
+
acceptance: l.acceptance
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
} catch {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function p(e) {
|
|
195
|
+
let t = JSON.stringify(e);
|
|
196
|
+
return f(t) || n("Cannot retain the original invoice intent. Nothing was sent."), t;
|
|
197
|
+
}
|
|
198
|
+
function m(e) {
|
|
199
|
+
return typeof e == "string" && Number.isFinite(new Date(e).getTime()) && new Date(e).toISOString() === e;
|
|
200
|
+
}
|
|
201
|
+
var h = new Set([
|
|
202
|
+
"MATCHED",
|
|
203
|
+
"RATE_CHANGED",
|
|
204
|
+
"QUANTITY_CHANGED",
|
|
205
|
+
"AMOUNT_CHANGED",
|
|
206
|
+
"CURRENCY_CHANGED",
|
|
207
|
+
"PAYER_CHANGED",
|
|
208
|
+
"UNMATCHED_INVOICE_LINE",
|
|
209
|
+
"MISSING_EXPECTED_LINE",
|
|
210
|
+
"DUPLICATE_MATCH",
|
|
211
|
+
"EXCLUDED_CHARGE_APPEARED",
|
|
212
|
+
"UNKNOWN_COMPARISON"
|
|
213
|
+
]), g = new Set([
|
|
214
|
+
"MISSING_AMOUNT",
|
|
215
|
+
"MISSING_PAYER",
|
|
216
|
+
"MISSING_UNIT",
|
|
217
|
+
"UNIT_MISMATCH",
|
|
218
|
+
"MISSING_QUANTITY",
|
|
219
|
+
"MISSING_RATE",
|
|
220
|
+
"SCALE_MISMATCH",
|
|
221
|
+
"UNKNOWN_BASIS",
|
|
222
|
+
"UNKNOWN_DISPOSITION",
|
|
223
|
+
"INCLUDED_CHILD_BILLED_SEPARATELY",
|
|
224
|
+
"UNKNOWN_EXPECTED_CHARGE_COVERAGE"
|
|
225
|
+
]);
|
|
226
|
+
function _(e, t, n = !1) {
|
|
227
|
+
return Array.isArray(e) && e.length <= t.size && (!n || e.length > 0) && e.every((e) => typeof e == "string" && t.has(e)) && new Set(e).size === e.length;
|
|
228
|
+
}
|
|
229
|
+
function v(e, t) {
|
|
230
|
+
let n = e.outcome;
|
|
231
|
+
if (!n || typeof n.allLinesMatched != "boolean" || !_(n.flags, h, !0) || !Array.isArray(n.rows) || n.rows.length !== t.length || new Set(n.rows.map((e) => e.invoiceLineId)).size !== t.length || !Array.isArray(n.missingExpectedLineIds) || n.missingExpectedLineIds.length > 100 || n.missingExpectedLineIds.some((e) => typeof e != "string" || !e || e.length > 120) || new Set(n.missingExpectedLineIds).size !== n.missingExpectedLineIds.length || !Array.isArray(n.unknownExpectedCoverage) || n.unknownExpectedCoverage.length > 100 || n.rows.some((e) => !t.some((t) => t.id === e.invoiceLineId && (t.estimateLineId ?? null) === e.estimateLineId) || !_(e.flags, h, !0) || !_(e.reasons, g) || e.deltaMinor !== null && (typeof e.deltaMinor != "string" || !/^(-?[1-9]\d{0,39}|0)$/.test(e.deltaMinor))) || n.unknownExpectedCoverage.some((e) => typeof e.estimateLineId != "string" || !e.estimateLineId || e.estimateLineId.length > 120 || e.flag !== "UNKNOWN_COMPARISON" || e.reason !== "UNKNOWN_EXPECTED_CHARGE_COVERAGE") || n.allLinesMatched && (n.flags.length !== 1 || n.flags[0] !== "MATCHED" || n.missingExpectedLineIds.length > 0 || n.unknownExpectedCoverage.length > 0 || n.rows.some((e) => e.flags.length !== 1 || e.flags[0] !== "MATCHED")) || !Array.isArray(n.comparableSubtotals) || n.comparableSubtotals.length > 100) return !1;
|
|
232
|
+
let r = [];
|
|
233
|
+
for (let e of n.comparableSubtotals) {
|
|
234
|
+
s(e.currency), i(e.payerReference, 255);
|
|
235
|
+
for (let t of [e.estimateMinor, e.invoiceMinor]) if (typeof t != "string" || !/^(0|[1-9]\d{0,39})$/.test(t)) return !1;
|
|
236
|
+
if (typeof e.deltaMinor != "string" || !/^(-?[1-9]\d{0,39}|0)$/.test(e.deltaMinor) || !Array.isArray(e.invoiceLineIds) || !e.invoiceLineIds.length || e.invoiceLineIds.some((e) => !t.some((t) => t.id === e))) return !1;
|
|
237
|
+
r.push(...e.invoiceLineIds);
|
|
238
|
+
}
|
|
239
|
+
if (new Set(r).size !== r.length) return !1;
|
|
240
|
+
for (let t of [e.estimateDeclaredSubtotals, e.invoiceDeclaredSubtotals]) {
|
|
241
|
+
if (!Array.isArray(t) || t.length > 100) return !1;
|
|
242
|
+
for (let e of t) if (s(e.currency), a(e.payerReference, 255), a(e.payerLabel, 255), typeof e.knownAmountMinor != "string" || !/^(0|[1-9]\d{0,39})$/.test(e.knownAmountMinor) || e.totalAmountMinor !== null && (typeof e.totalAmountMinor != "string" || !/^(0|[1-9]\d{0,39})$/.test(e.totalAmountMinor))) return !1;
|
|
243
|
+
}
|
|
244
|
+
return !0;
|
|
245
|
+
}
|
|
246
|
+
function y(e, t) {
|
|
247
|
+
try {
|
|
248
|
+
if (!e || typeof e.id != "string" || !/^([a-f0-9]{8}-){1}[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(e.id) || typeof e.invoiceIdentityId != "string" || !e.invoiceIdentityId || e.invoiceIdentityId.length > 255 || e.invoiceIdentityId !== e.invoiceIdentityId.trim() || e.shipmentId !== t.input.shipmentId || e.idempotencyKey !== t.input.idempotencyKey || typeof e.requestFingerprint != "string" || !/^([a-f0-9]{64})$/.test(e.requestFingerprint) || e.methodVersion !== 1 || e.revision !== t.input.expectedRevision + 1 || e.previousComparisonId !== (t.input.expectedPreviousComparisonId ?? null) || e.correctionReason !== (t.input.correctionReason ?? null) || e.createdBy !== t.scope.actorId || e.actorProvenance !== "direct_human" || e.onBehalfOf !== null && e.onBehalfOf !== t.scope.actorId || !m(e.recordedAt) || c(e.estimate) !== c(t.estimate) || c(l(e.facts)) !== c(t.input.facts) || !v(e, t.input.facts.rows)) return !1;
|
|
249
|
+
let n = t.input.evidence.map((e) => JSON.stringify([e.fileId, e.versionId])), r = e.evidence.map((e) => JSON.stringify([e.fileId, e.versionId]));
|
|
250
|
+
return r.length !== n.length || new Set(r).size !== r.length || r.some((e, t) => e !== n[t]) ? !1 : e.evidence.every((t) => typeof t.sha256Hash == "string" && /^[a-f0-9]{64}$/.test(t.sha256Hash) && m(t.checkedAt) && new Date(t.checkedAt) <= new Date(e.recordedAt) && new Date(e.recordedAt).getTime() - new Date(t.checkedAt).getTime() <= 6e4);
|
|
251
|
+
} catch {
|
|
252
|
+
return !1;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function b(e, t, n) {
|
|
256
|
+
try {
|
|
257
|
+
return !!e && e.methodVersion === 1 && typeof e.recordable == "boolean" && Array.isArray(e.blockers) && e.blockers.length <= 4 && e.recordable === (e.blockers.length === 0) && e.blockers.every((e) => e === "SUPPLIER_UNKNOWN" || e === "INVOICE_REFERENCE_UNKNOWN" || e === "EVIDENCE_REQUIRED" || e === "SHIPMENT_NOT_LIVE") && c(e.estimate) === c(n) && c(l(e.facts)) === c(l(t)) && v(e, t.rows);
|
|
258
|
+
} catch {
|
|
259
|
+
return !1;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function x(t, n) {
|
|
263
|
+
if (t == null) return "Unknown";
|
|
264
|
+
let r = t.startsWith("-");
|
|
265
|
+
return `${n.code} ${r ? "-" : ""}${e(r ? t.slice(1) : t, n.minorUnitDigits)}`;
|
|
266
|
+
}
|
|
267
|
+
function S(e, t) {
|
|
268
|
+
let n = e.facts.rows.find((e) => e.id === t), r = e.outcome.rows.find((e) => e.invoiceLineId === t), i = e.outcome.comparableSubtotals.find((e) => e.invoiceLineIds.includes(t));
|
|
269
|
+
return !n || !r || r.deltaMinor === null || !i || n.currency.code !== i.currency.code || n.currency.minorUnitDigits !== i.currency.minorUnitDigits || n.payerReference !== i.payerReference ? "Not comparable" : x(r.deltaMinor, n.currency);
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
export { t as INVOICE_RECOVERY_STORAGE, f as decodeInvoiceIntent, p as encodeInvoiceIntent, c as invoiceCanonical, l as invoiceFactsInput, x as invoiceMoney, u as invoiceRecordInput, S as invoiceRowDifference, b as matchesInvoicePreview, y as matchesInvoiceReceipt, d as sameInvoiceScope };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-movethewheels",
|
|
3
|
-
"version": "2026.1016.
|
|
3
|
+
"version": "2026.1016.4",
|
|
4
4
|
"description": "Burdenoff MoveTheWheels Microfrontend - Logistics & Supply Chain Management Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
37
37
|
"type:check": "bash scripts/build-limits.sh tsc --noEmit",
|
|
38
38
|
"validate:schema-drift": "graphql-schema-drift",
|
|
39
|
-
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run codegen && bun run validate:schema-drift && bun run lint:sanity && bun run format && bun run type:check && bun run verify:live-logistics-contract && bun run verify:empty-reuse-retry && bun run verify:empty-reuse-recovery && bun run verify:trip-utilization-input && bun run verify:trip-draft-context && bun run verify:stock-binding-input && bun run verify:stock-observation-input && bun run verify:pending-pick-input && bun run verify:pick-review-ack && bun run verify:freight-input && bun run verify:freight-recovery && bun run verify:freight-commercial && bun run verify:procedure-input && bun run verify:consolidation && bun run verify:multimodal-single-attempt && bun run verify:workspace-predispatch && bun run verify:tracking-quality-outcomes && bun run verify:shipment-status-authority && bun run verify:free-time-permissions && bun run verify:
|
|
39
|
+
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run codegen && bun run validate:schema-drift && bun run lint:sanity && bun run format && bun run type:check && bun run verify:live-logistics-contract && bun run verify:empty-reuse-retry && bun run verify:empty-reuse-recovery && bun run verify:trip-utilization-input && bun run verify:trip-draft-context && bun run verify:stock-binding-input && bun run verify:stock-observation-input && bun run verify:pending-pick-input && bun run verify:pick-review-ack && bun run verify:driver-license-expiry && bun run verify:freight-input && bun run verify:freight-recovery && bun run verify:freight-commercial && bun run verify:freight-invoice && bun run verify:procedure-input && bun run verify:consolidation && bun run verify:multimodal-single-attempt && bun run verify:workspace-predispatch && bun run verify:tracking-quality-outcomes && bun run verify:shipment-status-authority && bun run verify:free-time-permissions && bun run verify:core-codegen && bun run build && bun run build-storybook'",
|
|
40
40
|
"storybook": "storybook dev -p 6006",
|
|
41
41
|
"build-storybook": "storybook build",
|
|
42
|
-
"test:storybook": "
|
|
42
|
+
"test:storybook": "vitest run --project=storybook",
|
|
43
43
|
"schema:pull": "bash scripts/schema-pull.sh",
|
|
44
44
|
"schema:pull:introspect": "bash scripts/schema-pull.sh --mode introspect",
|
|
45
45
|
"schema:check": "bash scripts/schema-pull.sh --check",
|
|
46
46
|
"verify:stock-binding-input": "bun scripts/verify-stock-binding-input.mjs",
|
|
47
|
-
"codegen": "
|
|
47
|
+
"codegen": "bun scripts/codegen.ts --project wspace && bun scripts/codegen.ts --project container-foundation && bun scripts/codegen.ts --project container-condition && bun scripts/codegen.ts --project free-time && bun scripts/codegen.ts --project empty-reuse && bun scripts/codegen.ts --project trip-utilization && bun scripts/codegen.ts --project stock-binding && bun scripts/codegen.ts --project stock-observation && bun scripts/codegen.ts --project pending-pick && bun scripts/codegen.ts --project freight-cost && bun scripts/codegen.ts --project freight-invoice && bun scripts/codegen.ts --project logistics-procedure && bun scripts/codegen.ts --project consolidation && bun scripts/codegen.ts --project tracking-quality && bun scripts/codegen.ts --project shipment-status-authority",
|
|
48
48
|
"codegen:all": "bun run schema:pull && bun run codegen",
|
|
49
49
|
"switch:status": "bun scripts/deps-mode.ts status",
|
|
50
50
|
"switch:remote": "bun scripts/deps-mode.ts remote",
|
|
@@ -64,10 +64,12 @@
|
|
|
64
64
|
"verify:procedure-input": "bun scripts/verify-procedure-input.mjs && bun scripts/verify-procedure-recovery-hook.mjs",
|
|
65
65
|
"verify:consolidation": "bun scripts/verify-consolidation-input.mjs && bun scripts/verify-consolidation-recovery-hook.mjs && bun scripts/verify-consolidation-mounted-hook.mjs",
|
|
66
66
|
"verify:tracking-quality-outcomes": "bun test scripts/verify-tracking-quality-outcomes.test.ts",
|
|
67
|
-
"verify:braces-depth": "bun test scripts/braces-depth-patch.test.ts",
|
|
68
67
|
"verify:shipment-status-authority": "bun scripts/verify-shipment-status-command.mjs",
|
|
69
68
|
"verify:free-time-permissions": "bun scripts/verify-free-time-permission-gates.mjs",
|
|
70
|
-
"verify:freight-commercial": "bun scripts/verify-freight-commercial.mjs && bun scripts/verify-freight-commercial-recovery.mjs && bun scripts/verify-freight-commercial-mounted.mjs"
|
|
69
|
+
"verify:freight-commercial": "bun scripts/verify-freight-commercial.mjs && bun scripts/verify-freight-commercial-recovery.mjs && bun scripts/verify-freight-commercial-mounted.mjs",
|
|
70
|
+
"verify:freight-invoice": "bun test scripts/verify-invoice-comparison.test.ts && bun scripts/verify-invoice-recovery-hook.mjs",
|
|
71
|
+
"verify:driver-license-expiry": "bun test scripts/check-driver-license-expiry.test.ts",
|
|
72
|
+
"verify:core-codegen": "bun test scripts/codegen.test.ts && node --test scripts/check-package-types.test.mjs"
|
|
71
73
|
},
|
|
72
74
|
"dependencies": {
|
|
73
75
|
"@apollo/client": "^4.0.11",
|
|
@@ -89,26 +91,17 @@
|
|
|
89
91
|
"devDependencies": {
|
|
90
92
|
"@escape.tech/graphql-armor-cost-limit": "2.4.3",
|
|
91
93
|
"@eslint/js": "^9.39.2",
|
|
92
|
-
"@graphql-codegen/
|
|
93
|
-
"@graphql-codegen/
|
|
94
|
-
"@graphql-codegen/
|
|
95
|
-
"@
|
|
96
|
-
"@
|
|
97
|
-
"@graphql-codegen/typescript-operations": "^4.0.0",
|
|
98
|
-
"@graphql-codegen/typescript-react-apollo": "^4.0.0",
|
|
99
|
-
"@storybook/addon-essentials": "^8.6.0",
|
|
100
|
-
"@storybook/addon-interactions": "^8.6.0",
|
|
101
|
-
"@storybook/react": "^8.6.0",
|
|
102
|
-
"@storybook/react-vite": "^8.6.0",
|
|
103
|
-
"@storybook/test": "^8.6.0",
|
|
104
|
-
"@storybook/test-runner": "0.22.0",
|
|
94
|
+
"@graphql-codegen/schema-ast": "6.1.1",
|
|
95
|
+
"@graphql-codegen/typescript": "6.1.2",
|
|
96
|
+
"@graphql-codegen/typescript-operations": "6.1.10",
|
|
97
|
+
"@storybook/react": "10.6.2",
|
|
98
|
+
"@storybook/react-vite": "10.6.2",
|
|
105
99
|
"@tailwindcss/vite": "^4.3.2",
|
|
106
100
|
"@types/leaflet": "^1.9.12",
|
|
107
101
|
"@types/react": "^19.0.2",
|
|
108
102
|
"@types/react-dom": "^19.0.2",
|
|
109
|
-
"@vitejs/plugin-react": "
|
|
103
|
+
"@vitejs/plugin-react": "5.2.0",
|
|
110
104
|
"autoprefixer": "^10.4.20",
|
|
111
|
-
"braces": "3.0.3",
|
|
112
105
|
"eslint": "^9.18.0",
|
|
113
106
|
"eslint-plugin-react": "^7.37.5",
|
|
114
107
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -118,12 +111,23 @@
|
|
|
118
111
|
"postcss": "^8.4.49",
|
|
119
112
|
"prettier": "^3.4.2",
|
|
120
113
|
"react-test-renderer": "19.3.0",
|
|
121
|
-
"storybook": "
|
|
114
|
+
"storybook": "10.6.2",
|
|
122
115
|
"tailwindcss": "^4.0.0",
|
|
123
116
|
"typescript": "^5.9.0",
|
|
124
117
|
"typescript-eslint": "^8.54.0",
|
|
125
118
|
"vite": "8.0.16",
|
|
126
|
-
"vite-plugin-dts": "5.1.2"
|
|
119
|
+
"vite-plugin-dts": "5.1.2",
|
|
120
|
+
"@storybook/addon-docs": "10.6.2",
|
|
121
|
+
"@storybook/addon-vitest": "10.6.2",
|
|
122
|
+
"vitest": "4.1.12",
|
|
123
|
+
"@vitest/browser": "4.1.12",
|
|
124
|
+
"@vitest/runner": "4.1.12",
|
|
125
|
+
"@vitest/browser-playwright": "4.1.12",
|
|
126
|
+
"@vitest/coverage-v8": "4.1.12",
|
|
127
|
+
"@graphql-codegen/core": "6.2.2",
|
|
128
|
+
"@graphql-codegen/typed-document-node": "7.1.1",
|
|
129
|
+
"@graphql-tools/load": "8.1.21",
|
|
130
|
+
"@graphql-tools/url-loader": "9.1.14"
|
|
127
131
|
},
|
|
128
132
|
"peerDependencies": {
|
|
129
133
|
"@apollo/client": "^4.0.11",
|
|
@@ -149,11 +153,7 @@
|
|
|
149
153
|
"yaml": ">=2.8.3",
|
|
150
154
|
"picomatch": ">=2.3.2",
|
|
151
155
|
"immutable": ">=3.8.3",
|
|
152
|
-
"minimatch": ">=3.1.3"
|
|
153
|
-
"@graphql-tools/utils": "12.0.3",
|
|
154
|
-
"ajv": "6.15.0"
|
|
156
|
+
"minimatch": ">=3.1.3"
|
|
155
157
|
},
|
|
156
|
-
"
|
|
157
|
-
"braces@3.0.3": "patches/braces@3.0.3.patch"
|
|
158
|
-
}
|
|
158
|
+
"schemaDriftAdapter": "codegen-core-v1"
|
|
159
159
|
}
|