@burdenoff/microfe-movethewheels 2026.1117.1 → 2026.1123.2
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/MoveTheWheelsRoot.js +149 -133
- package/dist/MoveTheWheelsRoutes.js +157 -139
- package/dist/components/EntityConversationsCard.js +145 -0
- package/dist/components/maps/MapCanvas.js +4 -3
- package/dist/events/rybbit.js +87 -0
- package/dist/generated/tracking-quality-operations.d.ts +342 -0
- package/dist/hooks/useEntityComments.js +111 -0
- package/dist/hooks/useFleet.js +394 -311
- package/dist/hooks/useInventory.js +378 -313
- package/dist/hooks/useMultiModalShipments.js +58 -53
- package/dist/hooks/useOrders.js +178 -158
- package/dist/hooks/useRoutes.js +146 -130
- package/dist/index.js +35 -34
- package/dist/movethewheels/components/EntityConversationsCard.d.ts +8 -0
- package/dist/movethewheels/events/rybbit.d.ts +27 -0
- package/dist/movethewheels/hooks/useEntityComments.d.ts +26 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +73 -1
- package/dist/movethewheels/hooks/useInventory.d.ts +19 -0
- package/dist/movethewheels/index.d.ts +1 -0
- package/dist/movethewheels/pages/DocumentsLibraryPage.d.ts +1 -0
- package/dist/movethewheels/pages/NotificationsCenterPage.d.ts +1 -0
- package/dist/movethewheels/types/index.d.ts +95 -2
- package/dist/node_modules/lucide-react/dist/esm/icons/check-check.js +10 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/layers.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/message-square.js +7 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/send.js +10 -0
- package/dist/pages/DocumentsLibraryPage.js +235 -0
- package/dist/pages/DriverDetailsPage.js +625 -351
- package/dist/pages/NotificationsCenterPage.js +310 -0
- package/dist/pages/OrderDetailsPage.js +48 -42
- package/dist/pages/RouteDetailsPage.js +257 -251
- package/dist/pages/TrackingPage.js +202 -196
- package/dist/pages/VehicleDetailsPage.js +616 -314
- package/dist/pages/WarehouseDetailsPage.js +539 -253
- package/dist/stories/ControlTowerWidgets.stories.d.ts +10 -0
- package/dist/stories/DataTable.stories.d.ts +15 -0
- package/dist/stories/FleetCards.stories.d.ts +9 -0
- package/dist/stories/OrderForms.stories.d.ts +8 -0
- package/dist/stories/RouteMap.stories.d.ts +7 -0
- package/dist/stories/ShipmentTimeline.stories.d.ts +6 -0
- package/package.json +1 -1
- package/src/generated/tracking-quality-operations.ts +407 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +16 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +17 -2
- package/src/movethewheels/components/EntityConversationsCard.tsx +143 -0
- package/src/movethewheels/components/maps/MapCanvas.tsx +3 -3
- package/src/movethewheels/events/__tests__/rybbit.test.ts +98 -0
- package/src/movethewheels/events/rybbit.ts +191 -0
- package/src/movethewheels/hooks/useEntityComments.ts +258 -0
- package/src/movethewheels/hooks/useFleet.ts +300 -5
- package/src/movethewheels/hooks/useInventory.ts +231 -3
- package/src/movethewheels/hooks/useMultiModalShipments.ts +8 -1
- package/src/movethewheels/hooks/useOrders.ts +19 -3
- package/src/movethewheels/hooks/useRoutes.ts +14 -2
- package/src/movethewheels/index.ts +1 -0
- package/src/movethewheels/pages/DocumentsLibraryPage.tsx +229 -0
- package/src/movethewheels/pages/DriverDetailsPage.tsx +250 -1
- package/src/movethewheels/pages/NotificationsCenterPage.tsx +331 -0
- package/src/movethewheels/pages/OrderDetailsPage.tsx +8 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +6 -0
- package/src/movethewheels/pages/TrackingPage.tsx +8 -0
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +255 -1
- package/src/movethewheels/pages/WarehouseDetailsPage.tsx +266 -2
- package/src/movethewheels/types/index.ts +103 -2
- package/src/stories/ControlTowerWidgets.stories.tsx +150 -0
- package/src/stories/DataTable.stories.tsx +94 -0
- package/src/stories/FleetCards.stories.tsx +77 -0
- package/src/stories/OrderForms.stories.tsx +84 -0
- package/src/stories/RouteMap.stories.tsx +43 -0
- package/src/stories/ShipmentTimeline.stories.tsx +128 -0
package/dist/hooks/useRoutes.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { emitRoutePlanned as t } from "../events/rybbit.js";
|
|
3
|
+
import { executeGraphQL as n } from "../utils/graphqlClient.js";
|
|
4
|
+
import { useCallback as r, useEffect as i, useMemo as a, useState as o } from "react";
|
|
5
|
+
import { useEventBus as s } from "@burdenoff/fe-libs/shared/events";
|
|
4
6
|
// src/movethewheels/hooks/useRoutes.ts
|
|
5
|
-
var
|
|
7
|
+
var c = "\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", l = "\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", u = `
|
|
6
8
|
query GetRoute($id: ID!) {
|
|
7
9
|
route(id: $id) {
|
|
8
10
|
id
|
|
@@ -18,10 +20,10 @@ var o = "\n lastOptimization {\n strategy\n ranAt\n waypointCount\n
|
|
|
18
20
|
actualDistance
|
|
19
21
|
actualDuration
|
|
20
22
|
createdAt
|
|
21
|
-
${
|
|
23
|
+
${c}
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
|
-
`,
|
|
26
|
+
`, d = "\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", f = "\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", p = "\n mutation DeleteRoute($id: ID!) {\n deleteRoute(id: $id)\n }\n", m = `
|
|
25
27
|
mutation OptimizeRoute($id: ID!, $input: OptimizeRouteInput) {
|
|
26
28
|
optimizeRoute(id: $id, input: $input) {
|
|
27
29
|
id
|
|
@@ -37,11 +39,11 @@ var o = "\n lastOptimization {\n strategy\n ranAt\n waypointCount\n
|
|
|
37
39
|
actualDistance
|
|
38
40
|
actualDuration
|
|
39
41
|
createdAt
|
|
40
|
-
${
|
|
42
|
+
${c}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
`;
|
|
44
|
-
function
|
|
46
|
+
function h(e) {
|
|
45
47
|
switch (e) {
|
|
46
48
|
case "IN_PROGRESS": return "in_progress";
|
|
47
49
|
case "COMPLETED": return "completed";
|
|
@@ -49,7 +51,7 @@ function p(e) {
|
|
|
49
51
|
default: return "planned";
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
|
-
function
|
|
54
|
+
function g(e) {
|
|
53
55
|
if (e) switch (e) {
|
|
54
56
|
case "in_progress": return "IN_PROGRESS";
|
|
55
57
|
case "completed": return "COMPLETED";
|
|
@@ -57,7 +59,7 @@ function m(e) {
|
|
|
57
59
|
default: return "PLANNED";
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
function
|
|
62
|
+
function _(e) {
|
|
61
63
|
return Array.isArray(e) ? e.map((e, t) => {
|
|
62
64
|
let n = e ?? {}, r = n.address, i = r && typeof r == "object" ? r : {}, a = typeof r == "string" ? r : void 0;
|
|
63
65
|
return {
|
|
@@ -82,14 +84,14 @@ function h(e) {
|
|
|
82
84
|
};
|
|
83
85
|
}) : [];
|
|
84
86
|
}
|
|
85
|
-
function
|
|
87
|
+
function v(e) {
|
|
86
88
|
return {
|
|
87
89
|
id: e.id,
|
|
88
90
|
name: e.name,
|
|
89
91
|
driverId: e.driverId ?? void 0,
|
|
90
92
|
vehicleId: e.vehicleId ?? void 0,
|
|
91
|
-
status:
|
|
92
|
-
stops:
|
|
93
|
+
status: h(e.status),
|
|
94
|
+
stops: _(e.waypoints),
|
|
93
95
|
distance: e.actualDistance ?? e.estimatedDistance ?? 0,
|
|
94
96
|
estimatedDuration: e.estimatedDuration ?? 0,
|
|
95
97
|
fuelCost: e.fuelCost ?? void 0,
|
|
@@ -99,102 +101,102 @@ function g(e) {
|
|
|
99
101
|
createdAt: new Date(e.createdAt)
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
|
-
function
|
|
103
|
-
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId:
|
|
104
|
-
return
|
|
104
|
+
function y() {
|
|
105
|
+
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: i, tenantId: o, currentUser: s } = e();
|
|
106
|
+
return a(() => ({
|
|
105
107
|
apiGatewayUrl: t,
|
|
106
108
|
authToken: n,
|
|
107
109
|
workspaceToken: r,
|
|
108
|
-
workspaceId:
|
|
110
|
+
workspaceId: i,
|
|
109
111
|
tenantId: o,
|
|
110
112
|
actorId: s?.id
|
|
111
113
|
}), [
|
|
112
114
|
t,
|
|
113
115
|
n,
|
|
114
116
|
r,
|
|
115
|
-
|
|
117
|
+
i,
|
|
116
118
|
o,
|
|
117
119
|
s?.id
|
|
118
120
|
]);
|
|
119
121
|
}
|
|
120
|
-
function
|
|
121
|
-
let { driverId:
|
|
122
|
-
|
|
122
|
+
function b(e = {}) {
|
|
123
|
+
let { driverId: a, vehicleId: c, status: u, search: h, limit: _ = 20, offset: b = 0 } = e, x = y(), S = s(), C = x.workspaceId, [w, T] = o([]), [E, D] = o(0), [O, k] = o(!1), [A, j] = o(!1), [M, N] = o(!1), [P, F] = o(null), I = r(async () => {
|
|
124
|
+
j(!0), F(null);
|
|
123
125
|
try {
|
|
124
|
-
let e = await
|
|
126
|
+
let e = await n(x, l, {
|
|
125
127
|
filter: {
|
|
126
|
-
driverId:
|
|
127
|
-
vehicleId:
|
|
128
|
-
status:
|
|
129
|
-
search:
|
|
128
|
+
driverId: a,
|
|
129
|
+
vehicleId: c,
|
|
130
|
+
status: u ? g(u) : void 0,
|
|
131
|
+
search: h || void 0
|
|
130
132
|
},
|
|
131
133
|
pagination: {
|
|
132
|
-
limit:
|
|
133
|
-
offset:
|
|
134
|
+
limit: _,
|
|
135
|
+
offset: b
|
|
134
136
|
}
|
|
135
137
|
});
|
|
136
|
-
|
|
138
|
+
D(e.routesCount), k(b + e.routes.length < e.routesCount), T(e.routes.map(v));
|
|
137
139
|
} catch (e) {
|
|
138
|
-
|
|
140
|
+
F(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load routes"));
|
|
139
141
|
} finally {
|
|
140
|
-
|
|
142
|
+
j(!1);
|
|
141
143
|
}
|
|
142
144
|
}, [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
p,
|
|
146
|
-
c,
|
|
147
|
-
o,
|
|
145
|
+
a,
|
|
146
|
+
x,
|
|
148
147
|
h,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
u,
|
|
149
|
+
c,
|
|
150
|
+
_,
|
|
151
|
+
b
|
|
152
|
+
]), L = r(async () => {
|
|
153
|
+
if (!O || A || M) return;
|
|
154
|
+
let e = b + w.length;
|
|
155
|
+
N(!0), F(null);
|
|
154
156
|
try {
|
|
155
|
-
let
|
|
157
|
+
let t = await n(x, l, {
|
|
156
158
|
filter: {
|
|
157
|
-
driverId:
|
|
158
|
-
vehicleId:
|
|
159
|
-
status:
|
|
160
|
-
search:
|
|
159
|
+
driverId: a,
|
|
160
|
+
vehicleId: c,
|
|
161
|
+
status: u ? g(u) : void 0,
|
|
162
|
+
search: h || void 0
|
|
161
163
|
},
|
|
162
164
|
pagination: {
|
|
163
|
-
limit:
|
|
165
|
+
limit: _,
|
|
164
166
|
offset: e
|
|
165
167
|
}
|
|
166
|
-
}), r =
|
|
167
|
-
|
|
168
|
+
}), r = t.routes.map(v);
|
|
169
|
+
D(t.routesCount), k(e + r.length < t.routesCount), T((e) => {
|
|
168
170
|
let t = new Set(e.map((e) => e.id));
|
|
169
171
|
return [...e, ...r.filter((e) => !t.has(e.id))];
|
|
170
172
|
});
|
|
171
173
|
} catch (e) {
|
|
172
|
-
|
|
174
|
+
F(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more routes"));
|
|
173
175
|
} finally {
|
|
174
|
-
|
|
176
|
+
N(!1);
|
|
175
177
|
}
|
|
176
178
|
}, [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
w,
|
|
180
|
-
E,
|
|
179
|
+
a,
|
|
180
|
+
x,
|
|
181
181
|
O,
|
|
182
|
+
A,
|
|
183
|
+
M,
|
|
184
|
+
_,
|
|
185
|
+
b,
|
|
186
|
+
w.length,
|
|
182
187
|
h,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
p,
|
|
186
|
-
c,
|
|
187
|
-
o
|
|
188
|
+
u,
|
|
189
|
+
c
|
|
188
190
|
]);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}, [
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
}, [
|
|
195
|
-
let
|
|
191
|
+
i(() => {
|
|
192
|
+
I();
|
|
193
|
+
}, [I]);
|
|
194
|
+
let R = r(() => {
|
|
195
|
+
I();
|
|
196
|
+
}, [I]), z = r(async (e) => {
|
|
197
|
+
let r = v((await n(x, d, { input: {
|
|
196
198
|
name: e.name ?? `Route ${(/* @__PURE__ */ new Date()).toLocaleDateString()}`,
|
|
197
|
-
status:
|
|
199
|
+
status: g(e.status),
|
|
198
200
|
shipmentId: void 0,
|
|
199
201
|
vehicleId: e.vehicleId,
|
|
200
202
|
driverId: e.driverId,
|
|
@@ -202,86 +204,100 @@ function v(e = {}) {
|
|
|
202
204
|
estimatedDuration: e.estimatedDuration,
|
|
203
205
|
fuelCost: e.fuelCost
|
|
204
206
|
} })).createRoute);
|
|
205
|
-
return
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
return T((e) => [r, ...e]), t(S, r.id, C, {
|
|
208
|
+
optimized: !1,
|
|
209
|
+
stopCount: r.stops.length
|
|
210
|
+
}), r;
|
|
211
|
+
}, [
|
|
212
|
+
S,
|
|
213
|
+
x,
|
|
214
|
+
C
|
|
215
|
+
]), B = r(async (e, t) => {
|
|
216
|
+
let r = v((await n(x, f, {
|
|
208
217
|
id: e,
|
|
209
218
|
input: {
|
|
210
|
-
name:
|
|
211
|
-
status:
|
|
219
|
+
name: t.name,
|
|
220
|
+
status: g(t.status),
|
|
212
221
|
shipmentId: void 0,
|
|
213
|
-
vehicleId: Object.prototype.hasOwnProperty.call(
|
|
214
|
-
driverId: Object.prototype.hasOwnProperty.call(
|
|
215
|
-
waypoints:
|
|
216
|
-
estimatedDuration:
|
|
217
|
-
fuelCost:
|
|
222
|
+
vehicleId: Object.prototype.hasOwnProperty.call(t, "vehicleId") ? t.vehicleId ?? null : void 0,
|
|
223
|
+
driverId: Object.prototype.hasOwnProperty.call(t, "driverId") ? t.driverId ?? null : void 0,
|
|
224
|
+
waypoints: t.stops,
|
|
225
|
+
estimatedDuration: t.estimatedDuration,
|
|
226
|
+
fuelCost: t.fuelCost
|
|
218
227
|
}
|
|
219
228
|
})).updateRoute);
|
|
220
|
-
return
|
|
221
|
-
}, [
|
|
229
|
+
return T((t) => t.map((t) => t.id === e ? r : t)), r;
|
|
230
|
+
}, [x]);
|
|
222
231
|
return {
|
|
223
|
-
routes:
|
|
224
|
-
totalRoutes:
|
|
225
|
-
hasMore:
|
|
226
|
-
isLoading:
|
|
227
|
-
isLoadingMore:
|
|
228
|
-
error:
|
|
229
|
-
refetch:
|
|
230
|
-
loadMore:
|
|
231
|
-
createRoute:
|
|
232
|
-
updateRoute:
|
|
233
|
-
deleteRoute:
|
|
234
|
-
await
|
|
235
|
-
}, [
|
|
236
|
-
optimizeRoute:
|
|
237
|
-
let
|
|
232
|
+
routes: w,
|
|
233
|
+
totalRoutes: E,
|
|
234
|
+
hasMore: O,
|
|
235
|
+
isLoading: A,
|
|
236
|
+
isLoadingMore: M,
|
|
237
|
+
error: P,
|
|
238
|
+
refetch: R,
|
|
239
|
+
loadMore: L,
|
|
240
|
+
createRoute: z,
|
|
241
|
+
updateRoute: B,
|
|
242
|
+
deleteRoute: r(async (e) => {
|
|
243
|
+
await n(x, p, { id: e }), T((t) => t.filter((t) => t.id !== e));
|
|
244
|
+
}, [x]),
|
|
245
|
+
optimizeRoute: r(async (e, r) => {
|
|
246
|
+
let i = v((await n(x, m, {
|
|
238
247
|
id: e,
|
|
239
|
-
input:
|
|
248
|
+
input: r ? { strategy: r } : void 0
|
|
240
249
|
})).optimizeRoute);
|
|
241
|
-
return
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
250
|
+
return T((t) => t.map((t) => t.id === e ? i : t)), t(S, i.id, C, {
|
|
251
|
+
optimized: !0,
|
|
252
|
+
stopCount: i.stops.length
|
|
253
|
+
}), i;
|
|
254
|
+
}, [
|
|
255
|
+
S,
|
|
256
|
+
x,
|
|
257
|
+
C
|
|
258
|
+
]),
|
|
259
|
+
updateStopStatus: r(async (e, t, n) => {
|
|
260
|
+
let r = w.find((t) => t.id === e);
|
|
245
261
|
if (!r) throw Error("Route not found");
|
|
246
262
|
let i = r.stops.map((e) => e.id === t ? {
|
|
247
263
|
...e,
|
|
248
264
|
status: n,
|
|
249
265
|
actualTime: n === "completed" ? /* @__PURE__ */ new Date() : e.actualTime
|
|
250
266
|
} : e);
|
|
251
|
-
return
|
|
267
|
+
return B(e, {
|
|
252
268
|
stops: i,
|
|
253
269
|
status: i.every((e) => e.status === "completed") ? "completed" : r.status
|
|
254
270
|
});
|
|
255
|
-
}, [
|
|
271
|
+
}, [w, B])
|
|
256
272
|
};
|
|
257
273
|
}
|
|
258
|
-
function
|
|
259
|
-
let
|
|
274
|
+
function x(e) {
|
|
275
|
+
let t = y(), [a, s] = o(null), [c, l] = o(!1), [d, f] = o(null), p = r(async () => {
|
|
260
276
|
if (!e) s(null);
|
|
261
277
|
else {
|
|
262
|
-
|
|
278
|
+
l(!0), f(null);
|
|
263
279
|
try {
|
|
264
|
-
let
|
|
265
|
-
s(
|
|
280
|
+
let r = await n(t, u, { id: e });
|
|
281
|
+
s(r.route ? v(r.route) : null);
|
|
266
282
|
} catch (e) {
|
|
267
283
|
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load route"));
|
|
268
284
|
} finally {
|
|
269
|
-
|
|
285
|
+
l(!1);
|
|
270
286
|
}
|
|
271
287
|
}
|
|
272
|
-
}, [
|
|
273
|
-
return
|
|
288
|
+
}, [t, e]);
|
|
289
|
+
return i(() => {
|
|
274
290
|
p();
|
|
275
291
|
}, [p]), {
|
|
276
|
-
route:
|
|
277
|
-
isLoading:
|
|
292
|
+
route: a,
|
|
293
|
+
isLoading: c,
|
|
278
294
|
error: d,
|
|
279
295
|
refetch: () => void p()
|
|
280
296
|
};
|
|
281
297
|
}
|
|
282
|
-
var
|
|
283
|
-
function
|
|
284
|
-
let e =
|
|
298
|
+
var S = "\n query RouteStats {\n routeStats {\n total\n totalDistance\n totalDuration\n completed\n inProgress\n planned\n optimized\n }\n }\n";
|
|
299
|
+
function C() {
|
|
300
|
+
let e = y(), [t, r] = o({
|
|
285
301
|
totalRoutes: 0,
|
|
286
302
|
totalDistance: 0,
|
|
287
303
|
totalDuration: 0,
|
|
@@ -291,22 +307,22 @@ function x() {
|
|
|
291
307
|
inProgressRoutes: 0,
|
|
292
308
|
plannedRoutes: 0,
|
|
293
309
|
optimizedRoutes: 0
|
|
294
|
-
}), [
|
|
295
|
-
return
|
|
310
|
+
}), [a, s] = o(!1), [c, l] = o(null);
|
|
311
|
+
return i(() => {
|
|
296
312
|
(async () => {
|
|
297
313
|
s(!0), l(null);
|
|
298
314
|
try {
|
|
299
|
-
let
|
|
300
|
-
|
|
301
|
-
totalRoutes:
|
|
302
|
-
totalDistance:
|
|
303
|
-
totalDuration:
|
|
304
|
-
avgDistance:
|
|
305
|
-
avgDuration:
|
|
306
|
-
completedRoutes:
|
|
307
|
-
inProgressRoutes:
|
|
308
|
-
plannedRoutes:
|
|
309
|
-
optimizedRoutes:
|
|
315
|
+
let t = (await n(e, S)).routeStats;
|
|
316
|
+
r({
|
|
317
|
+
totalRoutes: t.total,
|
|
318
|
+
totalDistance: t.totalDistance,
|
|
319
|
+
totalDuration: t.totalDuration,
|
|
320
|
+
avgDistance: t.total > 0 ? t.totalDistance / t.total : 0,
|
|
321
|
+
avgDuration: t.total > 0 ? t.totalDuration / t.total : 0,
|
|
322
|
+
completedRoutes: t.completed,
|
|
323
|
+
inProgressRoutes: t.inProgress,
|
|
324
|
+
plannedRoutes: t.planned,
|
|
325
|
+
optimizedRoutes: t.optimized
|
|
310
326
|
});
|
|
311
327
|
} catch (e) {
|
|
312
328
|
l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load route stats"));
|
|
@@ -315,9 +331,9 @@ function x() {
|
|
|
315
331
|
}
|
|
316
332
|
})();
|
|
317
333
|
}, [e]), {
|
|
318
|
-
stats:
|
|
319
|
-
isLoading:
|
|
334
|
+
stats: t,
|
|
335
|
+
isLoading: a,
|
|
320
336
|
error: c
|
|
321
337
|
};
|
|
322
338
|
}
|
|
323
|
-
export {
|
|
339
|
+
export { v as mapRoute, x as useRoute, C as useRouteStats, b as useRoutes };
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { MoveTheWheelsRoot as e } from "./MoveTheWheelsRoot.js";
|
|
2
2
|
import { useTr as t } from "./shared/hooks/useTr.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
3
|
+
import { useMoveTheWheels as n, useMoveTheWheelsNavigate as r } from "./providers/MoveTheWheelsProvider.js";
|
|
4
|
+
import { useRoute as i, useRouteStats as a, useRoutes as o } from "./hooks/useRoutes.js";
|
|
5
|
+
import { useOrder as s, useOrderStats as c, useOrders as l } from "./hooks/useOrders.js";
|
|
6
|
+
import { useDriver as u, useDriverStatusCounts as d, useDrivers as f, useFleet as p, useFleetStats as m, useVehicle as h, useVehicleDrivers as g, useVehicles as _ } from "./hooks/useFleet.js";
|
|
7
|
+
import { useInventory as v, useInventoryStats as y, useInventoryTransactions as b, useProduct as x, useProductStockLevels as S, useProducts as C, useStockActions as w, useWarehouse as T, useWarehouses as E } from "./hooks/useInventory.js";
|
|
8
|
+
import { useCustomer as D, useCustomerStats as O, useCustomers as k } from "./hooks/useCustomers.js";
|
|
9
|
+
import { useAnalytics as A, useDashboardMetrics as j, useEmissionsSummary as M, useFinanceMetrics as N, useFleetAnalytics as P, useOrderAnalytics as F, usePerformanceAnalytics as I, useRevenueAnalytics as L } from "./hooks/useAnalytics.js";
|
|
10
|
+
import { useDriverTracking as R, useGeofence as z, useLiveTracking as B, useOrderTracking as V, useTracking as H, useTrackingAlerts as U, useVehicleTracking as W } from "./hooks/useTracking.js";
|
|
11
|
+
import { useEntityDocuments as G } from "./hooks/useEntityDocuments.js";
|
|
12
|
+
import { useMyDeliveryDay as K, useOnlineStatus as q } from "./hooks/useDriverDay.js";
|
|
13
|
+
import { useCaptureEpod as J, useEpod as Y, useEpodPhotoUpload as X, useEpodPhotoUrl as Z, useMyPendingEpodDeliveryJobs as Q } from "./hooks/useEpod.js";
|
|
14
14
|
import { useMoveTheWheelsStore as $ } from "./store/movethewheelsStore.js";
|
|
15
|
-
import {
|
|
15
|
+
import { MOVETHEWHEELS_RYBBIT_EVENT_ALLOWLIST as ee } from "./events/rybbit.js";
|
|
16
|
+
import { useSandboxAssistantTransport as te } from "./services/createSandboxAssistantTransport.js";
|
|
16
17
|
import "./hooks/index.js";
|
|
17
|
-
import { Avatar as
|
|
18
|
-
import { EmptyState as
|
|
19
|
-
import { chartTokens as
|
|
20
|
-
import { Sparkline as
|
|
21
|
-
import { MetricCard as
|
|
22
|
-
import { GlassPanel as
|
|
23
|
-
import { ChartEmpty as
|
|
24
|
-
import { TrendChart as
|
|
25
|
-
import { VolumeBar as
|
|
26
|
-
import { StatusDonut as
|
|
27
|
-
import { createCurrentIcon as
|
|
28
|
-
import { MapCanvas as
|
|
29
|
-
import { LogisticsMap as
|
|
30
|
-
import { RouteMap as
|
|
31
|
-
import { TrackingMap as
|
|
32
|
-
import { PaymentStatusBadge as
|
|
33
|
-
import { DataTable as
|
|
34
|
-
import { FormError as
|
|
35
|
-
import { Notice as
|
|
36
|
-
import { DocumentsCard as
|
|
37
|
-
import { CarbonFootprintPanel as
|
|
18
|
+
import { Avatar as ne, AvatarFallback as re, AvatarImage as ie, Badge as ae, Button as oe, Card as se, CardContent as ce, CardDescription as le, CardFooter as ue, CardHeader as de, CardTitle as fe, Checkbox as pe, Command as me, CommandEmpty as he, CommandGroup as ge, CommandInput as _e, CommandItem as ve, CommandList as ye, Dialog as be, DialogContent as xe, DialogDescription as Se, DialogFooter as Ce, DialogHeader as we, DialogTitle as Te, DialogTrigger as Ee, DropdownMenu as De, DropdownMenuContent as Oe, DropdownMenuItem as ke, DropdownMenuSeparator as Ae, DropdownMenuTrigger as je, Input as Me, Label as Ne, Popover as Pe, PopoverContent as Fe, PopoverTrigger as Ie, Progress as Le, ScrollArea as Re, Select as ze, SelectContent as Be, SelectItem as Ve, SelectTrigger as He, SelectValue as Ue, Separator as We, Skeleton as Ge, Switch as Ke, Table as qe, TableBody as Je, TableCell as Ye, TableHead as Xe, TableHeader as Ze, TableRow as Qe, Tabs as $e, TabsContent as et, TabsList as tt, TabsTrigger as nt, Textarea as rt, Tooltip as it, TooltipContent as at, TooltipProvider as ot, TooltipTrigger as st } from "./components/ui.js";
|
|
19
|
+
import { EmptyState as ct, ErrorState as lt, LoadingState as ut, PageLayout as dt, PageSection as ft } from "./components/PageLayout.js";
|
|
20
|
+
import { chartTokens as pt, seriesColor as mt } from "./components/charts/chartTokens.js";
|
|
21
|
+
import { Sparkline as ht } from "./components/charts/Sparkline.js";
|
|
22
|
+
import { MetricCard as gt, MetricCardSkeleton as _t, MetricGrid as vt } from "./components/MetricCard.js";
|
|
23
|
+
import { GlassPanel as yt } from "./components/GlassPanel.js";
|
|
24
|
+
import { ChartEmpty as bt, ChartTooltip as xt } from "./components/charts/ChartShell.js";
|
|
25
|
+
import { TrendChart as St } from "./components/charts/TrendChart.js";
|
|
26
|
+
import { VolumeBar as Ct } from "./components/charts/VolumeBar.js";
|
|
27
|
+
import { StatusDonut as wt } from "./components/charts/StatusDonut.js";
|
|
28
|
+
import { createCurrentIcon as Tt, createPinIcon as Et, createStopIcon as Dt, isRealCoord as Ot } from "./components/maps/leaflet-setup.js";
|
|
29
|
+
import { MapCanvas as kt } from "./components/maps/MapCanvas.js";
|
|
30
|
+
import { LogisticsMap as At } from "./components/maps/LogisticsMap.js";
|
|
31
|
+
import { RouteMap as jt } from "./components/maps/RouteMap.js";
|
|
32
|
+
import { TrackingMap as Mt } from "./components/maps/TrackingMap.js";
|
|
33
|
+
import { PaymentStatusBadge as Nt, PriorityBadge as Pt, StatusBadge as Ft, TypeBadge as It, VehicleTypeBadge as Lt } from "./components/StatusBadge.js";
|
|
34
|
+
import { DataTable as Rt } from "./components/DataTable.js";
|
|
35
|
+
import { FormError as zt } from "./components/FormError.js";
|
|
36
|
+
import { Notice as Bt, useNotice as Vt } from "./components/Notice.js";
|
|
37
|
+
import { DocumentsCard as Ht } from "./components/DocumentsCard.js";
|
|
38
|
+
import { CarbonFootprintPanel as Ut } from "./components/CarbonFootprintPanel.js";
|
|
38
39
|
import "./components/index.js";
|
|
39
|
-
export {
|
|
40
|
+
export { ne as Avatar, re as AvatarFallback, ie as AvatarImage, ae as Badge, oe as Button, Ut as CarbonFootprintPanel, se as Card, ce as CardContent, le as CardDescription, ue as CardFooter, de as CardHeader, fe as CardTitle, bt as ChartEmpty, xt as ChartTooltip, pe as Checkbox, me as Command, he as CommandEmpty, ge as CommandGroup, _e as CommandInput, ve as CommandItem, ye as CommandList, Rt as DataTable, be as Dialog, xe as DialogContent, Se as DialogDescription, Ce as DialogFooter, we as DialogHeader, Te as DialogTitle, Ee as DialogTrigger, Ht as DocumentsCard, De as DropdownMenu, Oe as DropdownMenuContent, ke as DropdownMenuItem, Ae as DropdownMenuSeparator, je as DropdownMenuTrigger, ct as EmptyState, lt as ErrorState, zt as FormError, yt as GlassPanel, Me as Input, Ne as Label, ut as LoadingState, At as LogisticsMap, ee as MOVETHEWHEELS_RYBBIT_EVENT_ALLOWLIST, kt as MapCanvas, gt as MetricCard, _t as MetricCardSkeleton, vt as MetricGrid, e as MoveTheWheelsRoot, Bt as Notice, dt as PageLayout, ft as PageSection, Nt as PaymentStatusBadge, Pe as Popover, Fe as PopoverContent, Ie as PopoverTrigger, Pt as PriorityBadge, Le as Progress, jt as RouteMap, Re as ScrollArea, ze as Select, Be as SelectContent, Ve as SelectItem, He as SelectTrigger, Ue as SelectValue, We as Separator, Ge as Skeleton, ht as Sparkline, Ft as StatusBadge, wt as StatusDonut, Ke as Switch, qe as Table, Je as TableBody, Ye as TableCell, Xe as TableHead, Ze as TableHeader, Qe as TableRow, $e as Tabs, et as TabsContent, tt as TabsList, nt as TabsTrigger, rt as Textarea, it as Tooltip, at as TooltipContent, ot as TooltipProvider, st as TooltipTrigger, Mt as TrackingMap, St as TrendChart, It as TypeBadge, Lt as VehicleTypeBadge, Ct as VolumeBar, pt as chartTokens, Tt as createCurrentIcon, Et as createPinIcon, Dt as createStopIcon, Ot as isRealCoord, mt as seriesColor, A as useAnalytics, J as useCaptureEpod, D as useCustomer, O as useCustomerStats, k as useCustomers, j as useDashboardMetrics, u as useDriver, d as useDriverStatusCounts, R as useDriverTracking, f as useDrivers, M as useEmissionsSummary, G as useEntityDocuments, Y as useEpod, X as useEpodPhotoUpload, Z as useEpodPhotoUrl, N as useFinanceMetrics, p as useFleet, P as useFleetAnalytics, m as useFleetStats, z as useGeofence, v as useInventory, y as useInventoryStats, b as useInventoryTransactions, B as useLiveTracking, n as useMoveTheWheels, r as useMoveTheWheelsNavigate, $ as useMoveTheWheelsStore, K as useMyDeliveryDay, Q as useMyPendingEpodDeliveryJobs, Vt as useNotice, q as useOnlineStatus, s as useOrder, F as useOrderAnalytics, c as useOrderStats, V as useOrderTracking, l as useOrders, I as usePerformanceAnalytics, x as useProduct, S as useProductStockLevels, C as useProducts, L as useRevenueAnalytics, i as useRoute, a as useRouteStats, o as useRoutes, te as useSandboxAssistantTransport, w as useStockActions, t as useTr, H as useTracking, U as useTrackingAlerts, h as useVehicle, g as useVehicleDrivers, W as useVehicleTracking, _ as useVehicles, T as useWarehouse, E as useWarehouses };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConversationEntityType } from '../hooks/useEntityComments';
|
|
2
|
+
interface EntityConversationsCardProps {
|
|
3
|
+
entityType: ConversationEntityType;
|
|
4
|
+
entityId: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function EntityConversationsCard({ entityType, entityId, title, }: EntityConversationsCardProps): import('react').JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EventBus } from '@burdenoff/fe-libs/shared/events';
|
|
2
|
+
/** Canonical MoveTheWheels product events aligned with ANALYTICS_PLAN.md and fe-libs AppShellProvider. */
|
|
3
|
+
export declare const MOVETHEWHEELS_RYBBIT_EVENT_ALLOWLIST: readonly ["movethewheels.page.viewed", "movethewheels.order.created", "movethewheels.shipment.created", "movethewheels.shipment.delivered", "movethewheels.delivery_job.assigned", "movethewheels.route.planned", "movethewheels.vehicle.assigned", "movethewheels.warehouse.inbound_received", "movethewheels.vehicle.service_recorded", "billing.plan.upgraded"];
|
|
4
|
+
export type MoveTheWheelsAnalyticsEventName = (typeof MOVETHEWHEELS_RYBBIT_EVENT_ALLOWLIST)[number];
|
|
5
|
+
/** Sanitize pathname to strip UUID/ID segments before emitting page views. */
|
|
6
|
+
export declare function normalizeAnalyticsPagePath(pathname: string): string;
|
|
7
|
+
export declare function emitPageViewed(bus: EventBus, pathname: string, workspaceId?: string | null): void;
|
|
8
|
+
export declare function emitOrderCreated(bus: EventBus, orderId: string | undefined, workspaceId?: string | null, meta?: {
|
|
9
|
+
priority?: string;
|
|
10
|
+
itemCount?: number;
|
|
11
|
+
}): void;
|
|
12
|
+
export declare function emitShipmentCreated(bus: EventBus, shipmentId: string | undefined, workspaceId?: string | null, meta?: {
|
|
13
|
+
mode?: string;
|
|
14
|
+
isMultiModal?: boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
export declare function emitShipmentDelivered(bus: EventBus, shipmentId: string | undefined, workspaceId?: string | null): void;
|
|
17
|
+
export declare function emitDeliveryJobAssigned(bus: EventBus, deliveryJobId: string | undefined, workspaceId?: string | null, meta?: {
|
|
18
|
+
hasDriver?: boolean;
|
|
19
|
+
hasVehicle?: boolean;
|
|
20
|
+
}): void;
|
|
21
|
+
export declare function emitRoutePlanned(bus: EventBus, routeId: string | undefined, workspaceId?: string | null, meta?: {
|
|
22
|
+
optimized?: boolean;
|
|
23
|
+
stopCount?: number;
|
|
24
|
+
}): void;
|
|
25
|
+
export declare function emitVehicleAssigned(bus: EventBus, vehicleId: string | undefined, driverId: string | undefined, workspaceId?: string | null): void;
|
|
26
|
+
export declare function emitWarehouseInboundReceived(bus: EventBus, warehouseId: string | undefined, inventoryItemId: string | undefined, workspaceId?: string | null): void;
|
|
27
|
+
export declare function emitVehicleServiceRecorded(bus: EventBus, vehicleId: string | undefined, workspaceId?: string | null, serviceType?: string): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ConversationEntityType = 'mtw_order' | 'mtw_shipment' | 'mtw_route';
|
|
2
|
+
export interface EntityCommentItem {
|
|
3
|
+
id: string;
|
|
4
|
+
entityType: string;
|
|
5
|
+
entityId: string;
|
|
6
|
+
text: string;
|
|
7
|
+
authorId: string;
|
|
8
|
+
status: string;
|
|
9
|
+
isPinned: boolean;
|
|
10
|
+
parentCommentId?: string | null;
|
|
11
|
+
replyCount: number;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
}
|
|
15
|
+
export declare function useEntityComments(entityType: ConversationEntityType, entityId: string | undefined): {
|
|
16
|
+
comments: EntityCommentItem[];
|
|
17
|
+
total: number;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
isSubmitting: boolean;
|
|
20
|
+
error: Error | null;
|
|
21
|
+
refetch: () => Promise<void>;
|
|
22
|
+
addComment: (text: string, parentCommentId?: string) => Promise<EntityCommentItem | null>;
|
|
23
|
+
toggleResolve: (id: string, resolved: boolean) => Promise<void>;
|
|
24
|
+
deleteComment: (id: string) => Promise<void>;
|
|
25
|
+
currentUserId: string | undefined;
|
|
26
|
+
};
|