@burdenoff/microfe-movethewheels 2026.1031.1 → 2026.1031.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 (51) hide show
  1. package/dist/MoveTheWheelsRoot.js +144 -136
  2. package/dist/MoveTheWheelsRoutes.js +61 -57
  3. package/dist/components/ShipmentRiskDialog.js +228 -0
  4. package/dist/components/TrackingAlertList.js +149 -0
  5. package/dist/generated/tracking-quality-operations.d.ts +1154 -2
  6. package/dist/generated/wspace-types.d.ts +2895 -50
  7. package/dist/hooks/useEntityImport.js +68 -0
  8. package/dist/hooks/useShipmentRisk.js +72 -0
  9. package/dist/hooks/useTracking.js +96 -82
  10. package/dist/movethewheels/components/ShipmentRiskDialog.d.ts +20 -0
  11. package/dist/movethewheels/components/TrackingAlertList.d.ts +14 -0
  12. package/dist/movethewheels/hooks/useEntityImport.d.ts +19 -0
  13. package/dist/movethewheels/hooks/useShipmentRisk.d.ts +41 -0
  14. package/dist/movethewheels/pages/ImportExportPage.d.ts +9 -0
  15. package/dist/movethewheels/types/index.d.ts +15 -1
  16. package/dist/movethewheels/utils/entityImport.d.ts +109 -0
  17. package/dist/movethewheels/utils/trackingAlerts.d.ts +36 -0
  18. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down-up.js +22 -0
  19. package/dist/node_modules/lucide-react/dist/esm/icons/file-spreadsheet.js +30 -0
  20. package/dist/node_modules/lucide-react/dist/esm/icons/file-up.js +22 -0
  21. package/dist/pages/CustomersPage.js +88 -79
  22. package/dist/pages/DashboardPage.js +147 -151
  23. package/dist/pages/DriversPage.js +115 -106
  24. package/dist/pages/ImportExportPage.js +435 -0
  25. package/dist/pages/LiveTrackingPage.js +169 -169
  26. package/dist/pages/ProductsPage.js +85 -76
  27. package/dist/pages/VehiclesPage.js +99 -90
  28. package/dist/pages/WarehousesPage.js +97 -88
  29. package/dist/utils/entityImport.js +73 -0
  30. package/dist/utils/trackingAlerts.js +86 -0
  31. package/package.json +4 -2
  32. package/src/generated/tracking-quality-operations.ts +1519 -1
  33. package/src/generated/wspace-types.ts +3248 -51
  34. package/src/movethewheels/MoveTheWheelsRoot.tsx +8 -0
  35. package/src/movethewheels/MoveTheWheelsRoutes.tsx +4 -0
  36. package/src/movethewheels/components/ShipmentRiskDialog.tsx +315 -0
  37. package/src/movethewheels/components/TrackingAlertList.tsx +188 -0
  38. package/src/movethewheels/hooks/useEntityImport.ts +108 -0
  39. package/src/movethewheels/hooks/useShipmentRisk.ts +195 -0
  40. package/src/movethewheels/hooks/useTracking.ts +66 -22
  41. package/src/movethewheels/pages/CustomersPage.tsx +6 -1
  42. package/src/movethewheels/pages/DashboardPage.tsx +10 -20
  43. package/src/movethewheels/pages/DriversPage.tsx +6 -0
  44. package/src/movethewheels/pages/ImportExportPage.tsx +483 -0
  45. package/src/movethewheels/pages/LiveTrackingPage.tsx +20 -22
  46. package/src/movethewheels/pages/ProductsPage.tsx +14 -1
  47. package/src/movethewheels/pages/VehiclesPage.tsx +6 -0
  48. package/src/movethewheels/pages/WarehousesPage.tsx +6 -1
  49. package/src/movethewheels/types/index.ts +16 -1
  50. package/src/movethewheels/utils/entityImport.ts +239 -0
  51. package/src/movethewheels/utils/trackingAlerts.ts +151 -0
@@ -28,8 +28,8 @@ function d() {
28
28
  })
29
29
  });
30
30
  }
31
- var f = r(() => import("./pages/DashboardPage.js")), ee = r(() => import("./pages/OrdersListPage.js")), p = r(() => import("./pages/OrderDetailsPage.js")), m = r(() => import("./pages/CreateOrderPage.js")), h = r(() => import("./pages/TrackingPage.js")), g = r(() => import("./pages/TrackingEventQualityPage.js")), _ = r(() => import("./pages/ShipmentStatusAuthorityPage.js")), v = r(() => import("./pages/LiveTrackingPage.js")), y = r(() => import("./pages/FleetPage.js")), b = r(() => import("./pages/VehiclesPage.js")), x = r(() => import("./pages/VehicleDetailsPage.js")), S = r(() => import("./pages/DriversPage.js")), C = r(() => import("./pages/DriverDetailsPage.js")), w = r(() => import("./pages/InventoryPage.js")), T = r(() => import("./pages/ProductsPage.js")), E = r(() => import("./pages/ProductDetailsPage.js")), D = r(() => import("./pages/PalletPreviewPage.js")), O = r(() => import("./pages/WarehousesPage.js")), k = r(() => import("./pages/WarehouseDetailsPage.js")), A = r(() => import("./pages/CustomersPage.js")), j = r(() => import("./pages/CustomerDetailsPage.js")), M = r(() => import("./pages/MarketplacePage.js")), N = r(() => import("./pages/RoutesPage.js")), P = r(() => import("./pages/RouteDetailsPage.js")), F = r(() => import("./pages/AnalyticsPage.js")), I = r(() => import("./pages/FinancePage.js")), L = r(() => import("./pages/FreightEstimatePage.js")), R = r(() => import("./pages/FreightInvoicePage.js")), z = r(() => import("./pages/ConsolidationPage.js")), B = r(() => import("./pages/LogisticsProceduresPage.js")), V = r(() => import("./pages/AIAssistantPage.js")), H = r(() => import("./pages/DeliveryCapturePage.js")), U = r(() => import("./pages/MultiModalShipmentPage.js")), W = r(() => import("./pages/ShippingRatesPage.js")), G = r(() => import("./pages/ContainersPage.js")), K = r(() => import("./pages/ContainerConditionPage.js")), q = r(() => import("./pages/FreeTimePage.js")), J = r(() => import("./pages/PendingPickPage.js")), Y = r(() => import("./pages/StockObservationsPage.js")), X = r(() => import("./pages/StockBindingPage.js")), Z = r(() => import("./pages/TripUtilizationPage.js")), Q = r(() => import("./pages/ConsumedFuelPreviewPage.js")), $ = r(() => import("./pages/EmptyReusePage.js"));
32
- function te() {
31
+ var f = r(() => import("./pages/DashboardPage.js")), p = r(() => import("./pages/OrdersListPage.js")), m = r(() => import("./pages/OrderDetailsPage.js")), h = r(() => import("./pages/CreateOrderPage.js")), g = r(() => import("./pages/TrackingPage.js")), _ = r(() => import("./pages/TrackingEventQualityPage.js")), v = r(() => import("./pages/ShipmentStatusAuthorityPage.js")), y = r(() => import("./pages/LiveTrackingPage.js")), b = r(() => import("./pages/FleetPage.js")), x = r(() => import("./pages/VehiclesPage.js")), S = r(() => import("./pages/VehicleDetailsPage.js")), C = r(() => import("./pages/DriversPage.js")), w = r(() => import("./pages/DriverDetailsPage.js")), T = r(() => import("./pages/InventoryPage.js")), E = r(() => import("./pages/ProductsPage.js")), D = r(() => import("./pages/ProductDetailsPage.js")), O = r(() => import("./pages/PalletPreviewPage.js")), k = r(() => import("./pages/WarehousesPage.js")), A = r(() => import("./pages/WarehouseDetailsPage.js")), j = r(() => import("./pages/CustomersPage.js")), M = r(() => import("./pages/CustomerDetailsPage.js")), N = r(() => import("./pages/MarketplacePage.js")), P = r(() => import("./pages/ImportExportPage.js")), ee = r(() => import("./pages/RoutesPage.js")), F = r(() => import("./pages/RouteDetailsPage.js")), I = r(() => import("./pages/AnalyticsPage.js")), L = r(() => import("./pages/FinancePage.js")), R = r(() => import("./pages/FreightEstimatePage.js")), z = r(() => import("./pages/FreightInvoicePage.js")), B = r(() => import("./pages/ConsolidationPage.js")), V = r(() => import("./pages/LogisticsProceduresPage.js")), H = r(() => import("./pages/AIAssistantPage.js")), U = r(() => import("./pages/DeliveryCapturePage.js")), W = r(() => import("./pages/MultiModalShipmentPage.js")), G = r(() => import("./pages/ShippingRatesPage.js")), K = r(() => import("./pages/ContainersPage.js")), q = r(() => import("./pages/ContainerConditionPage.js")), J = r(() => import("./pages/FreeTimePage.js")), Y = r(() => import("./pages/PendingPickPage.js")), X = r(() => import("./pages/StockObservationsPage.js")), Z = r(() => import("./pages/StockBindingPage.js")), Q = r(() => import("./pages/TripUtilizationPage.js")), $ = r(() => import("./pages/ConsumedFuelPreviewPage.js")), te = r(() => import("./pages/EmptyReusePage.js"));
32
+ function ne() {
33
33
  return /* @__PURE__ */ s(n, {
34
34
  fallback: /* @__PURE__ */ s(d, {}),
35
35
  children: /* @__PURE__ */ c(a, { children: [
@@ -39,219 +39,223 @@ function te() {
39
39
  }),
40
40
  /* @__PURE__ */ s(i, {
41
41
  path: "orders",
42
- element: /* @__PURE__ */ s(ee, {})
42
+ element: /* @__PURE__ */ s(p, {})
43
43
  }),
44
44
  /* @__PURE__ */ s(i, {
45
45
  path: "orders/new",
46
- element: /* @__PURE__ */ s(m, {})
46
+ element: /* @__PURE__ */ s(h, {})
47
47
  }),
48
48
  /* @__PURE__ */ s(i, {
49
49
  path: "orders/:orderId",
50
- element: /* @__PURE__ */ s(p, {})
50
+ element: /* @__PURE__ */ s(m, {})
51
51
  }),
52
52
  /* @__PURE__ */ s(i, {
53
53
  path: "orders/:orderId/edit",
54
- element: /* @__PURE__ */ s(m, {})
54
+ element: /* @__PURE__ */ s(h, {})
55
55
  }),
56
56
  /* @__PURE__ */ s(i, {
57
57
  path: "tracking",
58
- element: /* @__PURE__ */ s(h, {})
58
+ element: /* @__PURE__ */ s(g, {})
59
59
  }),
60
60
  /* @__PURE__ */ s(i, {
61
61
  path: "tracking/live",
62
- element: /* @__PURE__ */ s(v, {})
62
+ element: /* @__PURE__ */ s(y, {})
63
63
  }),
64
64
  /* @__PURE__ */ s(i, {
65
65
  path: "tracking/event-quality",
66
- element: /* @__PURE__ */ s(g, {})
66
+ element: /* @__PURE__ */ s(_, {})
67
67
  }),
68
68
  /* @__PURE__ */ s(i, {
69
69
  path: "shipments/status-authority",
70
- element: /* @__PURE__ */ s(_, {})
70
+ element: /* @__PURE__ */ s(v, {})
71
71
  }),
72
72
  /* @__PURE__ */ s(i, {
73
73
  path: "deliveries/mine",
74
- element: /* @__PURE__ */ s(H, {})
74
+ element: /* @__PURE__ */ s(U, {})
75
75
  }),
76
76
  /* @__PURE__ */ s(i, {
77
77
  path: "shipments/multi-modal",
78
- element: /* @__PURE__ */ s(U, {})
78
+ element: /* @__PURE__ */ s(W, {})
79
79
  }),
80
80
  /* @__PURE__ */ s(i, {
81
81
  path: "shipments/rates",
82
- element: /* @__PURE__ */ s(W, {})
82
+ element: /* @__PURE__ */ s(G, {})
83
83
  }),
84
84
  /* @__PURE__ */ s(i, {
85
85
  path: "containers",
86
- element: /* @__PURE__ */ s(G, {})
86
+ element: /* @__PURE__ */ s(K, {})
87
87
  }),
88
88
  /* @__PURE__ */ s(i, {
89
89
  path: "containers/condition",
90
- element: /* @__PURE__ */ s(K, {})
90
+ element: /* @__PURE__ */ s(q, {})
91
91
  }),
92
92
  /* @__PURE__ */ s(i, {
93
93
  path: "containers/free-time",
94
- element: /* @__PURE__ */ s(q, {})
94
+ element: /* @__PURE__ */ s(J, {})
95
95
  }),
96
96
  /* @__PURE__ */ s(i, {
97
97
  path: "containers/empty-reuse",
98
- element: /* @__PURE__ */ s($, {})
98
+ element: /* @__PURE__ */ s(te, {})
99
99
  }),
100
100
  /* @__PURE__ */ s(i, {
101
101
  path: "containers/consolidation",
102
- element: /* @__PURE__ */ s(z, {})
102
+ element: /* @__PURE__ */ s(B, {})
103
103
  }),
104
104
  /* @__PURE__ */ s(i, {
105
105
  path: "containers/procedures",
106
- element: /* @__PURE__ */ s(B, {})
106
+ element: /* @__PURE__ */ s(V, {})
107
107
  }),
108
108
  /* @__PURE__ */ s(i, {
109
109
  path: "fleet",
110
- element: /* @__PURE__ */ s(y, {})
110
+ element: /* @__PURE__ */ s(b, {})
111
111
  }),
112
112
  /* @__PURE__ */ s(i, {
113
113
  path: "fleet/vehicles",
114
- element: /* @__PURE__ */ s(b, {})
114
+ element: /* @__PURE__ */ s(x, {})
115
115
  }),
116
116
  /* @__PURE__ */ s(i, {
117
117
  path: "fleet/vehicles/new",
118
- element: /* @__PURE__ */ s(x, {})
118
+ element: /* @__PURE__ */ s(S, {})
119
119
  }),
120
120
  /* @__PURE__ */ s(i, {
121
121
  path: "fleet/vehicles/:vehicleId",
122
- element: /* @__PURE__ */ s(x, {})
122
+ element: /* @__PURE__ */ s(S, {})
123
123
  }),
124
124
  /* @__PURE__ */ s(i, {
125
125
  path: "fleet/vehicles/:vehicleId/edit",
126
- element: /* @__PURE__ */ s(x, {})
126
+ element: /* @__PURE__ */ s(S, {})
127
127
  }),
128
128
  /* @__PURE__ */ s(i, {
129
129
  path: "fleet/drivers",
130
- element: /* @__PURE__ */ s(S, {})
130
+ element: /* @__PURE__ */ s(C, {})
131
131
  }),
132
132
  /* @__PURE__ */ s(i, {
133
133
  path: "fleet/drivers/new",
134
- element: /* @__PURE__ */ s(C, {})
134
+ element: /* @__PURE__ */ s(w, {})
135
135
  }),
136
136
  /* @__PURE__ */ s(i, {
137
137
  path: "fleet/drivers/:driverId",
138
- element: /* @__PURE__ */ s(C, {})
138
+ element: /* @__PURE__ */ s(w, {})
139
139
  }),
140
140
  /* @__PURE__ */ s(i, {
141
141
  path: "fleet/drivers/:driverId/edit",
142
- element: /* @__PURE__ */ s(C, {})
142
+ element: /* @__PURE__ */ s(w, {})
143
143
  }),
144
144
  /* @__PURE__ */ s(i, {
145
145
  path: "inventory",
146
- element: /* @__PURE__ */ s(w, {})
146
+ element: /* @__PURE__ */ s(T, {})
147
147
  }),
148
148
  /* @__PURE__ */ s(i, {
149
149
  path: "inventory/source-assessments",
150
- element: /* @__PURE__ */ s(X, {})
150
+ element: /* @__PURE__ */ s(Z, {})
151
151
  }),
152
152
  /* @__PURE__ */ s(i, {
153
153
  path: "inventory/reported-issues",
154
- element: /* @__PURE__ */ s(Y, {})
154
+ element: /* @__PURE__ */ s(X, {})
155
155
  }),
156
156
  /* @__PURE__ */ s(i, {
157
157
  path: "inventory/pending-picks",
158
- element: /* @__PURE__ */ s(J, {})
158
+ element: /* @__PURE__ */ s(Y, {})
159
159
  }),
160
160
  /* @__PURE__ */ s(i, {
161
161
  path: "inventory/products",
162
- element: /* @__PURE__ */ s(T, {})
162
+ element: /* @__PURE__ */ s(E, {})
163
163
  }),
164
164
  /* @__PURE__ */ s(i, {
165
165
  path: "inventory/products/new",
166
- element: /* @__PURE__ */ s(E, {})
166
+ element: /* @__PURE__ */ s(D, {})
167
167
  }),
168
168
  /* @__PURE__ */ s(i, {
169
169
  path: "inventory/products/:productId",
170
- element: /* @__PURE__ */ s(E, {})
170
+ element: /* @__PURE__ */ s(D, {})
171
171
  }),
172
172
  /* @__PURE__ */ s(i, {
173
173
  path: "inventory/products/:productId/edit",
174
- element: /* @__PURE__ */ s(E, {})
174
+ element: /* @__PURE__ */ s(D, {})
175
175
  }),
176
176
  /* @__PURE__ */ s(i, {
177
177
  path: "inventory/warehouses",
178
- element: /* @__PURE__ */ s(O, {})
178
+ element: /* @__PURE__ */ s(k, {})
179
179
  }),
180
180
  /* @__PURE__ */ s(i, {
181
181
  path: "inventory/warehouses/pallet-preview",
182
- element: /* @__PURE__ */ s(D, {})
182
+ element: /* @__PURE__ */ s(O, {})
183
183
  }),
184
184
  /* @__PURE__ */ s(i, {
185
185
  path: "inventory/warehouses/new",
186
- element: /* @__PURE__ */ s(k, {})
186
+ element: /* @__PURE__ */ s(A, {})
187
187
  }),
188
188
  /* @__PURE__ */ s(i, {
189
189
  path: "inventory/warehouses/:warehouseId",
190
- element: /* @__PURE__ */ s(k, {})
190
+ element: /* @__PURE__ */ s(A, {})
191
191
  }),
192
192
  /* @__PURE__ */ s(i, {
193
193
  path: "inventory/warehouses/:warehouseId/edit",
194
- element: /* @__PURE__ */ s(k, {})
194
+ element: /* @__PURE__ */ s(A, {})
195
195
  }),
196
196
  /* @__PURE__ */ s(i, {
197
197
  path: "customers",
198
- element: /* @__PURE__ */ s(A, {})
198
+ element: /* @__PURE__ */ s(j, {})
199
199
  }),
200
200
  /* @__PURE__ */ s(i, {
201
201
  path: "customers/new",
202
- element: /* @__PURE__ */ s(j, {})
202
+ element: /* @__PURE__ */ s(M, {})
203
203
  }),
204
204
  /* @__PURE__ */ s(i, {
205
205
  path: "customers/:customerId",
206
- element: /* @__PURE__ */ s(j, {})
206
+ element: /* @__PURE__ */ s(M, {})
207
207
  }),
208
208
  /* @__PURE__ */ s(i, {
209
209
  path: "marketplace",
210
- element: /* @__PURE__ */ s(M, {})
210
+ element: /* @__PURE__ */ s(N, {})
211
+ }),
212
+ /* @__PURE__ */ s(i, {
213
+ path: "import-export",
214
+ element: /* @__PURE__ */ s(P, {})
211
215
  }),
212
216
  /* @__PURE__ */ s(i, {
213
217
  path: "routes",
214
- element: /* @__PURE__ */ s(N, {})
218
+ element: /* @__PURE__ */ s(ee, {})
215
219
  }),
216
220
  /* @__PURE__ */ s(i, {
217
221
  path: "routes/trip-utilization",
218
- element: /* @__PURE__ */ s(Z, {})
222
+ element: /* @__PURE__ */ s(Q, {})
219
223
  }),
220
224
  /* @__PURE__ */ s(i, {
221
225
  path: "fuel-preview",
222
- element: /* @__PURE__ */ s(Q, {})
226
+ element: /* @__PURE__ */ s($, {})
223
227
  }),
224
228
  /* @__PURE__ */ s(i, {
225
229
  path: "routes/new",
226
- element: /* @__PURE__ */ s(P, {})
230
+ element: /* @__PURE__ */ s(F, {})
227
231
  }),
228
232
  /* @__PURE__ */ s(i, {
229
233
  path: "routes/:routeId",
230
- element: /* @__PURE__ */ s(P, {})
234
+ element: /* @__PURE__ */ s(F, {})
231
235
  }),
232
236
  /* @__PURE__ */ s(i, {
233
237
  path: "routes/:routeId/edit",
234
- element: /* @__PURE__ */ s(P, {})
238
+ element: /* @__PURE__ */ s(F, {})
235
239
  }),
236
240
  /* @__PURE__ */ s(i, {
237
241
  path: "analytics",
238
- element: /* @__PURE__ */ s(F, {})
242
+ element: /* @__PURE__ */ s(I, {})
239
243
  }),
240
244
  /* @__PURE__ */ s(i, {
241
245
  path: "finance",
242
- element: /* @__PURE__ */ s(I, {})
246
+ element: /* @__PURE__ */ s(L, {})
243
247
  }),
244
248
  /* @__PURE__ */ s(i, {
245
249
  path: "finance/freight-estimates",
246
- element: /* @__PURE__ */ s(L, {})
250
+ element: /* @__PURE__ */ s(R, {})
247
251
  }),
248
252
  /* @__PURE__ */ s(i, {
249
253
  path: "finance/freight-invoice-comparisons",
250
- element: /* @__PURE__ */ s(R, {})
254
+ element: /* @__PURE__ */ s(z, {})
251
255
  }),
252
256
  /* @__PURE__ */ s(i, {
253
257
  path: "ai-assistant",
254
- element: /* @__PURE__ */ s(V, {})
258
+ element: /* @__PURE__ */ s(H, {})
255
259
  }),
256
260
  /* @__PURE__ */ s(i, {
257
261
  path: "*",
@@ -261,4 +265,4 @@ function te() {
261
265
  });
262
266
  }
263
267
  //#endregion
264
- export { te as MoveTheWheelsRoutes };
268
+ export { ne as MoveTheWheelsRoutes };
@@ -0,0 +1,228 @@
1
+ import { formatSlip as e, riskSignalLabel as t } from "../utils/trackingAlerts.js";
2
+ import { Badge as n, Button as r, Dialog as i, DialogContent as a, DialogDescription as o, DialogHeader as s, DialogTitle as c, Skeleton as l, Textarea as u } from "./ui.js";
3
+ import { formatDateTime as d } from "../utils/formatters.js";
4
+ import { useShipmentRisk as f } from "../hooks/useShipmentRisk.js";
5
+ import { useEffect as p, useState as m } from "react";
6
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
7
+ //#region src/movethewheels/components/ShipmentRiskDialog.tsx
8
+ var _ = {
9
+ NONE: {
10
+ key: "movethewheels.risk.level.none",
11
+ fallback: "No risk"
12
+ },
13
+ LOW: {
14
+ key: "movethewheels.risk.level.low",
15
+ fallback: "Low"
16
+ },
17
+ MEDIUM: {
18
+ key: "movethewheels.risk.level.medium",
19
+ fallback: "Medium"
20
+ },
21
+ HIGH: {
22
+ key: "movethewheels.risk.level.high",
23
+ fallback: "High"
24
+ }
25
+ }, v = {
26
+ NONE: {
27
+ key: "movethewheels.risk.action.none",
28
+ fallback: "No action needed"
29
+ },
30
+ MONITOR: {
31
+ key: "movethewheels.risk.action.monitor",
32
+ fallback: "Keep monitoring this shipment"
33
+ },
34
+ REPROMISE_DELIVERY: {
35
+ key: "movethewheels.risk.action.repromise",
36
+ fallback: "Re-promise the delivery to the predicted time"
37
+ },
38
+ REQUEST_TRACKING_UPDATE: {
39
+ key: "movethewheels.risk.action.trackingUpdate",
40
+ fallback: "Get a tracking update from the driver or carrier"
41
+ },
42
+ REASSIGN_VEHICLE: {
43
+ key: "movethewheels.risk.action.reassign",
44
+ fallback: "Reassign the vehicle on this order"
45
+ }
46
+ };
47
+ function y(t, n) {
48
+ return t.ratio === null ? t.minutes !== null && t.minutes > 0 ? e(t.minutes) : null : `${Math.round(t.ratio * 100)}% ${n("movethewheels.risk.lateRate", "late recently")}`;
49
+ }
50
+ function b({ shipmentId: b, shipmentNumber: x, open: S, onOpenChange: C, t: w, onOpenOrder: T, onChanged: E }) {
51
+ let { forecast: D, shipment: O, isLoading: k, error: A, refetch: j, repromise: M, recordTrackingUpdate: N } = f(S ? b : void 0), [P, F] = m(null), [I, L] = m(null), [R, z] = m(!1), [B, V] = m("");
52
+ p(() => {
53
+ F(null), L(null), V("");
54
+ }, [b, S]);
55
+ let H = async (e, t) => {
56
+ z(!0), F(null), L(null);
57
+ try {
58
+ await e(), L(t), E();
59
+ } catch (e) {
60
+ F(e instanceof Error ? e.message : w("movethewheels.risk.actionFailed", "The action failed"));
61
+ } finally {
62
+ z(!1);
63
+ }
64
+ }, U = D?.predictedDeliveryLatest ?? D?.predictedDeliveryEarliest, W = O?.deliveryJobId ?? null;
65
+ return /* @__PURE__ */ h(i, {
66
+ open: S,
67
+ onOpenChange: C,
68
+ children: /* @__PURE__ */ g(a, {
69
+ className: "max-w-lg",
70
+ children: [
71
+ /* @__PURE__ */ g(s, { children: [/* @__PURE__ */ g(c, { children: [w("movethewheels.risk.title", "Delivery risk"), x ? ` · ${x}` : ""] }), /* @__PURE__ */ h(o, { children: w("movethewheels.risk.description", "Forecast from this shipment’s legs, route, tracking, vehicle and carrier history.") })] }),
72
+ k && !D && /* @__PURE__ */ g("div", {
73
+ className: "space-y-2",
74
+ "aria-busy": "true",
75
+ children: [/* @__PURE__ */ h(l, { className: "h-6 w-1/2" }), /* @__PURE__ */ h(l, { className: "h-16 w-full" })]
76
+ }),
77
+ A && !k && /* @__PURE__ */ g("div", {
78
+ role: "alert",
79
+ className: "space-y-2 text-sm",
80
+ children: [/* @__PURE__ */ h("p", {
81
+ className: "text-status-error-text",
82
+ children: A.message
83
+ }), /* @__PURE__ */ h(r, {
84
+ size: "sm",
85
+ variant: "outline",
86
+ onClick: j,
87
+ children: w("movethewheels.risk.retry", "Retry")
88
+ })]
89
+ }),
90
+ D && /* @__PURE__ */ g("div", {
91
+ className: "space-y-4 text-sm",
92
+ "data-testid": "shipment-risk-panel",
93
+ children: [
94
+ /* @__PURE__ */ g("div", {
95
+ className: "flex flex-wrap items-center gap-2",
96
+ children: [
97
+ /* @__PURE__ */ h(n, {
98
+ variant: D.riskLevel === "HIGH" ? "destructive" : "secondary",
99
+ children: w(_[D.riskLevel].key, _[D.riskLevel].fallback)
100
+ }),
101
+ /* @__PURE__ */ g("span", {
102
+ className: "text-text-secondary",
103
+ children: [
104
+ w("movethewheels.risk.score", "Risk score"),
105
+ ":",
106
+ " ",
107
+ /* @__PURE__ */ g("span", {
108
+ className: "font-medium text-text-primary",
109
+ children: [D.riskScore, "/100"]
110
+ })
111
+ ]
112
+ }),
113
+ D.breached && /* @__PURE__ */ h(n, {
114
+ variant: "destructive",
115
+ children: w("movethewheels.risk.breached", "Promise missed")
116
+ })
117
+ ]
118
+ }),
119
+ /* @__PURE__ */ g("dl", {
120
+ className: "grid grid-cols-1 gap-2 sm:grid-cols-2",
121
+ children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", {
122
+ className: "text-xs text-text-secondary",
123
+ children: w("movethewheels.alerts.promised", "Promised")
124
+ }), /* @__PURE__ */ h("dd", { children: D.promisedDelivery ? d(D.promisedDelivery) : w("movethewheels.risk.noPromise", "No promised time") })] }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", {
125
+ className: "text-xs text-text-secondary",
126
+ children: w("movethewheels.risk.window", "Predicted window")
127
+ }), /* @__PURE__ */ g("dd", { children: [D.predictedDeliveryEarliest ? `${d(D.predictedDeliveryEarliest)}${D.predictedDeliveryLatest && D.predictedDeliveryLatest !== D.predictedDeliveryEarliest ? ` – ${d(D.predictedDeliveryLatest)}` : ""}` : w("movethewheels.risk.noPrediction", "Not enough data to predict"), D.predictedSlipMinutes > 0 && /* @__PURE__ */ g("span", {
128
+ className: "ml-1 text-status-error-text",
129
+ children: [
130
+ "(+",
131
+ e(D.predictedSlipMinutes),
132
+ ")"
133
+ ]
134
+ })] })] })]
135
+ }),
136
+ /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
137
+ className: "mb-1 text-xs text-text-secondary",
138
+ children: w("movethewheels.alerts.signals", "Risk signals")
139
+ }), D.signals.length > 0 ? /* @__PURE__ */ h("ul", {
140
+ className: "space-y-1",
141
+ children: D.signals.map((e) => {
142
+ let n = y(e, w);
143
+ return /* @__PURE__ */ g("li", {
144
+ className: "flex items-center justify-between rounded border border-border-primary px-2 py-1",
145
+ children: [/* @__PURE__ */ g("span", { children: [t(e.code, w), n && /* @__PURE__ */ g("span", {
146
+ className: "ml-1 text-text-secondary",
147
+ children: ["· ", n]
148
+ })] }), /* @__PURE__ */ g("span", {
149
+ className: "text-xs text-text-secondary",
150
+ children: ["+", e.weight]
151
+ })]
152
+ }, e.code);
153
+ })
154
+ }) : /* @__PURE__ */ h("p", {
155
+ className: "text-text-secondary",
156
+ children: w("movethewheels.risk.noSignals", "No risk signals right now")
157
+ })] }),
158
+ /* @__PURE__ */ g("div", {
159
+ className: "rounded-lg bg-status-info-bg-subtle p-3",
160
+ children: [
161
+ /* @__PURE__ */ h("p", {
162
+ className: "text-xs text-text-secondary",
163
+ children: w("movethewheels.risk.recommended", "Recommended action")
164
+ }),
165
+ /* @__PURE__ */ h("p", {
166
+ className: "font-medium",
167
+ children: w(v[D.recommendedAction].key, v[D.recommendedAction].fallback)
168
+ }),
169
+ D.recommendedAction === "REPROMISE_DELIVERY" && U && /* @__PURE__ */ g(r, {
170
+ size: "sm",
171
+ className: "mt-2",
172
+ disabled: R,
173
+ onClick: () => void H(() => M(U), w("movethewheels.risk.repromised", "Delivery re-promised")),
174
+ children: [
175
+ w("movethewheels.risk.repromiseTo", "Re-promise to"),
176
+ " ",
177
+ d(U)
178
+ ]
179
+ }),
180
+ D.recommendedAction === "REQUEST_TRACKING_UPDATE" && /* @__PURE__ */ g("div", {
181
+ className: "mt-2 space-y-2",
182
+ children: [/* @__PURE__ */ h(u, {
183
+ value: B,
184
+ onChange: (e) => V(e.target.value),
185
+ maxLength: 500,
186
+ "aria-label": w("movethewheels.risk.updateDetails", "Tracking update"),
187
+ placeholder: w("movethewheels.risk.updatePlaceholder", "What did the driver or carrier report?")
188
+ }), /* @__PURE__ */ h(r, {
189
+ size: "sm",
190
+ disabled: R || B.trim().length === 0,
191
+ onClick: () => void H(() => N(B.trim()), w("movethewheels.risk.updateRecorded", "Tracking update recorded")),
192
+ children: w("movethewheels.risk.recordUpdate", "Record tracking update")
193
+ })]
194
+ }),
195
+ D.recommendedAction === "REASSIGN_VEHICLE" && W && /* @__PURE__ */ h(r, {
196
+ size: "sm",
197
+ className: "mt-2",
198
+ onClick: () => T(W),
199
+ children: w("movethewheels.risk.openOrder", "Open order to reassign")
200
+ }),
201
+ I && /* @__PURE__ */ h("p", {
202
+ role: "status",
203
+ className: "mt-2 text-xs text-status-success-text",
204
+ children: I
205
+ }),
206
+ P && /* @__PURE__ */ h("p", {
207
+ role: "alert",
208
+ className: "mt-2 text-xs text-status-error-text",
209
+ children: P
210
+ })
211
+ ]
212
+ }),
213
+ /* @__PURE__ */ g("p", {
214
+ className: "text-xs text-text-secondary",
215
+ children: [
216
+ w("movethewheels.risk.evaluated", "Evaluated"),
217
+ " ",
218
+ d(D.evaluatedAt)
219
+ ]
220
+ })
221
+ ]
222
+ })
223
+ ]
224
+ })
225
+ });
226
+ }
227
+ //#endregion
228
+ export { b as ShipmentRiskDialog };