@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,6 +1,10 @@
|
|
|
1
1
|
import { resolveGraphqlUrl as e } from "./graphqlClient.js";
|
|
2
2
|
//#region src/movethewheels/utils/carrierIntegrations.ts
|
|
3
|
-
var t = [
|
|
3
|
+
var t = new Set(["GEOTAB"]);
|
|
4
|
+
function n(e) {
|
|
5
|
+
return t.has(e);
|
|
6
|
+
}
|
|
7
|
+
var r = [
|
|
4
8
|
{
|
|
5
9
|
id: "PROJECT44",
|
|
6
10
|
label: "project44"
|
|
@@ -13,22 +17,23 @@ var t = [
|
|
|
13
17
|
id: "DESCARTES",
|
|
14
18
|
label: "Descartes"
|
|
15
19
|
}
|
|
16
|
-
],
|
|
20
|
+
], i = ["Motive"], a = [
|
|
17
21
|
"ACTIVE",
|
|
18
22
|
"PAUSED",
|
|
19
23
|
"DISABLED"
|
|
20
24
|
];
|
|
21
|
-
function
|
|
25
|
+
function o(e) {
|
|
22
26
|
switch (e) {
|
|
23
27
|
case "GENERIC_WEBHOOK": return "Signed webhook";
|
|
24
28
|
case "SAMSARA": return "Samsara";
|
|
29
|
+
case "GEOTAB": return "Geotab";
|
|
25
30
|
case "SHIPROCKET": return "Shiprocket";
|
|
26
31
|
case "PROJECT44": return "project44";
|
|
27
32
|
case "FOURKITES": return "FourKites";
|
|
28
33
|
case "DESCARTES": return "Descartes";
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
|
-
var
|
|
36
|
+
var s = [
|
|
32
37
|
{
|
|
33
38
|
type: "RouteStopArrival",
|
|
34
39
|
becomes: "ARRIVED"
|
|
@@ -45,18 +50,92 @@ var a = [
|
|
|
45
50
|
type: "GeofenceExit",
|
|
46
51
|
becomes: "DEPARTED"
|
|
47
52
|
}
|
|
48
|
-
],
|
|
49
|
-
function
|
|
53
|
+
], c = "mtwShipment";
|
|
54
|
+
function l(e) {
|
|
50
55
|
let t = e.trim(), n = "Paste the secret key exactly as Samsara shows it on the webhook page.";
|
|
51
56
|
if (!t || t.length % 4 != 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(t)) return n;
|
|
52
57
|
let r = t.endsWith("==") ? 2 : +!!t.endsWith("=");
|
|
53
58
|
return t.length / 4 * 3 - r < 16 ? n : null;
|
|
54
59
|
}
|
|
55
|
-
function
|
|
60
|
+
function u(e) {
|
|
56
61
|
let t = e.trim();
|
|
57
62
|
return t && (t.length > 64 || !/^[A-Za-z0-9_.-]+$/.test(t)) ? "Use letters, numbers, dots, dashes or underscores (up to 64) for the external ID key." : null;
|
|
58
63
|
}
|
|
59
|
-
var
|
|
64
|
+
var d = "my.geotab.com", f = [
|
|
65
|
+
"PICKED_UP",
|
|
66
|
+
"IN_TRANSIT",
|
|
67
|
+
"ARRIVED",
|
|
68
|
+
"DEPARTED",
|
|
69
|
+
"OUT_FOR_DELIVERY",
|
|
70
|
+
"DELIVERED",
|
|
71
|
+
"FAILED",
|
|
72
|
+
"RETURNED"
|
|
73
|
+
], p = /^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.geotab\.com$/, m = /^[A-Za-z0-9_.-]{1,64}$/;
|
|
74
|
+
function h(e) {
|
|
75
|
+
let t = e.trim().toLowerCase();
|
|
76
|
+
if (!t) return d;
|
|
77
|
+
let n = t.replace(/^https:\/\//, "").replace(/\/(apiv1\/?)?$/, "");
|
|
78
|
+
return p.test(n) ? n : null;
|
|
79
|
+
}
|
|
80
|
+
function g(e) {
|
|
81
|
+
let t = {}, n = e.split(/\r?\n/);
|
|
82
|
+
for (let [e, r] of n.entries()) {
|
|
83
|
+
let n = r.trim();
|
|
84
|
+
if (!n || n.startsWith("#")) continue;
|
|
85
|
+
let i = /^([^=:]+)[=:](.+)$/.exec(n), a = i?.[1]?.trim() ?? "", o = (i?.[2]?.trim() ?? "").toUpperCase().replace(/[\s-]+/g, "_");
|
|
86
|
+
if (!i || !m.test(a)) return {
|
|
87
|
+
ok: !1,
|
|
88
|
+
error: `Line ${e + 1}: write each mapping as <rule id> = <event>, e.g. RuleArriveId = ARRIVED.`
|
|
89
|
+
};
|
|
90
|
+
if (!f.includes(o)) return {
|
|
91
|
+
ok: !1,
|
|
92
|
+
error: `Line ${e + 1}: use one of ${f.join(", ")}.`
|
|
93
|
+
};
|
|
94
|
+
t[a] = o;
|
|
95
|
+
}
|
|
96
|
+
return Object.keys(t).length > 50 ? {
|
|
97
|
+
ok: !1,
|
|
98
|
+
error: "Map at most 50 rules."
|
|
99
|
+
} : {
|
|
100
|
+
ok: !0,
|
|
101
|
+
ruleEvents: t
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function _(e) {
|
|
105
|
+
let t = h(e.server);
|
|
106
|
+
if (!t) return {
|
|
107
|
+
ok: !1,
|
|
108
|
+
error: "Use your MyGeotab server, e.g. my.geotab.com."
|
|
109
|
+
};
|
|
110
|
+
let n = e.database.trim();
|
|
111
|
+
if (!n || n.length > 255) return {
|
|
112
|
+
ok: !1,
|
|
113
|
+
error: "Enter the MyGeotab database name."
|
|
114
|
+
};
|
|
115
|
+
let r = e.userName.trim();
|
|
116
|
+
if (!r || r.length > 255) return {
|
|
117
|
+
ok: !1,
|
|
118
|
+
error: "Enter the MyGeotab user name."
|
|
119
|
+
};
|
|
120
|
+
let i = g(e.ruleMappings);
|
|
121
|
+
return i.ok ? !e.locationUpdates && Object.keys(i.ruleEvents).length === 0 ? {
|
|
122
|
+
ok: !1,
|
|
123
|
+
error: "Turn on GPS position updates or map at least one exception rule, or nothing is read."
|
|
124
|
+
} : {
|
|
125
|
+
ok: !0,
|
|
126
|
+
config: {
|
|
127
|
+
server: t,
|
|
128
|
+
database: n,
|
|
129
|
+
userName: r,
|
|
130
|
+
ruleEvents: i.ruleEvents,
|
|
131
|
+
locationUpdates: e.locationUpdates
|
|
132
|
+
}
|
|
133
|
+
} : i;
|
|
134
|
+
}
|
|
135
|
+
function v(e) {
|
|
136
|
+
return e ? e.length > 255 ? "The password can be at most 255 characters." : null : "Enter the MyGeotab password.";
|
|
137
|
+
}
|
|
138
|
+
var y = ["X-Samsara-Signature", "X-Samsara-Timestamp"], b = [
|
|
60
139
|
"CREATED",
|
|
61
140
|
"PICKED_UP",
|
|
62
141
|
"IN_TRANSIT",
|
|
@@ -66,41 +145,41 @@ var l = ["X-Samsara-Signature", "X-Samsara-Timestamp"], u = [
|
|
|
66
145
|
"DELIVERED",
|
|
67
146
|
"FAILED",
|
|
68
147
|
"RETURNED"
|
|
69
|
-
],
|
|
148
|
+
], x = "x-webhook-signature", S = "\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", C = `
|
|
70
149
|
query MtwCarrierIntegrations($filter: IntegrationFilterInput, $pagination: PaginationInput) {
|
|
71
150
|
integrations(filter: $filter, pagination: $pagination) {
|
|
72
|
-
${
|
|
151
|
+
${S}
|
|
73
152
|
}
|
|
74
153
|
integrationsCount(filter: $filter)
|
|
75
154
|
}
|
|
76
|
-
`,
|
|
155
|
+
`, w = "\n query MtwCarrierIntegrationCounts {\n all: integrationsCount\n active: integrationsCount(filter: { status: ACTIVE })\n }\n", T = "\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", E = `
|
|
77
156
|
mutation CreateMtwCarrierIntegration($input: CreateIntegrationInput!) {
|
|
78
157
|
createIntegration(input: $input) {
|
|
79
|
-
${
|
|
158
|
+
${S}
|
|
80
159
|
}
|
|
81
160
|
}
|
|
82
|
-
`,
|
|
161
|
+
`, D = `
|
|
83
162
|
mutation UpdateMtwCarrierIntegration($id: ID!, $input: UpdateIntegrationInput!) {
|
|
84
163
|
updateIntegration(id: $id, input: $input) {
|
|
85
|
-
${
|
|
164
|
+
${S}
|
|
86
165
|
}
|
|
87
166
|
}
|
|
88
|
-
`,
|
|
89
|
-
function
|
|
167
|
+
`, O = "\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", k = "\n mutation DeleteMtwCarrierIntegration($id: ID!) {\n deleteIntegration(id: $id)\n }\n";
|
|
168
|
+
function A(e = globalThis.crypto) {
|
|
90
169
|
let t = e.getRandomValues(new Uint8Array(32));
|
|
91
170
|
return Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
92
171
|
}
|
|
93
|
-
function
|
|
172
|
+
function j(e) {
|
|
94
173
|
return e.trim().length < 32 ? "Use a signing secret of at least 32 characters." : null;
|
|
95
174
|
}
|
|
96
|
-
function
|
|
175
|
+
function M(e) {
|
|
97
176
|
let t = e.trim();
|
|
98
177
|
return t ? t.length > 120 ? "Keep the name under 120 characters." : null : "Give the integration a name.";
|
|
99
178
|
}
|
|
100
|
-
function
|
|
179
|
+
function N(t, n, r, i) {
|
|
101
180
|
return `${new URL(e(t), i).origin}/api/integrations/webhook/${n}/${r}`;
|
|
102
181
|
}
|
|
103
|
-
function
|
|
182
|
+
function P(e = /* @__PURE__ */ new Date()) {
|
|
104
183
|
return JSON.stringify({
|
|
105
184
|
externalEventId: "evt_0001",
|
|
106
185
|
trackingNumber: "YOUR-TRACKING-NUMBER",
|
|
@@ -114,31 +193,49 @@ function C(e = /* @__PURE__ */ new Date()) {
|
|
|
114
193
|
details: "Departed origin hub"
|
|
115
194
|
}, null, 2);
|
|
116
195
|
}
|
|
117
|
-
function
|
|
196
|
+
function F(e) {
|
|
118
197
|
return `'${e.split("'").join("'\\''")}'`;
|
|
119
198
|
}
|
|
120
|
-
function
|
|
199
|
+
function I(e) {
|
|
121
200
|
return [
|
|
122
201
|
"BODY='{\"externalEventId\":\"evt_0001\",\"trackingNumber\":\"YOUR-TRACKING-NUMBER\",\"eventType\":\"IN_TRANSIT\"}'",
|
|
123
202
|
"SIG=$(printf '%s' \"$BODY\" | openssl dgst -sha256 -hmac \"$MTW_WEBHOOK_SECRET\" -hex | sed 's/^.* //')",
|
|
124
|
-
`curl -X POST ${
|
|
203
|
+
`curl -X POST ${F(e)} \\`,
|
|
125
204
|
" -H 'Content-Type: application/json' \\",
|
|
126
|
-
` -H "${
|
|
205
|
+
` -H "${x}: sha256=$SIG" \\`,
|
|
127
206
|
" --data \"$BODY\""
|
|
128
207
|
].join("\n");
|
|
129
208
|
}
|
|
130
|
-
function
|
|
209
|
+
function L(e) {
|
|
131
210
|
let t = e.toLowerCase().split("_").join(" ");
|
|
132
211
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
133
212
|
}
|
|
134
|
-
function
|
|
213
|
+
function R(e) {
|
|
135
214
|
return e === "ACTIVE" ? "default" : e === "PAUSED" ? "secondary" : "outline";
|
|
136
215
|
}
|
|
137
|
-
function
|
|
216
|
+
function z(e) {
|
|
217
|
+
return e === "OK" ? "default" : e === "PARTIAL" ? "secondary" : e === "FAILED" ? "destructive" : "outline";
|
|
218
|
+
}
|
|
219
|
+
function B(e, t) {
|
|
220
|
+
if (!e?.lastPollAt) return "Not polled yet; the first poll runs within a few minutes.";
|
|
221
|
+
let n = t(e.lastPollAt);
|
|
222
|
+
if (e.lastPollStatus === "FAILED") {
|
|
223
|
+
let r = e.lastSuccessAt ? ` Last successful poll ${t(e.lastSuccessAt)}.` : "";
|
|
224
|
+
return `Last poll ${n} failed.${e.consecutiveFailures > 1 ? ` ${e.consecutiveFailures} failures in a row.` : ""}${r}`;
|
|
225
|
+
}
|
|
226
|
+
return `Last poll ${n}: ${e.lastRecordsFetched} records read, ${e.lastUpdatesAccepted} tracking events added, ${e.lastUpdatesSkipped} skipped (vehicle not matched or not on an in-progress route).`;
|
|
227
|
+
}
|
|
228
|
+
function V(e, t) {
|
|
229
|
+
if (t.status === "SKIPPED") return t.skippedReason === "POLL_IN_PROGRESS" ? `${e} is being polled right now; refresh in a moment.` : `${e} was not polled (${L(t.skippedReason ?? "skipped")}).`;
|
|
230
|
+
if (t.status === "FAILED") return `Polling ${e} failed: ${t.error ?? "unknown error"}`;
|
|
231
|
+
let n = t.status === "PARTIAL" ? " Some updates were refused; see the log." : "";
|
|
232
|
+
return `Polled ${e}: ${t.recordsFetched} records read, ${t.updatesAccepted} tracking events added.${n}`;
|
|
233
|
+
}
|
|
234
|
+
function H(e) {
|
|
138
235
|
return e === "ACCEPTED" ? "default" : e === "DUPLICATE" || e === "PARTIAL" || e === "RECEIVED" ? "secondary" : "destructive";
|
|
139
236
|
}
|
|
140
|
-
function
|
|
141
|
-
return e === "ACTIVE" ? "Signed deliveries are accepted and become tracking events." : e === "PAUSED" ? "Deliveries are refused with HTTP 423 so the sender can retry after you resume." : "Deliveries are refused with HTTP 410. Resume to accept them again.";
|
|
237
|
+
function U(e, t = "GENERIC_WEBHOOK") {
|
|
238
|
+
return n(t) ? e === "ACTIVE" ? "Polled every 5 minutes; new records become tracking events." : "Not polled. Resume to start reading the feed again from where it stopped." : e === "ACTIVE" ? "Signed deliveries are accepted and become tracking events." : e === "PAUSED" ? "Deliveries are refused with HTTP 423 so the sender can retry after you resume." : "Deliveries are refused with HTTP 410. Resume to accept them again.";
|
|
142
239
|
}
|
|
143
240
|
//#endregion
|
|
144
|
-
export {
|
|
241
|
+
export { E as CREATE_INTEGRATION_MUTATION, d as DEFAULT_GEOTAB_SERVER, c as DEFAULT_SAMSARA_SHIPMENT_KEY, k as DELETE_INTEGRATION_MUTATION, f as GEOTAB_RULE_EVENT_TYPES, w as INTEGRATION_COUNTS_QUERY, T as INTEGRATION_EVENTS_QUERY, a as INTEGRATION_STATUSES, C as LIST_INTEGRATIONS_QUERY, i as PLANNED_ELD_PROVIDERS, O as POLL_INTEGRATION_NOW_MUTATION, r as ROADMAP_PROVIDERS, s as SAMSARA_EVENT_TYPES, y as SAMSARA_SIGNATURE_HEADERS, x as SIGNATURE_HEADER, b as TRACKING_EVENT_TYPES, D as UPDATE_INTEGRATION_MUTATION, _ as buildGeotabConfig, I as curlExample, H as eventStatusTone, P as examplePayload, u as externalIdKeyError, A as generateSigningSecret, v as geotabPasswordError, L as humanize, M as integrationNameError, R as integrationStatusTone, n as isPolledProvider, V as pollResultMessage, B as pollStatusSummary, z as pollStatusTone, o as providerLabel, l as samsaraSecretError, j as signingSecretError, U as statusExplanation, N as webhookUrl };
|
package/package.json
CHANGED