@burdenoff/microfe-movethewheels 2026.822.1 → 2026.828.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.
Files changed (71) hide show
  1. package/dist/generated/wspace-operations.d.ts +168 -912
  2. package/dist/generated/wspace-types.d.ts +78432 -35831
  3. package/dist/hooks/useFleet.js +142 -74
  4. package/dist/hooks/useImportExport.js +22 -51
  5. package/dist/hooks/useInventory.js +163 -70
  6. package/dist/hooks/useOrders.js +2 -2
  7. package/dist/hooks/useReports.js +63 -73
  8. package/dist/hooks/useSettings.js +52 -44
  9. package/dist/hooks/useTracking.js +5 -5
  10. package/dist/index.js +33 -33
  11. package/dist/movethewheels/hooks/index.d.ts +2 -2
  12. package/dist/movethewheels/hooks/useFleet.d.ts +32 -1
  13. package/dist/movethewheels/hooks/useImportExport.d.ts +10 -0
  14. package/dist/movethewheels/hooks/useInventory.d.ts +67 -12
  15. package/dist/movethewheels/hooks/useOrders.d.ts +25 -2
  16. package/dist/movethewheels/pages/MarketplacePage.d.ts +7 -4
  17. package/dist/movethewheels/types/index.d.ts +2 -0
  18. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down-right.js +11 -0
  19. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left-right.js +22 -0
  20. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-right.js +11 -0
  21. package/dist/node_modules/lucide-react/dist/esm/icons/calendar-clock.js +32 -0
  22. package/dist/node_modules/lucide-react/dist/esm/icons/history.js +18 -0
  23. package/dist/node_modules/lucide-react/dist/esm/icons/lock.js +16 -0
  24. package/dist/node_modules/lucide-react/dist/esm/icons/user-round.js +13 -0
  25. package/dist/pages/CreateOrderPage.js +246 -195
  26. package/dist/pages/DeliveryCapturePage.js +91 -78
  27. package/dist/pages/DriversPage.js +202 -108
  28. package/dist/pages/InventoryPage.js +356 -131
  29. package/dist/pages/MarketplacePage.js +11 -432
  30. package/dist/pages/ProductDetailsPage.js +212 -156
  31. package/dist/pages/ReportsPage.js +120 -109
  32. package/dist/pages/VehicleDetailsPage.js +257 -193
  33. package/dist/utils/formatters.js +4 -1
  34. package/package.json +2 -2
  35. package/src/generated/wspace-operations.ts +134 -929
  36. package/src/generated/wspace-types.ts +91730 -40059
  37. package/src/movethewheels/hooks/index.ts +9 -0
  38. package/src/movethewheels/hooks/useFleet.ts +133 -3
  39. package/src/movethewheels/hooks/useImportExport.ts +36 -72
  40. package/src/movethewheels/hooks/useInventory.ts +311 -53
  41. package/src/movethewheels/hooks/useOrders.ts +31 -7
  42. package/src/movethewheels/hooks/useReports.ts +73 -87
  43. package/src/movethewheels/hooks/useSettings.ts +50 -53
  44. package/src/movethewheels/hooks/useTracking.ts +14 -14
  45. package/src/movethewheels/pages/CreateOrderPage.tsx +67 -10
  46. package/src/movethewheels/pages/DeliveryCapturePage.tsx +8 -0
  47. package/src/movethewheels/pages/DriversPage.tsx +181 -31
  48. package/src/movethewheels/pages/InventoryPage.tsx +299 -19
  49. package/src/movethewheels/pages/MarketplacePage.tsx +16 -539
  50. package/src/movethewheels/pages/ProductDetailsPage.tsx +68 -3
  51. package/src/movethewheels/pages/ReportsPage.tsx +23 -0
  52. package/src/movethewheels/pages/VehicleDetailsPage.tsx +86 -27
  53. package/src/movethewheels/types/index.ts +2 -0
  54. package/src/operations/wspace/movethewheels/fragments/core.graphql +23 -53
  55. package/src/operations/wspace/movethewheels/fragments/core.withdrawn.graphql +59 -0
  56. package/src/operations/wspace/movethewheels/mutations/entities.graphql +5 -5
  57. package/src/operations/wspace/movethewheels/mutations/marketplace-reports.graphql +18 -78
  58. package/src/operations/wspace/movethewheels/mutations/marketplace-reports.withdrawn.graphql +93 -0
  59. package/src/operations/wspace/movethewheels/mutations/orders.graphql +7 -7
  60. package/src/operations/wspace/movethewheels/queries/dashboard.graphql +3 -3
  61. package/src/operations/wspace/movethewheels/queries/entities.graphql +3 -3
  62. package/src/operations/wspace/movethewheels/queries/logistics.graphql +3 -3
  63. package/src/operations/wspace/movethewheels/queries/marketplace-reports.withdrawn.graphql +58 -0
  64. package/src/operations/wspace/movethewheels/queries/orders.graphql +3 -3
  65. package/dist/generated/global-operations.d.ts +0 -1
  66. package/dist/generated/global-types.d.ts +0 -23526
  67. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +0 -8
  68. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +0 -8
  69. package/src/generated/global-operations.ts +0 -2
  70. package/src/generated/global-types.ts +0 -27259
  71. package/src/operations/wspace/movethewheels/queries/marketplace-reports.graphql +0 -40
@@ -12,9 +12,12 @@ export {
12
12
  useFleet,
13
13
  useVehicles,
14
14
  useVehicle,
15
+ useVehicleDrivers,
15
16
  useDrivers,
16
17
  useDriver,
18
+ useDriverStatusCounts,
17
19
  useFleetStats,
20
+ type DriverStatusCounts,
18
21
  } from './useFleet';
19
22
 
20
23
  // Inventory (Products & Warehouses)
@@ -22,9 +25,15 @@ export {
22
25
  useInventory,
23
26
  useProducts,
24
27
  useProduct,
28
+ useProductStockLevels,
25
29
  useWarehouses,
26
30
  useWarehouse,
27
31
  useInventoryStats,
32
+ useInventoryTransactions,
33
+ type InventoryStats,
34
+ type InventoryTransaction,
35
+ type InventoryTransactionType,
36
+ type ProductStockLevel,
28
37
  } from './useInventory';
29
38
 
30
39
  // Customers
@@ -46,6 +46,7 @@ interface ApiVehicle {
46
46
  make?: string | null;
47
47
  model?: string | null;
48
48
  licensePlate?: string | null;
49
+ ownershipType?: string | null;
49
50
  year?: number | null;
50
51
  capacity?: Record<string, unknown> | null;
51
52
  status: string;
@@ -83,6 +84,7 @@ const LIST_VEHICLES_QUERY = `
83
84
  make
84
85
  model
85
86
  licensePlate
87
+ ownershipType
86
88
  year
87
89
  capacity
88
90
  status
@@ -126,6 +128,7 @@ const GET_VEHICLE_QUERY = `
126
128
  make
127
129
  model
128
130
  licensePlate
131
+ ownershipType
129
132
  year
130
133
  capacity
131
134
  status
@@ -169,6 +172,7 @@ const UPDATE_VEHICLE_STATUS_MUTATION = `
169
172
  make
170
173
  model
171
174
  licensePlate
175
+ ownershipType
172
176
  year
173
177
  capacity
174
178
  status
@@ -234,6 +238,7 @@ const CREATE_VEHICLE_MUTATION = `
234
238
  make
235
239
  model
236
240
  licensePlate
241
+ ownershipType
237
242
  year
238
243
  capacity
239
244
  status
@@ -277,6 +282,7 @@ const UPDATE_VEHICLE_MUTATION = `
277
282
  make
278
283
  model
279
284
  licensePlate
285
+ ownershipType
280
286
  year
281
287
  capacity
282
288
  status
@@ -311,6 +317,21 @@ const UPDATE_DRIVER_MUTATION = `
311
317
  }
312
318
  `;
313
319
 
320
+ /**
321
+ * `fleetStats` only breaks drivers down into available / on-delivery, so an
322
+ * "on break" or "off duty" tile derived from it is always wrong (on-break
323
+ * drivers get lumped into the off-duty remainder). `driversCount` takes the
324
+ * same DriverFilterInput as the list, so each roster tile can be counted
325
+ * exactly, workspace-wide, instead of inferred from a subtraction.
326
+ */
327
+ const DRIVER_STATUS_COUNTS_QUERY = `
328
+ query GetDriverStatusCounts {
329
+ onBreak: driversCount(filter: { status: ON_BREAK })
330
+ offDuty: driversCount(filter: { status: OFF_DUTY })
331
+ inactive: driversCount(filter: { status: INACTIVE })
332
+ }
333
+ `;
334
+
314
335
  const FLEET_STATS_QUERY = `
315
336
  query GetFleetStats {
316
337
  fleetStats {
@@ -386,6 +407,7 @@ function mapVehicle(vehicle: ApiVehicle): Vehicle {
386
407
  make: vehicle.make ?? '',
387
408
  model: vehicle.model ?? '',
388
409
  licensePlate: vehicle.licensePlate ?? '',
410
+ ownershipType: vehicle.ownershipType ?? undefined,
389
411
  year: vehicle.year ?? new Date().getFullYear(),
390
412
  capacity: {
391
413
  weight: 0,
@@ -805,8 +827,16 @@ interface UseDriversResult {
805
827
  assignVehicle: (driverId: string, vehicleId: string) => Promise<Driver>;
806
828
  }
807
829
 
808
- export function useDrivers(options: UseListOptions = {}): UseDriversResult {
809
- const { limit = 200, offset = 0 } = options;
830
+ interface UseDriversOptions extends UseListOptions {
831
+ /**
832
+ * Narrows the roster server-side via `DriverFilterInput.status` so the pager
833
+ * still counts whole result sets rather than filtering one fetched page.
834
+ */
835
+ status?: DriverStatus;
836
+ }
837
+
838
+ export function useDrivers(options: UseDriversOptions = {}): UseDriversResult {
839
+ const { limit = 200, offset = 0, status } = options;
810
840
  const graphQLOptions = useGraphqlOptions();
811
841
  const [drivers, setDrivers] = useState<Driver[]>([]);
812
842
  const [hasMore, setHasMore] = useState(false);
@@ -821,6 +851,7 @@ export function useDrivers(options: UseListOptions = {}): UseDriversResult {
821
851
  graphQLOptions,
822
852
  LIST_DRIVERS_QUERY,
823
853
  {
854
+ filter: status ? { status: toApiDriverStatus(status) } : undefined,
824
855
  pagination: { limit, offset },
825
856
  }
826
857
  );
@@ -831,7 +862,7 @@ export function useDrivers(options: UseListOptions = {}): UseDriversResult {
831
862
  } finally {
832
863
  setIsLoading(false);
833
864
  }
834
- }, [graphQLOptions, limit, offset]);
865
+ }, [graphQLOptions, limit, offset, status]);
835
866
 
836
867
  useEffect(() => {
837
868
  void load();
@@ -928,6 +959,105 @@ export function useDriver(driverId: string | undefined) {
928
959
  return { driver, isLoading, error, refetch };
929
960
  }
930
961
 
962
+ export interface DriverStatusCounts {
963
+ onBreak: number;
964
+ offDuty: number;
965
+ inactive: number;
966
+ }
967
+
968
+ /** Exact per-status driver counts for the roster tiles (see DRIVER_STATUS_COUNTS_QUERY). */
969
+ export function useDriverStatusCounts() {
970
+ const graphQLOptions = useGraphqlOptions();
971
+ const [counts, setCounts] = useState<DriverStatusCounts>({
972
+ onBreak: 0,
973
+ offDuty: 0,
974
+ inactive: 0,
975
+ });
976
+ const [isLoading, setIsLoading] = useState(false);
977
+ const [error, setError] = useState<Error | null>(null);
978
+
979
+ const load = useCallback(async () => {
980
+ setIsLoading(true);
981
+ setError(null);
982
+ try {
983
+ const data = await executeGraphQL<DriverStatusCounts>(
984
+ graphQLOptions,
985
+ DRIVER_STATUS_COUNTS_QUERY
986
+ );
987
+ setCounts({
988
+ onBreak: data.onBreak,
989
+ offDuty: data.offDuty,
990
+ inactive: data.inactive,
991
+ });
992
+ } catch (fetchError) {
993
+ setError(
994
+ fetchError instanceof Error ? fetchError : new Error('Failed to load driver status counts')
995
+ );
996
+ } finally {
997
+ setIsLoading(false);
998
+ }
999
+ }, [graphQLOptions]);
1000
+
1001
+ useEffect(() => {
1002
+ void load();
1003
+ }, [load]);
1004
+
1005
+ const refetch = useCallback(() => {
1006
+ void load();
1007
+ }, [load]);
1008
+
1009
+ return { counts, isLoading, error, refetch };
1010
+ }
1011
+
1012
+ /**
1013
+ * The driver(s) currently assigned to a vehicle, resolved server-side through
1014
+ * `DriverFilterInput.vehicleId` (the same link `assignDriverVehicle` writes).
1015
+ * A vehicle normally has one driver, but the filter returns a list, so the
1016
+ * caller gets every assignment rather than a silently-picked first row.
1017
+ */
1018
+ export function useVehicleDrivers(vehicleId: string | undefined) {
1019
+ const graphQLOptions = useGraphqlOptions();
1020
+ const [drivers, setDrivers] = useState<Driver[]>([]);
1021
+ const [isLoading, setIsLoading] = useState(false);
1022
+ const [error, setError] = useState<Error | null>(null);
1023
+
1024
+ const load = useCallback(async () => {
1025
+ if (!vehicleId) {
1026
+ setDrivers([]);
1027
+ return;
1028
+ }
1029
+ setIsLoading(true);
1030
+ setError(null);
1031
+ try {
1032
+ const data = await executeGraphQL<{ drivers: ApiDriver[] }>(
1033
+ graphQLOptions,
1034
+ LIST_DRIVERS_QUERY,
1035
+ {
1036
+ filter: { vehicleId },
1037
+ pagination: { limit: 25, offset: 0 },
1038
+ }
1039
+ );
1040
+ setDrivers(data.drivers.map(mapDriver));
1041
+ } catch (fetchError) {
1042
+ setError(
1043
+ fetchError instanceof Error ? fetchError : new Error('Failed to load assigned driver')
1044
+ );
1045
+ } finally {
1046
+ setIsLoading(false);
1047
+ }
1048
+ }, [graphQLOptions, vehicleId]);
1049
+
1050
+ useEffect(() => {
1051
+ void load();
1052
+ }, [load]);
1053
+
1054
+ const refetch = useCallback(() => {
1055
+ void load();
1056
+ }, [load]);
1057
+
1058
+ return { drivers, isLoading, error, refetch };
1059
+ }
1060
+
931
1061
  export function useFleetStats() {
932
1062
  const graphQLOptions = useGraphqlOptions();
933
1063
  const [stats, setStats] = useState({
@@ -1,6 +1,4 @@
1
- import { useCallback, useMemo, useState } from 'react';
2
- import { useMoveTheWheels } from '../providers/MoveTheWheelsProvider';
3
- import { executeGraphQL } from '../utils/graphqlClient';
1
+ import { useCallback, useState } from 'react';
4
2
 
5
3
  export interface ImportExportResult {
6
4
  success: boolean;
@@ -8,26 +6,6 @@ export interface ImportExportResult {
8
6
  payload?: Record<string, unknown> | null;
9
7
  }
10
8
 
11
- const EXPORT_DATA_MUTATION = `
12
- mutation MovethewheelsExportData($input: MovethewheelsExportDataInput!) {
13
- exportData(input: $input) {
14
- success
15
- message
16
- payload
17
- }
18
- }
19
- `;
20
-
21
- const IMPORT_DATA_MUTATION = `
22
- mutation MovethewheelsImportData($input: MovethewheelsImportDataInput!) {
23
- importData(input: $input) {
24
- success
25
- message
26
- payload
27
- }
28
- }
29
- `;
30
-
31
9
  interface UseImportExportResult {
32
10
  exportData: (resource: string, format?: string) => Promise<ImportExportResult>;
33
11
  importData: (resource: string, payload: Record<string, unknown>) => Promise<ImportExportResult>;
@@ -35,66 +13,52 @@ interface UseImportExportResult {
35
13
  error: Error | null;
36
14
  }
37
15
 
16
+ /**
17
+ * Import/export surface withdrawn from wspace-movethewheels-svc by migration
18
+ * 20260707000001_movethewheels_reuse_cleanup. The service now exposes
19
+ * `exportMtwEntities` (async job, returns MtwExportJob) but no import
20
+ * counterpart, so the old synchronous exportData/importData mutations are no
21
+ * longer resolvable. This hook keeps the same contract for consumers but
22
+ * rejects calls with a clear message until a replacement import/export flow is
23
+ * designed. The original operations are preserved in
24
+ * src/operations/wspace/movethewheels/mutations/marketplace-reports.withdrawn.graphql.
25
+ */
38
26
  export function useImportExport(): UseImportExportResult {
39
- const { apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser } =
40
- useMoveTheWheels();
41
27
  const [isBusy, setIsBusy] = useState(false);
42
28
  const [error, setError] = useState<Error | null>(null);
43
29
 
44
- const graphQLOptions = useMemo(
45
- () => ({
46
- apiGatewayUrl,
47
- authToken,
48
- workspaceToken,
49
- workspaceId,
50
- tenantId,
51
- actorId: currentUser?.id,
52
- }),
53
- [apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser?.id]
54
- );
30
+ const withBusy = useCallback(async <T>(fn: () => Promise<T>): Promise<T> => {
31
+ setIsBusy(true);
32
+ setError(null);
33
+ try {
34
+ return await fn();
35
+ } catch (err) {
36
+ const normalized = err instanceof Error ? err : new Error('Import/export failed');
37
+ setError(normalized);
38
+ throw normalized;
39
+ } finally {
40
+ setIsBusy(false);
41
+ }
42
+ }, []);
55
43
 
56
44
  const exportData = useCallback(
57
- async (resource: string, format?: string): Promise<ImportExportResult> => {
58
- setIsBusy(true);
59
- setError(null);
60
- try {
61
- const data = await executeGraphQL<{ exportData: ImportExportResult }>(
62
- graphQLOptions,
63
- EXPORT_DATA_MUTATION,
64
- { input: { resource, format } }
45
+ async (resource: string, _format?: string): Promise<ImportExportResult> =>
46
+ withBusy(async () => {
47
+ throw new Error(
48
+ `Export for "${resource}" is not available: the import/export surface was withdrawn from the service.`
65
49
  );
66
- return data.exportData;
67
- } catch (fetchError) {
68
- const normalized = fetchError instanceof Error ? fetchError : new Error('Export failed');
69
- setError(normalized);
70
- throw normalized;
71
- } finally {
72
- setIsBusy(false);
73
- }
74
- },
75
- [graphQLOptions]
50
+ }),
51
+ [withBusy]
76
52
  );
77
53
 
78
54
  const importData = useCallback(
79
- async (resource: string, payload: Record<string, unknown>): Promise<ImportExportResult> => {
80
- setIsBusy(true);
81
- setError(null);
82
- try {
83
- const data = await executeGraphQL<{ importData: ImportExportResult }>(
84
- graphQLOptions,
85
- IMPORT_DATA_MUTATION,
86
- { input: { resource, payload } }
55
+ async (resource: string, _payload: Record<string, unknown>): Promise<ImportExportResult> =>
56
+ withBusy(async () => {
57
+ throw new Error(
58
+ `Import for "${resource}" is not available: the import surface was withdrawn from the service.`
87
59
  );
88
- return data.importData;
89
- } catch (fetchError) {
90
- const normalized = fetchError instanceof Error ? fetchError : new Error('Import failed');
91
- setError(normalized);
92
- throw normalized;
93
- } finally {
94
- setIsBusy(false);
95
- }
96
- },
97
- [graphQLOptions]
60
+ }),
61
+ [withBusy]
98
62
  );
99
63
 
100
64
  return { exportData, importData, isBusy, error };