Files
accounted/lib/bookkeeping/account-classifier-client.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

16 lines
722 B
TypeScript

/**
* Client-side account classification: the lazily loaded BAS chart when it
* has arrived (see lib/bookkeeping/bas-lazy.ts), the BAS-aligned heuristic
* until then. Components call useBasReference() to re-render once the chart
* lands so an authoritative answer replaces the heuristic one.
*/
import { getBasLoadedByNumber } from './bas-lazy'
import { classifyAccountHeuristic, type ClassifiedAccount } from './account-classifier-heuristic'
export function classifyAccountClient(accountNumber: string): ClassifiedAccount {
const ref = getBasLoadedByNumber(accountNumber)
if (ref) return { account_type: ref.account_type, normal_balance: ref.normal_balance }
return classifyAccountHeuristic(accountNumber)
}