@burdenoff/microfe-healthybowl 2026.810.10 → 2026.810.12

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.
@@ -3,16 +3,16 @@ import { useCallback as t, useMemo as n } from "react";
3
3
  import { gql as r } from "@apollo/client";
4
4
  import { useMutation as i, useQuery as a } from "@apollo/client/react";
5
5
  //#region src/healthybowl/hooks/useHealthyBowlInputsInsurance.ts
6
- var ee = "00000000-0000-0000-0000-000000000001", o = "\n id name season notes status itemCount totalPlannedBudget totalAllocatedCost totalSpent createdAt updatedAt\n items { \n id planId fieldId fieldName cropId cropName inputType category unit\n plannedQty allocatedQty usedQty remainingQty unitCost plannedBudget spent allocatedCost status createdAt updatedAt\n }\n", s = "\n season totalBudget spent committed remaining spentPct\n plannedVsSpent { fieldId fieldName planned spent }\n inputMix { category label amount pct }\n costByCrop { cropName totalCost costPerAcre }\n", c = "\n id schemeApplicationId schemeId fieldId fieldName cropName season coverageType areaAcres\n sumInsured premiumTotal farmerSharePremium farmerSharePct subsidyPct notifiedArea sowingDate\n policyNumber insurer status premiumStatus billingOrderId billingSyncStatus billingSyncError\n documentIds activeClaimCount createdAt updatedAt\n", l = "season fieldsCovered totalFields activePolicies sumInsuredTotal premiumDueTotal activeClaims", u = "\n id policyId claimNumber fieldId fieldName cropName policySeason sumInsured incidentType incidentDate\n estimatedLossPct claimedAmount approvedAmount notifiedArea surveyorName status description photoIds documentIds\n events { id status label description eventDate actorId createdAt } createdAt updatedAt\n", d = "\n id lenderName financierActorId grantId amount currency purpose tenureMonths interestRatePct status\n pledgedFieldIds sharedRecords { fieldRecords inputPlan cropYield costBudget } communityFunded expiresAt createdAt updatedAt\n", te = r`query GetHbInputPlans($context: ContextInput!, $season: String, $status: String) {
6
+ var ee = "00000000-0000-0000-0000-000000000001", o = "\n id name season notes status itemCount totalPlannedBudget totalAllocatedCost totalSpent createdAt updatedAt\n items { \n id planId fieldId fieldName cropId cropName inputType category unit\n plannedQty allocatedQty usedQty remainingQty unitCost plannedBudget spent allocatedCost status createdAt updatedAt\n }\n", s = "\n season totalBudget spent committed remaining spentPct\n plannedVsSpent { fieldId fieldName planned spent }\n inputMix { category label amount pct }\n costByCrop { cropName totalCost costPerAcre }\n", c = "\n id schemeApplicationId schemeId fieldId fieldName cropName season coverageType areaAcres\n sumInsured premiumTotal farmerSharePremium farmerSharePct subsidyPct notifiedArea sowingDate\n policyNumber insurer status premiumStatus billingOrderId billingSyncStatus billingSyncError\n paymentProvider paymentReference paidAmount paidAt\n documentIds activeClaimCount createdAt updatedAt\n", l = "season fieldsCovered totalFields activePolicies sumInsuredTotal premiumDueTotal activeClaims", u = "\n id policyId claimNumber fieldId fieldName cropName policySeason sumInsured incidentType incidentDate\n estimatedLossPct claimedAmount approvedAmount notifiedArea surveyorName status description photoIds documentIds\n events { id status label description eventDate actorId createdAt } createdAt updatedAt\n", d = "\n id lenderName financierActorId grantId amount currency purpose tenureMonths interestRatePct status\n pledgedFieldIds sharedRecords { fieldRecords inputPlan cropYield costBudget } communityFunded expiresAt createdAt updatedAt\n", te = r`query GetHbInputPlans($context: ContextInput!, $season: String, $status: String) {
7
7
  getHealthyBowlInputPlans(context: $context, season: $season, status: $status) { ${o} } }`, ne = r`query GetHbInputPlan($context: ContextInput!, $id: ID!) {
8
- getHealthyBowlInputPlan(context: $context, id: $id) { ${o} } }`, f = r`query GetHbInputAnalytics($context: ContextInput!, $season: String) {
9
- getHealthyBowlInputBudgetAnalytics(context: $context, season: $season) { ${s} } }`, re = r`query GetHbPolicies($context: ContextInput!, $season: String, $status: String) {
10
- getHealthyBowlInsurancePolicies(context: $context, season: $season, status: $status) { ${c} } }`, ie = r`query GetHbPolicy($context: ContextInput!, $id: ID!) {
11
- getHealthyBowlInsurancePolicy(context: $context, id: $id) { ${c} } }`, ae = r`query GetHbEnrollment($context: ContextInput!, $season: String) {
12
- getHealthyBowlInsuranceEnrollmentSummary(context: $context, season: $season) { ${l} } }`, oe = r`query GetHbClaims($context: ContextInput!, $policyId: ID, $status: String) {
13
- getHealthyBowlInsuranceClaims(context: $context, policyId: $policyId, status: $status) { ${u} } }`, se = r`query GetHbClaim($context: ContextInput!, $id: ID!) {
14
- getHealthyBowlInsuranceClaim(context: $context, id: $id) { ${u} } }`, ce = r`query GetHbLoans($context: ContextInput!, $status: String) {
15
- getHealthyBowlLoanFacilitations(context: $context, status: $status) { ${d} } }`, le = r`mutation CreateHbInputPlan($input: CreateHealthyBowlInputPlanInput!) {
8
+ getHealthyBowlInputPlan(context: $context, id: $id) { ${o} } }`, re = r`query GetHbInputAnalytics($context: ContextInput!, $season: String) {
9
+ getHealthyBowlInputBudgetAnalytics(context: $context, season: $season) { ${s} } }`, ie = r`query GetHbPolicies($context: ContextInput!, $season: String, $status: String) {
10
+ getHealthyBowlInsurancePolicies(context: $context, season: $season, status: $status) { ${c} } }`, ae = r`query GetHbPolicy($context: ContextInput!, $id: ID!) {
11
+ getHealthyBowlInsurancePolicy(context: $context, id: $id) { ${c} } }`, oe = r`query GetHbEnrollment($context: ContextInput!, $season: String) {
12
+ getHealthyBowlInsuranceEnrollmentSummary(context: $context, season: $season) { ${l} } }`, se = r`query GetHbClaims($context: ContextInput!, $policyId: ID, $status: String) {
13
+ getHealthyBowlInsuranceClaims(context: $context, policyId: $policyId, status: $status) { ${u} } }`, ce = r`query GetHbClaim($context: ContextInput!, $id: ID!) {
14
+ getHealthyBowlInsuranceClaim(context: $context, id: $id) { ${u} } }`, le = r`query GetHbLoans($context: ContextInput!, $status: String) {
15
+ getHealthyBowlLoanFacilitations(context: $context, status: $status) { ${d} } }`, f = r`mutation CreateHbInputPlan($input: CreateHealthyBowlInputPlanInput!) {
16
16
  createHealthyBowlInputPlan(input: $input) { ${o} } }`, p = r`mutation UpdateHbInputPlan($input: UpdateHealthyBowlInputPlanInput!) {
17
17
  updateHealthyBowlInputPlan(input: $input) { ${o} } }`, ue = r`
18
18
  mutation DeleteHbInputPlan($id: ID!, $context: ContextInput!) {
@@ -23,19 +23,35 @@ var ee = "00000000-0000-0000-0000-000000000001", o = "\n id name season notes s
23
23
  updateHealthyBowlInputPlanItem(input: $input) { ${o} } }`, m = r`mutation DeleteHbInputPlanItem($id: ID!, $planId: ID!, $context: ContextInput!) {
24
24
  deleteHealthyBowlInputPlanItem(id: $id, planId: $planId, context: $context) { ${o} } }`, h = r`mutation ApplyHbPmfby($input: ApplyHealthyBowlPmfbyInput!) {
25
25
  applyForHealthyBowlPmfby(input: $input) { ${c} } }`, g = r`mutation PayHbPremium($input: PayHealthyBowlInsurancePremiumInput!) {
26
- payHealthyBowlInsurancePremium(input: $input) { ${c} } }`, _ = r`mutation UpdateHbPolicy($input: UpdateHealthyBowlInsurancePolicyInput!) {
27
- updateHealthyBowlInsurancePolicy(input: $input) { ${c} } }`, v = r`
26
+ payHealthyBowlInsurancePremium(input: $input) { ${c} } }`, _ = r`
27
+ mutation CheckoutHbPremium($input: PayHealthyBowlInsurancePremiumInput!) {
28
+ checkoutHealthyBowlInsurancePremium(input: $input) {
29
+ policyId
30
+ billingOrderId
31
+ provider
32
+ providerOrderId
33
+ razorpayKeyId
34
+ clientSecret
35
+ subtotal
36
+ taxAmount
37
+ total
38
+ currency
39
+ }
40
+ }
41
+ `, pe = r`mutation SyncHbPremiumPayment($input: PayHealthyBowlInsurancePremiumInput!) {
42
+ syncHealthyBowlInsurancePremiumPayment(input: $input) { ${c} } }`, me = r`mutation UpdateHbPolicy($input: UpdateHealthyBowlInsurancePolicyInput!) {
43
+ updateHealthyBowlInsurancePolicy(input: $input) { ${c} } }`, he = r`
28
44
  mutation DeleteHbPolicy($id: ID!, $context: ContextInput!) {
29
45
  deleteHealthyBowlInsurancePolicy(id: $id, context: $context)
30
46
  }
31
- `, y = r`mutation FileHbClaim($input: FileHealthyBowlInsuranceClaimInput!) {
32
- fileHealthyBowlInsuranceClaim(input: $input) { ${u} } }`, pe = r`mutation AddHbClaimEvent($input: AddHealthyBowlInsuranceClaimEventInput!) {
33
- addHealthyBowlInsuranceClaimEvent(input: $input) { ${u} } }`, me = r`mutation UpdateHbClaim($input: UpdateHealthyBowlInsuranceClaimInput!) {
34
- updateHealthyBowlInsuranceClaim(input: $input) { ${u} } }`, he = r`mutation RequestHbLoan($input: RequestHealthyBowlLoanFacilitationInput!) {
35
- requestHealthyBowlLoanFacilitation(input: $input) { ${d} } }`, ge = r`mutation UpdateHbLoan($input: UpdateHealthyBowlLoanFacilitationInput!) {
36
- updateHealthyBowlLoanFacilitation(input: $input) { ${d} } }`, _e = r`mutation RevokeHbLoan($id: ID!, $context: ContextInput!) {
47
+ `, ge = r`mutation FileHbClaim($input: FileHealthyBowlInsuranceClaimInput!) {
48
+ fileHealthyBowlInsuranceClaim(input: $input) { ${u} } }`, _e = r`mutation AddHbClaimEvent($input: AddHealthyBowlInsuranceClaimEventInput!) {
49
+ addHealthyBowlInsuranceClaimEvent(input: $input) { ${u} } }`, ve = r`mutation UpdateHbClaim($input: UpdateHealthyBowlInsuranceClaimInput!) {
50
+ updateHealthyBowlInsuranceClaim(input: $input) { ${u} } }`, ye = r`mutation RequestHbLoan($input: RequestHealthyBowlLoanFacilitationInput!) {
51
+ requestHealthyBowlLoanFacilitation(input: $input) { ${d} } }`, be = r`mutation UpdateHbLoan($input: UpdateHealthyBowlLoanFacilitationInput!) {
52
+ updateHealthyBowlLoanFacilitation(input: $input) { ${d} } }`, xe = r`mutation RevokeHbLoan($id: ID!, $context: ContextInput!) {
37
53
  revokeHealthyBowlLoanFacilitation(id: $id, context: $context) { ${d} } }`;
38
- function b(r = {}) {
54
+ function v(r = {}) {
39
55
  let { workspaceId: o } = e(), s = o || ee, c = n(() => ({ workspaceId: s }), [s]), l = r.season ?? null, u = a(te, {
40
56
  variables: {
41
57
  context: c,
@@ -44,14 +60,14 @@ function b(r = {}) {
44
60
  },
45
61
  fetchPolicy: "cache-and-network",
46
62
  skip: r.plans !== !0
47
- }), d = a(f, {
63
+ }), d = a(re, {
48
64
  variables: {
49
65
  context: c,
50
66
  season: l
51
67
  },
52
68
  fetchPolicy: "cache-and-network",
53
69
  skip: r.analytics !== !0
54
- }), b = a(re, {
70
+ }), v = a(ie, {
55
71
  variables: {
56
72
  context: c,
57
73
  season: l,
@@ -59,14 +75,14 @@ function b(r = {}) {
59
75
  },
60
76
  fetchPolicy: "cache-and-network",
61
77
  skip: r.policies !== !0
62
- }), x = a(ae, {
78
+ }), y = a(oe, {
63
79
  variables: {
64
80
  context: c,
65
81
  season: l
66
82
  },
67
83
  fetchPolicy: "cache-and-network",
68
84
  skip: r.enrollment !== !0
69
- }), S = a(oe, {
85
+ }), b = a(se, {
70
86
  variables: {
71
87
  context: c,
72
88
  policyId: r.claimsPolicyId ?? null,
@@ -74,37 +90,37 @@ function b(r = {}) {
74
90
  },
75
91
  fetchPolicy: "cache-and-network",
76
92
  skip: r.claims !== !0
77
- }), C = a(ce, {
93
+ }), x = a(le, {
78
94
  variables: {
79
95
  context: c,
80
96
  status: r.loansStatus ?? null
81
97
  },
82
98
  fetchPolicy: "cache-and-network",
83
99
  skip: r.loans !== !0
84
- }), w = a(ne, {
100
+ }), S = a(ne, {
85
101
  variables: {
86
102
  context: c,
87
103
  id: r.planId ?? ""
88
104
  },
89
105
  fetchPolicy: "cache-and-network",
90
106
  skip: !r.planId
91
- }), T = a(ie, {
107
+ }), C = a(ae, {
92
108
  variables: {
93
109
  context: c,
94
110
  id: r.policyId ?? ""
95
111
  },
96
112
  fetchPolicy: "cache-and-network",
97
113
  skip: !r.policyId
98
- }), E = a(se, {
114
+ }), w = a(ce, {
99
115
  variables: {
100
116
  context: c,
101
117
  id: r.claimId ?? ""
102
118
  },
103
119
  fetchPolicy: "cache-and-network",
104
120
  skip: !r.claimId
105
- }), D = u.refetch, O = d.refetch, k = b.refetch, A = x.refetch, j = S.refetch, M = C.refetch, N = w.refetch, P = T.refetch, F = E.refetch, I = t(async () => {
121
+ }), T = u.refetch, E = d.refetch, D = v.refetch, O = y.refetch, k = b.refetch, A = x.refetch, j = S.refetch, M = C.refetch, N = w.refetch, P = t(async () => {
106
122
  let e = [];
107
- r.plans && e.push(D().catch(() => void 0)), r.analytics && e.push(O().catch(() => void 0)), r.policies && e.push(k().catch(() => void 0)), r.enrollment && e.push(A().catch(() => void 0)), r.claims && e.push(j().catch(() => void 0)), r.loans && e.push(M().catch(() => void 0)), r.planId && e.push(N().catch(() => void 0)), r.policyId && e.push(P().catch(() => void 0)), r.claimId && e.push(F().catch(() => void 0)), await Promise.all(e);
123
+ r.plans && e.push(T().catch(() => void 0)), r.analytics && e.push(E().catch(() => void 0)), r.policies && e.push(D().catch(() => void 0)), r.enrollment && e.push(O().catch(() => void 0)), r.claims && e.push(k().catch(() => void 0)), r.loans && e.push(A().catch(() => void 0)), r.planId && e.push(j().catch(() => void 0)), r.policyId && e.push(M().catch(() => void 0)), r.claimId && e.push(N().catch(() => void 0)), await Promise.all(e);
108
124
  }, [
109
125
  r.plans,
110
126
  r.analytics,
@@ -115,142 +131,156 @@ function b(r = {}) {
115
131
  r.planId,
116
132
  r.policyId,
117
133
  r.claimId,
134
+ T,
135
+ E,
118
136
  D,
119
137
  O,
120
138
  k,
121
139
  A,
122
140
  j,
123
141
  M,
124
- N,
125
- P,
126
- F
127
- ]), [L] = i(le), [R] = i(p), [z] = i(ue), [B] = i(de), [V] = i(fe), [H] = i(m), [U] = i(h), [W] = i(g), [G] = i(_), [K] = i(v), [q] = i(y), [J] = i(pe), [Y] = i(me), [X] = i(he), [Z] = i(ge), [Q] = i(_e), $ = t((e) => ({
142
+ N
143
+ ]), [F] = i(f), [I] = i(p), [L] = i(ue), [R] = i(de), [z] = i(fe), [B] = i(m), [V] = i(h), [H] = i(g), [U] = i(_), [W] = i(pe), [G] = i(me), [K] = i(he), [q] = i(ge), [J] = i(_e), [Y] = i(ve), [X] = i(ye), [Z] = i(be), [Q] = i(xe), $ = t((e) => ({
128
144
  ...e,
129
145
  context: c
130
146
  }), [c]);
131
147
  return {
132
148
  plans: u.data?.getHealthyBowlInputPlans ?? [],
133
149
  analytics: d.data?.getHealthyBowlInputBudgetAnalytics ?? null,
134
- policies: b.data?.getHealthyBowlInsurancePolicies ?? [],
135
- enrollment: x.data?.getHealthyBowlInsuranceEnrollmentSummary ?? null,
136
- claims: S.data?.getHealthyBowlInsuranceClaims ?? [],
137
- loans: C.data?.getHealthyBowlLoanFacilitations ?? [],
138
- plan: w.data?.getHealthyBowlInputPlan ?? null,
139
- policy: T.data?.getHealthyBowlInsurancePolicy ?? null,
140
- claim: E.data?.getHealthyBowlInsuranceClaim ?? null,
150
+ policies: v.data?.getHealthyBowlInsurancePolicies ?? [],
151
+ enrollment: y.data?.getHealthyBowlInsuranceEnrollmentSummary ?? null,
152
+ claims: b.data?.getHealthyBowlInsuranceClaims ?? [],
153
+ loans: x.data?.getHealthyBowlLoanFacilitations ?? [],
154
+ plan: S.data?.getHealthyBowlInputPlan ?? null,
155
+ policy: C.data?.getHealthyBowlInsurancePolicy ?? null,
156
+ claim: w.data?.getHealthyBowlInsuranceClaim ?? null,
141
157
  loading: {
142
158
  plans: u.loading,
143
159
  analytics: d.loading,
144
- policies: b.loading,
145
- enrollment: x.loading,
146
- claims: S.loading,
147
- loans: C.loading,
148
- plan: w.loading,
149
- policy: T.loading,
150
- claim: E.loading
160
+ policies: v.loading,
161
+ enrollment: y.loading,
162
+ claims: b.loading,
163
+ loans: x.loading,
164
+ plan: S.loading,
165
+ policy: C.loading,
166
+ claim: w.loading
151
167
  },
152
168
  errors: {
153
169
  plans: u.error,
154
170
  analytics: d.error,
155
- policies: b.error,
156
- enrollment: x.error,
157
- claims: S.error,
158
- loans: C.error,
159
- plan: w.error,
160
- policy: T.error,
161
- claim: E.error
171
+ policies: v.error,
172
+ enrollment: y.error,
173
+ claims: b.error,
174
+ loans: x.error,
175
+ plan: S.error,
176
+ policy: C.error,
177
+ claim: w.error
162
178
  },
163
- refetchAll: I,
179
+ refetchAll: P,
164
180
  createPlan: t(async (e) => {
165
- let t = await L({ variables: { input: $(e) } });
181
+ let t = await F({ variables: { input: $(e) } });
166
182
  if (t.error) throw t.error;
167
- return await I(), t.data?.createHealthyBowlInputPlan ?? null;
183
+ return await P(), t.data?.createHealthyBowlInputPlan ?? null;
168
184
  }, [
169
- L,
185
+ F,
170
186
  $,
171
- I
187
+ P
172
188
  ]),
173
189
  updatePlan: t(async (e) => {
174
- let t = await R({ variables: { input: $(e) } });
190
+ let t = await I({ variables: { input: $(e) } });
175
191
  if (t.error) throw t.error;
176
- return await I(), t.data?.updateHealthyBowlInputPlan ?? null;
192
+ return await P(), t.data?.updateHealthyBowlInputPlan ?? null;
177
193
  }, [
178
- R,
194
+ I,
179
195
  $,
180
- I
196
+ P
181
197
  ]),
182
198
  deletePlan: t(async (e) => {
183
- let t = await z({ variables: {
199
+ let t = await L({ variables: {
184
200
  id: e,
185
201
  context: c
186
202
  } });
187
203
  if (t.error) throw t.error;
188
- await I();
204
+ await P();
189
205
  }, [
190
- z,
206
+ L,
191
207
  c,
192
- I
208
+ P
193
209
  ]),
194
210
  addItem: t(async (e) => {
195
- let t = await B({ variables: { input: $(e) } });
211
+ let t = await R({ variables: { input: $(e) } });
196
212
  if (t.error) throw t.error;
197
- return await I(), t.data?.addHealthyBowlInputPlanItem ?? null;
213
+ return await P(), t.data?.addHealthyBowlInputPlanItem ?? null;
198
214
  }, [
199
- B,
215
+ R,
200
216
  $,
201
- I
217
+ P
202
218
  ]),
203
219
  updateItem: t(async (e) => {
204
- let t = await V({ variables: { input: $(e) } });
220
+ let t = await z({ variables: { input: $(e) } });
205
221
  if (t.error) throw t.error;
206
- return await I(), t.data?.updateHealthyBowlInputPlanItem ?? null;
222
+ return await P(), t.data?.updateHealthyBowlInputPlanItem ?? null;
207
223
  }, [
208
- V,
224
+ z,
209
225
  $,
210
- I
226
+ P
211
227
  ]),
212
228
  deleteItem: t(async (e, t) => {
213
- let n = await H({ variables: {
229
+ let n = await B({ variables: {
214
230
  id: e,
215
231
  planId: t,
216
232
  context: c
217
233
  } });
218
234
  if (n.error) throw n.error;
219
- await I();
235
+ await P();
220
236
  }, [
221
- H,
237
+ B,
222
238
  c,
223
- I
239
+ P
224
240
  ]),
225
241
  applyPmfby: t(async (e) => {
226
- let t = await U({ variables: { input: $(e) } });
242
+ let t = await V({ variables: { input: $(e) } });
227
243
  if (t.error) throw t.error;
228
- return await I(), t.data?.applyForHealthyBowlPmfby ?? null;
244
+ return await P(), t.data?.applyForHealthyBowlPmfby ?? null;
229
245
  }, [
230
- U,
246
+ V,
231
247
  $,
232
- I
248
+ P
233
249
  ]),
234
250
  payPremium: t(async (e, t) => {
235
- let n = await W({ variables: { input: $({
251
+ let n = await H({ variables: { input: $({
236
252
  id: e,
237
253
  ...t ? { paymentMethodId: t } : {}
238
254
  }) } });
239
255
  if (n.error) throw n.error;
240
- return await I(), n.data?.payHealthyBowlInsurancePremium ?? null;
256
+ return await P(), n.data?.payHealthyBowlInsurancePremium ?? null;
257
+ }, [
258
+ H,
259
+ $,
260
+ P
261
+ ]),
262
+ checkoutPremium: t(async (e) => {
263
+ let t = await U({ variables: { input: $({ id: e }) } });
264
+ if (t.error) throw t.error;
265
+ return t.data?.checkoutHealthyBowlInsurancePremium ?? null;
266
+ }, [U, $]),
267
+ syncPremiumPayment: t(async (e) => {
268
+ let t = await W({ variables: { input: $({ id: e }) } });
269
+ if (t.error) throw t.error;
270
+ return await P(), t.data?.syncHealthyBowlInsurancePremiumPayment ?? null;
241
271
  }, [
242
272
  W,
243
273
  $,
244
- I
274
+ P
245
275
  ]),
246
276
  updatePolicy: t(async (e) => {
247
277
  let t = await G({ variables: { input: $(e) } });
248
278
  if (t.error) throw t.error;
249
- return await I(), t.data?.updateHealthyBowlInsurancePolicy ?? null;
279
+ return await P(), t.data?.updateHealthyBowlInsurancePolicy ?? null;
250
280
  }, [
251
281
  G,
252
282
  $,
253
- I
283
+ P
254
284
  ]),
255
285
  deletePolicy: t(async (e) => {
256
286
  let t = await K({ variables: {
@@ -258,56 +288,56 @@ function b(r = {}) {
258
288
  context: c
259
289
  } });
260
290
  if (t.error) throw t.error;
261
- await I();
291
+ await P();
262
292
  }, [
263
293
  K,
264
294
  c,
265
- I
295
+ P
266
296
  ]),
267
297
  fileClaim: t(async (e) => {
268
298
  let t = await q({ variables: { input: $(e) } });
269
299
  if (t.error) throw t.error;
270
- return await I(), t.data?.fileHealthyBowlInsuranceClaim ?? null;
300
+ return await P(), t.data?.fileHealthyBowlInsuranceClaim ?? null;
271
301
  }, [
272
302
  q,
273
303
  $,
274
- I
304
+ P
275
305
  ]),
276
306
  addClaimEvent: t(async (e) => {
277
307
  let t = await J({ variables: { input: $(e) } });
278
308
  if (t.error) throw t.error;
279
- return await I(), t.data?.addHealthyBowlInsuranceClaimEvent ?? null;
309
+ return await P(), t.data?.addHealthyBowlInsuranceClaimEvent ?? null;
280
310
  }, [
281
311
  J,
282
312
  $,
283
- I
313
+ P
284
314
  ]),
285
315
  updateClaim: t(async (e) => {
286
316
  let t = await Y({ variables: { input: $(e) } });
287
317
  if (t.error) throw t.error;
288
- return await I(), t.data?.updateHealthyBowlInsuranceClaim ?? null;
318
+ return await P(), t.data?.updateHealthyBowlInsuranceClaim ?? null;
289
319
  }, [
290
320
  Y,
291
321
  $,
292
- I
322
+ P
293
323
  ]),
294
324
  requestLoan: t(async (e) => {
295
325
  let t = await X({ variables: { input: $(e) } });
296
326
  if (t.error) throw t.error;
297
- return await I(), t.data?.requestHealthyBowlLoanFacilitation ?? null;
327
+ return await P(), t.data?.requestHealthyBowlLoanFacilitation ?? null;
298
328
  }, [
299
329
  X,
300
330
  $,
301
- I
331
+ P
302
332
  ]),
303
333
  updateLoan: t(async (e) => {
304
334
  let t = await Z({ variables: { input: $(e) } });
305
335
  if (t.error) throw t.error;
306
- return await I(), t.data?.updateHealthyBowlLoanFacilitation ?? null;
336
+ return await P(), t.data?.updateHealthyBowlLoanFacilitation ?? null;
307
337
  }, [
308
338
  Z,
309
339
  $,
310
- I
340
+ P
311
341
  ]),
312
342
  revokeLoan: t(async (e) => {
313
343
  let t = await Q({ variables: {
@@ -315,15 +345,15 @@ function b(r = {}) {
315
345
  context: c
316
346
  } });
317
347
  if (t.error) throw t.error;
318
- return await I(), t.data?.revokeHealthyBowlLoanFacilitation ?? null;
348
+ return await P(), t.data?.revokeHealthyBowlLoanFacilitation ?? null;
319
349
  }, [
320
350
  Q,
321
351
  c,
322
- I
352
+ P
323
353
  ])
324
354
  };
325
355
  }
326
356
  //#endregion
327
- export { b as useHealthyBowlInputsInsurance };
357
+ export { v as useHealthyBowlInputsInsurance };
328
358
 
329
359
  //# sourceMappingURL=useHealthyBowlInputsInsurance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useHealthyBowlInputsInsurance.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlInputsInsurance.ts"],"sourcesContent":["/**\n * Input planning + PMFBY crop-insurance + input-loan facilitation — data hook.\n * Roadmap 25 · BOFF-2897 · gap E-4, E-5.\n *\n * Per-season, per-field input resource-allocation plans (Planned / Allocated / Used / Cost)\n * with Budget-vs-Actual + Input-Mix analytics; PMFBY enrolment (typed policy that also\n * submits a canonical SchemeApplication); premium payment via global-billing; damage-claim\n * inspection timeline; and input-loan facilitation reusing the FinancierAccessGrant consent\n * bridge. Documents are declared inline with `gql` (not `src/operations/*.graphql`) because\n * codegen validates operations against the committed snapshot, which can't know these fields\n * until the subgraph is live — the same escape hatch the distribution/withdrawal hooks use.\n * Types mirror `wspace-healthybowl-svc/src/modules/healthybowl/schema/inputs-insurance.gql`.\n *\n * Reads use `cache-and-network`; every write throws on error then refetches the reads it\n * invalidates. Pages opt into only the reads they render (all default off).\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 inputs-insurance.gql) ────────────────────────────────────────\nexport type HbContext = { workspaceId: string };\n\nexport interface InputPlanItem {\n id: string;\n planId: string;\n fieldId: string | null;\n fieldName: string;\n cropId: string | null;\n cropName: string | null;\n inputType: string;\n category: string;\n unit: string;\n plannedQty: number;\n allocatedQty: number;\n usedQty: number;\n remainingQty: number;\n unitCost: number;\n plannedBudget: number;\n spent: number;\n allocatedCost: number;\n status: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface InputPlan {\n id: string;\n name: string;\n season: string;\n notes: string | null;\n status: string;\n itemCount: number;\n totalPlannedBudget: number;\n totalAllocatedCost: number;\n totalSpent: number;\n items: InputPlanItem[];\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface InputMixSlice {\n category: string;\n label: string;\n amount: number;\n pct: number;\n}\nexport interface PlannedVsSpentPoint {\n fieldId: string | null;\n fieldName: string;\n planned: number;\n spent: number;\n}\nexport interface CostByCropPoint {\n cropName: string;\n totalCost: number;\n costPerAcre: number;\n}\nexport interface InputBudgetAnalytics {\n season: string;\n totalBudget: number;\n spent: number;\n committed: number;\n remaining: number;\n spentPct: number;\n plannedVsSpent: PlannedVsSpentPoint[];\n inputMix: InputMixSlice[];\n costByCrop: CostByCropPoint[];\n}\n\nexport interface InsurancePolicy {\n id: string;\n schemeApplicationId: string | null;\n schemeId: string | null;\n fieldId: string | null;\n fieldName: string;\n cropName: string | null;\n season: string;\n coverageType: string;\n areaAcres: number;\n sumInsured: number;\n premiumTotal: number;\n farmerSharePremium: number;\n farmerSharePct: number;\n subsidyPct: number;\n notifiedArea: string | null;\n sowingDate: string | null;\n policyNumber: string | null;\n insurer: string | null;\n status: string;\n premiumStatus: string;\n billingOrderId: string | null;\n billingSyncStatus: string;\n billingSyncError: string | null;\n documentIds: string[];\n activeClaimCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface InsuranceEnrollmentSummary {\n season: string;\n fieldsCovered: number;\n totalFields: number;\n activePolicies: number;\n sumInsuredTotal: number;\n premiumDueTotal: number;\n activeClaims: number;\n}\n\nexport interface InsuranceClaimEvent {\n id: string;\n status: string;\n label: string;\n description: string | null;\n eventDate: string;\n actorId: string | null;\n createdAt: string;\n}\n\nexport interface InsuranceClaim {\n id: string;\n policyId: string;\n claimNumber: string;\n fieldId: string | null;\n fieldName: string;\n cropName: string | null;\n policySeason: string | null;\n sumInsured: number;\n incidentType: string;\n incidentDate: string;\n estimatedLossPct: number;\n claimedAmount: number;\n approvedAmount: number | null;\n notifiedArea: string | null;\n surveyorName: string | null;\n status: string;\n description: string | null;\n photoIds: string[];\n documentIds: string[];\n events: InsuranceClaimEvent[];\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface LoanSharedRecords {\n fieldRecords: boolean;\n inputPlan: boolean;\n cropYield: boolean;\n costBudget: boolean;\n}\nexport interface LoanFacilitation {\n id: string;\n lenderName: string;\n financierActorId: string | null;\n grantId: string | null;\n amount: number;\n currency: string;\n purpose: string | null;\n tenureMonths: number;\n interestRatePct: number | null;\n status: string;\n pledgedFieldIds: string[];\n sharedRecords: LoanSharedRecords;\n communityFunded: boolean;\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ── field fragments ─────────────────────────────────────────────────────────\nconst ITEM_FIELDS = `\n id planId fieldId fieldName cropId cropName inputType category unit\n plannedQty allocatedQty usedQty remainingQty unitCost plannedBudget spent allocatedCost status createdAt updatedAt\n`;\nconst PLAN_FIELDS = `\n id name season notes status itemCount totalPlannedBudget totalAllocatedCost totalSpent createdAt updatedAt\n items { ${ITEM_FIELDS} }\n`;\nconst ANALYTICS_FIELDS = `\n season totalBudget spent committed remaining spentPct\n plannedVsSpent { fieldId fieldName planned spent }\n inputMix { category label amount pct }\n costByCrop { cropName totalCost costPerAcre }\n`;\nconst POLICY_FIELDS = `\n id schemeApplicationId schemeId fieldId fieldName cropName season coverageType areaAcres\n sumInsured premiumTotal farmerSharePremium farmerSharePct subsidyPct notifiedArea sowingDate\n policyNumber insurer status premiumStatus billingOrderId billingSyncStatus billingSyncError\n documentIds activeClaimCount createdAt updatedAt\n`;\nconst ENROLLMENT_FIELDS = `season fieldsCovered totalFields activePolicies sumInsuredTotal premiumDueTotal activeClaims`;\nconst CLAIM_FIELDS = `\n id policyId claimNumber fieldId fieldName cropName policySeason sumInsured incidentType incidentDate\n estimatedLossPct claimedAmount approvedAmount notifiedArea surveyorName status description photoIds documentIds\n events { id status label description eventDate actorId createdAt } createdAt updatedAt\n`;\nconst LOAN_FIELDS = `\n id lenderName financierActorId grantId amount currency purpose tenureMonths interestRatePct status\n pledgedFieldIds sharedRecords { fieldRecords inputPlan cropYield costBudget } communityFunded expiresAt createdAt updatedAt\n`;\n\n// ── queries ───────────────────────────────────────────────────────────────────\nconst GET_PLANS = gql`query GetHbInputPlans($context: ContextInput!, $season: String, $status: String) {\n getHealthyBowlInputPlans(context: $context, season: $season, status: $status) { ${PLAN_FIELDS} } }`;\nconst GET_PLAN = gql`query GetHbInputPlan($context: ContextInput!, $id: ID!) {\n getHealthyBowlInputPlan(context: $context, id: $id) { ${PLAN_FIELDS} } }`;\nconst GET_ANALYTICS = gql`query GetHbInputAnalytics($context: ContextInput!, $season: String) {\n getHealthyBowlInputBudgetAnalytics(context: $context, season: $season) { ${ANALYTICS_FIELDS} } }`;\nconst GET_POLICIES = gql`query GetHbPolicies($context: ContextInput!, $season: String, $status: String) {\n getHealthyBowlInsurancePolicies(context: $context, season: $season, status: $status) { ${POLICY_FIELDS} } }`;\nconst GET_POLICY = gql`query GetHbPolicy($context: ContextInput!, $id: ID!) {\n getHealthyBowlInsurancePolicy(context: $context, id: $id) { ${POLICY_FIELDS} } }`;\nconst GET_ENROLLMENT = gql`query GetHbEnrollment($context: ContextInput!, $season: String) {\n getHealthyBowlInsuranceEnrollmentSummary(context: $context, season: $season) { ${ENROLLMENT_FIELDS} } }`;\nconst GET_CLAIMS = gql`query GetHbClaims($context: ContextInput!, $policyId: ID, $status: String) {\n getHealthyBowlInsuranceClaims(context: $context, policyId: $policyId, status: $status) { ${CLAIM_FIELDS} } }`;\nconst GET_CLAIM = gql`query GetHbClaim($context: ContextInput!, $id: ID!) {\n getHealthyBowlInsuranceClaim(context: $context, id: $id) { ${CLAIM_FIELDS} } }`;\nconst GET_LOANS = gql`query GetHbLoans($context: ContextInput!, $status: String) {\n getHealthyBowlLoanFacilitations(context: $context, status: $status) { ${LOAN_FIELDS} } }`;\n\n// ── mutations ─────────────────────────────────────────────────────────────────\nconst CREATE_PLAN = gql`mutation CreateHbInputPlan($input: CreateHealthyBowlInputPlanInput!) {\n createHealthyBowlInputPlan(input: $input) { ${PLAN_FIELDS} } }`;\nconst UPDATE_PLAN = gql`mutation UpdateHbInputPlan($input: UpdateHealthyBowlInputPlanInput!) {\n updateHealthyBowlInputPlan(input: $input) { ${PLAN_FIELDS} } }`;\nconst DELETE_PLAN = gql`\n mutation DeleteHbInputPlan($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlInputPlan(id: $id, context: $context)\n }\n`;\nconst ADD_ITEM = gql`mutation AddHbInputPlanItem($input: AddHealthyBowlInputPlanItemInput!) {\n addHealthyBowlInputPlanItem(input: $input) { ${PLAN_FIELDS} } }`;\nconst UPDATE_ITEM = gql`mutation UpdateHbInputPlanItem($input: UpdateHealthyBowlInputPlanItemInput!) {\n updateHealthyBowlInputPlanItem(input: $input) { ${PLAN_FIELDS} } }`;\nconst DELETE_ITEM = gql`mutation DeleteHbInputPlanItem($id: ID!, $planId: ID!, $context: ContextInput!) {\n deleteHealthyBowlInputPlanItem(id: $id, planId: $planId, context: $context) { ${PLAN_FIELDS} } }`;\nconst APPLY_PMFBY = gql`mutation ApplyHbPmfby($input: ApplyHealthyBowlPmfbyInput!) {\n applyForHealthyBowlPmfby(input: $input) { ${POLICY_FIELDS} } }`;\nconst PAY_PREMIUM = gql`mutation PayHbPremium($input: PayHealthyBowlInsurancePremiumInput!) {\n payHealthyBowlInsurancePremium(input: $input) { ${POLICY_FIELDS} } }`;\nconst UPDATE_POLICY = gql`mutation UpdateHbPolicy($input: UpdateHealthyBowlInsurancePolicyInput!) {\n updateHealthyBowlInsurancePolicy(input: $input) { ${POLICY_FIELDS} } }`;\nconst DELETE_POLICY = gql`\n mutation DeleteHbPolicy($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlInsurancePolicy(id: $id, context: $context)\n }\n`;\nconst FILE_CLAIM = gql`mutation FileHbClaim($input: FileHealthyBowlInsuranceClaimInput!) {\n fileHealthyBowlInsuranceClaim(input: $input) { ${CLAIM_FIELDS} } }`;\nconst ADD_CLAIM_EVENT = gql`mutation AddHbClaimEvent($input: AddHealthyBowlInsuranceClaimEventInput!) {\n addHealthyBowlInsuranceClaimEvent(input: $input) { ${CLAIM_FIELDS} } }`;\nconst UPDATE_CLAIM = gql`mutation UpdateHbClaim($input: UpdateHealthyBowlInsuranceClaimInput!) {\n updateHealthyBowlInsuranceClaim(input: $input) { ${CLAIM_FIELDS} } }`;\nconst REQUEST_LOAN = gql`mutation RequestHbLoan($input: RequestHealthyBowlLoanFacilitationInput!) {\n requestHealthyBowlLoanFacilitation(input: $input) { ${LOAN_FIELDS} } }`;\nconst UPDATE_LOAN = gql`mutation UpdateHbLoan($input: UpdateHealthyBowlLoanFacilitationInput!) {\n updateHealthyBowlLoanFacilitation(input: $input) { ${LOAN_FIELDS} } }`;\nconst REVOKE_LOAN = gql`mutation RevokeHbLoan($id: ID!, $context: ContextInput!) {\n revokeHealthyBowlLoanFacilitation(id: $id, context: $context) { ${LOAN_FIELDS} } }`;\n\nexport interface UseInputsInsuranceOptions {\n plans?: boolean;\n analytics?: boolean;\n policies?: boolean;\n enrollment?: boolean;\n claims?: boolean;\n loans?: boolean;\n season?: string | null;\n plansStatus?: string | null;\n policiesStatus?: string | null;\n loansStatus?: string | null;\n claimsPolicyId?: string | null;\n planId?: string | null;\n policyId?: string | null;\n claimId?: string | null;\n}\n\nexport function useHealthyBowlInputsInsurance(options: UseInputsInsuranceOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const season = options.season ?? null;\n\n const plansQuery = useQuery<\n { getHealthyBowlInputPlans: InputPlan[] },\n { context: HbContext; season: string | null; status: string | null }\n >(GET_PLANS, {\n variables: { context: ctx, season, status: options.plansStatus ?? null },\n fetchPolicy: 'cache-and-network',\n skip: options.plans !== true,\n });\n const analyticsQuery = useQuery<\n { getHealthyBowlInputBudgetAnalytics: InputBudgetAnalytics },\n { context: HbContext; season: string | null }\n >(GET_ANALYTICS, {\n variables: { context: ctx, season },\n fetchPolicy: 'cache-and-network',\n skip: options.analytics !== true,\n });\n const policiesQuery = useQuery<\n { getHealthyBowlInsurancePolicies: InsurancePolicy[] },\n { context: HbContext; season: string | null; status: string | null }\n >(GET_POLICIES, {\n variables: { context: ctx, season, status: options.policiesStatus ?? null },\n fetchPolicy: 'cache-and-network',\n skip: options.policies !== true,\n });\n const enrollmentQuery = useQuery<\n { getHealthyBowlInsuranceEnrollmentSummary: InsuranceEnrollmentSummary },\n { context: HbContext; season: string | null }\n >(GET_ENROLLMENT, {\n variables: { context: ctx, season },\n fetchPolicy: 'cache-and-network',\n skip: options.enrollment !== true,\n });\n const claimsQuery = useQuery<\n { getHealthyBowlInsuranceClaims: InsuranceClaim[] },\n { context: HbContext; policyId: string | null; status: string | null }\n >(GET_CLAIMS, {\n variables: { context: ctx, policyId: options.claimsPolicyId ?? null, status: null },\n fetchPolicy: 'cache-and-network',\n skip: options.claims !== true,\n });\n const loansQuery = useQuery<\n { getHealthyBowlLoanFacilitations: LoanFacilitation[] },\n { context: HbContext; status: string | null }\n >(GET_LOANS, {\n variables: { context: ctx, status: options.loansStatus ?? null },\n fetchPolicy: 'cache-and-network',\n skip: options.loans !== true,\n });\n const planQuery = useQuery<{ getHealthyBowlInputPlan: InputPlan }, { context: HbContext; id: string }>(GET_PLAN, {\n variables: { context: ctx, id: options.planId ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !options.planId,\n });\n const policyQuery = useQuery<{ getHealthyBowlInsurancePolicy: InsurancePolicy }, { context: HbContext; id: string }>(\n GET_POLICY,\n {\n variables: { context: ctx, id: options.policyId ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !options.policyId,\n }\n );\n const claimQuery = useQuery<{ getHealthyBowlInsuranceClaim: InsuranceClaim }, { context: HbContext; id: string }>(\n GET_CLAIM,\n { variables: { context: ctx, id: options.claimId ?? '' }, fetchPolicy: 'cache-and-network', skip: !options.claimId }\n );\n\n const rp = plansQuery.refetch;\n const ra = analyticsQuery.refetch;\n const rpol = policiesQuery.refetch;\n const re = enrollmentQuery.refetch;\n const rc = claimsQuery.refetch;\n const rl = loansQuery.refetch;\n const rplan = planQuery.refetch;\n const rpolicy = policyQuery.refetch;\n const rclaim = claimQuery.refetch;\n\n const reconcileReads = useCallback(async () => {\n const runners: Array<Promise<unknown>> = [];\n if (options.plans) runners.push(rp().catch(() => undefined));\n if (options.analytics) runners.push(ra().catch(() => undefined));\n if (options.policies) runners.push(rpol().catch(() => undefined));\n if (options.enrollment) runners.push(re().catch(() => undefined));\n if (options.claims) runners.push(rc().catch(() => undefined));\n if (options.loans) runners.push(rl().catch(() => undefined));\n if (options.planId) runners.push(rplan().catch(() => undefined));\n if (options.policyId) runners.push(rpolicy().catch(() => undefined));\n if (options.claimId) runners.push(rclaim().catch(() => undefined));\n await Promise.all(runners);\n }, [\n options.plans,\n options.analytics,\n options.policies,\n options.enrollment,\n options.claims,\n options.loans,\n options.planId,\n options.policyId,\n options.claimId,\n rp,\n ra,\n rpol,\n re,\n rc,\n rl,\n rplan,\n rpolicy,\n rclaim,\n ]);\n\n const [createPlanM] = useMutation<{ createHealthyBowlInputPlan: InputPlan }, { input: Record<string, unknown> }>(\n CREATE_PLAN\n );\n const [updatePlanM] = useMutation<{ updateHealthyBowlInputPlan: InputPlan }, { input: Record<string, unknown> }>(\n UPDATE_PLAN\n );\n const [deletePlanM] = useMutation<{ deleteHealthyBowlInputPlan: boolean }, { id: string; context: HbContext }>(\n DELETE_PLAN\n );\n const [addItemM] = useMutation<{ addHealthyBowlInputPlanItem: InputPlan }, { input: Record<string, unknown> }>(\n ADD_ITEM\n );\n const [updateItemM] = useMutation<{ updateHealthyBowlInputPlanItem: InputPlan }, { input: Record<string, unknown> }>(\n UPDATE_ITEM\n );\n const [deleteItemM] = useMutation<\n { deleteHealthyBowlInputPlanItem: InputPlan },\n { id: string; planId: string; context: HbContext }\n >(DELETE_ITEM);\n const [applyPmfbyM] = useMutation<{ applyForHealthyBowlPmfby: InsurancePolicy }, { input: Record<string, unknown> }>(\n APPLY_PMFBY\n );\n const [payPremiumM] = useMutation<\n { payHealthyBowlInsurancePremium: InsurancePolicy },\n { input: Record<string, unknown> }\n >(PAY_PREMIUM);\n const [updatePolicyM] = useMutation<\n { updateHealthyBowlInsurancePolicy: InsurancePolicy },\n { input: Record<string, unknown> }\n >(UPDATE_POLICY);\n const [deletePolicyM] = useMutation<\n { deleteHealthyBowlInsurancePolicy: boolean },\n { id: string; context: HbContext }\n >(DELETE_POLICY);\n const [fileClaimM] = useMutation<\n { fileHealthyBowlInsuranceClaim: InsuranceClaim },\n { input: Record<string, unknown> }\n >(FILE_CLAIM);\n const [addClaimEventM] = useMutation<\n { addHealthyBowlInsuranceClaimEvent: InsuranceClaim },\n { input: Record<string, unknown> }\n >(ADD_CLAIM_EVENT);\n const [updateClaimM] = useMutation<\n { updateHealthyBowlInsuranceClaim: InsuranceClaim },\n { input: Record<string, unknown> }\n >(UPDATE_CLAIM);\n const [requestLoanM] = useMutation<\n { requestHealthyBowlLoanFacilitation: LoanFacilitation },\n { input: Record<string, unknown> }\n >(REQUEST_LOAN);\n const [updateLoanM] = useMutation<\n { updateHealthyBowlLoanFacilitation: LoanFacilitation },\n { input: Record<string, unknown> }\n >(UPDATE_LOAN);\n const [revokeLoanM] = useMutation<\n { revokeHealthyBowlLoanFacilitation: LoanFacilitation },\n { id: string; context: HbContext }\n >(REVOKE_LOAN);\n\n const withCtx = useCallback((input: Record<string, unknown>) => ({ ...input, context: ctx }), [ctx]);\n\n return {\n plans: plansQuery.data?.getHealthyBowlInputPlans ?? [],\n analytics: analyticsQuery.data?.getHealthyBowlInputBudgetAnalytics ?? null,\n policies: policiesQuery.data?.getHealthyBowlInsurancePolicies ?? [],\n enrollment: enrollmentQuery.data?.getHealthyBowlInsuranceEnrollmentSummary ?? null,\n claims: claimsQuery.data?.getHealthyBowlInsuranceClaims ?? [],\n loans: loansQuery.data?.getHealthyBowlLoanFacilitations ?? [],\n plan: planQuery.data?.getHealthyBowlInputPlan ?? null,\n policy: policyQuery.data?.getHealthyBowlInsurancePolicy ?? null,\n claim: claimQuery.data?.getHealthyBowlInsuranceClaim ?? null,\n\n loading: {\n plans: plansQuery.loading,\n analytics: analyticsQuery.loading,\n policies: policiesQuery.loading,\n enrollment: enrollmentQuery.loading,\n claims: claimsQuery.loading,\n loans: loansQuery.loading,\n plan: planQuery.loading,\n policy: policyQuery.loading,\n claim: claimQuery.loading,\n },\n errors: {\n plans: plansQuery.error,\n analytics: analyticsQuery.error,\n policies: policiesQuery.error,\n enrollment: enrollmentQuery.error,\n claims: claimsQuery.error,\n loans: loansQuery.error,\n plan: planQuery.error,\n policy: policyQuery.error,\n claim: claimQuery.error,\n },\n refetchAll: reconcileReads,\n\n createPlan: useCallback(\n async (input: Record<string, unknown>): Promise<InputPlan | null> => {\n const res = await createPlanM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.createHealthyBowlInputPlan ?? null;\n },\n [createPlanM, withCtx, reconcileReads]\n ),\n updatePlan: useCallback(\n async (input: Record<string, unknown>): Promise<InputPlan | null> => {\n const res = await updatePlanM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlInputPlan ?? null;\n },\n [updatePlanM, withCtx, reconcileReads]\n ),\n deletePlan: useCallback(\n async (id: string): Promise<void> => {\n const res = await deletePlanM({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deletePlanM, ctx, reconcileReads]\n ),\n addItem: useCallback(\n async (input: Record<string, unknown>): Promise<InputPlan | null> => {\n const res = await addItemM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.addHealthyBowlInputPlanItem ?? null;\n },\n [addItemM, withCtx, reconcileReads]\n ),\n updateItem: useCallback(\n async (input: Record<string, unknown>): Promise<InputPlan | null> => {\n const res = await updateItemM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlInputPlanItem ?? null;\n },\n [updateItemM, withCtx, reconcileReads]\n ),\n deleteItem: useCallback(\n async (id: string, planId: string): Promise<void> => {\n const res = await deleteItemM({ variables: { id, planId, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deleteItemM, ctx, reconcileReads]\n ),\n\n applyPmfby: useCallback(\n async (input: Record<string, unknown>): Promise<InsurancePolicy | null> => {\n const res = await applyPmfbyM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.applyForHealthyBowlPmfby ?? null;\n },\n [applyPmfbyM, withCtx, reconcileReads]\n ),\n payPremium: useCallback(\n async (id: string, paymentMethodId?: string): Promise<InsurancePolicy | null> => {\n const res = await payPremiumM({\n variables: { input: withCtx({ id, ...(paymentMethodId ? { paymentMethodId } : {}) }) },\n });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.payHealthyBowlInsurancePremium ?? null;\n },\n [payPremiumM, withCtx, reconcileReads]\n ),\n updatePolicy: useCallback(\n async (input: Record<string, unknown>): Promise<InsurancePolicy | null> => {\n const res = await updatePolicyM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlInsurancePolicy ?? null;\n },\n [updatePolicyM, withCtx, reconcileReads]\n ),\n deletePolicy: useCallback(\n async (id: string): Promise<void> => {\n const res = await deletePolicyM({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deletePolicyM, ctx, reconcileReads]\n ),\n\n fileClaim: useCallback(\n async (input: Record<string, unknown>): Promise<InsuranceClaim | null> => {\n const res = await fileClaimM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.fileHealthyBowlInsuranceClaim ?? null;\n },\n [fileClaimM, withCtx, reconcileReads]\n ),\n addClaimEvent: useCallback(\n async (input: Record<string, unknown>): Promise<InsuranceClaim | null> => {\n const res = await addClaimEventM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.addHealthyBowlInsuranceClaimEvent ?? null;\n },\n [addClaimEventM, withCtx, reconcileReads]\n ),\n updateClaim: useCallback(\n async (input: Record<string, unknown>): Promise<InsuranceClaim | null> => {\n const res = await updateClaimM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlInsuranceClaim ?? null;\n },\n [updateClaimM, withCtx, reconcileReads]\n ),\n\n requestLoan: useCallback(\n async (input: Record<string, unknown>): Promise<LoanFacilitation | null> => {\n const res = await requestLoanM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.requestHealthyBowlLoanFacilitation ?? null;\n },\n [requestLoanM, withCtx, reconcileReads]\n ),\n updateLoan: useCallback(\n async (input: Record<string, unknown>): Promise<LoanFacilitation | null> => {\n const res = await updateLoanM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlLoanFacilitation ?? null;\n },\n [updateLoanM, withCtx, reconcileReads]\n ),\n revokeLoan: useCallback(\n async (id: string): Promise<LoanFacilitation | null> => {\n const res = await revokeLoanM({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.revokeHealthyBowlLoanFacilitation ?? null;\n },\n [revokeLoanM, ctx, reconcileReads]\n ),\n };\n}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AAS;GAAe,CAC1C;EACD,aAAa,EACX,OAAO,MAAmE;GACxE,IAAM,IAAM,MAAM,EAAa,EAAE,WAAW,EAAE,OAAO,EAAQ,EAAM,EAAE,EAAE,CAAC;AACxE,OAAI,EAAI,MAAO,OAAM,EAAI;AAEzB,UADA,MAAM,GAAgB,EACf,EAAI,MAAM,mCAAmC;KAEtD;GAAC;GAAc;GAAS;GAAe,CACxC;EAED,aAAa,EACX,OAAO,MAAqE;GAC1E,IAAM,IAAM,MAAM,EAAa,EAAE,WAAW,EAAE,OAAO,EAAQ,EAAM,EAAE,EAAE,CAAC;AACxE,OAAI,EAAI,MAAO,OAAM,EAAI;AAEzB,UADA,MAAM,GAAgB,EACf,EAAI,MAAM,sCAAsC;KAEzD;GAAC;GAAc;GAAS;GAAe,CACxC;EACD,YAAY,EACV,OAAO,MAAqE;GAC1E,IAAM,IAAM,MAAM,EAAY,EAAE,WAAW,EAAE,OAAO,EAAQ,EAAM,EAAE,EAAE,CAAC;AACvE,OAAI,EAAI,MAAO,OAAM,EAAI;AAEzB,UADA,MAAM,GAAgB,EACf,EAAI,MAAM,qCAAqC;KAExD;GAAC;GAAa;GAAS;GAAe,CACvC;EACD,YAAY,EACV,OAAO,MAAiD;GACtD,IAAM,IAAM,MAAM,EAAY,EAAE,WAAW;IAAE;IAAI,SAAS;IAAK,EAAE,CAAC;AAClE,OAAI,EAAI,MAAO,OAAM,EAAI;AAEzB,UADA,MAAM,GAAgB,EACf,EAAI,MAAM,qCAAqC;KAExD;GAAC;GAAa;GAAK;GAAe,CACnC;EACF"}
1
+ {"version":3,"file":"useHealthyBowlInputsInsurance.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlInputsInsurance.ts"],"sourcesContent":["/**\n * Input planning + PMFBY crop-insurance + input-loan facilitation — data hook.\n * Roadmap 25 · BOFF-2897 · gap E-4, E-5.\n *\n * Per-season, per-field input resource-allocation plans (Planned / Allocated / Used / Cost)\n * with Budget-vs-Actual + Input-Mix analytics; PMFBY enrolment (typed policy that also\n * submits a canonical SchemeApplication); premium payment via global-billing; damage-claim\n * inspection timeline; and input-loan facilitation reusing the FinancierAccessGrant consent\n * bridge. Documents are declared inline with `gql` (not `src/operations/*.graphql`) because\n * codegen validates operations against the committed snapshot, which can't know these fields\n * until the subgraph is live — the same escape hatch the distribution/withdrawal hooks use.\n * Types mirror `wspace-healthybowl-svc/src/modules/healthybowl/schema/inputs-insurance.gql`.\n *\n * Reads use `cache-and-network`; every write throws on error then refetches the reads it\n * invalidates. Pages opt into only the reads they render (all default off).\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 inputs-insurance.gql) ────────────────────────────────────────\nexport type HbContext = { workspaceId: string };\n\nexport interface InputPlanItem {\n id: string;\n planId: string;\n fieldId: string | null;\n fieldName: string;\n cropId: string | null;\n cropName: string | null;\n inputType: string;\n category: string;\n unit: string;\n plannedQty: number;\n allocatedQty: number;\n usedQty: number;\n remainingQty: number;\n unitCost: number;\n plannedBudget: number;\n spent: number;\n allocatedCost: number;\n status: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface InputPlan {\n id: string;\n name: string;\n season: string;\n notes: string | null;\n status: string;\n itemCount: number;\n totalPlannedBudget: number;\n totalAllocatedCost: number;\n totalSpent: number;\n items: InputPlanItem[];\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface InputMixSlice {\n category: string;\n label: string;\n amount: number;\n pct: number;\n}\nexport interface PlannedVsSpentPoint {\n fieldId: string | null;\n fieldName: string;\n planned: number;\n spent: number;\n}\nexport interface CostByCropPoint {\n cropName: string;\n totalCost: number;\n costPerAcre: number;\n}\nexport interface InputBudgetAnalytics {\n season: string;\n totalBudget: number;\n spent: number;\n committed: number;\n remaining: number;\n spentPct: number;\n plannedVsSpent: PlannedVsSpentPoint[];\n inputMix: InputMixSlice[];\n costByCrop: CostByCropPoint[];\n}\n\nexport interface InsurancePolicy {\n id: string;\n schemeApplicationId: string | null;\n schemeId: string | null;\n fieldId: string | null;\n fieldName: string;\n cropName: string | null;\n season: string;\n coverageType: string;\n areaAcres: number;\n sumInsured: number;\n premiumTotal: number;\n farmerSharePremium: number;\n farmerSharePct: number;\n subsidyPct: number;\n notifiedArea: string | null;\n sowingDate: string | null;\n policyNumber: string | null;\n insurer: string | null;\n status: string;\n premiumStatus: string;\n billingOrderId: string | null;\n billingSyncStatus: string;\n billingSyncError: string | null;\n /** RAZORPAY / STRIPE, as global-billing resolved it. Null until the premium settles. */\n paymentProvider: string | null;\n /**\n * The payment gateway's OWN reference (Razorpay `pay_xxx`) for the settled premium — the evidence\n * that money actually moved. A PAID premium with no reference was stamped by the pre-BOFF-6045\n * code, which marked policies paid without ever charging anybody.\n */\n paymentReference: string | null;\n paidAmount: number | null;\n paidAt: string | null;\n documentIds: string[];\n activeClaimCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\n/**\n * Everything the client needs to open the payment provider's checkout for a farmer-share premium.\n * The amounts are global-billing's — tax is computed there, not here.\n */\nexport interface PremiumCheckout {\n policyId: string;\n billingOrderId: string;\n /** RAZORPAY / STRIPE — billing decides, the client only reacts. */\n provider: string;\n /** Razorpay `order_xxx`; null when billing routed to another provider. */\n providerOrderId: string | null;\n razorpayKeyId: string | null;\n /** Stripe's client secret, when billing routes to Stripe (not handled by this UI). */\n clientSecret: string | null;\n subtotal: number;\n taxAmount: number;\n total: number;\n currency: string;\n}\n\nexport interface InsuranceEnrollmentSummary {\n season: string;\n fieldsCovered: number;\n totalFields: number;\n activePolicies: number;\n sumInsuredTotal: number;\n premiumDueTotal: number;\n activeClaims: number;\n}\n\nexport interface InsuranceClaimEvent {\n id: string;\n status: string;\n label: string;\n description: string | null;\n eventDate: string;\n actorId: string | null;\n createdAt: string;\n}\n\nexport interface InsuranceClaim {\n id: string;\n policyId: string;\n claimNumber: string;\n fieldId: string | null;\n fieldName: string;\n cropName: string | null;\n policySeason: string | null;\n sumInsured: number;\n incidentType: string;\n incidentDate: string;\n estimatedLossPct: number;\n claimedAmount: number;\n approvedAmount: number | null;\n notifiedArea: string | null;\n surveyorName: string | null;\n status: string;\n description: string | null;\n photoIds: string[];\n documentIds: string[];\n events: InsuranceClaimEvent[];\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface LoanSharedRecords {\n fieldRecords: boolean;\n inputPlan: boolean;\n cropYield: boolean;\n costBudget: boolean;\n}\nexport interface LoanFacilitation {\n id: string;\n lenderName: string;\n financierActorId: string | null;\n grantId: string | null;\n amount: number;\n currency: string;\n purpose: string | null;\n tenureMonths: number;\n interestRatePct: number | null;\n status: string;\n pledgedFieldIds: string[];\n sharedRecords: LoanSharedRecords;\n communityFunded: boolean;\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\n// ── field fragments ─────────────────────────────────────────────────────────\nconst ITEM_FIELDS = `\n id planId fieldId fieldName cropId cropName inputType category unit\n plannedQty allocatedQty usedQty remainingQty unitCost plannedBudget spent allocatedCost status createdAt updatedAt\n`;\nconst PLAN_FIELDS = `\n id name season notes status itemCount totalPlannedBudget totalAllocatedCost totalSpent createdAt updatedAt\n items { ${ITEM_FIELDS} }\n`;\nconst ANALYTICS_FIELDS = `\n season totalBudget spent committed remaining spentPct\n plannedVsSpent { fieldId fieldName planned spent }\n inputMix { category label amount pct }\n costByCrop { cropName totalCost costPerAcre }\n`;\nconst POLICY_FIELDS = `\n id schemeApplicationId schemeId fieldId fieldName cropName season coverageType areaAcres\n sumInsured premiumTotal farmerSharePremium farmerSharePct subsidyPct notifiedArea sowingDate\n policyNumber insurer status premiumStatus billingOrderId billingSyncStatus billingSyncError\n paymentProvider paymentReference paidAmount paidAt\n documentIds activeClaimCount createdAt updatedAt\n`;\nconst ENROLLMENT_FIELDS = `season fieldsCovered totalFields activePolicies sumInsuredTotal premiumDueTotal activeClaims`;\nconst CLAIM_FIELDS = `\n id policyId claimNumber fieldId fieldName cropName policySeason sumInsured incidentType incidentDate\n estimatedLossPct claimedAmount approvedAmount notifiedArea surveyorName status description photoIds documentIds\n events { id status label description eventDate actorId createdAt } createdAt updatedAt\n`;\nconst LOAN_FIELDS = `\n id lenderName financierActorId grantId amount currency purpose tenureMonths interestRatePct status\n pledgedFieldIds sharedRecords { fieldRecords inputPlan cropYield costBudget } communityFunded expiresAt createdAt updatedAt\n`;\n\n// ── queries ───────────────────────────────────────────────────────────────────\nconst GET_PLANS = gql`query GetHbInputPlans($context: ContextInput!, $season: String, $status: String) {\n getHealthyBowlInputPlans(context: $context, season: $season, status: $status) { ${PLAN_FIELDS} } }`;\nconst GET_PLAN = gql`query GetHbInputPlan($context: ContextInput!, $id: ID!) {\n getHealthyBowlInputPlan(context: $context, id: $id) { ${PLAN_FIELDS} } }`;\nconst GET_ANALYTICS = gql`query GetHbInputAnalytics($context: ContextInput!, $season: String) {\n getHealthyBowlInputBudgetAnalytics(context: $context, season: $season) { ${ANALYTICS_FIELDS} } }`;\nconst GET_POLICIES = gql`query GetHbPolicies($context: ContextInput!, $season: String, $status: String) {\n getHealthyBowlInsurancePolicies(context: $context, season: $season, status: $status) { ${POLICY_FIELDS} } }`;\nconst GET_POLICY = gql`query GetHbPolicy($context: ContextInput!, $id: ID!) {\n getHealthyBowlInsurancePolicy(context: $context, id: $id) { ${POLICY_FIELDS} } }`;\nconst GET_ENROLLMENT = gql`query GetHbEnrollment($context: ContextInput!, $season: String) {\n getHealthyBowlInsuranceEnrollmentSummary(context: $context, season: $season) { ${ENROLLMENT_FIELDS} } }`;\nconst GET_CLAIMS = gql`query GetHbClaims($context: ContextInput!, $policyId: ID, $status: String) {\n getHealthyBowlInsuranceClaims(context: $context, policyId: $policyId, status: $status) { ${CLAIM_FIELDS} } }`;\nconst GET_CLAIM = gql`query GetHbClaim($context: ContextInput!, $id: ID!) {\n getHealthyBowlInsuranceClaim(context: $context, id: $id) { ${CLAIM_FIELDS} } }`;\nconst GET_LOANS = gql`query GetHbLoans($context: ContextInput!, $status: String) {\n getHealthyBowlLoanFacilitations(context: $context, status: $status) { ${LOAN_FIELDS} } }`;\n\n// ── mutations ─────────────────────────────────────────────────────────────────\nconst CREATE_PLAN = gql`mutation CreateHbInputPlan($input: CreateHealthyBowlInputPlanInput!) {\n createHealthyBowlInputPlan(input: $input) { ${PLAN_FIELDS} } }`;\nconst UPDATE_PLAN = gql`mutation UpdateHbInputPlan($input: UpdateHealthyBowlInputPlanInput!) {\n updateHealthyBowlInputPlan(input: $input) { ${PLAN_FIELDS} } }`;\nconst DELETE_PLAN = gql`\n mutation DeleteHbInputPlan($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlInputPlan(id: $id, context: $context)\n }\n`;\nconst ADD_ITEM = gql`mutation AddHbInputPlanItem($input: AddHealthyBowlInputPlanItemInput!) {\n addHealthyBowlInputPlanItem(input: $input) { ${PLAN_FIELDS} } }`;\nconst UPDATE_ITEM = gql`mutation UpdateHbInputPlanItem($input: UpdateHealthyBowlInputPlanItemInput!) {\n updateHealthyBowlInputPlanItem(input: $input) { ${PLAN_FIELDS} } }`;\nconst DELETE_ITEM = gql`mutation DeleteHbInputPlanItem($id: ID!, $planId: ID!, $context: ContextInput!) {\n deleteHealthyBowlInputPlanItem(id: $id, planId: $planId, context: $context) { ${PLAN_FIELDS} } }`;\nconst APPLY_PMFBY = gql`mutation ApplyHbPmfby($input: ApplyHealthyBowlPmfbyInput!) {\n applyForHealthyBowlPmfby(input: $input) { ${POLICY_FIELDS} } }`;\nconst PAY_PREMIUM = gql`mutation PayHbPremium($input: PayHealthyBowlInsurancePremiumInput!) {\n payHealthyBowlInsurancePremium(input: $input) { ${POLICY_FIELDS} } }`;\n/**\n * BOFF-6045: the premium runs the platform payment rail, exactly like a marketplace order.\n * checkout → the farmer pays in the provider's widget → sync re-reads the authoritative Payment and\n * only then marks the premium PAID. This client never decides that money arrived.\n */\nconst CHECKOUT_PREMIUM = gql`\n mutation CheckoutHbPremium($input: PayHealthyBowlInsurancePremiumInput!) {\n checkoutHealthyBowlInsurancePremium(input: $input) {\n policyId\n billingOrderId\n provider\n providerOrderId\n razorpayKeyId\n clientSecret\n subtotal\n taxAmount\n total\n currency\n }\n }\n`;\nconst SYNC_PREMIUM_PAYMENT = gql`mutation SyncHbPremiumPayment($input: PayHealthyBowlInsurancePremiumInput!) {\n syncHealthyBowlInsurancePremiumPayment(input: $input) { ${POLICY_FIELDS} } }`;\nconst UPDATE_POLICY = gql`mutation UpdateHbPolicy($input: UpdateHealthyBowlInsurancePolicyInput!) {\n updateHealthyBowlInsurancePolicy(input: $input) { ${POLICY_FIELDS} } }`;\nconst DELETE_POLICY = gql`\n mutation DeleteHbPolicy($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlInsurancePolicy(id: $id, context: $context)\n }\n`;\nconst FILE_CLAIM = gql`mutation FileHbClaim($input: FileHealthyBowlInsuranceClaimInput!) {\n fileHealthyBowlInsuranceClaim(input: $input) { ${CLAIM_FIELDS} } }`;\nconst ADD_CLAIM_EVENT = gql`mutation AddHbClaimEvent($input: AddHealthyBowlInsuranceClaimEventInput!) {\n addHealthyBowlInsuranceClaimEvent(input: $input) { ${CLAIM_FIELDS} } }`;\nconst UPDATE_CLAIM = gql`mutation UpdateHbClaim($input: UpdateHealthyBowlInsuranceClaimInput!) {\n updateHealthyBowlInsuranceClaim(input: $input) { ${CLAIM_FIELDS} } }`;\nconst REQUEST_LOAN = gql`mutation RequestHbLoan($input: RequestHealthyBowlLoanFacilitationInput!) {\n requestHealthyBowlLoanFacilitation(input: $input) { ${LOAN_FIELDS} } }`;\nconst UPDATE_LOAN = gql`mutation UpdateHbLoan($input: UpdateHealthyBowlLoanFacilitationInput!) {\n updateHealthyBowlLoanFacilitation(input: $input) { ${LOAN_FIELDS} } }`;\nconst REVOKE_LOAN = gql`mutation RevokeHbLoan($id: ID!, $context: ContextInput!) {\n revokeHealthyBowlLoanFacilitation(id: $id, context: $context) { ${LOAN_FIELDS} } }`;\n\nexport interface UseInputsInsuranceOptions {\n plans?: boolean;\n analytics?: boolean;\n policies?: boolean;\n enrollment?: boolean;\n claims?: boolean;\n loans?: boolean;\n season?: string | null;\n plansStatus?: string | null;\n policiesStatus?: string | null;\n loansStatus?: string | null;\n claimsPolicyId?: string | null;\n planId?: string | null;\n policyId?: string | null;\n claimId?: string | null;\n}\n\nexport function useHealthyBowlInputsInsurance(options: UseInputsInsuranceOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const season = options.season ?? null;\n\n const plansQuery = useQuery<\n { getHealthyBowlInputPlans: InputPlan[] },\n { context: HbContext; season: string | null; status: string | null }\n >(GET_PLANS, {\n variables: { context: ctx, season, status: options.plansStatus ?? null },\n fetchPolicy: 'cache-and-network',\n skip: options.plans !== true,\n });\n const analyticsQuery = useQuery<\n { getHealthyBowlInputBudgetAnalytics: InputBudgetAnalytics },\n { context: HbContext; season: string | null }\n >(GET_ANALYTICS, {\n variables: { context: ctx, season },\n fetchPolicy: 'cache-and-network',\n skip: options.analytics !== true,\n });\n const policiesQuery = useQuery<\n { getHealthyBowlInsurancePolicies: InsurancePolicy[] },\n { context: HbContext; season: string | null; status: string | null }\n >(GET_POLICIES, {\n variables: { context: ctx, season, status: options.policiesStatus ?? null },\n fetchPolicy: 'cache-and-network',\n skip: options.policies !== true,\n });\n const enrollmentQuery = useQuery<\n { getHealthyBowlInsuranceEnrollmentSummary: InsuranceEnrollmentSummary },\n { context: HbContext; season: string | null }\n >(GET_ENROLLMENT, {\n variables: { context: ctx, season },\n fetchPolicy: 'cache-and-network',\n skip: options.enrollment !== true,\n });\n const claimsQuery = useQuery<\n { getHealthyBowlInsuranceClaims: InsuranceClaim[] },\n { context: HbContext; policyId: string | null; status: string | null }\n >(GET_CLAIMS, {\n variables: { context: ctx, policyId: options.claimsPolicyId ?? null, status: null },\n fetchPolicy: 'cache-and-network',\n skip: options.claims !== true,\n });\n const loansQuery = useQuery<\n { getHealthyBowlLoanFacilitations: LoanFacilitation[] },\n { context: HbContext; status: string | null }\n >(GET_LOANS, {\n variables: { context: ctx, status: options.loansStatus ?? null },\n fetchPolicy: 'cache-and-network',\n skip: options.loans !== true,\n });\n const planQuery = useQuery<{ getHealthyBowlInputPlan: InputPlan }, { context: HbContext; id: string }>(GET_PLAN, {\n variables: { context: ctx, id: options.planId ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !options.planId,\n });\n const policyQuery = useQuery<{ getHealthyBowlInsurancePolicy: InsurancePolicy }, { context: HbContext; id: string }>(\n GET_POLICY,\n {\n variables: { context: ctx, id: options.policyId ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !options.policyId,\n }\n );\n const claimQuery = useQuery<{ getHealthyBowlInsuranceClaim: InsuranceClaim }, { context: HbContext; id: string }>(\n GET_CLAIM,\n { variables: { context: ctx, id: options.claimId ?? '' }, fetchPolicy: 'cache-and-network', skip: !options.claimId }\n );\n\n const rp = plansQuery.refetch;\n const ra = analyticsQuery.refetch;\n const rpol = policiesQuery.refetch;\n const re = enrollmentQuery.refetch;\n const rc = claimsQuery.refetch;\n const rl = loansQuery.refetch;\n const rplan = planQuery.refetch;\n const rpolicy = policyQuery.refetch;\n const rclaim = claimQuery.refetch;\n\n const reconcileReads = useCallback(async () => {\n const runners: Array<Promise<unknown>> = [];\n if (options.plans) runners.push(rp().catch(() => undefined));\n if (options.analytics) runners.push(ra().catch(() => undefined));\n if (options.policies) runners.push(rpol().catch(() => undefined));\n if (options.enrollment) runners.push(re().catch(() => undefined));\n if (options.claims) runners.push(rc().catch(() => undefined));\n if (options.loans) runners.push(rl().catch(() => undefined));\n if (options.planId) runners.push(rplan().catch(() => undefined));\n if (options.policyId) runners.push(rpolicy().catch(() => undefined));\n if (options.claimId) runners.push(rclaim().catch(() => undefined));\n await Promise.all(runners);\n }, [\n options.plans,\n options.analytics,\n options.policies,\n options.enrollment,\n options.claims,\n options.loans,\n options.planId,\n options.policyId,\n options.claimId,\n rp,\n ra,\n rpol,\n re,\n rc,\n rl,\n rplan,\n rpolicy,\n rclaim,\n ]);\n\n const [createPlanM] = useMutation<{ createHealthyBowlInputPlan: InputPlan }, { input: Record<string, unknown> }>(\n CREATE_PLAN\n );\n const [updatePlanM] = useMutation<{ updateHealthyBowlInputPlan: InputPlan }, { input: Record<string, unknown> }>(\n UPDATE_PLAN\n );\n const [deletePlanM] = useMutation<{ deleteHealthyBowlInputPlan: boolean }, { id: string; context: HbContext }>(\n DELETE_PLAN\n );\n const [addItemM] = useMutation<{ addHealthyBowlInputPlanItem: InputPlan }, { input: Record<string, unknown> }>(\n ADD_ITEM\n );\n const [updateItemM] = useMutation<{ updateHealthyBowlInputPlanItem: InputPlan }, { input: Record<string, unknown> }>(\n UPDATE_ITEM\n );\n const [deleteItemM] = useMutation<\n { deleteHealthyBowlInputPlanItem: InputPlan },\n { id: string; planId: string; context: HbContext }\n >(DELETE_ITEM);\n const [applyPmfbyM] = useMutation<{ applyForHealthyBowlPmfby: InsurancePolicy }, { input: Record<string, unknown> }>(\n APPLY_PMFBY\n );\n const [payPremiumM] = useMutation<\n { payHealthyBowlInsurancePremium: InsurancePolicy },\n { input: Record<string, unknown> }\n >(PAY_PREMIUM);\n const [checkoutPremiumM] = useMutation<\n { checkoutHealthyBowlInsurancePremium: PremiumCheckout },\n { input: Record<string, unknown> }\n >(CHECKOUT_PREMIUM);\n const [syncPremiumPaymentM] = useMutation<\n { syncHealthyBowlInsurancePremiumPayment: InsurancePolicy },\n { input: Record<string, unknown> }\n >(SYNC_PREMIUM_PAYMENT);\n const [updatePolicyM] = useMutation<\n { updateHealthyBowlInsurancePolicy: InsurancePolicy },\n { input: Record<string, unknown> }\n >(UPDATE_POLICY);\n const [deletePolicyM] = useMutation<\n { deleteHealthyBowlInsurancePolicy: boolean },\n { id: string; context: HbContext }\n >(DELETE_POLICY);\n const [fileClaimM] = useMutation<\n { fileHealthyBowlInsuranceClaim: InsuranceClaim },\n { input: Record<string, unknown> }\n >(FILE_CLAIM);\n const [addClaimEventM] = useMutation<\n { addHealthyBowlInsuranceClaimEvent: InsuranceClaim },\n { input: Record<string, unknown> }\n >(ADD_CLAIM_EVENT);\n const [updateClaimM] = useMutation<\n { updateHealthyBowlInsuranceClaim: InsuranceClaim },\n { input: Record<string, unknown> }\n >(UPDATE_CLAIM);\n const [requestLoanM] = useMutation<\n { requestHealthyBowlLoanFacilitation: LoanFacilitation },\n { input: Record<string, unknown> }\n >(REQUEST_LOAN);\n const [updateLoanM] = useMutation<\n { updateHealthyBowlLoanFacilitation: LoanFacilitation },\n { input: Record<string, unknown> }\n >(UPDATE_LOAN);\n const [revokeLoanM] = useMutation<\n { revokeHealthyBowlLoanFacilitation: LoanFacilitation },\n { id: string; context: HbContext }\n >(REVOKE_LOAN);\n\n const withCtx = useCallback((input: Record<string, unknown>) => ({ ...input, context: ctx }), [ctx]);\n\n return {\n plans: plansQuery.data?.getHealthyBowlInputPlans ?? [],\n analytics: analyticsQuery.data?.getHealthyBowlInputBudgetAnalytics ?? null,\n policies: policiesQuery.data?.getHealthyBowlInsurancePolicies ?? [],\n enrollment: enrollmentQuery.data?.getHealthyBowlInsuranceEnrollmentSummary ?? null,\n claims: claimsQuery.data?.getHealthyBowlInsuranceClaims ?? [],\n loans: loansQuery.data?.getHealthyBowlLoanFacilitations ?? [],\n plan: planQuery.data?.getHealthyBowlInputPlan ?? null,\n policy: policyQuery.data?.getHealthyBowlInsurancePolicy ?? null,\n claim: claimQuery.data?.getHealthyBowlInsuranceClaim ?? null,\n\n loading: {\n plans: plansQuery.loading,\n analytics: analyticsQuery.loading,\n policies: policiesQuery.loading,\n enrollment: enrollmentQuery.loading,\n claims: claimsQuery.loading,\n loans: loansQuery.loading,\n plan: planQuery.loading,\n policy: policyQuery.loading,\n claim: claimQuery.loading,\n },\n errors: {\n plans: plansQuery.error,\n analytics: analyticsQuery.error,\n policies: policiesQuery.error,\n enrollment: enrollmentQuery.error,\n claims: claimsQuery.error,\n loans: loansQuery.error,\n plan: planQuery.error,\n policy: policyQuery.error,\n claim: claimQuery.error,\n },\n refetchAll: reconcileReads,\n\n createPlan: useCallback(\n async (input: Record<string, unknown>): Promise<InputPlan | null> => {\n const res = await createPlanM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.createHealthyBowlInputPlan ?? null;\n },\n [createPlanM, withCtx, reconcileReads]\n ),\n updatePlan: useCallback(\n async (input: Record<string, unknown>): Promise<InputPlan | null> => {\n const res = await updatePlanM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlInputPlan ?? null;\n },\n [updatePlanM, withCtx, reconcileReads]\n ),\n deletePlan: useCallback(\n async (id: string): Promise<void> => {\n const res = await deletePlanM({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deletePlanM, ctx, reconcileReads]\n ),\n addItem: useCallback(\n async (input: Record<string, unknown>): Promise<InputPlan | null> => {\n const res = await addItemM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.addHealthyBowlInputPlanItem ?? null;\n },\n [addItemM, withCtx, reconcileReads]\n ),\n updateItem: useCallback(\n async (input: Record<string, unknown>): Promise<InputPlan | null> => {\n const res = await updateItemM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlInputPlanItem ?? null;\n },\n [updateItemM, withCtx, reconcileReads]\n ),\n deleteItem: useCallback(\n async (id: string, planId: string): Promise<void> => {\n const res = await deleteItemM({ variables: { id, planId, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deleteItemM, ctx, reconcileReads]\n ),\n\n applyPmfby: useCallback(\n async (input: Record<string, unknown>): Promise<InsurancePolicy | null> => {\n const res = await applyPmfbyM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.applyForHealthyBowlPmfby ?? null;\n },\n [applyPmfbyM, withCtx, reconcileReads]\n ),\n payPremium: useCallback(\n async (id: string, paymentMethodId?: string): Promise<InsurancePolicy | null> => {\n const res = await payPremiumM({\n variables: { input: withCtx({ id, ...(paymentMethodId ? { paymentMethodId } : {}) }) },\n });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.payHealthyBowlInsurancePremium ?? null;\n },\n [payPremiumM, withCtx, reconcileReads]\n ),\n /**\n * Start a real premium payment. Idempotent server-side — a re-checkout reuses the existing\n * BillingOrder rather than double-charging. Marks nothing paid.\n */\n checkoutPremium: useCallback(\n async (id: string): Promise<PremiumCheckout | null> => {\n const res = await checkoutPremiumM({ variables: { input: withCtx({ id }) } });\n if (res.error) throw res.error;\n return res.data?.checkoutHealthyBowlInsurancePremium ?? null;\n },\n [checkoutPremiumM, withCtx]\n ),\n /**\n * Ask the backend to settle the premium against the billing rail. It re-reads the authoritative\n * Payment and marks the premium PAID only if billing reports SUCCEEDED — so this is also the\n * right call when the farmer closes the widget without paying (the premium stays PROCESSING).\n */\n syncPremiumPayment: useCallback(\n async (id: string): Promise<InsurancePolicy | null> => {\n const res = await syncPremiumPaymentM({ variables: { input: withCtx({ id }) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.syncHealthyBowlInsurancePremiumPayment ?? null;\n },\n [syncPremiumPaymentM, withCtx, reconcileReads]\n ),\n updatePolicy: useCallback(\n async (input: Record<string, unknown>): Promise<InsurancePolicy | null> => {\n const res = await updatePolicyM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlInsurancePolicy ?? null;\n },\n [updatePolicyM, withCtx, reconcileReads]\n ),\n deletePolicy: useCallback(\n async (id: string): Promise<void> => {\n const res = await deletePolicyM({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deletePolicyM, ctx, reconcileReads]\n ),\n\n fileClaim: useCallback(\n async (input: Record<string, unknown>): Promise<InsuranceClaim | null> => {\n const res = await fileClaimM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.fileHealthyBowlInsuranceClaim ?? null;\n },\n [fileClaimM, withCtx, reconcileReads]\n ),\n addClaimEvent: useCallback(\n async (input: Record<string, unknown>): Promise<InsuranceClaim | null> => {\n const res = await addClaimEventM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.addHealthyBowlInsuranceClaimEvent ?? null;\n },\n [addClaimEventM, withCtx, reconcileReads]\n ),\n updateClaim: useCallback(\n async (input: Record<string, unknown>): Promise<InsuranceClaim | null> => {\n const res = await updateClaimM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlInsuranceClaim ?? null;\n },\n [updateClaimM, withCtx, reconcileReads]\n ),\n\n requestLoan: useCallback(\n async (input: Record<string, unknown>): Promise<LoanFacilitation | null> => {\n const res = await requestLoanM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.requestHealthyBowlLoanFacilitation ?? null;\n },\n [requestLoanM, withCtx, reconcileReads]\n ),\n updateLoan: useCallback(\n async (input: Record<string, unknown>): Promise<LoanFacilitation | null> => {\n const res = await updateLoanM({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlLoanFacilitation ?? null;\n },\n [updateLoanM, withCtx, reconcileReads]\n ),\n revokeLoan: useCallback(\n async (id: string): Promise<LoanFacilitation | null> => {\n const res = await revokeLoanM({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.revokeHealthyBowlLoanFacilitation ?? null;\n },\n [revokeLoanM, ctx, reconcileReads]\n ),\n };\n}\n"],"mappings":";;;;;AAqBA,IAAM,KAAwB,wCA+MxB,IA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