@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.
Files changed (70) hide show
  1. package/dist/MoveTheWheelsRoot.js +149 -133
  2. package/dist/MoveTheWheelsRoutes.js +157 -139
  3. package/dist/components/EntityConversationsCard.js +145 -0
  4. package/dist/components/maps/MapCanvas.js +4 -3
  5. package/dist/events/rybbit.js +87 -0
  6. package/dist/generated/tracking-quality-operations.d.ts +342 -0
  7. package/dist/hooks/useEntityComments.js +111 -0
  8. package/dist/hooks/useFleet.js +394 -311
  9. package/dist/hooks/useInventory.js +378 -313
  10. package/dist/hooks/useMultiModalShipments.js +58 -53
  11. package/dist/hooks/useOrders.js +178 -158
  12. package/dist/hooks/useRoutes.js +146 -130
  13. package/dist/index.js +35 -34
  14. package/dist/movethewheels/components/EntityConversationsCard.d.ts +8 -0
  15. package/dist/movethewheels/events/rybbit.d.ts +27 -0
  16. package/dist/movethewheels/hooks/useEntityComments.d.ts +26 -0
  17. package/dist/movethewheels/hooks/useFleet.d.ts +73 -1
  18. package/dist/movethewheels/hooks/useInventory.d.ts +19 -0
  19. package/dist/movethewheels/index.d.ts +1 -0
  20. package/dist/movethewheels/pages/DocumentsLibraryPage.d.ts +1 -0
  21. package/dist/movethewheels/pages/NotificationsCenterPage.d.ts +1 -0
  22. package/dist/movethewheels/types/index.d.ts +95 -2
  23. package/dist/node_modules/lucide-react/dist/esm/icons/check-check.js +10 -0
  24. package/dist/node_modules/lucide-react/dist/esm/icons/layers.js +17 -0
  25. package/dist/node_modules/lucide-react/dist/esm/icons/message-square.js +7 -0
  26. package/dist/node_modules/lucide-react/dist/esm/icons/send.js +10 -0
  27. package/dist/pages/DocumentsLibraryPage.js +235 -0
  28. package/dist/pages/DriverDetailsPage.js +625 -351
  29. package/dist/pages/NotificationsCenterPage.js +310 -0
  30. package/dist/pages/OrderDetailsPage.js +48 -42
  31. package/dist/pages/RouteDetailsPage.js +257 -251
  32. package/dist/pages/TrackingPage.js +202 -196
  33. package/dist/pages/VehicleDetailsPage.js +616 -314
  34. package/dist/pages/WarehouseDetailsPage.js +539 -253
  35. package/dist/stories/ControlTowerWidgets.stories.d.ts +10 -0
  36. package/dist/stories/DataTable.stories.d.ts +15 -0
  37. package/dist/stories/FleetCards.stories.d.ts +9 -0
  38. package/dist/stories/OrderForms.stories.d.ts +8 -0
  39. package/dist/stories/RouteMap.stories.d.ts +7 -0
  40. package/dist/stories/ShipmentTimeline.stories.d.ts +6 -0
  41. package/package.json +1 -1
  42. package/src/generated/tracking-quality-operations.ts +407 -0
  43. package/src/movethewheels/MoveTheWheelsRoot.tsx +16 -0
  44. package/src/movethewheels/MoveTheWheelsRoutes.tsx +17 -2
  45. package/src/movethewheels/components/EntityConversationsCard.tsx +143 -0
  46. package/src/movethewheels/components/maps/MapCanvas.tsx +3 -3
  47. package/src/movethewheels/events/__tests__/rybbit.test.ts +98 -0
  48. package/src/movethewheels/events/rybbit.ts +191 -0
  49. package/src/movethewheels/hooks/useEntityComments.ts +258 -0
  50. package/src/movethewheels/hooks/useFleet.ts +300 -5
  51. package/src/movethewheels/hooks/useInventory.ts +231 -3
  52. package/src/movethewheels/hooks/useMultiModalShipments.ts +8 -1
  53. package/src/movethewheels/hooks/useOrders.ts +19 -3
  54. package/src/movethewheels/hooks/useRoutes.ts +14 -2
  55. package/src/movethewheels/index.ts +1 -0
  56. package/src/movethewheels/pages/DocumentsLibraryPage.tsx +229 -0
  57. package/src/movethewheels/pages/DriverDetailsPage.tsx +250 -1
  58. package/src/movethewheels/pages/NotificationsCenterPage.tsx +331 -0
  59. package/src/movethewheels/pages/OrderDetailsPage.tsx +8 -0
  60. package/src/movethewheels/pages/RouteDetailsPage.tsx +6 -0
  61. package/src/movethewheels/pages/TrackingPage.tsx +8 -0
  62. package/src/movethewheels/pages/VehicleDetailsPage.tsx +255 -1
  63. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +266 -2
  64. package/src/movethewheels/types/index.ts +103 -2
  65. package/src/stories/ControlTowerWidgets.stories.tsx +150 -0
  66. package/src/stories/DataTable.stories.tsx +94 -0
  67. package/src/stories/FleetCards.stories.tsx +77 -0
  68. package/src/stories/OrderForms.stories.tsx +84 -0
  69. package/src/stories/RouteMap.stories.tsx +43 -0
  70. package/src/stories/ShipmentTimeline.stories.tsx +128 -0
@@ -1,8 +1,10 @@
1
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";
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 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 = `
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
- ${o}
23
+ ${c}
22
24
  }
23
25
  }
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 = `
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
- ${o}
42
+ ${c}
41
43
  }
42
44
  }
43
45
  `;
44
- function p(e) {
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 m(e) {
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 h(e) {
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 g(e) {
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: p(e.status),
92
- stops: h(e.waypoints),
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: a, tenantId: o, currentUser: s } = e();
104
- return i(() => ({
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: a,
110
+ workspaceId: i,
109
111
  tenantId: o,
110
112
  actorId: s?.id
111
113
  }), [
112
114
  t,
113
115
  n,
114
116
  r,
115
- a,
117
+ i,
116
118
  o,
117
119
  s?.id
118
120
  ]);
119
121
  }
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 () => {
122
- D(!0), j(null);
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 t(y, s, {
126
+ let e = await n(x, l, {
125
127
  filter: {
126
- driverId: i,
127
- vehicleId: o,
128
- status: c ? m(c) : void 0,
129
- search: p || void 0
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: h,
133
- offset: v
134
+ limit: _,
135
+ offset: b
134
136
  }
135
137
  });
136
- C(e.routesCount), T(v + e.routes.length < e.routesCount), x(e.routes.map(g));
138
+ D(e.routesCount), k(b + e.routes.length < e.routesCount), T(e.routes.map(v));
137
139
  } catch (e) {
138
- j(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load routes"));
140
+ F(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load routes"));
139
141
  } finally {
140
- D(!1);
142
+ j(!1);
141
143
  }
142
144
  }, [
143
- i,
144
- y,
145
- p,
146
- c,
147
- o,
145
+ a,
146
+ x,
148
147
  h,
149
- v
150
- ]), N = n(async () => {
151
- if (!w || E || O) return;
152
- let e = v + b.length;
153
- k(!0), j(null);
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 n = await t(y, s, {
157
+ let t = await n(x, l, {
156
158
  filter: {
157
- driverId: i,
158
- vehicleId: o,
159
- status: c ? m(c) : void 0,
160
- search: p || void 0
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: h,
165
+ limit: _,
164
166
  offset: e
165
167
  }
166
- }), r = n.routes.map(g);
167
- C(n.routesCount), T(e + r.length < n.routesCount), x((e) => {
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
- j(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more routes"));
174
+ F(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load more routes"));
173
175
  } finally {
174
- k(!1);
176
+ N(!1);
175
177
  }
176
178
  }, [
177
- i,
178
- y,
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
- v,
184
- b.length,
185
- p,
186
- c,
187
- o
188
+ u,
189
+ c
188
190
  ]);
189
- r(() => {
190
- M();
191
- }, [M]);
192
- let P = n(() => {
193
- M();
194
- }, [M]), F = n(async (e) => {
195
- let n = g((await t(y, l, { input: {
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: m(e.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 x((e) => [n, ...e]), n;
206
- }, [y]), I = n(async (e, n) => {
207
- let r = g((await t(y, u, {
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: n.name,
211
- status: m(n.status),
219
+ name: t.name,
220
+ status: g(t.status),
212
221
  shipmentId: void 0,
213
- vehicleId: Object.prototype.hasOwnProperty.call(n, "vehicleId") ? n.vehicleId ?? null : void 0,
214
- driverId: Object.prototype.hasOwnProperty.call(n, "driverId") ? n.driverId ?? null : void 0,
215
- waypoints: n.stops,
216
- estimatedDuration: n.estimatedDuration,
217
- fuelCost: n.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 x((t) => t.map((t) => t.id === e ? r : t)), r;
221
- }, [y]);
229
+ return T((t) => t.map((t) => t.id === e ? r : t)), r;
230
+ }, [x]);
222
231
  return {
223
- routes: b,
224
- totalRoutes: S,
225
- hasMore: w,
226
- isLoading: E,
227
- isLoadingMore: O,
228
- error: A,
229
- refetch: P,
230
- loadMore: N,
231
- createRoute: F,
232
- updateRoute: I,
233
- deleteRoute: n(async (e) => {
234
- await t(y, d, { id: e }), x((t) => t.filter((t) => t.id !== e));
235
- }, [y]),
236
- optimizeRoute: n(async (e, n) => {
237
- let r = g((await t(y, f, {
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: n ? { strategy: n } : void 0
248
+ input: r ? { strategy: r } : void 0
240
249
  })).optimizeRoute);
241
- return x((t) => t.map((t) => t.id === e ? r : t)), r;
242
- }, [y]),
243
- updateStopStatus: n(async (e, t, n) => {
244
- let r = b.find((t) => t.id === e);
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 I(e, {
267
+ return B(e, {
252
268
  stops: i,
253
269
  status: i.every((e) => e.status === "completed") ? "completed" : r.status
254
270
  });
255
- }, [b, I])
271
+ }, [w, B])
256
272
  };
257
273
  }
258
- function y(e) {
259
- let i = _(), [o, s] = a(null), [l, u] = a(!1), [d, f] = a(null), p = n(async () => {
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
- u(!0), f(null);
278
+ l(!0), f(null);
263
279
  try {
264
- let n = await t(i, c, { id: e });
265
- s(n.route ? g(n.route) : null);
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
- u(!1);
285
+ l(!1);
270
286
  }
271
287
  }
272
- }, [i, e]);
273
- return r(() => {
288
+ }, [t, e]);
289
+ return i(() => {
274
290
  p();
275
291
  }, [p]), {
276
- route: o,
277
- isLoading: l,
292
+ route: a,
293
+ isLoading: c,
278
294
  error: d,
279
295
  refetch: () => void p()
280
296
  };
281
297
  }
282
- var b = "\n query RouteStats {\n routeStats {\n total\n totalDistance\n totalDuration\n completed\n inProgress\n planned\n optimized\n }\n }\n";
283
- function x() {
284
- let e = _(), [n, i] = a({
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
- }), [o, s] = a(!1), [c, l] = a(null);
295
- return r(() => {
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 n = (await t(e, b)).routeStats;
300
- i({
301
- totalRoutes: n.total,
302
- totalDistance: n.totalDistance,
303
- totalDuration: n.totalDuration,
304
- avgDistance: n.total > 0 ? n.totalDistance / n.total : 0,
305
- avgDuration: n.total > 0 ? n.totalDuration / n.total : 0,
306
- completedRoutes: n.completed,
307
- inProgressRoutes: n.inProgress,
308
- plannedRoutes: n.planned,
309
- optimizedRoutes: n.optimized
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: n,
319
- isLoading: o,
334
+ stats: t,
335
+ isLoading: a,
320
336
  error: c
321
337
  };
322
338
  }
323
- export { g as mapRoute, y as useRoute, x as useRouteStats, v as useRoutes };
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 { useRoute as n, useRouteStats as r, useRoutes as i } from "./hooks/useRoutes.js";
4
- import { useOrder as a, useOrderStats as o, useOrders as s } from "./hooks/useOrders.js";
5
- import { useDriver as c, useDriverStatusCounts as l, useDrivers as u, useFleet as d, useFleetStats as f, useVehicle as p, useVehicleDrivers as m, useVehicles as h } from "./hooks/useFleet.js";
6
- import { useInventory as g, useInventoryStats as _, useInventoryTransactions as v, useProduct as y, useProductStockLevels as b, useProducts as x, useStockActions as S, useWarehouse as C, useWarehouses as w } from "./hooks/useInventory.js";
7
- import { useCustomer as T, useCustomerStats as E, useCustomers as D } from "./hooks/useCustomers.js";
8
- import { useAnalytics as O, useDashboardMetrics as k, useEmissionsSummary as A, useFinanceMetrics as j, useFleetAnalytics as M, useOrderAnalytics as N, usePerformanceAnalytics as P, useRevenueAnalytics as F } from "./hooks/useAnalytics.js";
9
- import { useDriverTracking as I, useGeofence as L, useLiveTracking as R, useOrderTracking as z, useTracking as B, useTrackingAlerts as V, useVehicleTracking as H } from "./hooks/useTracking.js";
10
- import { useEntityDocuments as U } from "./hooks/useEntityDocuments.js";
11
- import { useMyDeliveryDay as W, useOnlineStatus as G } from "./hooks/useDriverDay.js";
12
- import { useCaptureEpod as K, useEpod as q, useEpodPhotoUpload as J, useEpodPhotoUrl as Y, useMyPendingEpodDeliveryJobs as X } from "./hooks/useEpod.js";
13
- import { useMoveTheWheels as Z, useMoveTheWheelsNavigate as Q } from "./providers/MoveTheWheelsProvider.js";
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 { useSandboxAssistantTransport as ee } from "./services/createSandboxAssistantTransport.js";
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 te, AvatarFallback as ne, AvatarImage as re, Badge as ie, Button as ae, Card as oe, CardContent as se, CardDescription as ce, CardFooter as le, CardHeader as ue, CardTitle as de, Checkbox as fe, Command as pe, CommandEmpty as me, CommandGroup as he, CommandInput as ge, CommandItem as _e, CommandList as ve, Dialog as ye, DialogContent as be, DialogDescription as xe, DialogFooter as Se, DialogHeader as Ce, DialogTitle as we, DialogTrigger as Te, DropdownMenu as Ee, DropdownMenuContent as De, DropdownMenuItem as Oe, DropdownMenuSeparator as ke, DropdownMenuTrigger as Ae, Input as je, Label as Me, Popover as Ne, PopoverContent as Pe, PopoverTrigger as Fe, Progress as Ie, ScrollArea as Le, Select as Re, SelectContent as ze, SelectItem as Be, SelectTrigger as Ve, SelectValue as He, Separator as Ue, Skeleton as We, Switch as Ge, Table as Ke, TableBody as qe, TableCell as Je, TableHead as Ye, TableHeader as Xe, TableRow as Ze, Tabs as Qe, TabsContent as $e, TabsList as et, TabsTrigger as tt, Textarea as nt, Tooltip as rt, TooltipContent as it, TooltipProvider as at, TooltipTrigger as ot } from "./components/ui.js";
18
- import { EmptyState as st, ErrorState as ct, LoadingState as lt, PageLayout as ut, PageSection as dt } from "./components/PageLayout.js";
19
- import { chartTokens as ft, seriesColor as pt } from "./components/charts/chartTokens.js";
20
- import { Sparkline as mt } from "./components/charts/Sparkline.js";
21
- import { MetricCard as ht, MetricCardSkeleton as gt, MetricGrid as _t } from "./components/MetricCard.js";
22
- import { GlassPanel as vt } from "./components/GlassPanel.js";
23
- import { ChartEmpty as yt, ChartTooltip as bt } from "./components/charts/ChartShell.js";
24
- import { TrendChart as xt } from "./components/charts/TrendChart.js";
25
- import { VolumeBar as St } from "./components/charts/VolumeBar.js";
26
- import { StatusDonut as Ct } from "./components/charts/StatusDonut.js";
27
- import { createCurrentIcon as wt, createPinIcon as Tt, createStopIcon as Et, isRealCoord as Dt } from "./components/maps/leaflet-setup.js";
28
- import { MapCanvas as Ot } from "./components/maps/MapCanvas.js";
29
- import { LogisticsMap as kt } from "./components/maps/LogisticsMap.js";
30
- import { RouteMap as At } from "./components/maps/RouteMap.js";
31
- import { TrackingMap as jt } from "./components/maps/TrackingMap.js";
32
- import { PaymentStatusBadge as Mt, PriorityBadge as Nt, StatusBadge as Pt, TypeBadge as Ft, VehicleTypeBadge as It } from "./components/StatusBadge.js";
33
- import { DataTable as Lt } from "./components/DataTable.js";
34
- import { FormError as Rt } from "./components/FormError.js";
35
- import { Notice as zt, useNotice as Bt } from "./components/Notice.js";
36
- import { DocumentsCard as Vt } from "./components/DocumentsCard.js";
37
- import { CarbonFootprintPanel as Ht } from "./components/CarbonFootprintPanel.js";
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 { te as Avatar, ne as AvatarFallback, re as AvatarImage, ie as Badge, ae as Button, Ht as CarbonFootprintPanel, oe as Card, se as CardContent, ce as CardDescription, le as CardFooter, ue as CardHeader, de as CardTitle, yt as ChartEmpty, bt as ChartTooltip, fe as Checkbox, pe as Command, me as CommandEmpty, he as CommandGroup, ge as CommandInput, _e as CommandItem, ve as CommandList, Lt as DataTable, ye as Dialog, be as DialogContent, xe as DialogDescription, Se as DialogFooter, Ce as DialogHeader, we as DialogTitle, Te as DialogTrigger, Vt as DocumentsCard, Ee as DropdownMenu, De as DropdownMenuContent, Oe as DropdownMenuItem, ke as DropdownMenuSeparator, Ae as DropdownMenuTrigger, st as EmptyState, ct as ErrorState, Rt as FormError, vt as GlassPanel, je as Input, Me as Label, lt as LoadingState, kt as LogisticsMap, Ot as MapCanvas, ht as MetricCard, gt as MetricCardSkeleton, _t as MetricGrid, e as MoveTheWheelsRoot, zt as Notice, ut as PageLayout, dt as PageSection, Mt as PaymentStatusBadge, Ne as Popover, Pe as PopoverContent, Fe as PopoverTrigger, Nt as PriorityBadge, Ie as Progress, At as RouteMap, Le as ScrollArea, Re as Select, ze as SelectContent, Be as SelectItem, Ve as SelectTrigger, He as SelectValue, Ue as Separator, We as Skeleton, mt as Sparkline, Pt as StatusBadge, Ct as StatusDonut, Ge as Switch, Ke as Table, qe as TableBody, Je as TableCell, Ye as TableHead, Xe as TableHeader, Ze as TableRow, Qe as Tabs, $e as TabsContent, et as TabsList, tt as TabsTrigger, nt as Textarea, rt as Tooltip, it as TooltipContent, at as TooltipProvider, ot as TooltipTrigger, jt as TrackingMap, xt as TrendChart, Ft as TypeBadge, It as VehicleTypeBadge, St as VolumeBar, ft as chartTokens, wt as createCurrentIcon, Tt as createPinIcon, Et as createStopIcon, Dt as isRealCoord, pt as seriesColor, O as useAnalytics, K as useCaptureEpod, T as useCustomer, E as useCustomerStats, D as useCustomers, k as useDashboardMetrics, c as useDriver, l as useDriverStatusCounts, I as useDriverTracking, u as useDrivers, A as useEmissionsSummary, U as useEntityDocuments, q as useEpod, J as useEpodPhotoUpload, Y as useEpodPhotoUrl, j as useFinanceMetrics, d as useFleet, M as useFleetAnalytics, f as useFleetStats, L as useGeofence, g as useInventory, _ as useInventoryStats, v as useInventoryTransactions, R as useLiveTracking, Z as useMoveTheWheels, Q as useMoveTheWheelsNavigate, $ as useMoveTheWheelsStore, W as useMyDeliveryDay, X as useMyPendingEpodDeliveryJobs, Bt as useNotice, G as useOnlineStatus, a as useOrder, N as useOrderAnalytics, o as useOrderStats, z as useOrderTracking, s as useOrders, P as usePerformanceAnalytics, y as useProduct, b as useProductStockLevels, x as useProducts, F as useRevenueAnalytics, n as useRoute, r as useRouteStats, i as useRoutes, ee as useSandboxAssistantTransport, S as useStockActions, t as useTr, B as useTracking, V as useTrackingAlerts, p as useVehicle, m as useVehicleDrivers, H as useVehicleTracking, h as useVehicles, C as useWarehouse, w as useWarehouses };
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
+ };