@burdenoff/microfe-theglobalfuel 2026.704.1 → 2026.705.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/node_modules/{.bun/clsx@2.1.1/node_modules/clsx → clsx}/dist/clsx.js +1 -1
  2. package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
  3. package/dist/node_modules/{.bun/tailwind-merge@3.5.0/node_modules/tailwind-merge → tailwind-merge}/dist/bundle-mjs.js +212 -170
  4. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  5. package/dist/theglobalfuel/components/DataTable.js +37 -27
  6. package/dist/theglobalfuel/components/DataTable.js.map +1 -1
  7. package/dist/theglobalfuel/hooks/index.js +1 -0
  8. package/dist/theglobalfuel/hooks/useNotify.js +19 -0
  9. package/dist/theglobalfuel/hooks/useNotify.js.map +1 -0
  10. package/dist/theglobalfuel/hooks/useTheFiles.js +4 -1
  11. package/dist/theglobalfuel/hooks/useTheFiles.js.map +1 -1
  12. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +59 -31
  13. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
  14. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +367 -321
  15. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -1
  16. package/dist/theglobalfuel/pages/assets/AssetsPage.js +66 -54
  17. package/dist/theglobalfuel/pages/assets/AssetsPage.js.map +1 -1
  18. package/dist/theglobalfuel/pages/compliance/CompliancePage.js +346 -182
  19. package/dist/theglobalfuel/pages/compliance/CompliancePage.js.map +1 -1
  20. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js +418 -390
  21. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js.map +1 -1
  22. package/dist/theglobalfuel/pages/contracts/ContractsPage.js +238 -230
  23. package/dist/theglobalfuel/pages/contracts/ContractsPage.js.map +1 -1
  24. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +5 -3
  25. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -1
  26. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +201 -177
  27. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -1
  28. package/dist/theglobalfuel/pages/inventory/InventoryPage.js +271 -238
  29. package/dist/theglobalfuel/pages/inventory/InventoryPage.js.map +1 -1
  30. package/dist/theglobalfuel/pages/production/ProductionPage.js +185 -177
  31. package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
  32. package/dist/theglobalfuel/pages/reserves/ReservesPage.js +160 -138
  33. package/dist/theglobalfuel/pages/reserves/ReservesPage.js.map +1 -1
  34. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +250 -198
  35. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -1
  36. package/dist/theglobalfuel/utils/cn.js +2 -2
  37. package/dist/theglobalfuel/utils/formatters.js +6 -1
  38. package/dist/theglobalfuel/utils/formatters.js.map +1 -1
  39. package/dist/theglobalfuel/utils/transitions.js +70 -0
  40. package/dist/theglobalfuel/utils/transitions.js.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/dev/main.d.ts +0 -2
  43. package/dist/dev/main.d.ts.map +0 -1
  44. package/dist/index.d.ts +0 -2
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js.map +0 -1
  47. package/dist/node_modules/.bun/tailwind-merge@3.5.0/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
  48. package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts +0 -5
  49. package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts.map +0 -1
  50. package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts +0 -4
  51. package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts.map +0 -1
  52. package/dist/theglobalfuel/components/DataTable.d.ts +0 -28
  53. package/dist/theglobalfuel/components/DataTable.d.ts.map +0 -1
  54. package/dist/theglobalfuel/components/EmptyState.d.ts +0 -18
  55. package/dist/theglobalfuel/components/EmptyState.d.ts.map +0 -1
  56. package/dist/theglobalfuel/components/EvidenceUpload.d.ts +0 -14
  57. package/dist/theglobalfuel/components/EvidenceUpload.d.ts.map +0 -1
  58. package/dist/theglobalfuel/components/FileLink.d.ts +0 -15
  59. package/dist/theglobalfuel/components/FileLink.d.ts.map +0 -1
  60. package/dist/theglobalfuel/components/FilterTabs.d.ts +0 -18
  61. package/dist/theglobalfuel/components/FilterTabs.d.ts.map +0 -1
  62. package/dist/theglobalfuel/components/MetricsCard.d.ts +0 -23
  63. package/dist/theglobalfuel/components/MetricsCard.d.ts.map +0 -1
  64. package/dist/theglobalfuel/components/MiniBar.d.ts +0 -16
  65. package/dist/theglobalfuel/components/MiniBar.d.ts.map +0 -1
  66. package/dist/theglobalfuel/components/PageLayout.d.ts +0 -16
  67. package/dist/theglobalfuel/components/PageLayout.d.ts.map +0 -1
  68. package/dist/theglobalfuel/components/Pagination.d.ts +0 -22
  69. package/dist/theglobalfuel/components/Pagination.d.ts.map +0 -1
  70. package/dist/theglobalfuel/components/StateViews.d.ts +0 -24
  71. package/dist/theglobalfuel/components/StateViews.d.ts.map +0 -1
  72. package/dist/theglobalfuel/components/StatusBadge.d.ts +0 -9
  73. package/dist/theglobalfuel/components/StatusBadge.d.ts.map +0 -1
  74. package/dist/theglobalfuel/components/Tabs.d.ts +0 -17
  75. package/dist/theglobalfuel/components/Tabs.d.ts.map +0 -1
  76. package/dist/theglobalfuel/components/TheDiscussion.d.ts +0 -18
  77. package/dist/theglobalfuel/components/TheDiscussion.d.ts.map +0 -1
  78. package/dist/theglobalfuel/components/TheTags.d.ts +0 -17
  79. package/dist/theglobalfuel/components/TheTags.d.ts.map +0 -1
  80. package/dist/theglobalfuel/components/index.d.ts +0 -19
  81. package/dist/theglobalfuel/components/index.d.ts.map +0 -1
  82. package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts +0 -16
  83. package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts.map +0 -1
  84. package/dist/theglobalfuel/context/index.d.ts +0 -6
  85. package/dist/theglobalfuel/context/index.d.ts.map +0 -1
  86. package/dist/theglobalfuel/hooks/index.d.ts +0 -10
  87. package/dist/theglobalfuel/hooks/index.d.ts.map +0 -1
  88. package/dist/theglobalfuel/hooks/useCursorPager.d.ts +0 -33
  89. package/dist/theglobalfuel/hooks/useCursorPager.d.ts.map +0 -1
  90. package/dist/theglobalfuel/hooks/useTheComments.d.ts +0 -36
  91. package/dist/theglobalfuel/hooks/useTheComments.d.ts.map +0 -1
  92. package/dist/theglobalfuel/hooks/useTheFiles.d.ts +0 -47
  93. package/dist/theglobalfuel/hooks/useTheFiles.d.ts.map +0 -1
  94. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +0 -75
  95. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +0 -1
  96. package/dist/theglobalfuel/hooks/useTheTags.d.ts +0 -44
  97. package/dist/theglobalfuel/hooks/useTheTags.d.ts.map +0 -1
  98. package/dist/theglobalfuel/index.d.ts +0 -9
  99. package/dist/theglobalfuel/index.d.ts.map +0 -1
  100. package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts +0 -13
  101. package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts.map +0 -1
  102. package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts +0 -10
  103. package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts.map +0 -1
  104. package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts +0 -11
  105. package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts.map +0 -1
  106. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts +0 -9
  107. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts.map +0 -1
  108. package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts +0 -8
  109. package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts.map +0 -1
  110. package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts +0 -13
  111. package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts.map +0 -1
  112. package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts +0 -12
  113. package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts.map +0 -1
  114. package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts +0 -11
  115. package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts.map +0 -1
  116. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +0 -11
  117. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +0 -1
  118. package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts +0 -10
  119. package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts.map +0 -1
  120. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts +0 -10
  121. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts.map +0 -1
  122. package/dist/theglobalfuel/types/index.d.ts +0 -376
  123. package/dist/theglobalfuel/types/index.d.ts.map +0 -1
  124. package/dist/theglobalfuel/utils/cn.d.ts +0 -4
  125. package/dist/theglobalfuel/utils/cn.d.ts.map +0 -1
  126. package/dist/theglobalfuel/utils/formatters.d.ts +0 -36
  127. package/dist/theglobalfuel/utils/formatters.d.ts.map +0 -1
  128. package/dist/theglobalfuel/utils/i18n.d.ts +0 -6
  129. package/dist/theglobalfuel/utils/i18n.d.ts.map +0 -1
  130. package/dist/theglobalfuel/utils/index.d.ts +0 -9
  131. package/dist/theglobalfuel/utils/index.d.ts.map +0 -1
  132. package/dist/theglobalfuel/utils/navigation.d.ts +0 -14
  133. package/dist/theglobalfuel/utils/navigation.d.ts.map +0 -1
@@ -1,23 +1,24 @@
1
1
  import { useTheGlobalFuel as e } from "../../context/TheGlobalFuelContext.js";
2
2
  import { PageLayout as ee } from "../../components/PageLayout.js";
3
- import { formatEnumLabel as t, formatMoney as n, formatUnit as r, formatVolume as i } from "../../utils/formatters.js";
4
- import { StatusBadge as a } from "../../components/StatusBadge.js";
5
- import { MiniBar as o } from "../../components/MiniBar.js";
6
- import { DataTable as te } from "../../components/DataTable.js";
7
- import { ErrorView as ne, LoadingView as re } from "../../components/StateViews.js";
8
- import { EmptyState as ie } from "../../components/EmptyState.js";
3
+ import { formatEnumLabel as t, formatMoney as n, formatUnit as r, formatVolume as i, toBackendDate as a } from "../../utils/formatters.js";
4
+ import { StatusBadge as o } from "../../components/StatusBadge.js";
5
+ import { MiniBar as s } from "../../components/MiniBar.js";
6
+ import { DataTable as c } from "../../components/DataTable.js";
7
+ import { ErrorView as l, LoadingView as u } from "../../components/StateViews.js";
8
+ import { EmptyState as d } from "../../components/EmptyState.js";
9
9
  import "../../context/index.js";
10
- import { useTheContracts as ae, useTheCreateContract as oe } from "../../hooks/useTheGlobalFuelApi.js";
11
- import { useCursorPager as se } from "../../hooks/useCursorPager.js";
10
+ import { useTheContracts as f, useTheCreateContract as p } from "../../hooks/useTheGlobalFuelApi.js";
11
+ import { useCursorPager as te } from "../../hooks/useCursorPager.js";
12
+ import { useNotify as ne } from "../../hooks/useNotify.js";
12
13
  import "../../hooks/index.js";
13
- import { FilterTabs as s } from "../../components/FilterTabs.js";
14
- import { Pagination as c } from "../../components/Pagination.js";
15
- import { useMemo as l, useState as u } from "react";
16
- import { FileSignature as d, Plus as f } from "lucide-react";
17
- import { Fragment as ce, jsx as p, jsxs as m } from "react/jsx-runtime";
18
- import { Button as h, Input as g, Label as _, ResponsiveDialog as v, ResponsiveDialogContent as y, ResponsiveDialogDescription as b, ResponsiveDialogFooter as x, ResponsiveDialogHeader as S, ResponsiveDialogTitle as C, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O, Textarea as le } from "@burdenoff/fe-libs/ui";
14
+ import { FilterTabs as re } from "../../components/FilterTabs.js";
15
+ import { Pagination as ie } from "../../components/Pagination.js";
16
+ import { useMemo as ae, useState as m } from "react";
17
+ import { FileSignature as h, Plus as g } from "lucide-react";
18
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
19
+ import { Button as b, Input as x, Label as S, ResponsiveDialog as oe, ResponsiveDialogContent as se, ResponsiveDialogDescription as ce, ResponsiveDialogFooter as le, ResponsiveDialogHeader as ue, ResponsiveDialogTitle as de, Select as C, SelectContent as w, SelectItem as T, SelectTrigger as E, SelectValue as D, Textarea as fe } from "@burdenoff/fe-libs/ui";
19
20
  //#region src/theglobalfuel/pages/contracts/ContractsPage.tsx
20
- var k = [
21
+ var O = [
21
22
  {
22
23
  value: "ALL",
23
24
  label: "All"
@@ -50,12 +51,12 @@ var k = [
50
51
  value: "TERMINATED",
51
52
  label: "Terminated"
52
53
  }
53
- ], A = ["BUY", "SELL"], j = [
54
+ ], k = ["BUY", "SELL"], A = [
54
55
  "FIXED",
55
56
  "INDEX_LINKED",
56
57
  "FORMULA",
57
58
  "SPOT"
58
- ], M = [
59
+ ], j = [
59
60
  "CRUDE_OIL",
60
61
  "NATURAL_GAS",
61
62
  "LNG",
@@ -69,7 +70,7 @@ var k = [
69
70
  "GOLD",
70
71
  "LITHIUM",
71
72
  "RARE_EARTH"
72
- ], N = [
73
+ ], M = [
73
74
  "BARRELS",
74
75
  "CUBIC_METERS",
75
76
  "TONNES",
@@ -77,7 +78,7 @@ var k = [
77
78
  "MWH",
78
79
  "GJ",
79
80
  "MCF"
80
- ], P = 25, F = (e) => Math.max(0, Math.min(100, e)), I = (e) => e.contractedVolume > 0 ? F(e.deliveredVolume / e.contractedVolume * 100) : 0, L = {
81
+ ], N = 25, P = (e) => Math.max(0, Math.min(100, e)), F = (e) => e.contractedVolume > 0 ? P(e.deliveredVolume / e.contractedVolume * 100) : 0, I = {
81
82
  reference: "",
82
83
  counterparty: "",
83
84
  commodity: "CRUDE_OIL",
@@ -93,30 +94,30 @@ var k = [
93
94
  endDate: "",
94
95
  notes: ""
95
96
  };
96
- function R() {
97
- let { navigateTo: F } = e(), [R, z] = u("ALL"), [B, V] = u("ALL"), [H, U] = u("ALL"), W = se(), [ue, G] = u(!1), [K, q] = u(L), [J, Y] = u(null), { data: X, isLoading: de, isError: fe, refetch: pe } = ae({
97
+ function L() {
98
+ let { navigateTo: P } = e(), L = ne(), [R, z] = m("ALL"), [B, V] = m("ALL"), [H, pe] = m("ALL"), U = te(), [me, W] = m(!1), [G, K] = m(I), [q, J] = m(null), { data: Y, isLoading: he, isError: ge, refetch: _e } = f({
98
99
  status: R === "ALL" ? void 0 : R,
99
100
  side: B === "ALL" ? void 0 : B,
100
101
  commodity: H === "ALL" ? void 0 : H,
101
102
  pagination: {
102
- limit: P,
103
- cursor: W.cursor
103
+ limit: N,
104
+ cursor: U.cursor
104
105
  }
105
- }), Z = oe(), Q = l(() => X?.items ?? [], [X]), me = [
106
+ }), X = p(), Z = ae(() => Y?.items ?? [], [Y]), Q = [
106
107
  {
107
108
  key: "reference",
108
109
  header: "Contract",
109
- render: (e) => /* @__PURE__ */ m("div", {
110
+ render: (e) => /* @__PURE__ */ y("div", {
110
111
  className: "flex items-center gap-3",
111
- children: [/* @__PURE__ */ p("div", {
112
+ children: [/* @__PURE__ */ v("div", {
112
113
  className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-accent",
113
- children: /* @__PURE__ */ p(d, { className: "h-4 w-4" })
114
- }), /* @__PURE__ */ m("div", {
114
+ children: /* @__PURE__ */ v(h, { className: "h-4 w-4" })
115
+ }), /* @__PURE__ */ y("div", {
115
116
  className: "min-w-0",
116
- children: [/* @__PURE__ */ p("p", {
117
+ children: [/* @__PURE__ */ v("p", {
117
118
  className: "truncate font-semibold text-text-primary",
118
119
  children: e.reference
119
- }), /* @__PURE__ */ p("p", {
120
+ }), /* @__PURE__ */ v("p", {
120
121
  className: "truncate text-xs text-text-tertiary",
121
122
  children: e.counterparty
122
123
  })]
@@ -126,13 +127,13 @@ function R() {
126
127
  {
127
128
  key: "side",
128
129
  header: "Side",
129
- render: (e) => /* @__PURE__ */ p(a, { status: e.side })
130
+ render: (e) => /* @__PURE__ */ v(o, { status: e.side })
130
131
  },
131
132
  {
132
133
  key: "commodity",
133
134
  header: "Commodity",
134
135
  hideOnMobile: !0,
135
- render: (e) => /* @__PURE__ */ p("span", {
136
+ render: (e) => /* @__PURE__ */ v("span", {
136
137
  className: "text-text-secondary",
137
138
  children: t(e.commodity)
138
139
  })
@@ -140,7 +141,7 @@ function R() {
140
141
  {
141
142
  key: "status",
142
143
  header: "Status",
143
- render: (e) => /* @__PURE__ */ p(a, { status: e.status })
144
+ render: (e) => /* @__PURE__ */ v(o, { status: e.status })
144
145
  },
145
146
  {
146
147
  key: "price",
@@ -148,9 +149,9 @@ function R() {
148
149
  align: "right",
149
150
  hideOnMobile: !0,
150
151
  sortValue: (e) => e.pricePerUnit,
151
- render: (e) => /* @__PURE__ */ m("span", {
152
+ render: (e) => /* @__PURE__ */ y("span", {
152
153
  className: "tabular-nums text-text-secondary",
153
- children: [n(e.pricePerUnit, e.currency), /* @__PURE__ */ m("span", {
154
+ children: [n(e.pricePerUnit, e.currency), /* @__PURE__ */ y("span", {
154
155
  className: "text-text-tertiary",
155
156
  children: ["/", r(e.unit)]
156
157
  })]
@@ -159,14 +160,14 @@ function R() {
159
160
  {
160
161
  key: "delivery",
161
162
  header: "Delivered",
162
- sortValue: (e) => I(e),
163
- render: (e) => /* @__PURE__ */ m("div", {
163
+ sortValue: (e) => F(e),
164
+ render: (e) => /* @__PURE__ */ y("div", {
164
165
  className: "min-w-[9rem]",
165
- children: [/* @__PURE__ */ p(o, {
166
- value: I(e),
166
+ children: [/* @__PURE__ */ v(s, {
167
+ value: F(e),
167
168
  barClassName: "bg-[var(--color-status-success-text)]",
168
169
  className: "mb-1"
169
- }), /* @__PURE__ */ m("p", {
170
+ }), /* @__PURE__ */ y("p", {
170
171
  className: "text-xs tabular-nums text-text-tertiary",
171
172
  children: [
172
173
  i(e.deliveredVolume, e.unit),
@@ -181,7 +182,7 @@ function R() {
181
182
  header: "Updated",
182
183
  align: "right",
183
184
  hideOnMobile: !0,
184
- render: (e) => /* @__PURE__ */ p("span", {
185
+ render: (e) => /* @__PURE__ */ v("span", {
185
186
  className: "text-text-tertiary",
186
187
  children: new Date(e.updatedAt).toLocaleDateString(void 0, {
187
188
  day: "numeric",
@@ -191,256 +192,292 @@ function R() {
191
192
  })
192
193
  }
193
194
  ], $ = () => {
194
- q(L), Y(null);
195
+ K(I), J(null);
196
+ }, ve = async () => {
197
+ if (!G.reference.trim()) {
198
+ J("Contract reference is required.");
199
+ return;
200
+ }
201
+ if (!G.counterparty.trim()) {
202
+ J("Counterparty is required.");
203
+ return;
204
+ }
205
+ J(null);
206
+ try {
207
+ let e = await X.mutateAsync({
208
+ reference: G.reference.trim(),
209
+ counterparty: G.counterparty.trim(),
210
+ commodity: G.commodity,
211
+ side: G.side,
212
+ pricingBasis: G.pricingBasis,
213
+ pricePerUnit: G.pricePerUnit ? Number(G.pricePerUnit) : null,
214
+ priceIndex: G.priceIndex.trim() || null,
215
+ currency: G.currency.trim().toUpperCase() || "USD",
216
+ contractedVolume: G.contractedVolume ? Number(G.contractedVolume) : null,
217
+ unit: G.unit,
218
+ deliveryLocation: G.deliveryLocation.trim() || null,
219
+ startDate: a(G.startDate) ?? null,
220
+ endDate: a(G.endDate) ?? null,
221
+ notes: G.notes.trim() || null
222
+ });
223
+ L.success("Contract created"), W(!1), $(), P(`contracts/${e.id}`);
224
+ } catch (e) {
225
+ J(e instanceof Error ? e.message : "Failed to create contract."), L.fromError(e);
226
+ }
195
227
  };
196
- return /* @__PURE__ */ m(ee, {
228
+ return /* @__PURE__ */ y(ee, {
197
229
  title: "Offtake Contracts",
198
230
  description: "Commodity purchase & sale agreements — pricing, contracted volume and delivery progress.",
199
- actions: /* @__PURE__ */ m(h, {
200
- onClick: () => G(!0),
201
- children: [/* @__PURE__ */ p(f, { className: "mr-1.5 h-4 w-4" }), " New contract"]
231
+ actions: /* @__PURE__ */ y(b, {
232
+ onClick: () => W(!0),
233
+ children: [/* @__PURE__ */ v(g, { className: "mr-1.5 h-4 w-4" }), " New contract"]
202
234
  }),
203
235
  children: [
204
- /* @__PURE__ */ m("div", {
236
+ /* @__PURE__ */ y("div", {
205
237
  className: "mb-5 flex flex-wrap items-center gap-3",
206
238
  children: [
207
- /* @__PURE__ */ p(s, {
208
- options: k,
239
+ /* @__PURE__ */ v(re, {
240
+ options: O,
209
241
  value: R,
210
242
  onChange: (e) => {
211
- z(e), W.reset();
243
+ z(e), U.reset();
212
244
  }
213
245
  }),
214
- /* @__PURE__ */ m(w, {
246
+ /* @__PURE__ */ y(C, {
215
247
  value: B,
216
248
  onValueChange: (e) => {
217
- V(e), W.reset();
249
+ V(e), U.reset();
218
250
  },
219
- children: [/* @__PURE__ */ p(D, {
251
+ children: [/* @__PURE__ */ v(E, {
220
252
  className: "w-40",
221
- children: /* @__PURE__ */ p(O, { placeholder: "All sides" })
222
- }), /* @__PURE__ */ m(T, { children: [/* @__PURE__ */ p(E, {
253
+ "aria-label": "Filter by side",
254
+ children: /* @__PURE__ */ v(D, { placeholder: "All sides" })
255
+ }), /* @__PURE__ */ y(w, { children: [/* @__PURE__ */ v(T, {
223
256
  value: "ALL",
224
257
  children: "All sides"
225
- }), A.map((e) => /* @__PURE__ */ p(E, {
258
+ }), k.map((e) => /* @__PURE__ */ v(T, {
226
259
  value: e,
227
260
  children: t(e)
228
261
  }, e))] })]
229
262
  }),
230
- /* @__PURE__ */ m(w, {
263
+ /* @__PURE__ */ y(C, {
231
264
  value: H,
232
265
  onValueChange: (e) => {
233
- U(e), W.reset();
266
+ pe(e), U.reset();
234
267
  },
235
- children: [/* @__PURE__ */ p(D, {
268
+ children: [/* @__PURE__ */ v(E, {
236
269
  className: "w-48",
237
- children: /* @__PURE__ */ p(O, { placeholder: "All commodities" })
238
- }), /* @__PURE__ */ m(T, { children: [/* @__PURE__ */ p(E, {
270
+ "aria-label": "Filter by commodity",
271
+ children: /* @__PURE__ */ v(D, { placeholder: "All commodities" })
272
+ }), /* @__PURE__ */ y(w, { children: [/* @__PURE__ */ v(T, {
239
273
  value: "ALL",
240
274
  children: "All commodities"
241
- }), M.map((e) => /* @__PURE__ */ p(E, {
275
+ }), j.map((e) => /* @__PURE__ */ v(T, {
242
276
  value: e,
243
277
  children: t(e)
244
278
  }, e))] })]
245
279
  })
246
280
  ]
247
281
  }),
248
- de ? /* @__PURE__ */ p(re, { label: "Loading contracts…" }) : fe ? /* @__PURE__ */ p(ne, {
282
+ he ? /* @__PURE__ */ v(u, { label: "Loading contracts…" }) : ge ? /* @__PURE__ */ v(l, {
249
283
  message: "Couldn't load contracts.",
250
- onRetry: () => pe()
251
- }) : Q.length === 0 ? /* @__PURE__ */ p(ie, {
284
+ onRetry: () => _e()
285
+ }) : Z.length === 0 ? /* @__PURE__ */ v(d, {
252
286
  illustration: "empty-data",
253
- icon: /* @__PURE__ */ p(d, { className: "h-10 w-10" }),
287
+ icon: /* @__PURE__ */ v(h, { className: "h-10 w-10" }),
254
288
  title: "No contracts yet",
255
289
  description: R === "ALL" && B === "ALL" && H === "ALL" ? "Create your first offtake contract to track pricing, volume and delivery." : "No contracts match these filters.",
256
- action: /* @__PURE__ */ m(h, {
257
- onClick: () => G(!0),
258
- children: [/* @__PURE__ */ p(f, { className: "mr-1.5 h-4 w-4" }), " New contract"]
290
+ action: /* @__PURE__ */ y(b, {
291
+ onClick: () => W(!0),
292
+ children: [/* @__PURE__ */ v(g, { className: "mr-1.5 h-4 w-4" }), " New contract"]
259
293
  })
260
- }) : /* @__PURE__ */ m(ce, { children: [/* @__PURE__ */ p(te, {
261
- columns: me,
262
- rows: Q,
294
+ }) : /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(c, {
295
+ columns: Q,
296
+ rows: Z,
263
297
  rowKey: (e) => e.id,
264
- onRowClick: (e) => F(`contracts/${e.id}`)
265
- }), /* @__PURE__ */ p(c, {
266
- page: W.page,
267
- pageSize: P,
268
- itemCount: Q.length,
269
- hasMore: X?.pageInfo?.hasMore ?? !1,
270
- onPageChange: (e) => W.onPageChange(e, X?.pageInfo?.cursor)
298
+ onRowClick: (e) => P(`contracts/${e.id}`),
299
+ rowLabel: (e) => `Open ${e.reference}`
300
+ }), /* @__PURE__ */ v(ie, {
301
+ page: U.page,
302
+ pageSize: N,
303
+ itemCount: Z.length,
304
+ hasMore: Y?.pageInfo?.hasMore ?? !1,
305
+ onPageChange: (e) => U.onPageChange(e, Y?.pageInfo?.cursor)
271
306
  })] }),
272
- /* @__PURE__ */ p(v, {
273
- open: ue,
307
+ /* @__PURE__ */ v(oe, {
308
+ open: me,
274
309
  onOpenChange: (e) => {
275
- G(e), e || $();
310
+ W(e), e || $();
276
311
  },
277
- children: /* @__PURE__ */ m(y, { children: [
278
- /* @__PURE__ */ m(S, { children: [/* @__PURE__ */ p(C, { children: "New offtake contract" }), /* @__PURE__ */ p(b, { children: "Register a commodity purchase or sale agreement with a counterparty." })] }),
279
- /* @__PURE__ */ m("div", {
312
+ children: /* @__PURE__ */ y(se, { children: [/* @__PURE__ */ y(ue, { children: [/* @__PURE__ */ v(de, { children: "New offtake contract" }), /* @__PURE__ */ v(ce, { children: "Register a commodity purchase or sale agreement with a counterparty." })] }), /* @__PURE__ */ y("form", {
313
+ onSubmit: (e) => {
314
+ e.preventDefault(), ve();
315
+ },
316
+ children: [/* @__PURE__ */ y("div", {
280
317
  className: "grid gap-4 py-2",
281
318
  children: [
282
- /* @__PURE__ */ m("div", {
319
+ /* @__PURE__ */ y("div", {
283
320
  className: "grid gap-2 sm:grid-cols-2",
284
- children: [/* @__PURE__ */ m("div", {
321
+ children: [/* @__PURE__ */ y("div", {
285
322
  className: "grid gap-1.5",
286
- children: [/* @__PURE__ */ p(_, {
323
+ children: [/* @__PURE__ */ v(S, {
287
324
  htmlFor: "reference",
288
325
  children: "Reference *"
289
- }), /* @__PURE__ */ p(g, {
326
+ }), /* @__PURE__ */ v(x, {
290
327
  id: "reference",
291
- value: K.reference,
292
- onChange: (e) => q({
293
- ...K,
328
+ value: G.reference,
329
+ onChange: (e) => K({
330
+ ...G,
294
331
  reference: e.target.value
295
332
  }),
296
333
  placeholder: "OFT-2026-0142"
297
334
  })]
298
- }), /* @__PURE__ */ m("div", {
335
+ }), /* @__PURE__ */ y("div", {
299
336
  className: "grid gap-1.5",
300
- children: [/* @__PURE__ */ p(_, {
337
+ children: [/* @__PURE__ */ v(S, {
301
338
  htmlFor: "counterparty",
302
339
  children: "Counterparty *"
303
- }), /* @__PURE__ */ p(g, {
340
+ }), /* @__PURE__ */ v(x, {
304
341
  id: "counterparty",
305
- value: K.counterparty,
306
- onChange: (e) => q({
307
- ...K,
342
+ value: G.counterparty,
343
+ onChange: (e) => K({
344
+ ...G,
308
345
  counterparty: e.target.value
309
346
  }),
310
347
  placeholder: "Vitol S.A."
311
348
  })]
312
349
  })]
313
350
  }),
314
- /* @__PURE__ */ m("div", {
351
+ /* @__PURE__ */ y("div", {
315
352
  className: "grid gap-2 sm:grid-cols-2",
316
- children: [/* @__PURE__ */ m("div", {
353
+ children: [/* @__PURE__ */ y("div", {
317
354
  className: "grid gap-1.5",
318
- children: [/* @__PURE__ */ p(_, {
355
+ children: [/* @__PURE__ */ v(S, {
319
356
  htmlFor: "commodity",
320
357
  children: "Commodity *"
321
- }), /* @__PURE__ */ m(w, {
322
- value: K.commodity,
323
- onValueChange: (e) => q({
324
- ...K,
358
+ }), /* @__PURE__ */ y(C, {
359
+ value: G.commodity,
360
+ onValueChange: (e) => K({
361
+ ...G,
325
362
  commodity: e
326
363
  }),
327
- children: [/* @__PURE__ */ p(D, {
364
+ children: [/* @__PURE__ */ v(E, {
328
365
  id: "commodity",
329
- children: /* @__PURE__ */ p(O, {})
330
- }), /* @__PURE__ */ p(T, { children: M.map((e) => /* @__PURE__ */ p(E, {
366
+ children: /* @__PURE__ */ v(D, {})
367
+ }), /* @__PURE__ */ v(w, { children: j.map((e) => /* @__PURE__ */ v(T, {
331
368
  value: e,
332
369
  children: t(e)
333
370
  }, e)) })]
334
371
  })]
335
- }), /* @__PURE__ */ m("div", {
372
+ }), /* @__PURE__ */ y("div", {
336
373
  className: "grid gap-1.5",
337
- children: [/* @__PURE__ */ p(_, {
374
+ children: [/* @__PURE__ */ v(S, {
338
375
  htmlFor: "side",
339
376
  children: "Side"
340
- }), /* @__PURE__ */ m(w, {
341
- value: K.side,
342
- onValueChange: (e) => q({
343
- ...K,
377
+ }), /* @__PURE__ */ y(C, {
378
+ value: G.side,
379
+ onValueChange: (e) => K({
380
+ ...G,
344
381
  side: e
345
382
  }),
346
- children: [/* @__PURE__ */ p(D, {
383
+ children: [/* @__PURE__ */ v(E, {
347
384
  id: "side",
348
- children: /* @__PURE__ */ p(O, {})
349
- }), /* @__PURE__ */ p(T, { children: A.map((e) => /* @__PURE__ */ p(E, {
385
+ children: /* @__PURE__ */ v(D, {})
386
+ }), /* @__PURE__ */ v(w, { children: k.map((e) => /* @__PURE__ */ v(T, {
350
387
  value: e,
351
388
  children: t(e)
352
389
  }, e)) })]
353
390
  })]
354
391
  })]
355
392
  }),
356
- /* @__PURE__ */ m("div", {
393
+ /* @__PURE__ */ y("div", {
357
394
  className: "grid gap-2 sm:grid-cols-2",
358
- children: [/* @__PURE__ */ m("div", {
395
+ children: [/* @__PURE__ */ y("div", {
359
396
  className: "grid gap-1.5",
360
- children: [/* @__PURE__ */ p(_, {
397
+ children: [/* @__PURE__ */ v(S, {
361
398
  htmlFor: "pricingBasis",
362
399
  children: "Pricing basis"
363
- }), /* @__PURE__ */ m(w, {
364
- value: K.pricingBasis,
365
- onValueChange: (e) => q({
366
- ...K,
400
+ }), /* @__PURE__ */ y(C, {
401
+ value: G.pricingBasis,
402
+ onValueChange: (e) => K({
403
+ ...G,
367
404
  pricingBasis: e
368
405
  }),
369
- children: [/* @__PURE__ */ p(D, {
406
+ children: [/* @__PURE__ */ v(E, {
370
407
  id: "pricingBasis",
371
- children: /* @__PURE__ */ p(O, {})
372
- }), /* @__PURE__ */ p(T, { children: j.map((e) => /* @__PURE__ */ p(E, {
408
+ children: /* @__PURE__ */ v(D, {})
409
+ }), /* @__PURE__ */ v(w, { children: A.map((e) => /* @__PURE__ */ v(T, {
373
410
  value: e,
374
411
  children: t(e)
375
412
  }, e)) })]
376
413
  })]
377
- }), /* @__PURE__ */ m("div", {
414
+ }), /* @__PURE__ */ y("div", {
378
415
  className: "grid gap-1.5",
379
- children: [/* @__PURE__ */ p(_, {
416
+ children: [/* @__PURE__ */ v(S, {
380
417
  htmlFor: "priceIndex",
381
418
  children: "Price index"
382
- }), /* @__PURE__ */ p(g, {
419
+ }), /* @__PURE__ */ v(x, {
383
420
  id: "priceIndex",
384
- value: K.priceIndex,
385
- onChange: (e) => q({
386
- ...K,
421
+ value: G.priceIndex,
422
+ onChange: (e) => K({
423
+ ...G,
387
424
  priceIndex: e.target.value
388
425
  }),
389
426
  placeholder: "Brent, TTF, Henry Hub"
390
427
  })]
391
428
  })]
392
429
  }),
393
- /* @__PURE__ */ m("div", {
430
+ /* @__PURE__ */ y("div", {
394
431
  className: "grid gap-2 sm:grid-cols-3",
395
432
  children: [
396
- /* @__PURE__ */ m("div", {
433
+ /* @__PURE__ */ y("div", {
397
434
  className: "grid gap-1.5",
398
- children: [/* @__PURE__ */ p(_, {
435
+ children: [/* @__PURE__ */ v(S, {
399
436
  htmlFor: "pricePerUnit",
400
437
  children: "Price / unit"
401
- }), /* @__PURE__ */ p(g, {
438
+ }), /* @__PURE__ */ v(x, {
402
439
  id: "pricePerUnit",
403
440
  type: "number",
404
441
  min: "0",
405
442
  step: "any",
406
- value: K.pricePerUnit,
407
- onChange: (e) => q({
408
- ...K,
443
+ value: G.pricePerUnit,
444
+ onChange: (e) => K({
445
+ ...G,
409
446
  pricePerUnit: e.target.value
410
447
  }),
411
448
  placeholder: "82.50"
412
449
  })]
413
450
  }),
414
- /* @__PURE__ */ m("div", {
451
+ /* @__PURE__ */ y("div", {
415
452
  className: "grid gap-1.5",
416
- children: [/* @__PURE__ */ p(_, {
453
+ children: [/* @__PURE__ */ v(S, {
417
454
  htmlFor: "currency",
418
455
  children: "Currency"
419
- }), /* @__PURE__ */ p(g, {
456
+ }), /* @__PURE__ */ v(x, {
420
457
  id: "currency",
421
- value: K.currency,
422
- onChange: (e) => q({
423
- ...K,
458
+ value: G.currency,
459
+ onChange: (e) => K({
460
+ ...G,
424
461
  currency: e.target.value
425
462
  }),
426
463
  placeholder: "USD"
427
464
  })]
428
465
  }),
429
- /* @__PURE__ */ m("div", {
466
+ /* @__PURE__ */ y("div", {
430
467
  className: "grid gap-1.5",
431
- children: [/* @__PURE__ */ p(_, {
468
+ children: [/* @__PURE__ */ v(S, {
432
469
  htmlFor: "unit",
433
470
  children: "Unit"
434
- }), /* @__PURE__ */ m(w, {
435
- value: K.unit,
436
- onValueChange: (e) => q({
437
- ...K,
471
+ }), /* @__PURE__ */ y(C, {
472
+ value: G.unit,
473
+ onValueChange: (e) => K({
474
+ ...G,
438
475
  unit: e
439
476
  }),
440
- children: [/* @__PURE__ */ p(D, {
477
+ children: [/* @__PURE__ */ v(E, {
441
478
  id: "unit",
442
- children: /* @__PURE__ */ p(O, {})
443
- }), /* @__PURE__ */ p(T, { children: N.map((e) => /* @__PURE__ */ p(E, {
479
+ children: /* @__PURE__ */ v(D, {})
480
+ }), /* @__PURE__ */ v(w, { children: M.map((e) => /* @__PURE__ */ v(T, {
444
481
  value: e,
445
482
  children: r(e)
446
483
  }, e)) })]
@@ -448,141 +485,112 @@ function R() {
448
485
  })
449
486
  ]
450
487
  }),
451
- /* @__PURE__ */ m("div", {
488
+ /* @__PURE__ */ y("div", {
452
489
  className: "grid gap-2 sm:grid-cols-2",
453
- children: [/* @__PURE__ */ m("div", {
490
+ children: [/* @__PURE__ */ y("div", {
454
491
  className: "grid gap-1.5",
455
- children: [/* @__PURE__ */ p(_, {
492
+ children: [/* @__PURE__ */ v(S, {
456
493
  htmlFor: "contractedVolume",
457
494
  children: "Contracted volume"
458
- }), /* @__PURE__ */ p(g, {
495
+ }), /* @__PURE__ */ v(x, {
459
496
  id: "contractedVolume",
460
497
  type: "number",
461
498
  min: "0",
462
499
  step: "any",
463
- value: K.contractedVolume,
464
- onChange: (e) => q({
465
- ...K,
500
+ value: G.contractedVolume,
501
+ onChange: (e) => K({
502
+ ...G,
466
503
  contractedVolume: e.target.value
467
504
  }),
468
505
  placeholder: "500000"
469
506
  })]
470
- }), /* @__PURE__ */ m("div", {
507
+ }), /* @__PURE__ */ y("div", {
471
508
  className: "grid gap-1.5",
472
- children: [/* @__PURE__ */ p(_, {
509
+ children: [/* @__PURE__ */ v(S, {
473
510
  htmlFor: "deliveryLocation",
474
511
  children: "Delivery location"
475
- }), /* @__PURE__ */ p(g, {
512
+ }), /* @__PURE__ */ v(x, {
476
513
  id: "deliveryLocation",
477
- value: K.deliveryLocation,
478
- onChange: (e) => q({
479
- ...K,
514
+ value: G.deliveryLocation,
515
+ onChange: (e) => K({
516
+ ...G,
480
517
  deliveryLocation: e.target.value
481
518
  }),
482
519
  placeholder: "Rotterdam"
483
520
  })]
484
521
  })]
485
522
  }),
486
- /* @__PURE__ */ m("div", {
523
+ /* @__PURE__ */ y("div", {
487
524
  className: "grid gap-2 sm:grid-cols-2",
488
- children: [/* @__PURE__ */ m("div", {
525
+ children: [/* @__PURE__ */ y("div", {
489
526
  className: "grid gap-1.5",
490
- children: [/* @__PURE__ */ p(_, {
527
+ children: [/* @__PURE__ */ v(S, {
491
528
  htmlFor: "startDate",
492
529
  children: "Start date"
493
- }), /* @__PURE__ */ p(g, {
530
+ }), /* @__PURE__ */ v(x, {
494
531
  id: "startDate",
495
532
  type: "date",
496
- value: K.startDate,
497
- onChange: (e) => q({
498
- ...K,
533
+ value: G.startDate,
534
+ onChange: (e) => K({
535
+ ...G,
499
536
  startDate: e.target.value
500
537
  })
501
538
  })]
502
- }), /* @__PURE__ */ m("div", {
539
+ }), /* @__PURE__ */ y("div", {
503
540
  className: "grid gap-1.5",
504
- children: [/* @__PURE__ */ p(_, {
541
+ children: [/* @__PURE__ */ v(S, {
505
542
  htmlFor: "endDate",
506
543
  children: "End date"
507
- }), /* @__PURE__ */ p(g, {
544
+ }), /* @__PURE__ */ v(x, {
508
545
  id: "endDate",
509
546
  type: "date",
510
- value: K.endDate,
511
- onChange: (e) => q({
512
- ...K,
547
+ value: G.endDate,
548
+ onChange: (e) => K({
549
+ ...G,
513
550
  endDate: e.target.value
514
551
  })
515
552
  })]
516
553
  })]
517
554
  }),
518
- /* @__PURE__ */ m("div", {
555
+ /* @__PURE__ */ y("div", {
519
556
  className: "grid gap-1.5",
520
- children: [/* @__PURE__ */ p(_, {
557
+ children: [/* @__PURE__ */ v(S, {
521
558
  htmlFor: "notes",
522
559
  children: "Notes"
523
- }), /* @__PURE__ */ p(le, {
560
+ }), /* @__PURE__ */ v(fe, {
524
561
  id: "notes",
525
562
  rows: 2,
526
- value: K.notes,
527
- onChange: (e) => q({
528
- ...K,
563
+ value: G.notes,
564
+ onChange: (e) => K({
565
+ ...G,
529
566
  notes: e.target.value
530
567
  }),
531
568
  placeholder: "Optional context about this contract."
532
569
  })]
533
570
  }),
534
- J && /* @__PURE__ */ p("p", {
571
+ q && /* @__PURE__ */ v("p", {
535
572
  className: "text-sm text-status-error-text",
536
- children: J
573
+ children: q
537
574
  })
538
575
  ]
539
- }),
540
- /* @__PURE__ */ m(x, { children: [/* @__PURE__ */ p(h, {
576
+ }), /* @__PURE__ */ y(le, { children: [/* @__PURE__ */ v(b, {
577
+ type: "button",
541
578
  variant: "outline",
542
- onClick: () => G(!1),
543
- children: "Cancel"
544
- }), /* @__PURE__ */ p(h, {
545
- onClick: async () => {
546
- if (!K.reference.trim()) {
547
- Y("Contract reference is required.");
548
- return;
549
- }
550
- if (!K.counterparty.trim()) {
551
- Y("Counterparty is required.");
552
- return;
553
- }
554
- Y(null);
555
- try {
556
- let e = await Z.mutateAsync({
557
- reference: K.reference.trim(),
558
- counterparty: K.counterparty.trim(),
559
- commodity: K.commodity,
560
- side: K.side,
561
- pricingBasis: K.pricingBasis,
562
- pricePerUnit: K.pricePerUnit ? Number(K.pricePerUnit) : null,
563
- priceIndex: K.priceIndex.trim() || null,
564
- currency: K.currency.trim() || "USD",
565
- contractedVolume: K.contractedVolume ? Number(K.contractedVolume) : null,
566
- unit: K.unit,
567
- deliveryLocation: K.deliveryLocation.trim() || null,
568
- startDate: K.startDate ? new Date(K.startDate).toISOString() : null,
569
- endDate: K.endDate ? new Date(K.endDate).toISOString() : null,
570
- notes: K.notes.trim() || null
571
- });
572
- G(!1), $(), F(`contracts/${e.id}`);
573
- } catch (e) {
574
- Y(e instanceof Error ? e.message : "Failed to create contract.");
575
- }
579
+ onClick: () => {
580
+ W(!1), $();
576
581
  },
577
- disabled: Z.isPending,
578
- children: Z.isPending ? "Creating…" : "Create contract"
579
- })] })
580
- ] })
582
+ children: "Cancel"
583
+ }), /* @__PURE__ */ v(b, {
584
+ type: "submit",
585
+ disabled: X.isPending,
586
+ children: X.isPending ? "Creating…" : "Create contract"
587
+ })] })]
588
+ })] })
581
589
  })
582
590
  ]
583
591
  });
584
592
  }
585
593
  //#endregion
586
- export { R as ContractsPage };
594
+ export { L as ContractsPage };
587
595
 
588
596
  //# sourceMappingURL=ContractsPage.js.map