@burdenoff/microfe-healthybowl 2026.813.9 → 2026.813.11
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/hooks/useHealthyBowlAccounting.js +10 -0
- package/dist/healthybowl/hooks/useHealthyBowlAccounting.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlSustainability.js +224 -205
- package/dist/healthybowl/hooks/useHealthyBowlSustainability.js.map +1 -1
- package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js +7 -2
- package/dist/healthybowl/pages/financial/AccountingIntegrationsPage.js.map +1 -1
- package/dist/healthybowl/pages/sustainability/SustainabilityOverviewPage.js +282 -196
- package/dist/healthybowl/pages/sustainability/SustainabilityOverviewPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -54,6 +54,7 @@ var o = "00000000-0000-0000-0000-000000000001", s = "id code name accountType no
|
|
|
54
54
|
status
|
|
55
55
|
entriesCount
|
|
56
56
|
message
|
|
57
|
+
accountsCount
|
|
57
58
|
log {
|
|
58
59
|
id
|
|
59
60
|
provider
|
|
@@ -63,6 +64,15 @@ var o = "00000000-0000-0000-0000-000000000001", s = "id code name accountType no
|
|
|
63
64
|
batchRef
|
|
64
65
|
syncedAt
|
|
65
66
|
}
|
|
67
|
+
coaLog {
|
|
68
|
+
id
|
|
69
|
+
provider
|
|
70
|
+
entriesCount
|
|
71
|
+
status
|
|
72
|
+
message
|
|
73
|
+
batchRef
|
|
74
|
+
syncedAt
|
|
75
|
+
}
|
|
66
76
|
integration {
|
|
67
77
|
id
|
|
68
78
|
provider
|
|
@@ -1 +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}\n/**\n * BOFF-6026 — the three standard statements, derived from the same posted journal lines the P&L\n * already uses. Each carries its own integrity flag: these documents go to a lender, so one that is\n * quietly wrong is worse than one that admits it cannot be trusted.\n */\nexport interface TrialBalanceRow {\n accountCode: string;\n accountName: string;\n accountType: string;\n totalDebit: number;\n totalCredit: number;\n /** Reported on the account's natural side, so a credit-natured account reads positive. */\n balance: number;\n}\nexport interface TrialBalance {\n periodLabel: string;\n currency: string;\n rows: TrialBalanceRow[];\n totalDebit: number;\n totalCredit: number;\n isBalanced: boolean;\n difference: number;\n}\nexport interface StatementLine {\n accountCode: string;\n accountName: string;\n amount: number;\n}\nexport interface BalanceSheet {\n asOfLabel: string;\n currency: string;\n assets: StatementLine[];\n liabilities: StatementLine[];\n equity: StatementLine[];\n totalAssets: number;\n totalLiabilities: number;\n totalEquityAccounts: number;\n /** Cumulative income − expense. Without it, assets never equal liabilities plus equity. */\n retainedEarnings: number;\n totalEquity: number;\n totalLiabilitiesAndEquity: number;\n isBalanced: boolean;\n difference: number;\n}\nexport interface CashFlowLine extends StatementLine {\n category: 'OPERATING' | 'INVESTING' | 'FINANCING';\n}\nexport interface CashFlowStatement {\n periodLabel: string;\n currency: string;\n operating: CashFlowLine[];\n investing: CashFlowLine[];\n financing: CashFlowLine[];\n netOperating: number;\n netInvesting: number;\n netFinancing: number;\n netChangeInCash: number;\n /** Movement summed straight off the cash accounts — must equal netChangeInCash. */\n cashAccountMovement: number;\n isReconciled: boolean;\n difference: number;\n cashAccounts: StatementLine[];\n unclassifiedCount: number;\n /** True when the period held more lines than one statement can read. */\n isTruncated: boolean;\n entryLimit: number;\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`;\n// BOFF-6026 — trial balance, balance sheet and cash flow.\nconst TRIAL_BALANCE_FIELDS = `periodLabel currency totalDebit totalCredit isBalanced difference rows { accountCode accountName accountType totalDebit totalCredit balance }`;\nconst BALANCE_SHEET_FIELDS = `asOfLabel currency assets { accountCode accountName amount } liabilities { accountCode accountName amount } equity { accountCode accountName amount } totalAssets totalLiabilities totalEquityAccounts retainedEarnings totalEquity totalLiabilitiesAndEquity isBalanced difference`;\nconst CASH_FLOW_FIELDS = `periodLabel currency operating { accountCode accountName category amount } investing { accountCode accountName category amount } financing { accountCode accountName category amount } netOperating netInvesting netFinancing netChangeInCash cashAccountMovement isReconciled difference cashAccounts { accountCode accountName amount } unclassifiedCount isTruncated entryLimit`;\nconst GET_TRIAL_BALANCE = gql`query HbTrialBalance($context: ContextInput!, $startDate: String!, $endDate: String!) {\n getHealthyBowlTrialBalance(context: $context, startDate: $startDate, endDate: $endDate) { ${TRIAL_BALANCE_FIELDS} } }`;\nconst GET_BALANCE_SHEET = gql`query HbBalanceSheet($context: ContextInput!, $asOfDate: String!) {\n getHealthyBowlBalanceSheet(context: $context, asOfDate: $asOfDate) { ${BALANCE_SHEET_FIELDS} } }`;\nconst GET_CASH_FLOW = gql`query HbCashFlow($context: ContextInput!, $startDate: String!, $endDate: String!) {\n getHealthyBowlCashFlowStatement(context: $context, startDate: $startDate, endDate: $endDate) { ${CASH_FLOW_FIELDS} } }`;\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 batch {\n format\n filename\n mimeType\n contentBase64\n byteSize\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 /** BOFF-6026 — the three statements share `statementRange`; the balance sheet uses its endDate. */\n trialBalance?: boolean;\n balanceSheet?: boolean;\n cashFlow?: boolean;\n statementRange?: { 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 tbQuery = useQuery<{ getHealthyBowlTrialBalance: TrialBalance }>(GET_TRIAL_BALANCE, {\n variables: {\n context,\n startDate: options.statementRange?.startDate ?? '',\n endDate: options.statementRange?.endDate ?? '',\n },\n fetchPolicy: 'cache-and-network',\n skip: !options.trialBalance || !options.statementRange,\n });\n const bsQuery = useQuery<{ getHealthyBowlBalanceSheet: BalanceSheet }>(GET_BALANCE_SHEET, {\n // A balance sheet is a position on a date, not a period, so only the end of the range applies.\n variables: { context, asOfDate: options.statementRange?.endDate ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !options.balanceSheet || !options.statementRange,\n });\n const cfQuery = useQuery<{ getHealthyBowlCashFlowStatement: CashFlowStatement }>(GET_CASH_FLOW, {\n variables: {\n context,\n startDate: options.statementRange?.startDate ?? '',\n endDate: options.statementRange?.endDate ?? '',\n },\n fetchPolicy: 'cache-and-network',\n skip: !options.cashFlow || !options.statementRange,\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.trialBalance && options.statementRange) jobs.push(tbQuery.refetch());\n if (options.balanceSheet && options.statementRange) jobs.push(bsQuery.refetch());\n if (options.cashFlow && options.statementRange) jobs.push(cfQuery.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 }, [\n options,\n coaQuery,\n glQuery,\n entriesQuery,\n pnlQuery,\n tbQuery,\n bsQuery,\n cfQuery,\n cbcQuery,\n centersQuery,\n integrationsQuery,\n ]);\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 | {\n syncHealthyBowlAccountingIntegration: {\n status: string;\n entriesCount: number;\n message: string;\n batch: AccountingExport | null;\n };\n }\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 trialBalance: tbQuery.data?.getHealthyBowlTrialBalance ?? null,\n balanceSheet: bsQuery.data?.getHealthyBowlBalanceSheet ?? null,\n cashFlow: cfQuery.data?.getHealthyBowlCashFlowStatement ?? 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 tbQuery.loading ||\n bsQuery.loading ||\n cfQuery.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 tbQuery.error ||\n bsQuery.error ||\n cfQuery.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,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S;GAAW;GAAS;GAAQ,EAAE,CAAC;AACpF,MAAI,EAAI,MAAO,OAAM,EAAI;AACzB,SACG,EAAI,MACD,qCAAqC;IAG7C,CAAC,GAAY,EAAQ,CACtB;AAED,QAAO;EAEL,iBAAiB,EAAS,MAAM,iCAAiC,EAAE;EACnE,eAAe,EAAQ,MAAM,+BAA+B;EAC5D,gBAAgB,EAAa,MAAM,gCAAgC,EAAE;EACrE,eAAe,EAAS,MAAM,+BAA+B;EAC7D,cAAc,EAAQ,MAAM,8BAA8B;EAC1D,cAAc,EAAQ,MAAM,8BAA8B;EAC1D,UAAU,EAAQ,MAAM,mCAAmC;EAC3D,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,EAAQ,WACR,EAAQ,WACR,EAAQ,WACR,EAAS,WACT,EAAa,WACb,EAAkB;EACpB,OACE,EAAS,SACT,EAAQ,SACR,EAAa,SACb,EAAS,SACT,EAAQ,SACR,EAAQ,SACR,EAAQ,SACR,EAAS,SACT,EAAa,SACb,EAAkB,SAClB;EACF;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
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}\n/**\n * BOFF-6026 — the three standard statements, derived from the same posted journal lines the P&L\n * already uses. Each carries its own integrity flag: these documents go to a lender, so one that is\n * quietly wrong is worse than one that admits it cannot be trusted.\n */\nexport interface TrialBalanceRow {\n accountCode: string;\n accountName: string;\n accountType: string;\n totalDebit: number;\n totalCredit: number;\n /** Reported on the account's natural side, so a credit-natured account reads positive. */\n balance: number;\n}\nexport interface TrialBalance {\n periodLabel: string;\n currency: string;\n rows: TrialBalanceRow[];\n totalDebit: number;\n totalCredit: number;\n isBalanced: boolean;\n difference: number;\n}\nexport interface StatementLine {\n accountCode: string;\n accountName: string;\n amount: number;\n}\nexport interface BalanceSheet {\n asOfLabel: string;\n currency: string;\n assets: StatementLine[];\n liabilities: StatementLine[];\n equity: StatementLine[];\n totalAssets: number;\n totalLiabilities: number;\n totalEquityAccounts: number;\n /** Cumulative income − expense. Without it, assets never equal liabilities plus equity. */\n retainedEarnings: number;\n totalEquity: number;\n totalLiabilitiesAndEquity: number;\n isBalanced: boolean;\n difference: number;\n}\nexport interface CashFlowLine extends StatementLine {\n category: 'OPERATING' | 'INVESTING' | 'FINANCING';\n}\nexport interface CashFlowStatement {\n periodLabel: string;\n currency: string;\n operating: CashFlowLine[];\n investing: CashFlowLine[];\n financing: CashFlowLine[];\n netOperating: number;\n netInvesting: number;\n netFinancing: number;\n netChangeInCash: number;\n /** Movement summed straight off the cash accounts — must equal netChangeInCash. */\n cashAccountMovement: number;\n isReconciled: boolean;\n difference: number;\n cashAccounts: StatementLine[];\n unclassifiedCount: number;\n /** True when the period held more lines than one statement can read. */\n isTruncated: boolean;\n entryLimit: number;\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`;\n// BOFF-6026 — trial balance, balance sheet and cash flow.\nconst TRIAL_BALANCE_FIELDS = `periodLabel currency totalDebit totalCredit isBalanced difference rows { accountCode accountName accountType totalDebit totalCredit balance }`;\nconst BALANCE_SHEET_FIELDS = `asOfLabel currency assets { accountCode accountName amount } liabilities { accountCode accountName amount } equity { accountCode accountName amount } totalAssets totalLiabilities totalEquityAccounts retainedEarnings totalEquity totalLiabilitiesAndEquity isBalanced difference`;\nconst CASH_FLOW_FIELDS = `periodLabel currency operating { accountCode accountName category amount } investing { accountCode accountName category amount } financing { accountCode accountName category amount } netOperating netInvesting netFinancing netChangeInCash cashAccountMovement isReconciled difference cashAccounts { accountCode accountName amount } unclassifiedCount isTruncated entryLimit`;\nconst GET_TRIAL_BALANCE = gql`query HbTrialBalance($context: ContextInput!, $startDate: String!, $endDate: String!) {\n getHealthyBowlTrialBalance(context: $context, startDate: $startDate, endDate: $endDate) { ${TRIAL_BALANCE_FIELDS} } }`;\nconst GET_BALANCE_SHEET = gql`query HbBalanceSheet($context: ContextInput!, $asOfDate: String!) {\n getHealthyBowlBalanceSheet(context: $context, asOfDate: $asOfDate) { ${BALANCE_SHEET_FIELDS} } }`;\nconst GET_CASH_FLOW = gql`query HbCashFlow($context: ContextInput!, $startDate: String!, $endDate: String!) {\n getHealthyBowlCashFlowStatement(context: $context, startDate: $startDate, endDate: $endDate) { ${CASH_FLOW_FIELDS} } }`;\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 accountsCount\n log {\n id\n provider\n entriesCount\n status\n message\n batchRef\n syncedAt\n }\n coaLog {\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 batch {\n format\n filename\n mimeType\n contentBase64\n byteSize\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 /** BOFF-6026 — the three statements share `statementRange`; the balance sheet uses its endDate. */\n trialBalance?: boolean;\n balanceSheet?: boolean;\n cashFlow?: boolean;\n statementRange?: { 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 tbQuery = useQuery<{ getHealthyBowlTrialBalance: TrialBalance }>(GET_TRIAL_BALANCE, {\n variables: {\n context,\n startDate: options.statementRange?.startDate ?? '',\n endDate: options.statementRange?.endDate ?? '',\n },\n fetchPolicy: 'cache-and-network',\n skip: !options.trialBalance || !options.statementRange,\n });\n const bsQuery = useQuery<{ getHealthyBowlBalanceSheet: BalanceSheet }>(GET_BALANCE_SHEET, {\n // A balance sheet is a position on a date, not a period, so only the end of the range applies.\n variables: { context, asOfDate: options.statementRange?.endDate ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !options.balanceSheet || !options.statementRange,\n });\n const cfQuery = useQuery<{ getHealthyBowlCashFlowStatement: CashFlowStatement }>(GET_CASH_FLOW, {\n variables: {\n context,\n startDate: options.statementRange?.startDate ?? '',\n endDate: options.statementRange?.endDate ?? '',\n },\n fetchPolicy: 'cache-and-network',\n skip: !options.cashFlow || !options.statementRange,\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.trialBalance && options.statementRange) jobs.push(tbQuery.refetch());\n if (options.balanceSheet && options.statementRange) jobs.push(bsQuery.refetch());\n if (options.cashFlow && options.statementRange) jobs.push(cfQuery.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 }, [\n options,\n coaQuery,\n glQuery,\n entriesQuery,\n pnlQuery,\n tbQuery,\n bsQuery,\n cfQuery,\n cbcQuery,\n centersQuery,\n integrationsQuery,\n ]);\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 | {\n syncHealthyBowlAccountingIntegration: {\n status: string;\n entriesCount: number;\n message: string;\n accountsCount: number;\n coaLog: AccountingSyncLog | null;\n batch: AccountingExport | null;\n };\n }\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 trialBalance: tbQuery.data?.getHealthyBowlTrialBalance ?? null,\n balanceSheet: bsQuery.data?.getHealthyBowlBalanceSheet ?? null,\n cashFlow: cfQuery.data?.getHealthyBowlCashFlowStatement ?? 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 tbQuery.loading ||\n bsQuery.loading ||\n cfQuery.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 tbQuery.error ||\n bsQuery.error ||\n cfQuery.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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