@burdenoff/microfe-healthybowl 2026.714.6 → 2026.714.8
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/healthybowl/HealthyBowlRoutes.js +135 -95
- package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlAccounting.js +316 -0
- package/dist/healthybowl/hooks/useHealthyBowlAccounting.js.map +1 -0
- package/dist/healthybowl/hooks/useWeatherIntelligence.js +224 -0
- package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -0
- package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js +297 -0
- package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/ChartOfAccountsPage.js +233 -0
- package/dist/healthybowl/pages/financial/ChartOfAccountsPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/CostByCropPage.js +365 -0
- package/dist/healthybowl/pages/financial/CostByCropPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/FarmAccountingPage.js +384 -0
- package/dist/healthybowl/pages/financial/FarmAccountingPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/FinancialDashboardPage.js +32 -16
- package/dist/healthybowl/pages/financial/FinancialDashboardPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +221 -0
- package/dist/healthybowl/pages/financial/GeneralLedgerPage.js.map +1 -0
- package/dist/healthybowl/pages/financial/JournalEntryModal.js +261 -0
- package/dist/healthybowl/pages/financial/JournalEntryModal.js.map +1 -0
- package/dist/healthybowl/pages/financial/ProfitLossPage.js +202 -0
- package/dist/healthybowl/pages/financial/ProfitLossPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js +258 -0
- package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +255 -0
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js +387 -0
- package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js.map +1 -0
- package/dist/healthybowl/pages/weather/WeatherHistoryPage.js +313 -114
- package/dist/healthybowl/pages/weather/WeatherHistoryPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js +554 -213
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +457 -0
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -0
- package/dist/healthybowl/utils/download.js +11 -0
- package/dist/healthybowl/utils/download.js.map +1 -0
- package/dist/healthybowl/utils/helpers.js +11 -8
- package/dist/healthybowl/utils/helpers.js.map +1 -1
- package/dist/healthybowl/utils/period.js +15 -0
- package/dist/healthybowl/utils/period.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
|
|
2
|
+
import { useCallback as t, useMemo as n } from "react";
|
|
3
|
+
import { gql as r } from "@apollo/client";
|
|
4
|
+
import { useMutation as i, useQuery as a } from "@apollo/client/react";
|
|
5
|
+
//#region src/healthybowl/hooks/useHealthyBowlAccounting.ts
|
|
6
|
+
var o = "00000000-0000-0000-0000-000000000001", s = "id code name accountType normalBalance description isActive isSystem sortOrder balance createdAt updatedAt", c = "id entryNumber date memo reference status source totalDebit totalCredit balanced billingOrderId billingSyncStatus postedAt lines { id accountId accountCode accountName accountType description debit credit costCenterId costCenterLabel lineOrder } createdAt updatedAt", l = "rows { id entryId entryNumber date accountCode accountName accountType description reference debit credit runningBalance costCenterLabel } totalDebit totalCredit rowCount hasMore", u = "periodLabel currency income { code name amount } expenses { code name amount } totalRevenue totalExpenses netProfit grossMarginPct generatedAt", d = "id code label kind refType refId season yieldQuantity yieldUnit isActive createdAt updatedAt", f = "rows { costCenterId code label kind yieldQuantity yieldUnit totalCost revenue costPerKg revenuePerKg grossMarginPct } allocation { label amount percent } totalRevenue totalCost grossMarginPct bestMarginLabel bestMarginPct", p = "integrations { id provider status displayName endpoint organizationRef lastSyncedAt entriesPushed autoSyncDaily pushInvoices syncCoaMapping } syncLogs { id provider entriesCount status message batchRef syncedAt } autoSyncDaily pushInvoices syncCoaMapping", m = r`query HbChartOfAccounts($context: ContextInput!, $accountType: String, $activeOnly: Boolean) {
|
|
7
|
+
getHealthyBowlChartOfAccounts(context: $context, accountType: $accountType, activeOnly: $activeOnly) { ${s} } }`, h = r`query HbGeneralLedger($context: ContextInput!, $accountType: String, $accountId: ID, $startDate: String, $endDate: String, $search: String, $limit: Int, $offset: Int) {
|
|
8
|
+
getHealthyBowlGeneralLedger(context: $context, accountType: $accountType, accountId: $accountId, startDate: $startDate, endDate: $endDate, search: $search, limit: $limit, offset: $offset) { ${l} } }`, g = r`query HbJournalEntries($context: ContextInput!, $status: String, $startDate: String, $endDate: String, $limit: Int, $offset: Int) {
|
|
9
|
+
getHealthyBowlJournalEntries(context: $context, status: $status, startDate: $startDate, endDate: $endDate, limit: $limit, offset: $offset) { ${c} } }`, _ = r`query HbProfitAndLoss($context: ContextInput!, $startDate: String!, $endDate: String!) {
|
|
10
|
+
getHealthyBowlProfitAndLoss(context: $context, startDate: $startDate, endDate: $endDate) { ${u} } }`, ee = r`
|
|
11
|
+
query HbPnlExport($context: ContextInput!, $startDate: String!, $endDate: String!, $format: String!) {
|
|
12
|
+
getHealthyBowlProfitAndLossExport(context: $context, startDate: $startDate, endDate: $endDate, format: $format) {
|
|
13
|
+
format
|
|
14
|
+
filename
|
|
15
|
+
mimeType
|
|
16
|
+
contentBase64
|
|
17
|
+
byteSize
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`, v = r`query HbCostByCrop($context: ContextInput!, $startDate: String, $endDate: String, $kind: String) {
|
|
21
|
+
getHealthyBowlCostByCrop(context: $context, startDate: $startDate, endDate: $endDate, kind: $kind) { ${f} } }`, y = r`query HbCostCenters($context: ContextInput!, $kind: String, $activeOnly: Boolean) {
|
|
22
|
+
getHealthyBowlCostCenters(context: $context, kind: $kind, activeOnly: $activeOnly) { ${d} } }`, b = r`query HbAccountingIntegrations($context: ContextInput!) {
|
|
23
|
+
getHealthyBowlAccountingIntegrations(context: $context) { ${p} } }`, x = r`mutation HbEnsureCoa($context: ContextInput!) { ensureHealthyBowlChartOfAccounts(context: $context) { ${s} } }`, S = r`mutation HbCreateAccount($input: CreateHealthyBowlLedgerAccountInput!) { createHealthyBowlLedgerAccount(input: $input) { ${s} } }`, C = r`mutation HbUpdateAccount($input: UpdateHealthyBowlLedgerAccountInput!) { updateHealthyBowlLedgerAccount(input: $input) { ${s} } }`, w = r`
|
|
24
|
+
mutation HbDeleteAccount($id: ID!, $context: ContextInput!) {
|
|
25
|
+
deleteHealthyBowlLedgerAccount(id: $id, context: $context)
|
|
26
|
+
}
|
|
27
|
+
`, T = r`mutation HbPostEntry($input: PostHealthyBowlJournalEntryInput!) { postHealthyBowlJournalEntry(input: $input) { ${c} } }`, E = r`mutation HbSaveDraft($input: PostHealthyBowlJournalEntryInput!) { saveHealthyBowlJournalEntryDraft(input: $input) { ${c} } }`, D = r`mutation HbVoidEntry($id: ID!, $context: ContextInput!) { voidHealthyBowlJournalEntry(id: $id, context: $context) { ${c} } }`, te = r`mutation HbPushBilling($id: ID!, $context: ContextInput!) { pushHealthyBowlJournalEntryToBilling(id: $id, context: $context) { ${c} } }`, O = r`mutation HbCreateCostCenter($input: CreateHealthyBowlCostCenterInput!) { createHealthyBowlCostCenter(input: $input) { ${d} } }`, k = r`mutation HbUpdateCostCenter($input: UpdateHealthyBowlCostCenterInput!) { updateHealthyBowlCostCenter(input: $input) { ${d} } }`, A = r`
|
|
28
|
+
mutation HbDeleteCostCenter($id: ID!, $context: ContextInput!) {
|
|
29
|
+
deleteHealthyBowlCostCenter(id: $id, context: $context)
|
|
30
|
+
}
|
|
31
|
+
`, ne = r`
|
|
32
|
+
mutation HbConnect($input: ConnectHealthyBowlAccountingIntegrationInput!) {
|
|
33
|
+
connectHealthyBowlAccountingIntegration(input: $input) {
|
|
34
|
+
id
|
|
35
|
+
provider
|
|
36
|
+
status
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`, re = r`
|
|
40
|
+
mutation HbDisconnect($provider: String!, $context: ContextInput!) {
|
|
41
|
+
disconnectHealthyBowlAccountingIntegration(provider: $provider, context: $context) {
|
|
42
|
+
id
|
|
43
|
+
provider
|
|
44
|
+
status
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`, ie = r`mutation HbSyncSettings($input: UpdateHealthyBowlAccountingSyncSettingsInput!) { updateHealthyBowlAccountingSyncSettings(input: $input) { ${p} } }`, j = r`
|
|
48
|
+
mutation HbSync($input: SyncHealthyBowlAccountingInput!) {
|
|
49
|
+
syncHealthyBowlAccountingIntegration(input: $input) {
|
|
50
|
+
provider
|
|
51
|
+
status
|
|
52
|
+
entriesCount
|
|
53
|
+
message
|
|
54
|
+
log {
|
|
55
|
+
id
|
|
56
|
+
provider
|
|
57
|
+
entriesCount
|
|
58
|
+
status
|
|
59
|
+
message
|
|
60
|
+
batchRef
|
|
61
|
+
syncedAt
|
|
62
|
+
}
|
|
63
|
+
integration {
|
|
64
|
+
id
|
|
65
|
+
provider
|
|
66
|
+
status
|
|
67
|
+
entriesPushed
|
|
68
|
+
lastSyncedAt
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
function M(r = {}) {
|
|
74
|
+
let { workspaceId: s } = e(), c = s || o, l = n(() => ({ workspaceId: c }), [c]), u = t((e) => ({
|
|
75
|
+
...e,
|
|
76
|
+
context: l
|
|
77
|
+
}), [l]), d = a(m, {
|
|
78
|
+
variables: {
|
|
79
|
+
context: l,
|
|
80
|
+
accountType: r.chartOfAccountsType ?? null,
|
|
81
|
+
activeOnly: !1
|
|
82
|
+
},
|
|
83
|
+
fetchPolicy: "cache-and-network",
|
|
84
|
+
skip: !r.chartOfAccounts
|
|
85
|
+
}), f = a(h, {
|
|
86
|
+
variables: {
|
|
87
|
+
context: l,
|
|
88
|
+
...r.ledgerFilters
|
|
89
|
+
},
|
|
90
|
+
fetchPolicy: "cache-and-network",
|
|
91
|
+
skip: !r.generalLedger
|
|
92
|
+
}), p = a(g, {
|
|
93
|
+
variables: {
|
|
94
|
+
context: l,
|
|
95
|
+
limit: 50
|
|
96
|
+
},
|
|
97
|
+
fetchPolicy: "cache-and-network",
|
|
98
|
+
skip: !r.journalEntries
|
|
99
|
+
}), M = a(_, {
|
|
100
|
+
variables: {
|
|
101
|
+
context: l,
|
|
102
|
+
startDate: r.pnlRange?.startDate ?? "",
|
|
103
|
+
endDate: r.pnlRange?.endDate ?? ""
|
|
104
|
+
},
|
|
105
|
+
fetchPolicy: "cache-and-network",
|
|
106
|
+
skip: !r.profitAndLoss || !r.pnlRange
|
|
107
|
+
}), N = a(v, {
|
|
108
|
+
variables: {
|
|
109
|
+
context: l,
|
|
110
|
+
startDate: r.costByCropParams?.startDate ?? null,
|
|
111
|
+
endDate: r.costByCropParams?.endDate ?? null,
|
|
112
|
+
kind: r.costByCropParams?.kind ?? null
|
|
113
|
+
},
|
|
114
|
+
fetchPolicy: "cache-and-network",
|
|
115
|
+
skip: !r.costByCrop
|
|
116
|
+
}), P = a(y, {
|
|
117
|
+
variables: {
|
|
118
|
+
context: l,
|
|
119
|
+
activeOnly: !1
|
|
120
|
+
},
|
|
121
|
+
fetchPolicy: "cache-and-network",
|
|
122
|
+
skip: !r.costCenters
|
|
123
|
+
}), F = a(b, {
|
|
124
|
+
variables: { context: l },
|
|
125
|
+
fetchPolicy: "cache-and-network",
|
|
126
|
+
skip: !r.integrations
|
|
127
|
+
}), I = t(async () => {
|
|
128
|
+
let e = [];
|
|
129
|
+
r.chartOfAccounts && e.push(d.refetch()), r.generalLedger && e.push(f.refetch()), r.journalEntries && e.push(p.refetch()), r.profitAndLoss && r.pnlRange && e.push(M.refetch()), r.costByCrop && e.push(N.refetch()), r.costCenters && e.push(P.refetch()), r.integrations && e.push(F.refetch()), await Promise.all(e);
|
|
130
|
+
}, [
|
|
131
|
+
r,
|
|
132
|
+
d,
|
|
133
|
+
f,
|
|
134
|
+
p,
|
|
135
|
+
M,
|
|
136
|
+
N,
|
|
137
|
+
P,
|
|
138
|
+
F
|
|
139
|
+
]), [L] = i(x), [R] = i(S), [z] = i(C), [B] = i(w), [V] = i(T), [H] = i(E), [U] = i(D), [W] = i(te), [G] = i(O), [K] = i(k), [q] = i(A), [J] = i(ne), [Y] = i(re), [X] = i(ie), [Z] = i(j), [Q] = i(ee), ae = t(async () => {
|
|
140
|
+
let e = await L({ variables: { context: l } });
|
|
141
|
+
if (e.error) throw e.error;
|
|
142
|
+
return await I(), e.data?.ensureHealthyBowlChartOfAccounts ?? [];
|
|
143
|
+
}, [
|
|
144
|
+
L,
|
|
145
|
+
l,
|
|
146
|
+
I
|
|
147
|
+
]), oe = t(async (e) => {
|
|
148
|
+
let t = await R({ variables: { input: u(e) } });
|
|
149
|
+
if (t.error) throw t.error;
|
|
150
|
+
await I();
|
|
151
|
+
}, [
|
|
152
|
+
R,
|
|
153
|
+
u,
|
|
154
|
+
I
|
|
155
|
+
]), se = t(async (e) => {
|
|
156
|
+
let t = await z({ variables: { input: u(e) } });
|
|
157
|
+
if (t.error) throw t.error;
|
|
158
|
+
await I();
|
|
159
|
+
}, [
|
|
160
|
+
z,
|
|
161
|
+
u,
|
|
162
|
+
I
|
|
163
|
+
]), ce = t(async (e) => {
|
|
164
|
+
let t = await B({ variables: {
|
|
165
|
+
id: e,
|
|
166
|
+
context: l
|
|
167
|
+
} });
|
|
168
|
+
if (t.error) throw t.error;
|
|
169
|
+
await I();
|
|
170
|
+
}, [
|
|
171
|
+
B,
|
|
172
|
+
l,
|
|
173
|
+
I
|
|
174
|
+
]), le = t(async (e) => {
|
|
175
|
+
let t = await V({ variables: { input: u(e) } });
|
|
176
|
+
if (t.error) throw t.error;
|
|
177
|
+
return await I(), t.data?.postHealthyBowlJournalEntry ?? null;
|
|
178
|
+
}, [
|
|
179
|
+
V,
|
|
180
|
+
u,
|
|
181
|
+
I
|
|
182
|
+
]), ue = t(async (e) => {
|
|
183
|
+
let t = await H({ variables: { input: u(e) } });
|
|
184
|
+
if (t.error) throw t.error;
|
|
185
|
+
return await I(), t.data?.saveHealthyBowlJournalEntryDraft ?? null;
|
|
186
|
+
}, [
|
|
187
|
+
H,
|
|
188
|
+
u,
|
|
189
|
+
I
|
|
190
|
+
]), de = t(async (e) => {
|
|
191
|
+
let t = await U({ variables: {
|
|
192
|
+
id: e,
|
|
193
|
+
context: l
|
|
194
|
+
} });
|
|
195
|
+
if (t.error) throw t.error;
|
|
196
|
+
await I();
|
|
197
|
+
}, [
|
|
198
|
+
U,
|
|
199
|
+
l,
|
|
200
|
+
I
|
|
201
|
+
]), fe = t(async (e) => {
|
|
202
|
+
let t = await W({ variables: {
|
|
203
|
+
id: e,
|
|
204
|
+
context: l
|
|
205
|
+
} });
|
|
206
|
+
if (t.error) throw t.error;
|
|
207
|
+
return await I(), t.data?.pushHealthyBowlJournalEntryToBilling ?? null;
|
|
208
|
+
}, [
|
|
209
|
+
W,
|
|
210
|
+
l,
|
|
211
|
+
I
|
|
212
|
+
]), pe = t(async (e) => {
|
|
213
|
+
let t = await G({ variables: { input: u(e) } });
|
|
214
|
+
if (t.error) throw t.error;
|
|
215
|
+
await I();
|
|
216
|
+
}, [
|
|
217
|
+
G,
|
|
218
|
+
u,
|
|
219
|
+
I
|
|
220
|
+
]), $ = t(async (e) => {
|
|
221
|
+
let t = await K({ variables: { input: u(e) } });
|
|
222
|
+
if (t.error) throw t.error;
|
|
223
|
+
await I();
|
|
224
|
+
}, [
|
|
225
|
+
K,
|
|
226
|
+
u,
|
|
227
|
+
I
|
|
228
|
+
]), me = t(async (e) => {
|
|
229
|
+
let t = await q({ variables: {
|
|
230
|
+
id: e,
|
|
231
|
+
context: l
|
|
232
|
+
} });
|
|
233
|
+
if (t.error) throw t.error;
|
|
234
|
+
await I();
|
|
235
|
+
}, [
|
|
236
|
+
q,
|
|
237
|
+
l,
|
|
238
|
+
I
|
|
239
|
+
]), he = t(async (e) => {
|
|
240
|
+
let t = await J({ variables: { input: u(e) } });
|
|
241
|
+
if (t.error) throw t.error;
|
|
242
|
+
await I();
|
|
243
|
+
}, [
|
|
244
|
+
J,
|
|
245
|
+
u,
|
|
246
|
+
I
|
|
247
|
+
]), ge = t(async (e) => {
|
|
248
|
+
let t = await Y({ variables: {
|
|
249
|
+
provider: e,
|
|
250
|
+
context: l
|
|
251
|
+
} });
|
|
252
|
+
if (t.error) throw t.error;
|
|
253
|
+
await I();
|
|
254
|
+
}, [
|
|
255
|
+
Y,
|
|
256
|
+
l,
|
|
257
|
+
I
|
|
258
|
+
]), _e = t(async (e) => {
|
|
259
|
+
let t = await X({ variables: { input: u(e) } });
|
|
260
|
+
if (t.error) throw t.error;
|
|
261
|
+
await I();
|
|
262
|
+
}, [
|
|
263
|
+
X,
|
|
264
|
+
u,
|
|
265
|
+
I
|
|
266
|
+
]), ve = t(async (e) => {
|
|
267
|
+
let t = await Z({ variables: { input: u({ provider: e }) } });
|
|
268
|
+
if (t.error) throw t.error;
|
|
269
|
+
return await I(), t.data?.syncHealthyBowlAccountingIntegration ?? null;
|
|
270
|
+
}, [
|
|
271
|
+
Z,
|
|
272
|
+
u,
|
|
273
|
+
I
|
|
274
|
+
]), ye = t(async (e, t, n) => {
|
|
275
|
+
let r = await Q({ variables: {
|
|
276
|
+
context: l,
|
|
277
|
+
startDate: e,
|
|
278
|
+
endDate: t,
|
|
279
|
+
format: n
|
|
280
|
+
} });
|
|
281
|
+
if (r.error) throw r.error;
|
|
282
|
+
return r.data?.getHealthyBowlProfitAndLossExport ?? null;
|
|
283
|
+
}, [Q, l]);
|
|
284
|
+
return {
|
|
285
|
+
chartOfAccounts: d.data?.getHealthyBowlChartOfAccounts ?? [],
|
|
286
|
+
generalLedger: f.data?.getHealthyBowlGeneralLedger ?? null,
|
|
287
|
+
journalEntries: p.data?.getHealthyBowlJournalEntries ?? [],
|
|
288
|
+
profitAndLoss: M.data?.getHealthyBowlProfitAndLoss ?? null,
|
|
289
|
+
costByCrop: N.data?.getHealthyBowlCostByCrop ?? null,
|
|
290
|
+
costCenters: P.data?.getHealthyBowlCostCenters ?? [],
|
|
291
|
+
integrations: F.data?.getHealthyBowlAccountingIntegrations ?? null,
|
|
292
|
+
loading: d.loading || f.loading || p.loading || M.loading || N.loading || P.loading || F.loading,
|
|
293
|
+
error: d.error || f.error || p.error || M.error || N.error || P.error || F.error || null,
|
|
294
|
+
reconcile: I,
|
|
295
|
+
ensureChartOfAccounts: ae,
|
|
296
|
+
createAccount: oe,
|
|
297
|
+
updateAccount: se,
|
|
298
|
+
deleteAccount: ce,
|
|
299
|
+
postJournalEntry: le,
|
|
300
|
+
saveDraft: ue,
|
|
301
|
+
voidEntry: de,
|
|
302
|
+
pushEntryToBilling: fe,
|
|
303
|
+
createCostCenter: pe,
|
|
304
|
+
updateCostCenter: $,
|
|
305
|
+
deleteCostCenter: me,
|
|
306
|
+
connectIntegration: he,
|
|
307
|
+
disconnectIntegration: ge,
|
|
308
|
+
updateSyncSettings: _e,
|
|
309
|
+
syncIntegration: ve,
|
|
310
|
+
exportProfitAndLoss: ye
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
//#endregion
|
|
314
|
+
export { M as useHealthyBowlAccounting };
|
|
315
|
+
|
|
316
|
+
//# sourceMappingURL=useHealthyBowlAccounting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHealthyBowlAccounting.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlAccounting.ts"],"sourcesContent":["/**\n * Farm Accounting — data hook (BOFF-2888 · roadmap 16).\n *\n * Chart of accounts, double-entry general ledger, Profit & Loss (+ CSV/PDF export),\n * cost-by-crop / per-animal profitability, and Tally/Zoho/QuickBooks integrations.\n * Documents are declared inline with `gql` (not `src/operations/wspace/*.graphql`)\n * because codegen validates operations against the committed `graphql/wspace.graphql`\n * snapshot, which can't know about these fields until the accounting subgraph is live\n * in the supergraph — the same escape hatch `useHealthyBowlDistribution` uses. Types\n * mirror `wspace-healthybowl-svc/src/modules/healthybowl/schema/accounting.gql`.\n *\n * Reads use `cache-and-network`; pages opt into only the sections they render (all\n * default off). Every write throws on error then reconciles the reads it invalidates.\n */\nimport { useCallback, useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\nconst FALLBACK_WORKSPACE_ID = '00000000-0000-0000-0000-000000000001';\n\n// ── types (mirror accounting.gql) ─────────────────────────────────────────────\nexport type AccountType = 'ASSET' | 'LIABILITY' | 'EQUITY' | 'INCOME' | 'EXPENSE';\nexport type AccountingProvider = 'TALLY' | 'ZOHO_BOOKS' | 'QUICKBOOKS';\nexport type CostCenterKind = 'CROP' | 'ANIMAL' | 'OTHER';\n\nexport interface LedgerAccount {\n id: string;\n code: string;\n name: string;\n accountType: string;\n normalBalance: string;\n description: string | null;\n isActive: boolean;\n isSystem: boolean;\n sortOrder: number;\n balance: number;\n createdAt: string;\n updatedAt: string;\n}\nexport interface JournalLine {\n id: string;\n accountId: string;\n accountCode: string;\n accountName: string;\n accountType: string;\n description: string | null;\n debit: number;\n credit: number;\n costCenterId: string | null;\n costCenterLabel: string | null;\n lineOrder: number;\n}\nexport interface JournalEntry {\n id: string;\n entryNumber: string;\n date: string;\n memo: string;\n reference: string | null;\n status: string;\n source: string;\n totalDebit: number;\n totalCredit: number;\n balanced: boolean;\n billingOrderId: string | null;\n billingSyncStatus: string | null;\n postedAt: string | null;\n lines: JournalLine[];\n createdAt: string;\n updatedAt: string;\n}\nexport interface GeneralLedgerRow {\n id: string;\n entryId: string;\n entryNumber: string;\n date: string;\n accountCode: string;\n accountName: string;\n accountType: string;\n description: string | null;\n reference: string | null;\n debit: number;\n credit: number;\n runningBalance: number;\n costCenterLabel: string | null;\n}\nexport interface GeneralLedger {\n rows: GeneralLedgerRow[];\n totalDebit: number;\n totalCredit: number;\n rowCount: number;\n hasMore: boolean;\n}\nexport interface PnlLine {\n code: string;\n name: string;\n amount: number;\n}\nexport interface ProfitAndLoss {\n periodLabel: string;\n currency: string;\n income: PnlLine[];\n expenses: PnlLine[];\n totalRevenue: number;\n totalExpenses: number;\n netProfit: number;\n grossMarginPct: number;\n generatedAt: string;\n}\nexport interface AccountingExport {\n format: string;\n filename: string;\n mimeType: string;\n contentBase64: string;\n byteSize: number;\n}\nexport interface CostCenter {\n id: string;\n code: string;\n label: string;\n kind: string;\n refType: string | null;\n refId: string | null;\n season: string | null;\n yieldQuantity: number;\n yieldUnit: string;\n isActive: boolean;\n createdAt: string;\n updatedAt: string;\n}\nexport interface CropProfitability {\n costCenterId: string;\n code: string;\n label: string;\n kind: string;\n yieldQuantity: number;\n yieldUnit: string;\n totalCost: number;\n revenue: number;\n costPerKg: number | null;\n revenuePerKg: number | null;\n grossMarginPct: number | null;\n}\nexport interface CostAllocationSlice {\n label: string;\n amount: number;\n percent: number;\n}\nexport interface CostByCropReport {\n rows: CropProfitability[];\n allocation: CostAllocationSlice[];\n totalRevenue: number;\n totalCost: number;\n grossMarginPct: number;\n bestMarginLabel: string | null;\n bestMarginPct: number | null;\n}\nexport interface AccountingIntegration {\n id: string;\n provider: string;\n status: string;\n displayName: string | null;\n endpoint: string | null;\n organizationRef: string | null;\n lastSyncedAt: string | null;\n entriesPushed: number;\n autoSyncDaily: boolean;\n pushInvoices: boolean;\n syncCoaMapping: boolean;\n}\nexport interface AccountingSyncLog {\n id: string;\n provider: string;\n entriesCount: number;\n status: string;\n message: string | null;\n batchRef: string | null;\n syncedAt: string;\n}\nexport interface IntegrationsPayload {\n integrations: AccountingIntegration[];\n syncLogs: AccountingSyncLog[];\n autoSyncDaily: boolean;\n pushInvoices: boolean;\n syncCoaMapping: boolean;\n}\n\ninterface HbContext {\n workspaceId: string;\n}\nexport interface JournalLineInput {\n accountId?: string | null;\n accountCode?: string | null;\n description?: string | null;\n debit?: number;\n credit?: number;\n costCenterId?: string | null;\n}\n\n// ── fragments ──────────────────────────────────────────────────────────────────\nconst ACCOUNT_FIELDS = `id code name accountType normalBalance description isActive isSystem sortOrder balance createdAt updatedAt`;\nconst LINE_FIELDS = `id accountId accountCode accountName accountType description debit credit costCenterId costCenterLabel lineOrder`;\nconst ENTRY_FIELDS = `id entryNumber date memo reference status source totalDebit totalCredit balanced billingOrderId billingSyncStatus postedAt lines { ${LINE_FIELDS} } createdAt updatedAt`;\nconst GL_FIELDS = `rows { id entryId entryNumber date accountCode accountName accountType description reference debit credit runningBalance costCenterLabel } totalDebit totalCredit rowCount hasMore`;\nconst PNL_FIELDS = `periodLabel currency income { code name amount } expenses { code name amount } totalRevenue totalExpenses netProfit grossMarginPct generatedAt`;\nconst COST_CENTER_FIELDS = `id code label kind refType refId season yieldQuantity yieldUnit isActive createdAt updatedAt`;\nconst COST_BY_CROP_FIELDS = `rows { costCenterId code label kind yieldQuantity yieldUnit totalCost revenue costPerKg revenuePerKg grossMarginPct } allocation { label amount percent } totalRevenue totalCost grossMarginPct bestMarginLabel bestMarginPct`;\nconst INTEGRATIONS_FIELDS = `integrations { id provider status displayName endpoint organizationRef lastSyncedAt entriesPushed autoSyncDaily pushInvoices syncCoaMapping } syncLogs { id provider entriesCount status message batchRef syncedAt } autoSyncDaily pushInvoices syncCoaMapping`;\n\n// ── queries ─────────────────────────────────────────────────────────────────────\nconst GET_CHART_OF_ACCOUNTS = gql`query HbChartOfAccounts($context: ContextInput!, $accountType: String, $activeOnly: Boolean) {\n getHealthyBowlChartOfAccounts(context: $context, accountType: $accountType, activeOnly: $activeOnly) { ${ACCOUNT_FIELDS} } }`;\nconst GET_GENERAL_LEDGER = gql`query HbGeneralLedger($context: ContextInput!, $accountType: String, $accountId: ID, $startDate: String, $endDate: String, $search: String, $limit: Int, $offset: Int) {\n getHealthyBowlGeneralLedger(context: $context, accountType: $accountType, accountId: $accountId, startDate: $startDate, endDate: $endDate, search: $search, limit: $limit, offset: $offset) { ${GL_FIELDS} } }`;\nconst GET_JOURNAL_ENTRIES = gql`query HbJournalEntries($context: ContextInput!, $status: String, $startDate: String, $endDate: String, $limit: Int, $offset: Int) {\n getHealthyBowlJournalEntries(context: $context, status: $status, startDate: $startDate, endDate: $endDate, limit: $limit, offset: $offset) { ${ENTRY_FIELDS} } }`;\nconst GET_PROFIT_AND_LOSS = gql`query HbProfitAndLoss($context: ContextInput!, $startDate: String!, $endDate: String!) {\n getHealthyBowlProfitAndLoss(context: $context, startDate: $startDate, endDate: $endDate) { ${PNL_FIELDS} } }`;\nconst GET_PNL_EXPORT = gql`\n query HbPnlExport($context: ContextInput!, $startDate: String!, $endDate: String!, $format: String!) {\n getHealthyBowlProfitAndLossExport(context: $context, startDate: $startDate, endDate: $endDate, format: $format) {\n format\n filename\n mimeType\n contentBase64\n byteSize\n }\n }\n`;\nconst GET_COST_BY_CROP = gql`query HbCostByCrop($context: ContextInput!, $startDate: String, $endDate: String, $kind: String) {\n getHealthyBowlCostByCrop(context: $context, startDate: $startDate, endDate: $endDate, kind: $kind) { ${COST_BY_CROP_FIELDS} } }`;\nconst GET_COST_CENTERS = gql`query HbCostCenters($context: ContextInput!, $kind: String, $activeOnly: Boolean) {\n getHealthyBowlCostCenters(context: $context, kind: $kind, activeOnly: $activeOnly) { ${COST_CENTER_FIELDS} } }`;\nconst GET_INTEGRATIONS = gql`query HbAccountingIntegrations($context: ContextInput!) {\n getHealthyBowlAccountingIntegrations(context: $context) { ${INTEGRATIONS_FIELDS} } }`;\n\n// ── mutations ─────────────────────────────────────────────────────────────────\nconst ENSURE_COA = gql`mutation HbEnsureCoa($context: ContextInput!) { ensureHealthyBowlChartOfAccounts(context: $context) { ${ACCOUNT_FIELDS} } }`;\nconst CREATE_ACCOUNT = gql`mutation HbCreateAccount($input: CreateHealthyBowlLedgerAccountInput!) { createHealthyBowlLedgerAccount(input: $input) { ${ACCOUNT_FIELDS} } }`;\nconst UPDATE_ACCOUNT = gql`mutation HbUpdateAccount($input: UpdateHealthyBowlLedgerAccountInput!) { updateHealthyBowlLedgerAccount(input: $input) { ${ACCOUNT_FIELDS} } }`;\nconst DELETE_ACCOUNT = gql`\n mutation HbDeleteAccount($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlLedgerAccount(id: $id, context: $context)\n }\n`;\nconst POST_ENTRY = gql`mutation HbPostEntry($input: PostHealthyBowlJournalEntryInput!) { postHealthyBowlJournalEntry(input: $input) { ${ENTRY_FIELDS} } }`;\nconst SAVE_DRAFT = gql`mutation HbSaveDraft($input: PostHealthyBowlJournalEntryInput!) { saveHealthyBowlJournalEntryDraft(input: $input) { ${ENTRY_FIELDS} } }`;\nconst VOID_ENTRY = gql`mutation HbVoidEntry($id: ID!, $context: ContextInput!) { voidHealthyBowlJournalEntry(id: $id, context: $context) { ${ENTRY_FIELDS} } }`;\nconst PUSH_TO_BILLING = gql`mutation HbPushBilling($id: ID!, $context: ContextInput!) { pushHealthyBowlJournalEntryToBilling(id: $id, context: $context) { ${ENTRY_FIELDS} } }`;\nconst CREATE_COST_CENTER = gql`mutation HbCreateCostCenter($input: CreateHealthyBowlCostCenterInput!) { createHealthyBowlCostCenter(input: $input) { ${COST_CENTER_FIELDS} } }`;\nconst UPDATE_COST_CENTER = gql`mutation HbUpdateCostCenter($input: UpdateHealthyBowlCostCenterInput!) { updateHealthyBowlCostCenter(input: $input) { ${COST_CENTER_FIELDS} } }`;\nconst DELETE_COST_CENTER = gql`\n mutation HbDeleteCostCenter($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlCostCenter(id: $id, context: $context)\n }\n`;\nconst CONNECT_INTEGRATION = gql`\n mutation HbConnect($input: ConnectHealthyBowlAccountingIntegrationInput!) {\n connectHealthyBowlAccountingIntegration(input: $input) {\n id\n provider\n status\n }\n }\n`;\nconst DISCONNECT_INTEGRATION = gql`\n mutation HbDisconnect($provider: String!, $context: ContextInput!) {\n disconnectHealthyBowlAccountingIntegration(provider: $provider, context: $context) {\n id\n provider\n status\n }\n }\n`;\nconst UPDATE_SYNC_SETTINGS = gql`mutation HbSyncSettings($input: UpdateHealthyBowlAccountingSyncSettingsInput!) { updateHealthyBowlAccountingSyncSettings(input: $input) { ${INTEGRATIONS_FIELDS} } }`;\nconst SYNC_INTEGRATION = gql`\n mutation HbSync($input: SyncHealthyBowlAccountingInput!) {\n syncHealthyBowlAccountingIntegration(input: $input) {\n provider\n status\n entriesCount\n message\n log {\n id\n provider\n entriesCount\n status\n message\n batchRef\n syncedAt\n }\n integration {\n id\n provider\n status\n entriesPushed\n lastSyncedAt\n }\n }\n }\n`;\n\nexport interface UseAccountingOptions {\n chartOfAccounts?: boolean;\n chartOfAccountsType?: string | null;\n generalLedger?: boolean;\n ledgerFilters?: {\n accountType?: string | null;\n accountId?: string | null;\n startDate?: string | null;\n endDate?: string | null;\n search?: string | null;\n limit?: number | null;\n offset?: number | null;\n };\n journalEntries?: boolean;\n profitAndLoss?: boolean;\n pnlRange?: { startDate: string; endDate: string };\n costByCrop?: boolean;\n costByCropParams?: { startDate?: string | null; endDate?: string | null; kind?: string | null };\n costCenters?: boolean;\n integrations?: boolean;\n}\n\nexport function useHealthyBowlAccounting(options: UseAccountingOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const context = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n const withCtx = useCallback(<T extends object>(input: T) => ({ ...input, context }), [context]);\n\n const coaQuery = useQuery<{ getHealthyBowlChartOfAccounts: LedgerAccount[] }>(GET_CHART_OF_ACCOUNTS, {\n variables: { context, accountType: options.chartOfAccountsType ?? null, activeOnly: false },\n fetchPolicy: 'cache-and-network',\n skip: !options.chartOfAccounts,\n });\n const glQuery = useQuery<{ getHealthyBowlGeneralLedger: GeneralLedger }>(GET_GENERAL_LEDGER, {\n variables: { context, ...options.ledgerFilters },\n fetchPolicy: 'cache-and-network',\n skip: !options.generalLedger,\n });\n const entriesQuery = useQuery<{ getHealthyBowlJournalEntries: JournalEntry[] }>(GET_JOURNAL_ENTRIES, {\n variables: { context, limit: 50 },\n fetchPolicy: 'cache-and-network',\n skip: !options.journalEntries,\n });\n const pnlQuery = useQuery<{ getHealthyBowlProfitAndLoss: ProfitAndLoss }>(GET_PROFIT_AND_LOSS, {\n variables: { context, startDate: options.pnlRange?.startDate ?? '', endDate: options.pnlRange?.endDate ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !options.profitAndLoss || !options.pnlRange,\n });\n const cbcQuery = useQuery<{ getHealthyBowlCostByCrop: CostByCropReport }>(GET_COST_BY_CROP, {\n variables: {\n context,\n startDate: options.costByCropParams?.startDate ?? null,\n endDate: options.costByCropParams?.endDate ?? null,\n kind: options.costByCropParams?.kind ?? null,\n },\n fetchPolicy: 'cache-and-network',\n skip: !options.costByCrop,\n });\n const centersQuery = useQuery<{ getHealthyBowlCostCenters: CostCenter[] }>(GET_COST_CENTERS, {\n variables: { context, activeOnly: false },\n fetchPolicy: 'cache-and-network',\n skip: !options.costCenters,\n });\n const integrationsQuery = useQuery<{ getHealthyBowlAccountingIntegrations: IntegrationsPayload }>(GET_INTEGRATIONS, {\n variables: { context },\n fetchPolicy: 'cache-and-network',\n skip: !options.integrations,\n });\n\n const reconcile = useCallback(async () => {\n const jobs: Promise<unknown>[] = [];\n if (options.chartOfAccounts) jobs.push(coaQuery.refetch());\n if (options.generalLedger) jobs.push(glQuery.refetch());\n if (options.journalEntries) jobs.push(entriesQuery.refetch());\n if (options.profitAndLoss && options.pnlRange) jobs.push(pnlQuery.refetch());\n if (options.costByCrop) jobs.push(cbcQuery.refetch());\n if (options.costCenters) jobs.push(centersQuery.refetch());\n if (options.integrations) jobs.push(integrationsQuery.refetch());\n await Promise.all(jobs);\n }, [options, coaQuery, glQuery, entriesQuery, pnlQuery, cbcQuery, centersQuery, integrationsQuery]);\n\n const [ensureCoaM] = useMutation(ENSURE_COA);\n const [createAccountM] = useMutation(CREATE_ACCOUNT);\n const [updateAccountM] = useMutation(UPDATE_ACCOUNT);\n const [deleteAccountM] = useMutation(DELETE_ACCOUNT);\n const [postEntryM] = useMutation(POST_ENTRY);\n const [saveDraftM] = useMutation(SAVE_DRAFT);\n const [voidEntryM] = useMutation(VOID_ENTRY);\n const [pushBillingM] = useMutation(PUSH_TO_BILLING);\n const [createCenterM] = useMutation(CREATE_COST_CENTER);\n const [updateCenterM] = useMutation(UPDATE_COST_CENTER);\n const [deleteCenterM] = useMutation(DELETE_COST_CENTER);\n const [connectM] = useMutation(CONNECT_INTEGRATION);\n const [disconnectM] = useMutation(DISCONNECT_INTEGRATION);\n const [syncSettingsM] = useMutation(UPDATE_SYNC_SETTINGS);\n const [syncM] = useMutation(SYNC_INTEGRATION);\n const [pnlExportM] = useMutation(GET_PNL_EXPORT); // query-shaped, but invoked imperatively via useMutation for on-demand fetch\n\n const ensureChartOfAccounts = useCallback(async () => {\n const res = await ensureCoaM({ variables: { context } });\n if (res.error) throw res.error;\n await reconcile();\n return (\n (res.data as { ensureHealthyBowlChartOfAccounts: LedgerAccount[] } | undefined)\n ?.ensureHealthyBowlChartOfAccounts ?? []\n );\n }, [ensureCoaM, context, reconcile]);\n\n const createAccount = useCallback(\n async (input: {\n code: string;\n name: string;\n accountType: string;\n description?: string | null;\n sortOrder?: number;\n }) => {\n const res = await createAccountM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [createAccountM, withCtx, reconcile]\n );\n const updateAccount = useCallback(\n async (input: {\n id: string;\n name?: string;\n accountType?: string;\n description?: string | null;\n isActive?: boolean;\n sortOrder?: number;\n }) => {\n const res = await updateAccountM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [updateAccountM, withCtx, reconcile]\n );\n const deleteAccount = useCallback(\n async (id: string) => {\n const res = await deleteAccountM({ variables: { id, context } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [deleteAccountM, context, reconcile]\n );\n\n const postJournalEntry = useCallback(\n async (input: {\n date?: string;\n memo: string;\n reference?: string | null;\n source?: string;\n lines: JournalLineInput[];\n }) => {\n const res = await postEntryM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcile();\n return (\n (res.data as { postHealthyBowlJournalEntry: JournalEntry } | undefined)?.postHealthyBowlJournalEntry ?? null\n );\n },\n [postEntryM, withCtx, reconcile]\n );\n const saveDraft = useCallback(\n async (input: {\n date?: string;\n memo: string;\n reference?: string | null;\n source?: string;\n lines: JournalLineInput[];\n }) => {\n const res = await saveDraftM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcile();\n return (\n (res.data as { saveHealthyBowlJournalEntryDraft: JournalEntry } | undefined)\n ?.saveHealthyBowlJournalEntryDraft ?? null\n );\n },\n [saveDraftM, withCtx, reconcile]\n );\n const voidEntry = useCallback(\n async (id: string) => {\n const res = await voidEntryM({ variables: { id, context } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [voidEntryM, context, reconcile]\n );\n const pushEntryToBilling = useCallback(\n async (id: string) => {\n const res = await pushBillingM({ variables: { id, context } });\n if (res.error) throw res.error;\n await reconcile();\n return (\n (res.data as { pushHealthyBowlJournalEntryToBilling: JournalEntry } | undefined)\n ?.pushHealthyBowlJournalEntryToBilling ?? null\n );\n },\n [pushBillingM, context, reconcile]\n );\n\n const createCostCenter = useCallback(\n async (input: {\n code?: string;\n label: string;\n kind: string;\n refType?: string | null;\n refId?: string | null;\n season?: string | null;\n yieldQuantity?: number;\n yieldUnit?: string;\n }) => {\n const res = await createCenterM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [createCenterM, withCtx, reconcile]\n );\n const updateCostCenter = useCallback(\n async (input: {\n id: string;\n label?: string;\n kind?: string;\n season?: string | null;\n yieldQuantity?: number;\n yieldUnit?: string;\n isActive?: boolean;\n }) => {\n const res = await updateCenterM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [updateCenterM, withCtx, reconcile]\n );\n const deleteCostCenter = useCallback(\n async (id: string) => {\n const res = await deleteCenterM({ variables: { id, context } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [deleteCenterM, context, reconcile]\n );\n\n const connectIntegration = useCallback(\n async (input: {\n provider: string;\n displayName?: string | null;\n endpoint?: string | null;\n organizationRef?: string | null;\n }) => {\n const res = await connectM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [connectM, withCtx, reconcile]\n );\n const disconnectIntegration = useCallback(\n async (provider: string) => {\n const res = await disconnectM({ variables: { provider, context } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [disconnectM, context, reconcile]\n );\n const updateSyncSettings = useCallback(\n async (input: { autoSyncDaily?: boolean; pushInvoices?: boolean; syncCoaMapping?: boolean }) => {\n const res = await syncSettingsM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcile();\n },\n [syncSettingsM, withCtx, reconcile]\n );\n const syncIntegration = useCallback(\n async (provider: string) => {\n const res = await syncM({ variables: { input: withCtx({ provider }) } });\n if (res.error) throw res.error;\n await reconcile();\n return (\n (\n res.data as\n | { syncHealthyBowlAccountingIntegration: { status: string; entriesCount: number; message: string } }\n | undefined\n )?.syncHealthyBowlAccountingIntegration ?? null\n );\n },\n [syncM, withCtx, reconcile]\n );\n\n const exportProfitAndLoss = useCallback(\n async (startDate: string, endDate: string, format: 'CSV' | 'PDF'): Promise<AccountingExport | null> => {\n const res = await pnlExportM({ variables: { context, startDate, endDate, format } });\n if (res.error) throw res.error;\n return (\n (res.data as { getHealthyBowlProfitAndLossExport: AccountingExport } | undefined)\n ?.getHealthyBowlProfitAndLossExport ?? null\n );\n },\n [pnlExportM, context]\n );\n\n return {\n // data\n chartOfAccounts: coaQuery.data?.getHealthyBowlChartOfAccounts ?? [],\n generalLedger: glQuery.data?.getHealthyBowlGeneralLedger ?? null,\n journalEntries: entriesQuery.data?.getHealthyBowlJournalEntries ?? [],\n profitAndLoss: pnlQuery.data?.getHealthyBowlProfitAndLoss ?? null,\n costByCrop: cbcQuery.data?.getHealthyBowlCostByCrop ?? null,\n costCenters: centersQuery.data?.getHealthyBowlCostCenters ?? [],\n integrations: integrationsQuery.data?.getHealthyBowlAccountingIntegrations ?? null,\n // status\n loading:\n coaQuery.loading ||\n glQuery.loading ||\n entriesQuery.loading ||\n pnlQuery.loading ||\n cbcQuery.loading ||\n centersQuery.loading ||\n integrationsQuery.loading,\n error:\n coaQuery.error ||\n glQuery.error ||\n entriesQuery.error ||\n pnlQuery.error ||\n cbcQuery.error ||\n centersQuery.error ||\n integrationsQuery.error ||\n null,\n reconcile,\n // mutations\n ensureChartOfAccounts,\n createAccount,\n updateAccount,\n deleteAccount,\n postJournalEntry,\n saveDraft,\n voidEntry,\n pushEntryToBilling,\n createCostCenter,\n updateCostCenter,\n deleteCostCenter,\n connectIntegration,\n disconnectIntegration,\n updateSyncSettings,\n syncIntegration,\n exportProfitAndLoss,\n };\n}\n"],"mappings":";;;;;AAmBA,IAAM,IAAwB,wCAqLxB,IAAiB,8GAEjB,IAAe,6QACf,IAAY,sLACZ,IAAa,kJACb,IAAqB,gGACrB,IAAsB,iOACtB,IAAsB,kQAGtB,IAAwB,CAAG;2GAC0E,EAAe,OACpH,IAAqB,CAAG;kMACoK,EAAU,OACtM,IAAsB,CAAG;iJACkH,EAAa,OACxJ,IAAsB,CAAG;+FACgE,EAAW,OACpG,KAAiB,CAAG;;;;;;;;;;GAWpB,IAAmB,CAAG;yGAC6E,EAAoB,OACvH,IAAmB,CAAG;yFAC6D,EAAmB,OACtG,IAAmB,CAAG;8DACkC,EAAoB,OAG5E,IAAa,CAAG,yGAAyG,EAAe,OACxI,IAAiB,CAAG,4HAA4H,EAAe,OAC/J,IAAiB,CAAG,4HAA4H,EAAe,OAC/J,IAAiB,C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AAa,MAAM,gCAAgC,EAAE;EACrE,eAAe,EAAS,MAAM,+BAA+B;EAC7D,YAAY,EAAS,MAAM,4BAA4B;EACvD,aAAa,EAAa,MAAM,6BAA6B,EAAE;EAC/D,cAAc,EAAkB,MAAM,wCAAwC;EAE9E,SACE,EAAS,WACT,EAAQ,WACR,EAAa,WACb,EAAS,WACT,EAAS,WACT,EAAa,WACb,EAAkB;EACpB,OACE,EAAS,SACT,EAAQ,SACR,EAAa,SACb,EAAS,SACT,EAAS,SACT,EAAa,SACb,EAAkB,SAClB;EACF;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
|
|
2
|
+
import { useCallback as t } from "react";
|
|
3
|
+
import { gql as n } from "@apollo/client";
|
|
4
|
+
import { useLazyQuery as r, useMutation as i, useQuery as a } from "@apollo/client/react";
|
|
5
|
+
//#region src/healthybowl/hooks/useWeatherIntelligence.ts
|
|
6
|
+
var o = "\n startYear\n endYear\n baselineYears\n source\n synced\n lastSyncedAt\n points {\n year\n month\n monthName\n avgTemp\n totalRainfall\n avgHumidity\n }\n baseline {\n month\n monthName\n avgTemp\n tempMin\n tempMax\n avgRainfall\n rainfallMin\n rainfallMax\n }\n", s = "\n id\n ruleId\n ruleName\n alertType\n severity\n title\n advisory\n metric\n observedValue\n threshold\n unit\n channels\n status\n triggeredAt\n handledAt\n snoozedUntil\n", c = "\n inAppEnabled\n smsEnabled\n smsNumber\n emailEnabled\n webhookEnabled\n webhookUrl\n quietHoursEnabled\n quietHoursStart\n quietHoursEnd\n escalateCriticalFrost\n alertLeadTimeHours\n baselineYears\n deviationThresholdPct\n weeklyDigestEmail\n aiAdvisoryEnabled\n advisoryLanguage\n units\n historyStartYear\n historyEndYear\n historyLastSyncedAt\n", l = n`
|
|
7
|
+
query GetHealthyBowlWeatherHistorySeries($context: ContextInput!, $years: Int) {
|
|
8
|
+
getHealthyBowlWeatherHistorySeries(context: $context, years: $years) {
|
|
9
|
+
${o}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`, u = n`
|
|
13
|
+
query GetHealthyBowlWeatherAnomalyReport($context: ContextInput!) {
|
|
14
|
+
getHealthyBowlWeatherAnomalyReport(context: $context) {
|
|
15
|
+
baselineYears
|
|
16
|
+
startYear
|
|
17
|
+
endYear
|
|
18
|
+
currentMonth
|
|
19
|
+
currentMonthName
|
|
20
|
+
rainfallThisMonthMm
|
|
21
|
+
rainfallBaselineMm
|
|
22
|
+
rainfallDeviationPct
|
|
23
|
+
avgTempDeltaC
|
|
24
|
+
frostDaysThisSeason
|
|
25
|
+
frostDaysBaseline
|
|
26
|
+
frostDaysDelta
|
|
27
|
+
firstFrostDate
|
|
28
|
+
baselineFirstFrostDate
|
|
29
|
+
firstFrostDeltaDays
|
|
30
|
+
monthlyRainfall {
|
|
31
|
+
month
|
|
32
|
+
monthName
|
|
33
|
+
currentValue
|
|
34
|
+
baselineAvg
|
|
35
|
+
baselineMin
|
|
36
|
+
baselineMax
|
|
37
|
+
}
|
|
38
|
+
monthlyTemperature {
|
|
39
|
+
month
|
|
40
|
+
monthName
|
|
41
|
+
currentValue
|
|
42
|
+
baselineAvg
|
|
43
|
+
baselineMin
|
|
44
|
+
baselineMax
|
|
45
|
+
}
|
|
46
|
+
callouts {
|
|
47
|
+
id
|
|
48
|
+
title
|
|
49
|
+
severity
|
|
50
|
+
date
|
|
51
|
+
metric
|
|
52
|
+
}
|
|
53
|
+
generatedAt
|
|
54
|
+
source
|
|
55
|
+
synced
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`, d = n`
|
|
59
|
+
query GetHealthyBowlFrostRiskCalendar($context: ContextInput!, $year: Int, $month: Int) {
|
|
60
|
+
getHealthyBowlFrostRiskCalendar(context: $context, year: $year, month: $month) {
|
|
61
|
+
year
|
|
62
|
+
month
|
|
63
|
+
monthName
|
|
64
|
+
frostRiskDayCount
|
|
65
|
+
historicalFirstFrost
|
|
66
|
+
days {
|
|
67
|
+
date
|
|
68
|
+
day
|
|
69
|
+
risk
|
|
70
|
+
label
|
|
71
|
+
detail
|
|
72
|
+
tempMin
|
|
73
|
+
tempMax
|
|
74
|
+
source
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`, f = n`
|
|
79
|
+
query GetHealthyBowlWeatherAlertEvents($context: ContextInput!, $alertType: String, $status: String) {
|
|
80
|
+
getHealthyBowlWeatherAlertEvents(context: $context, alertType: $alertType, status: $status) {
|
|
81
|
+
${s}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
`, p = n`
|
|
85
|
+
query GetHealthyBowlWeatherAlertSettings($context: ContextInput!) {
|
|
86
|
+
getHealthyBowlWeatherAlertSettings(context: $context) {
|
|
87
|
+
${c}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`, m = n`
|
|
91
|
+
mutation SyncHealthyBowlWeatherHistory($context: ContextInput!) {
|
|
92
|
+
syncHealthyBowlWeatherHistory(context: $context) {
|
|
93
|
+
${o}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`, h = n`
|
|
97
|
+
mutation MarkHealthyBowlWeatherAlertHandled($id: ID!, $context: ContextInput!) {
|
|
98
|
+
markHealthyBowlWeatherAlertHandled(id: $id, context: $context) {
|
|
99
|
+
${s}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
`, g = n`
|
|
103
|
+
mutation SnoozeHealthyBowlWeatherAlert($id: ID!, $until: String!, $context: ContextInput!) {
|
|
104
|
+
snoozeHealthyBowlWeatherAlert(id: $id, until: $until, context: $context) {
|
|
105
|
+
${s}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`, _ = n`
|
|
109
|
+
mutation UpsertHealthyBowlWeatherAlertSettings($input: UpsertHealthyBowlWeatherAlertSettingsInput!) {
|
|
110
|
+
upsertHealthyBowlWeatherAlertSettings(input: $input) {
|
|
111
|
+
${c}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
function v(n = {}) {
|
|
116
|
+
let { workspaceId: o } = e(), s = { workspaceId: o }, { years: c } = n, { data: v, loading: y, error: b, refetch: x } = a(l, {
|
|
117
|
+
variables: {
|
|
118
|
+
context: s,
|
|
119
|
+
years: c
|
|
120
|
+
},
|
|
121
|
+
skip: !o,
|
|
122
|
+
fetchPolicy: "cache-and-network",
|
|
123
|
+
notifyOnNetworkStatusChange: !0
|
|
124
|
+
}), { data: S, loading: C, error: w, refetch: T } = a(u, {
|
|
125
|
+
variables: { context: s },
|
|
126
|
+
skip: !o,
|
|
127
|
+
fetchPolicy: "cache-and-network",
|
|
128
|
+
notifyOnNetworkStatusChange: !0
|
|
129
|
+
}), { data: E, loading: D, error: O, refetch: k } = a(d, {
|
|
130
|
+
variables: { context: s },
|
|
131
|
+
skip: !o,
|
|
132
|
+
fetchPolicy: "cache-and-network",
|
|
133
|
+
notifyOnNetworkStatusChange: !0
|
|
134
|
+
}), [A] = r(d, { fetchPolicy: "cache-and-network" }), { data: j, loading: M, error: N, refetch: P } = a(f, {
|
|
135
|
+
variables: { context: s },
|
|
136
|
+
skip: !o,
|
|
137
|
+
fetchPolicy: "cache-and-network",
|
|
138
|
+
notifyOnNetworkStatusChange: !0
|
|
139
|
+
}), [F] = r(f, { fetchPolicy: "cache-and-network" }), { data: I, loading: L, error: R, refetch: z } = a(p, {
|
|
140
|
+
variables: { context: s },
|
|
141
|
+
skip: !o,
|
|
142
|
+
fetchPolicy: "cache-and-network",
|
|
143
|
+
notifyOnNetworkStatusChange: !0
|
|
144
|
+
}), [B] = i(m), [V] = i(h), [H] = i(g), [U] = i(_), W = t(async (e, t) => (await A({ variables: {
|
|
145
|
+
context: s,
|
|
146
|
+
year: e,
|
|
147
|
+
month: t
|
|
148
|
+
} })).data?.getHealthyBowlFrostRiskCalendar ?? null, [A, o]), G = t(async (e = {}) => (await F({ variables: {
|
|
149
|
+
context: s,
|
|
150
|
+
alertType: e.alertType ?? null,
|
|
151
|
+
status: e.status ?? null
|
|
152
|
+
} })).data?.getHealthyBowlWeatherAlertEvents ?? [], [F, o]), K = t(async () => {
|
|
153
|
+
let e = await B({ variables: { context: s } });
|
|
154
|
+
return await x(), await T(), e.data?.syncHealthyBowlWeatherHistory ?? null;
|
|
155
|
+
}, [
|
|
156
|
+
B,
|
|
157
|
+
x,
|
|
158
|
+
T,
|
|
159
|
+
o
|
|
160
|
+
]), q = t(async (e) => {
|
|
161
|
+
let t = await V({ variables: {
|
|
162
|
+
id: e,
|
|
163
|
+
context: s
|
|
164
|
+
} });
|
|
165
|
+
return await P(), t.data?.markHealthyBowlWeatherAlertHandled ?? null;
|
|
166
|
+
}, [
|
|
167
|
+
V,
|
|
168
|
+
P,
|
|
169
|
+
o
|
|
170
|
+
]), J = t(async (e, t) => {
|
|
171
|
+
let n = await H({ variables: {
|
|
172
|
+
id: e,
|
|
173
|
+
until: t,
|
|
174
|
+
context: s
|
|
175
|
+
} });
|
|
176
|
+
return await P(), n.data?.snoozeHealthyBowlWeatherAlert ?? null;
|
|
177
|
+
}, [
|
|
178
|
+
H,
|
|
179
|
+
P,
|
|
180
|
+
o
|
|
181
|
+
]), Y = t(async (e) => {
|
|
182
|
+
let t = await U({ variables: { input: {
|
|
183
|
+
...e,
|
|
184
|
+
context: s
|
|
185
|
+
} } });
|
|
186
|
+
return await z(), t.data?.upsertHealthyBowlWeatherAlertSettings ?? null;
|
|
187
|
+
}, [
|
|
188
|
+
U,
|
|
189
|
+
z,
|
|
190
|
+
o
|
|
191
|
+
]);
|
|
192
|
+
return {
|
|
193
|
+
series: v?.getHealthyBowlWeatherHistorySeries ?? null,
|
|
194
|
+
loadingSeries: y,
|
|
195
|
+
errorSeries: b ?? null,
|
|
196
|
+
refetchSeries: x,
|
|
197
|
+
anomaly: S?.getHealthyBowlWeatherAnomalyReport ?? null,
|
|
198
|
+
loadingAnomaly: C,
|
|
199
|
+
errorAnomaly: w ?? null,
|
|
200
|
+
refetchAnomaly: T,
|
|
201
|
+
frostCalendar: E?.getHealthyBowlFrostRiskCalendar ?? null,
|
|
202
|
+
loadingCalendar: D,
|
|
203
|
+
errorCalendar: O ?? null,
|
|
204
|
+
refetchCalendar: k,
|
|
205
|
+
loadCalendar: W,
|
|
206
|
+
alertEvents: j?.getHealthyBowlWeatherAlertEvents ?? [],
|
|
207
|
+
loadingEvents: M,
|
|
208
|
+
errorEvents: N ?? null,
|
|
209
|
+
refetchEvents: P,
|
|
210
|
+
loadEvents: G,
|
|
211
|
+
settings: I?.getHealthyBowlWeatherAlertSettings ?? null,
|
|
212
|
+
loadingSettings: L,
|
|
213
|
+
errorSettings: R ?? null,
|
|
214
|
+
refetchSettings: z,
|
|
215
|
+
syncHistory: K,
|
|
216
|
+
markHandled: q,
|
|
217
|
+
snooze: J,
|
|
218
|
+
saveSettings: Y
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
export { v as useWeatherIntelligence };
|
|
223
|
+
|
|
224
|
+
//# sourceMappingURL=useWeatherIntelligence.js.map
|