@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.
Files changed (32) hide show
  1. package/dist/MoveTheWheelsRoot.js +5 -0
  2. package/dist/MoveTheWheelsRoutes.js +54 -50
  3. package/dist/generated/shipment-status-authority-operations.d.ts +4473 -0
  4. package/dist/hooks/useEpod.js +85 -77
  5. package/dist/hooks/useShipmentStatusAuthority.js +127 -0
  6. package/dist/hooks/useTracking.js +15 -14
  7. package/dist/hooks/useTrackingEventQuality.js +43 -17
  8. package/dist/movethewheels/hooks/useEpod.d.ts +23 -0
  9. package/dist/movethewheels/hooks/useShipmentStatusAuthority.d.ts +23 -0
  10. package/dist/movethewheels/hooks/useTrackingEventQuality.d.ts +5 -0
  11. package/dist/movethewheels/pages/ShipmentStatusAuthorityPage.d.ts +1 -0
  12. package/dist/movethewheels/utils/shipmentStatusDraft.d.ts +45 -0
  13. package/dist/pages/DeliveryCapturePage.js +181 -116
  14. package/dist/pages/ShipmentStatusAuthorityPage.js +563 -0
  15. package/dist/pages/TrackingEventQualityPage.js +6 -1
  16. package/dist/src/generated/shipment-status-authority-operations.js +86 -0
  17. package/dist/utils/graphqlClient.js +66 -56
  18. package/dist/utils/shipmentStatusDraft.js +41 -0
  19. package/package.json +7 -5
  20. package/src/generated/shipment-status-authority-operations.ts +5503 -0
  21. package/src/movethewheels/MoveTheWheelsRoot.tsx +6 -0
  22. package/src/movethewheels/MoveTheWheelsRoutes.tsx +2 -0
  23. package/src/movethewheels/hooks/useEpod.ts +47 -12
  24. package/src/movethewheels/hooks/useShipmentStatusAuthority.ts +179 -0
  25. package/src/movethewheels/hooks/useTracking.ts +27 -12
  26. package/src/movethewheels/hooks/useTrackingEventQuality.ts +42 -0
  27. package/src/movethewheels/pages/DeliveryCapturePage.tsx +113 -6
  28. package/src/movethewheels/pages/ShipmentStatusAuthorityPage.tsx +639 -0
  29. package/src/movethewheels/pages/TrackingEventQualityPage.tsx +13 -2
  30. package/src/movethewheels/utils/graphqlClient.ts +34 -17
  31. package/src/movethewheels/utils/shipmentStatusDraft.ts +118 -0
  32. 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 e(e) {
3
+ function t(e) {
3
4
  return e ? e.endsWith("/graphql") ? e : `${e}/workspaces/graphql` : "/workspaces/graphql";
4
5
  }
5
- var t = 3, n = 12e3;
6
- function r(e) {
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 i(e) {
10
+ function a(e) {
10
11
  return e === 429 || e === 502 || e === 503 || e === 504;
11
12
  }
12
- function a(e) {
13
+ function o(e) {
13
14
  return typeof e == "object" && !!e && "name" in e && e.name === "AbortError";
14
15
  }
15
- var o = (e) => new Promise((t) => setTimeout(t, e)), s = 4, c = 0, l = [];
16
- function u() {
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
- c < s ? (c += 1, e()) : l.push(e);
19
+ l < c ? (l += 1, e()) : u.push(e);
19
20
  });
20
21
  }
21
- function d() {
22
- let e = l.shift();
23
- e ? e() : --c;
22
+ function f() {
23
+ let e = u.shift();
24
+ e ? e() : --l;
24
25
  }
25
- async function f(n, r, i, a = "RETRY_TRANSIENT") {
26
- let o = e(n.apiGatewayUrl), s = {
27
- "content-type": "application/json",
28
- ...n.authToken ? { Authorization: `Bearer ${n.authToken}` } : {},
29
- ...n.workspaceToken ? { "X-Workspace-Authorization": `Bearer ${n.workspaceToken}` } : {},
30
- ...n.workspaceId ? { "x-workspace-id": n.workspaceId } : {},
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
- return await m(o, s, c, a === "SINGLE_ATTEMPT" ? 0 : t);
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
- d();
52
+ f();
43
53
  }
44
54
  }
45
- async function p(e) {
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 m(e, t, s, c) {
54
- let l = /* @__PURE__ */ Error("GraphQL request failed");
55
- for (let u = 0; u <= c; u += 1) {
56
- let d = u < c;
57
- u > 0 && await o(Math.min(250 * 2 ** (u - 1), 2e3) + Math.floor(Math.random() * 150));
58
- let f = new AbortController(), m = setTimeout(() => f.abort(), n);
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 n = await fetch(e, {
70
+ let r = await fetch(e, {
61
71
  method: "POST",
62
72
  headers: t,
63
- body: s,
64
- signal: f.signal
73
+ body: n,
74
+ signal: p.signal
65
75
  });
66
- if (!n.ok) {
67
- let e = i(n.status) ? null : await p(n);
68
- if (l = Error(e ?? `GraphQL request failed with status ${n.status}`), d && i(n.status)) continue;
69
- throw l;
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 a = await n.json();
72
- if (a.errors?.length) {
73
- let e = a.errors.map((e) => e.message ?? "Unknown GraphQL error").join("; ");
74
- if (l = Error(e), d && a.errors.some((e) => r(e.message))) continue;
75
- throw l;
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 (!a.data) {
78
- if (l = /* @__PURE__ */ Error("GraphQL response did not include data"), d) continue;
79
- throw l;
87
+ if (!o.data) {
88
+ if (u = /* @__PURE__ */ Error("GraphQL response did not include data"), f) continue;
89
+ throw u;
80
90
  }
81
- return a.data;
91
+ return o.data;
82
92
  } catch (e) {
83
- let t = a(e), i = t ? `GraphQL request timed out after ${n}ms` : e instanceof Error ? e.message : String(e);
84
- if (l = !t && e instanceof Error ? e : Error(i), d && (t || r(i) || e instanceof TypeError)) continue;
85
- throw l;
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(m);
97
+ clearTimeout(h);
88
98
  }
89
99
  }
90
- throw l;
100
+ throw u;
91
101
  }
92
102
  //#endregion
93
- export { f as executeGraphQL, e as resolveGraphqlUrl };
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.1",
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.801.1",
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",