@burdenoff/microfe-movethewheels 2026.920.3 → 2026.921.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/components/CarbonFootprintPanel.js +1 -1
- package/dist/components/CustomerPicker.js +76 -65
- package/dist/components/DataTable.js +140 -139
- package/dist/components/DocumentsCard.js +14 -8
- package/dist/generated/wspace-types.d.ts +1043 -5
- package/dist/hooks/useAnalytics.js +21 -1
- package/dist/hooks/useCustomers.js +94 -78
- package/dist/hooks/useDebouncedValue.js +11 -0
- package/dist/hooks/useEntityDocuments.js +28 -18
- package/dist/hooks/useEpod.js +24 -17
- package/dist/hooks/useFleet.js +146 -125
- package/dist/hooks/useInventory.js +255 -186
- package/dist/hooks/useMultiModalShipments.js +35 -27
- package/dist/hooks/useOrders.js +73 -73
- package/dist/hooks/useRoutes.js +97 -75
- package/dist/hooks/useTracking.js +100 -88
- package/dist/movethewheels/components/CustomerPicker.d.ts +3 -1
- package/dist/movethewheels/components/DataTable.d.ts +5 -1
- package/dist/movethewheels/hooks/useCustomers.d.ts +0 -1
- package/dist/movethewheels/hooks/useDebouncedValue.d.ts +1 -0
- package/dist/movethewheels/hooks/useEntityDocuments.d.ts +2 -0
- package/dist/movethewheels/hooks/useEpod.d.ts +6 -1
- package/dist/movethewheels/hooks/useFleet.d.ts +49 -5
- package/dist/movethewheels/hooks/useInventory.d.ts +24 -17
- package/dist/movethewheels/hooks/useMultiModalShipments.d.ts +6 -1
- package/dist/movethewheels/hooks/useOrders.d.ts +33 -5
- package/dist/movethewheels/hooks/useRoutes.d.ts +2 -1
- package/dist/movethewheels/hooks/useTracking.d.ts +12 -11
- package/dist/movethewheels/types/index.d.ts +7 -5
- package/dist/pages/CreateOrderPage.js +207 -201
- package/dist/pages/CustomersPage.js +61 -54
- package/dist/pages/DeliveryCapturePage.js +131 -109
- package/dist/pages/DriversPage.js +100 -92
- package/dist/pages/InventoryPage.js +239 -236
- package/dist/pages/MultiModalShipmentPage.js +163 -130
- package/dist/pages/OrderDetailsPage.js +224 -208
- package/dist/pages/OrdersListPage.js +66 -60
- package/dist/pages/ProductDetailsPage.js +241 -200
- package/dist/pages/ProductsPage.js +59 -52
- package/dist/pages/RouteDetailsPage.js +343 -321
- package/dist/pages/RoutesPage.js +55 -48
- package/dist/pages/VehiclesPage.js +63 -56
- package/dist/pages/WarehousesPage.js +60 -53
- package/package.json +1 -1
- package/src/generated/wspace-types.ts +1188 -5
- package/src/movethewheels/components/CarbonFootprintPanel.tsx +0 -1
- package/src/movethewheels/components/CustomerPicker.tsx +14 -0
- package/src/movethewheels/components/DataTable.tsx +34 -18
- package/src/movethewheels/components/DocumentsCard.tsx +6 -1
- package/src/movethewheels/components/maps/leaflet-setup.ts +1 -8
- package/src/movethewheels/hooks/useAnalytics.ts +27 -0
- package/src/movethewheels/hooks/useCustomers.ts +64 -24
- package/src/movethewheels/hooks/useDebouncedValue.ts +12 -0
- package/src/movethewheels/hooks/useEntityDocuments.ts +43 -25
- package/src/movethewheels/hooks/useEpod.ts +14 -7
- package/src/movethewheels/hooks/useFleet.ts +58 -37
- package/src/movethewheels/hooks/useFleetIntelligence.ts +1 -4
- package/src/movethewheels/hooks/useInventory.ts +211 -90
- package/src/movethewheels/hooks/useMultiModalShipments.ts +15 -11
- package/src/movethewheels/hooks/useOrders.ts +13 -14
- package/src/movethewheels/hooks/useRoutes.ts +80 -23
- package/src/movethewheels/hooks/useTracking.ts +130 -98
- package/src/movethewheels/pages/CreateOrderPage.tsx +9 -1
- package/src/movethewheels/pages/CustomersPage.tsx +11 -1
- package/src/movethewheels/pages/DeliveryCapturePage.tsx +31 -1
- package/src/movethewheels/pages/DriversPage.tsx +24 -12
- package/src/movethewheels/pages/InventoryPage.tsx +57 -32
- package/src/movethewheels/pages/MultiModalShipmentPage.tsx +52 -3
- package/src/movethewheels/pages/OrderDetailsPage.tsx +17 -1
- package/src/movethewheels/pages/OrdersListPage.tsx +20 -3
- package/src/movethewheels/pages/ProductDetailsPage.tsx +52 -3
- package/src/movethewheels/pages/ProductsPage.tsx +11 -1
- package/src/movethewheels/pages/RouteDetailsPage.tsx +35 -5
- package/src/movethewheels/pages/RoutesPage.tsx +11 -1
- package/src/movethewheels/pages/VehiclesPage.tsx +19 -2
- package/src/movethewheels/pages/WarehousesPage.tsx +11 -1
- package/src/movethewheels/types/index.ts +7 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
2
|
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useCallback as
|
|
3
|
+
import { mapOrder as n, useOrder as r } from "./useOrders.js";
|
|
4
|
+
import { mapDriver as i, mapVehicle as a, useDriver as o, useDrivers as s, useVehicle as c, useVehicles as l } from "./useFleet.js";
|
|
5
|
+
import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
|
|
6
6
|
//#region src/movethewheels/hooks/useTracking.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var m = "\n query ListShipments($filter: ShipmentFilterInput, $pagination: PaginationInput) {\n shipments(filter: $filter, pagination: $pagination) {\n id\n shipmentNumber\n deliveryJobId\n status\n estimatedDelivery\n }\n }\n", h = "\n query GetDeliveryJobTracking($deliveryJobId: ID!, $pagination: PaginationInput) {\n deliveryJobTracking(deliveryJobId: $deliveryJobId, pagination: $pagination) {\n id\n shipmentId\n eventType\n location\n details\n timestamp\n }\n }\n", g = "\n query GetActiveDeliveries($pagination: PaginationInput) {\n activeDeliveries(pagination: $pagination) {\n id\n shipmentNumber\n deliveryJobId\n status\n estimatedDelivery\n trackingEvents(pagination: { limit: 1, offset: 0 }) {\n id\n shipmentId\n eventType\n location\n details\n timestamp\n }\n deliveryJob {\n id\n deliveryJobNumber\n customerId\n status\n priority\n pickupAddress\n deliveryAddress\n cargoItems\n pricing\n trackingNumber\n specialInstructions\n scheduledDelivery\n vehicleId\n driverId\n createdAt\n updatedAt\n customer {\n name\n email\n phone\n company\n }\n vehicle {\n id\n vehicleNumber\n type\n make\n model\n licensePlate\n ownershipType\n year\n capacity\n status\n currentLocation\n fuelLevel\n mileage\n lastServiceDate\n nextServiceDueDate\n nextServiceDueMileage\n createdAt\n }\n driver {\n id\n userId\n firstName\n lastName\n email\n phone\n employeeId\n licenseNumber\n licenseClass\n licenseExpiry\n status\n currentLocation\n rating\n vehicleId\n createdAt\n }\n }\n }\n }\n", _ = "\n query GetTrackingAlerts {\n trackingAlerts {\n shipmentId\n shipmentNumber\n alertType\n message\n }\n }\n";
|
|
8
|
+
function v(e, t) {
|
|
9
9
|
let n = {
|
|
10
10
|
latitude: Number(e.location?.latitude ?? 0),
|
|
11
11
|
longitude: Number(e.location?.longitude ?? 0),
|
|
@@ -25,9 +25,9 @@ function _(e, t) {
|
|
|
25
25
|
lastUpdated: new Date(e.timestamp)
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function y() {
|
|
29
29
|
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: i, tenantId: a, currentUser: o } = e();
|
|
30
|
-
return
|
|
30
|
+
return f(() => ({
|
|
31
31
|
apiGatewayUrl: t,
|
|
32
32
|
authToken: n,
|
|
33
33
|
workspaceToken: r,
|
|
@@ -43,17 +43,24 @@ function v() {
|
|
|
43
43
|
o?.id
|
|
44
44
|
]);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
let { entityId: n, entityType: r } = e, i =
|
|
48
|
-
|
|
46
|
+
function b(e = {}) {
|
|
47
|
+
let { entityId: n, entityType: r } = e, i = y(), [a, o] = p([]), [s, c] = p(!1), [l, f] = p(null), h = u(async () => {
|
|
48
|
+
c(!0), f(null);
|
|
49
49
|
try {
|
|
50
|
-
o((await t(i,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
o((await t(i, m, {
|
|
51
|
+
filter: n ? {
|
|
52
|
+
...r === "order" ? { deliveryJobId: n } : {},
|
|
53
|
+
...r === "vehicle" ? { vehicleId: n } : {},
|
|
54
|
+
...r === "driver" ? { driverId: n } : {}
|
|
55
|
+
} : void 0,
|
|
56
|
+
pagination: {
|
|
57
|
+
limit: 50,
|
|
58
|
+
offset: 0
|
|
59
|
+
}
|
|
60
|
+
})).shipments.map((e) => ({
|
|
54
61
|
id: e.id,
|
|
55
|
-
entityId: e.deliveryJobId ?? e.id,
|
|
56
|
-
entityType: "order",
|
|
62
|
+
entityId: n ?? e.deliveryJobId ?? e.id,
|
|
63
|
+
entityType: r ?? "order",
|
|
57
64
|
currentLocation: {
|
|
58
65
|
latitude: 0,
|
|
59
66
|
longitude: 0,
|
|
@@ -65,56 +72,62 @@ function y(e = {}) {
|
|
|
65
72
|
nextCheckpoint: e.shipmentNumber,
|
|
66
73
|
alerts: [],
|
|
67
74
|
lastUpdated: /* @__PURE__ */ new Date()
|
|
68
|
-
}))
|
|
75
|
+
})));
|
|
69
76
|
} catch (e) {
|
|
70
|
-
|
|
77
|
+
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load tracking data"));
|
|
71
78
|
} finally {
|
|
72
|
-
|
|
79
|
+
c(!1);
|
|
73
80
|
}
|
|
74
81
|
}, [
|
|
75
82
|
n,
|
|
76
83
|
r,
|
|
77
84
|
i
|
|
78
85
|
]);
|
|
79
|
-
return
|
|
86
|
+
return d(() => {
|
|
80
87
|
h();
|
|
81
88
|
}, [h]), {
|
|
82
89
|
tracking: a,
|
|
83
90
|
isLoading: s,
|
|
84
|
-
error:
|
|
91
|
+
error: l,
|
|
85
92
|
refetch: () => void h()
|
|
86
93
|
};
|
|
87
94
|
}
|
|
88
|
-
function
|
|
89
|
-
let
|
|
95
|
+
function x(e) {
|
|
96
|
+
let n = y(), { order: i } = r(e), [a, o] = p(null), [s, c] = p(!1), [l, f] = p(null), m = u(async () => {
|
|
90
97
|
if (!e) {
|
|
91
98
|
o(null);
|
|
92
99
|
return;
|
|
93
100
|
}
|
|
94
|
-
|
|
101
|
+
c(!0), f(null);
|
|
95
102
|
try {
|
|
96
|
-
let
|
|
97
|
-
|
|
103
|
+
let r = (await t(n, h, {
|
|
104
|
+
deliveryJobId: e,
|
|
105
|
+
pagination: {
|
|
106
|
+
limit: 1,
|
|
107
|
+
offset: 0
|
|
108
|
+
}
|
|
109
|
+
})).deliveryJobTracking[0];
|
|
110
|
+
o(r ? v(r, e) : null);
|
|
98
111
|
} catch (e) {
|
|
99
|
-
|
|
112
|
+
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load order tracking"));
|
|
100
113
|
} finally {
|
|
101
|
-
|
|
114
|
+
c(!1);
|
|
102
115
|
}
|
|
103
|
-
}, [
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
}, [
|
|
116
|
+
}, [n, e]);
|
|
117
|
+
return d(() => {
|
|
118
|
+
m();
|
|
119
|
+
}, [m]), {
|
|
107
120
|
tracking: a,
|
|
108
121
|
order: i,
|
|
109
122
|
isLoading: s,
|
|
110
|
-
error:
|
|
111
|
-
refetch: () => void
|
|
123
|
+
error: l,
|
|
124
|
+
refetch: () => void m()
|
|
112
125
|
};
|
|
113
126
|
}
|
|
114
|
-
function
|
|
115
|
-
let { vehicle: t, isLoading: n, error: r, refetch: i } =
|
|
127
|
+
function S(e) {
|
|
128
|
+
let { vehicle: t, isLoading: n, error: r, refetch: i } = c(e);
|
|
116
129
|
return {
|
|
117
|
-
tracking:
|
|
130
|
+
tracking: f(() => !t || !t.currentLocation ? null : {
|
|
118
131
|
id: `vehicle-track-${t.id}`,
|
|
119
132
|
entityId: t.id,
|
|
120
133
|
entityType: "vehicle",
|
|
@@ -130,10 +143,10 @@ function x(e) {
|
|
|
130
143
|
refetch: i
|
|
131
144
|
};
|
|
132
145
|
}
|
|
133
|
-
function
|
|
134
|
-
let { driver: t, isLoading: n, error: r, refetch:
|
|
146
|
+
function C(e) {
|
|
147
|
+
let { driver: t, isLoading: n, error: r, refetch: i } = o(e);
|
|
135
148
|
return {
|
|
136
|
-
tracking:
|
|
149
|
+
tracking: f(() => !t || !t.currentLocation ? null : {
|
|
137
150
|
id: `driver-track-${t.id}`,
|
|
138
151
|
entityId: t.id,
|
|
139
152
|
entityType: "driver",
|
|
@@ -146,49 +159,48 @@ function S(e) {
|
|
|
146
159
|
driver: t,
|
|
147
160
|
isLoading: n,
|
|
148
161
|
error: r,
|
|
149
|
-
refetch:
|
|
162
|
+
refetch: i
|
|
150
163
|
};
|
|
151
164
|
}
|
|
152
|
-
function
|
|
153
|
-
let e =
|
|
154
|
-
|
|
165
|
+
function w() {
|
|
166
|
+
let e = y(), [r, o] = p([]), [s, c] = p(!1), [l, f] = p(null), m = u(async () => {
|
|
167
|
+
c(!0), f(null);
|
|
155
168
|
try {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
169
|
+
o(((await t(e, g, { pagination: {
|
|
170
|
+
limit: 100,
|
|
171
|
+
offset: 0
|
|
172
|
+
} })).activeDeliveries ?? []).map((e) => {
|
|
173
|
+
let t = e.deliveryJob;
|
|
174
|
+
if (!t) return null;
|
|
175
|
+
let r = e.trackingEvents?.[0];
|
|
176
|
+
return {
|
|
177
|
+
order: n(t),
|
|
178
|
+
driver: t.driver ? i(t.driver) : null,
|
|
179
|
+
vehicle: t.vehicle ? a(t.vehicle) : null,
|
|
180
|
+
tracking: r ? v(r, t.id) : null,
|
|
181
|
+
estimatedArrival: e.estimatedDelivery ? new Date(e.estimatedDelivery) : void 0
|
|
182
|
+
};
|
|
183
|
+
}).filter((e) => e !== null));
|
|
167
184
|
} catch (e) {
|
|
168
|
-
|
|
185
|
+
f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load live tracking"));
|
|
169
186
|
} finally {
|
|
170
|
-
|
|
187
|
+
c(!1);
|
|
171
188
|
}
|
|
172
|
-
}, [
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}, [x]), {
|
|
181
|
-
activeDeliveries: u,
|
|
182
|
-
isLoading: m,
|
|
183
|
-
error: y,
|
|
184
|
-
refetch: () => void x()
|
|
189
|
+
}, [e]);
|
|
190
|
+
return d(() => {
|
|
191
|
+
m();
|
|
192
|
+
}, [m]), {
|
|
193
|
+
activeDeliveries: r,
|
|
194
|
+
isLoading: s,
|
|
195
|
+
error: l,
|
|
196
|
+
refetch: () => void m()
|
|
185
197
|
};
|
|
186
198
|
}
|
|
187
|
-
function
|
|
188
|
-
let e =
|
|
199
|
+
function T() {
|
|
200
|
+
let e = y(), [n, r] = p([]), [i, a] = p(!1), [o, s] = p(null), c = u(async () => {
|
|
189
201
|
a(!0), s(null);
|
|
190
202
|
try {
|
|
191
|
-
r((await t(e,
|
|
203
|
+
r((await t(e, _)).trackingAlerts.map((e) => ({
|
|
192
204
|
id: `${e.shipmentId}-${e.alertType}`,
|
|
193
205
|
type: "delay",
|
|
194
206
|
severity: "medium",
|
|
@@ -202,12 +214,12 @@ function w() {
|
|
|
202
214
|
a(!1);
|
|
203
215
|
}
|
|
204
216
|
}, [e]);
|
|
205
|
-
return
|
|
206
|
-
|
|
207
|
-
}, [
|
|
217
|
+
return d(() => {
|
|
218
|
+
c();
|
|
219
|
+
}, [c]), {
|
|
208
220
|
alerts: n,
|
|
209
|
-
unacknowledgedAlerts:
|
|
210
|
-
acknowledgeAlert:
|
|
221
|
+
unacknowledgedAlerts: f(() => n.filter((e) => !e.acknowledged), [n]),
|
|
222
|
+
acknowledgeAlert: u(async (e) => {
|
|
211
223
|
r((t) => t.map((t) => t.id === e ? {
|
|
212
224
|
...t,
|
|
213
225
|
acknowledged: !0
|
|
@@ -215,17 +227,17 @@ function w() {
|
|
|
215
227
|
}, []),
|
|
216
228
|
isLoading: i,
|
|
217
229
|
error: o,
|
|
218
|
-
refetch: () => void
|
|
230
|
+
refetch: () => void c()
|
|
219
231
|
};
|
|
220
232
|
}
|
|
221
|
-
function
|
|
222
|
-
let { vehicles: n } =
|
|
233
|
+
function E(e, t) {
|
|
234
|
+
let { vehicles: n } = l(), { drivers: r } = s();
|
|
223
235
|
return {
|
|
224
|
-
entitiesInRange:
|
|
236
|
+
entitiesInRange: f(() => {
|
|
225
237
|
let i = [];
|
|
226
238
|
return n.forEach((n) => {
|
|
227
239
|
if (!n.currentLocation) return;
|
|
228
|
-
let r =
|
|
240
|
+
let r = D(e.latitude, e.longitude, n.currentLocation.latitude, n.currentLocation.longitude);
|
|
229
241
|
r <= t && i.push({
|
|
230
242
|
type: "vehicle",
|
|
231
243
|
entity: n,
|
|
@@ -233,7 +245,7 @@ function T(e, t) {
|
|
|
233
245
|
});
|
|
234
246
|
}), r.forEach((n) => {
|
|
235
247
|
if (!n.currentLocation) return;
|
|
236
|
-
let r =
|
|
248
|
+
let r = D(e.latitude, e.longitude, n.currentLocation.latitude, n.currentLocation.longitude);
|
|
237
249
|
r <= t && i.push({
|
|
238
250
|
type: "driver",
|
|
239
251
|
entity: n,
|
|
@@ -251,12 +263,12 @@ function T(e, t) {
|
|
|
251
263
|
error: null
|
|
252
264
|
};
|
|
253
265
|
}
|
|
254
|
-
function
|
|
255
|
-
let i =
|
|
266
|
+
function D(e, t, n, r) {
|
|
267
|
+
let i = O(n - e), a = O(r - t), o = Math.sin(i / 2) * Math.sin(i / 2) + Math.cos(O(e)) * Math.cos(O(n)) * Math.sin(a / 2) * Math.sin(a / 2);
|
|
256
268
|
return 6371 * (2 * Math.atan2(Math.sqrt(o), Math.sqrt(1 - o)));
|
|
257
269
|
}
|
|
258
|
-
function
|
|
270
|
+
function O(e) {
|
|
259
271
|
return Math.PI / 180 * e;
|
|
260
272
|
}
|
|
261
273
|
//#endregion
|
|
262
|
-
export {
|
|
274
|
+
export { C as useDriverTracking, E as useGeofence, w as useLiveTracking, x as useOrderTracking, b as useTracking, T as useTrackingAlerts, S as useVehicleTracking };
|
|
@@ -11,7 +11,9 @@ interface CustomerPickerProps {
|
|
|
11
11
|
onRetry: () => void;
|
|
12
12
|
onOpenCustomers?: () => void;
|
|
13
13
|
selectedCustomer?: Customer | null;
|
|
14
|
+
searchQuery?: string;
|
|
15
|
+
onSearchQueryChange?: (query: string) => void;
|
|
14
16
|
disabled?: boolean;
|
|
15
17
|
}
|
|
16
|
-
export declare function CustomerPicker({ customers, value, onValueChange, onCreated, createCustomer, isLoading, error, onRetry, onOpenCustomers, selectedCustomer, disabled, }: CustomerPickerProps): import("react").JSX.Element;
|
|
18
|
+
export declare function CustomerPicker({ customers, value, onValueChange, onCreated, createCustomer, isLoading, error, onRetry, onOpenCustomers, selectedCustomer, searchQuery, onSearchQueryChange, disabled, }: CustomerPickerProps): import("react").JSX.Element;
|
|
17
19
|
export {};
|
|
@@ -25,6 +25,10 @@ interface DataTableProps<T> {
|
|
|
25
25
|
searchable?: boolean;
|
|
26
26
|
searchPlaceholder?: string;
|
|
27
27
|
searchFields?: (keyof T)[];
|
|
28
|
+
/** Controlled search query for server-side filtering. */
|
|
29
|
+
searchQuery?: string;
|
|
30
|
+
/** Called when the search input changes; disables current-page filtering. */
|
|
31
|
+
onSearchQueryChange?: (query: string) => void;
|
|
28
32
|
pagination?: boolean;
|
|
29
33
|
pageSize?: number;
|
|
30
34
|
pageSizeOptions?: number[];
|
|
@@ -63,5 +67,5 @@ interface DataTableProps<T> {
|
|
|
63
67
|
* DataTable - A reusable data table component with sorting, search, and both
|
|
64
68
|
* client-side and controlled (server-side) pagination.
|
|
65
69
|
*/
|
|
66
|
-
export declare function DataTable<T extends object>({ columns, data, isLoading, error, onRetry, searchable, searchPlaceholder, searchFields, pagination, pageSize: pageSizeProp, pageSizeOptions, onRowClick, rowClassName, emptyMessage, emptyIllustration, emptyTitle, emptyDescription, emptyAction, className, getRowId, pageIndex, onPageChange, onPageSizeChange, totalItems, hasNextPage, }: DataTableProps<T>): import("react").JSX.Element;
|
|
70
|
+
export declare function DataTable<T extends object>({ columns, data, isLoading, error, onRetry, searchable, searchPlaceholder, searchFields, searchQuery: controlledSearchQuery, onSearchQueryChange, pagination, pageSize: pageSizeProp, pageSizeOptions, onRowClick, rowClassName, emptyMessage, emptyIllustration, emptyTitle, emptyDescription, emptyAction, className, getRowId, pageIndex, onPageChange, onPageSizeChange, totalItems, hasNextPage, }: DataTableProps<T>): import("react").JSX.Element;
|
|
67
71
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDebouncedValue<T>(value: T, delay?: number): T;
|
|
@@ -39,9 +39,11 @@ export interface EntityDocument {
|
|
|
39
39
|
}
|
|
40
40
|
interface UseEntityDocumentsResult {
|
|
41
41
|
documents: EntityDocument[];
|
|
42
|
+
hasMore: boolean;
|
|
42
43
|
isLoading: boolean;
|
|
43
44
|
error: Error | null;
|
|
44
45
|
refetch: () => void;
|
|
46
|
+
loadMore: () => void;
|
|
45
47
|
}
|
|
46
48
|
export declare function useEntityDocuments(entityType: EntityDocumentType, entityId: string | undefined): UseEntityDocumentsResult;
|
|
47
49
|
export {};
|
|
@@ -18,8 +18,13 @@ export interface PendingEpodDeliveryJob {
|
|
|
18
18
|
customerPhone?: string;
|
|
19
19
|
}
|
|
20
20
|
/** Type C self-list: the CALLING driver's own jobs still awaiting ePOD capture — feeds the capture flow's job picker. */
|
|
21
|
-
export declare function useMyPendingEpodDeliveryJobs(
|
|
21
|
+
export declare function useMyPendingEpodDeliveryJobs(options?: {
|
|
22
|
+
limit?: number;
|
|
23
|
+
offset?: number;
|
|
24
|
+
}): {
|
|
22
25
|
jobs: PendingEpodDeliveryJob[];
|
|
26
|
+
totalJobs: number;
|
|
27
|
+
hasMore: boolean;
|
|
23
28
|
isLoading: boolean;
|
|
24
29
|
error: Error | null;
|
|
25
30
|
refetch: () => Promise<void>;
|
|
@@ -2,6 +2,7 @@ import { Driver, DriverStatus, FleetFilter, Vehicle, VehicleStatus } from '../ty
|
|
|
2
2
|
|
|
3
3
|
interface UseFleetOptions {
|
|
4
4
|
filters?: FleetFilter;
|
|
5
|
+
limit?: number;
|
|
5
6
|
}
|
|
6
7
|
export interface CreateVehicleInput {
|
|
7
8
|
vehicleNumber: string;
|
|
@@ -32,11 +33,55 @@ interface UseFleetResult {
|
|
|
32
33
|
updateVehicle: (id: string, input: CreateVehicleInput) => Promise<Vehicle>;
|
|
33
34
|
updateDriver: (id: string, input: CreateDriverInput) => Promise<Driver>;
|
|
34
35
|
}
|
|
36
|
+
export interface ApiVehicle {
|
|
37
|
+
id: string;
|
|
38
|
+
vehicleNumber: string;
|
|
39
|
+
type: string;
|
|
40
|
+
make?: string | null;
|
|
41
|
+
model?: string | null;
|
|
42
|
+
licensePlate?: string | null;
|
|
43
|
+
ownershipType?: string | null;
|
|
44
|
+
year?: number | null;
|
|
45
|
+
capacity?: Record<string, unknown> | null;
|
|
46
|
+
status: string;
|
|
47
|
+
currentLocation?: Record<string, unknown> | null;
|
|
48
|
+
fuelLevel?: number | null;
|
|
49
|
+
mileage?: number | null;
|
|
50
|
+
lastServiceDate?: string | null;
|
|
51
|
+
nextServiceDueDate?: string | null;
|
|
52
|
+
nextServiceDueMileage?: number | null;
|
|
53
|
+
createdAt: string;
|
|
54
|
+
updatedAt?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ApiDriver {
|
|
57
|
+
id: string;
|
|
58
|
+
userId?: string | null;
|
|
59
|
+
firstName: string;
|
|
60
|
+
lastName: string;
|
|
61
|
+
email?: string | null;
|
|
62
|
+
phone?: string | null;
|
|
63
|
+
employeeId: string;
|
|
64
|
+
licenseNumber?: string | null;
|
|
65
|
+
licenseClass?: string | null;
|
|
66
|
+
licenseExpiry?: string | null;
|
|
67
|
+
status: string;
|
|
68
|
+
currentLocation?: Record<string, unknown> | null;
|
|
69
|
+
rating?: number | null;
|
|
70
|
+
vehicleId?: string | null;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
}
|
|
73
|
+
export declare function mapVehicle(vehicle: ApiVehicle): Vehicle;
|
|
74
|
+
export declare function mapDriver(driver: ApiDriver): Driver;
|
|
35
75
|
export declare function useFleet(options?: UseFleetOptions): UseFleetResult;
|
|
36
76
|
interface UseListOptions {
|
|
37
77
|
limit?: number;
|
|
38
78
|
offset?: number;
|
|
39
79
|
}
|
|
80
|
+
interface UseVehiclesOptions extends UseListOptions {
|
|
81
|
+
search?: string;
|
|
82
|
+
status?: VehicleStatus;
|
|
83
|
+
vehicleType?: Vehicle['type'];
|
|
84
|
+
}
|
|
40
85
|
interface UseVehiclesResult {
|
|
41
86
|
vehicles: Vehicle[];
|
|
42
87
|
totalVehicles: number;
|
|
@@ -48,7 +93,7 @@ interface UseVehiclesResult {
|
|
|
48
93
|
updateVehicleStatus: (id: string, status: VehicleStatus) => Promise<Vehicle>;
|
|
49
94
|
assignDriver: (vehicleId: string, driverId: string) => Promise<Vehicle>;
|
|
50
95
|
}
|
|
51
|
-
export declare function useVehicles(options?:
|
|
96
|
+
export declare function useVehicles(options?: UseVehiclesOptions): UseVehiclesResult;
|
|
52
97
|
export declare function useVehicle(vehicleId: string | undefined): {
|
|
53
98
|
vehicle: Vehicle | null;
|
|
54
99
|
isLoading: boolean;
|
|
@@ -67,11 +112,10 @@ interface UseDriversResult {
|
|
|
67
112
|
assignVehicle: (driverId: string, vehicleId: string) => Promise<Driver>;
|
|
68
113
|
}
|
|
69
114
|
interface UseDriversOptions extends UseListOptions {
|
|
70
|
-
/**
|
|
71
|
-
* Narrows the roster server-side via `DriverFilterInput.status` so the pager
|
|
72
|
-
* still counts whole result sets rather than filtering one fetched page.
|
|
73
|
-
*/
|
|
115
|
+
/** Narrows the roster server-side via DriverFilterInput.status. */
|
|
74
116
|
status?: DriverStatus;
|
|
117
|
+
search?: string;
|
|
118
|
+
licenseClass?: string;
|
|
75
119
|
}
|
|
76
120
|
export declare function useDrivers(options?: UseDriversOptions): UseDriversResult;
|
|
77
121
|
export declare function useDriver(driverId: string | undefined): {
|
|
@@ -2,6 +2,9 @@ import { Inventory, InventoryFilter, Product, Warehouse } from '../types';
|
|
|
2
2
|
|
|
3
3
|
interface UseInventoryOptions {
|
|
4
4
|
filters?: InventoryFilter;
|
|
5
|
+
search?: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
offset?: number;
|
|
5
8
|
}
|
|
6
9
|
export interface CreateProductInput {
|
|
7
10
|
name: string;
|
|
@@ -26,9 +29,11 @@ export interface CreateWarehouseInput {
|
|
|
26
29
|
}
|
|
27
30
|
interface UseInventoryResult {
|
|
28
31
|
inventory: Inventory[];
|
|
32
|
+
lowStockItems: Inventory[];
|
|
29
33
|
products: Product[];
|
|
30
34
|
warehouses: Warehouse[];
|
|
31
35
|
totalItems: number;
|
|
36
|
+
hasMore: boolean;
|
|
32
37
|
isLoading: boolean;
|
|
33
38
|
error: Error | null;
|
|
34
39
|
refetch: () => void;
|
|
@@ -44,7 +49,14 @@ interface UseListOptions {
|
|
|
44
49
|
limit?: number;
|
|
45
50
|
offset?: number;
|
|
46
51
|
}
|
|
47
|
-
|
|
52
|
+
interface UseProductsOptions extends UseListOptions {
|
|
53
|
+
search?: string;
|
|
54
|
+
category?: string;
|
|
55
|
+
}
|
|
56
|
+
interface UseWarehousesOptions extends UseListOptions {
|
|
57
|
+
search?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare function useProducts(options?: UseProductsOptions): {
|
|
48
60
|
products: Product[];
|
|
49
61
|
totalProducts: number;
|
|
50
62
|
hasMore: boolean;
|
|
@@ -52,14 +64,7 @@ export declare function useProducts(options?: UseListOptions): {
|
|
|
52
64
|
error: Error | null;
|
|
53
65
|
refetch: () => undefined;
|
|
54
66
|
};
|
|
55
|
-
|
|
56
|
-
* Bounded aggregate for the Products page "at a glance" tiles. Fetches up to
|
|
57
|
-
* `sampleSize` products (independent of the paginated list) and computes the
|
|
58
|
-
* special-handling / temperature-controlled counts so the tiles never reflect
|
|
59
|
-
* a single truncated page. There is no product *Count field on the frozen
|
|
60
|
-
* supergraph, so this bounded sample is the aggregate source.
|
|
61
|
-
*/
|
|
62
|
-
export declare function useProductStats(sampleSize?: number): {
|
|
67
|
+
export declare function useProductStats(): {
|
|
63
68
|
stats: {
|
|
64
69
|
total: number;
|
|
65
70
|
specialHandling: number;
|
|
@@ -74,7 +79,7 @@ export declare function useProduct(productId: string | undefined): {
|
|
|
74
79
|
error: Error | null;
|
|
75
80
|
refetch: () => undefined;
|
|
76
81
|
};
|
|
77
|
-
export declare function useWarehouses(options?:
|
|
82
|
+
export declare function useWarehouses(options?: UseWarehousesOptions): {
|
|
78
83
|
warehouses: Warehouse[];
|
|
79
84
|
totalWarehouses: number;
|
|
80
85
|
hasMore: boolean;
|
|
@@ -82,12 +87,7 @@ export declare function useWarehouses(options?: UseListOptions): {
|
|
|
82
87
|
error: Error | null;
|
|
83
88
|
refetch: () => undefined;
|
|
84
89
|
};
|
|
85
|
-
|
|
86
|
-
* Bounded aggregate for the Warehouses page "at a glance" tiles — fetches up to
|
|
87
|
-
* `sampleSize` warehouses (independent of the paginated list) so the active /
|
|
88
|
-
* avg-utilization tiles never reflect a single truncated page.
|
|
89
|
-
*/
|
|
90
|
-
export declare function useWarehouseStats(sampleSize?: number): {
|
|
90
|
+
export declare function useWarehouseStats(): {
|
|
91
91
|
stats: {
|
|
92
92
|
total: number;
|
|
93
93
|
active: number;
|
|
@@ -140,9 +140,16 @@ export interface ProductStockLevel {
|
|
|
140
140
|
damaged: number;
|
|
141
141
|
reorderPoint?: number;
|
|
142
142
|
}
|
|
143
|
+
interface ProductStockLevelOptions {
|
|
144
|
+
limit?: number;
|
|
145
|
+
offset?: number;
|
|
146
|
+
}
|
|
143
147
|
/** Where a catalog item is stocked, and how much of it is free to promise. */
|
|
144
|
-
export declare function useProductStockLevels(productId: string | undefined): {
|
|
148
|
+
export declare function useProductStockLevels(productId: string | undefined, options?: ProductStockLevelOptions): {
|
|
145
149
|
levels: ProductStockLevel[];
|
|
150
|
+
totalLevels: number;
|
|
151
|
+
totalAvailable: number;
|
|
152
|
+
hasMore: boolean;
|
|
146
153
|
isLoading: boolean;
|
|
147
154
|
error: Error | null;
|
|
148
155
|
refetch: () => void;
|
|
@@ -56,8 +56,13 @@ export interface MultiModalShipment {
|
|
|
56
56
|
createdAt: string;
|
|
57
57
|
legs: ShipmentLeg[];
|
|
58
58
|
}
|
|
59
|
-
export declare function useMultiModalShipments(
|
|
59
|
+
export declare function useMultiModalShipments(options?: {
|
|
60
|
+
limit?: number;
|
|
61
|
+
offset?: number;
|
|
62
|
+
}): {
|
|
60
63
|
shipments: MultiModalShipment[];
|
|
64
|
+
totalShipments: number;
|
|
65
|
+
hasMore: boolean;
|
|
61
66
|
isLoading: boolean;
|
|
62
67
|
error: Error | null;
|
|
63
68
|
refetch: () => undefined;
|
|
@@ -18,11 +18,7 @@ export type OrderWriteInput = Omit<Partial<Order>, 'scheduledDelivery'> & {
|
|
|
18
18
|
interface UseOrdersResult {
|
|
19
19
|
orders: Order[];
|
|
20
20
|
totalOrders: number;
|
|
21
|
-
/**
|
|
22
|
-
* True when the most recent fetch returned a full page (rawCount === limit),
|
|
23
|
-
* i.e. there may be another page. Used for offset pagers where no grand
|
|
24
|
-
* total is available.
|
|
25
|
-
*/
|
|
21
|
+
/** True when the most recent fetch has another server page. */
|
|
26
22
|
hasMore: boolean;
|
|
27
23
|
isLoading: boolean;
|
|
28
24
|
error: Error | null;
|
|
@@ -32,6 +28,37 @@ interface UseOrdersResult {
|
|
|
32
28
|
deleteOrder: (id: string) => Promise<void>;
|
|
33
29
|
updateOrderStatus: (id: string, status: OrderStatus) => Promise<Order>;
|
|
34
30
|
}
|
|
31
|
+
export interface ApiOrder {
|
|
32
|
+
id: string;
|
|
33
|
+
deliveryJobNumber: string;
|
|
34
|
+
customerId: string;
|
|
35
|
+
status: string;
|
|
36
|
+
priority: string;
|
|
37
|
+
pickupAddress: Record<string, unknown> | null;
|
|
38
|
+
deliveryAddress: Record<string, unknown> | null;
|
|
39
|
+
cargoItems: unknown;
|
|
40
|
+
pricing: unknown;
|
|
41
|
+
trackingNumber?: string | null;
|
|
42
|
+
specialInstructions?: string | null;
|
|
43
|
+
scheduledDelivery?: string | null;
|
|
44
|
+
vehicleId?: string | null;
|
|
45
|
+
driverId?: string | null;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
updatedAt: string;
|
|
48
|
+
customer?: {
|
|
49
|
+
name?: string | null;
|
|
50
|
+
email?: string | null;
|
|
51
|
+
phone?: string | null;
|
|
52
|
+
company?: string | null;
|
|
53
|
+
} | null;
|
|
54
|
+
statusHistory?: Array<{
|
|
55
|
+
status: string;
|
|
56
|
+
notes?: string | null;
|
|
57
|
+
location?: Record<string, unknown> | null;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
createdBy?: string | null;
|
|
60
|
+
}>;
|
|
61
|
+
}
|
|
35
62
|
/**
|
|
36
63
|
* Normalises a service `DeliveryJobStatus` into the MFE's OrderStatus union.
|
|
37
64
|
* Exported so any surface rendering a raw job status badge normalises it the
|
|
@@ -45,6 +72,7 @@ export declare function mapOrderStatus(status: string): OrderStatus;
|
|
|
45
72
|
* no direct badge entry, so rendering the raw value would break the colour map.
|
|
46
73
|
*/
|
|
47
74
|
export declare function mapOrderPriority(priority: string): 'low' | 'normal' | 'high' | 'urgent';
|
|
75
|
+
export declare function mapOrder(order: ApiOrder): Order;
|
|
48
76
|
export declare function useOrders(options?: UseOrdersOptions): UseOrdersResult;
|
|
49
77
|
export declare function useOrder(orderId: string | undefined): {
|
|
50
78
|
order: Order | null;
|
|
@@ -4,13 +4,14 @@ interface UseRoutesOptions {
|
|
|
4
4
|
driverId?: string;
|
|
5
5
|
vehicleId?: string;
|
|
6
6
|
status?: 'planned' | 'in_progress' | 'completed' | 'cancelled';
|
|
7
|
+
search?: string;
|
|
7
8
|
limit?: number;
|
|
8
9
|
offset?: number;
|
|
9
10
|
}
|
|
10
11
|
interface UseRoutesResult {
|
|
11
12
|
routes: Route[];
|
|
12
13
|
totalRoutes: number;
|
|
13
|
-
/** True when the last fetch
|
|
14
|
+
/** True when the last fetch has another server page. */
|
|
14
15
|
hasMore: boolean;
|
|
15
16
|
isLoading: boolean;
|
|
16
17
|
error: Error | null;
|