@burdenoff/microfe-movethewheels 2026.1108.1 → 2026.1108.3

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 (32) hide show
  1. package/dist/components/DocumentsCard.js +183 -55
  2. package/dist/components/ForecastModelsPanel.js +132 -0
  3. package/dist/components/UpcomingDemandPanel.js +70 -65
  4. package/dist/generated/wspace-operations.d.ts +25 -0
  5. package/dist/generated/wspace-types.d.ts +3301 -144
  6. package/dist/hooks/useDemandForecast.js +1 -1
  7. package/dist/hooks/useDocumentExtractions.js +100 -0
  8. package/dist/hooks/useForecastModelChoices.js +57 -0
  9. package/dist/movethewheels/components/ForecastModelsPanel.d.ts +4 -0
  10. package/dist/movethewheels/hooks/useDemandForecast.d.ts +9 -0
  11. package/dist/movethewheels/hooks/useDocumentExtractions.d.ts +49 -0
  12. package/dist/movethewheels/hooks/useEntityDocuments.d.ts +5 -5
  13. package/dist/movethewheels/hooks/useForecastModelChoices.d.ts +34 -0
  14. package/dist/node_modules/lucide-react/dist/esm/icons/file-search.js +24 -0
  15. package/dist/node_modules/lucide-react/dist/esm/icons/sigma.js +8 -0
  16. package/dist/pages/AnalyticsPage.js +83 -81
  17. package/dist/pages/MultiModalShipmentPage.js +125 -121
  18. package/dist/pages/RouteDetailsPage.js +212 -207
  19. package/package.json +1 -1
  20. package/src/generated/wspace-operations.ts +13 -4
  21. package/src/generated/wspace-types.ts +3623 -144
  22. package/src/movethewheels/components/DocumentsCard.tsx +174 -29
  23. package/src/movethewheels/components/ForecastModelsPanel.tsx +188 -0
  24. package/src/movethewheels/components/UpcomingDemandPanel.tsx +9 -2
  25. package/src/movethewheels/hooks/useDemandForecast.ts +13 -0
  26. package/src/movethewheels/hooks/useDocumentExtractions.ts +246 -0
  27. package/src/movethewheels/hooks/useEntityDocuments.ts +5 -5
  28. package/src/movethewheels/hooks/useForecastModelChoices.ts +138 -0
  29. package/src/movethewheels/pages/AnalyticsPage.tsx +7 -2
  30. package/src/movethewheels/pages/MultiModalShipmentPage.tsx +2 -0
  31. package/src/movethewheels/pages/RouteDetailsPage.tsx +2 -0
  32. package/src/operations/wspace/movethewheels/queries/forecast.graphql +22 -1
@@ -2,7 +2,7 @@ import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
2
2
  import { executeGraphQL as t } from "../utils/graphqlClient.js";
3
3
  import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
4
4
  //#region src/movethewheels/hooks/useDemandForecast.ts
5
- var o = "\n query GetMovethewheelsDemandForecast($weeks: Int!, $varianceLimit: Int!) {\n demandForecastByLane(weeks: $weeks) {\n scopeType\n scopeKey\n scopeLabel\n periodStart\n periodEnd\n predictedVolume\n predictedRevenue\n actualVolume\n actualRevenue\n confidence\n }\n demandForecastByCustomer(weeks: $weeks) {\n scopeType\n scopeKey\n scopeLabel\n periodStart\n periodEnd\n predictedVolume\n predictedRevenue\n actualVolume\n actualRevenue\n confidence\n }\n laneVariance: demandForecastVariance(scopeType: LANE, limit: $varianceLimit) {\n scopeType\n scopeKey\n scopeLabel\n periodStart\n periodEnd\n predictedVolume\n actualVolume\n volumeVariance\n predictedRevenue\n actualRevenue\n revenueVariance\n }\n customerVariance: demandForecastVariance(scopeType: CUSTOMER, limit: $varianceLimit) {\n scopeType\n scopeKey\n scopeLabel\n periodStart\n periodEnd\n predictedVolume\n actualVolume\n volumeVariance\n predictedRevenue\n actualRevenue\n revenueVariance\n }\n }\n";
5
+ var o = "\n query GetMovethewheelsDemandForecast($weeks: Int!, $varianceLimit: Int!) {\n demandForecastByLane(weeks: $weeks) {\n scopeType\n scopeKey\n scopeLabel\n periodStart\n periodEnd\n predictedVolume\n predictedRevenue\n actualVolume\n actualRevenue\n confidence\n model\n }\n demandForecastByCustomer(weeks: $weeks) {\n scopeType\n scopeKey\n scopeLabel\n periodStart\n periodEnd\n predictedVolume\n predictedRevenue\n actualVolume\n actualRevenue\n confidence\n model\n }\n laneVariance: demandForecastVariance(scopeType: LANE, limit: $varianceLimit) {\n scopeType\n scopeKey\n scopeLabel\n periodStart\n periodEnd\n predictedVolume\n actualVolume\n volumeVariance\n predictedRevenue\n actualRevenue\n revenueVariance\n }\n customerVariance: demandForecastVariance(scopeType: CUSTOMER, limit: $varianceLimit) {\n scopeType\n scopeKey\n scopeLabel\n periodStart\n periodEnd\n predictedVolume\n actualVolume\n volumeVariance\n predictedRevenue\n actualRevenue\n revenueVariance\n }\n }\n";
6
6
  function s(s = 4, c = 8) {
7
7
  let { apiGatewayUrl: l, authToken: u, workspaceToken: d, workspaceId: f, tenantId: p, currentUser: m } = e(), [h, g] = a([]), [_, v] = a([]), [y, b] = a([]), [x, S] = a([]), [C, w] = a(!1), [T, E] = a(null), D = i(() => ({
8
8
  apiGatewayUrl: l,
@@ -0,0 +1,100 @@
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/useDocumentExtractions.ts
5
+ var o = [
6
+ {
7
+ value: "BILL_OF_LADING",
8
+ label: "Bill of lading"
9
+ },
10
+ {
11
+ value: "PROOF_OF_DELIVERY",
12
+ label: "Proof of delivery"
13
+ },
14
+ {
15
+ value: "CARRIER_INVOICE",
16
+ label: "Carrier invoice"
17
+ },
18
+ {
19
+ value: "PACKING_LIST",
20
+ label: "Packing list"
21
+ }
22
+ ], s = "\n query MtwDocumentExtractions($fileId: ID!) {\n mtwDocumentExtractions(fileId: $fileId) {\n id\n fileId\n docType\n status\n fields { key label value confidence }\n acceptedFields\n shipmentId\n model\n costMicroUsd\n createdAt\n appliedAt\n appliedBy\n }\n }\n", c = "\n mutation MtwExtractDocument($fileId: ID!, $docType: MtwDocumentType!) {\n mtwExtractDocument(fileId: $fileId, docType: $docType) {\n id\n fileId\n docType\n status\n fields { key label value confidence }\n acceptedFields\n shipmentId\n model\n costMicroUsd\n createdAt\n appliedAt\n appliedBy\n }\n }\n", l = "\n mutation MtwApplyDocumentExtraction($extractionId: ID!, $accept: [String!]!, $corrections: [MtwExtractionCorrectionInput!]) {\n mtwApplyDocumentExtraction(extractionId: $extractionId, accept: $accept, corrections: $corrections) {\n id\n status\n fields { key label value confidence }\n acceptedFields\n appliedAt\n appliedBy\n }\n }\n";
23
+ function u(e) {
24
+ return {
25
+ ...e,
26
+ createdAt: new Date(e.createdAt),
27
+ appliedAt: e.appliedAt ? new Date(e.appliedAt) : null
28
+ };
29
+ }
30
+ function d(o) {
31
+ let { apiGatewayUrl: d, authToken: f, workspaceToken: p, workspaceId: m, tenantId: h, currentUser: g } = e(), [_, v] = a([]), [y, b] = a(!1), [x, S] = a(null), [C, w] = a(!1), [T, E] = a(null), D = i(() => ({
32
+ apiGatewayUrl: d,
33
+ authToken: f,
34
+ workspaceToken: p,
35
+ workspaceId: m,
36
+ tenantId: h,
37
+ actorId: g?.id
38
+ }), [
39
+ d,
40
+ f,
41
+ p,
42
+ m,
43
+ h,
44
+ g?.id
45
+ ]), O = n(async () => {
46
+ if (!o) {
47
+ v([]);
48
+ return;
49
+ }
50
+ b(!0), S(null);
51
+ try {
52
+ v(((await t(D, s, { fileId: o })).mtwDocumentExtractions ?? []).map(u));
53
+ } catch (e) {
54
+ S(e instanceof Error ? e.message : "Failed to load extractions"), v([]);
55
+ } finally {
56
+ b(!1);
57
+ }
58
+ }, [o, D]);
59
+ return r(() => {
60
+ O();
61
+ }, [O]), {
62
+ extractions: _,
63
+ isLoading: y,
64
+ error: x,
65
+ extracting: C,
66
+ extractError: T,
67
+ extract: n(async (e, n) => {
68
+ w(!0), E(null);
69
+ try {
70
+ let r = u((await t(D, c, {
71
+ fileId: e,
72
+ docType: n
73
+ })).mtwExtractDocument);
74
+ return v((e) => [r, ...e.filter((e) => e.id !== r.id)]), r;
75
+ } catch (e) {
76
+ return E(e instanceof Error ? e.message : "Extraction failed"), null;
77
+ } finally {
78
+ w(!1);
79
+ }
80
+ }, [D]),
81
+ apply: n(async (e, n, r) => {
82
+ try {
83
+ let i = u((await t(D, l, {
84
+ extractionId: e,
85
+ accept: n,
86
+ corrections: r
87
+ })).mtwApplyDocumentExtraction);
88
+ return v((e) => e.map((e) => e.id === i.id ? {
89
+ ...e,
90
+ ...i
91
+ } : e)), !0;
92
+ } catch {
93
+ return !1;
94
+ }
95
+ }, [D]),
96
+ refetch: () => void O()
97
+ };
98
+ }
99
+ //#endregion
100
+ export { o as DOCUMENT_TYPE_OPTIONS, d as useDocumentExtractions };
@@ -0,0 +1,57 @@
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, useRef as a, useState as o } from "react";
4
+ //#region src/movethewheels/hooks/useForecastModelChoices.ts
5
+ var s = "\n scopeType\n scopeKey\n scopeLabel\n historyWeeks\n selectedModel\n reason\n evaluatedAt\n candidates {\n model\n seasonLengthWeeks\n mape\n holdoutWeeks\n selected\n }\n", c = `
6
+ query GetMovethewheelsForecastModelChoices($limit: Int!) {
7
+ laneChoices: demandForecastModelChoices(scopeType: LANE, limit: $limit) {
8
+ ${s}
9
+ }
10
+ customerChoices: demandForecastModelChoices(scopeType: CUSTOMER, limit: $limit) {
11
+ ${s}
12
+ }
13
+ }
14
+ `;
15
+ function l(s = 5) {
16
+ let { apiGatewayUrl: l, authToken: u, workspaceToken: d, workspaceId: f, tenantId: p, currentUser: m } = e(), [h, g] = o([]), [_, v] = o([]), [y, b] = o(!0), [x, S] = o(null), C = a(0), w = i(() => ({
17
+ apiGatewayUrl: l,
18
+ authToken: u,
19
+ workspaceToken: d,
20
+ workspaceId: f,
21
+ tenantId: p,
22
+ actorId: m?.id
23
+ }), [
24
+ l,
25
+ u,
26
+ d,
27
+ f,
28
+ p,
29
+ m?.id
30
+ ]), T = n(async () => {
31
+ let e = ++C.current;
32
+ b(!0), S(null);
33
+ try {
34
+ let n = await t(w, c, { limit: s });
35
+ if (e !== C.current) return;
36
+ g(n.laneChoices ?? []), v(n.customerChoices ?? []);
37
+ } catch (t) {
38
+ if (e !== C.current) return;
39
+ S(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to load forecast models"));
40
+ } finally {
41
+ e === C.current && b(!1);
42
+ }
43
+ }, [w, s]);
44
+ return r(() => (T(), () => {
45
+ C.current += 1;
46
+ }), [T]), {
47
+ laneChoices: h,
48
+ customerChoices: _,
49
+ isLoading: y,
50
+ error: x,
51
+ refetch: n(() => {
52
+ T();
53
+ }, [T])
54
+ };
55
+ }
56
+ //#endregion
57
+ export { l as useForecastModelChoices };
@@ -0,0 +1,4 @@
1
+ import { DemandForecastModel } from '../hooks/useDemandForecast';
2
+ /** Short display name of a forecast model. */
3
+ export declare const forecastModelLabel: (model: DemandForecastModel, seasonLengthWeeks?: number | null) => string;
4
+ export declare function ForecastModelsPanel(): import('react').JSX.Element;
@@ -3,6 +3,13 @@
3
3
  * and customer plus the recent closed-period variance. Read-side only — the
4
4
  * admin console exposes `recalculateDemandForecasts` separately.
5
5
  */
6
+ /**
7
+ * The forecast model behind a row: the moving-average heuristic, or (once a
8
+ * lane or customer has 26 closed weeks and the model wins the back-test)
9
+ * Holt linear or Holt-Winters exponential smoothing. HEURISTIC_GROWTH_RATE is
10
+ * reserved and never produced.
11
+ */
12
+ export type DemandForecastModel = 'HEURISTIC_MOVING_AVG' | 'HEURISTIC_GROWTH_RATE' | 'HOLT_LINEAR' | 'HOLT_WINTERS';
6
13
  export interface ForecastPoint {
7
14
  scopeType: 'LANE' | 'CUSTOMER';
8
15
  scopeKey: string;
@@ -15,6 +22,8 @@ export interface ForecastPoint {
15
22
  actualVolume: number | null;
16
23
  actualRevenue: number | null;
17
24
  confidence: number;
25
+ /** The model that produced the row (BOFF-10925). */
26
+ model: DemandForecastModel;
18
27
  }
19
28
  export interface ForecastVariance {
20
29
  scopeType: 'LANE' | 'CUSTOMER';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * useDocumentExtractions — freight document intelligence (BOFF-3892).
3
+ *
4
+ * Lists the extraction runs a platform File has been through and drives the
5
+ * two mutations: mtwExtractDocument (vision model proposes typed fields with
6
+ * per-field confidence, metered on the shared AI runtime) and
7
+ * mtwApplyDocumentExtraction (a human accepts fields per-field; the mapped
8
+ * writes — POD delivery event, invoice comparison, BOL tracking number —
9
+ * happen only then, once each).
10
+ */
11
+ export type DocumentType = 'BILL_OF_LADING' | 'PROOF_OF_DELIVERY' | 'CARRIER_INVOICE' | 'PACKING_LIST';
12
+ export declare const DOCUMENT_TYPE_OPTIONS: ReadonlyArray<{
13
+ value: DocumentType;
14
+ label: string;
15
+ }>;
16
+ export interface ExtractionField {
17
+ key: string;
18
+ label: string;
19
+ value: string | null;
20
+ confidence: number;
21
+ }
22
+ export interface DocumentExtraction {
23
+ id: string;
24
+ fileId: string;
25
+ docType: DocumentType;
26
+ status: 'PROPOSED' | 'PARTIALLY_APPLIED' | 'APPLIED';
27
+ fields: ExtractionField[];
28
+ acceptedFields: string[];
29
+ shipmentId: string | null;
30
+ model: string;
31
+ costMicroUsd: string | null;
32
+ createdAt: Date;
33
+ appliedAt: Date | null;
34
+ appliedBy: string | null;
35
+ }
36
+ export interface UseDocumentExtractionsResult {
37
+ extractions: DocumentExtraction[];
38
+ isLoading: boolean;
39
+ error: string | null;
40
+ extracting: boolean;
41
+ extractError: string | null;
42
+ extract: (fileId: string, docType: DocumentType) => Promise<DocumentExtraction | null>;
43
+ apply: (extractionId: string, accept: string[], corrections: Array<{
44
+ key: string;
45
+ value: string;
46
+ }> | null) => Promise<boolean>;
47
+ refetch: () => void;
48
+ }
49
+ export declare function useDocumentExtractions(fileId: string | undefined): UseDocumentExtractionsResult;
@@ -2,10 +2,10 @@
2
2
  * useEntityDocuments — real document listing via wspace-files-svc.
3
3
  *
4
4
  * MoveTheWheels does NOT own a Document model. Documents attached to a vehicle,
5
- * driver or order live in the platform Files module (wspace-files-svc), which
6
- * federates into the same workspace gateway. We tag each uploaded file with two
7
- * marqueue entity tags — `mtwEntityType` and `mtwEntityId` — and list them back
8
- * here through `getFiles(filter:{ tags:[...] })`.
5
+ * driver, order, shipment or route live in the platform Files module
6
+ * (wspace-files-svc), which federates into the same workspace gateway. We tag
7
+ * each uploaded file with two marqueue entity tags — `mtwEntityType` and
8
+ * `mtwEntityId` — and list them back here through `getFiles(filter:{ tags:[...] })`.
9
9
  *
10
10
  * There is no upload UI here (out of scope): uploading/managing happens in the
11
11
  * Files module, deep-linked from DocumentsCard. This hook is read-only.
@@ -26,7 +26,7 @@
26
26
  * logic question outside a schema-shape validator's reach (it operates on
27
27
  * runtime variable values, not the query document). Flagged as follow-up.
28
28
  */
29
- export type EntityDocumentType = 'vehicle' | 'driver' | 'order';
29
+ export type EntityDocumentType = 'vehicle' | 'driver' | 'order' | 'shipment' | 'route';
30
30
  export interface EntityDocument {
31
31
  id: string;
32
32
  name: string;
@@ -0,0 +1,34 @@
1
+ import { DemandForecastModel } from './useDemandForecast';
2
+ /**
3
+ * Forecast model choices (BOFF-10925): which model forecasts each lane and
4
+ * customer, with every candidate's back-test error (MAPE), so the choice can
5
+ * be checked. Loaded separately from the forecast itself so a failure here
6
+ * never hides the upcoming demand.
7
+ */
8
+ export interface ForecastModelScore {
9
+ model: DemandForecastModel;
10
+ seasonLengthWeeks: number | null;
11
+ /** Mean absolute percentage error on weekly volume; 0.25 = 25%. */
12
+ mape: number | null;
13
+ holdoutWeeks: number;
14
+ selected: boolean;
15
+ }
16
+ export interface ForecastModelChoice {
17
+ scopeType: 'LANE' | 'CUSTOMER';
18
+ scopeKey: string;
19
+ scopeLabel: string;
20
+ historyWeeks: number;
21
+ selectedModel: DemandForecastModel;
22
+ reason: string;
23
+ evaluatedAt: string;
24
+ candidates: ForecastModelScore[];
25
+ }
26
+ interface UseForecastModelChoicesResult {
27
+ laneChoices: ForecastModelChoice[];
28
+ customerChoices: ForecastModelChoice[];
29
+ isLoading: boolean;
30
+ error: Error | null;
31
+ refetch: () => void;
32
+ }
33
+ export declare function useForecastModelChoices(limit?: number): UseForecastModelChoicesResult;
34
+ export {};
@@ -0,0 +1,24 @@
1
+ import { createLucideIcon as e } from "../createLucideIcon.js";
2
+ //#region node_modules/lucide-react/dist/esm/icons/file-search.js
3
+ var t = e("FileSearch", [
4
+ ["path", {
5
+ d: "M14 2v4a2 2 0 0 0 2 2h4",
6
+ key: "tnqrlb"
7
+ }],
8
+ ["path", {
9
+ d: "M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",
10
+ key: "ms7g94"
11
+ }],
12
+ ["path", {
13
+ d: "m9 18-1.5-1.5",
14
+ key: "1j6qii"
15
+ }],
16
+ ["circle", {
17
+ cx: "5",
18
+ cy: "14",
19
+ r: "3",
20
+ key: "ufru5t"
21
+ }]
22
+ ]);
23
+ //#endregion
24
+ export { t as FileSearch };
@@ -0,0 +1,8 @@
1
+ import { createLucideIcon as e } from "../createLucideIcon.js";
2
+ //#region node_modules/lucide-react/dist/esm/icons/sigma.js
3
+ var t = e("Sigma", [["path", {
4
+ d: "M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",
5
+ key: "wuwx1p"
6
+ }]]);
7
+ //#endregion
8
+ export { t as Sigma };
@@ -14,78 +14,79 @@ import { VolumeBar as x } from "../components/charts/VolumeBar.js";
14
14
  import { StatusDonut as S } from "../components/charts/StatusDonut.js";
15
15
  import "../components/charts/index.js";
16
16
  import { CarbonFootprintPanel as C } from "../components/CarbonFootprintPanel.js";
17
- import { UpcomingDemandPanel as w } from "../components/UpcomingDemandPanel.js";
18
- import { ScenarioPlanningPanel as T } from "../components/ScenarioPlanningPanel.js";
19
- import { useDemandForecast as E } from "../hooks/useDemandForecast.js";
20
- import { useMemo as D } from "react";
21
- import { jsx as O, jsxs as k } from "react/jsx-runtime";
22
- import { EmphasisPanel as A, PagePurpose as j } from "@burdenoff/fe-libs/ui";
17
+ import { ForecastModelsPanel as w } from "../components/ForecastModelsPanel.js";
18
+ import { UpcomingDemandPanel as T } from "../components/UpcomingDemandPanel.js";
19
+ import { ScenarioPlanningPanel as E } from "../components/ScenarioPlanningPanel.js";
20
+ import { useDemandForecast as D } from "../hooks/useDemandForecast.js";
21
+ import { useMemo as O } from "react";
22
+ import { jsx as k, jsxs as A } from "react/jsx-runtime";
23
+ import { EmphasisPanel as j, PagePurpose as M } from "@burdenoff/fe-libs/ui";
23
24
  //#region src/movethewheels/pages/AnalyticsPage.tsx
24
- var M = (e) => e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
25
- function N() {
26
- let { analytics: N, isLoading: P, error: F, refetch: I } = s(), { orderData: L } = l(), { fleetData: R } = c(), { laneForecast: z, customerForecast: B, laneVariance: V, customerVariance: H, isLoading: U, error: W, refetch: G } = E(4, 8), K = D(() => N.trends.dailyOrders.map((e) => e.orders), [N.trends.dailyOrders]), q = D(() => N.trends.revenue.map((e) => ({
25
+ var N = (e) => e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
26
+ function P() {
27
+ let { analytics: P, isLoading: F, error: I, refetch: L } = s(), { orderData: R } = l(), { fleetData: z } = c(), { laneForecast: B, customerForecast: V, laneVariance: H, customerVariance: U, isLoading: W, error: G, refetch: K } = D(4, 8), q = O(() => P.trends.dailyOrders.map((e) => e.orders), [P.trends.dailyOrders]), J = O(() => P.trends.revenue.map((e) => ({
27
28
  month: e.month,
28
29
  revenue: e.revenue
29
- })), [N.trends.revenue]), J = D(() => L.byStatus.filter((e) => e.count > 0).map((e) => ({
30
- name: M(e.status),
30
+ })), [P.trends.revenue]), Y = O(() => R.byStatus.filter((e) => e.count > 0).map((e) => ({
31
+ name: N(e.status),
31
32
  value: e.count
32
- })), [L.byStatus]), Y = J.reduce((e, t) => e + t.value, 0);
33
- return /* @__PURE__ */ k(g, {
33
+ })), [R.byStatus]), X = Y.reduce((e, t) => e + t.value, 0);
34
+ return /* @__PURE__ */ A(g, {
34
35
  title: "Analytics",
35
36
  subtitle: "Business performance and insights",
36
- icon: /* @__PURE__ */ O(e, { size: 24 }),
37
+ icon: /* @__PURE__ */ k(e, { size: 24 }),
37
38
  children: [
38
- /* @__PURE__ */ O(j, {
39
- icon: /* @__PURE__ */ O(e, { size: 18 }),
39
+ /* @__PURE__ */ k(M, {
40
+ icon: /* @__PURE__ */ k(e, { size: 18 }),
40
41
  children: "See how the operation is really performing. Track order volume, revenue, on-time rate and customer satisfaction over time so you can spot trends, find bottlenecks, and decide where to invest — whether that's more vehicles, better routes, or new customers."
41
42
  }),
42
- F && !P ? /* @__PURE__ */ O(d, {
43
+ I && !F ? /* @__PURE__ */ k(d, {
43
44
  className: "border-status-error-border",
44
- children: /* @__PURE__ */ k(f, {
45
+ children: /* @__PURE__ */ A(f, {
45
46
  className: "p-6 text-center space-y-3",
46
47
  children: [
47
- /* @__PURE__ */ O("p", {
48
+ /* @__PURE__ */ k("p", {
48
49
  className: "text-status-error-text font-medium",
49
50
  children: "Couldn't load analytics"
50
51
  }),
51
- /* @__PURE__ */ O("p", {
52
+ /* @__PURE__ */ k("p", {
52
53
  className: "text-sm text-text-secondary",
53
- children: F.message
54
+ children: I.message
54
55
  }),
55
- /* @__PURE__ */ O(u, {
56
+ /* @__PURE__ */ k(u, {
56
57
  variant: "outline",
57
- onClick: I,
58
+ onClick: L,
58
59
  children: "Retry"
59
60
  })
60
61
  ]
61
62
  })
62
- }) : P ? /* @__PURE__ */ O(y, {
63
+ }) : F ? /* @__PURE__ */ k(y, {
63
64
  columns: 4,
64
- children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ O(v, {}, t))
65
- }) : /* @__PURE__ */ k(y, {
65
+ children: Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ k(v, {}, t))
66
+ }) : /* @__PURE__ */ A(y, {
66
67
  columns: 4,
67
68
  children: [
68
- /* @__PURE__ */ O(_, {
69
+ /* @__PURE__ */ k(_, {
69
70
  label: "Order Volume",
70
- value: N.overview.totalOrders.toLocaleString(),
71
- icon: /* @__PURE__ */ O(n, { size: 20 }),
71
+ value: P.overview.totalOrders.toLocaleString(),
72
+ icon: /* @__PURE__ */ k(n, { size: 20 }),
72
73
  accent: "brand",
73
- sparklineData: K.length >= 2 ? K : void 0
74
+ sparklineData: q.length >= 2 ? q : void 0
74
75
  }),
75
- /* @__PURE__ */ O(_, {
76
+ /* @__PURE__ */ k(_, {
76
77
  treatment: "glass",
77
78
  glow: !0,
78
79
  label: "Revenue",
79
- value: o(N.overview.totalRevenue),
80
- icon: /* @__PURE__ */ O(t, { size: 20 }),
80
+ value: o(P.overview.totalRevenue),
81
+ icon: /* @__PURE__ */ k(t, { size: 20 }),
81
82
  accent: "success"
82
83
  }),
83
- /* @__PURE__ */ O(_, {
84
+ /* @__PURE__ */ k(_, {
84
85
  label: "On-Time Delivery",
85
- value: `${N.overview.onTimeDeliveryRate.toFixed(1)}%`,
86
- icon: /* @__PURE__ */ O(i, { size: 20 }),
86
+ value: `${P.overview.onTimeDeliveryRate.toFixed(1)}%`,
87
+ icon: /* @__PURE__ */ k(i, { size: 20 }),
87
88
  accent: "blue",
88
- delta: N.overview.onTimeDeliveryRate >= 90 ? {
89
+ delta: P.overview.onTimeDeliveryRate >= 90 ? {
89
90
  value: "On target",
90
91
  direction: "up"
91
92
  } : {
@@ -93,19 +94,19 @@ function N() {
93
94
  direction: "down"
94
95
  }
95
96
  }),
96
- /* @__PURE__ */ O(_, {
97
+ /* @__PURE__ */ k(_, {
97
98
  label: "Customer Satisfaction",
98
- value: N.overview.customerSatisfaction.toFixed(1),
99
- icon: /* @__PURE__ */ O(r, { size: 20 }),
99
+ value: P.overview.customerSatisfaction.toFixed(1),
100
+ icon: /* @__PURE__ */ k(r, { size: 20 }),
100
101
  accent: "warning",
101
102
  subtitle: "out of 5"
102
103
  })
103
104
  ]
104
105
  }),
105
- /* @__PURE__ */ k(d, { children: [/* @__PURE__ */ O(p, { children: /* @__PURE__ */ O(m, { children: "Order & delivery trend" }) }), /* @__PURE__ */ O(f, { children: /* @__PURE__ */ O(b, {
106
+ /* @__PURE__ */ A(d, { children: [/* @__PURE__ */ k(p, { children: /* @__PURE__ */ k(m, { children: "Order & delivery trend" }) }), /* @__PURE__ */ k(f, { children: /* @__PURE__ */ k(b, {
106
107
  xKey: "date",
107
108
  height: 300,
108
- data: N.trends.dailyOrders,
109
+ data: P.trends.dailyOrders,
109
110
  series: [{
110
111
  dataKey: "orders",
111
112
  name: "Orders"
@@ -115,100 +116,101 @@ function N() {
115
116
  }],
116
117
  emptyMessage: "No order trend recorded yet"
117
118
  }) })] }),
118
- /* @__PURE__ */ O(w, {
119
- laneForecast: z,
120
- customerForecast: B,
121
- laneVariance: V,
122
- customerVariance: H,
123
- isLoading: U,
124
- error: W,
125
- onRetry: G
119
+ /* @__PURE__ */ k(T, {
120
+ laneForecast: B,
121
+ customerForecast: V,
122
+ laneVariance: H,
123
+ customerVariance: U,
124
+ isLoading: W,
125
+ error: G,
126
+ onRetry: K
126
127
  }),
127
- /* @__PURE__ */ O(T, {}),
128
- /* @__PURE__ */ k("div", {
128
+ /* @__PURE__ */ k(w, {}),
129
+ /* @__PURE__ */ k(E, {}),
130
+ /* @__PURE__ */ A("div", {
129
131
  className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
130
- children: [/* @__PURE__ */ k(d, { children: [/* @__PURE__ */ O(p, { children: /* @__PURE__ */ O(m, { children: "Revenue by month" }) }), /* @__PURE__ */ O(f, { children: /* @__PURE__ */ O(x, {
132
+ children: [/* @__PURE__ */ A(d, { children: [/* @__PURE__ */ k(p, { children: /* @__PURE__ */ k(m, { children: "Revenue by month" }) }), /* @__PURE__ */ k(f, { children: /* @__PURE__ */ k(x, {
131
133
  xKey: "month",
132
134
  height: 280,
133
135
  showLegend: !1,
134
- data: q,
136
+ data: J,
135
137
  series: [{
136
138
  dataKey: "revenue",
137
139
  name: "Revenue"
138
140
  }],
139
141
  valueFormatter: (e) => o(Number(e)),
140
142
  emptyMessage: "No revenue recorded yet"
141
- }) })] }), /* @__PURE__ */ k(d, { children: [/* @__PURE__ */ O(p, { children: /* @__PURE__ */ O(m, { children: "Orders by status" }) }), /* @__PURE__ */ O(f, { children: /* @__PURE__ */ O(S, {
142
- data: J,
143
+ }) })] }), /* @__PURE__ */ A(d, { children: [/* @__PURE__ */ k(p, { children: /* @__PURE__ */ k(m, { children: "Orders by status" }) }), /* @__PURE__ */ k(f, { children: /* @__PURE__ */ k(S, {
144
+ data: Y,
143
145
  height: 240,
144
- centerLabel: Y.toLocaleString(),
146
+ centerLabel: X.toLocaleString(),
145
147
  centerSubLabel: "orders",
146
148
  emptyMessage: "No orders to break down yet"
147
149
  }) })] })]
148
150
  }),
149
- /* @__PURE__ */ k("div", {
151
+ /* @__PURE__ */ A("div", {
150
152
  className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
151
- children: [/* @__PURE__ */ k(d, { children: [/* @__PURE__ */ O(p, { children: /* @__PURE__ */ O(m, { children: "Fleet Performance" }) }), /* @__PURE__ */ k(f, {
153
+ children: [/* @__PURE__ */ A(d, { children: [/* @__PURE__ */ k(p, { children: /* @__PURE__ */ k(m, { children: "Fleet Performance" }) }), /* @__PURE__ */ A(f, {
152
154
  className: "space-y-4",
153
- children: [/* @__PURE__ */ k("div", { children: [/* @__PURE__ */ k("div", {
155
+ children: [/* @__PURE__ */ A("div", { children: [/* @__PURE__ */ A("div", {
154
156
  className: "flex justify-between text-sm mb-1",
155
- children: [/* @__PURE__ */ O("span", { children: "Vehicle Utilization" }), /* @__PURE__ */ k("span", { children: [R.vehicleUtilization.toFixed(0), "%"] })]
156
- }), /* @__PURE__ */ O(h, { value: R.vehicleUtilization })] }), R.vehiclesByType.length > 0 && /* @__PURE__ */ k("div", {
157
+ children: [/* @__PURE__ */ k("span", { children: "Vehicle Utilization" }), /* @__PURE__ */ A("span", { children: [z.vehicleUtilization.toFixed(0), "%"] })]
158
+ }), /* @__PURE__ */ k(h, { value: z.vehicleUtilization })] }), z.vehiclesByType.length > 0 && /* @__PURE__ */ A("div", {
157
159
  className: "pt-2",
158
- children: [/* @__PURE__ */ O("p", {
160
+ children: [/* @__PURE__ */ k("p", {
159
161
  className: "text-sm text-text-secondary mb-2",
160
162
  children: "Vehicles by Type"
161
- }), R.vehiclesByType.map(({ type: e, count: t }) => /* @__PURE__ */ k("div", {
163
+ }), z.vehiclesByType.map(({ type: e, count: t }) => /* @__PURE__ */ A("div", {
162
164
  className: "flex justify-between text-sm py-1",
163
- children: [/* @__PURE__ */ O("span", {
165
+ children: [/* @__PURE__ */ k("span", {
164
166
  className: "capitalize",
165
167
  children: e
166
- }), /* @__PURE__ */ O("span", {
168
+ }), /* @__PURE__ */ k("span", {
167
169
  className: "font-medium",
168
170
  children: t
169
171
  })]
170
172
  }, e))]
171
173
  })]
172
- })] }), /* @__PURE__ */ k(A, {
174
+ })] }), /* @__PURE__ */ A(j, {
173
175
  className: "space-y-4",
174
176
  children: [
175
- /* @__PURE__ */ O("h2", {
177
+ /* @__PURE__ */ k("h2", {
176
178
  className: "text-base font-semibold text-text-primary",
177
179
  children: "Performance Metrics"
178
180
  }),
179
- /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("p", {
181
+ /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
180
182
  className: "text-sm text-text-secondary",
181
183
  children: "On-Time Delivery"
182
- }), /* @__PURE__ */ k("p", {
184
+ }), /* @__PURE__ */ A("p", {
183
185
  className: "text-2xl font-bold",
184
- children: [N.performance.onTimeDelivery.toFixed(1), "%"]
186
+ children: [P.performance.onTimeDelivery.toFixed(1), "%"]
185
187
  })] }),
186
- /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("p", {
188
+ /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
187
189
  className: "text-sm text-text-secondary",
188
190
  children: "Customer Satisfaction"
189
- }), /* @__PURE__ */ k("p", {
191
+ }), /* @__PURE__ */ A("p", {
190
192
  className: "text-2xl font-bold",
191
- children: [N.overview.customerSatisfaction.toFixed(1), "/5"]
193
+ children: [P.overview.customerSatisfaction.toFixed(1), "/5"]
192
194
  })] }),
193
- /* @__PURE__ */ k("div", {
195
+ /* @__PURE__ */ A("div", {
194
196
  className: "flex items-center gap-2",
195
- children: [/* @__PURE__ */ O(a, {
197
+ children: [/* @__PURE__ */ k(a, {
196
198
  size: 16,
197
199
  className: "text-text-secondary"
198
- }), /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("p", {
200
+ }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
199
201
  className: "text-sm text-text-secondary",
200
202
  children: "Driver Ratings"
201
- }), /* @__PURE__ */ k("p", {
203
+ }), /* @__PURE__ */ A("p", {
202
204
  className: "text-2xl font-bold",
203
- children: [N.performance.driverRatings.toFixed(1), "/5"]
205
+ children: [P.performance.driverRatings.toFixed(1), "/5"]
204
206
  })] })]
205
207
  })
206
208
  ]
207
209
  })]
208
210
  }),
209
- /* @__PURE__ */ O(C, {})
211
+ /* @__PURE__ */ k(C, {})
210
212
  ]
211
213
  });
212
214
  }
213
215
  //#endregion
214
- export { N as default };
216
+ export { P as default };