@burdenoff/microfe-movethewheels 2026.1108.4 → 2026.1109.1
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/generated/tracking-quality-operations.d.ts +1 -1
- package/dist/generated/wspace-operations.d.ts +91 -0
- package/dist/generated/wspace-types.d.ts +43263 -9122
- package/dist/hooks/useRoutes.js +91 -52
- package/dist/movethewheels/hooks/useRoutes.d.ts +3 -2
- package/dist/movethewheels/types/index.d.ts +21 -1
- package/dist/movethewheels/utils/carrierIntegrations.d.ts +12 -4
- package/dist/pages/IntegrationsPage.js +371 -323
- package/dist/pages/RouteDetailsPage.js +344 -274
- package/dist/utils/carrierIntegrations.js +52 -45
- package/dist/utils/formatters.js +6 -1
- package/package.json +1 -1
- package/src/generated/tracking-quality-operations.ts +1 -0
- package/src/generated/wspace-operations.ts +13 -12
- package/src/generated/wspace-types.ts +43741 -9123
- package/src/movethewheels/hooks/useRoutes.ts +37 -10
- package/src/movethewheels/pages/IntegrationsPage.tsx +59 -17
- package/src/movethewheels/pages/RouteDetailsPage.tsx +107 -10
- package/src/movethewheels/types/index.ts +27 -1
- package/src/movethewheels/utils/carrierIntegrations.ts +24 -7
- package/src/operations/wspace/movethewheels/fragments/core.graphql +15 -0
- package/src/operations/wspace/movethewheels/mutations/logistics.graphql +2 -2
package/dist/hooks/useRoutes.js
CHANGED
|
@@ -2,8 +2,46 @@ import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
|
2
2
|
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
3
|
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
4
4
|
//#region src/movethewheels/hooks/useRoutes.ts
|
|
5
|
-
var o = "\n
|
|
6
|
-
|
|
5
|
+
var o = "\n lastOptimization {\n strategy\n ranAt\n waypointCount\n distanceBeforeKm\n distanceAfterKm\n distanceSavedKm\n durationAfterMinutes\n feasible\n violations {\n code\n message\n sequence\n }\n }\n", s = "\n query ListRoutes($filter: RouteFilterInput, $pagination: PaginationInput) {\n routes(filter: $filter, pagination: $pagination) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n routesCount(filter: $filter)\n }\n", c = `
|
|
6
|
+
query GetRoute($id: ID!) {
|
|
7
|
+
route(id: $id) {
|
|
8
|
+
id
|
|
9
|
+
name
|
|
10
|
+
status
|
|
11
|
+
shipmentId
|
|
12
|
+
vehicleId
|
|
13
|
+
driverId
|
|
14
|
+
waypoints
|
|
15
|
+
estimatedDistance
|
|
16
|
+
estimatedDuration
|
|
17
|
+
fuelCost
|
|
18
|
+
actualDistance
|
|
19
|
+
actualDuration
|
|
20
|
+
createdAt
|
|
21
|
+
${o}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`, l = "\n mutation CreateRoute($input: CreateRouteInput!) {\n createRoute(input: $input) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", u = "\n mutation UpdateRoute($id: ID!, $input: UpdateRouteInput!) {\n updateRoute(id: $id, input: $input) {\n id\n name\n status\n shipmentId\n vehicleId\n driverId\n waypoints\n estimatedDistance\n estimatedDuration\n fuelCost\n actualDistance\n actualDuration\n createdAt\n }\n }\n", d = "\n mutation DeleteRoute($id: ID!) {\n deleteRoute(id: $id)\n }\n", f = `
|
|
25
|
+
mutation OptimizeRoute($id: ID!, $input: OptimizeRouteInput) {
|
|
26
|
+
optimizeRoute(id: $id, input: $input) {
|
|
27
|
+
id
|
|
28
|
+
name
|
|
29
|
+
status
|
|
30
|
+
shipmentId
|
|
31
|
+
vehicleId
|
|
32
|
+
driverId
|
|
33
|
+
waypoints
|
|
34
|
+
estimatedDistance
|
|
35
|
+
estimatedDuration
|
|
36
|
+
fuelCost
|
|
37
|
+
actualDistance
|
|
38
|
+
actualDuration
|
|
39
|
+
createdAt
|
|
40
|
+
${o}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
function p(e) {
|
|
7
45
|
switch (e) {
|
|
8
46
|
case "IN_PROGRESS": return "in_progress";
|
|
9
47
|
case "COMPLETED": return "completed";
|
|
@@ -11,7 +49,7 @@ function f(e) {
|
|
|
11
49
|
default: return "planned";
|
|
12
50
|
}
|
|
13
51
|
}
|
|
14
|
-
function
|
|
52
|
+
function m(e) {
|
|
15
53
|
if (e) switch (e) {
|
|
16
54
|
case "in_progress": return "IN_PROGRESS";
|
|
17
55
|
case "completed": return "COMPLETED";
|
|
@@ -19,7 +57,7 @@ function p(e) {
|
|
|
19
57
|
default: return "PLANNED";
|
|
20
58
|
}
|
|
21
59
|
}
|
|
22
|
-
function
|
|
60
|
+
function h(e) {
|
|
23
61
|
return Array.isArray(e) ? e.map((e, t) => {
|
|
24
62
|
let n = e ?? {}, r = n.address, i = r && typeof r == "object" ? r : {}, a = typeof r == "string" ? r : void 0;
|
|
25
63
|
return {
|
|
@@ -44,23 +82,24 @@ function m(e) {
|
|
|
44
82
|
};
|
|
45
83
|
}) : [];
|
|
46
84
|
}
|
|
47
|
-
function
|
|
85
|
+
function g(e) {
|
|
48
86
|
return {
|
|
49
87
|
id: e.id,
|
|
50
88
|
name: e.name,
|
|
51
89
|
driverId: e.driverId ?? void 0,
|
|
52
90
|
vehicleId: e.vehicleId ?? void 0,
|
|
53
|
-
status:
|
|
54
|
-
stops:
|
|
91
|
+
status: p(e.status),
|
|
92
|
+
stops: h(e.waypoints),
|
|
55
93
|
distance: e.actualDistance ?? e.estimatedDistance ?? 0,
|
|
56
94
|
estimatedDuration: e.estimatedDuration ?? 0,
|
|
57
95
|
fuelCost: e.fuelCost ?? void 0,
|
|
58
96
|
actualDuration: e.actualDuration ?? void 0,
|
|
59
|
-
optimized: void 0,
|
|
97
|
+
optimized: e.lastOptimization ? !0 : void 0,
|
|
98
|
+
lastOptimization: e.lastOptimization ?? void 0,
|
|
60
99
|
createdAt: new Date(e.createdAt)
|
|
61
100
|
};
|
|
62
101
|
}
|
|
63
|
-
function
|
|
102
|
+
function _() {
|
|
64
103
|
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: a, tenantId: o, currentUser: s } = e();
|
|
65
104
|
return i(() => ({
|
|
66
105
|
apiGatewayUrl: t,
|
|
@@ -78,23 +117,23 @@ function g() {
|
|
|
78
117
|
s?.id
|
|
79
118
|
]);
|
|
80
119
|
}
|
|
81
|
-
function
|
|
82
|
-
let { driverId: i, vehicleId:
|
|
120
|
+
function v(e = {}) {
|
|
121
|
+
let { driverId: i, vehicleId: o, status: c, search: p, limit: h = 20, offset: v = 0 } = e, y = _(), [b, x] = a([]), [S, C] = a(0), [w, T] = a(!1), [E, D] = a(!1), [O, k] = a(!1), [A, j] = a(null), M = n(async () => {
|
|
83
122
|
D(!0), j(null);
|
|
84
123
|
try {
|
|
85
|
-
let e = await t(y,
|
|
124
|
+
let e = await t(y, s, {
|
|
86
125
|
filter: {
|
|
87
126
|
driverId: i,
|
|
88
|
-
vehicleId:
|
|
89
|
-
status:
|
|
90
|
-
search:
|
|
127
|
+
vehicleId: o,
|
|
128
|
+
status: c ? m(c) : void 0,
|
|
129
|
+
search: p || void 0
|
|
91
130
|
},
|
|
92
131
|
pagination: {
|
|
93
|
-
limit:
|
|
132
|
+
limit: h,
|
|
94
133
|
offset: v
|
|
95
134
|
}
|
|
96
135
|
});
|
|
97
|
-
C(e.routesCount), T(v + e.routes.length < e.routesCount), x(e.routes.map(
|
|
136
|
+
C(e.routesCount), T(v + e.routes.length < e.routesCount), x(e.routes.map(g));
|
|
98
137
|
} catch (e) {
|
|
99
138
|
j(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load routes"));
|
|
100
139
|
} finally {
|
|
@@ -103,28 +142,28 @@ function _(e = {}) {
|
|
|
103
142
|
}, [
|
|
104
143
|
i,
|
|
105
144
|
y,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
145
|
+
p,
|
|
146
|
+
c,
|
|
147
|
+
o,
|
|
148
|
+
h,
|
|
110
149
|
v
|
|
111
150
|
]), N = n(async () => {
|
|
112
151
|
if (!w || E || O) return;
|
|
113
152
|
let e = v + b.length;
|
|
114
153
|
k(!0), j(null);
|
|
115
154
|
try {
|
|
116
|
-
let n = await t(y,
|
|
155
|
+
let n = await t(y, s, {
|
|
117
156
|
filter: {
|
|
118
157
|
driverId: i,
|
|
119
|
-
vehicleId:
|
|
120
|
-
status:
|
|
121
|
-
search:
|
|
158
|
+
vehicleId: o,
|
|
159
|
+
status: c ? m(c) : void 0,
|
|
160
|
+
search: p || void 0
|
|
122
161
|
},
|
|
123
162
|
pagination: {
|
|
124
|
-
limit:
|
|
163
|
+
limit: h,
|
|
125
164
|
offset: e
|
|
126
165
|
}
|
|
127
|
-
}), r = n.routes.map(
|
|
166
|
+
}), r = n.routes.map(g);
|
|
128
167
|
C(n.routesCount), T(e + r.length < n.routesCount), x((e) => {
|
|
129
168
|
let t = new Set(e.map((e) => e.id));
|
|
130
169
|
return [...e, ...r.filter((e) => !t.has(e.id))];
|
|
@@ -140,12 +179,12 @@ function _(e = {}) {
|
|
|
140
179
|
w,
|
|
141
180
|
E,
|
|
142
181
|
O,
|
|
143
|
-
|
|
182
|
+
h,
|
|
144
183
|
v,
|
|
145
184
|
b.length,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
185
|
+
p,
|
|
186
|
+
c,
|
|
187
|
+
o
|
|
149
188
|
]);
|
|
150
189
|
r(() => {
|
|
151
190
|
M();
|
|
@@ -153,9 +192,9 @@ function _(e = {}) {
|
|
|
153
192
|
let P = n(() => {
|
|
154
193
|
M();
|
|
155
194
|
}, [M]), F = n(async (e) => {
|
|
156
|
-
let n =
|
|
195
|
+
let n = g((await t(y, l, { input: {
|
|
157
196
|
name: e.name ?? `Route ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`,
|
|
158
|
-
status:
|
|
197
|
+
status: m(e.status),
|
|
159
198
|
shipmentId: void 0,
|
|
160
199
|
vehicleId: e.vehicleId,
|
|
161
200
|
driverId: e.driverId,
|
|
@@ -165,11 +204,11 @@ function _(e = {}) {
|
|
|
165
204
|
} })).createRoute);
|
|
166
205
|
return x((e) => [n, ...e]), n;
|
|
167
206
|
}, [y]), I = n(async (e, n) => {
|
|
168
|
-
let r =
|
|
207
|
+
let r = g((await t(y, u, {
|
|
169
208
|
id: e,
|
|
170
209
|
input: {
|
|
171
210
|
name: n.name,
|
|
172
|
-
status:
|
|
211
|
+
status: m(n.status),
|
|
173
212
|
shipmentId: void 0,
|
|
174
213
|
vehicleId: Object.prototype.hasOwnProperty.call(n, "vehicleId") ? n.vehicleId ?? null : void 0,
|
|
175
214
|
driverId: Object.prototype.hasOwnProperty.call(n, "driverId") ? n.driverId ?? null : void 0,
|
|
@@ -192,14 +231,14 @@ function _(e = {}) {
|
|
|
192
231
|
createRoute: F,
|
|
193
232
|
updateRoute: I,
|
|
194
233
|
deleteRoute: n(async (e) => {
|
|
195
|
-
await t(y,
|
|
234
|
+
await t(y, d, { id: e }), x((t) => t.filter((t) => t.id !== e));
|
|
196
235
|
}, [y]),
|
|
197
|
-
optimizeRoute: n(async (e) => {
|
|
198
|
-
let
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
};
|
|
202
|
-
return x((t) => t.map((t) => t.id === e ?
|
|
236
|
+
optimizeRoute: n(async (e, n) => {
|
|
237
|
+
let r = g((await t(y, f, {
|
|
238
|
+
id: e,
|
|
239
|
+
input: n ? { strategy: n } : void 0
|
|
240
|
+
})).optimizeRoute);
|
|
241
|
+
return x((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
203
242
|
}, [y]),
|
|
204
243
|
updateStopStatus: n(async (e, t, n) => {
|
|
205
244
|
let r = b.find((t) => t.id === e);
|
|
@@ -216,16 +255,16 @@ function _(e = {}) {
|
|
|
216
255
|
}, [b, I])
|
|
217
256
|
};
|
|
218
257
|
}
|
|
219
|
-
function
|
|
220
|
-
let i =
|
|
258
|
+
function y(e) {
|
|
259
|
+
let i = _(), [o, s] = a(null), [l, u] = a(!1), [d, f] = a(null), p = n(async () => {
|
|
221
260
|
if (!e) {
|
|
222
|
-
|
|
261
|
+
s(null);
|
|
223
262
|
return;
|
|
224
263
|
}
|
|
225
264
|
u(!0), f(null);
|
|
226
265
|
try {
|
|
227
|
-
let n = await t(i,
|
|
228
|
-
|
|
266
|
+
let n = await t(i, c, { id: e });
|
|
267
|
+
s(n.route ? g(n.route) : null);
|
|
229
268
|
} catch (e) {
|
|
230
269
|
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load route"));
|
|
231
270
|
} finally {
|
|
@@ -241,9 +280,9 @@ function v(e) {
|
|
|
241
280
|
refetch: () => void p()
|
|
242
281
|
};
|
|
243
282
|
}
|
|
244
|
-
var
|
|
245
|
-
function
|
|
246
|
-
let e =
|
|
283
|
+
var b = "\n query RouteStats {\n routeStats {\n total\n totalDistance\n totalDuration\n completed\n inProgress\n planned\n optimized\n }\n }\n";
|
|
284
|
+
function x() {
|
|
285
|
+
let e = _(), [n, i] = a({
|
|
247
286
|
totalRoutes: 0,
|
|
248
287
|
totalDistance: 0,
|
|
249
288
|
totalDuration: 0,
|
|
@@ -258,7 +297,7 @@ function b() {
|
|
|
258
297
|
(async () => {
|
|
259
298
|
s(!0), l(null);
|
|
260
299
|
try {
|
|
261
|
-
let n = (await t(e,
|
|
300
|
+
let n = (await t(e, b)).routeStats;
|
|
262
301
|
i({
|
|
263
302
|
totalRoutes: n.total,
|
|
264
303
|
totalDistance: n.totalDistance,
|
|
@@ -283,4 +322,4 @@ function b() {
|
|
|
283
322
|
};
|
|
284
323
|
}
|
|
285
324
|
//#endregion
|
|
286
|
-
export {
|
|
325
|
+
export { g as mapRoute, y as useRoute, x as useRouteStats, v as useRoutes };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Route, RouteStop } from '../types';
|
|
1
|
+
import { Route, RouteOptimizationStrategy, RouteOptimizationSummary, RouteStop } from '../types';
|
|
2
2
|
interface UseRoutesOptions {
|
|
3
3
|
driverId?: string;
|
|
4
4
|
vehicleId?: string;
|
|
@@ -24,7 +24,7 @@ interface UseRoutesResult {
|
|
|
24
24
|
driverId?: string | null;
|
|
25
25
|
}) => Promise<Route>;
|
|
26
26
|
deleteRoute: (id: string) => Promise<void>;
|
|
27
|
-
optimizeRoute: (routeId: string) => Promise<Route>;
|
|
27
|
+
optimizeRoute: (routeId: string, strategy?: RouteOptimizationStrategy) => Promise<Route>;
|
|
28
28
|
updateStopStatus: (routeId: string, stopId: string, status: RouteStop['status']) => Promise<Route>;
|
|
29
29
|
}
|
|
30
30
|
interface ApiRoute {
|
|
@@ -40,6 +40,7 @@ interface ApiRoute {
|
|
|
40
40
|
fuelCost?: number | null;
|
|
41
41
|
actualDistance?: number | null;
|
|
42
42
|
actualDuration?: number | null;
|
|
43
|
+
lastOptimization?: RouteOptimizationSummary | null;
|
|
43
44
|
createdAt: string;
|
|
44
45
|
}
|
|
45
46
|
export declare function mapRoute(route: ApiRoute): Route;
|
|
@@ -403,6 +403,24 @@ export interface TrafficCondition {
|
|
|
403
403
|
delay: number;
|
|
404
404
|
location: string;
|
|
405
405
|
}
|
|
406
|
+
export type RouteOptimizationStrategy = 'AUTO' | 'NEAREST_NEIGHBOUR' | 'TIME_WINDOW' | 'TWO_OPT';
|
|
407
|
+
export type RouteOptimizationViolationCode = 'WINDOW_MISSED' | 'OVER_CAPACITY' | 'OVER_DRIVER_HOURS' | 'NO_COORDINATES';
|
|
408
|
+
export interface RouteOptimizationViolation {
|
|
409
|
+
code: RouteOptimizationViolationCode;
|
|
410
|
+
message: string;
|
|
411
|
+
sequence?: number | null;
|
|
412
|
+
}
|
|
413
|
+
export interface RouteOptimizationSummary {
|
|
414
|
+
strategy: RouteOptimizationStrategy;
|
|
415
|
+
ranAt: string;
|
|
416
|
+
waypointCount: number;
|
|
417
|
+
distanceBeforeKm?: number | null;
|
|
418
|
+
distanceAfterKm?: number | null;
|
|
419
|
+
distanceSavedKm?: number | null;
|
|
420
|
+
durationAfterMinutes?: number | null;
|
|
421
|
+
feasible: boolean;
|
|
422
|
+
violations: RouteOptimizationViolation[];
|
|
423
|
+
}
|
|
406
424
|
export interface Route {
|
|
407
425
|
id: string;
|
|
408
426
|
name: string;
|
|
@@ -415,8 +433,10 @@ export interface Route {
|
|
|
415
433
|
/** Estimated fuel cost for the route (svc MtwRoute.fuelCost). */
|
|
416
434
|
fuelCost?: number;
|
|
417
435
|
actualDuration?: number;
|
|
418
|
-
/**
|
|
436
|
+
/** True once the backend reports a persisted optimization summary. */
|
|
419
437
|
optimized?: boolean;
|
|
438
|
+
/** Summary of the most recent optimizeRoute run, when one has run. */
|
|
439
|
+
lastOptimization?: RouteOptimizationSummary;
|
|
420
440
|
createdAt: Date;
|
|
421
441
|
}
|
|
422
442
|
export type TrackingAlertSeverity = 'low' | 'medium' | 'high' | 'critical';
|
|
@@ -2,7 +2,7 @@
|
|
|
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", "GEOTAB"];
|
|
5
|
+
export declare const SUPPORTED_PROVIDERS: readonly ["GENERIC_WEBHOOK", "SAMSARA", "MOTIVE", "GEOTAB"];
|
|
6
6
|
export type SupportedProvider = (typeof SUPPORTED_PROVIDERS)[number];
|
|
7
7
|
/** Providers the service pulls on a schedule instead of receiving webhooks. */
|
|
8
8
|
export declare const POLLED_PROVIDERS: ReadonlySet<string>;
|
|
@@ -18,11 +18,9 @@ export declare const ROADMAP_PROVIDERS: readonly [{
|
|
|
18
18
|
readonly id: "DESCARTES";
|
|
19
19
|
readonly label: "Descartes";
|
|
20
20
|
}];
|
|
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"];
|
|
23
21
|
export declare const INTEGRATION_STATUSES: readonly ["ACTIVE", "PAUSED", "DISABLED"];
|
|
24
22
|
export type IntegrationStatus = (typeof INTEGRATION_STATUSES)[number];
|
|
25
|
-
export type IntegrationProvider = 'GENERIC_WEBHOOK' | 'SAMSARA' | 'GEOTAB' | 'SHIPROCKET' | 'PROJECT44' | 'FOURKITES' | 'DESCARTES';
|
|
23
|
+
export type IntegrationProvider = 'GENERIC_WEBHOOK' | 'SAMSARA' | 'MOTIVE' | 'GEOTAB' | 'SHIPROCKET' | 'PROJECT44' | 'FOURKITES' | 'DESCARTES';
|
|
26
24
|
/** How each provider is named on the page. */
|
|
27
25
|
export declare function providerLabel(provider: IntegrationProvider): string;
|
|
28
26
|
/** Samsara webhook event types the service turns into tracking events. */
|
|
@@ -39,6 +37,16 @@ export declare const SAMSARA_EVENT_TYPES: readonly [{
|
|
|
39
37
|
readonly type: "GeofenceExit";
|
|
40
38
|
readonly becomes: "DEPARTED";
|
|
41
39
|
}];
|
|
40
|
+
/** Motive webhook actions the service turns into tracking events. */
|
|
41
|
+
export declare const MOTIVE_ACTIONS: readonly [{
|
|
42
|
+
readonly action: "vehicle_geofence_event";
|
|
43
|
+
readonly becomes: "Arrived on geofence entry, Departed on exit";
|
|
44
|
+
}, {
|
|
45
|
+
readonly action: "vehicle_location_updated";
|
|
46
|
+
readonly becomes: "In transit, with the reported position";
|
|
47
|
+
}];
|
|
48
|
+
/** Header Motive signs each delivery with (hex HMAC-SHA1 of the raw body); the gateway forwards it. */
|
|
49
|
+
export declare const MOTIVE_SIGNATURE_HEADER = "X-KT-Webhook-Signature";
|
|
42
50
|
/** Route or stop external id key the service reads the shipment reference from by default. */
|
|
43
51
|
export declare const DEFAULT_SAMSARA_SHIPMENT_KEY = "mtwShipment";
|
|
44
52
|
/** The service refuses Samsara secrets that decode to fewer bytes than this. */
|