@burdenoff/microfe-movethewheels 2026.1108.2 → 2026.1108.3
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/dist/components/DocumentsCard.js +183 -55
- package/dist/generated/wspace-types.d.ts +1479 -10
- package/dist/hooks/useDocumentExtractions.js +100 -0
- package/dist/movethewheels/hooks/useDocumentExtractions.d.ts +49 -0
- package/dist/movethewheels/hooks/useEntityDocuments.d.ts +5 -5
- package/dist/node_modules/lucide-react/dist/esm/icons/file-search.js +24 -0
- package/dist/pages/MultiModalShipmentPage.js +125 -121
- package/dist/pages/RouteDetailsPage.js +212 -207
- package/package.json +1 -1
- package/src/generated/wspace-types.ts +1672 -10
- package/src/movethewheels/components/DocumentsCard.tsx +174 -29
- package/src/movethewheels/hooks/useDocumentExtractions.ts +246 -0
- package/src/movethewheels/hooks/useEntityDocuments.ts +5 -5
- package/src/movethewheels/pages/MultiModalShipmentPage.tsx +2 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +2 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
|
+
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
+
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
4
|
+
//#region src/movethewheels/hooks/useDocumentExtractions.ts
|
|
5
|
+
var o = [
|
|
6
|
+
{
|
|
7
|
+
value: "BILL_OF_LADING",
|
|
8
|
+
label: "Bill of lading"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
value: "PROOF_OF_DELIVERY",
|
|
12
|
+
label: "Proof of delivery"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: "CARRIER_INVOICE",
|
|
16
|
+
label: "Carrier invoice"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "PACKING_LIST",
|
|
20
|
+
label: "Packing list"
|
|
21
|
+
}
|
|
22
|
+
], s = "\n query MtwDocumentExtractions($fileId: ID!) {\n mtwDocumentExtractions(fileId: $fileId) {\n id\n fileId\n docType\n status\n fields { key label value confidence }\n acceptedFields\n shipmentId\n model\n costMicroUsd\n createdAt\n appliedAt\n appliedBy\n }\n }\n", c = "\n mutation MtwExtractDocument($fileId: ID!, $docType: MtwDocumentType!) {\n mtwExtractDocument(fileId: $fileId, docType: $docType) {\n id\n fileId\n docType\n status\n fields { key label value confidence }\n acceptedFields\n shipmentId\n model\n costMicroUsd\n createdAt\n appliedAt\n appliedBy\n }\n }\n", l = "\n mutation MtwApplyDocumentExtraction($extractionId: ID!, $accept: [String!]!, $corrections: [MtwExtractionCorrectionInput!]) {\n mtwApplyDocumentExtraction(extractionId: $extractionId, accept: $accept, corrections: $corrections) {\n id\n status\n fields { key label value confidence }\n acceptedFields\n appliedAt\n appliedBy\n }\n }\n";
|
|
23
|
+
function u(e) {
|
|
24
|
+
return {
|
|
25
|
+
...e,
|
|
26
|
+
createdAt: new Date(e.createdAt),
|
|
27
|
+
appliedAt: e.appliedAt ? new Date(e.appliedAt) : null
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function d(o) {
|
|
31
|
+
let { apiGatewayUrl: d, authToken: f, workspaceToken: p, workspaceId: m, tenantId: h, currentUser: g } = e(), [_, v] = a([]), [y, b] = a(!1), [x, S] = a(null), [C, w] = a(!1), [T, E] = a(null), D = i(() => ({
|
|
32
|
+
apiGatewayUrl: d,
|
|
33
|
+
authToken: f,
|
|
34
|
+
workspaceToken: p,
|
|
35
|
+
workspaceId: m,
|
|
36
|
+
tenantId: h,
|
|
37
|
+
actorId: g?.id
|
|
38
|
+
}), [
|
|
39
|
+
d,
|
|
40
|
+
f,
|
|
41
|
+
p,
|
|
42
|
+
m,
|
|
43
|
+
h,
|
|
44
|
+
g?.id
|
|
45
|
+
]), O = n(async () => {
|
|
46
|
+
if (!o) {
|
|
47
|
+
v([]);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
b(!0), S(null);
|
|
51
|
+
try {
|
|
52
|
+
v(((await t(D, s, { fileId: o })).mtwDocumentExtractions ?? []).map(u));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
S(e instanceof Error ? e.message : "Failed to load extractions"), v([]);
|
|
55
|
+
} finally {
|
|
56
|
+
b(!1);
|
|
57
|
+
}
|
|
58
|
+
}, [o, D]);
|
|
59
|
+
return r(() => {
|
|
60
|
+
O();
|
|
61
|
+
}, [O]), {
|
|
62
|
+
extractions: _,
|
|
63
|
+
isLoading: y,
|
|
64
|
+
error: x,
|
|
65
|
+
extracting: C,
|
|
66
|
+
extractError: T,
|
|
67
|
+
extract: n(async (e, n) => {
|
|
68
|
+
w(!0), E(null);
|
|
69
|
+
try {
|
|
70
|
+
let r = u((await t(D, c, {
|
|
71
|
+
fileId: e,
|
|
72
|
+
docType: n
|
|
73
|
+
})).mtwExtractDocument);
|
|
74
|
+
return v((e) => [r, ...e.filter((e) => e.id !== r.id)]), r;
|
|
75
|
+
} catch (e) {
|
|
76
|
+
return E(e instanceof Error ? e.message : "Extraction failed"), null;
|
|
77
|
+
} finally {
|
|
78
|
+
w(!1);
|
|
79
|
+
}
|
|
80
|
+
}, [D]),
|
|
81
|
+
apply: n(async (e, n, r) => {
|
|
82
|
+
try {
|
|
83
|
+
let i = u((await t(D, l, {
|
|
84
|
+
extractionId: e,
|
|
85
|
+
accept: n,
|
|
86
|
+
corrections: r
|
|
87
|
+
})).mtwApplyDocumentExtraction);
|
|
88
|
+
return v((e) => e.map((e) => e.id === i.id ? {
|
|
89
|
+
...e,
|
|
90
|
+
...i
|
|
91
|
+
} : e)), !0;
|
|
92
|
+
} catch {
|
|
93
|
+
return !1;
|
|
94
|
+
}
|
|
95
|
+
}, [D]),
|
|
96
|
+
refetch: () => void O()
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { o as DOCUMENT_TYPE_OPTIONS, d as useDocumentExtractions };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useDocumentExtractions — freight document intelligence (BOFF-3892).
|
|
3
|
+
*
|
|
4
|
+
* Lists the extraction runs a platform File has been through and drives the
|
|
5
|
+
* two mutations: mtwExtractDocument (vision model proposes typed fields with
|
|
6
|
+
* per-field confidence, metered on the shared AI runtime) and
|
|
7
|
+
* mtwApplyDocumentExtraction (a human accepts fields per-field; the mapped
|
|
8
|
+
* writes — POD delivery event, invoice comparison, BOL tracking number —
|
|
9
|
+
* happen only then, once each).
|
|
10
|
+
*/
|
|
11
|
+
export type DocumentType = 'BILL_OF_LADING' | 'PROOF_OF_DELIVERY' | 'CARRIER_INVOICE' | 'PACKING_LIST';
|
|
12
|
+
export declare const DOCUMENT_TYPE_OPTIONS: ReadonlyArray<{
|
|
13
|
+
value: DocumentType;
|
|
14
|
+
label: string;
|
|
15
|
+
}>;
|
|
16
|
+
export interface ExtractionField {
|
|
17
|
+
key: string;
|
|
18
|
+
label: string;
|
|
19
|
+
value: string | null;
|
|
20
|
+
confidence: number;
|
|
21
|
+
}
|
|
22
|
+
export interface DocumentExtraction {
|
|
23
|
+
id: string;
|
|
24
|
+
fileId: string;
|
|
25
|
+
docType: DocumentType;
|
|
26
|
+
status: 'PROPOSED' | 'PARTIALLY_APPLIED' | 'APPLIED';
|
|
27
|
+
fields: ExtractionField[];
|
|
28
|
+
acceptedFields: string[];
|
|
29
|
+
shipmentId: string | null;
|
|
30
|
+
model: string;
|
|
31
|
+
costMicroUsd: string | null;
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
appliedAt: Date | null;
|
|
34
|
+
appliedBy: string | null;
|
|
35
|
+
}
|
|
36
|
+
export interface UseDocumentExtractionsResult {
|
|
37
|
+
extractions: DocumentExtraction[];
|
|
38
|
+
isLoading: boolean;
|
|
39
|
+
error: string | null;
|
|
40
|
+
extracting: boolean;
|
|
41
|
+
extractError: string | null;
|
|
42
|
+
extract: (fileId: string, docType: DocumentType) => Promise<DocumentExtraction | null>;
|
|
43
|
+
apply: (extractionId: string, accept: string[], corrections: Array<{
|
|
44
|
+
key: string;
|
|
45
|
+
value: string;
|
|
46
|
+
}> | null) => Promise<boolean>;
|
|
47
|
+
refetch: () => void;
|
|
48
|
+
}
|
|
49
|
+
export declare function useDocumentExtractions(fileId: string | undefined): UseDocumentExtractionsResult;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* useEntityDocuments — real document listing via wspace-files-svc.
|
|
3
3
|
*
|
|
4
4
|
* MoveTheWheels does NOT own a Document model. Documents attached to a vehicle,
|
|
5
|
-
* driver or
|
|
6
|
-
* federates into the same workspace gateway. We tag
|
|
7
|
-
* marqueue entity tags — `mtwEntityType` and
|
|
8
|
-
* here through `getFiles(filter:{ tags:[...] })`.
|
|
5
|
+
* driver, order, shipment or route live in the platform Files module
|
|
6
|
+
* (wspace-files-svc), which federates into the same workspace gateway. We tag
|
|
7
|
+
* each uploaded file with two marqueue entity tags — `mtwEntityType` and
|
|
8
|
+
* `mtwEntityId` — and list them back here through `getFiles(filter:{ tags:[...] })`.
|
|
9
9
|
*
|
|
10
10
|
* There is no upload UI here (out of scope): uploading/managing happens in the
|
|
11
11
|
* Files module, deep-linked from DocumentsCard. This hook is read-only.
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* logic question outside a schema-shape validator's reach (it operates on
|
|
27
27
|
* runtime variable values, not the query document). Flagged as follow-up.
|
|
28
28
|
*/
|
|
29
|
-
export type EntityDocumentType = 'vehicle' | 'driver' | 'order';
|
|
29
|
+
export type EntityDocumentType = 'vehicle' | 'driver' | 'order' | 'shipment' | 'route';
|
|
30
30
|
export interface EntityDocument {
|
|
31
31
|
id: string;
|
|
32
32
|
name: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createLucideIcon as e } from "../createLucideIcon.js";
|
|
2
|
+
//#region node_modules/lucide-react/dist/esm/icons/file-search.js
|
|
3
|
+
var t = e("FileSearch", [
|
|
4
|
+
["path", {
|
|
5
|
+
d: "M14 2v4a2 2 0 0 0 2 2h4",
|
|
6
|
+
key: "tnqrlb"
|
|
7
|
+
}],
|
|
8
|
+
["path", {
|
|
9
|
+
d: "M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",
|
|
10
|
+
key: "ms7g94"
|
|
11
|
+
}],
|
|
12
|
+
["path", {
|
|
13
|
+
d: "m9 18-1.5-1.5",
|
|
14
|
+
key: "1j6qii"
|
|
15
|
+
}],
|
|
16
|
+
["circle", {
|
|
17
|
+
cx: "5",
|
|
18
|
+
cy: "14",
|
|
19
|
+
r: "3",
|
|
20
|
+
key: "ufru5t"
|
|
21
|
+
}]
|
|
22
|
+
]);
|
|
23
|
+
//#endregion
|
|
24
|
+
export { t as FileSearch };
|