@burdenoff/microfe-movethewheels 2026.1107.7 → 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.
@@ -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,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,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 {};