@burdenoff/microfe-movethewheels 2026.1026.2 → 2026.1028.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 (50) hide show
  1. package/dist/MoveTheWheelsRoot.js +126 -159
  2. package/dist/MoveTheWheelsRoutes.js +16 -32
  3. package/dist/components/ProofOfDeliveryCard.js +1 -1
  4. package/dist/components/UpcomingDemandPanel.js +1 -1
  5. package/dist/hooks/index.js +0 -3
  6. package/dist/index.js +27 -30
  7. package/dist/movethewheels/hooks/index.d.ts +0 -3
  8. package/dist/pages/ContainersPage.js +3 -3
  9. package/dist/pages/TrackingPage.js +111 -56
  10. package/package.json +2 -1
  11. package/src/movethewheels/MoveTheWheelsRoot.tsx +2 -46
  12. package/src/movethewheels/MoveTheWheelsRoutes.tsx +0 -16
  13. package/src/movethewheels/components/ProofOfDeliveryCard.tsx +1 -1
  14. package/src/movethewheels/components/UpcomingDemandPanel.tsx +2 -2
  15. package/src/movethewheels/hooks/index.ts +0 -9
  16. package/src/movethewheels/pages/ContainersPage.tsx +3 -3
  17. package/src/movethewheels/pages/TrackingPage.tsx +54 -9
  18. package/dist/hooks/useImportExport.js +0 -27
  19. package/dist/hooks/useReports.js +0 -75
  20. package/dist/hooks/useSettings.js +0 -67
  21. package/dist/movethewheels/hooks/useImportExport.d.ts +0 -23
  22. package/dist/movethewheels/hooks/useReports.d.ts +0 -39
  23. package/dist/movethewheels/hooks/useSettings.d.ts +0 -17
  24. package/dist/movethewheels/pages/ImportExportPage.d.ts +0 -8
  25. package/dist/movethewheels/pages/MarketplacePage.d.ts +0 -12
  26. package/dist/movethewheels/pages/ReportsPage.d.ts +0 -8
  27. package/dist/movethewheels/pages/SettingsPage.d.ts +0 -8
  28. package/dist/node_modules/lucide-react/dist/esm/icons/bell.js +0 -11
  29. package/dist/node_modules/lucide-react/dist/esm/icons/file-chart-column-increasing.js +0 -26
  30. package/dist/node_modules/lucide-react/dist/esm/icons/file-spreadsheet.js +0 -30
  31. package/dist/node_modules/lucide-react/dist/esm/icons/globe.js +0 -20
  32. package/dist/node_modules/lucide-react/dist/esm/icons/settings.js +0 -13
  33. package/dist/node_modules/lucide-react/dist/esm/icons/shield.js +0 -8
  34. package/dist/node_modules/lucide-react/dist/esm/icons/store.js +0 -26
  35. package/dist/node_modules/lucide-react/dist/esm/icons/webhook.js +0 -18
  36. package/dist/pages/ImportExportPage.js +0 -245
  37. package/dist/pages/MarketplacePage.js +0 -23
  38. package/dist/pages/ReportsPage.js +0 -328
  39. package/dist/pages/SettingsPage.js +0 -404
  40. package/dist/utils/download.js +0 -22
  41. package/src/movethewheels/hooks/useImportExport.ts +0 -65
  42. package/src/movethewheels/hooks/useReports.ts +0 -154
  43. package/src/movethewheels/hooks/useSettings.ts +0 -124
  44. package/src/movethewheels/pages/ImportExportPage.tsx +0 -288
  45. package/src/movethewheels/pages/MarketplacePage.tsx +0 -36
  46. package/src/movethewheels/pages/ReportsPage.tsx +0 -379
  47. package/src/movethewheels/pages/SettingsPage.tsx +0 -548
  48. package/src/operations/wspace/movethewheels/fragments/core.withdrawn.graphql +0 -59
  49. package/src/operations/wspace/movethewheels/mutations/marketplace-reports.withdrawn.graphql +0 -93
  50. package/src/operations/wspace/movethewheels/queries/marketplace-reports.withdrawn.graphql +0 -58
@@ -1,75 +0,0 @@
1
- import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
2
- import { useCallback as t, useEffect as n, useState as r } from "react";
3
- //#region src/movethewheels/hooks/useReports.ts
4
- function i() {
5
- return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
6
- }
7
- function a(e) {
8
- return `movethewheels:reports:${e ?? "default"}`;
9
- }
10
- function o(e) {
11
- if (typeof window > "u") return [];
12
- try {
13
- let t = window.localStorage.getItem(a(e));
14
- if (!t) return [];
15
- let n = JSON.parse(t);
16
- return Array.isArray(n) ? n : [];
17
- } catch {
18
- return [];
19
- }
20
- }
21
- function s(e, t) {
22
- if (!(typeof window > "u")) try {
23
- window.localStorage.setItem(a(e), JSON.stringify(t));
24
- } catch {}
25
- }
26
- function c(a = {}) {
27
- let { limit: c = 100, offset: l = 0 } = a, { workspaceId: u } = e(), [d, f] = r([]), [p, m] = r(!1), [h, g] = r(!1), [_, v] = r(null), y = t(() => {
28
- g(!0), v(null);
29
- try {
30
- let e = o(u).slice(l, l + c);
31
- m(e.length === c), f(e);
32
- } catch (e) {
33
- v(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load reports"));
34
- } finally {
35
- g(!1);
36
- }
37
- }, [
38
- u,
39
- c,
40
- l
41
- ]);
42
- return n(() => {
43
- y();
44
- }, [y]), {
45
- reports: d,
46
- hasMore: p,
47
- isLoading: h,
48
- error: _,
49
- refetch: t(() => {
50
- y();
51
- }, [y]),
52
- createReport: t(async (e) => {
53
- let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
54
- id: i(),
55
- name: e.name,
56
- description: e.description ?? null,
57
- type: e.type,
58
- status: e.status ?? "ready",
59
- schedule: e.schedule ?? null,
60
- lastGenerated: null,
61
- createdAt: t,
62
- updatedAt: t
63
- };
64
- return f((e) => {
65
- let t = [n, ...e];
66
- return s(u, t), t;
67
- }), n;
68
- }, [u]),
69
- generateReport: t(async (e, t) => {
70
- throw Error("Report generation is not available: the movethewheelsReports surface was withdrawn from the service.");
71
- }, [])
72
- };
73
- }
74
- //#endregion
75
- export { c as useReports };
@@ -1,67 +0,0 @@
1
- import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
2
- import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
3
- //#region src/movethewheels/hooks/useSettings.ts
4
- function a(e) {
5
- if (typeof window > "u") return null;
6
- try {
7
- let t = window.localStorage.getItem(`movethewheels:moduleSettings:${e}`);
8
- if (!t) return null;
9
- let n = JSON.parse(t);
10
- return n && typeof n == "object" && "preferences" in n ? n : null;
11
- } catch {
12
- return null;
13
- }
14
- }
15
- function o(e) {
16
- if (!(typeof window > "u")) try {
17
- window.localStorage.setItem(`movethewheels:moduleSettings:${e.workspaceId}`, JSON.stringify(e));
18
- } catch {}
19
- }
20
- function s() {
21
- let { workspaceId: s } = e(), [c, l] = i(null), [u, d] = i(!1), [f, p] = i(!1), [m, h] = i(null), g = t(() => {
22
- d(!0), h(null);
23
- try {
24
- l((s ? a(s) : null) ?? {
25
- preferences: {},
26
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
27
- workspaceId: s ?? ""
28
- });
29
- } catch (e) {
30
- h(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load settings"));
31
- } finally {
32
- d(!1);
33
- }
34
- }, [s]);
35
- n(() => {
36
- g();
37
- }, [g]);
38
- let _ = t(() => {
39
- g();
40
- }, [g]), v = t(async (e) => {
41
- p(!0), h(null);
42
- try {
43
- let t = {
44
- preferences: e,
45
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
46
- workspaceId: s ?? ""
47
- };
48
- return o(t), l(t), t;
49
- } catch (e) {
50
- let t = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to save settings");
51
- throw h(t), t;
52
- } finally {
53
- p(!1);
54
- }
55
- }, [s]);
56
- return {
57
- settings: c,
58
- preferences: r(() => c?.preferences ?? {}, [c]),
59
- isLoading: u,
60
- isSaving: f,
61
- error: m,
62
- refetch: _,
63
- savePreferences: v
64
- };
65
- }
66
- //#endregion
67
- export { s as useModuleSettings };
@@ -1,23 +0,0 @@
1
- export interface ImportExportResult {
2
- success: boolean;
3
- message: string;
4
- payload?: Record<string, unknown> | null;
5
- }
6
- interface UseImportExportResult {
7
- exportData: (resource: string, format?: string) => Promise<ImportExportResult>;
8
- importData: (resource: string, payload: Record<string, unknown>) => Promise<ImportExportResult>;
9
- isBusy: boolean;
10
- error: Error | null;
11
- }
12
- /**
13
- * Import/export surface withdrawn from wspace-movethewheels-svc by migration
14
- * 20260707000001_movethewheels_reuse_cleanup. The service now exposes
15
- * `exportMtwEntities` (async job, returns MtwExportJob) but no import
16
- * counterpart, so the old synchronous exportData/importData mutations are no
17
- * longer resolvable. This hook keeps the same contract for consumers but
18
- * rejects calls with a clear message until a replacement import/export flow is
19
- * designed. The original operations are preserved in
20
- * src/operations/wspace/movethewheels/mutations/marketplace-reports.withdrawn.graphql.
21
- */
22
- export declare function useImportExport(): UseImportExportResult;
23
- export {};
@@ -1,39 +0,0 @@
1
- export interface MovethewheelsReport {
2
- id: string;
3
- name: string;
4
- description?: string | null;
5
- type: string;
6
- status: string;
7
- schedule?: string | null;
8
- lastGenerated?: string | null;
9
- createdAt: string;
10
- updatedAt: string;
11
- }
12
- export interface GeneratedReport {
13
- generatedAt: string;
14
- result?: Record<string, unknown> | null;
15
- report: MovethewheelsReport;
16
- }
17
- export interface CreateReportInput {
18
- name: string;
19
- type: string;
20
- description?: string;
21
- schedule?: string;
22
- status?: string;
23
- }
24
- interface UseReportsOptions {
25
- limit?: number;
26
- offset?: number;
27
- }
28
- interface UseReportsResult {
29
- reports: MovethewheelsReport[];
30
- /** True when the last fetch returned a full page (rawCount === limit). */
31
- hasMore: boolean;
32
- isLoading: boolean;
33
- error: Error | null;
34
- refetch: () => void;
35
- createReport: (input: CreateReportInput) => Promise<MovethewheelsReport>;
36
- generateReport: (reportId: string, parameters?: Record<string, unknown>) => Promise<GeneratedReport>;
37
- }
38
- export declare function useReports(options?: UseReportsOptions): UseReportsResult;
39
- export {};
@@ -1,17 +0,0 @@
1
- export type ModulePreferences = Record<string, unknown>;
2
- export interface ModuleSettings {
3
- preferences: ModulePreferences;
4
- updatedAt: string;
5
- workspaceId: string;
6
- }
7
- interface UseModuleSettingsResult {
8
- settings: ModuleSettings | null;
9
- preferences: ModulePreferences;
10
- isLoading: boolean;
11
- isSaving: boolean;
12
- error: Error | null;
13
- refetch: () => void;
14
- savePreferences: (preferences: ModulePreferences) => Promise<ModuleSettings>;
15
- }
16
- export declare function useModuleSettings(): UseModuleSettingsResult;
17
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * Import/Export Page
3
- *
4
- * Bulk data in/out wired to the backend exportData / importData mutations.
5
- * Activity is session-local (reflects actions the operator actually ran) — no
6
- * fabricated history is shown; the empty state renders until something happens.
7
- */
8
- export default function ImportExportPage(): import('react').JSX.Element;
@@ -1,12 +0,0 @@
1
- /**
2
- * Marketplace Page
3
- *
4
- * The collaborative logistics marketplace (service providers / service offerings)
5
- * was withdrawn from wspace-movethewheels-svc by migration
6
- * 20260707000001_movethewheels_reuse_cleanup. The original query and mutation
7
- * documents are preserved verbatim in
8
- * src/operations/wspace/movethewheels/{queries,mutations}/marketplace-reports.withdrawn.graphql
9
- * so they can be restored if the surface returns. Until then the page renders a
10
- * static "coming soon" state.
11
- */
12
- export default function MarketplacePage(): import('react').JSX.Element;
@@ -1,8 +0,0 @@
1
- /**
2
- * Reports Page
3
- *
4
- * Lists reports from the backend (movethewheelsReports) and lets operators
5
- * create, schedule and generate them via the real mutations. Pre-launch
6
- * workspaces start empty — no fabricated report history is shown.
7
- */
8
- export default function ReportsPage(): import('react').JSX.Element;
@@ -1,8 +0,0 @@
1
- /**
2
- * Settings Page
3
- *
4
- * Loads persisted module settings (Query.moduleSettings.preferences) and saves
5
- * changes via updateModuleSettings. Integrations read "Not configured" until a
6
- * real connection is recorded — no fabricated "Connected" statuses.
7
- */
8
- export default function SettingsPage(): import('react').JSX.Element;
@@ -1,11 +0,0 @@
1
- import { createLucideIcon as e } from "../createLucideIcon.js";
2
- //#region node_modules/lucide-react/dist/esm/icons/bell.js
3
- var t = e("Bell", [["path", {
4
- d: "M10.268 21a2 2 0 0 0 3.464 0",
5
- key: "vwvbt9"
6
- }], ["path", {
7
- d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",
8
- key: "11g9vi"
9
- }]]);
10
- //#endregion
11
- export { t as Bell };
@@ -1,26 +0,0 @@
1
- import { createLucideIcon as e } from "../createLucideIcon.js";
2
- //#region node_modules/lucide-react/dist/esm/icons/file-chart-column-increasing.js
3
- var t = e("FileChartColumnIncreasing", [
4
- ["path", {
5
- d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",
6
- key: "1rqfz7"
7
- }],
8
- ["path", {
9
- d: "M14 2v4a2 2 0 0 0 2 2h4",
10
- key: "tnqrlb"
11
- }],
12
- ["path", {
13
- d: "M8 18v-2",
14
- key: "qcmpov"
15
- }],
16
- ["path", {
17
- d: "M12 18v-4",
18
- key: "q1q25u"
19
- }],
20
- ["path", {
21
- d: "M16 18v-6",
22
- key: "15y0np"
23
- }]
24
- ]);
25
- //#endregion
26
- export { t as FileChartColumnIncreasing };
@@ -1,30 +0,0 @@
1
- import { createLucideIcon as e } from "../createLucideIcon.js";
2
- //#region node_modules/lucide-react/dist/esm/icons/file-spreadsheet.js
3
- var t = e("FileSpreadsheet", [
4
- ["path", {
5
- d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",
6
- key: "1rqfz7"
7
- }],
8
- ["path", {
9
- d: "M14 2v4a2 2 0 0 0 2 2h4",
10
- key: "tnqrlb"
11
- }],
12
- ["path", {
13
- d: "M8 13h2",
14
- key: "yr2amv"
15
- }],
16
- ["path", {
17
- d: "M14 13h2",
18
- key: "un5t4a"
19
- }],
20
- ["path", {
21
- d: "M8 17h2",
22
- key: "2yhykz"
23
- }],
24
- ["path", {
25
- d: "M14 17h2",
26
- key: "10kma7"
27
- }]
28
- ]);
29
- //#endregion
30
- export { t as FileSpreadsheet };
@@ -1,20 +0,0 @@
1
- import { createLucideIcon as e } from "../createLucideIcon.js";
2
- //#region node_modules/lucide-react/dist/esm/icons/globe.js
3
- var t = e("Globe", [
4
- ["circle", {
5
- cx: "12",
6
- cy: "12",
7
- r: "10",
8
- key: "1mglay"
9
- }],
10
- ["path", {
11
- d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",
12
- key: "13o1zl"
13
- }],
14
- ["path", {
15
- d: "M2 12h20",
16
- key: "9i4pu4"
17
- }]
18
- ]);
19
- //#endregion
20
- export { t as Globe };
@@ -1,13 +0,0 @@
1
- import { createLucideIcon as e } from "../createLucideIcon.js";
2
- //#region node_modules/lucide-react/dist/esm/icons/settings.js
3
- var t = e("Settings", [["path", {
4
- d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",
5
- key: "1qme2f"
6
- }], ["circle", {
7
- cx: "12",
8
- cy: "12",
9
- r: "3",
10
- key: "1v7zrd"
11
- }]]);
12
- //#endregion
13
- export { t as Settings };
@@ -1,8 +0,0 @@
1
- import { createLucideIcon as e } from "../createLucideIcon.js";
2
- //#region node_modules/lucide-react/dist/esm/icons/shield.js
3
- var t = e("Shield", [["path", {
4
- d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
5
- key: "oel41y"
6
- }]]);
7
- //#endregion
8
- export { t as Shield };
@@ -1,26 +0,0 @@
1
- import { createLucideIcon as e } from "../createLucideIcon.js";
2
- //#region node_modules/lucide-react/dist/esm/icons/store.js
3
- var t = e("Store", [
4
- ["path", {
5
- d: "m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",
6
- key: "ztvudi"
7
- }],
8
- ["path", {
9
- d: "M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",
10
- key: "1b2hhj"
11
- }],
12
- ["path", {
13
- d: "M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",
14
- key: "2ebpfo"
15
- }],
16
- ["path", {
17
- d: "M2 7h20",
18
- key: "1fcdvo"
19
- }],
20
- ["path", {
21
- d: "M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",
22
- key: "6c3vgh"
23
- }]
24
- ]);
25
- //#endregion
26
- export { t as Store };
@@ -1,18 +0,0 @@
1
- import { createLucideIcon as e } from "../createLucideIcon.js";
2
- //#region node_modules/lucide-react/dist/esm/icons/webhook.js
3
- var t = e("Webhook", [
4
- ["path", {
5
- d: "M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",
6
- key: "q3hayz"
7
- }],
8
- ["path", {
9
- d: "m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",
10
- key: "1go1hn"
11
- }],
12
- ["path", {
13
- d: "m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",
14
- key: "qlwsc0"
15
- }]
16
- ]);
17
- //#endregion
18
- export { t as Webhook };
@@ -1,245 +0,0 @@
1
- import { Check as e } from "../node_modules/lucide-react/dist/esm/icons/check.js";
2
- import { Download as t } from "../node_modules/lucide-react/dist/esm/icons/download.js";
3
- import { FileSpreadsheet as n } from "../node_modules/lucide-react/dist/esm/icons/file-spreadsheet.js";
4
- import { FileText as r } from "../node_modules/lucide-react/dist/esm/icons/file-text.js";
5
- import { Upload as i } from "../node_modules/lucide-react/dist/esm/icons/upload.js";
6
- import { X as a } from "../node_modules/lucide-react/dist/esm/icons/x.js";
7
- import { useImportExport as o } from "../hooks/useImportExport.js";
8
- import { Badge as s, Button as c, Card as l, CardContent as u, CardHeader as d, CardTitle as f } from "../components/ui.js";
9
- import { PageLayout as p } from "../components/PageLayout.js";
10
- import { useRef as m, useState as h } from "react";
11
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
12
- import { EmphasisPanel as v, IllustratedEmptyState as y, PagePurpose as b } from "@burdenoff/fe-libs/ui";
13
- //#region src/movethewheels/pages/ImportExportPage.tsx
14
- var x = [
15
- {
16
- name: "Orders",
17
- description: "Import orders from CSV or JSON",
18
- resource: "orders"
19
- },
20
- {
21
- name: "Customers",
22
- description: "Import customer database",
23
- resource: "customers"
24
- },
25
- {
26
- name: "Products",
27
- description: "Import product catalog",
28
- resource: "products"
29
- },
30
- {
31
- name: "Inventory",
32
- description: "Import inventory levels",
33
- resource: "inventory"
34
- }
35
- ], S = [
36
- {
37
- name: "Orders Report",
38
- description: "Export all orders data",
39
- resource: "orders",
40
- formats: ["CSV", "JSON"]
41
- },
42
- {
43
- name: "Financial Report",
44
- description: "Export revenue and payments",
45
- resource: "finance",
46
- formats: ["CSV", "JSON"]
47
- },
48
- {
49
- name: "Fleet Report",
50
- description: "Export vehicle and driver data",
51
- resource: "fleet",
52
- formats: ["CSV", "JSON"]
53
- },
54
- {
55
- name: "Analytics Report",
56
- description: "Export performance metrics",
57
- resource: "analytics",
58
- formats: ["CSV", "JSON"]
59
- }
60
- ];
61
- function C() {
62
- let { exportData: C, importData: w, isBusy: T } = o(), [E, D] = h([]), [O, k] = h(null), A = m(null), j = m(null), M = (e) => D((t) => [e, ...t]), N = async (e, t) => {
63
- k(`${e.resource}:${t}`);
64
- try {
65
- let n = await C(e.resource, t);
66
- if (n.success && n.payload) {
67
- let r = JSON.stringify(n.payload, null, 2), i = new Blob([r], { type: "application/json" }), a = URL.createObjectURL(i), o = document.createElement("a");
68
- o.href = a, o.download = `${e.resource}-export.${t.toLowerCase() === "csv" ? "csv" : "json"}`, document.body.appendChild(o), o.click(), o.remove(), URL.revokeObjectURL(a);
69
- }
70
- M({
71
- type: "export",
72
- name: `${e.name} (${t})`,
73
- at: /* @__PURE__ */ new Date(),
74
- success: n.success,
75
- message: n.message
76
- });
77
- } catch (n) {
78
- M({
79
- type: "export",
80
- name: `${e.name} (${t})`,
81
- at: /* @__PURE__ */ new Date(),
82
- success: !1,
83
- message: n instanceof Error ? n.message : "Export failed"
84
- });
85
- } finally {
86
- k(null);
87
- }
88
- }, P = (e) => {
89
- j.current = e, A.current?.click();
90
- };
91
- return /* @__PURE__ */ _(p, {
92
- title: "Import / Export",
93
- subtitle: "Import and export your data",
94
- icon: /* @__PURE__ */ g(r, { size: 24 }),
95
- children: [
96
- /* @__PURE__ */ g(b, {
97
- icon: /* @__PURE__ */ g(r, { size: 18 }),
98
- children: "Move data in and out in bulk. Import orders, customers, products or inventory from CSV/JSON to onboard or migrate without re-keying, and export any dataset for accounting, BI tools or backups — no manual copy-paste required."
99
- }),
100
- /* @__PURE__ */ g("input", {
101
- ref: A,
102
- type: "file",
103
- accept: ".csv,.json,application/json,text/csv",
104
- className: "hidden",
105
- onChange: async (e) => {
106
- let t = e.target.files?.[0], n = j.current;
107
- if (e.target.value = "", !(!t || !n)) {
108
- k(`import:${n.resource}`);
109
- try {
110
- let e = await t.text(), r = await w(n.resource, {
111
- filename: t.name,
112
- content: e
113
- });
114
- M({
115
- type: "import",
116
- name: `${n.name} — ${t.name}`,
117
- at: /* @__PURE__ */ new Date(),
118
- success: r.success,
119
- message: r.message
120
- });
121
- } catch (e) {
122
- M({
123
- type: "import",
124
- name: `${n.name} — ${t.name}`,
125
- at: /* @__PURE__ */ new Date(),
126
- success: !1,
127
- message: e instanceof Error ? e.message : "Import failed"
128
- });
129
- } finally {
130
- k(null);
131
- }
132
- }
133
- }
134
- }),
135
- /* @__PURE__ */ _("div", {
136
- className: "grid grid-cols-1 lg:grid-cols-2 gap-6",
137
- children: [/* @__PURE__ */ _(v, {
138
- className: "space-y-4",
139
- children: [/* @__PURE__ */ _("h2", {
140
- className: "flex items-center gap-2 text-base font-semibold text-text-primary",
141
- children: [/* @__PURE__ */ g(i, { size: 18 }), " Import Data"]
142
- }), /* @__PURE__ */ g("div", {
143
- className: "space-y-4",
144
- children: x.map((e) => /* @__PURE__ */ _("div", {
145
- className: "flex items-center justify-between p-4 border rounded-lg hover:border-primary/50 transition-colors",
146
- children: [/* @__PURE__ */ _("div", {
147
- className: "flex items-center gap-3",
148
- children: [/* @__PURE__ */ g("div", {
149
- className: "w-10 h-10 rounded-lg bg-action-primary-bg/10 flex items-center justify-center",
150
- children: /* @__PURE__ */ g(n, {
151
- size: 20,
152
- className: "text-primary"
153
- })
154
- }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
155
- className: "font-medium",
156
- children: e.name
157
- }), /* @__PURE__ */ g("p", {
158
- className: "text-sm text-text-secondary",
159
- children: e.description
160
- })] })]
161
- }), /* @__PURE__ */ _("div", {
162
- className: "text-right",
163
- children: [/* @__PURE__ */ g(s, {
164
- variant: "outline",
165
- children: "CSV, JSON"
166
- }), /* @__PURE__ */ g(c, {
167
- variant: "outline",
168
- size: "sm",
169
- className: "ml-2",
170
- "aria-label": `Import ${e.name}`,
171
- disabled: T,
172
- onClick: () => P(e),
173
- children: /* @__PURE__ */ g(i, { size: 14 })
174
- })]
175
- })]
176
- }, e.name))
177
- })]
178
- }), /* @__PURE__ */ _(l, { children: [/* @__PURE__ */ g(d, { children: /* @__PURE__ */ _(f, {
179
- className: "flex items-center gap-2",
180
- children: [/* @__PURE__ */ g(t, { size: 18 }), " Export Data"]
181
- }) }), /* @__PURE__ */ g(u, {
182
- className: "space-y-4",
183
- children: S.map((e) => /* @__PURE__ */ _("div", {
184
- className: "flex items-center justify-between p-4 border rounded-lg hover:border-primary/50 transition-colors",
185
- children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
186
- className: "font-medium",
187
- children: e.name
188
- }), /* @__PURE__ */ g("p", {
189
- className: "text-sm text-text-secondary",
190
- children: e.description
191
- })] }), /* @__PURE__ */ g("div", {
192
- className: "flex gap-1",
193
- children: e.formats.map((t) => /* @__PURE__ */ g(c, {
194
- variant: "outline",
195
- size: "sm",
196
- disabled: O === `${e.resource}:${t}`,
197
- onClick: () => void N(e, t),
198
- children: t
199
- }, t))
200
- })]
201
- }, e.name))
202
- })] })]
203
- }),
204
- /* @__PURE__ */ _(l, { children: [/* @__PURE__ */ g(d, { children: /* @__PURE__ */ g(f, { children: "Recent Activity" }) }), /* @__PURE__ */ g(u, { children: E.length === 0 ? /* @__PURE__ */ g(y, {
205
- illustration: "empty-data",
206
- title: "No import or export activity yet",
207
- description: "Your recent imports and exports will show up here once you run one."
208
- }) : /* @__PURE__ */ g("div", {
209
- className: "space-y-3",
210
- children: E.map((n, r) => /* @__PURE__ */ _("div", {
211
- className: "flex items-center justify-between p-3 bg-bg-sunken/50 rounded-lg",
212
- children: [/* @__PURE__ */ _("div", {
213
- className: "flex items-center gap-3",
214
- children: [n.type === "import" ? /* @__PURE__ */ g(i, {
215
- size: 16,
216
- className: "text-primary"
217
- }) : /* @__PURE__ */ g(t, {
218
- size: 16,
219
- className: "text-primary"
220
- }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("p", {
221
- className: "font-medium",
222
- children: n.name
223
- }), /* @__PURE__ */ _("p", {
224
- className: "text-sm text-text-secondary",
225
- children: [
226
- n.type === "import" ? "Imported" : "Exported",
227
- " at",
228
- " ",
229
- n.at.toLocaleTimeString(),
230
- " — ",
231
- n.message
232
- ]
233
- })] })]
234
- }), /* @__PURE__ */ _(s, {
235
- variant: n.success ? "default" : "destructive",
236
- className: "gap-1",
237
- children: [n.success ? /* @__PURE__ */ g(e, { size: 12 }) : /* @__PURE__ */ g(a, { size: 12 }), n.success ? "done" : "failed"]
238
- })]
239
- }, r))
240
- }) })] })
241
- ]
242
- });
243
- }
244
- //#endregion
245
- export { C as default };