@burdenoff/microfe-movethewheels 2026.1011.1 → 2026.1011.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.
- package/dist/MoveTheWheelsRoot.js +5 -0
- package/dist/MoveTheWheelsRoutes.js +54 -50
- package/dist/generated/shipment-status-authority-operations.d.ts +4473 -0
- package/dist/hooks/useEpod.js +85 -77
- package/dist/hooks/useShipmentStatusAuthority.js +127 -0
- package/dist/hooks/useTracking.js +15 -14
- package/dist/hooks/useTrackingEventQuality.js +43 -17
- package/dist/movethewheels/hooks/useEpod.d.ts +23 -0
- package/dist/movethewheels/hooks/useShipmentStatusAuthority.d.ts +23 -0
- package/dist/movethewheels/hooks/useTrackingEventQuality.d.ts +5 -0
- package/dist/movethewheels/pages/ShipmentStatusAuthorityPage.d.ts +1 -0
- package/dist/movethewheels/utils/shipmentStatusDraft.d.ts +45 -0
- package/dist/pages/DeliveryCapturePage.js +181 -116
- package/dist/pages/ShipmentStatusAuthorityPage.js +563 -0
- package/dist/pages/TrackingEventQualityPage.js +6 -1
- package/dist/src/generated/shipment-status-authority-operations.js +86 -0
- package/dist/utils/graphqlClient.js +66 -56
- package/dist/utils/shipmentStatusDraft.js +41 -0
- package/package.json +7 -5
- package/src/generated/shipment-status-authority-operations.ts +5503 -0
- package/src/movethewheels/MoveTheWheelsRoot.tsx +6 -0
- package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
- package/src/movethewheels/hooks/useEpod.ts +47 -12
- package/src/movethewheels/hooks/useShipmentStatusAuthority.ts +179 -0
- package/src/movethewheels/hooks/useTracking.ts +27 -12
- package/src/movethewheels/hooks/useTrackingEventQuality.ts +42 -0
- package/src/movethewheels/pages/DeliveryCapturePage.tsx +113 -6
- package/src/movethewheels/pages/ShipmentStatusAuthorityPage.tsx +639 -0
- package/src/movethewheels/pages/TrackingEventQualityPage.tsx +13 -2
- package/src/movethewheels/utils/graphqlClient.ts +34 -17
- package/src/movethewheels/utils/shipmentStatusDraft.ts +118 -0
- package/src/operations/shipment-status-authority/status.graphql +80 -0
|
@@ -1,48 +1,58 @@
|
|
|
1
|
+
import { prepareWorkspaceRequest as e } from "@burdenoff/fe-libs/shared/graphql";
|
|
1
2
|
//#region src/movethewheels/utils/graphqlClient.ts
|
|
2
|
-
function
|
|
3
|
+
function t(e) {
|
|
3
4
|
return e ? e.endsWith("/graphql") ? e : `${e}/workspaces/graphql` : "/workspaces/graphql";
|
|
4
5
|
}
|
|
5
|
-
var
|
|
6
|
-
function
|
|
6
|
+
var n = 3, r = 12e3;
|
|
7
|
+
function i(e) {
|
|
7
8
|
return e ? /upstream connect|connection refused|reset before headers|delayed connect|econnrefused|econnreset|socket hang up|service unavailable|bad gateway|gateway timeout|temporarily unavailable|please try again|failed to fetch|networkerror|load failed/i.test(e) : !1;
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function a(e) {
|
|
10
11
|
return e === 429 || e === 502 || e === 503 || e === 504;
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function o(e) {
|
|
13
14
|
return typeof e == "object" && !!e && "name" in e && e.name === "AbortError";
|
|
14
15
|
}
|
|
15
|
-
var
|
|
16
|
-
function
|
|
16
|
+
var s = (e) => new Promise((t) => setTimeout(t, e)), c = 4, l = 0, u = [];
|
|
17
|
+
function d() {
|
|
17
18
|
return new Promise((e) => {
|
|
18
|
-
|
|
19
|
+
l < c ? (l += 1, e()) : u.push(e);
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
let e =
|
|
23
|
-
e ? e() : --
|
|
22
|
+
function f() {
|
|
23
|
+
let e = u.shift();
|
|
24
|
+
e ? e() : --l;
|
|
24
25
|
}
|
|
25
|
-
async function
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...n.tenantId ? { "x-tenant-id": n.tenantId } : {},
|
|
32
|
-
...n.actorId ? { "x-actor-id": n.actorId } : {},
|
|
33
|
-
...n.actorId ? { "x-actor-type": "user" } : {}
|
|
34
|
-
}, c = JSON.stringify({
|
|
35
|
-
query: r,
|
|
36
|
-
variables: i
|
|
37
|
-
});
|
|
38
|
-
await u();
|
|
26
|
+
async function p(r, i, a, o = "RETRY_TRANSIENT") {
|
|
27
|
+
let s = { ...r }, c = JSON.stringify({
|
|
28
|
+
query: i,
|
|
29
|
+
variables: a
|
|
30
|
+
}), l = t(s.apiGatewayUrl);
|
|
31
|
+
await d();
|
|
39
32
|
try {
|
|
40
|
-
|
|
33
|
+
let t = typeof window < "u" ? await e({
|
|
34
|
+
url: l.startsWith("/") ? new URL(l, window.location.origin).toString() : l,
|
|
35
|
+
authToken: s.authToken ?? "",
|
|
36
|
+
actorId: s.actorId ?? "",
|
|
37
|
+
workspaceId: s.workspaceId ?? "",
|
|
38
|
+
tenantId: s.tenantId,
|
|
39
|
+
workspaceToken: s.workspaceToken,
|
|
40
|
+
currentQuery: i
|
|
41
|
+
}) : null, r = t?.workspaceToken ?? s.workspaceToken;
|
|
42
|
+
return await h(l, {
|
|
43
|
+
"content-type": "application/json",
|
|
44
|
+
...s.authToken ? { Authorization: `Bearer ${s.authToken}` } : {},
|
|
45
|
+
...r ? { "X-Workspace-Authorization": `Bearer ${r}` } : {},
|
|
46
|
+
...s.workspaceId ? { "x-workspace-id": s.workspaceId } : {},
|
|
47
|
+
...s.tenantId ? { "x-tenant-id": s.tenantId } : {},
|
|
48
|
+
...s.actorId ? { "x-actor-id": s.actorId } : {},
|
|
49
|
+
...s.actorId ? { "x-actor-type": "user" } : {}
|
|
50
|
+
}, c, o === "SINGLE_ATTEMPT" ? 0 : n, t?.assertCurrent ?? (() => {}));
|
|
41
51
|
} finally {
|
|
42
|
-
|
|
52
|
+
f();
|
|
43
53
|
}
|
|
44
54
|
}
|
|
45
|
-
async function
|
|
55
|
+
async function m(e) {
|
|
46
56
|
try {
|
|
47
57
|
let t = ((await e.json()).errors ?? []).map((e) => e.message).filter((e) => typeof e == "string" && e.length > 0);
|
|
48
58
|
return t.length > 0 ? t.join("; ") : null;
|
|
@@ -50,44 +60,44 @@ async function p(e) {
|
|
|
50
60
|
return null;
|
|
51
61
|
}
|
|
52
62
|
}
|
|
53
|
-
async function
|
|
54
|
-
let
|
|
55
|
-
for (let
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
let
|
|
63
|
+
async function h(e, t, n, c, l) {
|
|
64
|
+
let u = /* @__PURE__ */ Error("GraphQL request failed");
|
|
65
|
+
for (let d = 0; d <= c; d += 1) {
|
|
66
|
+
let f = d < c;
|
|
67
|
+
d > 0 && await s(Math.min(250 * 2 ** (d - 1), 2e3) + Math.floor(Math.random() * 150)), l();
|
|
68
|
+
let p = new AbortController(), h = setTimeout(() => p.abort(), r);
|
|
59
69
|
try {
|
|
60
|
-
let
|
|
70
|
+
let r = await fetch(e, {
|
|
61
71
|
method: "POST",
|
|
62
72
|
headers: t,
|
|
63
|
-
body:
|
|
64
|
-
signal:
|
|
73
|
+
body: n,
|
|
74
|
+
signal: p.signal
|
|
65
75
|
});
|
|
66
|
-
if (!
|
|
67
|
-
let e =
|
|
68
|
-
if (
|
|
69
|
-
throw
|
|
76
|
+
if (!r.ok) {
|
|
77
|
+
let e = a(r.status) ? null : await m(r);
|
|
78
|
+
if (u = Error(e ?? `GraphQL request failed with status ${r.status}`), f && a(r.status)) continue;
|
|
79
|
+
throw u;
|
|
70
80
|
}
|
|
71
|
-
let
|
|
72
|
-
if (
|
|
73
|
-
let e =
|
|
74
|
-
if (
|
|
75
|
-
throw
|
|
81
|
+
let o = await r.json();
|
|
82
|
+
if (o.errors?.length) {
|
|
83
|
+
let e = o.errors.map((e) => e.message ?? "Unknown GraphQL error").join("; ");
|
|
84
|
+
if (u = Error(e), f && o.errors.some((e) => i(e.message))) continue;
|
|
85
|
+
throw u;
|
|
76
86
|
}
|
|
77
|
-
if (!
|
|
78
|
-
if (
|
|
79
|
-
throw
|
|
87
|
+
if (!o.data) {
|
|
88
|
+
if (u = /* @__PURE__ */ Error("GraphQL response did not include data"), f) continue;
|
|
89
|
+
throw u;
|
|
80
90
|
}
|
|
81
|
-
return
|
|
91
|
+
return o.data;
|
|
82
92
|
} catch (e) {
|
|
83
|
-
let t =
|
|
84
|
-
if (
|
|
85
|
-
throw
|
|
93
|
+
let t = o(e), n = t ? `GraphQL request timed out after ${r}ms` : e instanceof Error ? e.message : String(e);
|
|
94
|
+
if (u = !t && e instanceof Error ? e : Error(n), f && (t || i(n) || e instanceof TypeError)) continue;
|
|
95
|
+
throw u;
|
|
86
96
|
} finally {
|
|
87
|
-
clearTimeout(
|
|
97
|
+
clearTimeout(h);
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
|
-
throw
|
|
100
|
+
throw u;
|
|
91
101
|
}
|
|
92
102
|
//#endregion
|
|
93
|
-
export {
|
|
103
|
+
export { p as executeGraphQL, t as resolveGraphqlUrl };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/movethewheels/utils/shipmentStatusDraft.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = e.trim();
|
|
4
|
+
if (!t || t.length > 1e3) throw Error("Enter a reason of 1–1000 characters.");
|
|
5
|
+
return t;
|
|
6
|
+
}
|
|
7
|
+
function t(e, t, n, r) {
|
|
8
|
+
if (!/^\d+$/.test(e.trim())) throw Error(`${r} must be an explicit whole number of seconds.`);
|
|
9
|
+
let i = Number(e.trim());
|
|
10
|
+
if (!Number.isSafeInteger(i) || i < t || i > n) throw Error(`${r} must be between ${t} and ${n} seconds.`);
|
|
11
|
+
return i;
|
|
12
|
+
}
|
|
13
|
+
function n(n, r) {
|
|
14
|
+
if (!n.integrationId || !n.basisTrackingEventId) throw Error("Choose one integration and one recorded basis event.");
|
|
15
|
+
return {
|
|
16
|
+
expectedStatusRevision: r,
|
|
17
|
+
integrationId: n.integrationId,
|
|
18
|
+
basisTrackingEventId: n.basisTrackingEventId,
|
|
19
|
+
maxSourceAgeSeconds: t(n.maxSourceAgeSeconds, 1, 2592e3, "Maximum source age"),
|
|
20
|
+
maxFutureSkewSeconds: t(n.maxFutureSkewSeconds, 0, 86400, "Allowed future skew"),
|
|
21
|
+
reason: e(n.reason)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function r(e, t) {
|
|
25
|
+
let n = {
|
|
26
|
+
PICKED_UP: "PICKED_UP",
|
|
27
|
+
IN_TRANSIT: "IN_TRANSIT",
|
|
28
|
+
ARRIVED: "IN_TRANSIT",
|
|
29
|
+
DEPARTED: "IN_TRANSIT",
|
|
30
|
+
OUT_FOR_DELIVERY: "IN_TRANSIT",
|
|
31
|
+
DELIVERED: "DELIVERED",
|
|
32
|
+
FAILED: "FAILED",
|
|
33
|
+
RETURNED: "RETURNED"
|
|
34
|
+
}, r = t.basis, i = r?.providerEventTime ? Date.parse(r.providerEventTime) : NaN;
|
|
35
|
+
return !!e && !!r && Number.isFinite(i) && e.id === t.id && e.statusRevision === t.input.expectedStatusRevision + 1 && e.statusAuthority === "INTEGRATION_EVENT_TIME" && e.statusAuthorityEpoch === t.epoch + 1 && e.designatedIntegrationId === t.input.integrationId && e.statusBasisEventId === r.id && r.id === t.input.basisTrackingEventId && typeof e.statusBasisSourceTime == "string" && Date.parse(e.statusBasisSourceTime) === i && e.maxSourceAgeSeconds === t.input.maxSourceAgeSeconds && e.maxFutureSkewSeconds === t.input.maxFutureSkewSeconds && typeof n[r.eventType] == "string" && e.status === n[r.eventType];
|
|
36
|
+
}
|
|
37
|
+
function i(e, t) {
|
|
38
|
+
return !!e && e.id === t.id && e.statusRevision === t.revision + 1 && e.status === t.status && e.statusAuthority === "MANUAL_HOLD" && e.statusAuthorityEpoch === t.epoch + 1 && e.designatedIntegrationId === null && e.statusBasisEventId === null && e.statusBasisSourceTime === null && e.maxSourceAgeSeconds === null && e.maxFutureSkewSeconds === null;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { i as manualStatusAcknowledged, n as shipmentSourceInput, r as sourceStatusAcknowledged, e as statusDecisionReason };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-movethewheels",
|
|
3
|
-
"version": "2026.1011.
|
|
3
|
+
"version": "2026.1011.3",
|
|
4
4
|
"description": "Burdenoff MoveTheWheels Microfrontend - Logistics & Supply Chain Management Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"main": "./dist/index.js",
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
28
|
"scripts": {
|
|
29
|
+
"verify:workspace-predispatch": "bun test scripts/verify-workspace-predispatch.test.ts",
|
|
29
30
|
"verify:multimodal-single-attempt": "bun scripts/verify-multimodal-single-attempt.mjs",
|
|
30
31
|
"verify:live-logistics-contract": "bun test scripts/check-logistics-live-contract.test.mjs scripts/fetch-logistics-live-schema.test.mjs",
|
|
31
32
|
"dev": "vite --port 5191",
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
36
37
|
"type:check": "bash scripts/build-limits.sh tsc --noEmit",
|
|
37
38
|
"validate:schema-drift": "graphql-schema-drift",
|
|
38
|
-
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run codegen && bun run validate:schema-drift && bun run lint:sanity && bun run format && bun run type:check && bun run verify:live-logistics-contract && bun run verify:empty-reuse-retry && bun run verify:empty-reuse-recovery && bun run verify:trip-utilization-input && bun run verify:trip-draft-context && bun run verify:stock-binding-input && bun run verify:stock-observation-input && bun run verify:pending-pick-input && bun run verify:freight-input && bun run verify:freight-recovery && bun run verify:procedure-input && bun run verify:consolidation && bun run verify:multimodal-single-attempt && bun run verify:tracking-quality-outcomes && bun run verify:braces-depth && bun run build && bun run build-storybook'",
|
|
39
|
+
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run codegen && bun run validate:schema-drift && bun run lint:sanity && bun run format && bun run type:check && bun run verify:live-logistics-contract && bun run verify:empty-reuse-retry && bun run verify:empty-reuse-recovery && bun run verify:trip-utilization-input && bun run verify:trip-draft-context && bun run verify:stock-binding-input && bun run verify:stock-observation-input && bun run verify:pending-pick-input && bun run verify:freight-input && bun run verify:freight-recovery && bun run verify:procedure-input && bun run verify:consolidation && bun run verify:multimodal-single-attempt && bun run verify:workspace-predispatch && bun run verify:tracking-quality-outcomes && bun run verify:shipment-status-authority && bun run verify:braces-depth && bun run build && bun run build-storybook'",
|
|
39
40
|
"storybook": "storybook dev -p 6006",
|
|
40
41
|
"build-storybook": "storybook build",
|
|
41
42
|
"test:storybook": "test-storybook",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"schema:pull:introspect": "bash scripts/schema-pull.sh --mode introspect",
|
|
44
45
|
"schema:check": "bash scripts/schema-pull.sh --check",
|
|
45
46
|
"verify:stock-binding-input": "bun scripts/verify-stock-binding-input.mjs",
|
|
46
|
-
"codegen": "graphql-codegen --project wspace && graphql-codegen --project container-foundation && graphql-codegen --project container-condition && graphql-codegen --project free-time && graphql-codegen --project empty-reuse && graphql-codegen --project trip-utilization && graphql-codegen --project stock-binding && graphql-codegen --project stock-observation && graphql-codegen --project pending-pick && graphql-codegen --project freight-cost && graphql-codegen --project logistics-procedure && graphql-codegen --project consolidation && graphql-codegen --project tracking-quality",
|
|
47
|
+
"codegen": "graphql-codegen --project wspace && graphql-codegen --project container-foundation && graphql-codegen --project container-condition && graphql-codegen --project free-time && graphql-codegen --project empty-reuse && graphql-codegen --project trip-utilization && graphql-codegen --project stock-binding && graphql-codegen --project stock-observation && graphql-codegen --project pending-pick && graphql-codegen --project freight-cost && graphql-codegen --project logistics-procedure && graphql-codegen --project consolidation && graphql-codegen --project tracking-quality && graphql-codegen --project shipment-status-authority",
|
|
47
48
|
"codegen:all": "bun run schema:pull && bun run codegen",
|
|
48
49
|
"switch:status": "bun scripts/deps-mode.ts status",
|
|
49
50
|
"switch:remote": "bun scripts/deps-mode.ts remote",
|
|
@@ -62,11 +63,12 @@
|
|
|
62
63
|
"verify:procedure-input": "bun scripts/verify-procedure-input.mjs && bun scripts/verify-procedure-recovery-hook.mjs",
|
|
63
64
|
"verify:consolidation": "bun scripts/verify-consolidation-input.mjs && bun scripts/verify-consolidation-recovery-hook.mjs && bun scripts/verify-consolidation-mounted-hook.mjs",
|
|
64
65
|
"verify:tracking-quality-outcomes": "bun test scripts/verify-tracking-quality-outcomes.test.ts",
|
|
65
|
-
"verify:braces-depth": "bun test scripts/braces-depth-patch.test.ts"
|
|
66
|
+
"verify:braces-depth": "bun test scripts/braces-depth-patch.test.ts",
|
|
67
|
+
"verify:shipment-status-authority": "bun scripts/verify-shipment-status-command.mjs"
|
|
66
68
|
},
|
|
67
69
|
"dependencies": {
|
|
68
70
|
"@apollo/client": "^4.0.11",
|
|
69
|
-
"@burdenoff/fe-libs": "2026.
|
|
71
|
+
"@burdenoff/fe-libs": "2026.1011.2",
|
|
70
72
|
"@react-leaflet/core": "^3.0.0",
|
|
71
73
|
"@tanstack/react-query": "^5.90.16",
|
|
72
74
|
"clsx": "^2.1.1",
|