@burdenoff/microfe-healthybowl 2026.810.9 → 2026.810.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.
@@ -0,0 +1,47 @@
1
+ import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
2
+ import { gql as t } from "@apollo/client";
3
+ import { useQuery as n } from "@apollo/client/react";
4
+ //#region src/healthybowl/hooks/useSchemeEligibility.ts
5
+ var r = t`
6
+ query HealthyBowlSchemeEligibility($schemeId: ID!, $context: ContextInput!) {
7
+ getHealthyBowlSchemeEligibility(schemeId: $schemeId, context: $context) {
8
+ schemeId
9
+ schemeTitle
10
+ outcome
11
+ summary
12
+ metCount
13
+ unmetCount
14
+ unknownCount
15
+ criteria {
16
+ id
17
+ label
18
+ fact
19
+ operator
20
+ expected
21
+ actual
22
+ verdict
23
+ reason
24
+ }
25
+ eligibility
26
+ }
27
+ }
28
+ `;
29
+ function i(t) {
30
+ let { workspaceId: i } = e(), { data: a, loading: o, error: s } = n(r, {
31
+ variables: {
32
+ schemeId: t ?? "",
33
+ context: { workspaceId: i }
34
+ },
35
+ skip: !i || !t,
36
+ fetchPolicy: "cache-and-network"
37
+ });
38
+ return {
39
+ eligibility: a?.getHealthyBowlSchemeEligibility ?? null,
40
+ loading: o,
41
+ error: s ?? null
42
+ };
43
+ }
44
+ //#endregion
45
+ export { i as useSchemeEligibility };
46
+
47
+ //# sourceMappingURL=useSchemeEligibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSchemeEligibility.js","names":[],"sources":["../../../src/healthybowl/hooks/useSchemeEligibility.ts"],"sourcesContent":["/**\n * Scheme eligibility check (BOFF-6110).\n *\n * Scheme criteria were free text, so nothing could tell a farmer whether they qualify — the\n * details page said as much in a comment, having removed a `met: i < 2` fake that marked the\n * first two criteria met purely by position.\n *\n * This reads the real verdict from `getHealthyBowlSchemeEligibility`, which evaluates a scheme's\n * structured criteria against the farm data HealthyBowl already holds. The server never guesses:\n * anything it cannot settle comes back UNKNOWN rather than UNMET, and this hook passes that\n * through untouched — presenting UNKNOWN as \"not met\" in the UI would reintroduce exactly the\n * false negative the engine was written to avoid.\n *\n * Mirrors the raw-`gql` pattern used by {@link usePlanExecution} — the offline codegen doesn't\n * type these operations, so they're hand-written documents executed against the live gateway.\n * @module healthybowl\n */\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\nconst SCHEME_ELIGIBILITY = gql`\n query HealthyBowlSchemeEligibility($schemeId: ID!, $context: ContextInput!) {\n getHealthyBowlSchemeEligibility(schemeId: $schemeId, context: $context) {\n schemeId\n schemeTitle\n outcome\n summary\n metCount\n unmetCount\n unknownCount\n criteria {\n id\n label\n fact\n operator\n expected\n actual\n verdict\n reason\n }\n eligibility\n }\n }\n`;\n\nexport type EligibilityVerdict = 'MET' | 'UNMET' | 'UNKNOWN';\nexport type EligibilityOutcome = 'ELIGIBLE' | 'NOT_ELIGIBLE' | 'UNKNOWN';\n\nexport interface EligibilityCriterion {\n id: string;\n label: string;\n fact: string | null;\n operator: string | null;\n expected: string | null;\n actual: string | null;\n verdict: EligibilityVerdict;\n reason: string;\n}\n\nexport interface SchemeEligibility {\n schemeId: string;\n schemeTitle: string;\n outcome: EligibilityOutcome;\n summary: string;\n metCount: number;\n unmetCount: number;\n unknownCount: number;\n criteria: EligibilityCriterion[];\n eligibility: string[];\n}\n\ninterface QueryData {\n getHealthyBowlSchemeEligibility: SchemeEligibility;\n}\n\n/**\n * Loads the eligibility verdict for one scheme.\n *\n * Errors are swallowed into `eligibility: null` on purpose: this is an advisory panel, and a\n * scheme's published criteria are shown regardless, so a failed check must degrade to \"we could\n * not check\" rather than blocking the page a farmer needs in order to apply.\n */\nexport function useSchemeEligibility(schemeId: string | undefined) {\n const { workspaceId } = useHealthyBowl();\n const { data, loading, error } = useQuery<QueryData>(SCHEME_ELIGIBILITY, {\n variables: { schemeId: schemeId ?? '', context: { workspaceId } },\n skip: !workspaceId || !schemeId,\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n eligibility: data?.getHealthyBowlSchemeEligibility ?? null,\n loading,\n error: error ?? null,\n };\n}\n"],"mappings":";;;;AAqBA,IAAM,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;AA8D9B,SAAgB,EAAqB,GAA8B;CACjE,IAAM,EAAE,mBAAgB,GAAgB,EAClC,EAAE,SAAM,YAAS,aAAU,EAAoB,GAAoB;EACvE,WAAW;GAAE,UAAU,KAAY;GAAI,SAAS,EAAE,gBAAa;GAAE;EACjE,MAAM,CAAC,KAAe,CAAC;EACvB,aAAa;EACd,CAAC;AAEF,QAAO;EACL,aAAa,GAAM,mCAAmC;EACtD;EACA,OAAO,KAAS;EACjB"}