@burdenoff/microfe-movethewheels 2026.830.5 → 2026.920.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/MoveTheWheelsRoutes.js +7 -3
- package/dist/components/AssignmentSuggestions.js +135 -0
- package/dist/components/FleetAlertsPanel.js +114 -0
- package/dist/components/ShippingQuoteResults.js +142 -0
- package/dist/components/VehicleServiceCard.js +176 -0
- package/dist/hooks/useFleet.js +4 -3
- package/dist/hooks/useFleetIntelligence.js +91 -0
- package/dist/hooks/useShippingCarriers.js +29 -0
- package/dist/movethewheels/components/AssignmentSuggestions.d.ts +17 -0
- package/dist/movethewheels/components/FleetAlertsPanel.d.ts +14 -0
- package/dist/movethewheels/components/ShippingQuoteResults.d.ts +8 -0
- package/dist/movethewheels/components/VehicleServiceCard.d.ts +10 -0
- package/dist/movethewheels/hooks/useFleetIntelligence.d.ts +64 -0
- package/dist/movethewheels/hooks/useShippingCarriers.d.ts +43 -0
- package/dist/movethewheels/pages/ShippingRatesPage.d.ts +9 -0
- package/dist/movethewheels/types/index.d.ts +2 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/scale.js +26 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/sparkles.js +26 -0
- package/dist/pages/FleetPage.js +156 -146
- package/dist/pages/RouteDetailsPage.js +202 -184
- package/dist/pages/ShippingRatesPage.js +177 -0
- package/dist/pages/VehicleDetailsPage.js +149 -131
- package/dist/utils/graphqlClient.js +14 -5
- package/package.json +1 -1
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
- package/src/movethewheels/components/AssignmentSuggestions.tsx +234 -0
- package/src/movethewheels/components/FleetAlertsPanel.tsx +148 -0
- package/src/movethewheels/components/ShippingQuoteResults.tsx +199 -0
- package/src/movethewheels/components/VehicleServiceCard.tsx +220 -0
- package/src/movethewheels/hooks/useFleet.ts +12 -2
- package/src/movethewheels/hooks/useFleetIntelligence.ts +226 -0
- package/src/movethewheels/hooks/useShippingCarriers.ts +110 -0
- package/src/movethewheels/pages/FleetPage.tsx +21 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +33 -1
- package/src/movethewheels/pages/ShippingRatesPage.tsx +216 -0
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +27 -0
- package/src/movethewheels/types/index.ts +2 -0
- package/src/movethewheels/utils/graphqlClient.ts +20 -1
|
@@ -0,0 +1,91 @@
|
|
|
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";
|
|
4
|
+
//#region src/movethewheels/hooks/useFleetIntelligence.ts
|
|
5
|
+
var o = "\n query FleetAlerts {\n fleetAlerts {\n id\n type\n severity\n subjectType\n subjectId\n subjectName\n message\n dueDate\n daysUntilDue\n kmUntilDue\n }\n }\n", s = "\n query AssignmentSuggestions($routeId: ID!, $limit: Int) {\n assignmentSuggestions(routeId: $routeId, limit: $limit) {\n routeId\n vehicles {\n score\n reasons\n vehicle {\n id\n vehicleNumber\n make\n model\n }\n }\n drivers {\n score\n reasons\n driver {\n id\n firstName\n lastName\n rating\n }\n }\n }\n }\n", c = "\n mutation RecordVehicleService($id: ID!, $input: RecordVehicleServiceInput!) {\n recordVehicleService(id: $id, input: $input) {\n id\n status\n mileage\n lastServiceDate\n nextServiceDueDate\n nextServiceDueMileage\n }\n }\n";
|
|
6
|
+
function l() {
|
|
7
|
+
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: a, tenantId: o, currentUser: s } = e();
|
|
8
|
+
return i(() => ({
|
|
9
|
+
apiGatewayUrl: t,
|
|
10
|
+
authToken: n,
|
|
11
|
+
workspaceToken: r,
|
|
12
|
+
workspaceId: a,
|
|
13
|
+
tenantId: o,
|
|
14
|
+
actorId: s?.id
|
|
15
|
+
}), [
|
|
16
|
+
t,
|
|
17
|
+
n,
|
|
18
|
+
r,
|
|
19
|
+
a,
|
|
20
|
+
o,
|
|
21
|
+
s?.id
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
function u() {
|
|
25
|
+
let e = l(), [i, s] = a([]), [c, u] = a(!0), [d, f] = a(null), [p, m] = a(0);
|
|
26
|
+
return r(() => {
|
|
27
|
+
let n = !0;
|
|
28
|
+
return u(!0), f(null), t(e, o).then((e) => {
|
|
29
|
+
n && s(e.fleetAlerts);
|
|
30
|
+
}).catch((e) => {
|
|
31
|
+
n && f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load fleet alerts"));
|
|
32
|
+
}).finally(() => {
|
|
33
|
+
n && u(!1);
|
|
34
|
+
}), () => {
|
|
35
|
+
n = !1;
|
|
36
|
+
};
|
|
37
|
+
}, [e, p]), {
|
|
38
|
+
data: i,
|
|
39
|
+
isLoading: c,
|
|
40
|
+
error: d,
|
|
41
|
+
refetch: n(() => m((e) => e + 1), [])
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
var d = {
|
|
45
|
+
routeId: "",
|
|
46
|
+
vehicles: [],
|
|
47
|
+
drivers: []
|
|
48
|
+
};
|
|
49
|
+
function f(e, i = 3) {
|
|
50
|
+
let o = l(), [c, u] = a(d), [f, p] = a(!!e), [m, h] = a(null), [g, _] = a(0);
|
|
51
|
+
return r(() => {
|
|
52
|
+
if (!e) {
|
|
53
|
+
u(d), p(!1);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let n = !0;
|
|
57
|
+
return p(!0), h(null), t(o, s, {
|
|
58
|
+
routeId: e,
|
|
59
|
+
limit: i
|
|
60
|
+
}).then((e) => {
|
|
61
|
+
n && u(e.assignmentSuggestions);
|
|
62
|
+
}).catch((e) => {
|
|
63
|
+
n && h(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load suggestions"));
|
|
64
|
+
}).finally(() => {
|
|
65
|
+
n && p(!1);
|
|
66
|
+
}), () => {
|
|
67
|
+
n = !1;
|
|
68
|
+
};
|
|
69
|
+
}, [
|
|
70
|
+
o,
|
|
71
|
+
e,
|
|
72
|
+
i,
|
|
73
|
+
g
|
|
74
|
+
]), {
|
|
75
|
+
data: c,
|
|
76
|
+
isLoading: f,
|
|
77
|
+
error: m,
|
|
78
|
+
refetch: n(() => _((e) => e + 1), [])
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function p() {
|
|
82
|
+
let e = l();
|
|
83
|
+
return n(async (n, r) => {
|
|
84
|
+
await t(e, c, {
|
|
85
|
+
id: n,
|
|
86
|
+
input: r
|
|
87
|
+
});
|
|
88
|
+
}, [e]);
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { f as useAssignmentSuggestions, u as useFleetAlerts, p as useRecordVehicleService };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
|
+
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
+
import { useCallback as n, useMemo as r } from "react";
|
|
4
|
+
//#region src/movethewheels/hooks/useShippingCarriers.ts
|
|
5
|
+
var i = "\n query ShippingQuotes($input: ShippingQuoteInput!) {\n shippingQuotes(input: $input) {\n chargeableWeightKg\n quotes {\n provider\n courierId\n courierName\n price\n currency\n estimatedDeliveryDays\n estimatedDeliveryDate\n rating\n mode\n isRecommended\n isCheapest\n isFastest\n }\n providers {\n provider\n ok\n quoteCount\n errorMessage\n }\n }\n }\n";
|
|
6
|
+
function a() {
|
|
7
|
+
let { apiGatewayUrl: t, authToken: n, workspaceToken: i, workspaceId: a, tenantId: o, currentUser: s } = e();
|
|
8
|
+
return r(() => ({
|
|
9
|
+
apiGatewayUrl: t,
|
|
10
|
+
authToken: n,
|
|
11
|
+
workspaceToken: i,
|
|
12
|
+
workspaceId: a,
|
|
13
|
+
tenantId: o,
|
|
14
|
+
actorId: s?.id
|
|
15
|
+
}), [
|
|
16
|
+
t,
|
|
17
|
+
n,
|
|
18
|
+
i,
|
|
19
|
+
a,
|
|
20
|
+
o,
|
|
21
|
+
s?.id
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
function o() {
|
|
25
|
+
let e = a();
|
|
26
|
+
return n(async (n) => (await t(e, i, { input: n })).shippingQuotes, [e]);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { o as useShippingQuotes };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AssignmentSuggestions as Suggestions } from '../hooks/useFleetIntelligence';
|
|
2
|
+
|
|
3
|
+
interface AssignmentSuggestionsProps {
|
|
4
|
+
suggestions: Suggestions;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
onRetry: () => void;
|
|
8
|
+
assignedVehicleId?: string;
|
|
9
|
+
assignedDriverId?: string;
|
|
10
|
+
onAssign: (patch: {
|
|
11
|
+
vehicleId?: string;
|
|
12
|
+
driverId?: string;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
t: (key: string, fallback: string) => string;
|
|
15
|
+
}
|
|
16
|
+
export declare function AssignmentSuggestions({ suggestions, isLoading, error, onRetry, assignedVehicleId, assignedDriverId, onAssign, t, }: AssignmentSuggestionsProps): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FleetAlert } from '../hooks/useFleetIntelligence';
|
|
2
|
+
|
|
3
|
+
interface FleetAlertsPanelProps {
|
|
4
|
+
alerts: FleetAlert[];
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
onRetry: () => void;
|
|
8
|
+
onOpen: (alert: FleetAlert) => void;
|
|
9
|
+
t: (key: string, fallback: string) => string;
|
|
10
|
+
}
|
|
11
|
+
/** Human-readable "how close / how late" for an alert, from its structured due data. */
|
|
12
|
+
export declare function describeDue(alert: Pick<FleetAlert, 'daysUntilDue' | 'kmUntilDue'>): string;
|
|
13
|
+
export declare function FleetAlertsPanel({ alerts, isLoading, error, onRetry, onOpen, t, }: FleetAlertsPanelProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ShippingQuoteResult } from '../hooks/useShippingCarriers';
|
|
2
|
+
|
|
3
|
+
interface ShippingQuoteResultsProps {
|
|
4
|
+
result: ShippingQuoteResult;
|
|
5
|
+
t: (key: string, fallback: string) => string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ShippingQuoteResults({ result, t }: ShippingQuoteResultsProps): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RecordVehicleServiceInput } from '../hooks/useFleetIntelligence';
|
|
2
|
+
import { Vehicle } from '../types';
|
|
3
|
+
|
|
4
|
+
interface VehicleServiceCardProps {
|
|
5
|
+
vehicle: Vehicle;
|
|
6
|
+
onRecord: (input: RecordVehicleServiceInput) => Promise<void>;
|
|
7
|
+
t: (key: string, fallback: string) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare function VehicleServiceCard({ vehicle, onRecord, t }: VehicleServiceCardProps): import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fleet intelligence hooks — compliance/maintenance alerts, dispatch
|
|
3
|
+
* suggestions for a route, and logging a completed vehicle service.
|
|
4
|
+
*
|
|
5
|
+
* All three sit on top of wspace-movethewheels-svc's fleet module; the ranking
|
|
6
|
+
* and alert rules live server-side so every surface (web, CLI, MCP) agrees.
|
|
7
|
+
*/
|
|
8
|
+
export type FleetAlertType = 'LICENSE_EXPIRED' | 'LICENSE_EXPIRING' | 'MAINTENANCE_OVERDUE' | 'MAINTENANCE_DUE_SOON';
|
|
9
|
+
export type FleetAlertSeverity = 'CRITICAL' | 'WARNING';
|
|
10
|
+
export type FleetAlertSubjectType = 'VEHICLE' | 'DRIVER';
|
|
11
|
+
export interface FleetAlert {
|
|
12
|
+
id: string;
|
|
13
|
+
type: FleetAlertType;
|
|
14
|
+
severity: FleetAlertSeverity;
|
|
15
|
+
subjectType: FleetAlertSubjectType;
|
|
16
|
+
subjectId: string;
|
|
17
|
+
subjectName: string;
|
|
18
|
+
message: string;
|
|
19
|
+
dueDate: string | null;
|
|
20
|
+
daysUntilDue: number | null;
|
|
21
|
+
kmUntilDue: number | null;
|
|
22
|
+
}
|
|
23
|
+
export interface VehicleSuggestion {
|
|
24
|
+
score: number;
|
|
25
|
+
reasons: string[];
|
|
26
|
+
vehicle: {
|
|
27
|
+
id: string;
|
|
28
|
+
vehicleNumber: string;
|
|
29
|
+
make: string | null;
|
|
30
|
+
model: string | null;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface DriverSuggestion {
|
|
34
|
+
score: number;
|
|
35
|
+
reasons: string[];
|
|
36
|
+
driver: {
|
|
37
|
+
id: string;
|
|
38
|
+
firstName: string;
|
|
39
|
+
lastName: string;
|
|
40
|
+
rating: number | null;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface AssignmentSuggestions {
|
|
44
|
+
routeId: string;
|
|
45
|
+
vehicles: VehicleSuggestion[];
|
|
46
|
+
drivers: DriverSuggestion[];
|
|
47
|
+
}
|
|
48
|
+
export interface RecordVehicleServiceInput {
|
|
49
|
+
/** ISO date-time. Defaults to now on the server. */
|
|
50
|
+
serviceDate?: string;
|
|
51
|
+
mileage?: number;
|
|
52
|
+
intervalDays?: number;
|
|
53
|
+
intervalKm?: number;
|
|
54
|
+
}
|
|
55
|
+
interface AsyncResource<T> {
|
|
56
|
+
data: T;
|
|
57
|
+
isLoading: boolean;
|
|
58
|
+
error: Error | null;
|
|
59
|
+
refetch: () => void;
|
|
60
|
+
}
|
|
61
|
+
export declare function useFleetAlerts(): AsyncResource<FleetAlert[]>;
|
|
62
|
+
export declare function useAssignmentSuggestions(routeId: string | undefined, limit?: number): AsyncResource<AssignmentSuggestions>;
|
|
63
|
+
export declare function useRecordVehicleService(): (vehicleId: string, input: RecordVehicleServiceInput) => Promise<void>;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shipping rate comparison — every carrier's price for one pincode pair, on top
|
|
3
|
+
* of wspace-movethewheels-svc's carrier module. The carrier accounts belong to
|
|
4
|
+
* the platform, so there is nothing for a workspace to configure.
|
|
5
|
+
*/
|
|
6
|
+
export type CarrierProvider = 'SHIPROCKET';
|
|
7
|
+
export type CarrierServiceMode = 'SURFACE' | 'AIR';
|
|
8
|
+
export interface ShippingQuoteInput {
|
|
9
|
+
pickupPostcode: string;
|
|
10
|
+
deliveryPostcode: string;
|
|
11
|
+
weightKg: number;
|
|
12
|
+
lengthCm?: number;
|
|
13
|
+
widthCm?: number;
|
|
14
|
+
heightCm?: number;
|
|
15
|
+
cod?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ShippingQuote {
|
|
18
|
+
provider: CarrierProvider;
|
|
19
|
+
courierId: string;
|
|
20
|
+
courierName: string;
|
|
21
|
+
price: number;
|
|
22
|
+
currency: string;
|
|
23
|
+
estimatedDeliveryDays: number | null;
|
|
24
|
+
estimatedDeliveryDate: string | null;
|
|
25
|
+
rating: number | null;
|
|
26
|
+
mode: CarrierServiceMode | null;
|
|
27
|
+
isRecommended: boolean;
|
|
28
|
+
isCheapest: boolean;
|
|
29
|
+
isFastest: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface CarrierOutcome {
|
|
32
|
+
provider: CarrierProvider;
|
|
33
|
+
ok: boolean;
|
|
34
|
+
quoteCount: number;
|
|
35
|
+
errorMessage: string | null;
|
|
36
|
+
}
|
|
37
|
+
export interface ShippingQuoteResult {
|
|
38
|
+
chargeableWeightKg: number;
|
|
39
|
+
quotes: ShippingQuote[];
|
|
40
|
+
providers: CarrierOutcome[];
|
|
41
|
+
}
|
|
42
|
+
/** Imperative: a comparison is something the operator asks for, not page-load data. */
|
|
43
|
+
export declare function useShippingQuotes(): (input: ShippingQuoteInput) => Promise<ShippingQuoteResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shipping Rates Page
|
|
3
|
+
*
|
|
4
|
+
* Compare live courier rates between two pincodes across the platform's
|
|
5
|
+
* carriers (Shiprocket first). Nothing to set up: the carrier accounts belong
|
|
6
|
+
* to the platform. Read-only — comparing never books a shipment or spends
|
|
7
|
+
* carrier credit.
|
|
8
|
+
*/
|
|
9
|
+
export default function ShippingRatesPage(): import("react").JSX.Element;
|
|
@@ -277,6 +277,8 @@ export interface Vehicle {
|
|
|
277
277
|
currentLocation?: Location;
|
|
278
278
|
lastMaintenance?: Date;
|
|
279
279
|
nextMaintenance?: Date;
|
|
280
|
+
/** Odometer reading (km) at which the next service is due. */
|
|
281
|
+
nextMaintenanceMileage?: number;
|
|
280
282
|
fuelLevel?: number;
|
|
281
283
|
mileage?: number;
|
|
282
284
|
documents: VehicleDocument[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createLucideIcon as e } from "../createLucideIcon.js";
|
|
2
|
+
//#region node_modules/lucide-react/dist/esm/icons/scale.js
|
|
3
|
+
var t = e("Scale", [
|
|
4
|
+
["path", {
|
|
5
|
+
d: "m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",
|
|
6
|
+
key: "7g6ntu"
|
|
7
|
+
}],
|
|
8
|
+
["path", {
|
|
9
|
+
d: "m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",
|
|
10
|
+
key: "ijws7r"
|
|
11
|
+
}],
|
|
12
|
+
["path", {
|
|
13
|
+
d: "M7 21h10",
|
|
14
|
+
key: "1b0cd5"
|
|
15
|
+
}],
|
|
16
|
+
["path", {
|
|
17
|
+
d: "M12 3v18",
|
|
18
|
+
key: "108xh3"
|
|
19
|
+
}],
|
|
20
|
+
["path", {
|
|
21
|
+
d: "M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",
|
|
22
|
+
key: "3gwbw2"
|
|
23
|
+
}]
|
|
24
|
+
]);
|
|
25
|
+
//#endregion
|
|
26
|
+
export { t as Scale };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createLucideIcon as e } from "../createLucideIcon.js";
|
|
2
|
+
//#region node_modules/lucide-react/dist/esm/icons/sparkles.js
|
|
3
|
+
var t = e("Sparkles", [
|
|
4
|
+
["path", {
|
|
5
|
+
d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",
|
|
6
|
+
key: "4pj2yx"
|
|
7
|
+
}],
|
|
8
|
+
["path", {
|
|
9
|
+
d: "M20 3v4",
|
|
10
|
+
key: "1olli1"
|
|
11
|
+
}],
|
|
12
|
+
["path", {
|
|
13
|
+
d: "M22 5h-4",
|
|
14
|
+
key: "1gvqau"
|
|
15
|
+
}],
|
|
16
|
+
["path", {
|
|
17
|
+
d: "M4 17v2",
|
|
18
|
+
key: "vumght"
|
|
19
|
+
}],
|
|
20
|
+
["path", {
|
|
21
|
+
d: "M5 18H3",
|
|
22
|
+
key: "zchphs"
|
|
23
|
+
}]
|
|
24
|
+
]);
|
|
25
|
+
//#endregion
|
|
26
|
+
export { t as Sparkles };
|