@burdenoff/microfe-movethewheels 2026.510.105
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/README.md +82 -0
- package/dist/AIAssistantPage-hD0VYJdH.js +210 -0
- package/dist/AnalyticsPage-DHTHCUtr.js +201 -0
- package/dist/CreateOrderPage-Cprg4Y9V.js +471 -0
- package/dist/CustomerDetailsPage-DNDEw7IW.js +239 -0
- package/dist/CustomersPage-CDjjeCEL.js +119 -0
- package/dist/DashboardPage-8iTPXRAG.js +374 -0
- package/dist/DataTable-CRIKfdIN.js +239 -0
- package/dist/DriverDetailsPage-CRyRCno7.js +297 -0
- package/dist/DriversPage-16O8fVmf.js +127 -0
- package/dist/FinancePage-BYUxK5dR.js +154 -0
- package/dist/FleetPage-CHYETCWT.js +293 -0
- package/dist/ImportExportPage-C3MKKxfc.js +232 -0
- package/dist/InventoryPage--822AxZM.js +223 -0
- package/dist/LiveTrackingPage-Dp3rTJDr.js +332 -0
- package/dist/MarketplacePage-DjEqudfM.js +192 -0
- package/dist/MetricCard-GTbxAk1a.js +135 -0
- package/dist/OrderDetailsPage-BIuYG0ub.js +398 -0
- package/dist/OrdersListPage-CW5V0Uvh.js +257 -0
- package/dist/PageLayout-B7b0vl0R.js +1894 -0
- package/dist/ProductDetailsPage-Q3X7AT-7.js +168 -0
- package/dist/ProductsPage-CUj9JpnW.js +131 -0
- package/dist/ReportsPage-DblO5CdJ.js +227 -0
- package/dist/RouteDetailsPage-CLctgk6A.js +240 -0
- package/dist/RoutesPage-8hrv6RWT.js +116 -0
- package/dist/SettingsPage-BJ5BQeqn.js +247 -0
- package/dist/StatusBadge-BrrwraIA.js +206 -0
- package/dist/TrackingPage-BGqHDh-w.js +322 -0
- package/dist/VehicleDetailsPage-XnDH4iQR.js +194 -0
- package/dist/VehiclesPage-Cs4XxHkA.js +127 -0
- package/dist/WarehouseDetailsPage-GemdMvr_.js +215 -0
- package/dist/WarehousesPage-QTiuDuXy.js +121 -0
- package/dist/arrow-left-6CiLhqVp.js +11 -0
- package/dist/box-BunB_4UH.js +18 -0
- package/dist/chart-column-DWwVEVQ-.js +22 -0
- package/dist/chevron-right-DhZVf20o.js +8 -0
- package/dist/circle-alert-D5f6RZxt.js +26 -0
- package/dist/circle-check-big-D-JMHcTe.js +11 -0
- package/dist/clock-CvwBKbQP.js +13 -0
- package/dist/dev/main.d.ts +1 -0
- package/dist/dollar-sign-CP9qeU5d.js +14 -0
- package/dist/download-CIuG04pJ.js +21 -0
- package/dist/file-text-Dd_thxkn.js +26 -0
- package/dist/filter-DyRMX9CU.js +8 -0
- package/dist/formatters-_vJlC-47.js +50 -0
- package/dist/generated/global-operations.d.ts +1 -0
- package/dist/generated/global-types.d.ts +20715 -0
- package/dist/generated/wspace-operations.d.ts +3704 -0
- package/dist/generated/wspace-types.d.ts +53362 -0
- package/dist/graphqlClient-CdJyR_ed.js +55 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +772 -0
- package/dist/map-BqH1cBJi.js +18 -0
- package/dist/map-pin-CFBOmh-A.js +13 -0
- package/dist/movethewheels/MoveTheWheelsRoot.d.ts +25 -0
- package/dist/movethewheels/MoveTheWheelsRoutes.d.ts +7 -0
- package/dist/movethewheels/components/DataTable.d.ts +32 -0
- package/dist/movethewheels/components/MetricCard.d.ts +43 -0
- package/dist/movethewheels/components/PageLayout.d.ts +68 -0
- package/dist/movethewheels/components/StatusBadge.d.ts +49 -0
- package/dist/movethewheels/components/index.d.ts +10 -0
- package/dist/movethewheels/components/ui.d.ts +22 -0
- package/dist/movethewheels/constants/index.d.ts +24 -0
- package/dist/movethewheels/constants/mockData.d.ts +33 -0
- package/dist/movethewheels/hooks/index.d.ts +12 -0
- package/dist/movethewheels/hooks/useAnalytics.d.ts +118 -0
- package/dist/movethewheels/hooks/useCustomers.d.ts +37 -0
- package/dist/movethewheels/hooks/useFleet.d.ts +71 -0
- package/dist/movethewheels/hooks/useInventory.d.ts +60 -0
- package/dist/movethewheels/hooks/useOrders.d.ts +47 -0
- package/dist/movethewheels/hooks/useRoutes.d.ts +41 -0
- package/dist/movethewheels/hooks/useTracking.d.ts +69 -0
- package/dist/movethewheels/index.d.ts +30 -0
- package/dist/movethewheels/pages/AIAssistantPage.d.ts +4 -0
- package/dist/movethewheels/pages/AnalyticsPage.d.ts +4 -0
- package/dist/movethewheels/pages/CreateOrderPage.d.ts +6 -0
- package/dist/movethewheels/pages/CustomerDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/CustomersPage.d.ts +4 -0
- package/dist/movethewheels/pages/DashboardPage.d.ts +6 -0
- package/dist/movethewheels/pages/DriverDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/DriversPage.d.ts +4 -0
- package/dist/movethewheels/pages/FinancePage.d.ts +4 -0
- package/dist/movethewheels/pages/FleetPage.d.ts +6 -0
- package/dist/movethewheels/pages/ImportExportPage.d.ts +4 -0
- package/dist/movethewheels/pages/InventoryPage.d.ts +4 -0
- package/dist/movethewheels/pages/LiveTrackingPage.d.ts +6 -0
- package/dist/movethewheels/pages/MarketplacePage.d.ts +4 -0
- package/dist/movethewheels/pages/OrderDetailsPage.d.ts +6 -0
- package/dist/movethewheels/pages/OrdersListPage.d.ts +6 -0
- package/dist/movethewheels/pages/ProductDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/ProductsPage.d.ts +4 -0
- package/dist/movethewheels/pages/ReportsPage.d.ts +4 -0
- package/dist/movethewheels/pages/RouteDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/RoutesPage.d.ts +4 -0
- package/dist/movethewheels/pages/SettingsPage.d.ts +4 -0
- package/dist/movethewheels/pages/TrackingPage.d.ts +6 -0
- package/dist/movethewheels/pages/VehicleDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/VehiclesPage.d.ts +4 -0
- package/dist/movethewheels/pages/WarehouseDetailsPage.d.ts +4 -0
- package/dist/movethewheels/pages/WarehousesPage.d.ts +4 -0
- package/dist/movethewheels/providers/MoveTheWheelsProvider.d.ts +16 -0
- package/dist/movethewheels/store/movethewheelsStore.d.ts +73 -0
- package/dist/movethewheels/types/index.d.ts +655 -0
- package/dist/movethewheels/utils/cn.d.ts +6 -0
- package/dist/movethewheels/utils/formatters.d.ts +60 -0
- package/dist/movethewheels/utils/graphqlClient.d.ts +11 -0
- package/dist/movethewheels/utils/index.d.ts +7 -0
- package/dist/movethewheels/utils/navigation.d.ts +23 -0
- package/dist/navigation-BgnOfsVd.js +6 -0
- package/dist/navigation-C2fY_aS9.js +8 -0
- package/dist/package-DVZbDRcV.js +22 -0
- package/dist/phone-KdwpVmC4.js +18 -0
- package/dist/plus-Bl7uX6Ji.js +11 -0
- package/dist/refresh-cw-BYjl3K-8.js +22 -0
- package/dist/route-Ce_poKFi.js +51 -0
- package/dist/save-C-qDVat-.js +18 -0
- package/dist/search-5pdn5eOO.js +13 -0
- package/dist/settings-C4kIDsYg.js +28 -0
- package/dist/square-pen-BwQ67vLE.js +11 -0
- package/dist/star-BlVsC3Ad.js +8 -0
- package/dist/store-DTmQT5M0.js +26 -0
- package/dist/trending-up-C1faflCI.js +11 -0
- package/dist/triangle-alert-CUoVAA4L.js +18 -0
- package/dist/truck-BmDAzu05.js +30 -0
- package/dist/useAnalytics-ph7eTIK6.js +297 -0
- package/dist/useCustomers-bS3a4ytk.js +186 -0
- package/dist/useFleet-BdETplNE.js +398 -0
- package/dist/useInventory-Dwn18FPz.js +323 -0
- package/dist/useOrders-D_3_hGMp.js +324 -0
- package/dist/useRoutes-v4aBaS-E.js +224 -0
- package/dist/useTracking-De2KIUNu.js +261 -0
- package/dist/user-BplzDrLP.js +13 -0
- package/dist/users-i-igmsP4.js +24 -0
- package/dist/warehouse-DewG0PXh.js +25 -0
- package/dist/wrench-CoSDEIC7.js +31 -0
- package/package.json +107 -0
- package/src/dev/main.tsx +110 -0
- package/src/dev/styles.css +139 -0
- package/src/generated/global-operations.ts +2 -0
- package/src/generated/global-types.ts +24048 -0
- package/src/generated/wspace-operations.ts +3734 -0
- package/src/generated/wspace-types.ts +60715 -0
- package/src/index.ts +4 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +258 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +119 -0
- package/src/movethewheels/components/DataTable.tsx +367 -0
- package/src/movethewheels/components/MetricCard.tsx +180 -0
- package/src/movethewheels/components/PageLayout.tsx +234 -0
- package/src/movethewheels/components/StatusBadge.tsx +243 -0
- package/src/movethewheels/components/index.ts +26 -0
- package/src/movethewheels/components/ui.tsx +124 -0
- package/src/movethewheels/constants/index.ts +65 -0
- package/src/movethewheels/constants/mockData.ts +1342 -0
- package/src/movethewheels/hooks/index.ts +55 -0
- package/src/movethewheels/hooks/useAnalytics.ts +476 -0
- package/src/movethewheels/hooks/useCustomers.ts +359 -0
- package/src/movethewheels/hooks/useFleet.ts +778 -0
- package/src/movethewheels/hooks/useInventory.ts +632 -0
- package/src/movethewheels/hooks/useOrders.ts +703 -0
- package/src/movethewheels/hooks/useRoutes.ts +453 -0
- package/src/movethewheels/hooks/useTracking.ts +505 -0
- package/src/movethewheels/index.ts +68 -0
- package/src/movethewheels/pages/AIAssistantPage.tsx +160 -0
- package/src/movethewheels/pages/AnalyticsPage.tsx +190 -0
- package/src/movethewheels/pages/CreateOrderPage.tsx +454 -0
- package/src/movethewheels/pages/CustomerDetailsPage.tsx +207 -0
- package/src/movethewheels/pages/CustomersPage.tsx +115 -0
- package/src/movethewheels/pages/DashboardPage.tsx +414 -0
- package/src/movethewheels/pages/DriverDetailsPage.tsx +261 -0
- package/src/movethewheels/pages/DriversPage.tsx +118 -0
- package/src/movethewheels/pages/FinancePage.tsx +141 -0
- package/src/movethewheels/pages/FleetPage.tsx +289 -0
- package/src/movethewheels/pages/ImportExportPage.tsx +165 -0
- package/src/movethewheels/pages/InventoryPage.tsx +212 -0
- package/src/movethewheels/pages/LiveTrackingPage.tsx +325 -0
- package/src/movethewheels/pages/MarketplacePage.tsx +235 -0
- package/src/movethewheels/pages/OrderDetailsPage.tsx +387 -0
- package/src/movethewheels/pages/OrdersListPage.tsx +241 -0
- package/src/movethewheels/pages/ProductDetailsPage.tsx +155 -0
- package/src/movethewheels/pages/ProductsPage.tsx +124 -0
- package/src/movethewheels/pages/ReportsPage.tsx +164 -0
- package/src/movethewheels/pages/RouteDetailsPage.tsx +245 -0
- package/src/movethewheels/pages/RoutesPage.tsx +104 -0
- package/src/movethewheels/pages/SettingsPage.tsx +242 -0
- package/src/movethewheels/pages/TrackingPage.tsx +419 -0
- package/src/movethewheels/pages/VehicleDetailsPage.tsx +218 -0
- package/src/movethewheels/pages/VehiclesPage.tsx +124 -0
- package/src/movethewheels/pages/WarehouseDetailsPage.tsx +216 -0
- package/src/movethewheels/pages/WarehousesPage.tsx +122 -0
- package/src/movethewheels/providers/MoveTheWheelsProvider.tsx +66 -0
- package/src/movethewheels/store/movethewheelsStore.ts +136 -0
- package/src/movethewheels/types/index.ts +744 -0
- package/src/movethewheels/utils/cn.ts +9 -0
- package/src/movethewheels/utils/formatters.ts +215 -0
- package/src/movethewheels/utils/graphqlClient.ts +63 -0
- package/src/movethewheels/utils/index.ts +8 -0
- package/src/movethewheels/utils/navigation.ts +70 -0
- package/src/operations/global/.gitkeep +0 -0
- package/src/operations/wspace/movethewheels/fragments/core.graphql +191 -0
- package/src/operations/wspace/movethewheels/mutations/entities.graphql +87 -0
- package/src/operations/wspace/movethewheels/mutations/logistics.graphql +86 -0
- package/src/operations/wspace/movethewheels/mutations/marketplace-reports.graphql +81 -0
- package/src/operations/wspace/movethewheels/mutations/orders.graphql +21 -0
- package/src/operations/wspace/movethewheels/queries/dashboard.graphql +61 -0
- package/src/operations/wspace/movethewheels/queries/entities.graphql +83 -0
- package/src/operations/wspace/movethewheels/queries/logistics.graphql +84 -0
- package/src/operations/wspace/movethewheels/queries/marketplace-reports.graphql +40 -0
- package/src/operations/wspace/movethewheels/queries/orders.graphql +43 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { clsx, type ClassValue } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Utility for merging Tailwind CSS classes with proper conflict resolution.
|
|
6
|
+
*/
|
|
7
|
+
export function cn(...inputs: ClassValue[]) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting utilities for the MoveTheWheels microfrontend.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Address } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Format an address object into a readable string.
|
|
9
|
+
*/
|
|
10
|
+
export function formatAddress(address: Address): string {
|
|
11
|
+
const parts = [
|
|
12
|
+
address.street,
|
|
13
|
+
address.city,
|
|
14
|
+
address.state,
|
|
15
|
+
address.postalCode,
|
|
16
|
+
address.country,
|
|
17
|
+
].filter(Boolean);
|
|
18
|
+
return parts.join(', ');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Format a number as currency.
|
|
23
|
+
*/
|
|
24
|
+
export function formatCurrency(amount: number, currency = 'USD'): string {
|
|
25
|
+
return new Intl.NumberFormat('en-US', {
|
|
26
|
+
style: 'currency',
|
|
27
|
+
currency,
|
|
28
|
+
minimumFractionDigits: 2,
|
|
29
|
+
maximumFractionDigits: 2,
|
|
30
|
+
}).format(amount);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Format a date for display.
|
|
35
|
+
* @param date - Date to format
|
|
36
|
+
* @param format - Format type: 'short' (default), 'full', 'relative', or 'time'
|
|
37
|
+
*/
|
|
38
|
+
export function formatDate(
|
|
39
|
+
date: Date | string,
|
|
40
|
+
format: 'short' | 'full' | 'relative' | 'time' = 'short'
|
|
41
|
+
): string {
|
|
42
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
43
|
+
|
|
44
|
+
if (format === 'relative') {
|
|
45
|
+
return formatRelativeTime(d);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (format === 'time') {
|
|
49
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
50
|
+
hour: 'numeric',
|
|
51
|
+
minute: '2-digit',
|
|
52
|
+
hour12: true,
|
|
53
|
+
}).format(d);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (format === 'full') {
|
|
57
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
58
|
+
weekday: 'long',
|
|
59
|
+
year: 'numeric',
|
|
60
|
+
month: 'long',
|
|
61
|
+
day: 'numeric',
|
|
62
|
+
hour: 'numeric',
|
|
63
|
+
minute: '2-digit',
|
|
64
|
+
hour12: true,
|
|
65
|
+
}).format(d);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// short format (default)
|
|
69
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
70
|
+
year: 'numeric',
|
|
71
|
+
month: 'short',
|
|
72
|
+
day: 'numeric',
|
|
73
|
+
}).format(d);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Format a date and time for display.
|
|
78
|
+
*/
|
|
79
|
+
export function formatDateTime(date: Date | string): string {
|
|
80
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
81
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
82
|
+
year: 'numeric',
|
|
83
|
+
month: 'short',
|
|
84
|
+
day: 'numeric',
|
|
85
|
+
hour: 'numeric',
|
|
86
|
+
minute: '2-digit',
|
|
87
|
+
hour12: true,
|
|
88
|
+
}).format(d);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Format a time for display.
|
|
93
|
+
*/
|
|
94
|
+
export function formatTime(date: Date | string): string {
|
|
95
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
96
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
97
|
+
hour: 'numeric',
|
|
98
|
+
minute: '2-digit',
|
|
99
|
+
hour12: true,
|
|
100
|
+
}).format(d);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Format a relative time (e.g., "2 hours ago").
|
|
105
|
+
*/
|
|
106
|
+
export function formatRelativeTime(date: Date | string): string {
|
|
107
|
+
const d = typeof date === 'string' ? new Date(date) : date;
|
|
108
|
+
const now = new Date();
|
|
109
|
+
const diffInSeconds = Math.floor((now.getTime() - d.getTime()) / 1000);
|
|
110
|
+
|
|
111
|
+
if (diffInSeconds < 60) {
|
|
112
|
+
return 'Just now';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const diffInMinutes = Math.floor(diffInSeconds / 60);
|
|
116
|
+
if (diffInMinutes < 60) {
|
|
117
|
+
return `${diffInMinutes} ${diffInMinutes === 1 ? 'minute' : 'minutes'} ago`;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const diffInHours = Math.floor(diffInMinutes / 60);
|
|
121
|
+
if (diffInHours < 24) {
|
|
122
|
+
return `${diffInHours} ${diffInHours === 1 ? 'hour' : 'hours'} ago`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const diffInDays = Math.floor(diffInHours / 24);
|
|
126
|
+
if (diffInDays < 7) {
|
|
127
|
+
return `${diffInDays} ${diffInDays === 1 ? 'day' : 'days'} ago`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return formatDate(d);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Format a number with thousand separators.
|
|
135
|
+
*/
|
|
136
|
+
export function formatNumber(num: number): string {
|
|
137
|
+
return new Intl.NumberFormat('en-US').format(num);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Format a percentage.
|
|
142
|
+
*/
|
|
143
|
+
export function formatPercentage(value: number, decimals = 1): string {
|
|
144
|
+
return `${value.toFixed(decimals)}%`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Format weight with appropriate units.
|
|
149
|
+
*/
|
|
150
|
+
export function formatWeight(kg: number): string {
|
|
151
|
+
if (kg >= 1000) {
|
|
152
|
+
return `${(kg / 1000).toFixed(2)} tonnes`;
|
|
153
|
+
}
|
|
154
|
+
return `${kg.toFixed(2)} kg`;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Format distance with appropriate units.
|
|
159
|
+
*/
|
|
160
|
+
export function formatDistance(km: number): string {
|
|
161
|
+
if (km < 1) {
|
|
162
|
+
return `${Math.round(km * 1000)} m`;
|
|
163
|
+
}
|
|
164
|
+
return `${km.toFixed(1)} km`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Format duration in minutes to human readable.
|
|
169
|
+
*/
|
|
170
|
+
export function formatDuration(minutes: number): string {
|
|
171
|
+
if (minutes < 60) {
|
|
172
|
+
return `${minutes} min`;
|
|
173
|
+
}
|
|
174
|
+
const hours = Math.floor(minutes / 60);
|
|
175
|
+
const mins = minutes % 60;
|
|
176
|
+
if (mins === 0) {
|
|
177
|
+
return `${hours} ${hours === 1 ? 'hour' : 'hours'}`;
|
|
178
|
+
}
|
|
179
|
+
return `${hours}h ${mins}m`;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Truncate text with ellipsis.
|
|
184
|
+
*/
|
|
185
|
+
export function truncateText(text: string, maxLength: number): string {
|
|
186
|
+
if (text.length <= maxLength) return text;
|
|
187
|
+
return text.slice(0, maxLength - 3) + '...';
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Format a phone number.
|
|
192
|
+
*/
|
|
193
|
+
export function formatPhoneNumber(phone: string): string {
|
|
194
|
+
// Simple formatting for US phone numbers
|
|
195
|
+
const cleaned = phone.replace(/\D/g, '');
|
|
196
|
+
if (cleaned.length === 10) {
|
|
197
|
+
return `(${cleaned.slice(0, 3)}) ${cleaned.slice(3, 6)}-${cleaned.slice(6)}`;
|
|
198
|
+
}
|
|
199
|
+
if (cleaned.length === 11 && cleaned.startsWith('1')) {
|
|
200
|
+
return `+1 (${cleaned.slice(1, 4)}) ${cleaned.slice(4, 7)}-${cleaned.slice(7)}`;
|
|
201
|
+
}
|
|
202
|
+
return phone;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Get initials from a name.
|
|
207
|
+
*/
|
|
208
|
+
export function getInitials(name: string): string {
|
|
209
|
+
return name
|
|
210
|
+
.split(' ')
|
|
211
|
+
.map((part) => part[0])
|
|
212
|
+
.join('')
|
|
213
|
+
.toUpperCase()
|
|
214
|
+
.slice(0, 2);
|
|
215
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
interface GraphQLRequestOptions {
|
|
2
|
+
apiGatewayUrl?: string;
|
|
3
|
+
authToken?: string;
|
|
4
|
+
workspaceToken?: string;
|
|
5
|
+
workspaceId?: string;
|
|
6
|
+
tenantId?: string;
|
|
7
|
+
actorId?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function resolveGraphqlUrl(apiGatewayUrl?: string): string {
|
|
11
|
+
if (!apiGatewayUrl) {
|
|
12
|
+
return '/workspaces/graphql';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (apiGatewayUrl.endsWith('/graphql')) {
|
|
16
|
+
return apiGatewayUrl;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return `${apiGatewayUrl}/workspaces/graphql`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function executeGraphQL<TData>(
|
|
23
|
+
options: GraphQLRequestOptions,
|
|
24
|
+
query: string,
|
|
25
|
+
variables?: Record<string, unknown>
|
|
26
|
+
): Promise<TData> {
|
|
27
|
+
const response = await fetch(resolveGraphqlUrl(options.apiGatewayUrl), {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: {
|
|
30
|
+
'content-type': 'application/json',
|
|
31
|
+
...(options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {}),
|
|
32
|
+
...(options.workspaceToken
|
|
33
|
+
? { 'X-Workspace-Authorization': `Bearer ${options.workspaceToken}` }
|
|
34
|
+
: {}),
|
|
35
|
+
...(options.workspaceId ? { 'x-workspace-id': options.workspaceId } : {}),
|
|
36
|
+
...(options.tenantId ? { 'x-tenant-id': options.tenantId } : {}),
|
|
37
|
+
...(options.actorId ? { 'x-actor-id': options.actorId } : {}),
|
|
38
|
+
...(options.actorId ? { 'x-actor-type': 'user' } : {}),
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify({ query, variables }),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (!response.ok) {
|
|
44
|
+
throw new Error(`GraphQL request failed with status ${response.status}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const payload = (await response.json()) as {
|
|
48
|
+
data?: TData;
|
|
49
|
+
errors?: Array<{ message?: string }>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (payload.errors?.length) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
payload.errors.map((item) => item.message ?? 'Unknown GraphQL error').join('; ')
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!payload.data) {
|
|
59
|
+
throw new Error('GraphQL response did not include data');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return payload.data;
|
|
63
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation utilities for the MoveTheWheels microfrontend.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Join path segments correctly, avoiding double slashes.
|
|
7
|
+
*/
|
|
8
|
+
export function joinPath(base: string, path: string): string {
|
|
9
|
+
const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;
|
|
10
|
+
const cleanPath = path.startsWith('/') ? path : `/${path}`;
|
|
11
|
+
return cleanBase + cleanPath;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get the relative path from a full path given a base path.
|
|
16
|
+
*/
|
|
17
|
+
export function getRelativePath(fullPath: string, basePath: string): string {
|
|
18
|
+
const cleanBase = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
|
|
19
|
+
if (fullPath.startsWith(cleanBase)) {
|
|
20
|
+
const relative = fullPath.slice(cleanBase.length);
|
|
21
|
+
return relative || '/';
|
|
22
|
+
}
|
|
23
|
+
return fullPath;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Check if a path matches a pattern (supports wildcards).
|
|
28
|
+
*/
|
|
29
|
+
export function pathMatches(path: string, pattern: string): boolean {
|
|
30
|
+
const cleanPath = path.endsWith('/') ? path.slice(0, -1) : path;
|
|
31
|
+
const cleanPattern = pattern.endsWith('/') ? pattern.slice(0, -1) : pattern;
|
|
32
|
+
|
|
33
|
+
if (cleanPattern.endsWith('/*')) {
|
|
34
|
+
const basePattern = cleanPattern.slice(0, -2);
|
|
35
|
+
return cleanPath === basePattern || cleanPath.startsWith(basePattern + '/');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return cleanPath === cleanPattern;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Build a URL with query parameters.
|
|
43
|
+
*/
|
|
44
|
+
export function buildUrl(base: string, params?: Record<string, string | number | boolean>): string {
|
|
45
|
+
if (!params || Object.keys(params).length === 0) {
|
|
46
|
+
return base;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const searchParams = new URLSearchParams();
|
|
50
|
+
for (const [key, value] of Object.entries(params)) {
|
|
51
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
52
|
+
searchParams.set(key, String(value));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const queryString = searchParams.toString();
|
|
57
|
+
return queryString ? `${base}?${queryString}` : base;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Parse query parameters from a URL.
|
|
62
|
+
*/
|
|
63
|
+
export function parseQueryParams(search: string): Record<string, string> {
|
|
64
|
+
const params: Record<string, string> = {};
|
|
65
|
+
const searchParams = new URLSearchParams(search);
|
|
66
|
+
searchParams.forEach((value, key) => {
|
|
67
|
+
params[key] = value;
|
|
68
|
+
});
|
|
69
|
+
return params;
|
|
70
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
fragment MovethewheelsOrderCore on MovethewheelsOrder {
|
|
2
|
+
id
|
|
3
|
+
orderNumber
|
|
4
|
+
orderType
|
|
5
|
+
status
|
|
6
|
+
priority
|
|
7
|
+
customerId
|
|
8
|
+
trackingNumber
|
|
9
|
+
pickupAddress
|
|
10
|
+
deliveryAddress
|
|
11
|
+
items
|
|
12
|
+
pricing
|
|
13
|
+
scheduledDelivery
|
|
14
|
+
vehicleId
|
|
15
|
+
driverId
|
|
16
|
+
createdAt
|
|
17
|
+
updatedAt
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
fragment CustomerCore on Customer {
|
|
21
|
+
id
|
|
22
|
+
name
|
|
23
|
+
email
|
|
24
|
+
phone
|
|
25
|
+
type
|
|
26
|
+
company
|
|
27
|
+
address
|
|
28
|
+
rating
|
|
29
|
+
createdAt
|
|
30
|
+
updatedAt
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
fragment ProductCore on Product {
|
|
34
|
+
id
|
|
35
|
+
sku
|
|
36
|
+
name
|
|
37
|
+
description
|
|
38
|
+
category
|
|
39
|
+
brand
|
|
40
|
+
dimensions
|
|
41
|
+
weight
|
|
42
|
+
value
|
|
43
|
+
hazardous
|
|
44
|
+
fragile
|
|
45
|
+
temperatureControlled
|
|
46
|
+
createdAt
|
|
47
|
+
updatedAt
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fragment VehicleCore on Vehicle {
|
|
51
|
+
id
|
|
52
|
+
vehicleNumber
|
|
53
|
+
make
|
|
54
|
+
model
|
|
55
|
+
year
|
|
56
|
+
licensePlate
|
|
57
|
+
type
|
|
58
|
+
ownershipType
|
|
59
|
+
capacity
|
|
60
|
+
status
|
|
61
|
+
currentLocation
|
|
62
|
+
fuelLevel
|
|
63
|
+
mileage
|
|
64
|
+
createdAt
|
|
65
|
+
updatedAt
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
fragment DriverCore on Driver {
|
|
69
|
+
id
|
|
70
|
+
employeeId
|
|
71
|
+
firstName
|
|
72
|
+
lastName
|
|
73
|
+
phone
|
|
74
|
+
email
|
|
75
|
+
licenseNumber
|
|
76
|
+
licenseClass
|
|
77
|
+
licenseExpiry
|
|
78
|
+
status
|
|
79
|
+
currentLocation
|
|
80
|
+
rating
|
|
81
|
+
userId
|
|
82
|
+
vehicleId
|
|
83
|
+
createdAt
|
|
84
|
+
updatedAt
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
fragment WarehouseCore on Warehouse {
|
|
88
|
+
id
|
|
89
|
+
name
|
|
90
|
+
code
|
|
91
|
+
type
|
|
92
|
+
address
|
|
93
|
+
contactInfo
|
|
94
|
+
operatingHours
|
|
95
|
+
capabilities
|
|
96
|
+
status
|
|
97
|
+
totalCapacity
|
|
98
|
+
usedCapacity
|
|
99
|
+
createdAt
|
|
100
|
+
updatedAt
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
fragment InventoryItemCore on InventoryItem {
|
|
104
|
+
id
|
|
105
|
+
productId
|
|
106
|
+
warehouseId
|
|
107
|
+
locationId
|
|
108
|
+
onHand
|
|
109
|
+
available
|
|
110
|
+
allocated
|
|
111
|
+
damaged
|
|
112
|
+
unitCost
|
|
113
|
+
reorderPoint
|
|
114
|
+
safetyStock
|
|
115
|
+
createdAt
|
|
116
|
+
updatedAt
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
fragment RouteCore on Route {
|
|
120
|
+
id
|
|
121
|
+
name
|
|
122
|
+
status
|
|
123
|
+
shipmentId
|
|
124
|
+
vehicleId
|
|
125
|
+
driverId
|
|
126
|
+
waypoints
|
|
127
|
+
estimatedDistance
|
|
128
|
+
estimatedDuration
|
|
129
|
+
actualDistance
|
|
130
|
+
actualDuration
|
|
131
|
+
fuelCost
|
|
132
|
+
createdAt
|
|
133
|
+
updatedAt
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
fragment ShipmentCore on Shipment {
|
|
137
|
+
id
|
|
138
|
+
shipmentNumber
|
|
139
|
+
orderId
|
|
140
|
+
customerId
|
|
141
|
+
carrierId
|
|
142
|
+
status
|
|
143
|
+
origin
|
|
144
|
+
destination
|
|
145
|
+
cargoDetails
|
|
146
|
+
trackingNumber
|
|
147
|
+
estimatedDelivery
|
|
148
|
+
actualDelivery
|
|
149
|
+
createdAt
|
|
150
|
+
updatedAt
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
fragment ServiceProviderCore on ServiceProvider {
|
|
154
|
+
id
|
|
155
|
+
name
|
|
156
|
+
type
|
|
157
|
+
description
|
|
158
|
+
rating
|
|
159
|
+
contactInfo
|
|
160
|
+
services
|
|
161
|
+
isVerified
|
|
162
|
+
isActive
|
|
163
|
+
createdAt
|
|
164
|
+
updatedAt
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
fragment ServiceOfferingCore on ServiceOffering {
|
|
168
|
+
id
|
|
169
|
+
providerId
|
|
170
|
+
name
|
|
171
|
+
description
|
|
172
|
+
category
|
|
173
|
+
price
|
|
174
|
+
currency
|
|
175
|
+
availability
|
|
176
|
+
createdAt
|
|
177
|
+
updatedAt
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
fragment MovethewheelsReportCore on MovethewheelsReport {
|
|
181
|
+
id
|
|
182
|
+
name
|
|
183
|
+
type
|
|
184
|
+
description
|
|
185
|
+
schedule
|
|
186
|
+
lastGenerated
|
|
187
|
+
configuration
|
|
188
|
+
status
|
|
189
|
+
createdAt
|
|
190
|
+
updatedAt
|
|
191
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
mutation CreateCustomer($input: CreateCustomerInput!) {
|
|
2
|
+
createCustomer(input: $input) {
|
|
3
|
+
...CustomerCore
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
mutation UpdateCustomer($id: ID!, $input: UpdateCustomerInput!) {
|
|
8
|
+
updateCustomer(id: $id, input: $input) {
|
|
9
|
+
...CustomerCore
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
mutation DeleteCustomer($id: ID!) {
|
|
14
|
+
deleteCustomer(id: $id)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
mutation CreateProduct($input: CreateProductInput!) {
|
|
18
|
+
createProduct(input: $input) {
|
|
19
|
+
...ProductCore
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
mutation UpdateProduct($id: ID!, $input: UpdateProductInput!) {
|
|
24
|
+
updateProduct(id: $id, input: $input) {
|
|
25
|
+
...ProductCore
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
mutation DeleteProduct($id: ID!) {
|
|
30
|
+
deleteProduct(id: $id)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
mutation CreateVehicle($input: CreateVehicleInput!) {
|
|
34
|
+
createVehicle(input: $input) {
|
|
35
|
+
...VehicleCore
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
mutation UpdateVehicle($id: ID!, $input: UpdateVehicleInput!) {
|
|
40
|
+
updateVehicle(id: $id, input: $input) {
|
|
41
|
+
...VehicleCore
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
mutation UpdateVehicleStatus($id: ID!, $status: VehicleStatus!) {
|
|
46
|
+
updateVehicleStatus(id: $id, status: $status) {
|
|
47
|
+
...VehicleCore
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
mutation UpdateVehicleLocation($id: ID!, $location: JSON!) {
|
|
52
|
+
updateVehicleLocation(id: $id, location: $location) {
|
|
53
|
+
...VehicleCore
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
mutation DeleteVehicle($id: ID!) {
|
|
58
|
+
deleteVehicle(id: $id)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
mutation CreateDriver($input: CreateDriverInput!) {
|
|
62
|
+
createDriver(input: $input) {
|
|
63
|
+
...DriverCore
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
mutation UpdateDriver($id: ID!, $input: UpdateDriverInput!) {
|
|
68
|
+
updateDriver(id: $id, input: $input) {
|
|
69
|
+
...DriverCore
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
mutation UpdateDriverStatus($id: ID!, $status: DriverStatus!) {
|
|
74
|
+
updateDriverStatus(id: $id, status: $status) {
|
|
75
|
+
...DriverCore
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
mutation AssignDriverVehicle($id: ID!, $vehicleId: ID) {
|
|
80
|
+
assignDriverVehicle(id: $id, vehicleId: $vehicleId) {
|
|
81
|
+
...DriverCore
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
mutation DeleteDriver($id: ID!) {
|
|
86
|
+
deleteDriver(id: $id)
|
|
87
|
+
}
|