@burdenoff/microfe-movethewheels 2026.920.3 → 2026.923.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 +2719 -8
- package/dist/hooks/index.js +1 -1
- 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 +148 -125
- package/dist/hooks/useInventory.js +255 -186
- package/dist/hooks/useMultiModalShipments.js +35 -27
- package/dist/hooks/useOrders.js +139 -134
- package/dist/hooks/useRoutes.js +97 -75
- package/dist/hooks/useTracking.js +100 -88
- package/dist/index.js +6 -6
- 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 +48 -5
- package/dist/movethewheels/hooks/useRoutes.d.ts +18 -1
- package/dist/movethewheels/hooks/useTracking.d.ts +12 -11
- package/dist/movethewheels/types/index.d.ts +12 -5
- package/dist/pages/CreateOrderPage.js +191 -129
- 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 +190 -106
- 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 +324 -293
- 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 +3136 -8
- 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 +66 -38
- 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 +48 -14
- package/src/movethewheels/hooks/useRoutes.ts +81 -24
- package/src/movethewheels/hooks/useTracking.ts +130 -98
- package/src/movethewheels/pages/CreateOrderPage.tsx +93 -2
- 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 +91 -6
- 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 +45 -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 +12 -5
|
@@ -5,6 +5,7 @@ import { executeGraphQL } from '../utils/graphqlClient';
|
|
|
5
5
|
|
|
6
6
|
interface UseFleetOptions {
|
|
7
7
|
filters?: FleetFilter;
|
|
8
|
+
limit?: number;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export interface CreateVehicleInput {
|
|
@@ -39,7 +40,7 @@ interface UseFleetResult {
|
|
|
39
40
|
updateDriver: (id: string, input: CreateDriverInput) => Promise<Driver>;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
interface ApiVehicle {
|
|
43
|
+
export interface ApiVehicle {
|
|
43
44
|
id: string;
|
|
44
45
|
vehicleNumber: string;
|
|
45
46
|
type: string;
|
|
@@ -60,7 +61,7 @@ interface ApiVehicle {
|
|
|
60
61
|
updatedAt?: string;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
interface ApiDriver {
|
|
64
|
+
export interface ApiDriver {
|
|
64
65
|
id: string;
|
|
65
66
|
userId?: string | null;
|
|
66
67
|
firstName: string;
|
|
@@ -100,6 +101,7 @@ const LIST_VEHICLES_QUERY = `
|
|
|
100
101
|
createdAt
|
|
101
102
|
updatedAt
|
|
102
103
|
}
|
|
104
|
+
vehiclesCount(filter: $filter)
|
|
103
105
|
}
|
|
104
106
|
`;
|
|
105
107
|
|
|
@@ -122,6 +124,7 @@ const LIST_DRIVERS_QUERY = `
|
|
|
122
124
|
vehicleId
|
|
123
125
|
createdAt
|
|
124
126
|
}
|
|
127
|
+
driversCount(filter: $filter)
|
|
125
128
|
}
|
|
126
129
|
`;
|
|
127
130
|
|
|
@@ -408,7 +411,7 @@ function toApiDriverStatus(status: DriverStatus): string {
|
|
|
408
411
|
}
|
|
409
412
|
}
|
|
410
413
|
|
|
411
|
-
function mapVehicle(vehicle: ApiVehicle): Vehicle {
|
|
414
|
+
export function mapVehicle(vehicle: ApiVehicle): Vehicle {
|
|
412
415
|
return {
|
|
413
416
|
id: vehicle.id,
|
|
414
417
|
vehicleNumber: vehicle.vehicleNumber,
|
|
@@ -443,7 +446,7 @@ function mapVehicle(vehicle: ApiVehicle): Vehicle {
|
|
|
443
446
|
};
|
|
444
447
|
}
|
|
445
448
|
|
|
446
|
-
function mapDriver(driver: ApiDriver): Driver {
|
|
449
|
+
export function mapDriver(driver: ApiDriver): Driver {
|
|
447
450
|
return {
|
|
448
451
|
id: driver.id,
|
|
449
452
|
userId: driver.userId ?? driver.id,
|
|
@@ -524,13 +527,19 @@ function useGraphqlOptions() {
|
|
|
524
527
|
}
|
|
525
528
|
|
|
526
529
|
export function useFleet(options: UseFleetOptions = {}): UseFleetResult {
|
|
527
|
-
const { filters: rawFilters } = options;
|
|
530
|
+
const { filters: rawFilters, limit = 20 } = options;
|
|
528
531
|
// Stabilize the filters reference by its primitive fields so React Compiler's
|
|
529
532
|
// inferred `filters` dependency stays stable and `load` is not recreated (and
|
|
530
533
|
// refetched) every render when the caller passes an inline filters object.
|
|
531
534
|
const filters = useMemo(
|
|
532
535
|
() => rawFilters,
|
|
533
|
-
[
|
|
536
|
+
[
|
|
537
|
+
rawFilters?.driverId,
|
|
538
|
+
rawFilters?.search,
|
|
539
|
+
rawFilters?.status,
|
|
540
|
+
rawFilters?.vehicleId,
|
|
541
|
+
rawFilters?.vehicleType,
|
|
542
|
+
]
|
|
534
543
|
);
|
|
535
544
|
const graphQLOptions = useGraphqlOptions();
|
|
536
545
|
const [vehicles, setVehicles] = useState<Vehicle[]>([]);
|
|
@@ -545,16 +554,19 @@ export function useFleet(options: UseFleetOptions = {}): UseFleetResult {
|
|
|
545
554
|
const [vehicleData, driverData] = await Promise.all([
|
|
546
555
|
executeGraphQL<{ vehicles: ApiVehicle[] }>(graphQLOptions, LIST_VEHICLES_QUERY, {
|
|
547
556
|
filter: {
|
|
557
|
+
search: filters?.search,
|
|
548
558
|
type: filters?.vehicleType?.toUpperCase(),
|
|
549
559
|
status: filters?.status ? toApiVehicleStatus(filters.status) : undefined,
|
|
560
|
+
driverId: filters?.driverId,
|
|
550
561
|
},
|
|
551
|
-
pagination: { limit
|
|
562
|
+
pagination: { limit, offset: 0 },
|
|
552
563
|
}),
|
|
553
564
|
executeGraphQL<{ drivers: ApiDriver[] }>(graphQLOptions, LIST_DRIVERS_QUERY, {
|
|
554
565
|
filter: {
|
|
555
|
-
|
|
566
|
+
search: filters?.search,
|
|
567
|
+
vehicleId: filters?.vehicleId,
|
|
556
568
|
},
|
|
557
|
-
pagination: { limit
|
|
569
|
+
pagination: { limit, offset: 0 },
|
|
558
570
|
}),
|
|
559
571
|
]);
|
|
560
572
|
|
|
@@ -565,7 +577,7 @@ export function useFleet(options: UseFleetOptions = {}): UseFleetResult {
|
|
|
565
577
|
} finally {
|
|
566
578
|
setIsLoading(false);
|
|
567
579
|
}
|
|
568
|
-
}, [filters, graphQLOptions]);
|
|
580
|
+
}, [filters, graphQLOptions, limit]);
|
|
569
581
|
|
|
570
582
|
useEffect(() => {
|
|
571
583
|
void load();
|
|
@@ -686,6 +698,12 @@ interface UseListOptions {
|
|
|
686
698
|
offset?: number;
|
|
687
699
|
}
|
|
688
700
|
|
|
701
|
+
interface UseVehiclesOptions extends UseListOptions {
|
|
702
|
+
search?: string;
|
|
703
|
+
status?: VehicleStatus;
|
|
704
|
+
vehicleType?: Vehicle['type'];
|
|
705
|
+
}
|
|
706
|
+
|
|
689
707
|
interface UseVehiclesResult {
|
|
690
708
|
vehicles: Vehicle[];
|
|
691
709
|
totalVehicles: number;
|
|
@@ -698,10 +716,11 @@ interface UseVehiclesResult {
|
|
|
698
716
|
assignDriver: (vehicleId: string, driverId: string) => Promise<Vehicle>;
|
|
699
717
|
}
|
|
700
718
|
|
|
701
|
-
export function useVehicles(options:
|
|
702
|
-
const { limit =
|
|
719
|
+
export function useVehicles(options: UseVehiclesOptions = {}): UseVehiclesResult {
|
|
720
|
+
const { limit = 20, offset = 0, search, status, vehicleType } = options;
|
|
703
721
|
const graphQLOptions = useGraphqlOptions();
|
|
704
722
|
const [vehicles, setVehicles] = useState<Vehicle[]>([]);
|
|
723
|
+
const [totalVehicles, setTotalVehicles] = useState(0);
|
|
705
724
|
const [hasMore, setHasMore] = useState(false);
|
|
706
725
|
const [isLoading, setIsLoading] = useState(false);
|
|
707
726
|
const [error, setError] = useState<Error | null>(null);
|
|
@@ -710,21 +729,26 @@ export function useVehicles(options: UseListOptions = {}): UseVehiclesResult {
|
|
|
710
729
|
setIsLoading(true);
|
|
711
730
|
setError(null);
|
|
712
731
|
try {
|
|
713
|
-
const data = await executeGraphQL<{
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
732
|
+
const data = await executeGraphQL<{
|
|
733
|
+
vehicles: ApiVehicle[];
|
|
734
|
+
vehiclesCount: number;
|
|
735
|
+
}>(graphQLOptions, LIST_VEHICLES_QUERY, {
|
|
736
|
+
filter: {
|
|
737
|
+
search: search || undefined,
|
|
738
|
+
status: status ? toApiVehicleStatus(status) : undefined,
|
|
739
|
+
type: vehicleType?.toUpperCase(),
|
|
740
|
+
},
|
|
741
|
+
pagination: { limit, offset },
|
|
742
|
+
});
|
|
743
|
+
setHasMore(offset + data.vehicles.length < data.vehiclesCount);
|
|
744
|
+
setTotalVehicles(data.vehiclesCount);
|
|
721
745
|
setVehicles(data.vehicles.map(mapVehicle));
|
|
722
746
|
} catch (fetchError) {
|
|
723
747
|
setError(fetchError instanceof Error ? fetchError : new Error('Failed to load vehicles'));
|
|
724
748
|
} finally {
|
|
725
749
|
setIsLoading(false);
|
|
726
750
|
}
|
|
727
|
-
}, [graphQLOptions, limit, offset]);
|
|
751
|
+
}, [graphQLOptions, limit, offset, search, status, vehicleType]);
|
|
728
752
|
|
|
729
753
|
useEffect(() => {
|
|
730
754
|
void load();
|
|
@@ -774,7 +798,7 @@ export function useVehicles(options: UseListOptions = {}): UseVehiclesResult {
|
|
|
774
798
|
|
|
775
799
|
return {
|
|
776
800
|
vehicles,
|
|
777
|
-
totalVehicles
|
|
801
|
+
totalVehicles,
|
|
778
802
|
hasMore,
|
|
779
803
|
isLoading,
|
|
780
804
|
error,
|
|
@@ -838,17 +862,17 @@ interface UseDriversResult {
|
|
|
838
862
|
}
|
|
839
863
|
|
|
840
864
|
interface UseDriversOptions extends UseListOptions {
|
|
841
|
-
/**
|
|
842
|
-
* Narrows the roster server-side via `DriverFilterInput.status` so the pager
|
|
843
|
-
* still counts whole result sets rather than filtering one fetched page.
|
|
844
|
-
*/
|
|
865
|
+
/** Narrows the roster server-side via DriverFilterInput.status. */
|
|
845
866
|
status?: DriverStatus;
|
|
867
|
+
search?: string;
|
|
868
|
+
licenseClass?: string;
|
|
846
869
|
}
|
|
847
870
|
|
|
848
871
|
export function useDrivers(options: UseDriversOptions = {}): UseDriversResult {
|
|
849
|
-
const { limit =
|
|
872
|
+
const { limit = 20, offset = 0, status, search, licenseClass } = options;
|
|
850
873
|
const graphQLOptions = useGraphqlOptions();
|
|
851
874
|
const [drivers, setDrivers] = useState<Driver[]>([]);
|
|
875
|
+
const [totalDrivers, setTotalDrivers] = useState(0);
|
|
852
876
|
const [hasMore, setHasMore] = useState(false);
|
|
853
877
|
const [isLoading, setIsLoading] = useState(false);
|
|
854
878
|
const [error, setError] = useState<Error | null>(null);
|
|
@@ -857,22 +881,26 @@ export function useDrivers(options: UseDriversOptions = {}): UseDriversResult {
|
|
|
857
881
|
setIsLoading(true);
|
|
858
882
|
setError(null);
|
|
859
883
|
try {
|
|
860
|
-
const data = await executeGraphQL<{
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
884
|
+
const data = await executeGraphQL<{
|
|
885
|
+
drivers: ApiDriver[];
|
|
886
|
+
driversCount: number;
|
|
887
|
+
}>(graphQLOptions, LIST_DRIVERS_QUERY, {
|
|
888
|
+
filter: {
|
|
889
|
+
status: status ? toApiDriverStatus(status) : undefined,
|
|
890
|
+
search: search || undefined,
|
|
891
|
+
licenseClass: licenseClass || undefined,
|
|
892
|
+
},
|
|
893
|
+
pagination: { limit, offset },
|
|
894
|
+
});
|
|
895
|
+
setHasMore(offset + data.drivers.length < data.driversCount);
|
|
896
|
+
setTotalDrivers(data.driversCount);
|
|
869
897
|
setDrivers(data.drivers.map(mapDriver));
|
|
870
898
|
} catch (fetchError) {
|
|
871
899
|
setError(fetchError instanceof Error ? fetchError : new Error('Failed to load drivers'));
|
|
872
900
|
} finally {
|
|
873
901
|
setIsLoading(false);
|
|
874
902
|
}
|
|
875
|
-
}, [graphQLOptions, limit, offset, status]);
|
|
903
|
+
}, [graphQLOptions, limit, offset, status, search, licenseClass]);
|
|
876
904
|
|
|
877
905
|
useEffect(() => {
|
|
878
906
|
void load();
|
|
@@ -918,7 +946,7 @@ export function useDrivers(options: UseDriversOptions = {}): UseDriversResult {
|
|
|
918
946
|
|
|
919
947
|
return {
|
|
920
948
|
drivers,
|
|
921
|
-
totalDrivers
|
|
949
|
+
totalDrivers,
|
|
922
950
|
hasMore,
|
|
923
951
|
isLoading,
|
|
924
952
|
error,
|
|
@@ -11,10 +11,7 @@ import { useMoveTheWheels } from '../providers/MoveTheWheelsProvider';
|
|
|
11
11
|
import { executeGraphQL } from '../utils/graphqlClient';
|
|
12
12
|
|
|
13
13
|
export type FleetAlertType =
|
|
14
|
-
| '
|
|
15
|
-
| 'LICENSE_EXPIRING'
|
|
16
|
-
| 'MAINTENANCE_OVERDUE'
|
|
17
|
-
| 'MAINTENANCE_DUE_SOON';
|
|
14
|
+
'LICENSE_EXPIRED' | 'LICENSE_EXPIRING' | 'MAINTENANCE_OVERDUE' | 'MAINTENANCE_DUE_SOON';
|
|
18
15
|
export type FleetAlertSeverity = 'CRITICAL' | 'WARNING';
|
|
19
16
|
export type FleetAlertSubjectType = 'VEHICLE' | 'DRIVER';
|
|
20
17
|
|