@burdenoff/microfe-theglobalfuel 2026.704.1 → 2026.705.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/dev/main.d.ts.map +1 -1
- package/dist/theglobalfuel/components/DataTable.d.ts +3 -1
- package/dist/theglobalfuel/components/DataTable.d.ts.map +1 -1
- package/dist/theglobalfuel/components/DataTable.js +37 -27
- package/dist/theglobalfuel/components/DataTable.js.map +1 -1
- package/dist/theglobalfuel/hooks/index.d.ts +1 -0
- package/dist/theglobalfuel/hooks/index.d.ts.map +1 -1
- package/dist/theglobalfuel/hooks/index.js +1 -0
- package/dist/theglobalfuel/hooks/useNotify.d.ts +23 -0
- package/dist/theglobalfuel/hooks/useNotify.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useNotify.js +19 -0
- package/dist/theglobalfuel/hooks/useNotify.js.map +1 -0
- package/dist/theglobalfuel/hooks/useTheFiles.d.ts.map +1 -1
- package/dist/theglobalfuel/hooks/useTheFiles.js +4 -1
- package/dist/theglobalfuel/hooks/useTheFiles.js.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +7 -3
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -1
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +59 -31
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +367 -321
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetsPage.js +66 -54
- package/dist/theglobalfuel/pages/assets/AssetsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts +2 -2
- package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/compliance/CompliancePage.js +346 -182
- package/dist/theglobalfuel/pages/compliance/CompliancePage.js.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js +418 -390
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractsPage.js +238 -230
- package/dist/theglobalfuel/pages/contracts/ContractsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +5 -3
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -1
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +201 -177
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/inventory/InventoryPage.js +271 -238
- package/dist/theglobalfuel/pages/inventory/InventoryPage.js.map +1 -1
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/production/ProductionPage.js +185 -177
- package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
- package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts +2 -2
- package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/reserves/ReservesPage.js +160 -138
- package/dist/theglobalfuel/pages/reserves/ReservesPage.js.map +1 -1
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts +4 -3
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts.map +1 -1
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +250 -198
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -1
- package/dist/theglobalfuel/utils/formatters.d.ts +8 -0
- package/dist/theglobalfuel/utils/formatters.d.ts.map +1 -1
- package/dist/theglobalfuel/utils/formatters.js +6 -1
- package/dist/theglobalfuel/utils/formatters.js.map +1 -1
- package/dist/theglobalfuel/utils/index.d.ts +2 -1
- package/dist/theglobalfuel/utils/index.d.ts.map +1 -1
- package/dist/theglobalfuel/utils/transitions.d.ts +17 -0
- package/dist/theglobalfuel/utils/transitions.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/transitions.js +70 -0
- package/dist/theglobalfuel/utils/transitions.js.map +1 -0
- package/package.json +1 -1
package/dist/dev/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dev/main.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/dev/main.tsx"],"names":[],"mappings":"AAKA,OAAO,cAAc,CAAC"}
|
|
@@ -16,6 +16,8 @@ interface DataTableProps<T> {
|
|
|
16
16
|
rows: T[];
|
|
17
17
|
rowKey: (row: T) => string;
|
|
18
18
|
onRowClick?: (row: T) => void;
|
|
19
|
+
/** Accessible label for a clickable row (e.g. `(a) => `Open ${a.name}``). */
|
|
20
|
+
rowLabel?: (row: T) => string;
|
|
19
21
|
className?: string;
|
|
20
22
|
/** Default sort: a column key + direction. */
|
|
21
23
|
defaultSort?: {
|
|
@@ -23,6 +25,6 @@ interface DataTableProps<T> {
|
|
|
23
25
|
dir: 'asc' | 'desc';
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
export declare function DataTable<T>({ columns, rows, rowKey, onRowClick, className, defaultSort, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare function DataTable<T>({ columns, rows, rowKey, onRowClick, rowLabel, className, defaultSort, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
export {};
|
|
28
30
|
//# sourceMappingURL=DataTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/DataTable.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/DataTable.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9E,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC;CACzC;AAED,UAAU,cAAc,CAAC,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC;CACpD;AAkBD,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAC3B,OAAO,EACP,IAAI,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,EAAE,cAAc,CAAC,CAAC,CAAC,2CAiHnB"}
|
|
@@ -4,27 +4,29 @@ import { ChevronDown as r, ChevronUp as i, ChevronsUpDown as a } from "lucide-re
|
|
|
4
4
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
5
|
import { GlassCard as c } from "@burdenoff/fe-libs/ui";
|
|
6
6
|
//#region src/theglobalfuel/components/DataTable.tsx
|
|
7
|
-
var l = {
|
|
7
|
+
var l = (e, t) => {
|
|
8
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), t());
|
|
9
|
+
}, u = {
|
|
8
10
|
left: "text-left",
|
|
9
11
|
right: "text-right",
|
|
10
12
|
center: "text-center"
|
|
11
13
|
};
|
|
12
|
-
function
|
|
13
|
-
let [
|
|
14
|
-
if (!
|
|
15
|
-
let e =
|
|
16
|
-
if (!e?.sortValue) return
|
|
17
|
-
let t =
|
|
18
|
-
return [...
|
|
14
|
+
function d({ columns: d, rows: f, rowKey: p, onRowClick: m, rowLabel: h, className: g, defaultSort: _ }) {
|
|
15
|
+
let [v, y] = n(_ ?? null), b = t(() => {
|
|
16
|
+
if (!v) return f;
|
|
17
|
+
let e = d.find((e) => e.key === v.key);
|
|
18
|
+
if (!e?.sortValue) return f;
|
|
19
|
+
let t = v.dir === "asc" ? 1 : -1;
|
|
20
|
+
return [...f].sort((n, r) => {
|
|
19
21
|
let i = e.sortValue(n), a = e.sortValue(r);
|
|
20
22
|
return i < a ? -1 * t : i > a ? 1 * t : 0;
|
|
21
23
|
});
|
|
22
24
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
]),
|
|
27
|
-
|
|
25
|
+
f,
|
|
26
|
+
v,
|
|
27
|
+
d
|
|
28
|
+
]), x = (e) => {
|
|
29
|
+
y((t) => t?.key === e ? {
|
|
28
30
|
key: e,
|
|
29
31
|
dir: t.dir === "asc" ? "desc" : "asc"
|
|
30
32
|
} : {
|
|
@@ -34,38 +36,46 @@ function u({ columns: u, rows: d, rowKey: f, onRowClick: p, className: m, defaul
|
|
|
34
36
|
};
|
|
35
37
|
return /* @__PURE__ */ o(c, {
|
|
36
38
|
treatment: "plain",
|
|
37
|
-
className: e("overflow-hidden",
|
|
39
|
+
className: e("overflow-hidden", g),
|
|
38
40
|
children: /* @__PURE__ */ o("div", {
|
|
39
41
|
className: "overflow-x-auto",
|
|
40
42
|
children: /* @__PURE__ */ s("table", {
|
|
41
43
|
className: "w-full border-collapse text-sm",
|
|
42
44
|
children: [/* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", {
|
|
43
45
|
className: "border-b border-border-seam",
|
|
44
|
-
children:
|
|
45
|
-
let n = !!t.sortValue, c =
|
|
46
|
+
children: d.map((t) => {
|
|
47
|
+
let n = !!t.sortValue, c = v?.key === t.key;
|
|
46
48
|
return /* @__PURE__ */ o("th", {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
scope: "col",
|
|
50
|
+
role: n ? "button" : void 0,
|
|
51
|
+
tabIndex: n ? 0 : void 0,
|
|
52
|
+
onClick: n ? () => x(t.key) : void 0,
|
|
53
|
+
onKeyDown: n ? (e) => l(e, () => x(t.key)) : void 0,
|
|
54
|
+
"aria-sort": c ? v?.dir === "asc" ? "ascending" : "descending" : void 0,
|
|
55
|
+
className: e("px-4 py-3 font-medium text-text-secondary whitespace-nowrap", u[t.align ?? "left"], t.hideOnMobile && "hidden md:table-cell", n && "cursor-pointer select-none hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"),
|
|
50
56
|
children: /* @__PURE__ */ s("span", {
|
|
51
57
|
className: e("inline-flex items-center gap-1", t.align === "right" && "flex-row-reverse"),
|
|
52
|
-
children: [t.header, n && (c ?
|
|
58
|
+
children: [t.header, n && (c ? v?.dir === "asc" ? /* @__PURE__ */ o(i, { className: "h-3.5 w-3.5 text-accent" }) : /* @__PURE__ */ o(r, { className: "h-3.5 w-3.5 text-accent" }) : /* @__PURE__ */ o(a, { className: "h-3.5 w-3.5 opacity-40" }))]
|
|
53
59
|
})
|
|
54
60
|
}, t.key);
|
|
55
61
|
})
|
|
56
|
-
}) }), /* @__PURE__ */ o("tbody", { children:
|
|
57
|
-
onClick:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
}) }), /* @__PURE__ */ o("tbody", { children: b.map((t) => /* @__PURE__ */ o("tr", {
|
|
63
|
+
onClick: m ? () => m(t) : void 0,
|
|
64
|
+
onKeyDown: m ? (e) => l(e, () => m(t)) : void 0,
|
|
65
|
+
role: m ? "button" : void 0,
|
|
66
|
+
tabIndex: m ? 0 : void 0,
|
|
67
|
+
"aria-label": m ? h?.(t) : void 0,
|
|
68
|
+
className: e("group border-b border-border-seam/60 last:border-0", m && "cursor-pointer transition-colors hover:bg-bg-sunken/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--color-focus-ring)]"),
|
|
69
|
+
children: d.map((n) => /* @__PURE__ */ o("td", {
|
|
70
|
+
className: e("px-4 py-3 text-text-primary align-middle", u[n.align ?? "left"], n.hideOnMobile && "hidden md:table-cell", n.className),
|
|
61
71
|
children: n.render(t)
|
|
62
72
|
}, n.key))
|
|
63
|
-
},
|
|
73
|
+
}, p(t))) })]
|
|
64
74
|
})
|
|
65
75
|
})
|
|
66
76
|
});
|
|
67
77
|
}
|
|
68
78
|
//#endregion
|
|
69
|
-
export {
|
|
79
|
+
export { d as DataTable };
|
|
70
80
|
|
|
71
81
|
//# sourceMappingURL=DataTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","names":[],"sources":["../../../src/theglobalfuel/components/DataTable.tsx"],"sourcesContent":["/**\n * DataTable — a lightweight, semantic-token table for list pages.\n * @module theglobalfuel/components\n *\n * Deliberately minimal (no external table lib). Renders a responsive,\n * horizontally-scrollable table wrapped in a GlassCard. Columns declare a\n * header, a render fn, optional alignment, and optionally a `sortValue` to make\n * the column click-sortable.\n */\n\nimport { useMemo, useState, type ReactNode } from 'react';\nimport { ChevronUp, ChevronDown, ChevronsUpDown } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\nexport interface Column<T> {\n key: string;\n header: ReactNode;\n render: (row: T) => ReactNode;\n align?: 'left' | 'right' | 'center';\n className?: string;\n /** Hide below the `md` breakpoint for a mobile-friendly layout. */\n hideOnMobile?: boolean;\n /** Provide to make this column click-sortable (returns a comparable value). */\n sortValue?: (row: T) => string | number;\n}\n\ninterface DataTableProps<T> {\n columns: Column<T>[];\n rows: T[];\n rowKey: (row: T) => string;\n onRowClick?: (row: T) => void;\n className?: string;\n /** Default sort: a column key + direction. */\n defaultSort?: { key: string; dir: 'asc' | 'desc' };\n}\n\nconst alignClass = {\n left: 'text-left',\n right: 'text-right',\n center: 'text-center',\n} as const;\n\nexport function DataTable<T>({\n columns,\n rows,\n rowKey,\n onRowClick,\n className,\n defaultSort,\n}: DataTableProps<T>) {\n const [sort, setSort] = useState<{ key: string; dir: 'asc' | 'desc' } | null>(\n defaultSort ?? null\n );\n\n const sortedRows = useMemo(() => {\n if (!sort) return rows;\n const col = columns.find((c) => c.key === sort.key);\n if (!col?.sortValue) return rows;\n const dir = sort.dir === 'asc' ? 1 : -1;\n return [...rows].sort((a, b) => {\n const va = col.sortValue!(a);\n const vb = col.sortValue!(b);\n if (va < vb) return -1 * dir;\n if (va > vb) return 1 * dir;\n return 0;\n });\n }, [rows, sort, columns]);\n\n const toggleSort = (key: string) => {\n setSort((prev) =>\n prev?.key === key ? { key, dir: prev.dir === 'asc' ? 'desc' : 'asc' } : { key, dir: 'asc' }\n );\n };\n\n return (\n <GlassCard treatment=\"plain\" className={cn('overflow-hidden', className)}>\n <div className=\"overflow-x-auto\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"border-b border-border-seam\">\n {columns.map((col) => {\n const sortable = Boolean(col.sortValue);\n const active = sort?.key === col.key;\n return (\n <th\n key={col.key}\n onClick={sortable ? () => toggleSort(col.key) : undefined}\n aria-sort={\n active ? (sort?.dir === 'asc' ? 'ascending' : 'descending') : undefined\n }\n className={cn(\n 'px-4 py-3 font-medium text-text-secondary whitespace-nowrap',\n alignClass[col.align ?? 'left'],\n col.hideOnMobile && 'hidden md:table-cell',\n sortable
|
|
1
|
+
{"version":3,"file":"DataTable.js","names":[],"sources":["../../../src/theglobalfuel/components/DataTable.tsx"],"sourcesContent":["/**\n * DataTable — a lightweight, semantic-token table for list pages.\n * @module theglobalfuel/components\n *\n * Deliberately minimal (no external table lib). Renders a responsive,\n * horizontally-scrollable table wrapped in a GlassCard. Columns declare a\n * header, a render fn, optional alignment, and optionally a `sortValue` to make\n * the column click-sortable.\n */\n\nimport { useMemo, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport { ChevronUp, ChevronDown, ChevronsUpDown } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\nexport interface Column<T> {\n key: string;\n header: ReactNode;\n render: (row: T) => ReactNode;\n align?: 'left' | 'right' | 'center';\n className?: string;\n /** Hide below the `md` breakpoint for a mobile-friendly layout. */\n hideOnMobile?: boolean;\n /** Provide to make this column click-sortable (returns a comparable value). */\n sortValue?: (row: T) => string | number;\n}\n\ninterface DataTableProps<T> {\n columns: Column<T>[];\n rows: T[];\n rowKey: (row: T) => string;\n onRowClick?: (row: T) => void;\n /** Accessible label for a clickable row (e.g. `(a) => `Open ${a.name}``). */\n rowLabel?: (row: T) => string;\n className?: string;\n /** Default sort: a column key + direction. */\n defaultSort?: { key: string; dir: 'asc' | 'desc' };\n}\n\n/** Enter/Space activate — only when the event originates on the element itself\n * (not on an interactive descendant like a Select or Button inside a cell). */\nconst activateOnKey = (e: KeyboardEvent, fn: () => void) => {\n if (e.target !== e.currentTarget) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n fn();\n }\n};\n\nconst alignClass = {\n left: 'text-left',\n right: 'text-right',\n center: 'text-center',\n} as const;\n\nexport function DataTable<T>({\n columns,\n rows,\n rowKey,\n onRowClick,\n rowLabel,\n className,\n defaultSort,\n}: DataTableProps<T>) {\n const [sort, setSort] = useState<{ key: string; dir: 'asc' | 'desc' } | null>(\n defaultSort ?? null\n );\n\n const sortedRows = useMemo(() => {\n if (!sort) return rows;\n const col = columns.find((c) => c.key === sort.key);\n if (!col?.sortValue) return rows;\n const dir = sort.dir === 'asc' ? 1 : -1;\n return [...rows].sort((a, b) => {\n const va = col.sortValue!(a);\n const vb = col.sortValue!(b);\n if (va < vb) return -1 * dir;\n if (va > vb) return 1 * dir;\n return 0;\n });\n }, [rows, sort, columns]);\n\n const toggleSort = (key: string) => {\n setSort((prev) =>\n prev?.key === key ? { key, dir: prev.dir === 'asc' ? 'desc' : 'asc' } : { key, dir: 'asc' }\n );\n };\n\n return (\n <GlassCard treatment=\"plain\" className={cn('overflow-hidden', className)}>\n <div className=\"overflow-x-auto\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"border-b border-border-seam\">\n {columns.map((col) => {\n const sortable = Boolean(col.sortValue);\n const active = sort?.key === col.key;\n return (\n <th\n key={col.key}\n scope=\"col\"\n role={sortable ? 'button' : undefined}\n tabIndex={sortable ? 0 : undefined}\n onClick={sortable ? () => toggleSort(col.key) : undefined}\n onKeyDown={\n sortable ? (e) => activateOnKey(e, () => toggleSort(col.key)) : undefined\n }\n aria-sort={\n active ? (sort?.dir === 'asc' ? 'ascending' : 'descending') : undefined\n }\n className={cn(\n 'px-4 py-3 font-medium text-text-secondary whitespace-nowrap',\n alignClass[col.align ?? 'left'],\n col.hideOnMobile && 'hidden md:table-cell',\n sortable &&\n 'cursor-pointer select-none hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]'\n )}\n >\n <span\n className={cn(\n 'inline-flex items-center gap-1',\n col.align === 'right' && 'flex-row-reverse'\n )}\n >\n {col.header}\n {sortable &&\n (active ? (\n sort?.dir === 'asc' ? (\n <ChevronUp className=\"h-3.5 w-3.5 text-accent\" />\n ) : (\n <ChevronDown className=\"h-3.5 w-3.5 text-accent\" />\n )\n ) : (\n <ChevronsUpDown className=\"h-3.5 w-3.5 opacity-40\" />\n ))}\n </span>\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {sortedRows.map((row) => (\n <tr\n key={rowKey(row)}\n onClick={onRowClick ? () => onRowClick(row) : undefined}\n onKeyDown={onRowClick ? (e) => activateOnKey(e, () => onRowClick(row)) : undefined}\n role={onRowClick ? 'button' : undefined}\n tabIndex={onRowClick ? 0 : undefined}\n aria-label={onRowClick ? rowLabel?.(row) : undefined}\n className={cn(\n 'group border-b border-border-seam/60 last:border-0',\n onRowClick &&\n 'cursor-pointer transition-colors hover:bg-bg-sunken/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--color-focus-ring)]'\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n 'px-4 py-3 text-text-primary align-middle',\n alignClass[col.align ?? 'left'],\n col.hideOnMobile && 'hidden md:table-cell',\n col.className\n )}\n >\n {col.render(row)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;AAyCA,IAAM,KAAiB,GAAkB,MAAmB;AACtD,GAAE,WAAW,EAAE,kBACf,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,GAAI;GAIF,IAAa;CACjB,MAAM;CACN,OAAO;CACP,QAAQ;CACT;AAED,SAAgB,EAAa,EAC3B,YACA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,SAAS,SACxB,EAAI,gBAAgB,wBACpB,KACE,kJACH;iBAED,kBAAC,QAAD;QACE,WAAW,EACT,kCACA,EAAI,UAAU,WAAW,mBAC1B;kBAJH,CAMG,EAAI,QACJ,MACE,IACC,GAAM,QAAQ,QACZ,kBAAC,GAAD,EAAW,WAAU,2BAA4B,CAAA,GAEjD,kBAAC,GAAD,EAAa,WAAU,2BAA4B,CAAA,GAGrD,kBAAC,GAAD,EAAgB,WAAU,0BAA2B,CAAA,EAEpD;;OACJ,EArCE,EAAI,IAqCN;OAEP;KACC,CAAA,EACC,CAAA,EACR,kBAAC,SAAD,EAAA,UACG,EAAW,KAAK,MACf,kBAAC,MAAD;KAEE,SAAS,UAAmB,EAAW,EAAI,GAAG,KAAA;KAC9C,WAAW,KAAc,MAAM,EAAc,SAAS,EAAW,EAAI,CAAC,GAAG,KAAA;KACzE,MAAM,IAAa,WAAW,KAAA;KAC9B,UAAU,IAAa,IAAI,KAAA;KAC3B,cAAY,IAAa,IAAW,EAAI,GAAG,KAAA;KAC3C,WAAW,EACT,sDACA,KACE,+KACH;eAEA,EAAQ,KAAK,MACZ,kBAAC,MAAD;MAEE,WAAW,EACT,4CACA,EAAW,EAAI,SAAS,SACxB,EAAI,gBAAgB,wBACpB,EAAI,UACL;gBAEA,EAAI,OAAO,EAAI;MACb,EATE,EAAI,IASN,CACL;KACC,EAzBE,EAAO,EAAI,CAyBb,CACL,EACI,CAAA,CACF;;GACJ,CAAA;EACI,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useNotify — thin wrapper over the shell's shared toast surface.
|
|
3
|
+
* @module theglobalfuel/hooks
|
|
4
|
+
*
|
|
5
|
+
* Every write control (create/record/transition/verify/deliver/set-status)
|
|
6
|
+
* routes success + error feedback through the app-shell's single `GlobalUi`
|
|
7
|
+
* toaster (fe-libs) — NOT a locally-bundled `sonner` singleton, which would be
|
|
8
|
+
* a different instance from the shell's mounted `<Toaster>` and never render.
|
|
9
|
+
*
|
|
10
|
+
* `useGlobalUi()` is called unconditionally (React rules-of-hooks): the MFE is
|
|
11
|
+
* always mounted inside the app-shell's GlobalUiProvider in production, and the
|
|
12
|
+
* standalone dev harness (src/dev/main.tsx) wraps the Root in the same provider.
|
|
13
|
+
*/
|
|
14
|
+
export type NotifyKind = 'info' | 'success' | 'warning' | 'error';
|
|
15
|
+
export interface Notifier {
|
|
16
|
+
success: (message: string) => void;
|
|
17
|
+
error: (message: string) => void;
|
|
18
|
+
info: (message: string) => void;
|
|
19
|
+
/** Extract a human-readable message from a thrown error and toast it. */
|
|
20
|
+
fromError: (err: unknown, fallback?: string) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function useNotify(): Notifier;
|
|
23
|
+
//# sourceMappingURL=useNotify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotify.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useNotify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,yEAAyE;IACzE,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAQD,wBAAgB,SAAS,IAAI,QAAQ,CAoBpC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback as e } from "react";
|
|
2
|
+
import { useGlobalUi as t } from "@burdenoff/fe-libs/shared/hooks/shell";
|
|
3
|
+
//#region src/theglobalfuel/hooks/useNotify.ts
|
|
4
|
+
var n = (e, t) => e instanceof Error && e.message ? e.message : typeof e == "string" && e ? e : t;
|
|
5
|
+
function r() {
|
|
6
|
+
let { showToast: r } = t(), i = e((e, t) => {
|
|
7
|
+
r(e, t);
|
|
8
|
+
}, [r]);
|
|
9
|
+
return {
|
|
10
|
+
success: e((e) => i(e, "success"), [i]),
|
|
11
|
+
error: e((e) => i(e, "error"), [i]),
|
|
12
|
+
info: e((e) => i(e, "info"), [i]),
|
|
13
|
+
fromError: e((e, t = "Something went wrong. Please try again.") => i(n(e, t), "error"), [i])
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as useNotify };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=useNotify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotify.js","names":[],"sources":["../../../src/theglobalfuel/hooks/useNotify.ts"],"sourcesContent":["/**\n * useNotify — thin wrapper over the shell's shared toast surface.\n * @module theglobalfuel/hooks\n *\n * Every write control (create/record/transition/verify/deliver/set-status)\n * routes success + error feedback through the app-shell's single `GlobalUi`\n * toaster (fe-libs) — NOT a locally-bundled `sonner` singleton, which would be\n * a different instance from the shell's mounted `<Toaster>` and never render.\n *\n * `useGlobalUi()` is called unconditionally (React rules-of-hooks): the MFE is\n * always mounted inside the app-shell's GlobalUiProvider in production, and the\n * standalone dev harness (src/dev/main.tsx) wraps the Root in the same provider.\n */\n\nimport { useCallback } from 'react';\nimport { useGlobalUi } from '@burdenoff/fe-libs/shared/hooks/shell';\n\nexport type NotifyKind = 'info' | 'success' | 'warning' | 'error';\n\nexport interface Notifier {\n success: (message: string) => void;\n error: (message: string) => void;\n info: (message: string) => void;\n /** Extract a human-readable message from a thrown error and toast it. */\n fromError: (err: unknown, fallback?: string) => void;\n}\n\nconst messageFor = (err: unknown, fallback: string): string => {\n if (err instanceof Error && err.message) return err.message;\n if (typeof err === 'string' && err) return err;\n return fallback;\n};\n\nexport function useNotify(): Notifier {\n const { showToast } = useGlobalUi();\n\n const emit = useCallback(\n (message: string, kind: NotifyKind) => {\n showToast(message, kind);\n },\n [showToast]\n );\n\n return {\n success: useCallback((m: string) => emit(m, 'success'), [emit]),\n error: useCallback((m: string) => emit(m, 'error'), [emit]),\n info: useCallback((m: string) => emit(m, 'info'), [emit]),\n fromError: useCallback(\n (err: unknown, fallback = 'Something went wrong. Please try again.') =>\n emit(messageFor(err, fallback), 'error'),\n [emit]\n ),\n };\n}\n"],"mappings":";;;AA2BA,IAAM,KAAc,GAAc,MAC5B,aAAe,SAAS,EAAI,UAAgB,EAAI,UAChD,OAAO,KAAQ,YAAY,IAAY,IACpC;AAGT,SAAgB,IAAsB;CACpC,IAAM,EAAE,iBAAc,GAAa,EAE7B,IAAO,GACV,GAAiB,MAAqB;AACrC,IAAU,GAAS,EAAK;IAE1B,CAAC,EAAU,CACZ;AAED,QAAO;EACL,SAAS,GAAa,MAAc,EAAK,GAAG,UAAU,EAAE,CAAC,EAAK,CAAC;EAC/D,OAAO,GAAa,MAAc,EAAK,GAAG,QAAQ,EAAE,CAAC,EAAK,CAAC;EAC3D,MAAM,GAAa,MAAc,EAAK,GAAG,OAAO,EAAE,CAAC,EAAK,CAAC;EACzD,WAAW,GACR,GAAc,IAAW,8CACxB,EAAK,EAAW,GAAK,EAAS,EAAE,QAAQ,EAC1C,CAAC,EAAK,CACP;EACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheFiles.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useTheFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA8BH,8EAA8E;AAC9E,eAAO,MAAM,WAAW,GAAU,KAAK,EACrC,OAAO,MAAM,EACb,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,MAAM,KACf,OAAO,CAAC,KAAK,CAmBf,CAAC;AAMF,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AA+BD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACjD,WAAW,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAO,
|
|
1
|
+
{"version":3,"file":"useTheFiles.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useTheFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA8BH,8EAA8E;AAC9E,eAAO,MAAM,WAAW,GAAU,KAAK,EACrC,OAAO,MAAM,EACb,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,MAAM,KACf,OAAO,CAAC,KAAK,CAmBf,CAAC;AAMF,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AA+BD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACjD,WAAW,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAO,sBAuFnC,CAAC;AAMF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,GAAG,IAAI,GAAG,SAAS,8EAsBvD,CAAC"}
|
|
@@ -46,7 +46,10 @@ var c = () => {
|
|
|
46
46
|
} }, r), { uploadUrl: c } = a.initiateUpload, u = a.initiateUpload.session.id;
|
|
47
47
|
if (!c) throw Error("The file service did not return an upload URL.");
|
|
48
48
|
await s(c, e, i, l);
|
|
49
|
-
let d = await o("mutation TheCompleteUpload($input: CompleteUploadInput!) {\n completeUpload(input: $input) {\n fileId\n file { id name }\n }\n }", { input: {
|
|
49
|
+
let d = await o("mutation TheCompleteUpload($input: CompleteUploadInput!) {\n completeUpload(input: $input) {\n fileId\n file { id name }\n }\n }", { input: {
|
|
50
|
+
sessionId: u,
|
|
51
|
+
fileSize: String(e.size)
|
|
52
|
+
} }, r);
|
|
50
53
|
return l(100), {
|
|
51
54
|
fileId: d.completeUpload.fileId,
|
|
52
55
|
fileName: d.completeUpload.file?.name ?? e.name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheFiles.js","names":[],"sources":["../../../src/theglobalfuel/hooks/useTheFiles.ts"],"sourcesContent":["/**\n * TheGlobalFuel — wspace-files-svc REUSE hooks (Integration A).\n * @module theglobalfuel/hooks/useTheFiles\n *\n * Reuses the platform file store (`wspace-files-svc`) WITHOUT any eco-svc\n * change: the theglobalfuel schema already exposes `TheObservation.evidenceFileId` /\n * `TheReport.fileId`; this module lets the UI actually produce a `fileId` via\n * the canonical 3-step upload flow composed into the WORKSPACE supergraph:\n * 1. `initiateUpload(input)` → `{ uploadUrl, session { id } }`\n * 2. HTTP `PUT` the bytes to the returned signed `uploadUrl`\n * 3. `completeUpload(input: { sessionId })` → `{ fileId }`\n * plus `getFile(id)` to resolve an existing evidence/report file's name + URL.\n *\n * Transport mirrors `useTheGlobalFuelApi` exactly — `graphqlFetch({ gateway:\n * 'workspace', workspaceToken: true })` — so no ApolloProvider is required.\n * These hooks live in a SEPARATE file by design; `useTheGlobalFuelApi.ts` is\n * left untouched.\n */\n\nimport { useCallback, useState } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useTheGlobalFuel } from '../context';\n\n// ============================================================================\n// Shared workspace-gateway transport (reused by the comments + tags hooks too)\n// ============================================================================\n\ntype GraphqlReadCacheGlobals = {\n __graphqlFetchResponseCache?: { clear: () => void };\n __graphqlFetchPendingResponses?: { clear: () => void };\n __boffGraphQLResponseCache?: { clear: () => void };\n};\n\n/**\n * fe-libs `graphqlFetch` coalesces `query` responses in a short-lived in-memory\n * cache. After a write we drop those caches so the invalidation refetch that\n * follows reads fresh data (same remedy `useTheGlobalFuelApi` applies).\n */\nconst clearGraphqlReadCaches = (): void => {\n const g = globalThis as GraphqlReadCacheGlobals;\n g.__graphqlFetchResponseCache?.clear();\n g.__graphqlFetchPendingResponses?.clear();\n g.__boffGraphQLResponseCache?.clear();\n};\n\n/** Execute a workspace-gateway GraphQL operation with the workspace token. */\nexport const wspaceFetch = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n if (/^\\s*mutation\\b/.test(query)) {\n clearGraphqlReadCaches();\n }\n return response.data;\n};\n\n// ============================================================================\n// File upload (initiate → PUT → complete)\n// ============================================================================\n\nexport interface UploadedTheFile {\n fileId: string;\n fileName: string;\n}\n\n/** `PUT` the blob to the signed URL, reporting byte-progress via `onProgress`. */\nfunction putWithProgress(\n url: string,\n file: File,\n contentType: string,\n onProgress: (percent: number) => void\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n xhr.open('PUT', url);\n xhr.setRequestHeader('Content-Type', contentType);\n xhr.upload.onprogress = (event) => {\n if (event.lengthComputable) {\n onProgress(Math.round((event.loaded / event.total) * 100));\n }\n };\n xhr.onload = () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve();\n } else {\n reject(new Error(`File storage rejected the upload (HTTP ${xhr.status}).`));\n }\n };\n xhr.onerror = () => reject(new Error('Network error while uploading the file.'));\n xhr.onabort = () => reject(new Error('The upload was cancelled.'));\n xhr.send(file);\n });\n}\n\nexport interface UseTheFileUploadResult {\n upload: (file: File) => Promise<UploadedTheFile>;\n isUploading: boolean;\n /** 0–100 byte-progress of the signed-URL PUT. */\n progress: number;\n error: string | null;\n reset: () => void;\n}\n\n/**\n * Imperative upload hook: `await upload(file)` runs the platform 3-step flow and\n * resolves to `{ fileId, fileName }`. `fileId` is what the theglobalfuel mutations accept\n * (`ecoRecordObservation.evidenceFileId`, `ecoPublishReport.fileId`).\n */\nexport const useTheFileUpload = (): UseTheFileUploadResult => {\n const { apiGatewayUrl } = useTheGlobalFuel();\n const [isUploading, setIsUploading] = useState(false);\n const [progress, setProgress] = useState(0);\n const [error, setError] = useState<string | null>(null);\n\n const reset = useCallback(() => {\n setIsUploading(false);\n setProgress(0);\n setError(null);\n }, []);\n\n const upload = useCallback(\n async (file: File): Promise<UploadedTheFile> => {\n setIsUploading(true);\n setProgress(0);\n setError(null);\n try {\n const dotIndex = file.name.lastIndexOf('.');\n const extension = dotIndex > -1 ? file.name.slice(dotIndex + 1) : '';\n const mimeType = file.type || 'application/octet-stream';\n\n // 1. initiate\n const initiated = await wspaceFetch<{\n initiateUpload: { uploadUrl: string | null; session: { id: string } };\n }>(\n `mutation TheInitiateUpload($input: InitiateUploadInput!) {\n initiateUpload(input: $input) {\n uploadUrl\n session { id }\n }\n }`,\n {\n input: {\n fileName: file.name,\n extension,\n mimeType,\n fileSize: String(file.size),\n visibility: 'WORKSPACE',\n },\n },\n apiGatewayUrl\n );\n\n const { uploadUrl } = initiated.initiateUpload;\n const sessionId = initiated.initiateUpload.session.id;\n if (!uploadUrl) {\n throw new Error('The file service did not return an upload URL.');\n }\n\n // 2. PUT the bytes\n await putWithProgress(uploadUrl, file, mimeType, setProgress);\n\n // 3. complete\n const completed = await wspaceFetch<{\n completeUpload: { fileId: string; file: { id: string; name: string } | null };\n }>(\n `mutation TheCompleteUpload($input: CompleteUploadInput!) {\n completeUpload(input: $input) {\n fileId\n file { id name }\n }\n }`,\n { input: { sessionId } },\n apiGatewayUrl\n );\n\n setProgress(100);\n return {\n fileId: completed.completeUpload.fileId,\n fileName: completed.completeUpload.file?.name ?? file.name,\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : 'The file could not be uploaded.';\n setError(message);\n throw err instanceof Error ? err : new Error(message);\n } finally {\n setIsUploading(false);\n }\n },\n [apiGatewayUrl]\n );\n\n return { upload, isUploading, progress, error, reset };\n};\n\n// ============================================================================\n// Resolve an existing file (name + download URL) for rendering evidence links\n// ============================================================================\n\nexport interface TheFileMeta {\n id: string;\n name: string;\n downloadUrl: string | null;\n mimeType: string;\n size: string;\n}\n\nexport const useTheFile = (id: string | null | undefined) => {\n const { apiGatewayUrl } = useTheGlobalFuel();\n return useQuery({\n queryKey: ['theglobalfuel', 'file', id ?? ''],\n enabled: Boolean(id),\n queryFn: async () => {\n const data = await wspaceFetch<{ getFile: TheFileMeta | null }>(\n `query TheGetFile($id: ID!) {\n getFile(id: $id) {\n id\n name\n downloadUrl\n mimeType\n size\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.getFile;\n },\n });\n};\n"],"mappings":";;;;;;AAwCA,IAAM,UAAqC;CACzC,IAAM,IAAI;AAGV,CAFA,EAAE,6BAA6B,OAAO,EACtC,EAAE,gCAAgC,OAAO,EACzC,EAAE,4BAA4B,OAAO;GAI1B,IAAc,OACzB,GACA,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,yBAAyB;AAE1E,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,wCAAwC;AAK1D,QAHI,iBAAiB,KAAK,EAAM,IAC9B,GAAwB,EAEnB,EAAS;;AAalB,SAAS,EACP,GACA,GACA,GACA,GACe;AACf,QAAO,IAAI,SAAe,GAAS,MAAW;EAC5C,IAAM,IAAM,IAAI,gBAAgB;AAiBhC,EAhBA,EAAI,KAAK,OAAO,EAAI,EACpB,EAAI,iBAAiB,gBAAgB,EAAY,EACjD,EAAI,OAAO,cAAc,MAAU;AACjC,GAAI,EAAM,oBACR,EAAW,KAAK,MAAO,EAAM,SAAS,EAAM,QAAS,IAAI,CAAC;KAG9D,EAAI,eAAe;AACjB,GAAI,EAAI,UAAU,OAAO,EAAI,SAAS,MACpC,GAAS,GAET,EAAO,gBAAI,MAAM,0CAA0C,EAAI,OAAO,IAAI,CAAC;KAG/E,EAAI,gBAAgB,EAAO,gBAAI,MAAM,0CAA0C,CAAC,EAChF,EAAI,gBAAgB,EAAO,gBAAI,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MAAkC;CAC3D,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAiB;GAAQ,KAAM;GAAG;EAC7C,SAAS,EAAQ;EACjB,SAAS,aACM,MAAM,EACjB,yLASA,EAAE,OAAI,EACN,EACD,EACW;EAEf,CAAC"}
|
|
1
|
+
{"version":3,"file":"useTheFiles.js","names":[],"sources":["../../../src/theglobalfuel/hooks/useTheFiles.ts"],"sourcesContent":["/**\n * TheGlobalFuel — wspace-files-svc REUSE hooks (Integration A).\n * @module theglobalfuel/hooks/useTheFiles\n *\n * Reuses the platform file store (`wspace-files-svc`) WITHOUT any eco-svc\n * change: the theglobalfuel schema already exposes `TheObservation.evidenceFileId` /\n * `TheReport.fileId`; this module lets the UI actually produce a `fileId` via\n * the canonical 3-step upload flow composed into the WORKSPACE supergraph:\n * 1. `initiateUpload(input)` → `{ uploadUrl, session { id } }`\n * 2. HTTP `PUT` the bytes to the returned signed `uploadUrl`\n * 3. `completeUpload(input: { sessionId })` → `{ fileId }`\n * plus `getFile(id)` to resolve an existing evidence/report file's name + URL.\n *\n * Transport mirrors `useTheGlobalFuelApi` exactly — `graphqlFetch({ gateway:\n * 'workspace', workspaceToken: true })` — so no ApolloProvider is required.\n * These hooks live in a SEPARATE file by design; `useTheGlobalFuelApi.ts` is\n * left untouched.\n */\n\nimport { useCallback, useState } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useTheGlobalFuel } from '../context';\n\n// ============================================================================\n// Shared workspace-gateway transport (reused by the comments + tags hooks too)\n// ============================================================================\n\ntype GraphqlReadCacheGlobals = {\n __graphqlFetchResponseCache?: { clear: () => void };\n __graphqlFetchPendingResponses?: { clear: () => void };\n __boffGraphQLResponseCache?: { clear: () => void };\n};\n\n/**\n * fe-libs `graphqlFetch` coalesces `query` responses in a short-lived in-memory\n * cache. After a write we drop those caches so the invalidation refetch that\n * follows reads fresh data (same remedy `useTheGlobalFuelApi` applies).\n */\nconst clearGraphqlReadCaches = (): void => {\n const g = globalThis as GraphqlReadCacheGlobals;\n g.__graphqlFetchResponseCache?.clear();\n g.__graphqlFetchPendingResponses?.clear();\n g.__boffGraphQLResponseCache?.clear();\n};\n\n/** Execute a workspace-gateway GraphQL operation with the workspace token. */\nexport const wspaceFetch = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n if (/^\\s*mutation\\b/.test(query)) {\n clearGraphqlReadCaches();\n }\n return response.data;\n};\n\n// ============================================================================\n// File upload (initiate → PUT → complete)\n// ============================================================================\n\nexport interface UploadedTheFile {\n fileId: string;\n fileName: string;\n}\n\n/** `PUT` the blob to the signed URL, reporting byte-progress via `onProgress`. */\nfunction putWithProgress(\n url: string,\n file: File,\n contentType: string,\n onProgress: (percent: number) => void\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n xhr.open('PUT', url);\n xhr.setRequestHeader('Content-Type', contentType);\n xhr.upload.onprogress = (event) => {\n if (event.lengthComputable) {\n onProgress(Math.round((event.loaded / event.total) * 100));\n }\n };\n xhr.onload = () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve();\n } else {\n reject(new Error(`File storage rejected the upload (HTTP ${xhr.status}).`));\n }\n };\n xhr.onerror = () => reject(new Error('Network error while uploading the file.'));\n xhr.onabort = () => reject(new Error('The upload was cancelled.'));\n xhr.send(file);\n });\n}\n\nexport interface UseTheFileUploadResult {\n upload: (file: File) => Promise<UploadedTheFile>;\n isUploading: boolean;\n /** 0–100 byte-progress of the signed-URL PUT. */\n progress: number;\n error: string | null;\n reset: () => void;\n}\n\n/**\n * Imperative upload hook: `await upload(file)` runs the platform 3-step flow and\n * resolves to `{ fileId, fileName }`. `fileId` is what the theglobalfuel mutations accept\n * (`ecoRecordObservation.evidenceFileId`, `ecoPublishReport.fileId`).\n */\nexport const useTheFileUpload = (): UseTheFileUploadResult => {\n const { apiGatewayUrl } = useTheGlobalFuel();\n const [isUploading, setIsUploading] = useState(false);\n const [progress, setProgress] = useState(0);\n const [error, setError] = useState<string | null>(null);\n\n const reset = useCallback(() => {\n setIsUploading(false);\n setProgress(0);\n setError(null);\n }, []);\n\n const upload = useCallback(\n async (file: File): Promise<UploadedTheFile> => {\n setIsUploading(true);\n setProgress(0);\n setError(null);\n try {\n const dotIndex = file.name.lastIndexOf('.');\n const extension = dotIndex > -1 ? file.name.slice(dotIndex + 1) : '';\n const mimeType = file.type || 'application/octet-stream';\n\n // 1. initiate\n const initiated = await wspaceFetch<{\n initiateUpload: { uploadUrl: string | null; session: { id: string } };\n }>(\n `mutation TheInitiateUpload($input: InitiateUploadInput!) {\n initiateUpload(input: $input) {\n uploadUrl\n session { id }\n }\n }`,\n {\n input: {\n fileName: file.name,\n extension,\n mimeType,\n fileSize: String(file.size),\n visibility: 'WORKSPACE',\n },\n },\n apiGatewayUrl\n );\n\n const { uploadUrl } = initiated.initiateUpload;\n const sessionId = initiated.initiateUpload.session.id;\n if (!uploadUrl) {\n throw new Error('The file service did not return an upload URL.');\n }\n\n // 2. PUT the bytes\n await putWithProgress(uploadUrl, file, mimeType, setProgress);\n\n // 3. complete\n const completed = await wspaceFetch<{\n completeUpload: { fileId: string; file: { id: string; name: string } | null };\n }>(\n `mutation TheCompleteUpload($input: CompleteUploadInput!) {\n completeUpload(input: $input) {\n fileId\n file { id name }\n }\n }`,\n // `fileSize` is required by wspace-files-svc completeUpload for quota\n // tracking and MUST match the fileSize passed to initiateUpload — omitting\n // it makes the resolver throw INTERNAL_SERVER_ERROR.\n { input: { sessionId, fileSize: String(file.size) } },\n apiGatewayUrl\n );\n\n setProgress(100);\n return {\n fileId: completed.completeUpload.fileId,\n fileName: completed.completeUpload.file?.name ?? file.name,\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : 'The file could not be uploaded.';\n setError(message);\n throw err instanceof Error ? err : new Error(message);\n } finally {\n setIsUploading(false);\n }\n },\n [apiGatewayUrl]\n );\n\n return { upload, isUploading, progress, error, reset };\n};\n\n// ============================================================================\n// Resolve an existing file (name + download URL) for rendering evidence links\n// ============================================================================\n\nexport interface TheFileMeta {\n id: string;\n name: string;\n downloadUrl: string | null;\n mimeType: string;\n size: string;\n}\n\nexport const useTheFile = (id: string | null | undefined) => {\n const { apiGatewayUrl } = useTheGlobalFuel();\n return useQuery({\n queryKey: ['theglobalfuel', 'file', id ?? ''],\n enabled: Boolean(id),\n queryFn: async () => {\n const data = await wspaceFetch<{ getFile: TheFileMeta | null }>(\n `query TheGetFile($id: ID!) {\n getFile(id: $id) {\n id\n name\n downloadUrl\n mimeType\n size\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.getFile;\n },\n });\n};\n"],"mappings":";;;;;;AAwCA,IAAM,UAAqC;CACzC,IAAM,IAAI;AAGV,CAFA,EAAE,6BAA6B,OAAO,EACtC,EAAE,gCAAgC,OAAO,EACzC,EAAE,4BAA4B,OAAO;GAI1B,IAAc,OACzB,GACA,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,yBAAyB;AAE1E,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,wCAAwC;AAK1D,QAHI,iBAAiB,KAAK,EAAM,IAC9B,GAAwB,EAEnB,EAAS;;AAalB,SAAS,EACP,GACA,GACA,GACA,GACe;AACf,QAAO,IAAI,SAAe,GAAS,MAAW;EAC5C,IAAM,IAAM,IAAI,gBAAgB;AAiBhC,EAhBA,EAAI,KAAK,OAAO,EAAI,EACpB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ASA,EAAE,OAAO;KAAE;KAAW,UAAU,OAAO,EAAK,KAAK;KAAE,EAAE,EACrD,EACD;AAGD,WADA,EAAY,IAAI,EACT;KACL,QAAQ,EAAU,eAAe;KACjC,UAAU,EAAU,eAAe,MAAM,QAAQ,EAAK;KACvD;YACM,GAAK;IACZ,IAAM,IAAU,aAAe,QAAQ,EAAI,UAAU;AAErD,UADA,EAAS,EAAQ,EACX,aAAe,QAAQ,IAAU,MAAM,EAAQ;aAC7C;AACR,MAAe,GAAM;;KAGzB,CAAC,EAAc,CAChB;EAEgB;EAAa;EAAU;EAAO;EAAO;GAe3C,KAAc,MAAkC;CAC3D,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAiB;GAAQ,KAAM;GAAG;EAC7C,SAAS,EAAQ;EACjB,SAAS,aACM,MAAM,EACjB,yLASA,EAAE,OAAI,EACN,EACD,EACW;EAEf,CAAC"}
|
|
@@ -24,7 +24,7 @@ export interface ProductionFilters {
|
|
|
24
24
|
}
|
|
25
25
|
export declare const useTheProductionRecords: (filters?: ProductionFilters) => import('@tanstack/react-query').UseQueryResult<TheConnection<TheProductionRecord>, Error>;
|
|
26
26
|
export declare const useTheRecordProduction: () => import('@tanstack/react-query').UseMutationResult<TheProductionRecord, Error, TheRecordProductionInput, unknown>;
|
|
27
|
-
export declare const useTheReserveEstimates: (assetId?: string, category?: TheReserveCategory) => import('@tanstack/react-query').UseQueryResult<TheReserveEstimate
|
|
27
|
+
export declare const useTheReserveEstimates: (assetId?: string, category?: TheReserveCategory, pagination?: PaginationInput) => import('@tanstack/react-query').UseQueryResult<TheConnection<TheReserveEstimate>, Error>;
|
|
28
28
|
export declare const useTheCreateReserveEstimate: () => import('@tanstack/react-query').UseMutationResult<TheReserveEstimate, Error, TheCreateReserveEstimateInput, unknown>;
|
|
29
29
|
export interface ContractFilters {
|
|
30
30
|
commodity?: TheCommodityType;
|
|
@@ -43,7 +43,11 @@ export declare const useTheTransitionContract: () => import('@tanstack/react-que
|
|
|
43
43
|
id: string;
|
|
44
44
|
status: TheContractStatus;
|
|
45
45
|
}, unknown>;
|
|
46
|
-
export declare const useTheShipments: (contractId?: string, status?: TheShipmentStatus) => import('@tanstack/react-query').UseQueryResult<TheShipment
|
|
46
|
+
export declare const useTheShipments: (contractId?: string, status?: TheShipmentStatus, pagination?: PaginationInput) => import('@tanstack/react-query').UseQueryResult<TheConnection<TheShipment>, Error>;
|
|
47
|
+
export declare const useTheTransitionShipment: () => import('@tanstack/react-query').UseMutationResult<TheShipment, Error, {
|
|
48
|
+
id: string;
|
|
49
|
+
status: TheShipmentStatus;
|
|
50
|
+
}, unknown>;
|
|
47
51
|
export declare const useTheScheduleShipment: () => import('@tanstack/react-query').UseMutationResult<TheShipment, Error, TheCreateShipmentInput, unknown>;
|
|
48
52
|
export declare const useTheDeliverShipment: () => import('@tanstack/react-query').UseMutationResult<TheShipment, Error, string, unknown>;
|
|
49
53
|
export interface InventoryFilters {
|
|
@@ -65,7 +69,7 @@ export interface EmissionFilters {
|
|
|
65
69
|
export declare const useTheEmissionRecords: (filters?: EmissionFilters) => import('@tanstack/react-query').UseQueryResult<TheConnection<TheEmissionRecord>, Error>;
|
|
66
70
|
export declare const useTheRecordEmission: () => import('@tanstack/react-query').UseMutationResult<TheEmissionRecord, Error, TheRecordEmissionInput, unknown>;
|
|
67
71
|
export declare const useTheVerifyEmission: () => import('@tanstack/react-query').UseMutationResult<TheEmissionRecord, Error, string, unknown>;
|
|
68
|
-
export declare const useTheComplianceCerts: (assetId?: string, category?: TheComplianceCategory, status?: TheComplianceStatus) => import('@tanstack/react-query').UseQueryResult<TheComplianceCert
|
|
72
|
+
export declare const useTheComplianceCerts: (assetId?: string, category?: TheComplianceCategory, status?: TheComplianceStatus, pagination?: PaginationInput) => import('@tanstack/react-query').UseQueryResult<TheConnection<TheComplianceCert>, Error>;
|
|
69
73
|
export declare const useTheComplianceCert: (id: string | undefined) => import('@tanstack/react-query').UseQueryResult<TheComplianceCert | null, Error>;
|
|
70
74
|
export declare const useTheCreateComplianceCert: () => import('@tanstack/react-query').UseMutationResult<TheComplianceCert, Error, TheCreateComplianceCertInput, unknown>;
|
|
71
75
|
export declare const useTheTransitionComplianceCert: () => import('@tanstack/react-query').UseMutationResult<TheComplianceCert, Error, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheGlobalFuelApi.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useTheGlobalFuelApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,EACtB,4BAA4B,EAC5B,eAAe,EAChB,MAAM,UAAU,CAAC;AAuHlB,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,GAAI,UAAS,YAAiB,mFAuBtD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,GAAG,SAAS,2EAoBjD,CAAC;AAEF,eAAO,MAAM,iBAAiB,wGAgB7B,CAAC;AAEF,eAAO,MAAM,iBAAiB;QAIc,MAAM;WAAS,mBAAmB;W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AU,iBAAiB;WAe7E,CAAC;AAEF,eAAO,MAAM,sBAAsB,8GAmBlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,8FAoBjC,CAAC;AAMF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,eAAO,MAAM,mBAAmB,GAAI,UAAS,gBAAqB,0FAsBjE,CAAC;AAEF,eAAO,MAAM,wBAAwB,sHAgBpC,CAAC;AAEF,eAAO,MAAM,2BAA2B;QAIK,MAAM;YAAU,kBAAkB;WAY9E,CAAC;AAMF,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,eAAO,MAAM,qBAAqB,GAAI,UAAS,eAAoB,4FAsBlE,CAAC;AAEF,eAAO,MAAM,oBAAoB,oHAgBhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,oGAgBhC,CAAC;AAMF,eAAO,MAAM,qBAAqB,GAChC,UAAU,MAAM,EAChB,WAAW,qBAAqB,EAChC,SAAS,mBAAmB,EAC5B,aAAa,eAAe,4FAmB7B,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,IAAI,MAAM,GAAG,SAAS,oFAgB1D,CAAC;AAEF,eAAO,MAAM,0BAA0B,0HAgBtC,CAAC;AAEF,eAAO,MAAM,8BAA8B;QAIE,MAAM;YAAU,mBAAmB;WAe/E,CAAC"}
|
|
@@ -121,20 +121,25 @@ var a = () => {
|
|
|
121
121
|
i.invalidateQueries({ queryKey: s.production }), i.invalidateQueries({ queryKey: s.asset(e.assetId) });
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
}, w = (t, r) => {
|
|
125
|
-
let { apiGatewayUrl:
|
|
124
|
+
}, w = (t, r, i) => {
|
|
125
|
+
let { apiGatewayUrl: a } = e();
|
|
126
126
|
return n({
|
|
127
127
|
queryKey: [
|
|
128
128
|
...s.reserves,
|
|
129
129
|
t ?? null,
|
|
130
|
-
r ?? null
|
|
130
|
+
r ?? null,
|
|
131
|
+
i ?? null
|
|
131
132
|
],
|
|
132
|
-
queryFn: async () => (await o(`query TheListReserveEstimates($assetId: ID, $category: TheReserveCategory) {
|
|
133
|
-
theListReserveEstimates(assetId: $assetId, category: $category
|
|
133
|
+
queryFn: async () => (await o(`query TheListReserveEstimates($assetId: ID, $category: TheReserveCategory, $pagination: PaginationInput) {
|
|
134
|
+
theListReserveEstimates(assetId: $assetId, category: $category, pagination: $pagination) {
|
|
135
|
+
items { ${d} }
|
|
136
|
+
pageInfo { cursor hasMore }
|
|
137
|
+
}
|
|
134
138
|
}`, {
|
|
135
139
|
assetId: t,
|
|
136
|
-
category: r
|
|
137
|
-
|
|
140
|
+
category: r,
|
|
141
|
+
pagination: i ?? c
|
|
142
|
+
}, a)).theListReserveEstimates
|
|
138
143
|
});
|
|
139
144
|
}, T = () => {
|
|
140
145
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
@@ -208,22 +213,40 @@ var a = () => {
|
|
|
208
213
|
i.invalidateQueries({ queryKey: s.contracts }), i.invalidateQueries({ queryKey: s.contract(e.id) });
|
|
209
214
|
}
|
|
210
215
|
});
|
|
211
|
-
}, j = (t, r) => {
|
|
212
|
-
let { apiGatewayUrl:
|
|
216
|
+
}, j = (t, r, i) => {
|
|
217
|
+
let { apiGatewayUrl: a } = e();
|
|
213
218
|
return n({
|
|
214
219
|
queryKey: [
|
|
215
220
|
...s.shipments,
|
|
216
221
|
t ?? null,
|
|
217
|
-
r ?? null
|
|
222
|
+
r ?? null,
|
|
223
|
+
i ?? null
|
|
218
224
|
],
|
|
219
|
-
queryFn: async () => (await o(`query TheListShipments($contractId: ID, $status: TheShipmentStatus) {
|
|
220
|
-
theListShipments(contractId: $contractId, status: $status
|
|
225
|
+
queryFn: async () => (await o(`query TheListShipments($contractId: ID, $status: TheShipmentStatus, $pagination: PaginationInput) {
|
|
226
|
+
theListShipments(contractId: $contractId, status: $status, pagination: $pagination) {
|
|
227
|
+
items { ${p} }
|
|
228
|
+
pageInfo { cursor hasMore }
|
|
229
|
+
}
|
|
221
230
|
}`, {
|
|
222
231
|
contractId: t,
|
|
223
|
-
status: r
|
|
224
|
-
|
|
232
|
+
status: r,
|
|
233
|
+
pagination: i ?? c
|
|
234
|
+
}, a)).theListShipments
|
|
225
235
|
});
|
|
226
236
|
}, M = () => {
|
|
237
|
+
let { apiGatewayUrl: n } = e(), i = r();
|
|
238
|
+
return t({
|
|
239
|
+
mutationFn: async ({ id: e, status: t }) => (await o(`mutation TheTransitionShipment($id: ID!, $status: TheShipmentStatus!) {
|
|
240
|
+
theTransitionShipment(id: $id, status: $status) { ${p} }
|
|
241
|
+
}`, {
|
|
242
|
+
id: e,
|
|
243
|
+
status: t
|
|
244
|
+
}, n)).theTransitionShipment,
|
|
245
|
+
onSuccess: (e) => {
|
|
246
|
+
i.invalidateQueries({ queryKey: s.shipments }), i.invalidateQueries({ queryKey: s.contract(e.contractId) });
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}, N = () => {
|
|
227
250
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
228
251
|
return t({
|
|
229
252
|
mutationFn: async (e) => (await o(`mutation TheScheduleShipment($input: TheCreateShipmentInput!) {
|
|
@@ -233,7 +256,7 @@ var a = () => {
|
|
|
233
256
|
i.invalidateQueries({ queryKey: s.shipments }), i.invalidateQueries({ queryKey: s.contract(e.contractId) });
|
|
234
257
|
}
|
|
235
258
|
});
|
|
236
|
-
},
|
|
259
|
+
}, P = () => {
|
|
237
260
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
238
261
|
return t({
|
|
239
262
|
mutationFn: async (e) => (await o(`mutation TheDeliverShipment($id: ID!) {
|
|
@@ -243,7 +266,7 @@ var a = () => {
|
|
|
243
266
|
i.invalidateQueries({ queryKey: s.shipments }), i.invalidateQueries({ queryKey: s.contracts }), i.invalidateQueries({ queryKey: s.contract(e.contractId) });
|
|
244
267
|
}
|
|
245
268
|
});
|
|
246
|
-
},
|
|
269
|
+
}, F = (t = {}) => {
|
|
247
270
|
let { apiGatewayUrl: r } = e();
|
|
248
271
|
return n({
|
|
249
272
|
queryKey: [...s.inventory, t],
|
|
@@ -258,7 +281,7 @@ var a = () => {
|
|
|
258
281
|
pagination: t.pagination ?? c
|
|
259
282
|
}, r)).theListInventoryLots
|
|
260
283
|
});
|
|
261
|
-
},
|
|
284
|
+
}, I = () => {
|
|
262
285
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
263
286
|
return t({
|
|
264
287
|
mutationFn: async (e) => (await o(`mutation TheCreateInventoryLot($input: TheCreateInventoryLotInput!) {
|
|
@@ -266,7 +289,7 @@ var a = () => {
|
|
|
266
289
|
}`, { input: e }, n)).theCreateInventoryLot,
|
|
267
290
|
onSuccess: () => i.invalidateQueries({ queryKey: s.inventory })
|
|
268
291
|
});
|
|
269
|
-
},
|
|
292
|
+
}, L = () => {
|
|
270
293
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
271
294
|
return t({
|
|
272
295
|
mutationFn: async ({ id: e, status: t }) => (await o(`mutation TheSetInventoryLotStatus($id: ID!, $status: TheInventoryStatus!) {
|
|
@@ -277,7 +300,7 @@ var a = () => {
|
|
|
277
300
|
}, n)).theSetInventoryLotStatus,
|
|
278
301
|
onSuccess: () => i.invalidateQueries({ queryKey: s.inventory })
|
|
279
302
|
});
|
|
280
|
-
},
|
|
303
|
+
}, R = (t = {}) => {
|
|
281
304
|
let { apiGatewayUrl: r } = e();
|
|
282
305
|
return n({
|
|
283
306
|
queryKey: [...s.emissions, t],
|
|
@@ -292,7 +315,7 @@ var a = () => {
|
|
|
292
315
|
pagination: t.pagination ?? c
|
|
293
316
|
}, r)).theListEmissionRecords
|
|
294
317
|
});
|
|
295
|
-
},
|
|
318
|
+
}, z = () => {
|
|
296
319
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
297
320
|
return t({
|
|
298
321
|
mutationFn: async (e) => (await o(`mutation TheRecordEmission($input: TheRecordEmissionInput!) {
|
|
@@ -300,7 +323,7 @@ var a = () => {
|
|
|
300
323
|
}`, { input: e }, n)).theRecordEmission,
|
|
301
324
|
onSuccess: () => i.invalidateQueries({ queryKey: s.emissions })
|
|
302
325
|
});
|
|
303
|
-
},
|
|
326
|
+
}, B = () => {
|
|
304
327
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
305
328
|
return t({
|
|
306
329
|
mutationFn: async (e) => (await o(`mutation TheVerifyEmission($id: ID!) {
|
|
@@ -308,24 +331,29 @@ var a = () => {
|
|
|
308
331
|
}`, { id: e }, n)).theVerifyEmission,
|
|
309
332
|
onSuccess: () => i.invalidateQueries({ queryKey: s.emissions })
|
|
310
333
|
});
|
|
311
|
-
},
|
|
312
|
-
let { apiGatewayUrl:
|
|
334
|
+
}, V = (t, r, i, a) => {
|
|
335
|
+
let { apiGatewayUrl: l } = e();
|
|
313
336
|
return n({
|
|
314
337
|
queryKey: [
|
|
315
338
|
...s.compliance,
|
|
316
339
|
t ?? null,
|
|
317
340
|
r ?? null,
|
|
318
|
-
i ?? null
|
|
341
|
+
i ?? null,
|
|
342
|
+
a ?? null
|
|
319
343
|
],
|
|
320
|
-
queryFn: async () => (await o(`query TheListComplianceCerts($assetId: ID, $category: TheComplianceCategory, $status: TheComplianceStatus) {
|
|
321
|
-
theListComplianceCerts(assetId: $assetId, category: $category, status: $status
|
|
344
|
+
queryFn: async () => (await o(`query TheListComplianceCerts($assetId: ID, $category: TheComplianceCategory, $status: TheComplianceStatus, $pagination: PaginationInput) {
|
|
345
|
+
theListComplianceCerts(assetId: $assetId, category: $category, status: $status, pagination: $pagination) {
|
|
346
|
+
items { ${g} }
|
|
347
|
+
pageInfo { cursor hasMore }
|
|
348
|
+
}
|
|
322
349
|
}`, {
|
|
323
350
|
assetId: t,
|
|
324
351
|
category: r,
|
|
325
|
-
status: i
|
|
326
|
-
|
|
352
|
+
status: i,
|
|
353
|
+
pagination: a ?? c
|
|
354
|
+
}, l)).theListComplianceCerts
|
|
327
355
|
});
|
|
328
|
-
},
|
|
356
|
+
}, H = () => {
|
|
329
357
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
330
358
|
return t({
|
|
331
359
|
mutationFn: async (e) => (await o(`mutation TheCreateComplianceCert($input: TheCreateComplianceCertInput!) {
|
|
@@ -333,7 +361,7 @@ var a = () => {
|
|
|
333
361
|
}`, { input: e }, n)).theCreateComplianceCert,
|
|
334
362
|
onSuccess: () => i.invalidateQueries({ queryKey: s.compliance })
|
|
335
363
|
});
|
|
336
|
-
},
|
|
364
|
+
}, U = () => {
|
|
337
365
|
let { apiGatewayUrl: n } = e(), i = r();
|
|
338
366
|
return t({
|
|
339
367
|
mutationFn: async ({ id: e, status: t }) => (await o(`mutation TheTransitionComplianceCert($id: ID!, $status: TheComplianceStatus!) {
|
|
@@ -348,6 +376,6 @@ var a = () => {
|
|
|
348
376
|
});
|
|
349
377
|
};
|
|
350
378
|
//#endregion
|
|
351
|
-
export { v as useTheAsset, _ as useTheAssets,
|
|
379
|
+
export { v as useTheAsset, _ as useTheAssets, V as useTheComplianceCerts, D as useTheContract, E as useTheContracts, y as useTheCreateAsset, H as useTheCreateComplianceCert, O as useTheCreateContract, I as useTheCreateInventoryLot, T as useTheCreateReserveEstimate, P as useTheDeliverShipment, R as useTheEmissionRecords, F as useTheInventoryLots, S as useTheProductionRecords, z as useTheRecordEmission, C as useTheRecordProduction, w as useTheReserveEstimates, x as useTheRetireAsset, N as useTheScheduleShipment, L as useTheSetInventoryLotStatus, j as useTheShipments, b as useTheTransitionAsset, U as useTheTransitionComplianceCert, A as useTheTransitionContract, M as useTheTransitionShipment, k as useTheUpdateContract, B as useTheVerifyEmission };
|
|
352
380
|
|
|
353
381
|
//# sourceMappingURL=useTheGlobalFuelApi.js.map
|