@burdenoff/microfe-movethewheels 2026.1108.2 → 2026.1108.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/dist/components/DocumentsCard.js +183 -55
- package/dist/generated/tracking-quality-operations.d.ts +328 -1
- package/dist/generated/wspace-types.d.ts +1479 -10
- package/dist/hooks/useCarrierIntegrations.js +30 -29
- package/dist/hooks/useDocumentExtractions.js +100 -0
- package/dist/movethewheels/hooks/useCarrierIntegrations.d.ts +9 -3
- package/dist/movethewheels/hooks/useDocumentExtractions.d.ts +49 -0
- package/dist/movethewheels/hooks/useEntityDocuments.d.ts +5 -5
- package/dist/movethewheels/utils/carrierIntegrations.d.ts +90 -9
- package/dist/node_modules/lucide-react/dist/esm/icons/cloud-download.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/file-search.js +24 -0
- package/dist/pages/IntegrationsPage.js +551 -329
- package/dist/pages/MultiModalShipmentPage.js +125 -121
- package/dist/pages/RouteDetailsPage.js +212 -207
- package/dist/utils/carrierIntegrations.js +127 -30
- package/package.json +1 -1
- package/src/generated/tracking-quality-operations.ts +373 -0
- package/src/generated/wspace-types.ts +1672 -10
- package/src/movethewheels/components/DocumentsCard.tsx +174 -29
- package/src/movethewheels/hooks/useCarrierIntegrations.ts +19 -2
- package/src/movethewheels/hooks/useDocumentExtractions.ts +246 -0
- package/src/movethewheels/hooks/useEntityDocuments.ts +5 -5
- package/src/movethewheels/pages/IntegrationsPage.tsx +292 -36
- package/src/movethewheels/pages/MultiModalShipmentPage.tsx +2 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +2 -0
- package/src/movethewheels/utils/carrierIntegrations.ts +252 -10
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
2
|
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
-
import { CREATE_INTEGRATION_MUTATION as n, DELETE_INTEGRATION_MUTATION as r, INTEGRATION_COUNTS_QUERY as i, INTEGRATION_EVENTS_QUERY as a, LIST_INTEGRATIONS_QUERY as o,
|
|
4
|
-
import { useCallback as
|
|
3
|
+
import { CREATE_INTEGRATION_MUTATION as n, DELETE_INTEGRATION_MUTATION as r, INTEGRATION_COUNTS_QUERY as i, INTEGRATION_EVENTS_QUERY as a, LIST_INTEGRATIONS_QUERY as o, POLL_INTEGRATION_NOW_MUTATION as s, UPDATE_INTEGRATION_MUTATION as c } from "../utils/carrierIntegrations.js";
|
|
4
|
+
import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
5
5
|
//#region src/movethewheels/hooks/useCarrierIntegrations.ts
|
|
6
|
-
function
|
|
6
|
+
function m() {
|
|
7
7
|
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: i, tenantId: a, currentUser: o } = e();
|
|
8
|
-
return
|
|
8
|
+
return d(() => ({
|
|
9
9
|
apiGatewayUrl: t,
|
|
10
10
|
authToken: n,
|
|
11
11
|
workspaceToken: r,
|
|
@@ -21,11 +21,11 @@ function p() {
|
|
|
21
21
|
o?.id
|
|
22
22
|
]);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function h(e, t) {
|
|
25
25
|
return e instanceof Error ? e : Error(t);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
let n =
|
|
27
|
+
function g(e) {
|
|
28
|
+
let n = m(), { status: r, limit: i, offset: a } = e, [s, c] = p([]), [d, g] = p(0), [_, v] = p(!1), [y, b] = p(null), x = f(0), S = l(async () => {
|
|
29
29
|
let e = ++x.current;
|
|
30
30
|
v(!0), b(null);
|
|
31
31
|
try {
|
|
@@ -37,10 +37,10 @@ function h(e) {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
if (e !== x.current) return;
|
|
40
|
-
|
|
40
|
+
c(s.integrations), g(s.integrationsCount);
|
|
41
41
|
} catch (t) {
|
|
42
42
|
if (e !== x.current) return;
|
|
43
|
-
b(
|
|
43
|
+
b(h(t, "Failed to load integrations"));
|
|
44
44
|
} finally {
|
|
45
45
|
e === x.current && v(!1);
|
|
46
46
|
}
|
|
@@ -50,25 +50,25 @@ function h(e) {
|
|
|
50
50
|
i,
|
|
51
51
|
a
|
|
52
52
|
]);
|
|
53
|
-
|
|
53
|
+
u(() => (S(), () => {
|
|
54
54
|
x.current += 1;
|
|
55
55
|
}), [S]);
|
|
56
|
-
let C =
|
|
57
|
-
return
|
|
56
|
+
let C = f(S);
|
|
57
|
+
return u(() => {
|
|
58
58
|
C.current = S;
|
|
59
59
|
}, [S]), {
|
|
60
60
|
integrations: s,
|
|
61
|
-
total:
|
|
61
|
+
total: d,
|
|
62
62
|
isLoading: _,
|
|
63
63
|
error: y,
|
|
64
|
-
refetch:
|
|
64
|
+
refetch: l(() => C.current(), [])
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
let e =
|
|
67
|
+
function _() {
|
|
68
|
+
let e = m(), [n, r] = p({
|
|
69
69
|
all: 0,
|
|
70
70
|
active: 0
|
|
71
|
-
}), a =
|
|
71
|
+
}), a = f(0), o = l(async () => {
|
|
72
72
|
let n = ++a.current;
|
|
73
73
|
try {
|
|
74
74
|
let o = await t(e, i, {});
|
|
@@ -78,22 +78,22 @@ function g() {
|
|
|
78
78
|
});
|
|
79
79
|
} catch {}
|
|
80
80
|
}, [e]);
|
|
81
|
-
return
|
|
81
|
+
return u(() => (o(), () => {
|
|
82
82
|
a.current += 1;
|
|
83
83
|
}), [o]), {
|
|
84
84
|
...n,
|
|
85
85
|
refetch: o
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
let i =
|
|
90
|
-
return
|
|
88
|
+
function v(e, n, r = 20) {
|
|
89
|
+
let i = m(), [o, s] = p([]), [c, l] = p(!1), [d, f] = p(null);
|
|
90
|
+
return u(() => {
|
|
91
91
|
if (!e) {
|
|
92
92
|
s([]);
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
let n = !1;
|
|
96
|
-
return
|
|
96
|
+
return l(!0), f(null), t(i, a, {
|
|
97
97
|
integrationId: e,
|
|
98
98
|
pagination: {
|
|
99
99
|
limit: r,
|
|
@@ -102,9 +102,9 @@ function _(e, n, r = 20) {
|
|
|
102
102
|
}).then((e) => {
|
|
103
103
|
n || s(e.integrationEvents);
|
|
104
104
|
}).catch((e) => {
|
|
105
|
-
n || h(
|
|
105
|
+
n || f(h(e, "Failed to load deliveries"));
|
|
106
106
|
}).finally(() => {
|
|
107
|
-
n ||
|
|
107
|
+
n || l(!1);
|
|
108
108
|
}), () => {
|
|
109
109
|
n = !0;
|
|
110
110
|
};
|
|
@@ -119,23 +119,24 @@ function _(e, n, r = 20) {
|
|
|
119
119
|
error: d
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
let e =
|
|
124
|
-
return
|
|
122
|
+
function y() {
|
|
123
|
+
let e = m();
|
|
124
|
+
return d(() => ({
|
|
125
125
|
create: async (r) => (await t(e, n, { input: {
|
|
126
126
|
...r,
|
|
127
127
|
name: r.name.trim(),
|
|
128
128
|
status: "ACTIVE"
|
|
129
129
|
} }, "SINGLE_ATTEMPT")).createIntegration,
|
|
130
|
-
update: async (n, r) => (await t(e,
|
|
130
|
+
update: async (n, r) => (await t(e, c, {
|
|
131
131
|
id: n,
|
|
132
132
|
input: r.name === void 0 ? r : {
|
|
133
133
|
...r,
|
|
134
134
|
name: r.name.trim()
|
|
135
135
|
}
|
|
136
136
|
})).updateIntegration,
|
|
137
|
+
pollNow: async (n) => (await t(e, s, { id: n }, "SINGLE_ATTEMPT")).pollIntegrationNow,
|
|
137
138
|
remove: async (n) => (await t(e, r, { id: n })).deleteIntegration
|
|
138
139
|
}), [e]);
|
|
139
140
|
}
|
|
140
141
|
//#endregion
|
|
141
|
-
export {
|
|
142
|
+
export { y as useCarrierIntegrationActions, _ as useCarrierIntegrationCounts, v as useCarrierIntegrationEvents, g as useCarrierIntegrations };
|
|
@@ -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 };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { CarrierIntegration, CarrierIntegrationEvent, IntegrationStatus, SupportedProvider } from '../utils/carrierIntegrations';
|
|
1
|
+
import { CarrierIntegration, CarrierIntegrationEvent, GeotabConfig, IntegrationPollResult, IntegrationStatus, SupportedProvider } from '../utils/carrierIntegrations';
|
|
2
2
|
export interface CreateCarrierIntegrationInput {
|
|
3
3
|
provider: SupportedProvider;
|
|
4
4
|
name: string;
|
|
5
5
|
apiSecret: string;
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Provider settings (Samsara's shipment external id key, Geotab's server,
|
|
8
|
+
* database, user and rule mappings). Never secrets: a Geotab password goes
|
|
9
|
+
* in `apiSecret`, which the service stores encrypted.
|
|
10
|
+
*/
|
|
11
|
+
config?: Record<string, string> | GeotabConfig;
|
|
8
12
|
}
|
|
9
13
|
export interface UpdateCarrierIntegrationInput {
|
|
10
14
|
name?: string;
|
|
@@ -37,5 +41,7 @@ export declare function useCarrierIntegrationEvents(integrationId: string | null
|
|
|
37
41
|
export declare function useCarrierIntegrationActions(): {
|
|
38
42
|
create: (input: CreateCarrierIntegrationInput) => Promise<CarrierIntegration>;
|
|
39
43
|
update: (id: string, input: UpdateCarrierIntegrationInput) => Promise<CarrierIntegration>;
|
|
44
|
+
/** Polls a pulled feed (Geotab) now, outside its schedule. */
|
|
45
|
+
pollNow: (id: string) => Promise<IntegrationPollResult>;
|
|
40
46
|
remove: (id: string) => Promise<boolean>;
|
|
41
47
|
};
|
|
@@ -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;
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* Providers this page can connect. The service also ingests SHIPROCKET, which
|
|
3
3
|
* is set up from the Shiprocket carrier flow rather than here.
|
|
4
4
|
*/
|
|
5
|
-
export declare const SUPPORTED_PROVIDERS: readonly ["GENERIC_WEBHOOK", "SAMSARA"];
|
|
5
|
+
export declare const SUPPORTED_PROVIDERS: readonly ["GENERIC_WEBHOOK", "SAMSARA", "GEOTAB"];
|
|
6
6
|
export type SupportedProvider = (typeof SUPPORTED_PROVIDERS)[number];
|
|
7
|
+
/** Providers the service pulls on a schedule instead of receiving webhooks. */
|
|
8
|
+
export declare const POLLED_PROVIDERS: ReadonlySet<string>;
|
|
9
|
+
export declare function isPolledProvider(provider: string): boolean;
|
|
7
10
|
/** Named networks without an adapter yet; the service refuses the reserved ones. */
|
|
8
11
|
export declare const ROADMAP_PROVIDERS: readonly [{
|
|
9
12
|
readonly id: "PROJECT44";
|
|
@@ -15,11 +18,11 @@ export declare const ROADMAP_PROVIDERS: readonly [{
|
|
|
15
18
|
readonly id: "DESCARTES";
|
|
16
19
|
readonly label: "Descartes";
|
|
17
20
|
}];
|
|
18
|
-
/** ELD networks planned after Samsara (BOFF-10703 follow-ups); not in the schema yet. */
|
|
19
|
-
export declare const PLANNED_ELD_PROVIDERS: readonly ["Motive"
|
|
21
|
+
/** ELD networks planned after Samsara and Geotab (BOFF-10703 follow-ups); not in the schema yet. */
|
|
22
|
+
export declare const PLANNED_ELD_PROVIDERS: readonly ["Motive"];
|
|
20
23
|
export declare const INTEGRATION_STATUSES: readonly ["ACTIVE", "PAUSED", "DISABLED"];
|
|
21
24
|
export type IntegrationStatus = (typeof INTEGRATION_STATUSES)[number];
|
|
22
|
-
export type IntegrationProvider = 'GENERIC_WEBHOOK' | 'SAMSARA' | 'SHIPROCKET' | 'PROJECT44' | 'FOURKITES' | 'DESCARTES';
|
|
25
|
+
export type IntegrationProvider = 'GENERIC_WEBHOOK' | 'SAMSARA' | 'GEOTAB' | 'SHIPROCKET' | 'PROJECT44' | 'FOURKITES' | 'DESCARTES';
|
|
23
26
|
/** How each provider is named on the page. */
|
|
24
27
|
export declare function providerLabel(provider: IntegrationProvider): string;
|
|
25
28
|
/** Samsara webhook event types the service turns into tracking events. */
|
|
@@ -47,6 +50,55 @@ export declare const MIN_SAMSARA_SECRET_BYTES = 16;
|
|
|
47
50
|
export declare function samsaraSecretError(secret: string): string | null;
|
|
48
51
|
/** Returns an error message for an unusable external id key, or null. */
|
|
49
52
|
export declare function externalIdKeyError(key: string): string | null;
|
|
53
|
+
/** MyGeotab host used when the server field is left blank. */
|
|
54
|
+
export declare const DEFAULT_GEOTAB_SERVER = "my.geotab.com";
|
|
55
|
+
/** How often the service polls each Geotab feed. */
|
|
56
|
+
export declare const GEOTAB_POLL_INTERVAL_MINUTES = 5;
|
|
57
|
+
/** Tracking events a Geotab exception rule may be mapped to. */
|
|
58
|
+
export declare const GEOTAB_RULE_EVENT_TYPES: readonly ["PICKED_UP", "IN_TRANSIT", "ARRIVED", "DEPARTED", "OUT_FOR_DELIVERY", "DELIVERED", "FAILED", "RETURNED"];
|
|
59
|
+
export type GeotabRuleEventType = (typeof GEOTAB_RULE_EVENT_TYPES)[number];
|
|
60
|
+
/** The service accepts at most this many rule mappings per Geotab feed. */
|
|
61
|
+
export declare const MAX_GEOTAB_RULE_MAPPINGS = 50;
|
|
62
|
+
/** The service refuses MyGeotab passwords longer than this. */
|
|
63
|
+
export declare const MAX_GEOTAB_PASSWORD_LENGTH = 255;
|
|
64
|
+
export interface GeotabConnectionInput {
|
|
65
|
+
server: string;
|
|
66
|
+
database: string;
|
|
67
|
+
userName: string;
|
|
68
|
+
/** One `<rule id> = <EVENT_TYPE>` per line. */
|
|
69
|
+
ruleMappings: string;
|
|
70
|
+
locationUpdates: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface GeotabConfig {
|
|
73
|
+
server: string;
|
|
74
|
+
database: string;
|
|
75
|
+
userName: string;
|
|
76
|
+
ruleEvents: Record<string, GeotabRuleEventType>;
|
|
77
|
+
locationUpdates: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** The MyGeotab host the service will contact, or null when it is not a geotab.com host. */
|
|
80
|
+
export declare function normalizeGeotabServer(value: string): string | null;
|
|
81
|
+
/**
|
|
82
|
+
* Parses rule mappings typed one per line as `<rule id> = <EVENT_TYPE>` (a
|
|
83
|
+
* colon works too; blank lines and `#` comments are ignored).
|
|
84
|
+
*/
|
|
85
|
+
export declare function parseGeotabRuleMappings(text: string): {
|
|
86
|
+
ok: true;
|
|
87
|
+
ruleEvents: Record<string, GeotabRuleEventType>;
|
|
88
|
+
} | {
|
|
89
|
+
ok: false;
|
|
90
|
+
error: string;
|
|
91
|
+
};
|
|
92
|
+
/** Validates the Geotab connection fields and builds the config the service stores. */
|
|
93
|
+
export declare function buildGeotabConfig(input: GeotabConnectionInput): {
|
|
94
|
+
ok: true;
|
|
95
|
+
config: GeotabConfig;
|
|
96
|
+
} | {
|
|
97
|
+
ok: false;
|
|
98
|
+
error: string;
|
|
99
|
+
};
|
|
100
|
+
/** Returns an error message for an unusable MyGeotab password, or null. */
|
|
101
|
+
export declare function geotabPasswordError(password: string): string | null;
|
|
50
102
|
/** Headers Samsara signs each delivery with; the workspace gateway forwards both. */
|
|
51
103
|
export declare const SAMSARA_SIGNATURE_HEADERS: readonly ["X-Samsara-Signature", "X-Samsara-Timestamp"];
|
|
52
104
|
export type IntegrationEventStatus = 'RECEIVED' | 'ACCEPTED' | 'PARTIAL' | 'REJECTED' | 'DUPLICATE' | 'CONFLICT';
|
|
@@ -58,6 +110,28 @@ export declare const MIN_SECRET_LENGTH = 32;
|
|
|
58
110
|
export declare const SIGNATURE_HEADER = "x-webhook-signature";
|
|
59
111
|
/** Updates accepted in one delivery (a JSON array of at most this many objects). */
|
|
60
112
|
export declare const MAX_UPDATES_PER_DELIVERY = 5;
|
|
113
|
+
export type PollStatus = 'OK' | 'PARTIAL' | 'FAILED';
|
|
114
|
+
export type PollResultStatus = PollStatus | 'SKIPPED';
|
|
115
|
+
/** Latest poll of a pulled feed (Geotab); null for webhook feeds. */
|
|
116
|
+
export interface IntegrationPollStatus {
|
|
117
|
+
lastPollAt: string | null;
|
|
118
|
+
lastSuccessAt: string | null;
|
|
119
|
+
lastPollStatus: PollStatus | null;
|
|
120
|
+
lastPollError: string | null;
|
|
121
|
+
consecutiveFailures: number;
|
|
122
|
+
lastRecordsFetched: number;
|
|
123
|
+
lastUpdatesAccepted: number;
|
|
124
|
+
lastUpdatesSkipped: number;
|
|
125
|
+
}
|
|
126
|
+
export interface IntegrationPollResult {
|
|
127
|
+
integrationId: string;
|
|
128
|
+
status: PollResultStatus;
|
|
129
|
+
skippedReason: string | null;
|
|
130
|
+
recordsFetched: number;
|
|
131
|
+
updatesAccepted: number;
|
|
132
|
+
updatesSkipped: number;
|
|
133
|
+
error: string | null;
|
|
134
|
+
}
|
|
61
135
|
export interface CarrierIntegration {
|
|
62
136
|
id: string;
|
|
63
137
|
workspaceId: string;
|
|
@@ -69,6 +143,7 @@ export interface CarrierIntegration {
|
|
|
69
143
|
lastErrorMessage: string | null;
|
|
70
144
|
createdAt: string;
|
|
71
145
|
updatedAt: string;
|
|
146
|
+
pollStatus: IntegrationPollStatus | null;
|
|
72
147
|
}
|
|
73
148
|
export interface CarrierIntegrationEvent {
|
|
74
149
|
id: string;
|
|
@@ -81,11 +156,12 @@ export interface CarrierIntegrationEvent {
|
|
|
81
156
|
receivedAt: string;
|
|
82
157
|
processedAt: string | null;
|
|
83
158
|
}
|
|
84
|
-
export declare const LIST_INTEGRATIONS_QUERY = "\n query MtwCarrierIntegrations($filter: IntegrationFilterInput, $pagination: PaginationInput) {\n integrations(filter: $filter, pagination: $pagination) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n\n }\n integrationsCount(filter: $filter)\n }\n";
|
|
159
|
+
export declare const LIST_INTEGRATIONS_QUERY = "\n query MtwCarrierIntegrations($filter: IntegrationFilterInput, $pagination: PaginationInput) {\n integrations(filter: $filter, pagination: $pagination) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n pollStatus {\n lastPollAt\n lastSuccessAt\n lastPollStatus\n lastPollError\n consecutiveFailures\n lastRecordsFetched\n lastUpdatesAccepted\n lastUpdatesSkipped\n }\n\n }\n integrationsCount(filter: $filter)\n }\n";
|
|
85
160
|
export declare const INTEGRATION_COUNTS_QUERY = "\n query MtwCarrierIntegrationCounts {\n all: integrationsCount\n active: integrationsCount(filter: { status: ACTIVE })\n }\n";
|
|
86
161
|
export declare const INTEGRATION_EVENTS_QUERY = "\n query MtwCarrierIntegrationEvents($integrationId: ID, $pagination: PaginationInput) {\n integrationEvents(integrationId: $integrationId, pagination: $pagination) {\n id\n integrationId\n externalEventId\n shipmentId\n eventType\n status\n errorMessage\n receivedAt\n processedAt\n }\n }\n";
|
|
87
|
-
export declare const CREATE_INTEGRATION_MUTATION = "\n mutation CreateMtwCarrierIntegration($input: CreateIntegrationInput!) {\n createIntegration(input: $input) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n\n }\n }\n";
|
|
88
|
-
export declare const UPDATE_INTEGRATION_MUTATION = "\n mutation UpdateMtwCarrierIntegration($id: ID!, $input: UpdateIntegrationInput!) {\n updateIntegration(id: $id, input: $input) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n\n }\n }\n";
|
|
162
|
+
export declare const CREATE_INTEGRATION_MUTATION = "\n mutation CreateMtwCarrierIntegration($input: CreateIntegrationInput!) {\n createIntegration(input: $input) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n pollStatus {\n lastPollAt\n lastSuccessAt\n lastPollStatus\n lastPollError\n consecutiveFailures\n lastRecordsFetched\n lastUpdatesAccepted\n lastUpdatesSkipped\n }\n\n }\n }\n";
|
|
163
|
+
export declare const UPDATE_INTEGRATION_MUTATION = "\n mutation UpdateMtwCarrierIntegration($id: ID!, $input: UpdateIntegrationInput!) {\n updateIntegration(id: $id, input: $input) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n pollStatus {\n lastPollAt\n lastSuccessAt\n lastPollStatus\n lastPollError\n consecutiveFailures\n lastRecordsFetched\n lastUpdatesAccepted\n lastUpdatesSkipped\n }\n\n }\n }\n";
|
|
164
|
+
export declare const POLL_INTEGRATION_NOW_MUTATION = "\n mutation PollMtwCarrierIntegrationNow($id: ID!) {\n pollIntegrationNow(id: $id) {\n integrationId\n status\n skippedReason\n recordsFetched\n updatesAccepted\n updatesSkipped\n error\n }\n }\n";
|
|
89
165
|
export declare const DELETE_INTEGRATION_MUTATION = "\n mutation DeleteMtwCarrierIntegration($id: ID!) {\n deleteIntegration(id: $id)\n }\n";
|
|
90
166
|
/** Minimal source of randomness, so tests can supply a deterministic one. */
|
|
91
167
|
export interface RandomSource {
|
|
@@ -117,6 +193,11 @@ export declare function curlExample(url: string): string;
|
|
|
117
193
|
export declare function humanize(value: string): string;
|
|
118
194
|
export type BadgeTone = 'default' | 'secondary' | 'outline' | 'destructive';
|
|
119
195
|
export declare function integrationStatusTone(status: IntegrationStatus): BadgeTone;
|
|
196
|
+
export declare function pollStatusTone(status: PollStatus | null): BadgeTone;
|
|
197
|
+
/** One line describing the latest poll, for the integration card. */
|
|
198
|
+
export declare function pollStatusSummary(pollStatus: IntegrationPollStatus | null, format: (iso: string) => string): string;
|
|
199
|
+
/** The notice shown after "Poll now". */
|
|
200
|
+
export declare function pollResultMessage(name: string, result: IntegrationPollResult): string;
|
|
120
201
|
export declare function eventStatusTone(status: IntegrationEventStatus): BadgeTone;
|
|
121
|
-
/** What
|
|
122
|
-
export declare function statusExplanation(status: IntegrationStatus): string;
|
|
202
|
+
/** What each status means for a feed, shown next to the status control. */
|
|
203
|
+
export declare function statusExplanation(status: IntegrationStatus, provider?: IntegrationProvider): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createLucideIcon as e } from "../createLucideIcon.js";
|
|
2
|
+
//#region node_modules/lucide-react/dist/esm/icons/cloud-download.js
|
|
3
|
+
var t = e("CloudDownload", [
|
|
4
|
+
["path", {
|
|
5
|
+
d: "M12 13v8l-4-4",
|
|
6
|
+
key: "1f5nwf"
|
|
7
|
+
}],
|
|
8
|
+
["path", {
|
|
9
|
+
d: "m12 21 4-4",
|
|
10
|
+
key: "1lfcce"
|
|
11
|
+
}],
|
|
12
|
+
["path", {
|
|
13
|
+
d: "M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",
|
|
14
|
+
key: "ui1hmy"
|
|
15
|
+
}]
|
|
16
|
+
]);
|
|
17
|
+
//#endregion
|
|
18
|
+
export { t as CloudDownload };
|
|
@@ -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 };
|