@burdenoff/microfe-movethewheels 2026.1031.6 → 2026.1101.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MoveTheWheelsRoot.js +141 -133
- package/dist/MoveTheWheelsRoutes.js +29 -25
- package/dist/components/EpodCaptureForm.js +256 -0
- package/dist/generated/wspace-types.d.ts +9012 -132
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useCarrierIntegrations.js +141 -0
- package/dist/hooks/useDriverDay.js +153 -0
- package/dist/hooks/useOrders.js +1 -1
- package/dist/index.js +27 -26
- package/dist/movethewheels/components/EpodCaptureForm.d.ts +12 -0
- package/dist/movethewheels/hooks/index.d.ts +1 -0
- package/dist/movethewheels/hooks/useCarrierIntegrations.d.ts +39 -0
- package/dist/movethewheels/hooks/useDriverDay.d.ts +53 -0
- package/dist/movethewheels/pages/IntegrationsPage.d.ts +6 -0
- package/dist/movethewheels/utils/carrierIntegrations.d.ts +88 -0
- package/dist/movethewheels/utils/driverNavigation.d.ts +31 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/calendar-days.js +50 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/copy.js +16 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/pause.js +19 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/play.js +8 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/wifi-off.js +34 -0
- package/dist/pages/DeliveryCapturePage.js +450 -321
- package/dist/pages/IntegrationsPage.js +616 -0
- package/dist/pages/SettingsPage.js +168 -150
- package/dist/utils/carrierIntegrations.js +105 -0
- package/dist/utils/driverNavigation.js +51 -0
- package/dist/utils/formatters.js +18 -9
- package/package.json +4 -2
- package/src/generated/wspace-types.ts +10266 -142
- package/src/movethewheels/MoveTheWheelsRoot.tsx +8 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +4 -0
- package/src/movethewheels/components/EpodCaptureForm.tsx +343 -0
- package/src/movethewheels/hooks/index.ts +9 -0
- package/src/movethewheels/hooks/useCarrierIntegrations.ts +221 -0
- package/src/movethewheels/hooks/useDriverDay.ts +289 -0
- package/src/movethewheels/pages/DeliveryCapturePage.tsx +478 -392
- package/src/movethewheels/pages/IntegrationsPage.tsx +752 -0
- package/src/movethewheels/pages/SettingsPage.tsx +19 -3
- package/src/movethewheels/utils/carrierIntegrations.ts +252 -0
- package/src/movethewheels/utils/driverNavigation.ts +103 -0
package/dist/hooks/index.js
CHANGED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
|
+
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
+
import { CREATE_INTEGRATION_MUTATION as n, DELETE_INTEGRATION_MUTATION as r, INTEGRATION_COUNTS_QUERY as i, INTEGRATION_EVENTS_QUERY as a, LIST_INTEGRATIONS_QUERY as o, UPDATE_INTEGRATION_MUTATION as s } from "../utils/carrierIntegrations.js";
|
|
4
|
+
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
5
|
+
//#region src/movethewheels/hooks/useCarrierIntegrations.ts
|
|
6
|
+
function p() {
|
|
7
|
+
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: i, tenantId: a, currentUser: o } = e();
|
|
8
|
+
return u(() => ({
|
|
9
|
+
apiGatewayUrl: t,
|
|
10
|
+
authToken: n,
|
|
11
|
+
workspaceToken: r,
|
|
12
|
+
workspaceId: i,
|
|
13
|
+
tenantId: a,
|
|
14
|
+
actorId: o?.id
|
|
15
|
+
}), [
|
|
16
|
+
t,
|
|
17
|
+
n,
|
|
18
|
+
r,
|
|
19
|
+
i,
|
|
20
|
+
a,
|
|
21
|
+
o?.id
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
function m(e, t) {
|
|
25
|
+
return e instanceof Error ? e : Error(t);
|
|
26
|
+
}
|
|
27
|
+
function h(e) {
|
|
28
|
+
let n = p(), { status: r, limit: i, offset: a } = e, [s, u] = f([]), [h, g] = f(0), [_, v] = f(!1), [y, b] = f(null), x = d(0), S = c(async () => {
|
|
29
|
+
let e = ++x.current;
|
|
30
|
+
v(!0), b(null);
|
|
31
|
+
try {
|
|
32
|
+
let s = await t(n, o, {
|
|
33
|
+
filter: r ? { status: r } : void 0,
|
|
34
|
+
pagination: {
|
|
35
|
+
limit: i,
|
|
36
|
+
offset: a
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
if (e !== x.current) return;
|
|
40
|
+
u(s.integrations), g(s.integrationsCount);
|
|
41
|
+
} catch (t) {
|
|
42
|
+
if (e !== x.current) return;
|
|
43
|
+
b(m(t, "Failed to load integrations"));
|
|
44
|
+
} finally {
|
|
45
|
+
e === x.current && v(!1);
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
n,
|
|
49
|
+
r,
|
|
50
|
+
i,
|
|
51
|
+
a
|
|
52
|
+
]);
|
|
53
|
+
l(() => (S(), () => {
|
|
54
|
+
x.current += 1;
|
|
55
|
+
}), [S]);
|
|
56
|
+
let C = d(S);
|
|
57
|
+
return l(() => {
|
|
58
|
+
C.current = S;
|
|
59
|
+
}, [S]), {
|
|
60
|
+
integrations: s,
|
|
61
|
+
total: h,
|
|
62
|
+
isLoading: _,
|
|
63
|
+
error: y,
|
|
64
|
+
refetch: c(() => C.current(), [])
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function g() {
|
|
68
|
+
let e = p(), [n, r] = f({
|
|
69
|
+
all: 0,
|
|
70
|
+
active: 0
|
|
71
|
+
}), a = d(0), o = c(async () => {
|
|
72
|
+
let n = ++a.current;
|
|
73
|
+
try {
|
|
74
|
+
let o = await t(e, i, {});
|
|
75
|
+
n === a.current && r({
|
|
76
|
+
all: o.all,
|
|
77
|
+
active: o.active
|
|
78
|
+
});
|
|
79
|
+
} catch {}
|
|
80
|
+
}, [e]);
|
|
81
|
+
return l(() => (o(), () => {
|
|
82
|
+
a.current += 1;
|
|
83
|
+
}), [o]), {
|
|
84
|
+
...n,
|
|
85
|
+
refetch: o
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function _(e, n, r = 20) {
|
|
89
|
+
let i = p(), [o, s] = f([]), [c, u] = f(!1), [d, h] = f(null);
|
|
90
|
+
return l(() => {
|
|
91
|
+
if (!e) {
|
|
92
|
+
s([]);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let n = !1;
|
|
96
|
+
return u(!0), h(null), t(i, a, {
|
|
97
|
+
integrationId: e,
|
|
98
|
+
pagination: {
|
|
99
|
+
limit: r,
|
|
100
|
+
offset: 0
|
|
101
|
+
}
|
|
102
|
+
}).then((e) => {
|
|
103
|
+
n || s(e.integrationEvents);
|
|
104
|
+
}).catch((e) => {
|
|
105
|
+
n || h(m(e, "Failed to load deliveries"));
|
|
106
|
+
}).finally(() => {
|
|
107
|
+
n || u(!1);
|
|
108
|
+
}), () => {
|
|
109
|
+
n = !0;
|
|
110
|
+
};
|
|
111
|
+
}, [
|
|
112
|
+
i,
|
|
113
|
+
e,
|
|
114
|
+
n,
|
|
115
|
+
r
|
|
116
|
+
]), {
|
|
117
|
+
events: o,
|
|
118
|
+
isLoading: c,
|
|
119
|
+
error: d
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function v() {
|
|
123
|
+
let e = p();
|
|
124
|
+
return u(() => ({
|
|
125
|
+
create: async (r) => (await t(e, n, { input: {
|
|
126
|
+
...r,
|
|
127
|
+
name: r.name.trim(),
|
|
128
|
+
status: "ACTIVE"
|
|
129
|
+
} }, "SINGLE_ATTEMPT")).createIntegration,
|
|
130
|
+
update: async (n, r) => (await t(e, s, {
|
|
131
|
+
id: n,
|
|
132
|
+
input: r.name === void 0 ? r : {
|
|
133
|
+
...r,
|
|
134
|
+
name: r.name.trim()
|
|
135
|
+
}
|
|
136
|
+
})).updateIntegration,
|
|
137
|
+
remove: async (n) => (await t(e, r, { id: n })).deleteIntegration
|
|
138
|
+
}), [e]);
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
export { v as useCarrierIntegrationActions, g as useCarrierIntegrationCounts, _ as useCarrierIntegrationEvents, h as useCarrierIntegrations };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
|
+
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
+
import { deviceTimeZone as n, timezoneOffsetFor as r } from "../utils/driverNavigation.js";
|
|
4
|
+
import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
5
|
+
//#region src/movethewheels/hooks/useDriverDay.ts
|
|
6
|
+
var l = "\n query MyDeliveryDay($date: String!, $timezoneOffsetMinutes: Int, $timeZone: String) {\n myDeliveryDay(date: $date, timezoneOffsetMinutes: $timezoneOffsetMinutes, timeZone: $timeZone) {\n date\n driverId\n driverName\n totalStops\n completedStops\n remainingStops\n stops {\n \n sequence\n state\n awaitingCapture\n overdue\n deliveredAt\n routeId\n routeName\n deliveryJob {\n id\n deliveryJobNumber\n status\n priority\n deliveryAddress\n scheduledDelivery\n specialInstructions\n customer {\n name\n phone\n }\n }\n\n }\n }\n }\n";
|
|
7
|
+
function u(e) {
|
|
8
|
+
let t = e.deliveryJob;
|
|
9
|
+
return {
|
|
10
|
+
sequence: e.sequence,
|
|
11
|
+
state: e.state,
|
|
12
|
+
awaitingCapture: e.awaitingCapture,
|
|
13
|
+
overdue: e.overdue,
|
|
14
|
+
deliveredAt: e.deliveredAt ? new Date(e.deliveredAt) : void 0,
|
|
15
|
+
routeId: e.routeId ?? void 0,
|
|
16
|
+
routeName: e.routeName ?? void 0,
|
|
17
|
+
jobId: t.id,
|
|
18
|
+
deliveryJobNumber: t.deliveryJobNumber,
|
|
19
|
+
status: t.status,
|
|
20
|
+
priority: t.priority,
|
|
21
|
+
deliveryAddress: t.deliveryAddress,
|
|
22
|
+
scheduledDelivery: t.scheduledDelivery ? new Date(t.scheduledDelivery) : void 0,
|
|
23
|
+
specialInstructions: t.specialInstructions ?? void 0,
|
|
24
|
+
customerName: t.customer?.name ?? void 0,
|
|
25
|
+
customerPhone: t.customer?.phone ?? void 0
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function d(e, t) {
|
|
29
|
+
return e.map((e) => t.has(e.jobId) && e.state !== "COMPLETED" ? {
|
|
30
|
+
...e,
|
|
31
|
+
state: "COMPLETED",
|
|
32
|
+
awaitingCapture: !1,
|
|
33
|
+
status: "DELIVERED"
|
|
34
|
+
} : e);
|
|
35
|
+
}
|
|
36
|
+
function f(e) {
|
|
37
|
+
let t = e.filter((e) => e.state === "COMPLETED" || e.state === "FAILED").length;
|
|
38
|
+
return {
|
|
39
|
+
totalStops: e.length,
|
|
40
|
+
completedStops: t,
|
|
41
|
+
remainingStops: e.length - t,
|
|
42
|
+
nextStop: e.find((e) => e.awaitingCapture) ?? e.find((e) => e.state === "UPCOMING") ?? null
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function p(p) {
|
|
46
|
+
let { apiGatewayUrl: m, authToken: h, workspaceToken: g, workspaceId: _, tenantId: v, currentUser: y } = e(), b = o(() => ({
|
|
47
|
+
apiGatewayUrl: m,
|
|
48
|
+
authToken: h,
|
|
49
|
+
workspaceToken: g,
|
|
50
|
+
workspaceId: _,
|
|
51
|
+
tenantId: v,
|
|
52
|
+
actorId: y?.id
|
|
53
|
+
}), [
|
|
54
|
+
m,
|
|
55
|
+
h,
|
|
56
|
+
g,
|
|
57
|
+
_,
|
|
58
|
+
v,
|
|
59
|
+
y?.id
|
|
60
|
+
]), x = JSON.stringify([
|
|
61
|
+
m,
|
|
62
|
+
_,
|
|
63
|
+
v,
|
|
64
|
+
y?.id
|
|
65
|
+
]), S = JSON.stringify([x, p]), [C, w] = c({
|
|
66
|
+
scopeKey: x,
|
|
67
|
+
ids: /* @__PURE__ */ new Set()
|
|
68
|
+
}), T = s(0), [E, D] = c({
|
|
69
|
+
readKey: S,
|
|
70
|
+
day: null,
|
|
71
|
+
isLoading: !0,
|
|
72
|
+
error: null
|
|
73
|
+
}), O = i(async () => {
|
|
74
|
+
let e = ++T.current;
|
|
75
|
+
D((e) => ({
|
|
76
|
+
readKey: S,
|
|
77
|
+
day: e.readKey === S ? e.day : null,
|
|
78
|
+
isLoading: !0,
|
|
79
|
+
error: null
|
|
80
|
+
}));
|
|
81
|
+
try {
|
|
82
|
+
let i = await t(b, l, {
|
|
83
|
+
date: p,
|
|
84
|
+
timezoneOffsetMinutes: r(p),
|
|
85
|
+
timeZone: n()
|
|
86
|
+
});
|
|
87
|
+
if (e !== T.current) return;
|
|
88
|
+
D({
|
|
89
|
+
readKey: S,
|
|
90
|
+
day: i.myDeliveryDay,
|
|
91
|
+
isLoading: !1,
|
|
92
|
+
error: null
|
|
93
|
+
});
|
|
94
|
+
} catch (t) {
|
|
95
|
+
if (e !== T.current) return;
|
|
96
|
+
D((e) => ({
|
|
97
|
+
readKey: S,
|
|
98
|
+
day: e.readKey === S ? e.day : null,
|
|
99
|
+
isLoading: !1,
|
|
100
|
+
error: t instanceof Error ? t : /* @__PURE__ */ Error("Failed to load your deliveries")
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
}, [
|
|
104
|
+
b,
|
|
105
|
+
p,
|
|
106
|
+
S
|
|
107
|
+
]), k = i(() => {
|
|
108
|
+
T.current++;
|
|
109
|
+
}, []);
|
|
110
|
+
a(() => (O(), k), [O, k]);
|
|
111
|
+
let A = i((e) => {
|
|
112
|
+
w((t) => {
|
|
113
|
+
let n = new Set(t.scopeKey === x ? t.ids : []);
|
|
114
|
+
return n.add(e), {
|
|
115
|
+
scopeKey: x,
|
|
116
|
+
ids: n
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}, [x]), j = E.readKey === S ? E : null, M = j?.day ?? null;
|
|
120
|
+
return {
|
|
121
|
+
day: o(() => {
|
|
122
|
+
if (!M) return null;
|
|
123
|
+
let e = C.scopeKey === x ? C.ids : /* @__PURE__ */ new Set(), t = d(M.stops.map(u), e);
|
|
124
|
+
return {
|
|
125
|
+
date: M.date,
|
|
126
|
+
driverId: M.driverId,
|
|
127
|
+
driverName: M.driverName,
|
|
128
|
+
stops: t,
|
|
129
|
+
...f(t)
|
|
130
|
+
};
|
|
131
|
+
}, [
|
|
132
|
+
M,
|
|
133
|
+
x,
|
|
134
|
+
C
|
|
135
|
+
]),
|
|
136
|
+
isLoading: !j || j.isLoading,
|
|
137
|
+
error: j?.error ?? null,
|
|
138
|
+
refetch: O,
|
|
139
|
+
markCaptured: A
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function m() {
|
|
143
|
+
let [e, t] = c(() => typeof navigator > "u" ? !0 : navigator.onLine !== !1);
|
|
144
|
+
return a(() => {
|
|
145
|
+
if (typeof window > "u") return;
|
|
146
|
+
let e = () => t(navigator.onLine !== !1);
|
|
147
|
+
return window.addEventListener("online", e), window.addEventListener("offline", e), () => {
|
|
148
|
+
window.removeEventListener("online", e), window.removeEventListener("offline", e);
|
|
149
|
+
};
|
|
150
|
+
}, []), e;
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
export { p as useMyDeliveryDay, m as useOnlineStatus };
|
package/dist/hooks/useOrders.js
CHANGED
|
@@ -375,4 +375,4 @@ function w() {
|
|
|
375
375
|
};
|
|
376
376
|
}
|
|
377
377
|
//#endregion
|
|
378
|
-
export { x as mapOrder, _ as mapOrderPriority,
|
|
378
|
+
export { x as mapOrder, _ as mapOrderPriority, C as useOrder, w as useOrderStats, S as useOrders };
|
package/dist/index.js
CHANGED
|
@@ -8,31 +8,32 @@ import { useCustomer as E, useCustomerStats as D, useCustomers as O } from "./ho
|
|
|
8
8
|
import { useAnalytics as k, useDashboardMetrics as A, useEmissionsSummary as j, useFinanceMetrics as M, useFleetAnalytics as N, useOrderAnalytics as P, usePerformanceAnalytics as F, useRevenueAnalytics as I } from "./hooks/useAnalytics.js";
|
|
9
9
|
import { useDriverTracking as L, useGeofence as R, useLiveTracking as z, useOrderTracking as B, useTracking as V, useTrackingAlerts as H, useVehicleTracking as U } from "./hooks/useTracking.js";
|
|
10
10
|
import { useEntityDocuments as W } from "./hooks/useEntityDocuments.js";
|
|
11
|
-
import {
|
|
11
|
+
import { useMyDeliveryDay as G, useOnlineStatus as K } from "./hooks/useDriverDay.js";
|
|
12
|
+
import { useCaptureEpod as q, useEpod as J, useEpodPhotoUpload as Y, useEpodPhotoUrl as X, useMyPendingEpodDeliveryJobs as Z } from "./hooks/useEpod.js";
|
|
12
13
|
import "./hooks/index.js";
|
|
13
|
-
import { MoveTheWheelsRoot as
|
|
14
|
-
import { useMoveTheWheelsStore as
|
|
15
|
-
import { useSandboxAssistantTransport as
|
|
16
|
-
import { Avatar as
|
|
17
|
-
import { EmptyState as
|
|
18
|
-
import { chartTokens as
|
|
19
|
-
import { Sparkline as
|
|
20
|
-
import { MetricCard as
|
|
21
|
-
import { GlassPanel as
|
|
22
|
-
import { ChartEmpty as
|
|
23
|
-
import { TrendChart as
|
|
24
|
-
import { VolumeBar as
|
|
25
|
-
import { StatusDonut as
|
|
26
|
-
import { createCurrentIcon as
|
|
27
|
-
import { MapCanvas as
|
|
28
|
-
import { LogisticsMap as
|
|
29
|
-
import { RouteMap as
|
|
30
|
-
import { TrackingMap as
|
|
31
|
-
import { PaymentStatusBadge as
|
|
32
|
-
import { DataTable as
|
|
33
|
-
import { FormError as
|
|
34
|
-
import { Notice as
|
|
35
|
-
import { DocumentsCard as
|
|
36
|
-
import { CarbonFootprintPanel as
|
|
14
|
+
import { MoveTheWheelsRoot as Q } from "./MoveTheWheelsRoot.js";
|
|
15
|
+
import { useMoveTheWheelsStore as $ } from "./store/movethewheelsStore.js";
|
|
16
|
+
import { useSandboxAssistantTransport as ee } from "./services/createSandboxAssistantTransport.js";
|
|
17
|
+
import { Avatar as te, AvatarFallback as ne, AvatarImage as re, Badge as ie, Button as ae, Card as oe, CardContent as se, CardDescription as ce, CardFooter as le, CardHeader as ue, CardTitle as de, Checkbox as fe, Command as pe, CommandEmpty as me, CommandGroup as he, CommandInput as ge, CommandItem as _e, CommandList as ve, Dialog as ye, DialogContent as be, DialogDescription as xe, DialogFooter as Se, DialogHeader as Ce, DialogTitle as we, DialogTrigger as Te, DropdownMenu as Ee, DropdownMenuContent as De, DropdownMenuItem as Oe, DropdownMenuSeparator as ke, DropdownMenuTrigger as Ae, Input as je, Label as Me, Popover as Ne, PopoverContent as Pe, PopoverTrigger as Fe, Progress as Ie, ScrollArea as Le, Select as Re, SelectContent as ze, SelectItem as Be, SelectTrigger as Ve, SelectValue as He, Separator as Ue, Skeleton as We, Switch as Ge, Table as Ke, TableBody as qe, TableCell as Je, TableHead as Ye, TableHeader as Xe, TableRow as Ze, Tabs as Qe, TabsContent as $e, TabsList as et, TabsTrigger as tt, Textarea as nt, Tooltip as rt, TooltipContent as it, TooltipProvider as at, TooltipTrigger as ot } from "./components/ui.js";
|
|
18
|
+
import { EmptyState as st, ErrorState as ct, LoadingState as lt, PageLayout as ut, PageSection as dt } from "./components/PageLayout.js";
|
|
19
|
+
import { chartTokens as ft, seriesColor as pt } from "./components/charts/chartTokens.js";
|
|
20
|
+
import { Sparkline as mt } from "./components/charts/Sparkline.js";
|
|
21
|
+
import { MetricCard as ht, MetricCardSkeleton as gt, MetricGrid as _t } from "./components/MetricCard.js";
|
|
22
|
+
import { GlassPanel as vt } from "./components/GlassPanel.js";
|
|
23
|
+
import { ChartEmpty as yt, ChartTooltip as bt } from "./components/charts/ChartShell.js";
|
|
24
|
+
import { TrendChart as xt } from "./components/charts/TrendChart.js";
|
|
25
|
+
import { VolumeBar as St } from "./components/charts/VolumeBar.js";
|
|
26
|
+
import { StatusDonut as Ct } from "./components/charts/StatusDonut.js";
|
|
27
|
+
import { createCurrentIcon as wt, createPinIcon as Tt, createStopIcon as Et, isRealCoord as Dt } from "./components/maps/leaflet-setup.js";
|
|
28
|
+
import { MapCanvas as Ot } from "./components/maps/MapCanvas.js";
|
|
29
|
+
import { LogisticsMap as kt } from "./components/maps/LogisticsMap.js";
|
|
30
|
+
import { RouteMap as At } from "./components/maps/RouteMap.js";
|
|
31
|
+
import { TrackingMap as jt } from "./components/maps/TrackingMap.js";
|
|
32
|
+
import { PaymentStatusBadge as Mt, PriorityBadge as Nt, StatusBadge as Pt, TypeBadge as Ft, VehicleTypeBadge as It } from "./components/StatusBadge.js";
|
|
33
|
+
import { DataTable as Lt } from "./components/DataTable.js";
|
|
34
|
+
import { FormError as Rt } from "./components/FormError.js";
|
|
35
|
+
import { Notice as zt, useNotice as Bt } from "./components/Notice.js";
|
|
36
|
+
import { DocumentsCard as Vt } from "./components/DocumentsCard.js";
|
|
37
|
+
import { CarbonFootprintPanel as Ht } from "./components/CarbonFootprintPanel.js";
|
|
37
38
|
import "./components/index.js";
|
|
38
|
-
export {
|
|
39
|
+
export { te as Avatar, ne as AvatarFallback, re as AvatarImage, ie as Badge, ae as Button, Ht as CarbonFootprintPanel, oe as Card, se as CardContent, ce as CardDescription, le as CardFooter, ue as CardHeader, de as CardTitle, yt as ChartEmpty, bt as ChartTooltip, fe as Checkbox, pe as Command, me as CommandEmpty, he as CommandGroup, ge as CommandInput, _e as CommandItem, ve as CommandList, Lt as DataTable, ye as Dialog, be as DialogContent, xe as DialogDescription, Se as DialogFooter, Ce as DialogHeader, we as DialogTitle, Te as DialogTrigger, Vt as DocumentsCard, Ee as DropdownMenu, De as DropdownMenuContent, Oe as DropdownMenuItem, ke as DropdownMenuSeparator, Ae as DropdownMenuTrigger, st as EmptyState, ct as ErrorState, Rt as FormError, vt as GlassPanel, je as Input, Me as Label, lt as LoadingState, kt as LogisticsMap, Ot as MapCanvas, ht as MetricCard, gt as MetricCardSkeleton, _t as MetricGrid, Q as MoveTheWheelsRoot, zt as Notice, ut as PageLayout, dt as PageSection, Mt as PaymentStatusBadge, Ne as Popover, Pe as PopoverContent, Fe as PopoverTrigger, Nt as PriorityBadge, Ie as Progress, At as RouteMap, Le as ScrollArea, Re as Select, ze as SelectContent, Be as SelectItem, Ve as SelectTrigger, He as SelectValue, Ue as Separator, We as Skeleton, mt as Sparkline, Pt as StatusBadge, Ct as StatusDonut, Ge as Switch, Ke as Table, qe as TableBody, Je as TableCell, Ye as TableHead, Xe as TableHeader, Ze as TableRow, Qe as Tabs, $e as TabsContent, et as TabsList, tt as TabsTrigger, nt as Textarea, rt as Tooltip, it as TooltipContent, at as TooltipProvider, ot as TooltipTrigger, jt as TrackingMap, xt as TrendChart, Ft as TypeBadge, It as VehicleTypeBadge, St as VolumeBar, ft as chartTokens, wt as createCurrentIcon, Tt as createPinIcon, Et as createStopIcon, Dt as isRealCoord, pt as seriesColor, k as useAnalytics, q as useCaptureEpod, E as useCustomer, D as useCustomerStats, O as useCustomers, A as useDashboardMetrics, l as useDriver, u as useDriverStatusCounts, L as useDriverTracking, d as useDrivers, j as useEmissionsSummary, W as useEntityDocuments, J as useEpod, Y as useEpodPhotoUpload, X as useEpodPhotoUrl, M as useFinanceMetrics, f as useFleet, N as useFleetAnalytics, p as useFleetStats, R as useGeofence, _ as useInventory, v as useInventoryStats, y as useInventoryTransactions, z as useLiveTracking, e as useMoveTheWheels, t as useMoveTheWheelsNavigate, $ as useMoveTheWheelsStore, G as useMyDeliveryDay, Z as useMyPendingEpodDeliveryJobs, Bt as useNotice, K as useOnlineStatus, o as useOrder, P as useOrderAnalytics, s as useOrderStats, B as useOrderTracking, c as useOrders, F as usePerformanceAnalytics, b as useProduct, x as useProductStockLevels, S as useProducts, I as useRevenueAnalytics, r as useRoute, i as useRouteStats, a as useRoutes, ee as useSandboxAssistantTransport, C as useStockActions, n as useTr, V as useTracking, H as useTrackingAlerts, m as useVehicle, h as useVehicleDrivers, U as useVehicleTracking, g as useVehicles, w as useWarehouse, T as useWarehouses };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PendingEpodDeliveryJob } from '../hooks/useEpod';
|
|
2
|
+
export declare function EpodCaptureForm({ job, onCaptured, onCancel, offline, }: {
|
|
3
|
+
job: PendingEpodDeliveryJob;
|
|
4
|
+
onCaptured: (deliveryJobId: string) => void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
/**
|
|
7
|
+
* True while the device has no network. Capture needs the live linked
|
|
8
|
+
* shipment status and an acknowledged server write, so it is blocked
|
|
9
|
+
* rather than queued while offline.
|
|
10
|
+
*/
|
|
11
|
+
offline?: boolean;
|
|
12
|
+
}): import('react').JSX.Element;
|
|
@@ -12,4 +12,5 @@ export { useRoutes, useRoute, useRouteStats } from './useRoutes';
|
|
|
12
12
|
export { useAnalytics, useDashboardMetrics, useRevenueAnalytics, useOrderAnalytics, useFleetAnalytics, usePerformanceAnalytics, useFinanceMetrics, type FinanceMetrics, useEmissionsSummary, type EmissionsSummary, } from './useAnalytics';
|
|
13
13
|
export { useTracking, useOrderTracking, useVehicleTracking, useDriverTracking, useLiveTracking, useTrackingAlerts, useGeofence, } from './useTracking';
|
|
14
14
|
export { useEntityDocuments, type EntityDocument, type EntityDocumentType, } from './useEntityDocuments';
|
|
15
|
+
export { useMyDeliveryDay, useOnlineStatus, type DriverDay, type DriverStop, type DriverStopState, } from './useDriverDay';
|
|
15
16
|
export { useEpod, useMyPendingEpodDeliveryJobs, useCaptureEpod, useEpodPhotoUpload, useEpodPhotoUrl, type PendingEpodDeliveryJob, type CaptureEpodArgs, type UploadedEpodPhoto, } from './useEpod';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CarrierIntegration, CarrierIntegrationEvent, IntegrationStatus, SupportedProvider } from '../utils/carrierIntegrations';
|
|
2
|
+
export interface CreateCarrierIntegrationInput {
|
|
3
|
+
provider: SupportedProvider;
|
|
4
|
+
name: string;
|
|
5
|
+
apiSecret: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UpdateCarrierIntegrationInput {
|
|
8
|
+
name?: string;
|
|
9
|
+
status?: IntegrationStatus;
|
|
10
|
+
apiSecret?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function useCarrierIntegrations(options: {
|
|
13
|
+
status?: IntegrationStatus;
|
|
14
|
+
limit: number;
|
|
15
|
+
offset: number;
|
|
16
|
+
}): {
|
|
17
|
+
integrations: CarrierIntegration[];
|
|
18
|
+
total: number;
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
error: Error | null;
|
|
21
|
+
refetch: () => Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
/** Workspace-wide feed counts (all and active) in one request, independent of the list filter. */
|
|
24
|
+
export declare function useCarrierIntegrationCounts(): {
|
|
25
|
+
refetch: () => Promise<void>;
|
|
26
|
+
all: number;
|
|
27
|
+
active: number;
|
|
28
|
+
};
|
|
29
|
+
/** The most recent deliveries for one integration, newest first. */
|
|
30
|
+
export declare function useCarrierIntegrationEvents(integrationId: string | null, refreshKey: number, limit?: number): {
|
|
31
|
+
events: CarrierIntegrationEvent[];
|
|
32
|
+
isLoading: boolean;
|
|
33
|
+
error: Error | null;
|
|
34
|
+
};
|
|
35
|
+
export declare function useCarrierIntegrationActions(): {
|
|
36
|
+
create: (input: CreateCarrierIntegrationInput) => Promise<CarrierIntegration>;
|
|
37
|
+
update: (id: string, input: UpdateCarrierIntegrationInput) => Promise<CarrierIntegration>;
|
|
38
|
+
remove: (id: string) => Promise<boolean>;
|
|
39
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Order } from '../types';
|
|
2
|
+
export type DriverStopState = 'COMPLETED' | 'EN_ROUTE' | 'UPCOMING' | 'FAILED';
|
|
3
|
+
export interface DriverStop {
|
|
4
|
+
sequence: number;
|
|
5
|
+
state: DriverStopState;
|
|
6
|
+
awaitingCapture: boolean;
|
|
7
|
+
overdue: boolean;
|
|
8
|
+
deliveredAt?: Date;
|
|
9
|
+
routeId?: string;
|
|
10
|
+
routeName?: string;
|
|
11
|
+
jobId: string;
|
|
12
|
+
deliveryJobNumber: string;
|
|
13
|
+
status: string;
|
|
14
|
+
priority: string;
|
|
15
|
+
deliveryAddress: Order['deliveryAddress'] | null;
|
|
16
|
+
scheduledDelivery?: Date;
|
|
17
|
+
specialInstructions?: string;
|
|
18
|
+
customerName?: string;
|
|
19
|
+
customerPhone?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DriverDay {
|
|
22
|
+
date: string;
|
|
23
|
+
driverId: string | null;
|
|
24
|
+
driverName: string | null;
|
|
25
|
+
stops: DriverStop[];
|
|
26
|
+
totalStops: number;
|
|
27
|
+
completedStops: number;
|
|
28
|
+
remainingStops: number;
|
|
29
|
+
nextStop: DriverStop | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Applies acknowledged captures on top of a server snapshot: a stop whose
|
|
33
|
+
* capture the server already acknowledged is shown completed even if a
|
|
34
|
+
* delayed read still reports it en route. This is an in-memory UI fact for
|
|
35
|
+
* the current actor/scope, never a fabricated server update.
|
|
36
|
+
*/
|
|
37
|
+
export declare function applyAcknowledgedCaptures(stops: DriverStop[], acknowledged: ReadonlySet<string>): DriverDay['stops'];
|
|
38
|
+
/** Derived counters and the next stop, recomputed after acknowledgement overrides. */
|
|
39
|
+
export declare function summariseStops(stops: DriverStop[]): {
|
|
40
|
+
totalStops: number;
|
|
41
|
+
completedStops: number;
|
|
42
|
+
remainingStops: number;
|
|
43
|
+
nextStop: DriverStop | null;
|
|
44
|
+
};
|
|
45
|
+
export declare function useMyDeliveryDay(date: string): {
|
|
46
|
+
day: DriverDay | null;
|
|
47
|
+
isLoading: boolean;
|
|
48
|
+
error: Error | null;
|
|
49
|
+
refetch: () => Promise<void>;
|
|
50
|
+
markCaptured: (deliveryJobId: string) => void;
|
|
51
|
+
};
|
|
52
|
+
/** Tracks `navigator.onLine` so the driver sees when capture is unavailable. */
|
|
53
|
+
export declare function useOnlineStatus(): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remounts the page whenever the host switches tenant or workspace, so no
|
|
3
|
+
* server state, filter, page, pending reveal or in-flight mutation from the
|
|
4
|
+
* previous workspace survives into the next one.
|
|
5
|
+
*/
|
|
6
|
+
export default function IntegrationsPage(): import('react').JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** Providers the service can ingest today. Vendor adapters are refused by the API. */
|
|
2
|
+
export declare const SUPPORTED_PROVIDERS: readonly ["GENERIC_WEBHOOK"];
|
|
3
|
+
export type SupportedProvider = (typeof SUPPORTED_PROVIDERS)[number];
|
|
4
|
+
/** Named networks that need a signed vendor agreement before an adapter can ship. */
|
|
5
|
+
export declare const ROADMAP_PROVIDERS: readonly [{
|
|
6
|
+
readonly id: "PROJECT44";
|
|
7
|
+
readonly label: "project44";
|
|
8
|
+
}, {
|
|
9
|
+
readonly id: "FOURKITES";
|
|
10
|
+
readonly label: "FourKites";
|
|
11
|
+
}, {
|
|
12
|
+
readonly id: "DESCARTES";
|
|
13
|
+
readonly label: "Descartes";
|
|
14
|
+
}];
|
|
15
|
+
export declare const INTEGRATION_STATUSES: readonly ["ACTIVE", "PAUSED", "DISABLED"];
|
|
16
|
+
export type IntegrationStatus = (typeof INTEGRATION_STATUSES)[number];
|
|
17
|
+
export type IntegrationProvider = 'GENERIC_WEBHOOK' | 'PROJECT44' | 'FOURKITES' | 'DESCARTES';
|
|
18
|
+
export type IntegrationEventStatus = 'RECEIVED' | 'ACCEPTED' | 'PARTIAL' | 'REJECTED' | 'DUPLICATE' | 'CONFLICT';
|
|
19
|
+
/** Tracking event types a delivery may carry (the service's TrackingEventType). */
|
|
20
|
+
export declare const TRACKING_EVENT_TYPES: readonly ["CREATED", "PICKED_UP", "IN_TRANSIT", "ARRIVED", "DEPARTED", "OUT_FOR_DELIVERY", "DELIVERED", "FAILED", "RETURNED"];
|
|
21
|
+
/** The service refuses shorter secrets; the generator always produces 64 hex characters. */
|
|
22
|
+
export declare const MIN_SECRET_LENGTH = 32;
|
|
23
|
+
/** Header the workspace gateway forwards; custom headers do not survive the gateway. */
|
|
24
|
+
export declare const SIGNATURE_HEADER = "x-webhook-signature";
|
|
25
|
+
/** Updates accepted in one delivery (a JSON array of at most this many objects). */
|
|
26
|
+
export declare const MAX_UPDATES_PER_DELIVERY = 5;
|
|
27
|
+
export interface CarrierIntegration {
|
|
28
|
+
id: string;
|
|
29
|
+
workspaceId: string;
|
|
30
|
+
provider: IntegrationProvider;
|
|
31
|
+
name: string;
|
|
32
|
+
status: IntegrationStatus;
|
|
33
|
+
lastSyncAt: string | null;
|
|
34
|
+
lastErrorAt: string | null;
|
|
35
|
+
lastErrorMessage: string | null;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CarrierIntegrationEvent {
|
|
40
|
+
id: string;
|
|
41
|
+
integrationId: string;
|
|
42
|
+
externalEventId: string | null;
|
|
43
|
+
shipmentId: string | null;
|
|
44
|
+
eventType: string | null;
|
|
45
|
+
status: IntegrationEventStatus;
|
|
46
|
+
errorMessage: string | null;
|
|
47
|
+
receivedAt: string;
|
|
48
|
+
processedAt: string | null;
|
|
49
|
+
}
|
|
50
|
+
export declare const LIST_INTEGRATIONS_QUERY = "\n query MtwCarrierIntegrations($filter: IntegrationFilterInput, $pagination: PaginationInput) {\n integrations(filter: $filter, pagination: $pagination) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n\n }\n integrationsCount(filter: $filter)\n }\n";
|
|
51
|
+
export declare const INTEGRATION_COUNTS_QUERY = "\n query MtwCarrierIntegrationCounts {\n all: integrationsCount\n active: integrationsCount(filter: { status: ACTIVE })\n }\n";
|
|
52
|
+
export declare const INTEGRATION_EVENTS_QUERY = "\n query MtwCarrierIntegrationEvents($integrationId: ID, $pagination: PaginationInput) {\n integrationEvents(integrationId: $integrationId, pagination: $pagination) {\n id\n integrationId\n externalEventId\n shipmentId\n eventType\n status\n errorMessage\n receivedAt\n processedAt\n }\n }\n";
|
|
53
|
+
export declare const CREATE_INTEGRATION_MUTATION = "\n mutation CreateMtwCarrierIntegration($input: CreateIntegrationInput!) {\n createIntegration(input: $input) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n\n }\n }\n";
|
|
54
|
+
export declare const UPDATE_INTEGRATION_MUTATION = "\n mutation UpdateMtwCarrierIntegration($id: ID!, $input: UpdateIntegrationInput!) {\n updateIntegration(id: $id, input: $input) {\n \n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n\n }\n }\n";
|
|
55
|
+
export declare const DELETE_INTEGRATION_MUTATION = "\n mutation DeleteMtwCarrierIntegration($id: ID!) {\n deleteIntegration(id: $id)\n }\n";
|
|
56
|
+
/** Minimal source of randomness, so tests can supply a deterministic one. */
|
|
57
|
+
export interface RandomSource {
|
|
58
|
+
getRandomValues<T extends ArrayBufferView>(array: T): T;
|
|
59
|
+
}
|
|
60
|
+
/** A fresh 256-bit signing secret as 64 lowercase hex characters. */
|
|
61
|
+
export declare function generateSigningSecret(random?: RandomSource): string;
|
|
62
|
+
/** Returns an error message for an unusable secret, or null when it is fine. */
|
|
63
|
+
export declare function signingSecretError(secret: string): string | null;
|
|
64
|
+
/** Returns an error message for an unusable name, or null when it is fine. */
|
|
65
|
+
export declare function integrationNameError(name: string): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* The public URL a carrier posts deliveries to. It lives on the same workspace
|
|
68
|
+
* gateway host the app already talks to: `/api/integrations/webhook/<workspace>/<integration>`.
|
|
69
|
+
* A relative gateway URL (local development behind the dev proxy) resolves
|
|
70
|
+
* against `fallbackOrigin`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function webhookUrl(apiGatewayUrl: string | undefined, workspaceId: string, integrationId: string, fallbackOrigin: string): string;
|
|
73
|
+
/** An example delivery body for the setup instructions. */
|
|
74
|
+
export declare function examplePayload(now?: Date): string;
|
|
75
|
+
/** Quotes a value for a POSIX shell: single quotes, with embedded ones escaped. */
|
|
76
|
+
export declare function shellQuote(value: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* A copy-paste shell example that signs and sends one delivery. The secret is
|
|
79
|
+
* referenced as an environment variable so it never appears in the snippet.
|
|
80
|
+
*/
|
|
81
|
+
export declare function curlExample(url: string): string;
|
|
82
|
+
/** "OUT_FOR_DELIVERY" → "Out for delivery". */
|
|
83
|
+
export declare function humanize(value: string): string;
|
|
84
|
+
export type BadgeTone = 'default' | 'secondary' | 'outline' | 'destructive';
|
|
85
|
+
export declare function integrationStatusTone(status: IntegrationStatus): BadgeTone;
|
|
86
|
+
export declare function eventStatusTone(status: IntegrationEventStatus): BadgeTone;
|
|
87
|
+
/** What a webhook sender sees for each status, shown next to the status control. */
|
|
88
|
+
export declare function statusExplanation(status: IntegrationStatus): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Address } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Google's universal URL accepts at most 9 intermediate waypoints (plus the
|
|
4
|
+
* destination). Longer days are handed off in chunks: the driver restarts
|
|
5
|
+
* navigation from the next remaining stop once these are done.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MAX_NAVIGATION_WAYPOINTS = 9;
|
|
8
|
+
/** The best destination string for an address: coordinates when present, else the formatted address. */
|
|
9
|
+
export declare function navigationDestination(address: Partial<Address> | null | undefined): string | null;
|
|
10
|
+
/** Directions from the device's current position to one stop. */
|
|
11
|
+
export declare function stopNavigationUrl(address: Partial<Address> | null | undefined): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Directions through the remaining stops in sequence: the last stop in the
|
|
14
|
+
* chunk is the destination, the ones before it are waypoints. Stops without a
|
|
15
|
+
* usable address are skipped. Returns null when no stop is navigable.
|
|
16
|
+
*/
|
|
17
|
+
export declare function routeNavigationUrl(addresses: Array<Partial<Address> | null | undefined>): string | null;
|
|
18
|
+
/** A `tel:` link for a phone number, keeping only dialable characters. */
|
|
19
|
+
export declare function phoneHref(phone: string | null | undefined): string | null;
|
|
20
|
+
/** The device-local calendar date as YYYY-MM-DD (what `myDeliveryDay` expects). */
|
|
21
|
+
export declare function localDateString(date: Date): string;
|
|
22
|
+
/** Shift a YYYY-MM-DD date by whole days, staying in local calendar terms. */
|
|
23
|
+
export declare function shiftLocalDate(date: string, days: number): string;
|
|
24
|
+
/** The `Date#getTimezoneOffset()` value for local midnight of a YYYY-MM-DD date (DST-correct). */
|
|
25
|
+
export declare function timezoneOffsetFor(date: string): number;
|
|
26
|
+
/**
|
|
27
|
+
* The device's IANA time zone (e.g. `Asia/Kolkata`), so the server can build
|
|
28
|
+
* the day window from real local midnights, including on DST transition
|
|
29
|
+
* days. Null when the runtime cannot report one; the fixed offset is then used.
|
|
30
|
+
*/
|
|
31
|
+
export declare function deviceTimeZone(): string | null;
|