@burdenoff/microfe-theglobalfuel 2026.1107.2 → 2026.1107.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/theglobalfuel/components/AllocateProductionSheet.d.ts.map +1 -1
- package/dist/theglobalfuel/components/AllocateProductionSheet.js +213 -164
- package/dist/theglobalfuel/components/AllocateProductionSheet.js.map +1 -1
- package/dist/theglobalfuel/components/AssignEntitlementDialog.d.ts +11 -0
- package/dist/theglobalfuel/components/AssignEntitlementDialog.d.ts.map +1 -0
- package/dist/theglobalfuel/components/AssignEntitlementDialog.js +117 -0
- package/dist/theglobalfuel/components/AssignEntitlementDialog.js.map +1 -0
- package/dist/theglobalfuel/components/ConfirmActionDialog.d.ts +17 -0
- package/dist/theglobalfuel/components/ConfirmActionDialog.d.ts.map +1 -0
- package/dist/theglobalfuel/components/ConfirmActionDialog.js +29 -0
- package/dist/theglobalfuel/components/ConfirmActionDialog.js.map +1 -0
- package/dist/theglobalfuel/components/InterestDeckSheet.d.ts +21 -0
- package/dist/theglobalfuel/components/InterestDeckSheet.d.ts.map +1 -0
- package/dist/theglobalfuel/components/InterestDeckSheet.js +287 -0
- package/dist/theglobalfuel/components/InterestDeckSheet.js.map +1 -0
- package/dist/theglobalfuel/components/StatusBadge.d.ts.map +1 -1
- package/dist/theglobalfuel/components/StatusBadge.js +7 -1
- package/dist/theglobalfuel/components/StatusBadge.js.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +27 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +221 -117
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
- package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts +4 -1
- package/dist/theglobalfuel/pages/production/AllocationsPanel.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/production/AllocationsPanel.js +206 -165
- package/dist/theglobalfuel/pages/production/AllocationsPanel.js.map +1 -1
- package/dist/theglobalfuel/pages/production/EntitlementsPanel.d.ts +14 -0
- package/dist/theglobalfuel/pages/production/EntitlementsPanel.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/production/EntitlementsPanel.js +205 -0
- package/dist/theglobalfuel/pages/production/EntitlementsPanel.js.map +1 -0
- package/dist/theglobalfuel/pages/production/InterestDecksPanel.d.ts +12 -0
- package/dist/theglobalfuel/pages/production/InterestDecksPanel.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/production/InterestDecksPanel.js +243 -0
- package/dist/theglobalfuel/pages/production/InterestDecksPanel.js.map +1 -0
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +3 -0
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/production/ProductionPage.js +109 -95
- package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
- package/dist/theglobalfuel/types/index.d.ts +83 -0
- package/dist/theglobalfuel/types/index.d.ts.map +1 -1
- package/dist/theglobalfuel/utils/allocationForm.d.ts +30 -4
- package/dist/theglobalfuel/utils/allocationForm.d.ts.map +1 -1
- package/dist/theglobalfuel/utils/allocationForm.js +43 -25
- package/dist/theglobalfuel/utils/allocationForm.js.map +1 -1
- package/dist/theglobalfuel/utils/interestDeckForm.d.ts +64 -0
- package/dist/theglobalfuel/utils/interestDeckForm.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/interestDeckForm.js +140 -0
- package/dist/theglobalfuel/utils/interestDeckForm.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssignEntitlementDialog.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/AssignEntitlementDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAqBH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,UAAU,4BAA4B;IACpC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACjC,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAID,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,cAAc,EACd,YAAY,GACb,EAAE,4BAA4B,+BAsH9B"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { formatNumber as e, formatVolume as t } from "../utils/formatters.js";
|
|
2
|
+
import { useTheAllSellContracts as n, useTheCreateContractEntitlement as r } from "../hooks/useTheGlobalFuelApi.js";
|
|
3
|
+
import { useNotify as i } from "../hooks/useNotify.js";
|
|
4
|
+
import "../hooks/index.js";
|
|
5
|
+
import { useMemo as a, useState as o } from "react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { Button as l, Input as u, Label as d, ResponsiveDialog as f, ResponsiveDialogContent as p, ResponsiveDialogDescription as m, ResponsiveDialogFooter as h, ResponsiveDialogHeader as g, ResponsiveDialogTitle as _, Select as v, SelectContent as y, SelectItem as b, SelectTrigger as x, SelectValue as S } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
//#region src/theglobalfuel/components/AssignEntitlementDialog.tsx
|
|
9
|
+
var C = (e) => Math.round(e * 1e6) / 1e6;
|
|
10
|
+
function w({ entry: w, assignedVolume: T, onOpenChange: E }) {
|
|
11
|
+
let D = i(), O = !!w, k = n({ enabled: O }), A = r(), j = w ? Math.max(C(w.netRevenueVolume - T), 0) : 0, M = a(() => (k.data?.items ?? []).filter((e) => (e.status === "SIGNED" || e.status === "ACTIVE") && e.unit === w?.unit), [k.data, w?.unit]), [N, P] = o(""), [F, I] = o(""), [L, R] = o(null), z = w ? `open:${w.id}` : "closed", [B, V] = o(z);
|
|
12
|
+
z !== B && (V(z), P(""), I(""), R(null));
|
|
13
|
+
let H = async () => {
|
|
14
|
+
if (!w) return;
|
|
15
|
+
if (!N) {
|
|
16
|
+
R("Pick a contract.");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let e = F.trim() === "" ? null : Number(F);
|
|
20
|
+
if (e !== null && (!Number.isFinite(e) || e <= 0 || e > j + 1e-6)) {
|
|
21
|
+
R(`Enter a volume greater than 0 and at most ${t(j, w.unit)}.`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
R(null);
|
|
25
|
+
try {
|
|
26
|
+
await A.mutateAsync({
|
|
27
|
+
contractId: N,
|
|
28
|
+
allocationEntryId: w.id,
|
|
29
|
+
volume: e
|
|
30
|
+
}), D.success("Volume assigned to the contract"), E(!1);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
R(e instanceof Error ? e.message : "Failed to assign the volume."), D.fromError(e);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ s(f, {
|
|
36
|
+
open: O,
|
|
37
|
+
onOpenChange: E,
|
|
38
|
+
children: /* @__PURE__ */ c(p, {
|
|
39
|
+
"data-testid": "assign-entitlement-dialog",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ c(g, { children: [/* @__PURE__ */ s(_, { children: "Assign to contract" }), /* @__PURE__ */ s(m, { children: w ? `${w.asset?.name ?? "Asset"}: ${t(j, w.unit)} of ${t(w.netRevenueVolume, w.unit)} net revenue volume is not yet assigned.` : "" })] }),
|
|
42
|
+
/* @__PURE__ */ c("div", {
|
|
43
|
+
className: "grid gap-4 py-2",
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ c("div", {
|
|
46
|
+
className: "grid gap-1.5",
|
|
47
|
+
children: [/* @__PURE__ */ s(d, {
|
|
48
|
+
htmlFor: "entContract",
|
|
49
|
+
children: "Sell contract *"
|
|
50
|
+
}), /* @__PURE__ */ c(v, {
|
|
51
|
+
value: N,
|
|
52
|
+
onValueChange: P,
|
|
53
|
+
children: [/* @__PURE__ */ s(x, {
|
|
54
|
+
id: "entContract",
|
|
55
|
+
className: "h-11 md:h-10",
|
|
56
|
+
children: /* @__PURE__ */ s(S, { placeholder: M.length === 0 ? "No signed or active sell contract" : "Select a contract" })
|
|
57
|
+
}), /* @__PURE__ */ s(y, { children: M.map((e) => /* @__PURE__ */ c(b, {
|
|
58
|
+
value: e.id,
|
|
59
|
+
children: [
|
|
60
|
+
e.reference,
|
|
61
|
+
" — ",
|
|
62
|
+
e.counterparty
|
|
63
|
+
]
|
|
64
|
+
}, e.id)) })]
|
|
65
|
+
})]
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ c("div", {
|
|
68
|
+
className: "grid gap-1.5",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ s(d, {
|
|
71
|
+
htmlFor: "entVolume",
|
|
72
|
+
children: "Volume"
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ s(u, {
|
|
75
|
+
id: "entVolume",
|
|
76
|
+
type: "number",
|
|
77
|
+
inputMode: "decimal",
|
|
78
|
+
min: "0",
|
|
79
|
+
step: "any",
|
|
80
|
+
className: "h-11 tabular-nums md:h-10",
|
|
81
|
+
placeholder: e(j, { maximumFractionDigits: 6 }),
|
|
82
|
+
value: F,
|
|
83
|
+
onChange: (e) => I(e.target.value)
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ s("p", {
|
|
86
|
+
className: "text-xs text-text-tertiary",
|
|
87
|
+
children: "Leave blank to assign all of it."
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
}),
|
|
91
|
+
L && /* @__PURE__ */ s("p", {
|
|
92
|
+
role: "alert",
|
|
93
|
+
className: "text-sm text-status-error-text",
|
|
94
|
+
children: L
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ c(h, {
|
|
99
|
+
className: "max-md:flex-col-reverse max-md:gap-2",
|
|
100
|
+
children: [/* @__PURE__ */ s(l, {
|
|
101
|
+
variant: "outline",
|
|
102
|
+
onClick: () => E(!1),
|
|
103
|
+
children: "Cancel"
|
|
104
|
+
}), /* @__PURE__ */ s(l, {
|
|
105
|
+
onClick: () => void H(),
|
|
106
|
+
disabled: A.isPending || j <= 0,
|
|
107
|
+
children: A.isPending ? "Assigning…" : "Assign volume"
|
|
108
|
+
})]
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { w as AssignEntitlementDialog };
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=AssignEntitlementDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssignEntitlementDialog.js","names":[],"sources":["../../../src/theglobalfuel/components/AssignEntitlementDialog.tsx"],"sourcesContent":["/**\n * AssignEntitlementDialog — assign net volume from one entry of an APPROVED\n * allocation to a sell contract (BOFF-10787).\n * @module theglobalfuel/components\n *\n * Offers SIGNED/ACTIVE sell contracts in the entry's unit. The volume defaults\n * to the entry's remaining net revenue volume (net revenue minus what is\n * already assigned). Writes `theCreateContractEntitlement`; the svc re-checks\n * eligibility, unit, commodity and the remaining volume under a lock.\n */\n\nimport { useMemo, useState } from 'react';\nimport {\n Button,\n Input,\n Label,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotify, useTheAllSellContracts, useTheCreateContractEntitlement } from '../hooks';\nimport { formatNumber, formatVolume } from '../utils/formatters';\nimport type { TheAllocationEntry } from '../types';\n\ninterface AssignEntitlementDialogProps {\n entry: TheAllocationEntry | null;\n /** Net volume of the entry already assigned to contracts. */\n assignedVolume: number;\n onOpenChange: (open: boolean) => void;\n}\n\nconst round6 = (n: number): number => Math.round(n * 1e6) / 1e6;\n\nexport function AssignEntitlementDialog({\n entry,\n assignedVolume,\n onOpenChange,\n}: AssignEntitlementDialogProps) {\n const notify = useNotify();\n const open = Boolean(entry);\n const contractsQuery = useTheAllSellContracts({ enabled: open });\n const create = useTheCreateContractEntitlement();\n const remaining = entry ? Math.max(round6(entry.netRevenueVolume - assignedVolume), 0) : 0;\n\n const contracts = useMemo(\n () =>\n (contractsQuery.data?.items ?? []).filter(\n (c) => (c.status === 'SIGNED' || c.status === 'ACTIVE') && c.unit === entry?.unit\n ),\n [contractsQuery.data, entry?.unit]\n );\n\n const [contractId, setContractId] = useState('');\n const [volume, setVolume] = useState('');\n const [error, setError] = useState<string | null>(null);\n\n const seedKey = entry ? `open:${entry.id}` : 'closed';\n const [prevSeedKey, setPrevSeedKey] = useState(seedKey);\n if (seedKey !== prevSeedKey) {\n setPrevSeedKey(seedKey);\n setContractId('');\n setVolume('');\n setError(null);\n }\n\n const submit = async () => {\n if (!entry) return;\n if (!contractId) {\n setError('Pick a contract.');\n return;\n }\n const n = volume.trim() === '' ? null : Number(volume);\n if (n !== null && (!Number.isFinite(n) || n <= 0 || n > remaining + 1e-6)) {\n setError(`Enter a volume greater than 0 and at most ${formatVolume(remaining, entry.unit)}.`);\n return;\n }\n setError(null);\n try {\n await create.mutateAsync({ contractId, allocationEntryId: entry.id, volume: n });\n notify.success('Volume assigned to the contract');\n onOpenChange(false);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to assign the volume.');\n notify.fromError(err);\n }\n };\n\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent data-testid=\"assign-entitlement-dialog\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Assign to contract</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n {entry\n ? `${entry.asset?.name ?? 'Asset'}: ${formatVolume(remaining, entry.unit)} of ${formatVolume(\n entry.netRevenueVolume,\n entry.unit\n )} net revenue volume is not yet assigned.`\n : ''}\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <div className=\"grid gap-4 py-2\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"entContract\">Sell contract *</Label>\n <Select value={contractId} onValueChange={setContractId}>\n <SelectTrigger id=\"entContract\" className=\"h-11 md:h-10\">\n <SelectValue\n placeholder={\n contracts.length === 0\n ? 'No signed or active sell contract'\n : 'Select a contract'\n }\n />\n </SelectTrigger>\n <SelectContent>\n {contracts.map((c) => (\n <SelectItem key={c.id} value={c.id}>\n {c.reference} — {c.counterparty}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"entVolume\">Volume</Label>\n <Input\n id=\"entVolume\"\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n step=\"any\"\n className=\"h-11 tabular-nums md:h-10\"\n placeholder={formatNumber(remaining, { maximumFractionDigits: 6 })}\n value={volume}\n onChange={(e) => setVolume(e.target.value)}\n />\n <p className=\"text-xs text-text-tertiary\">Leave blank to assign all of it.</p>\n </div>\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n </div>\n <ResponsiveDialogFooter className=\"max-md:flex-col-reverse max-md:gap-2\">\n <Button variant=\"outline\" onClick={() => onOpenChange(false)}>\n Cancel\n </Button>\n <Button onClick={() => void submit()} disabled={create.isPending || remaining <= 0}>\n {create.isPending ? 'Assigning…' : 'Assign volume'}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;AAuCA,IAAM,KAAU,MAAsB,KAAK,MAAM,IAAI,IAAI,GAAG;AAE5D,SAAgB,EAAwB,EACtC,UACA,mBACA,mBAC+B;CAC/B,IAAM,IAAS,GAAW,EACpB,IAAO,EAAQ,GACf,IAAiB,EAAuB,EAAE,SAAS,GAAM,CAAC,EAC1D,IAAS,GAAiC,EAC1C,IAAY,IAAQ,KAAK,IAAI,EAAO,EAAM,mBAAmB,EAAe,EAAE,EAAE,G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;IACD;;EACT,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfirmActionDialog — a small confirmation step before a destructive
|
|
3
|
+
* action (deleting an interest deck, removing an entitlement).
|
|
4
|
+
* @module theglobalfuel/components
|
|
5
|
+
*/
|
|
6
|
+
interface ConfirmActionDialogProps {
|
|
7
|
+
open: boolean;
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
confirmLabel: string;
|
|
11
|
+
pending?: boolean;
|
|
12
|
+
onConfirm: () => void;
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function ConfirmActionDialog({ open, title, description, confirmLabel, pending, onConfirm, onCancel, }: ConfirmActionDialogProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=ConfirmActionDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmActionDialog.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/ConfirmActionDialog.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,UAAU,wBAAwB;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,WAAW,EACX,YAAY,EACZ,OAAe,EACf,SAAS,EACT,QAAQ,GACT,EAAE,wBAAwB,+BAmB1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { Button as n, ResponsiveDialog as r, ResponsiveDialogContent as i, ResponsiveDialogDescription as a, ResponsiveDialogFooter as o, ResponsiveDialogHeader as s, ResponsiveDialogTitle as c } from "@burdenoff/fe-libs/ui";
|
|
3
|
+
//#region src/theglobalfuel/components/ConfirmActionDialog.tsx
|
|
4
|
+
function l({ open: l, title: u, description: d, confirmLabel: f, pending: p = !1, onConfirm: m, onCancel: h }) {
|
|
5
|
+
return /* @__PURE__ */ e(r, {
|
|
6
|
+
open: l,
|
|
7
|
+
onOpenChange: (e) => !e && h(),
|
|
8
|
+
children: /* @__PURE__ */ t(i, {
|
|
9
|
+
"data-testid": "confirm-action-dialog",
|
|
10
|
+
children: [/* @__PURE__ */ t(s, { children: [/* @__PURE__ */ e(c, { children: u }), /* @__PURE__ */ e(a, { children: d })] }), /* @__PURE__ */ t(o, {
|
|
11
|
+
className: "max-md:flex-col-reverse max-md:gap-2",
|
|
12
|
+
children: [/* @__PURE__ */ e(n, {
|
|
13
|
+
variant: "outline",
|
|
14
|
+
onClick: h,
|
|
15
|
+
children: "Cancel"
|
|
16
|
+
}), /* @__PURE__ */ e(n, {
|
|
17
|
+
variant: "destructive",
|
|
18
|
+
onClick: m,
|
|
19
|
+
disabled: p,
|
|
20
|
+
children: p ? "Working…" : f
|
|
21
|
+
})]
|
|
22
|
+
})]
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { l as ConfirmActionDialog };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=ConfirmActionDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmActionDialog.js","names":[],"sources":["../../../src/theglobalfuel/components/ConfirmActionDialog.tsx"],"sourcesContent":["/**\n * ConfirmActionDialog — a small confirmation step before a destructive\n * action (deleting an interest deck, removing an entitlement).\n * @module theglobalfuel/components\n */\n\nimport {\n Button,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\n\ninterface ConfirmActionDialogProps {\n open: boolean;\n title: string;\n description: string;\n confirmLabel: string;\n pending?: boolean;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\nexport function ConfirmActionDialog({\n open,\n title,\n description,\n confirmLabel,\n pending = false,\n onConfirm,\n onCancel,\n}: ConfirmActionDialogProps) {\n return (\n <ResponsiveDialog open={open} onOpenChange={(o) => !o && onCancel()}>\n <ResponsiveDialogContent data-testid=\"confirm-action-dialog\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>{title}</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>{description}</ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n <ResponsiveDialogFooter className=\"max-md:flex-col-reverse max-md:gap-2\">\n <Button variant=\"outline\" onClick={onCancel}>\n Cancel\n </Button>\n <Button variant=\"destructive\" onClick={onConfirm} disabled={pending}>\n {pending ? 'Working…' : confirmLabel}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;AA0BA,SAAgB,EAAoB,EAClC,SACA,UACA,gBACA,iBACA,aAAU,IACV,cACA,eAC2B;AAC3B,QACE,kBAAC,GAAD;EAAwB;EAAM,eAAe,MAAM,CAAC,KAAK,GAAU;YACjE,kBAAC,GAAD;GAAyB,eAAY;aAArC,CACE,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UAAwB,GAA8B,CAAA,EACtD,kBAAC,GAAD,EAAA,UAA8B,GAA0C,CAAA,CACjD,EAAA,CAAA,EACzB,kBAAC,GAAD;IAAwB,WAAU;cAAlC,CACE,kBAAC,GAAD;KAAQ,SAAQ;KAAU,SAAS;eAAU;KAEpC,CAAA,EACT,kBAAC,GAAD;KAAQ,SAAQ;KAAc,SAAS;KAAW,UAAU;eACzD,IAAU,aAAa;KACjB,CAAA,CACc;MACD;;EACT,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InterestDeckSheet — record who owns an asset, and on what terms, from a
|
|
3
|
+
* given date (BOFF-10787).
|
|
4
|
+
* @module theglobalfuel/components
|
|
5
|
+
*
|
|
6
|
+
* An interest deck lists every working-interest owner of the asset (they must
|
|
7
|
+
* add up to 100%) with the lease burdens (royalty and overriding royalty) they
|
|
8
|
+
* bear. Exactly one party is this workspace's own interest; production
|
|
9
|
+
* allocation applies that party's terms for periods the deck covers. A deck
|
|
10
|
+
* that starts after the asset's open-ended deck closes the old one on the new
|
|
11
|
+
* effective date. Writes `theCreateInterestDeck`.
|
|
12
|
+
*/
|
|
13
|
+
interface InterestDeckSheetProps {
|
|
14
|
+
open: boolean;
|
|
15
|
+
onOpenChange: (open: boolean) => void;
|
|
16
|
+
/** Preselect an asset (e.g. the panel's asset filter). */
|
|
17
|
+
defaultAssetId?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function InterestDeckSheet({ open, onOpenChange, defaultAssetId }: InterestDeckSheetProps): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=InterestDeckSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InterestDeckSheet.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/InterestDeckSheet.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgCH,UAAU,sBAAsB;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAOD,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,sBAAsB,+BAiS/F"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { cn as e } from "../utils/cn.js";
|
|
2
|
+
import { formatNumber as t } from "../utils/formatters.js";
|
|
3
|
+
import { useTheAllAssets as n, useTheCreateInterestDeck as ee } from "../hooks/useTheGlobalFuelApi.js";
|
|
4
|
+
import { useNotify as r } from "../hooks/useNotify.js";
|
|
5
|
+
import "../hooks/index.js";
|
|
6
|
+
import { todayInputDate as i } from "../utils/productionForm.js";
|
|
7
|
+
import { buildInterestDeckInput as a, newDeckPartyRow as o, previewDeck as s } from "../utils/interestDeckForm.js";
|
|
8
|
+
import { useMemo as c, useState as l } from "react";
|
|
9
|
+
import { Plus as u, Trash2 as d } from "lucide-react";
|
|
10
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { Button as m, Input as h, Label as g, ResponsiveDialog as _, ResponsiveDialogContent as v, ResponsiveDialogDescription as y, ResponsiveDialogFooter as te, ResponsiveDialogHeader as b, ResponsiveDialogTitle as x, Select as S, SelectContent as C, SelectItem as w, SelectTrigger as T, SelectValue as ne, Textarea as re } from "@burdenoff/fe-libs/ui";
|
|
12
|
+
//#region src/theglobalfuel/components/InterestDeckSheet.tsx
|
|
13
|
+
var E = () => [o({ isWorkspaceInterest: !0 }), o()];
|
|
14
|
+
function D({ open: D, onOpenChange: O, defaultAssetId: k }) {
|
|
15
|
+
let A = r(), j = n({ enabled: D }), M = ee(), N = c(() => [...j.data?.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [j.data]), [P, F] = l(k ?? ""), [I, L] = l(i()), [R, z] = l(""), [B, V] = l(""), [H, U] = l(""), [W, G] = l(E), [K, q] = l(""), [J, Y] = l(null), X = D ? `open:${k ?? ""}` : "closed", [ie, ae] = l(X);
|
|
16
|
+
X !== ie && (ae(X), D && (F(k ?? ""), L(i()), z(""), V(""), U(""), G(E()), q(""), Y(null)));
|
|
17
|
+
let Z = s(B, H, W), Q = (e, t) => G((n) => n.map((n) => n.key === e ? {
|
|
18
|
+
...n,
|
|
19
|
+
...t
|
|
20
|
+
} : n)), oe = (e) => G((t) => t.map((t) => ({
|
|
21
|
+
...t,
|
|
22
|
+
isWorkspaceInterest: t.key === e
|
|
23
|
+
}))), se = (e) => G((t) => t.length > 1 ? t.filter((t) => t.key !== e) : t), $ = () => O(!1), ce = async () => {
|
|
24
|
+
let e = a({
|
|
25
|
+
assetId: P,
|
|
26
|
+
effectiveFrom: I,
|
|
27
|
+
effectiveTo: R,
|
|
28
|
+
royaltyPct: B,
|
|
29
|
+
overridingRoyaltyPct: H,
|
|
30
|
+
parties: W,
|
|
31
|
+
notes: K
|
|
32
|
+
});
|
|
33
|
+
if (!e.ok) {
|
|
34
|
+
Y(e.error), A.error(e.error);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
Y(null);
|
|
38
|
+
try {
|
|
39
|
+
await M.mutateAsync(e.input), A.success("Interest deck saved"), $();
|
|
40
|
+
} catch (e) {
|
|
41
|
+
Y(e instanceof Error ? e.message : "Failed to save the interest deck."), A.fromError(e);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ f(_, {
|
|
45
|
+
open: D,
|
|
46
|
+
onOpenChange: O,
|
|
47
|
+
children: /* @__PURE__ */ p(v, {
|
|
48
|
+
"data-testid": "interest-deck-sheet",
|
|
49
|
+
className: "md:max-w-2xl",
|
|
50
|
+
children: [/* @__PURE__ */ p(b, { children: [/* @__PURE__ */ f(x, { children: "New interest deck" }), /* @__PURE__ */ f(y, { children: "Who owns the asset from this date, and the royalties they bear. Allocations of production in periods this deck covers use your party’s terms." })] }), /* @__PURE__ */ p("form", {
|
|
51
|
+
onSubmit: (e) => {
|
|
52
|
+
e.preventDefault(), ce();
|
|
53
|
+
},
|
|
54
|
+
children: [/* @__PURE__ */ p("div", {
|
|
55
|
+
className: "grid gap-4 py-2",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ p("div", {
|
|
58
|
+
className: "grid gap-1.5",
|
|
59
|
+
children: [/* @__PURE__ */ f(g, {
|
|
60
|
+
htmlFor: "deckAsset",
|
|
61
|
+
children: "Asset *"
|
|
62
|
+
}), /* @__PURE__ */ p(S, {
|
|
63
|
+
value: P,
|
|
64
|
+
onValueChange: F,
|
|
65
|
+
children: [/* @__PURE__ */ f(T, {
|
|
66
|
+
id: "deckAsset",
|
|
67
|
+
className: "h-11 md:h-10",
|
|
68
|
+
children: /* @__PURE__ */ f(ne, { placeholder: "Select an asset" })
|
|
69
|
+
}), /* @__PURE__ */ f(C, { children: N.map((e) => /* @__PURE__ */ f(w, {
|
|
70
|
+
value: e.id,
|
|
71
|
+
children: e.name
|
|
72
|
+
}, e.id)) })]
|
|
73
|
+
})]
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ p("div", {
|
|
76
|
+
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ p("div", {
|
|
79
|
+
className: "grid gap-1.5",
|
|
80
|
+
children: [/* @__PURE__ */ f(g, {
|
|
81
|
+
htmlFor: "deckFrom",
|
|
82
|
+
children: "Effective from *"
|
|
83
|
+
}), /* @__PURE__ */ f(h, {
|
|
84
|
+
id: "deckFrom",
|
|
85
|
+
type: "date",
|
|
86
|
+
className: "h-11 md:h-10",
|
|
87
|
+
value: I,
|
|
88
|
+
onChange: (e) => L(e.target.value)
|
|
89
|
+
})]
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ p("div", {
|
|
92
|
+
className: "grid gap-1.5",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ f(g, {
|
|
95
|
+
htmlFor: "deckTo",
|
|
96
|
+
children: "Effective until"
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ f(h, {
|
|
99
|
+
id: "deckTo",
|
|
100
|
+
type: "date",
|
|
101
|
+
className: "h-11 md:h-10",
|
|
102
|
+
value: R,
|
|
103
|
+
onChange: (e) => z(e.target.value)
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ f("p", {
|
|
106
|
+
className: "text-xs text-text-tertiary",
|
|
107
|
+
children: "Leave blank until the ownership changes again."
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ p("div", {
|
|
112
|
+
className: "grid gap-1.5",
|
|
113
|
+
children: [/* @__PURE__ */ f(g, {
|
|
114
|
+
htmlFor: "deckRoyalty",
|
|
115
|
+
children: "Royalty %"
|
|
116
|
+
}), /* @__PURE__ */ f(h, {
|
|
117
|
+
id: "deckRoyalty",
|
|
118
|
+
type: "number",
|
|
119
|
+
inputMode: "decimal",
|
|
120
|
+
min: "0",
|
|
121
|
+
max: "100",
|
|
122
|
+
step: "any",
|
|
123
|
+
className: "h-11 tabular-nums md:h-10",
|
|
124
|
+
placeholder: "0",
|
|
125
|
+
value: B,
|
|
126
|
+
onChange: (e) => V(e.target.value)
|
|
127
|
+
})]
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ p("div", {
|
|
130
|
+
className: "grid gap-1.5",
|
|
131
|
+
children: [/* @__PURE__ */ f(g, {
|
|
132
|
+
htmlFor: "deckOrri",
|
|
133
|
+
children: "Overriding royalty %"
|
|
134
|
+
}), /* @__PURE__ */ f(h, {
|
|
135
|
+
id: "deckOrri",
|
|
136
|
+
type: "number",
|
|
137
|
+
inputMode: "decimal",
|
|
138
|
+
min: "0",
|
|
139
|
+
max: "100",
|
|
140
|
+
step: "any",
|
|
141
|
+
className: "h-11 tabular-nums md:h-10",
|
|
142
|
+
placeholder: "0",
|
|
143
|
+
value: H,
|
|
144
|
+
onChange: (e) => U(e.target.value)
|
|
145
|
+
})]
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ p("fieldset", {
|
|
150
|
+
className: "grid gap-2",
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ f("legend", {
|
|
153
|
+
className: "mb-1 text-sm font-medium text-text-primary",
|
|
154
|
+
children: "Working-interest owners *"
|
|
155
|
+
}),
|
|
156
|
+
W.map((e, n) => /* @__PURE__ */ p("div", {
|
|
157
|
+
className: "grid grid-cols-1 gap-2 rounded-lg border border-border-seam p-3 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_auto_auto]",
|
|
158
|
+
"data-testid": "deck-party-row",
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ p("div", {
|
|
161
|
+
className: "grid gap-1",
|
|
162
|
+
children: [/* @__PURE__ */ f(g, {
|
|
163
|
+
htmlFor: `${e.key}-name`,
|
|
164
|
+
className: "text-xs",
|
|
165
|
+
children: "Party"
|
|
166
|
+
}), /* @__PURE__ */ f(h, {
|
|
167
|
+
id: `${e.key}-name`,
|
|
168
|
+
className: "h-10",
|
|
169
|
+
maxLength: 255,
|
|
170
|
+
placeholder: e.isWorkspaceInterest ? "Your company" : "Partner name",
|
|
171
|
+
value: e.partyName,
|
|
172
|
+
onChange: (t) => Q(e.key, { partyName: t.target.value })
|
|
173
|
+
})]
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ p("div", {
|
|
176
|
+
className: "grid gap-1",
|
|
177
|
+
children: [/* @__PURE__ */ f(g, {
|
|
178
|
+
htmlFor: `${e.key}-wi`,
|
|
179
|
+
className: "text-xs",
|
|
180
|
+
children: "Working interest %"
|
|
181
|
+
}), /* @__PURE__ */ f(h, {
|
|
182
|
+
id: `${e.key}-wi`,
|
|
183
|
+
type: "number",
|
|
184
|
+
inputMode: "decimal",
|
|
185
|
+
min: "0",
|
|
186
|
+
max: "100",
|
|
187
|
+
step: "any",
|
|
188
|
+
className: "h-10 tabular-nums",
|
|
189
|
+
value: e.workingInterestPct,
|
|
190
|
+
onChange: (t) => Q(e.key, { workingInterestPct: t.target.value })
|
|
191
|
+
})]
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ p("label", {
|
|
194
|
+
className: "flex items-end gap-2 pb-2 text-sm text-text-secondary",
|
|
195
|
+
children: [/* @__PURE__ */ f("input", {
|
|
196
|
+
type: "radio",
|
|
197
|
+
name: "deckWorkspaceParty",
|
|
198
|
+
checked: e.isWorkspaceInterest,
|
|
199
|
+
onChange: () => oe(e.key),
|
|
200
|
+
"aria-label": `Party ${n + 1} is this workspace's own interest`
|
|
201
|
+
}), "Our interest"]
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ f("div", {
|
|
204
|
+
className: "flex items-end",
|
|
205
|
+
children: /* @__PURE__ */ f(m, {
|
|
206
|
+
type: "button",
|
|
207
|
+
variant: "ghost",
|
|
208
|
+
size: "icon",
|
|
209
|
+
"aria-label": `Remove party ${n + 1}`,
|
|
210
|
+
disabled: W.length === 1,
|
|
211
|
+
onClick: () => se(e.key),
|
|
212
|
+
children: /* @__PURE__ */ f(d, { className: "h-4 w-4" })
|
|
213
|
+
})
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ p("p", {
|
|
216
|
+
className: "text-xs tabular-nums text-text-tertiary md:col-span-4",
|
|
217
|
+
children: [
|
|
218
|
+
"Net revenue interest",
|
|
219
|
+
" ",
|
|
220
|
+
t(Z.netRevenueInterests[n] ?? 0, { maximumFractionDigits: 6 }),
|
|
221
|
+
"%"
|
|
222
|
+
]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
}, e.key)),
|
|
226
|
+
/* @__PURE__ */ f("div", { children: /* @__PURE__ */ p(m, {
|
|
227
|
+
type: "button",
|
|
228
|
+
variant: "outline",
|
|
229
|
+
size: "sm",
|
|
230
|
+
onClick: () => G((e) => [...e, o()]),
|
|
231
|
+
children: [/* @__PURE__ */ f(u, { className: "mr-1.5 h-4 w-4" }), " Add party"]
|
|
232
|
+
}) }),
|
|
233
|
+
/* @__PURE__ */ p("div", {
|
|
234
|
+
className: e("rounded-lg px-3 py-2 text-sm tabular-nums", Z.balanced ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-warning-bg-subtle text-status-warning-text"),
|
|
235
|
+
"data-testid": "deck-balance",
|
|
236
|
+
children: [
|
|
237
|
+
"Working interests total",
|
|
238
|
+
" ",
|
|
239
|
+
t(Z.totalWorkingInterest, { maximumFractionDigits: 6 }),
|
|
240
|
+
"%",
|
|
241
|
+
Z.balanced ? "" : " — they must add up to 100%"
|
|
242
|
+
]
|
|
243
|
+
})
|
|
244
|
+
]
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ p("div", {
|
|
247
|
+
className: "grid gap-1.5",
|
|
248
|
+
children: [/* @__PURE__ */ f(g, {
|
|
249
|
+
htmlFor: "deckNotes",
|
|
250
|
+
children: "Notes"
|
|
251
|
+
}), /* @__PURE__ */ f(re, {
|
|
252
|
+
id: "deckNotes",
|
|
253
|
+
rows: 2,
|
|
254
|
+
value: K,
|
|
255
|
+
onChange: (e) => q(e.target.value),
|
|
256
|
+
placeholder: "Source of the deck (JOA, farm-in, division order)."
|
|
257
|
+
})]
|
|
258
|
+
}),
|
|
259
|
+
J && /* @__PURE__ */ f("p", {
|
|
260
|
+
role: "alert",
|
|
261
|
+
className: "text-sm text-status-error-text",
|
|
262
|
+
children: J
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
}), /* @__PURE__ */ p(te, {
|
|
266
|
+
className: "max-md:flex-col-reverse max-md:gap-2",
|
|
267
|
+
children: [/* @__PURE__ */ f(m, {
|
|
268
|
+
type: "button",
|
|
269
|
+
variant: "outline",
|
|
270
|
+
className: "max-md:h-11",
|
|
271
|
+
onClick: $,
|
|
272
|
+
children: "Cancel"
|
|
273
|
+
}), /* @__PURE__ */ f(m, {
|
|
274
|
+
type: "submit",
|
|
275
|
+
className: "max-md:h-11",
|
|
276
|
+
disabled: M.isPending,
|
|
277
|
+
children: M.isPending ? "Saving…" : "Save interest deck"
|
|
278
|
+
})]
|
|
279
|
+
})]
|
|
280
|
+
})]
|
|
281
|
+
})
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
export { D as InterestDeckSheet };
|
|
286
|
+
|
|
287
|
+
//# sourceMappingURL=InterestDeckSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InterestDeckSheet.js","names":[],"sources":["../../../src/theglobalfuel/components/InterestDeckSheet.tsx"],"sourcesContent":["/**\n * InterestDeckSheet — record who owns an asset, and on what terms, from a\n * given date (BOFF-10787).\n * @module theglobalfuel/components\n *\n * An interest deck lists every working-interest owner of the asset (they must\n * add up to 100%) with the lease burdens (royalty and overriding royalty) they\n * bear. Exactly one party is this workspace's own interest; production\n * allocation applies that party's terms for periods the deck covers. A deck\n * that starts after the asset's open-ended deck closes the old one on the new\n * effective date. Writes `theCreateInterestDeck`.\n */\n\nimport { useMemo, useState } from 'react';\nimport { Plus, Trash2 } from 'lucide-react';\nimport {\n Button,\n Input,\n Label,\n Textarea,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { useNotify, useTheAllAssets, useTheCreateInterestDeck } from '../hooks';\nimport { cn } from '../utils/cn';\nimport { formatNumber } from '../utils/formatters';\nimport {\n buildInterestDeckInput,\n newDeckPartyRow,\n previewDeck,\n type DeckPartyRowState,\n} from '../utils/interestDeckForm';\nimport { todayInputDate } from '../utils/productionForm';\n\ninterface InterestDeckSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Preselect an asset (e.g. the panel's asset filter). */\n defaultAssetId?: string;\n}\n\nconst initialParties = (): DeckPartyRowState[] => [\n newDeckPartyRow({ isWorkspaceInterest: true }),\n newDeckPartyRow(),\n];\n\nexport function InterestDeckSheet({ open, onOpenChange, defaultAssetId }: InterestDeckSheetProps) {\n const notify = useNotify();\n const assetsQuery = useTheAllAssets({ enabled: open });\n const createDeck = useTheCreateInterestDeck();\n const assets = useMemo(\n () => [...(assetsQuery.data?.items ?? [])].sort((a, b) => a.name.localeCompare(b.name)),\n [assetsQuery.data]\n );\n\n const [assetId, setAssetId] = useState(defaultAssetId ?? '');\n const [effectiveFrom, setEffectiveFrom] = useState(todayInputDate());\n const [effectiveTo, setEffectiveTo] = useState('');\n const [royaltyPct, setRoyaltyPct] = useState('');\n const [overridingRoyaltyPct, setOverridingRoyaltyPct] = useState('');\n const [parties, setParties] = useState<DeckPartyRowState[]>(initialParties);\n const [notes, setNotes] = useState('');\n const [formError, setFormError] = useState<string | null>(null);\n\n // Fresh form on every open (\"adjust state on prop change\" while rendering).\n const seedKey = open ? `open:${defaultAssetId ?? ''}` : 'closed';\n const [prevSeedKey, setPrevSeedKey] = useState(seedKey);\n if (seedKey !== prevSeedKey) {\n setPrevSeedKey(seedKey);\n if (open) {\n setAssetId(defaultAssetId ?? '');\n setEffectiveFrom(todayInputDate());\n setEffectiveTo('');\n setRoyaltyPct('');\n setOverridingRoyaltyPct('');\n setParties(initialParties());\n setNotes('');\n setFormError(null);\n }\n }\n\n const preview = previewDeck(royaltyPct, overridingRoyaltyPct, parties);\n\n const updateParty = (key: string, patch: Partial<DeckPartyRowState>) =>\n setParties((current) => current.map((p) => (p.key === key ? { ...p, ...patch } : p)));\n const markWorkspace = (key: string) =>\n setParties((current) => current.map((p) => ({ ...p, isWorkspaceInterest: p.key === key })));\n const removeParty = (key: string) =>\n setParties((current) => (current.length > 1 ? current.filter((p) => p.key !== key) : current));\n\n const close = () => onOpenChange(false);\n\n const handleSubmit = async () => {\n const result = buildInterestDeckInput({\n assetId,\n effectiveFrom,\n effectiveTo,\n royaltyPct,\n overridingRoyaltyPct,\n parties,\n notes,\n });\n if (!result.ok) {\n setFormError(result.error);\n notify.error(result.error);\n return;\n }\n setFormError(null);\n try {\n await createDeck.mutateAsync(result.input);\n notify.success('Interest deck saved');\n close();\n } catch (err) {\n setFormError(err instanceof Error ? err.message : 'Failed to save the interest deck.');\n notify.fromError(err);\n }\n };\n\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent data-testid=\"interest-deck-sheet\" className=\"md:max-w-2xl\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>New interest deck</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Who owns the asset from this date, and the royalties they bear. Allocations of\n production in periods this deck covers use your party’s terms.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n <form\n onSubmit={(e) => {\n e.preventDefault();\n void handleSubmit();\n }}\n >\n <div className=\"grid gap-4 py-2\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"deckAsset\">Asset *</Label>\n <Select value={assetId} onValueChange={setAssetId}>\n <SelectTrigger id=\"deckAsset\" className=\"h-11 md:h-10\">\n <SelectValue placeholder=\"Select an asset\" />\n </SelectTrigger>\n <SelectContent>\n {assets.map((a) => (\n <SelectItem key={a.id} value={a.id}>\n {a.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"deckFrom\">Effective from *</Label>\n <Input\n id=\"deckFrom\"\n type=\"date\"\n className=\"h-11 md:h-10\"\n value={effectiveFrom}\n onChange={(e) => setEffectiveFrom(e.target.value)}\n />\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"deckTo\">Effective until</Label>\n <Input\n id=\"deckTo\"\n type=\"date\"\n className=\"h-11 md:h-10\"\n value={effectiveTo}\n onChange={(e) => setEffectiveTo(e.target.value)}\n />\n <p className=\"text-xs text-text-tertiary\">\n Leave blank until the ownership changes again.\n </p>\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"deckRoyalty\">Royalty %</Label>\n <Input\n id=\"deckRoyalty\"\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-11 tabular-nums md:h-10\"\n placeholder=\"0\"\n value={royaltyPct}\n onChange={(e) => setRoyaltyPct(e.target.value)}\n />\n </div>\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"deckOrri\">Overriding royalty %</Label>\n <Input\n id=\"deckOrri\"\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-11 tabular-nums md:h-10\"\n placeholder=\"0\"\n value={overridingRoyaltyPct}\n onChange={(e) => setOverridingRoyaltyPct(e.target.value)}\n />\n </div>\n </div>\n\n <fieldset className=\"grid gap-2\">\n <legend className=\"mb-1 text-sm font-medium text-text-primary\">\n Working-interest owners *\n </legend>\n {parties.map((party, i) => (\n <div\n key={party.key}\n className=\"grid grid-cols-1 gap-2 rounded-lg border border-border-seam p-3 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_auto_auto]\"\n data-testid=\"deck-party-row\"\n >\n <div className=\"grid gap-1\">\n <Label htmlFor={`${party.key}-name`} className=\"text-xs\">\n Party\n </Label>\n <Input\n id={`${party.key}-name`}\n className=\"h-10\"\n maxLength={255}\n placeholder={party.isWorkspaceInterest ? 'Your company' : 'Partner name'}\n value={party.partyName}\n onChange={(e) => updateParty(party.key, { partyName: e.target.value })}\n />\n </div>\n <div className=\"grid gap-1\">\n <Label htmlFor={`${party.key}-wi`} className=\"text-xs\">\n Working interest %\n </Label>\n <Input\n id={`${party.key}-wi`}\n type=\"number\"\n inputMode=\"decimal\"\n min=\"0\"\n max=\"100\"\n step=\"any\"\n className=\"h-10 tabular-nums\"\n value={party.workingInterestPct}\n onChange={(e) =>\n updateParty(party.key, { workingInterestPct: e.target.value })\n }\n />\n </div>\n <label className=\"flex items-end gap-2 pb-2 text-sm text-text-secondary\">\n <input\n type=\"radio\"\n name=\"deckWorkspaceParty\"\n checked={party.isWorkspaceInterest}\n onChange={() => markWorkspace(party.key)}\n aria-label={`Party ${i + 1} is this workspace's own interest`}\n />\n Our interest\n </label>\n <div className=\"flex items-end\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={`Remove party ${i + 1}`}\n disabled={parties.length === 1}\n onClick={() => removeParty(party.key)}\n >\n <Trash2 className=\"h-4 w-4\" />\n </Button>\n </div>\n <p className=\"text-xs tabular-nums text-text-tertiary md:col-span-4\">\n Net revenue interest{' '}\n {formatNumber(preview.netRevenueInterests[i] ?? 0, {\n maximumFractionDigits: 6,\n })}\n %\n </p>\n </div>\n ))}\n <div>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setParties((current) => [...current, newDeckPartyRow()])}\n >\n <Plus className=\"mr-1.5 h-4 w-4\" /> Add party\n </Button>\n </div>\n <div\n className={cn(\n 'rounded-lg px-3 py-2 text-sm tabular-nums',\n preview.balanced\n ? 'bg-status-success-bg-subtle text-status-success-text'\n : 'bg-status-warning-bg-subtle text-status-warning-text'\n )}\n data-testid=\"deck-balance\"\n >\n Working interests total{' '}\n {formatNumber(preview.totalWorkingInterest, { maximumFractionDigits: 6 })}%\n {preview.balanced ? '' : ' — they must add up to 100%'}\n </div>\n </fieldset>\n\n <div className=\"grid gap-1.5\">\n <Label htmlFor=\"deckNotes\">Notes</Label>\n <Textarea\n id=\"deckNotes\"\n rows={2}\n value={notes}\n onChange={(e) => setNotes(e.target.value)}\n placeholder=\"Source of the deck (JOA, farm-in, division order).\"\n />\n </div>\n\n {formError && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {formError}\n </p>\n )}\n </div>\n\n <ResponsiveDialogFooter className=\"max-md:flex-col-reverse max-md:gap-2\">\n <Button type=\"button\" variant=\"outline\" className=\"max-md:h-11\" onClick={close}>\n Cancel\n </Button>\n <Button type=\"submit\" className=\"max-md:h-11\" disabled={createDeck.isPending}>\n {createDeck.isPending ? 'Saving…' : 'Save interest deck'}\n </Button>\n </ResponsiveDialogFooter>\n </form>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkDA,IAAM,UAA4C,CAChD,EAAgB,EAAE,qBAAqB,IAAM,CAAC,EAC9C,GAAiB,CAClB;AAED,SAAgB,EAAkB,EAAE,SAAM,iBAAc,qBAA0C;CAChG,IAA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GAAY,MAAY,CAAC,GAAG,GAAS,GAAiB,CAAC,CAAC;mBAJzE,CAME,kBAAC,GAAD,EAAM,WAAU,kBAAmB,CAAA,EAAA,aAC5B;YACL,CAAA;QACN,kBAAC,OAAD;SACE,WAAW,EACT,6CACA,EAAQ,WACJ,yDACA,uDACL;SACD,eAAY;mBAPd;UAQC;UACyB;UACvB,EAAa,EAAQ,sBAAsB,EAAE,uBAAuB,GAAG,CAAC;UAAC;UACzE,EAAQ,WAAW,KAAK;UACrB;;QACG;;MAEX,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,GAAD;QAAO,SAAQ;kBAAY;QAAa,CAAA,EACxC,kBAAC,IAAD;QACE,IAAG;QACH,MAAM;QACN,OAAO;QACP,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;QACzC,aAAY;QACZ,CAAA,CACE;;MAEL,KACC,kBAAC,KAAD;OAAG,MAAK;OAAQ,WAAU;iBACvB;OACC,CAAA;MAEF;QAEN,kBAAC,IAAD;KAAwB,WAAU;eAAlC,CACE,kBAAC,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,WAAU;MAAc,SAAS;gBAAO;MAEvE,CAAA,EACT,kBAAC,GAAD;MAAQ,MAAK;MAAS,WAAU;MAAc,UAAU,EAAW;gBAChE,EAAW,YAAY,YAAY;MAC7B,CAAA,CACc;OACpB;MACiB;;EACT,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/StatusBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/StatusBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAgJD,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAsB5C,CAAC"}
|
|
@@ -90,7 +90,13 @@ var i = {
|
|
|
90
90
|
CONDITION_BASED: "warning",
|
|
91
91
|
REACTIVE: "secondary",
|
|
92
92
|
URGENT: "destructive",
|
|
93
|
-
OVERDUE: "destructive"
|
|
93
|
+
OVERDUE: "destructive",
|
|
94
|
+
OVER_LIFTED: "warning",
|
|
95
|
+
UNDER_LIFTED: "info",
|
|
96
|
+
BALANCED: "success",
|
|
97
|
+
INTEREST_DECK: "info",
|
|
98
|
+
OVERRIDE: "warning",
|
|
99
|
+
ASSET_DEFAULT: "secondary"
|
|
94
100
|
}, s = ({ status: s, className: c }) => {
|
|
95
101
|
let l = s.toUpperCase(), u = o[l] ?? "secondary", d = a.has(l);
|
|
96
102
|
return /* @__PURE__ */ r("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/theglobalfuel/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module theglobalfuel/components\n *\n * A colored badge for TheGlobalFuel domain statuses (asset lifecycle, contract\n * lifecycle & side, shipment status, inventory status, compliance status,\n * emission scope, reserve category, pricing basis) with semantic color mapping.\n * Accepts the raw server enum value.\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\nimport { formatEnumLabel } from '../utils/formatters';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['PRODUCING', 'ACTIVE', 'IN_TRANSIT', 'LOADING']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Asset lifecycle\n EXPLORATION: 'secondary',\n APPRAISAL: 'info',\n DEVELOPMENT: 'warning',\n PRODUCING: 'success',\n SUSPENDED: 'warning',\n DECOMMISSIONING: 'warning',\n RETIRED: 'outline',\n\n // Offtake-contract lifecycle\n DRAFT: 'secondary',\n NEGOTIATION: 'info',\n SIGNED: 'info',\n ACTIVE: 'success',\n COMPLETED: 'success',\n TERMINATED: 'destructive',\n\n // Contract side\n BUY: 'info',\n SELL: 'secondary',\n\n // Pricing basis\n FIXED: 'outline',\n INDEX_LINKED: 'outline',\n FORMULA: 'outline',\n SPOT: 'secondary',\n\n // Shipment status\n SCHEDULED: 'secondary',\n LOADING: 'info',\n IN_TRANSIT: 'warning',\n DELIVERED: 'success',\n CANCELLED: 'destructive',\n\n // Inventory status\n AVAILABLE: 'success',\n RESERVED: 'info',\n CONSUMED: 'outline',\n WRITTEN_OFF: 'destructive',\n\n // Compliance status\n PENDING: 'secondary',\n SUBMITTED: 'info',\n APPROVED: 'success',\n REVERSED: 'outline',\n REJECTED: 'destructive',\n EXPIRED: 'warning',\n REVOKED: 'destructive',\n\n // Emission scope\n SCOPE_1: 'destructive',\n SCOPE_2: 'warning',\n SCOPE_3: 'info',\n\n // Reserve category\n PROVED: 'success',\n PROBABLE: 'info',\n POSSIBLE: 'warning',\n CONTINGENT: 'secondary',\n PROSPECTIVE: 'outline',\n\n // Safety incident category\n NEAR_MISS: 'info',\n INJURY: 'destructive',\n SPILL: 'warning',\n RELEASE: 'warning',\n EQUIPMENT_FAILURE: 'secondary',\n\n // Safety incident severity\n LOW: 'secondary',\n MEDIUM: 'warning',\n HIGH: 'destructive',\n CRITICAL: 'destructive',\n\n // Safety incident investigation lifecycle\n REPORTED: 'secondary',\n INVESTIGATING: 'info',\n ROOT_CAUSE_IDENTIFIED: 'warning',\n CORRECTIVE_ACTION: 'warning',\n CLOSED: 'success',\n\n // Corrective/preventive action lifecycle\n OPEN: 'warning',\n IN_PROGRESS: 'info',\n VERIFIED: 'success',\n\n // ESG disclosure status (DRAFT is shared with the contract lifecycle above)\n FINAL: 'success',\n\n // Allocation period close (CLOSED is shared with the incident lifecycle above)\n REOPENED: 'warning',\n\n // Bulk allocation outcomes (APPROVED is shared above)\n VALIDATED: 'info',\n ALLOCATED: 'success',\n SKIPPED: 'outline',\n FAILED: 'destructive',\n\n // Allocation exceptions\n UNALLOCATED: 'warning',\n DRAFT_PENDING: 'secondary',\n\n // Equipment condition (RETIRED is shared with the asset lifecycle above)\n OPERATIONAL: 'success',\n DEGRADED: 'warning',\n DOWN: 'destructive',\n\n // Work-order type, priority and overdue flag (OPEN / SCHEDULED / IN_PROGRESS /\n // COMPLETED / CLOSED / CANCELLED and LOW / MEDIUM / HIGH are shared above)\n PLANNED: 'info',\n CONDITION_BASED: 'warning',\n REACTIVE: 'secondary',\n URGENT: 'destructive',\n OVERDUE: 'destructive',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;A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YALH,CAOG,KACC,kBAAC,QAAD;GACE,eAAY;GACZ,WAAU;GACV,CAAA,EAEH,EAAgB,EAAO,CACnB"}
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/theglobalfuel/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module theglobalfuel/components\n *\n * A colored badge for TheGlobalFuel domain statuses (asset lifecycle, contract\n * lifecycle & side, shipment status, inventory status, compliance status,\n * emission scope, reserve category, pricing basis) with semantic color mapping.\n * Accepts the raw server enum value.\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\nimport { formatEnumLabel } from '../utils/formatters';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-[var(--color-accent-soft)] text-text-primary',\n outline: 'border border-border-seam text-text-primary',\n};\n\n// Statuses that represent a \"live\" / in-progress condition get a subtle,\n// opacity-only glow pulse (reduced-motion safe via motion-safe:).\nconst liveStatuses = new Set(['PRODUCING', 'ACTIVE', 'IN_TRANSIT', 'LOADING']);\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Asset lifecycle\n EXPLORATION: 'secondary',\n APPRAISAL: 'info',\n DEVELOPMENT: 'warning',\n PRODUCING: 'success',\n SUSPENDED: 'warning',\n DECOMMISSIONING: 'warning',\n RETIRED: 'outline',\n\n // Offtake-contract lifecycle\n DRAFT: 'secondary',\n NEGOTIATION: 'info',\n SIGNED: 'info',\n ACTIVE: 'success',\n COMPLETED: 'success',\n TERMINATED: 'destructive',\n\n // Contract side\n BUY: 'info',\n SELL: 'secondary',\n\n // Pricing basis\n FIXED: 'outline',\n INDEX_LINKED: 'outline',\n FORMULA: 'outline',\n SPOT: 'secondary',\n\n // Shipment status\n SCHEDULED: 'secondary',\n LOADING: 'info',\n IN_TRANSIT: 'warning',\n DELIVERED: 'success',\n CANCELLED: 'destructive',\n\n // Inventory status\n AVAILABLE: 'success',\n RESERVED: 'info',\n CONSUMED: 'outline',\n WRITTEN_OFF: 'destructive',\n\n // Compliance status\n PENDING: 'secondary',\n SUBMITTED: 'info',\n APPROVED: 'success',\n REVERSED: 'outline',\n REJECTED: 'destructive',\n EXPIRED: 'warning',\n REVOKED: 'destructive',\n\n // Emission scope\n SCOPE_1: 'destructive',\n SCOPE_2: 'warning',\n SCOPE_3: 'info',\n\n // Reserve category\n PROVED: 'success',\n PROBABLE: 'info',\n POSSIBLE: 'warning',\n CONTINGENT: 'secondary',\n PROSPECTIVE: 'outline',\n\n // Safety incident category\n NEAR_MISS: 'info',\n INJURY: 'destructive',\n SPILL: 'warning',\n RELEASE: 'warning',\n EQUIPMENT_FAILURE: 'secondary',\n\n // Safety incident severity\n LOW: 'secondary',\n MEDIUM: 'warning',\n HIGH: 'destructive',\n CRITICAL: 'destructive',\n\n // Safety incident investigation lifecycle\n REPORTED: 'secondary',\n INVESTIGATING: 'info',\n ROOT_CAUSE_IDENTIFIED: 'warning',\n CORRECTIVE_ACTION: 'warning',\n CLOSED: 'success',\n\n // Corrective/preventive action lifecycle\n OPEN: 'warning',\n IN_PROGRESS: 'info',\n VERIFIED: 'success',\n\n // ESG disclosure status (DRAFT is shared with the contract lifecycle above)\n FINAL: 'success',\n\n // Allocation period close (CLOSED is shared with the incident lifecycle above)\n REOPENED: 'warning',\n\n // Bulk allocation outcomes (APPROVED is shared above)\n VALIDATED: 'info',\n ALLOCATED: 'success',\n SKIPPED: 'outline',\n FAILED: 'destructive',\n\n // Allocation exceptions\n UNALLOCATED: 'warning',\n DRAFT_PENDING: 'secondary',\n\n // Equipment condition (RETIRED is shared with the asset lifecycle above)\n OPERATIONAL: 'success',\n DEGRADED: 'warning',\n DOWN: 'destructive',\n\n // Work-order type, priority and overdue flag (OPEN / SCHEDULED / IN_PROGRESS /\n // COMPLETED / CLOSED / CANCELLED and LOW / MEDIUM / HIGH are shared above)\n PLANNED: 'info',\n CONDITION_BASED: 'warning',\n REACTIVE: 'secondary',\n URGENT: 'destructive',\n OVERDUE: 'destructive',\n\n // Contract lifting position (BOFF-10787)\n OVER_LIFTED: 'warning',\n UNDER_LIFTED: 'info',\n BALANCED: 'success',\n\n // Allocation entry interest source (BOFF-10787)\n INTEREST_DECK: 'info',\n OVERRIDE: 'warning',\n ASSET_DEFAULT: 'secondary',\n};\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const key = status.toUpperCase();\n const variant = statusVariantMap[key] ?? 'secondary';\n const isLive = liveStatuses.has(key);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n {isLive && (\n <span\n aria-hidden=\"true\"\n className=\"size-1.5 rounded-full bg-current motion-safe:animate-vc-glow-pulse\"\n />\n )}\n {formatEnumLabel(status)}\n </span>\n );\n};\n"],"mappings":";;;;AAqBA,IAAM,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;CACV,EAIK,IAAe,IAAI,IAAI;CAAC;CAAa;CAAU;CAAc;CAAU,CAAC,EAExE,IAAiD;CAErD,aAAa;CACb,WAAW;CACX,aAAa;CACb,WAAW;CACX,WAAW;CACX,iBAAiB;CACjB,SAAS;CAGT,OAAO;CACP,aAAa;CACb,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,YAAY;CAGZ,KAAK;CACL,MAAM;CAGN,OAAO;CACP,cAAc;CACd,SAAS;CACT,MAAM;CAGN,WAAW;CACX,SAAS;CACT,YAAY;CACZ,WAAW;CACX,WAAW;CAGX,WAAW;CACX,UAAU;CACV,UAAU;CACV,aAAa;CAGb,S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