@burdenoff/microfe-movethewheels 2026.1107.6 → 2026.1108.1
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/components/CarrierRecommendationDialog.js +21 -0
- package/dist/components/DispatchDecisionCard.js +111 -97
- package/dist/components/InventoryCoverPanel.js +401 -0
- package/dist/components/ShipmentDecisionPanel.js +362 -0
- package/dist/components/ShipmentRiskDialog.js +134 -89
- package/dist/generated/tracking-quality-operations.d.ts +288 -0
- package/dist/generated/wspace-types.d.ts +1645 -0
- package/dist/hooks/useInventoryCoverPlan.js +70 -0
- package/dist/hooks/useShipmentDecision.js +111 -0
- package/dist/movethewheels/components/CarrierRecommendationDialog.d.ts +20 -0
- package/dist/movethewheels/components/DispatchDecisionCard.d.ts +5 -1
- package/dist/movethewheels/components/InventoryCoverPanel.d.ts +24 -0
- package/dist/movethewheels/components/ShipmentDecisionPanel.d.ts +14 -0
- package/dist/movethewheels/hooks/useDispatchPlan.d.ts +1 -1
- package/dist/movethewheels/hooks/useInventoryCoverPlan.d.ts +80 -0
- package/dist/movethewheels/hooks/useShipmentDecision.d.ts +67 -0
- package/dist/pages/DispatchPlanPage.js +198 -171
- package/dist/pages/InventoryPage.js +219 -214
- package/package.json +1 -1
- package/src/generated/tracking-quality-operations.ts +321 -0
- package/src/generated/wspace-types.ts +1861 -0
- package/src/movethewheels/components/CarrierRecommendationDialog.tsx +54 -0
- package/src/movethewheels/components/DispatchDecisionCard.tsx +17 -2
- package/src/movethewheels/components/InventoryCoverPanel.tsx +449 -0
- package/src/movethewheels/components/ShipmentDecisionPanel.tsx +459 -0
- package/src/movethewheels/components/ShipmentRiskDialog.tsx +67 -1
- package/src/movethewheels/hooks/useInventoryCoverPlan.ts +250 -0
- package/src/movethewheels/hooks/useShipmentDecision.ts +318 -0
- package/src/movethewheels/pages/DispatchPlanPage.tsx +30 -1
- package/src/movethewheels/pages/InventoryPage.tsx +8 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
|
+
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
+
import { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
|
|
4
|
+
//#region src/movethewheels/hooks/useInventoryCoverPlan.ts
|
|
5
|
+
var s = [
|
|
6
|
+
"OUT_OF_STOCK",
|
|
7
|
+
"AT_RISK",
|
|
8
|
+
"REORDER"
|
|
9
|
+
], c = "\n query GetMovethewheelsInventoryCoverPlan($input: InventoryCoverPlanInput) {\n inventoryCoverPlan(input: $input) {\n generatedAt\n historyStart\n historyEnd\n historyWeeks\n warehouseId\n leadTimeWeeks\n targetCoverWeeks\n demandChangePct\n summary {\n totalItems\n outOfStock\n atRisk\n reorder\n healthy\n notEnoughHistory\n noDemand\n totalSuggestedReorderQuantity\n }\n unattributedUnits\n unattributedJobs\n truncated\n matchingItems\n rows {\n warehouseId\n warehouseName\n warehouseCode\n cargoItemId\n sku\n name\n onHand\n damaged\n usableStock\n reorderPoint\n safetyStock\n demandStatus\n weeksOfHistory\n weeklyUnits\n currentWeekUnits\n baselineWeeklyDemand\n forecastWeeklyDemand\n weeksOfCover\n projectedStockOutWeek\n stockOutBeforeLeadTime\n suggestedReorderQuantity\n status\n }\n }\n }\n", l = {
|
|
10
|
+
warehouseId: null,
|
|
11
|
+
leadTimeWeeks: 2,
|
|
12
|
+
targetCoverWeeks: 6,
|
|
13
|
+
demandChangePct: 0,
|
|
14
|
+
actionOnly: !1
|
|
15
|
+
};
|
|
16
|
+
function u(u = l) {
|
|
17
|
+
let { apiGatewayUrl: d, authToken: f, workspaceToken: p, workspaceId: m, tenantId: h, currentUser: g } = e(), [_, v] = o(null), [y, b] = o(!0), [x, S] = o(null), C = a(0), w = a(null), T = a(u), E = i(() => ({
|
|
18
|
+
apiGatewayUrl: d,
|
|
19
|
+
authToken: f,
|
|
20
|
+
workspaceToken: p,
|
|
21
|
+
workspaceId: m,
|
|
22
|
+
tenantId: h,
|
|
23
|
+
actorId: g?.id
|
|
24
|
+
}), [
|
|
25
|
+
d,
|
|
26
|
+
f,
|
|
27
|
+
p,
|
|
28
|
+
m,
|
|
29
|
+
h,
|
|
30
|
+
g?.id
|
|
31
|
+
]), D = n(async (e) => {
|
|
32
|
+
T.current = e;
|
|
33
|
+
let n = C.current + 1;
|
|
34
|
+
C.current = n, w.current?.abort();
|
|
35
|
+
let r = new AbortController();
|
|
36
|
+
w.current = r, b(!0), S(null);
|
|
37
|
+
try {
|
|
38
|
+
let i = await t({
|
|
39
|
+
...E,
|
|
40
|
+
signal: r.signal
|
|
41
|
+
}, c, { input: {
|
|
42
|
+
warehouseId: e.warehouseId,
|
|
43
|
+
leadTimeWeeks: e.leadTimeWeeks,
|
|
44
|
+
targetCoverWeeks: e.targetCoverWeeks,
|
|
45
|
+
demandChangePct: e.demandChangePct,
|
|
46
|
+
statuses: e.actionOnly ? s : null,
|
|
47
|
+
limit: 200
|
|
48
|
+
} });
|
|
49
|
+
C.current === n && v(i.inventoryCoverPlan);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
C.current === n && !r.signal.aborted && S(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load the stock cover plan"));
|
|
52
|
+
} finally {
|
|
53
|
+
C.current === n && b(!1);
|
|
54
|
+
}
|
|
55
|
+
}, [E]);
|
|
56
|
+
return r(() => {
|
|
57
|
+
D(T.current);
|
|
58
|
+
}, [D]), r(() => () => {
|
|
59
|
+
C.current += 1, w.current?.abort();
|
|
60
|
+
}, []), {
|
|
61
|
+
plan: _,
|
|
62
|
+
isLoading: y,
|
|
63
|
+
error: x,
|
|
64
|
+
run: n((e) => {
|
|
65
|
+
D(e);
|
|
66
|
+
}, [D])
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { l as DEFAULT_COVER_REQUEST, u as useInventoryCoverPlan };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
|
|
2
|
+
import { executeGraphQL as t } from "../utils/graphqlClient.js";
|
|
3
|
+
import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
|
|
4
|
+
//#region src/movethewheels/hooks/useShipmentDecision.ts
|
|
5
|
+
var o = "\n id\n kind\n shipmentId\n shipmentNumber\n status\n method\n options {\n id\n rank\n action\n execution\n confidence\n score\n reasons\n rationale\n aiRationale\n carrierId\n newEstimatedDelivery\n followUpMutation\n followUpArgs\n deliveredCount\n onTimeCount\n laneDeliveredCount\n laneOnTimeCount\n medianLaneCost\n currency\n }\n chosenOptionId\n outcome\n decisionReason\n currentCarrierId\n promisedDelivery\n riskScore\n predictedSlipMinutes\n breached\n laneKnown\n historyCount\n aiStatus\n aiSummary\n aiModel\n expiresAt\n decidedAt\n createdAt\n", s = `
|
|
6
|
+
query LatestShipmentDecision($shipmentId: ID!, $kind: MtwShipmentDecisionKind!) {
|
|
7
|
+
mtwLatestShipmentDecision(shipmentId: $shipmentId, kind: $kind) {
|
|
8
|
+
${o}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`, c = `
|
|
12
|
+
mutation RecommendCarrier($shipmentId: ID!) {
|
|
13
|
+
mtwRecommendCarrier(shipmentId: $shipmentId) {
|
|
14
|
+
${o}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`, l = `
|
|
18
|
+
mutation ResolveException($shipmentId: ID!) {
|
|
19
|
+
mtwResolveException(shipmentId: $shipmentId) {
|
|
20
|
+
${o}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`, u = `
|
|
24
|
+
mutation AcceptShipmentDecision($decisionId: ID!, $optionId: ID!) {
|
|
25
|
+
mtwAcceptShipmentDecision(decisionId: $decisionId, optionId: $optionId) {
|
|
26
|
+
${o}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`, d = `
|
|
30
|
+
mutation RejectShipmentDecision($decisionId: ID!) {
|
|
31
|
+
mtwRejectShipmentDecision(decisionId: $decisionId) {
|
|
32
|
+
${o}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
function f(o, f) {
|
|
37
|
+
let { apiGatewayUrl: p, authToken: m, workspaceToken: h, workspaceId: g, tenantId: _, currentUser: v } = e(), y = i(() => ({
|
|
38
|
+
apiGatewayUrl: p,
|
|
39
|
+
authToken: m,
|
|
40
|
+
workspaceToken: h,
|
|
41
|
+
workspaceId: g,
|
|
42
|
+
tenantId: _,
|
|
43
|
+
actorId: v?.id
|
|
44
|
+
}), [
|
|
45
|
+
p,
|
|
46
|
+
m,
|
|
47
|
+
h,
|
|
48
|
+
g,
|
|
49
|
+
_,
|
|
50
|
+
v?.id
|
|
51
|
+
]), [b, x] = a(null), [S, C] = a(!1), [w, T] = a(null), [E, D] = a(null), O = n(async (e) => {
|
|
52
|
+
if (o) {
|
|
53
|
+
C(!0), T(null);
|
|
54
|
+
try {
|
|
55
|
+
let n = await t({
|
|
56
|
+
...y,
|
|
57
|
+
signal: e
|
|
58
|
+
}, s, {
|
|
59
|
+
shipmentId: o,
|
|
60
|
+
kind: f
|
|
61
|
+
});
|
|
62
|
+
if (e?.aborted) return;
|
|
63
|
+
x(n.mtwLatestShipmentDecision);
|
|
64
|
+
} catch (t) {
|
|
65
|
+
if (e?.aborted) return;
|
|
66
|
+
T(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to load the decision"));
|
|
67
|
+
} finally {
|
|
68
|
+
e?.aborted || C(!1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, [
|
|
72
|
+
y,
|
|
73
|
+
o,
|
|
74
|
+
f
|
|
75
|
+
]);
|
|
76
|
+
r(() => {
|
|
77
|
+
let e = new AbortController();
|
|
78
|
+
return x(null), O(e.signal), () => e.abort();
|
|
79
|
+
}, [O]);
|
|
80
|
+
let k = n(async (e, t, n) => {
|
|
81
|
+
D(e);
|
|
82
|
+
try {
|
|
83
|
+
let e = n(await t());
|
|
84
|
+
return x(e), e;
|
|
85
|
+
} catch (e) {
|
|
86
|
+
throw O(), e;
|
|
87
|
+
} finally {
|
|
88
|
+
D(null);
|
|
89
|
+
}
|
|
90
|
+
}, [O]);
|
|
91
|
+
return {
|
|
92
|
+
decision: b,
|
|
93
|
+
isLoading: S,
|
|
94
|
+
error: w,
|
|
95
|
+
pendingAction: E,
|
|
96
|
+
refetch: () => void O(),
|
|
97
|
+
propose: n(() => o ? f === "CARRIER_RECOMMENDATION" ? k("propose", () => t(y, c, { shipmentId: o }, "SINGLE_ATTEMPT"), (e) => e.mtwRecommendCarrier) : k("propose", () => t(y, l, { shipmentId: o }, "SINGLE_ATTEMPT"), (e) => e.mtwResolveException) : Promise.reject(/* @__PURE__ */ Error("No shipment selected")), [
|
|
98
|
+
y,
|
|
99
|
+
f,
|
|
100
|
+
k,
|
|
101
|
+
o
|
|
102
|
+
]),
|
|
103
|
+
accept: n((e, n) => k("accept", () => t(y, u, {
|
|
104
|
+
decisionId: e,
|
|
105
|
+
optionId: n
|
|
106
|
+
}, "SINGLE_ATTEMPT"), (e) => e.mtwAcceptShipmentDecision), [y, k]),
|
|
107
|
+
reject: n((e) => k("reject", () => t(y, d, { decisionId: e }, "SINGLE_ATTEMPT"), (e) => e.mtwRejectShipmentDecision), [y, k])
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { f as useShipmentDecision };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CarrierRecommendationDialog (BOFF-10908)
|
|
3
|
+
*
|
|
4
|
+
* Carrier recommendation cards for one PLANNED shipment, opened from the
|
|
5
|
+
* dispatch planner when the shipment should go with a carrier rather than the
|
|
6
|
+
* own fleet (no free vehicle, or the dispatcher prefers a carrier). Accepting
|
|
7
|
+
* a card assigns that carrier to the shipment; rejecting changes nothing.
|
|
8
|
+
*/
|
|
9
|
+
type Translate = (key: string, fallback: string) => string;
|
|
10
|
+
interface CarrierRecommendationDialogProps {
|
|
11
|
+
shipment: {
|
|
12
|
+
id: string;
|
|
13
|
+
number: string | null;
|
|
14
|
+
} | null;
|
|
15
|
+
onOpenChange: (open: boolean) => void;
|
|
16
|
+
onApplied?: () => void;
|
|
17
|
+
t: Translate;
|
|
18
|
+
}
|
|
19
|
+
export declare function CarrierRecommendationDialog({ shipment, onOpenChange, onApplied, t, }: CarrierRecommendationDialogProps): import('react').JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -2,6 +2,8 @@ import { DispatchAssignment } from '../hooks/useDispatchPlan';
|
|
|
2
2
|
export type DispatchChoice = 'accept' | 'reject' | null;
|
|
3
3
|
type Translate = (key: string, fallback: string) => string;
|
|
4
4
|
export declare function reasonLabel(reason: string, t: Translate): string;
|
|
5
|
+
/** Text colour for a 0..1 confidence; shared by every decision card. */
|
|
6
|
+
export declare function confidenceTone(confidence: number): string;
|
|
5
7
|
interface DispatchDecisionCardProps {
|
|
6
8
|
assignment: DispatchAssignment;
|
|
7
9
|
/** True while the plan can still be decided. */
|
|
@@ -10,7 +12,9 @@ interface DispatchDecisionCardProps {
|
|
|
10
12
|
disabled: boolean;
|
|
11
13
|
onChoose: (choice: DispatchChoice) => void;
|
|
12
14
|
onOpenRoute: (routeId: string) => void;
|
|
15
|
+
/** When set, an open card also offers a carrier recommendation for its shipment. */
|
|
16
|
+
onRecommendCarrier?: (shipmentId: string, shipmentNumber: string | null) => void;
|
|
13
17
|
t: Translate;
|
|
14
18
|
}
|
|
15
|
-
export declare function DispatchDecisionCard({ assignment, open, choice, disabled, onChoose, onOpenRoute, t, }: DispatchDecisionCardProps): import('react').JSX.Element;
|
|
19
|
+
export declare function DispatchDecisionCard({ assignment, open, choice, disabled, onChoose, onOpenRoute, onRecommendCarrier, t, }: DispatchDecisionCardProps): import('react').JSX.Element;
|
|
16
20
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CoverPlanRequest } from '../hooks/useInventoryCoverPlan';
|
|
2
|
+
interface DraftSettings {
|
|
3
|
+
warehouseId: string;
|
|
4
|
+
leadTime: string;
|
|
5
|
+
targetCover: string;
|
|
6
|
+
demandPct: string;
|
|
7
|
+
actionOnly: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** The request a draft describes, or the first problem with it. */
|
|
10
|
+
export declare function parseCoverDraft(draft: DraftSettings): {
|
|
11
|
+
request: CoverPlanRequest;
|
|
12
|
+
problem: null;
|
|
13
|
+
} | {
|
|
14
|
+
request: null;
|
|
15
|
+
problem: string;
|
|
16
|
+
};
|
|
17
|
+
interface InventoryCoverPanelProps {
|
|
18
|
+
warehouses: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export declare function InventoryCoverPanel({ warehouses }: InventoryCoverPanelProps): import('react').JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ShipmentDecision, ShipmentDecisionKind, ShipmentDecisionOption } from '../hooks/useShipmentDecision';
|
|
3
|
+
type Translate = (key: string, fallback: string) => string;
|
|
4
|
+
interface ShipmentDecisionPanelProps {
|
|
5
|
+
shipmentId: string | undefined;
|
|
6
|
+
kind: ShipmentDecisionKind;
|
|
7
|
+
t: Translate;
|
|
8
|
+
/** Called after an accepted option changed the shipment. */
|
|
9
|
+
onApplied?: (decision: ShipmentDecision) => void;
|
|
10
|
+
/** The manual step for an accepted FOLLOW_UP option, rendered under its card. */
|
|
11
|
+
renderFollowUp?: (option: ShipmentDecisionOption) => ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function ShipmentDecisionPanel({ shipmentId, kind, t, onApplied, renderFollowUp, }: ShipmentDecisionPanelProps): import('react').JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -71,7 +71,7 @@ export declare function useDispatchPlan(): {
|
|
|
71
71
|
plan: DispatchPlan | null;
|
|
72
72
|
isLoading: boolean;
|
|
73
73
|
error: Error | null;
|
|
74
|
-
pendingAction: "
|
|
74
|
+
pendingAction: "propose" | "apply" | "reject" | null;
|
|
75
75
|
refetch: () => undefined;
|
|
76
76
|
propose: (options?: PlanDispatchOptions) => Promise<DispatchPlan>;
|
|
77
77
|
apply: (planId: string, accept: string[]) => Promise<DispatchPlan>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inventory planning (BOFF-10926). Runs the read-only `inventoryCoverPlan`
|
|
3
|
+
* query: weeks of stock cover per warehouse and SKU against forecast
|
|
4
|
+
* outbound demand, with the projected stock-out week and a suggested
|
|
5
|
+
* reorder quantity.
|
|
6
|
+
*/
|
|
7
|
+
export type CoverStatus = 'OUT_OF_STOCK' | 'AT_RISK' | 'REORDER' | 'HEALTHY' | 'NOT_ENOUGH_HISTORY' | 'NO_DEMAND';
|
|
8
|
+
export type DemandStatus = 'FORECAST' | 'NOT_ENOUGH_HISTORY' | 'NO_DEMAND';
|
|
9
|
+
/** Statuses that ask the planner to act, most urgent first. */
|
|
10
|
+
export declare const ACTION_STATUSES: CoverStatus[];
|
|
11
|
+
export interface CoverPlanRequest {
|
|
12
|
+
warehouseId: string | null;
|
|
13
|
+
leadTimeWeeks: number;
|
|
14
|
+
targetCoverWeeks: number;
|
|
15
|
+
demandChangePct: number;
|
|
16
|
+
/** Only rows that need action; the summary always counts every row. */
|
|
17
|
+
actionOnly: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface CoverPlanRow {
|
|
20
|
+
warehouseId: string;
|
|
21
|
+
warehouseName: string;
|
|
22
|
+
warehouseCode: string;
|
|
23
|
+
cargoItemId: string;
|
|
24
|
+
sku: string;
|
|
25
|
+
name: string;
|
|
26
|
+
onHand: number;
|
|
27
|
+
damaged: number;
|
|
28
|
+
usableStock: number;
|
|
29
|
+
reorderPoint: number | null;
|
|
30
|
+
safetyStock: number | null;
|
|
31
|
+
demandStatus: DemandStatus;
|
|
32
|
+
weeksOfHistory: number;
|
|
33
|
+
weeklyUnits: number[];
|
|
34
|
+
currentWeekUnits: number;
|
|
35
|
+
baselineWeeklyDemand: number | null;
|
|
36
|
+
forecastWeeklyDemand: number | null;
|
|
37
|
+
weeksOfCover: number | null;
|
|
38
|
+
projectedStockOutWeek: string | null;
|
|
39
|
+
stockOutBeforeLeadTime: boolean;
|
|
40
|
+
suggestedReorderQuantity: number | null;
|
|
41
|
+
status: CoverStatus;
|
|
42
|
+
}
|
|
43
|
+
export interface CoverPlanSummary {
|
|
44
|
+
totalItems: number;
|
|
45
|
+
outOfStock: number;
|
|
46
|
+
atRisk: number;
|
|
47
|
+
reorder: number;
|
|
48
|
+
healthy: number;
|
|
49
|
+
notEnoughHistory: number;
|
|
50
|
+
noDemand: number;
|
|
51
|
+
totalSuggestedReorderQuantity: number;
|
|
52
|
+
}
|
|
53
|
+
export interface CoverPlan {
|
|
54
|
+
generatedAt: string;
|
|
55
|
+
historyStart: string;
|
|
56
|
+
historyEnd: string;
|
|
57
|
+
historyWeeks: number;
|
|
58
|
+
warehouseId: string | null;
|
|
59
|
+
leadTimeWeeks: number;
|
|
60
|
+
targetCoverWeeks: number;
|
|
61
|
+
demandChangePct: number;
|
|
62
|
+
summary: CoverPlanSummary;
|
|
63
|
+
unattributedUnits: number;
|
|
64
|
+
unattributedJobs: number;
|
|
65
|
+
truncated: boolean;
|
|
66
|
+
matchingItems: number;
|
|
67
|
+
rows: CoverPlanRow[];
|
|
68
|
+
}
|
|
69
|
+
/** Rows the panel asks for; the summary still counts every position. */
|
|
70
|
+
export declare const COVER_PLAN_ROW_LIMIT = 200;
|
|
71
|
+
export declare const DEFAULT_COVER_REQUEST: CoverPlanRequest;
|
|
72
|
+
interface UseInventoryCoverPlanResult {
|
|
73
|
+
plan: CoverPlan | null;
|
|
74
|
+
isLoading: boolean;
|
|
75
|
+
error: Error | null;
|
|
76
|
+
/** Run a plan; the latest request wins if several overlap. */
|
|
77
|
+
run: (request: CoverPlanRequest) => void;
|
|
78
|
+
}
|
|
79
|
+
export declare function useInventoryCoverPlan(initial?: CoverPlanRequest): UseInventoryCoverPlanResult;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { DecisionRationaleStatus } from './useDispatchPlan';
|
|
2
|
+
export type ShipmentDecisionKind = 'CARRIER_RECOMMENDATION' | 'EXCEPTION_REMEDIATION';
|
|
3
|
+
export type ShipmentDecisionStatus = 'PROPOSED' | 'ACCEPTED' | 'REJECTED' | 'STALE' | 'EXPIRED';
|
|
4
|
+
export type ShipmentDecisionAction = 'USE_CARRIER' | 'REASSIGN_VEHICLE' | 'REPROMISE_DELIVERY' | 'REQUEST_TRACKING_UPDATE' | 'SWITCH_CARRIER' | 'ACCEPT_SLIP';
|
|
5
|
+
export type ShipmentDecisionExecution = 'APPLY' | 'FOLLOW_UP' | 'RECORD';
|
|
6
|
+
export type ShipmentDecisionOutcome = 'APPLIED' | 'RECORDED' | 'FOLLOW_UP';
|
|
7
|
+
export interface ShipmentDecisionOption {
|
|
8
|
+
id: string;
|
|
9
|
+
rank: number;
|
|
10
|
+
action: ShipmentDecisionAction;
|
|
11
|
+
execution: ShipmentDecisionExecution;
|
|
12
|
+
confidence: number;
|
|
13
|
+
score: number | null;
|
|
14
|
+
reasons: string[];
|
|
15
|
+
rationale: string;
|
|
16
|
+
aiRationale: string | null;
|
|
17
|
+
carrierId: string | null;
|
|
18
|
+
newEstimatedDelivery: string | null;
|
|
19
|
+
followUpMutation: string | null;
|
|
20
|
+
followUpArgs: Record<string, string> | null;
|
|
21
|
+
deliveredCount: number | null;
|
|
22
|
+
onTimeCount: number | null;
|
|
23
|
+
laneDeliveredCount: number | null;
|
|
24
|
+
laneOnTimeCount: number | null;
|
|
25
|
+
medianLaneCost: number | null;
|
|
26
|
+
currency: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface ShipmentDecision {
|
|
29
|
+
id: string;
|
|
30
|
+
kind: ShipmentDecisionKind;
|
|
31
|
+
shipmentId: string;
|
|
32
|
+
shipmentNumber: string | null;
|
|
33
|
+
status: ShipmentDecisionStatus;
|
|
34
|
+
method: string;
|
|
35
|
+
options: ShipmentDecisionOption[];
|
|
36
|
+
chosenOptionId: string | null;
|
|
37
|
+
outcome: ShipmentDecisionOutcome | null;
|
|
38
|
+
decisionReason: string | null;
|
|
39
|
+
currentCarrierId: string | null;
|
|
40
|
+
promisedDelivery: string | null;
|
|
41
|
+
riskScore: number | null;
|
|
42
|
+
predictedSlipMinutes: number | null;
|
|
43
|
+
breached: boolean | null;
|
|
44
|
+
laneKnown: boolean | null;
|
|
45
|
+
historyCount: number | null;
|
|
46
|
+
aiStatus: DecisionRationaleStatus;
|
|
47
|
+
aiSummary: string | null;
|
|
48
|
+
aiModel: string | null;
|
|
49
|
+
expiresAt: string;
|
|
50
|
+
decidedAt: string | null;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
}
|
|
53
|
+
type PendingAction = 'propose' | 'accept' | 'reject';
|
|
54
|
+
/**
|
|
55
|
+
* @param shipmentId the shipment, or undefined while nothing is selected (no request is made)
|
|
56
|
+
*/
|
|
57
|
+
export declare function useShipmentDecision(shipmentId: string | undefined, kind: ShipmentDecisionKind): {
|
|
58
|
+
decision: ShipmentDecision | null;
|
|
59
|
+
isLoading: boolean;
|
|
60
|
+
error: Error | null;
|
|
61
|
+
pendingAction: PendingAction | null;
|
|
62
|
+
refetch: () => undefined;
|
|
63
|
+
propose: () => Promise<ShipmentDecision>;
|
|
64
|
+
accept: (decisionId: string, optionId: string) => Promise<ShipmentDecision>;
|
|
65
|
+
reject: (decisionId: string) => Promise<ShipmentDecision>;
|
|
66
|
+
};
|
|
67
|
+
export {};
|