@burdenoff/microfe-govcitizenhub 2026.720.5 → 2026.720.7

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.
Files changed (33) hide show
  1. package/dist/govcitizenhub/hooks/index.d.ts +1 -0
  2. package/dist/govcitizenhub/hooks/index.d.ts.map +1 -1
  3. package/dist/govcitizenhub/hooks/index.js +1 -0
  4. package/dist/govcitizenhub/hooks/useGovApi.d.ts +23 -4
  5. package/dist/govcitizenhub/hooks/useGovApi.d.ts.map +1 -1
  6. package/dist/govcitizenhub/hooks/useGovApi.js +28 -11
  7. package/dist/govcitizenhub/hooks/useGovApi.js.map +1 -1
  8. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.d.ts +24 -0
  9. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.d.ts.map +1 -0
  10. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.js +40 -0
  11. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.js.map +1 -0
  12. package/dist/govcitizenhub/pages/agencies/AgenciesPage.d.ts +3 -2
  13. package/dist/govcitizenhub/pages/agencies/AgenciesPage.d.ts.map +1 -1
  14. package/dist/govcitizenhub/pages/agencies/AgenciesPage.js.map +1 -1
  15. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.d.ts.map +1 -1
  16. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js +169 -163
  17. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js.map +1 -1
  18. package/dist/govcitizenhub/pages/applications/NewApplicationPage.d.ts.map +1 -1
  19. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +151 -147
  20. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js.map +1 -1
  21. package/dist/govcitizenhub/pages/grievances/GrievancesPage.d.ts.map +1 -1
  22. package/dist/govcitizenhub/pages/grievances/GrievancesPage.js +173 -169
  23. package/dist/govcitizenhub/pages/grievances/GrievancesPage.js.map +1 -1
  24. package/dist/govcitizenhub/pages/payments/PaymentsPage.d.ts.map +1 -1
  25. package/dist/govcitizenhub/pages/payments/PaymentsPage.js +53 -49
  26. package/dist/govcitizenhub/pages/payments/PaymentsPage.js.map +1 -1
  27. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.d.ts.map +1 -1
  28. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js +82 -76
  29. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js.map +1 -1
  30. package/dist/govcitizenhub/pages/permits/PermitsPage.d.ts.map +1 -1
  31. package/dist/govcitizenhub/pages/permits/PermitsPage.js +174 -120
  32. package/dist/govcitizenhub/pages/permits/PermitsPage.js.map +1 -1
  33. package/package.json +1 -1
@@ -5,5 +5,6 @@
5
5
  export * from './useGovApi';
6
6
  export * from './useCursorPager';
7
7
  export * from './useFiles';
8
+ export * from './useGovCitizenHubAnalytics';
8
9
  export * from './useIsMobileViewport';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/govcitizenhub/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/govcitizenhub/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -2,3 +2,4 @@ import "./useIsMobileViewport.js";
2
2
  import "./useGovApi.js";
3
3
  import "./useCursorPager.js";
4
4
  import "./useFiles.js";
5
+ import "./useGovCitizenHubAnalytics.js";
@@ -88,10 +88,9 @@ export interface PermitFilters {
88
88
  pagination?: PaginationInput;
89
89
  }
90
90
  /**
91
- * `govListPermits` returns a bare ARRAY (not a connection), but now accepts an
92
- * optional offset `pagination` arg (default page size 50). Callers page with
93
- * `{ limit, offset }`; `hasMore` is inferred from a full-length page since the
94
- * svc does not return a total.
91
+ * `govListPermits` returns a paginated `GovPermitConnection`, flattened to a
92
+ * plain array here since PermitsPage reads `data` as GovPermit[] and infers
93
+ * `hasMore` itself from a full-length page. Callers page with `{ limit, offset }`.
95
94
  */
96
95
  export declare const useGovPermits: (filters?: PermitFilters) => import('@tanstack/react-query').UseQueryResult<GovPermit[], Error>;
97
96
  export declare const useGovIssuePermit: () => import('@tanstack/react-query').UseMutationResult<GovPermit, Error, GovIssuePermitInput, unknown>;
@@ -99,6 +98,26 @@ export declare const useGovRevokePermit: () => import('@tanstack/react-query').U
99
98
  id: string;
100
99
  reason?: string | null;
101
100
  }, unknown>;
101
+ /**
102
+ * Render the permit as a downloadable/printable PDF (BOFF-4060). A mutation
103
+ * (not a query) even though the backend field is a GraphQL Query: it's a
104
+ * client-triggered, non-cached action fired from a "Download" / "Print"
105
+ * button, exactly like the `getBlob` thunk in the platform's Save-to-Files
106
+ * pattern — the bytes are only assembled when the officer actually clicks.
107
+ */
108
+ export declare const useGovPermitPdf: () => import('@tanstack/react-query').UseMutationResult<{
109
+ pdfBase64: string;
110
+ filename: string;
111
+ generatedAt: string;
112
+ }, Error, string, unknown>;
113
+ /**
114
+ * Persist a `wspace-files-svc` File reference onto an issued permit once the
115
+ * client has saved the rendered PDF via the platform's Save-to-Files flow.
116
+ */
117
+ export declare const useGovAttachPermitFile: () => import('@tanstack/react-query').UseMutationResult<GovPermit, Error, {
118
+ id: string;
119
+ fileId: string;
120
+ }, unknown>;
102
121
  /**
103
122
  * Public permit verification by printed code. `govVerifyPermit` is a PUBLIC field
104
123
  * (no auth), but we keep the workspace-token transport for a consistent gateway
@@ -1 +1 @@
1
- {"version":3,"file":"useGovApi.d.ts","sourceRoot":"","sources":["../../../src/govcitizenhub/hooks/useG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AAM;YACF,kBAAkB;iBACb,MAAM,GAAG,IAAI;WAgB/B,CAAC"}
1
+ {"version":3,"file":"useGovApi.d.ts","sourceRoot":"","sources":["../../../src/govcitizenhub/hooks/useGovApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,eAAe,EAChB,MAAM,UAAU,CAAC;AAsIlB,eAAO,MAAM,sBAAsB,kFA8BlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,uFAevC,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,2BAA2B,2FAevC,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,wBAAwB,wFAepC,CAAC;AAQF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,eAAO,MAAM,cAAc,GAAI,UAAS,aAAkB,uEAkBzD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,GAAG,SAAS,4EAgBlD,CAAC;AAEF,eAAO,MAAM,kBAAkB,0GAgB9B,CAAC;AAEF,eAAO,MAAM,kBAAkB;QAII,MAAM;WAAS,oBAAoB;WAerE,CAAC;AAEF,eAAO,MAAM,mBAAmB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EAAE,eAAe,CAAC;CAC9B;AAED,eAAO,MAAM,gBAAgB,GAAI,UAAS,gBAAqB,uFAuB9D,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,GAAG,SAAS,+EAgBrD,CAAC;AAEF,eAAO,MAAM,qBAAqB,gHAgBjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;QAIC,MAAM;WAAS,uBAAuB;WAexE,CAAC;AAEF,eAAO,MAAM,yBAAyB;QAK5B,MAAM;YACF,kBAAkB;iBACb,MAAM,GAAG,IAAI;WAgB/B,CAAC"}
@@ -97,11 +97,14 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
97
97
  return r({
98
98
  queryKey: [...c.agencies, t],
99
99
  queryFn: async () => (await s(`query GovListAgencies($isActive: Boolean, $pagination: PaginationInput) {
100
- govListAgencies(isActive: $isActive, pagination: $pagination) { ${d} }
100
+ govListAgencies(isActive: $isActive, pagination: $pagination) {
101
+ items { ${d} }
102
+ pageInfo { cursor hasMore }
103
+ }
101
104
  }`, {
102
105
  isActive: t.isActive,
103
106
  pagination: u(t.pagination ?? { limit: 100 })
104
- }, n)).govListAgencies
107
+ }, n)).govListAgencies.items
105
108
  });
106
109
  }, w = (t) => {
107
110
  let { apiGatewayUrl: n } = e();
@@ -340,13 +343,16 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
340
343
  return r({
341
344
  queryKey: [...c.permits, t],
342
345
  queryFn: async () => (await s(`query GovListPermits($holderId: ID, $serviceId: ID, $status: GovPermitStatus, $pagination: PaginationInput) {
343
- govListPermits(holderId: $holderId, serviceId: $serviceId, status: $status, pagination: $pagination) { ${h} }
346
+ govListPermits(holderId: $holderId, serviceId: $serviceId, status: $status, pagination: $pagination) {
347
+ items { ${h} }
348
+ pageInfo { cursor hasMore }
349
+ }
344
350
  }`, {
345
351
  holderId: t.holderId,
346
352
  serviceId: t.serviceId,
347
353
  status: t.status,
348
354
  pagination: u(t.pagination)
349
- }, n)).govListPermits
355
+ }, n)).govListPermits.items
350
356
  });
351
357
  }, K = () => {
352
358
  let { apiGatewayUrl: t } = e(), r = i();
@@ -366,7 +372,18 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
366
372
  }`, e, t)).govRevokePermit,
367
373
  onSuccess: () => r.invalidateQueries({ queryKey: c.permits })
368
374
  });
369
- }, J = (t) => {
375
+ }, J = () => {
376
+ let { apiGatewayUrl: t } = e();
377
+ return n({ mutationFn: async (e) => (await s("query GovPermitPdf($id: ID!) {\n govPermitPdf(id: $id) { pdfBase64 filename generatedAt }\n }", { id: e }, t)).govPermitPdf });
378
+ }, Y = () => {
379
+ let { apiGatewayUrl: t } = e(), r = i();
380
+ return n({
381
+ mutationFn: async (e) => (await s(`mutation GovAttachPermitFile($id: ID!, $fileId: ID!) {
382
+ govAttachPermitFile(id: $id, fileId: $fileId) { ${h} }
383
+ }`, e, t)).govAttachPermitFile,
384
+ onSuccess: () => r.invalidateQueries({ queryKey: c.permits })
385
+ });
386
+ }, X = (t) => {
370
387
  let { apiGatewayUrl: n } = e();
371
388
  return r({
372
389
  queryKey: [
@@ -380,7 +397,7 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
380
397
  govVerifyPermit(verificationCode: $verificationCode) { ${h} }
381
398
  }`, { verificationCode: t }, n)).govVerifyPermit
382
399
  });
383
- }, Y = (t = {}) => {
400
+ }, Z = (t = {}) => {
384
401
  let { apiGatewayUrl: n } = e();
385
402
  return r({
386
403
  queryKey: [...c.grievances, t],
@@ -396,7 +413,7 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
396
413
  pagination: u(t.pagination)
397
414
  }, n)).govListGrievances
398
415
  });
399
- }, X = (t) => {
416
+ }, Q = (t) => {
400
417
  let { apiGatewayUrl: n } = e();
401
418
  return r({
402
419
  queryKey: c.grievance(t ?? ""),
@@ -405,7 +422,7 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
405
422
  govGrievance(id: $id) { ${v} }
406
423
  }`, { id: t }, n)).govGrievance
407
424
  });
408
- }, Z = () => {
425
+ }, $ = () => {
409
426
  let { apiGatewayUrl: t } = e(), r = i();
410
427
  return n({
411
428
  mutationFn: async (e) => (await s(`mutation GovReportGrievance($input: GovReportGrievanceInput!) {
@@ -413,7 +430,7 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
413
430
  }`, { input: e }, t)).govReportGrievance,
414
431
  onSuccess: () => r.invalidateQueries({ queryKey: c.grievances })
415
432
  });
416
- }, Q = () => {
433
+ }, te = () => {
417
434
  let { apiGatewayUrl: t } = e(), r = i();
418
435
  return n({
419
436
  mutationFn: async (e) => (await s(`mutation GovUpdateGrievance($id: ID!, $input: GovUpdateGrievanceInput!) {
@@ -423,7 +440,7 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
423
440
  r.invalidateQueries({ queryKey: c.grievances }), r.invalidateQueries({ queryKey: c.grievance(e.id) });
424
441
  }
425
442
  });
426
- }, $ = () => {
443
+ }, ne = () => {
427
444
  let { apiGatewayUrl: t } = e(), r = i();
428
445
  return n({
429
446
  mutationFn: async (e) => (await s(`mutation GovTransitionGrievance($id: ID!, $status: GovGrievanceStatus!, $resolution: String) {
@@ -435,6 +452,6 @@ var o = (e) => /^\s*mutation\b/.test(e), s = async (e, n, r) => {
435
452
  });
436
453
  };
437
454
  //#endregion
438
- export { B as useGovAddCaseNote, R as useGovAddDocument, C as useGovAgencies, w as useGovAgency, P as useGovApplication, x as useGovApplicationSlaSummary, N as useGovApplications, S as useGovApplicationsByService, D as useGovArchiveAgency, T as useGovCreateAgency, ee as useGovCreateApplication, H as useGovCreatePayment, A as useGovCreateService, b as useGovDashboardSummary, X as useGovGrievance, Y as useGovGrievances, K as useGovIssuePermit, U as useGovMarkPaymentPaid, V as useGovPayments, G as useGovPermits, W as useGovRefundPayment, Z as useGovReportGrievance, z as useGovReviewDocument, q as useGovRevokePermit, k as useGovService, O as useGovServices, I as useGovSubmitApplication, L as useGovTransitionApplication, $ as useGovTransitionGrievance, M as useGovTransitionService, E as useGovUpdateAgency, F as useGovUpdateApplication, Q as useGovUpdateGrievance, j as useGovUpdateService, J as useGovVerifyPermit };
455
+ export { B as useGovAddCaseNote, R as useGovAddDocument, C as useGovAgencies, w as useGovAgency, P as useGovApplication, x as useGovApplicationSlaSummary, N as useGovApplications, S as useGovApplicationsByService, D as useGovArchiveAgency, Y as useGovAttachPermitFile, T as useGovCreateAgency, ee as useGovCreateApplication, H as useGovCreatePayment, A as useGovCreateService, b as useGovDashboardSummary, Q as useGovGrievance, Z as useGovGrievances, K as useGovIssuePermit, U as useGovMarkPaymentPaid, V as useGovPayments, J as useGovPermitPdf, G as useGovPermits, W as useGovRefundPayment, $ as useGovReportGrievance, z as useGovReviewDocument, q as useGovRevokePermit, k as useGovService, O as useGovServices, I as useGovSubmitApplication, L as useGovTransitionApplication, ne as useGovTransitionGrievance, M as useGovTransitionService, E as useGovUpdateAgency, F as useGovUpdateApplication, te as useGovUpdateGrievance, j as useGovUpdateService, X as useGovVerifyPermit };
439
456
 
440
457
  //# sourceMappingURL=useGovApi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGovApi.js","names":[],"sources":["../../../src/govcitizenhub/hooks/useGovApi.ts"],"sourcesContent":["/**\n * GovCitizenHub API hooks\n * @module govcitizenhub/hooks\n *\n * React-Query hooks wired DIRECTLY to the real `wspace-govcitizenhub-svc`\n * federated GraphQL contract (the `gov*` operations). Every query/mutation below\n * uses an inline gql string whose fields match the svc `.hive-schema.graphql`\n * exactly. No mock data.\n *\n * Transport: `graphqlFetch({ gateway: 'workspace', workspaceToken: true })` — the\n * host shell supplies the gateway base URL + a workspace-scoped token.\n *\n * IMPORTANT: `User`/`File` are id-only federation stubs in this subgraph. We\n * never select `citizen { firstName }` or `file { url }`.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useGovCitizenHub } from '../context';\nimport { clearGraphqlResponseCache } from '../lib/graphql-cache';\nimport type {\n GovConnection,\n GovAgency,\n GovService,\n GovServiceCategory,\n GovServiceStatus,\n GovApplication,\n GovApplicationStatus,\n GovDocument,\n GovDocumentStatus,\n GovCaseNote,\n GovPermit,\n GovPermitStatus,\n GovPayment,\n GovPaymentStatus,\n GovGrievance,\n GovGrievanceStatus,\n GovCreateAgencyInput,\n GovUpdateAgencyInput,\n GovCreateServiceInput,\n GovUpdateServiceInput,\n GovCreateApplicationInput,\n GovUpdateApplicationInput,\n GovAddDocumentInput,\n GovAddCaseNoteInput,\n GovCreatePaymentInput,\n GovIssuePermitInput,\n GovReportGrievanceInput,\n GovUpdateGrievanceInput,\n GovDashboardSummary,\n GovApplicationSlaSummary,\n GovServiceApplicationCount,\n GovDeskApplicationCount,\n PaginationInput,\n} from '../types';\n\n// ============================================================================\n// Transport\n// ============================================================================\n\nconst isMutation = (query: string): boolean => /^\\s*mutation\\b/.test(query);\n\nconst govQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n // A mutation must never be served from — or coalesced onto — the read cache,\n // and the resolved read cache must be dropped once it commits so the\n // React-Query refetch that follows sees the new state, not a stale (≤15s)\n // pre-write response. Clear before AND after the write.\n const mutating = isMutation(query);\n if (mutating) clearGraphqlResponseCache();\n\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (mutating) clearGraphqlResponseCache();\n\n // GraphQL partial success: the gateway can attach a non-fatal top-level error\n // (e.g. a be-sdk activity/usage tracking side-effect) alongside a fully-resolved\n // payload. Only treat the request as failed when it produced NO usable data —\n // otherwise the operation genuinely succeeded and surfacing the background error\n // as a destructive toast would mislead the user.\n const data = response.data as Record<string, unknown> | null | undefined;\n const hasUsableData =\n data != null && Object.values(data).some((value) => value !== null && value !== undefined);\n\n if (!hasUsableData) {\n throw new Error(response.errors?.[0]?.message ?? 'GraphQL response did not include data');\n }\n if (response.errors?.length) {\n // Non-fatal: keep the data, but leave a breadcrumb for diagnostics.\n console.warn('[govcitizenhub] GraphQL partial error (data returned):', response.errors);\n }\n return response.data as TData;\n};\n\n// React-Query key roots (one namespace per domain entity).\nconst KEY = {\n dashboard: ['govcitizenhub', 'dashboard-summary'] as const,\n applicationSlaSummary: ['govcitizenhub', 'application-sla-summary'] as const,\n applicationsByService: ['govcitizenhub', 'applications-by-service'] as const,\n applicationsByDesk: ['govcitizenhub', 'applications-by-desk'] as const,\n agencies: ['govcitizenhub', 'agencies'] as const,\n agency: (id: string) => ['govcitizenhub', 'agency', id] as const,\n services: ['govcitizenhub', 'services'] as const,\n service: (id: string) => ['govcitizenhub', 'service', id] as const,\n applications: ['govcitizenhub', 'applications'] as const,\n application: (id: string) => ['govcitizenhub', 'application', id] as const,\n payments: ['govcitizenhub', 'payments'] as const,\n payment: (id: string) => ['govcitizenhub', 'payment', id] as const,\n permits: ['govcitizenhub', 'permits'] as const,\n grievances: ['govcitizenhub', 'grievances'] as const,\n grievance: (id: string) => ['govcitizenhub', 'grievance', id] as const,\n};\n\nconst DEFAULT_PAGE: PaginationInput = { limit: 50 };\n\n/** Build a clean PaginationInput, dropping nullish cursor so the svc never sees `cursor: null`. */\nconst page = (p?: PaginationInput): PaginationInput => {\n const base = p ?? DEFAULT_PAGE;\n const result: PaginationInput = { limit: base.limit ?? DEFAULT_PAGE.limit };\n if (base.offset != null) result.offset = base.offset;\n if (base.cursor != null) result.cursor = base.cursor;\n return result;\n};\n\n// ============================================================================\n// Reusable gql field selections (codegen-free strictness)\n// ============================================================================\n\nconst AGENCY_FIELDS = `\n id workspaceId code contactEmail contactPhone description isActive jurisdiction\n name tags createdAt updatedAt\n`;\n\nconst SERVICE_FIELDS = `\n id workspaceId agencyId category currency eligibility feeAmount feeType formSchema\n name publishedAt requiredDocuments slaDays slug status summary tags createdAt updatedAt\n`;\n\nconst DOCUMENT_FIELDS = `\n id workspaceId applicationId name status requirement rejectionReason\n file { id } createdAt updatedAt\n`;\n\nconst CASE_NOTE_FIELDS = `\n id workspaceId applicationId authorId body type createdAt updatedAt\n`;\n\nconst PERMIT_FIELDS = `\n id workspaceId applicationId serviceId holderId title verificationCode status\n issuedAt expiresAt revokedAt revokeReason file { id } createdAt updatedAt\n`;\n\nconst PAYMENT_FIELDS = `\n id workspaceId applicationId payerId amount currency status receiptNumber\n providerRef lineItems paidAt refundedAt createdAt updatedAt\n`;\n\nconst APPLICATION_FIELDS = `\n id workspaceId reference serviceId citizenId assignedToId status priority dueDate\n submittedAt decidedAt decisionReason tags createdAt updatedAt\n`;\n\nconst GRIEVANCE_FIELDS = `\n id workspaceId title description category status priority location latitude longitude\n photoFileIds reporterId agencyId assignedToId resolution resolvedAt tags createdAt updatedAt\n`;\n\n// ============================================================================\n// Dashboard summary (authoritative, backend-computed counts)\n// ============================================================================\n\n/**\n * Reads `govDashboardSummary` — the svc-computed operations totals. These are\n * authoritative (full-corpus counts, not a capped client-side window), so the\n * dashboard tiles and status donut MUST source from here, never from a paged\n * list's `items.length`.\n */\nconst DASHBOARD_TREND_FIELDS = `current previous changePercent direction`;\n\nexport const useGovDashboardSummary = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.dashboard,\n queryFn: async () => {\n const result = await govQuery<{ govDashboardSummary: GovDashboardSummary }>(\n `query GovDashboardSummary {\n govDashboardSummary {\n applicationsTotal\n applicationsByStatus { status count }\n pendingPayments\n pendingPaymentsAmount\n openGrievances\n activePermits\n publishedServices\n activeAgencies\n applicationsTotalTrend { ${DASHBOARD_TREND_FIELDS} }\n pendingPaymentsTrend { ${DASHBOARD_TREND_FIELDS} }\n openGrievancesTrend { ${DASHBOARD_TREND_FIELDS} }\n activePermitsTrend { ${DASHBOARD_TREND_FIELDS} }\n publishedServicesTrend { ${DASHBOARD_TREND_FIELDS} }\n activeAgenciesTrend { ${DASHBOARD_TREND_FIELDS} }\n }\n }`,\n {},\n apiGatewayUrl\n );\n return result.govDashboardSummary;\n },\n });\n};\n\n/**\n * Reads `govApplicationSlaSummary` — the svc-computed, corpus-wide SLA\n * breakdown across every non-terminal application. Unlike a page-level SLA\n * strip, this is accurate regardless of which page of results is loaded.\n */\nexport const useGovApplicationSlaSummary = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.applicationSlaSummary,\n queryFn: async () => {\n const result = await govQuery<{ govApplicationSlaSummary: GovApplicationSlaSummary }>(\n `query GovApplicationSlaSummary {\n govApplicationSlaSummary { onTrack dueSoon overdue noDueDate }\n }`,\n {},\n apiGatewayUrl\n );\n return result.govApplicationSlaSummary;\n },\n });\n};\n\n/** Reads `govApplicationsByService` — corpus-wide application volume per service. */\nexport const useGovApplicationsByService = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.applicationsByService,\n queryFn: async () => {\n const result = await govQuery<{ govApplicationsByService: GovServiceApplicationCount[] }>(\n `query GovApplicationsByService {\n govApplicationsByService { serviceId serviceName count }\n }`,\n {},\n apiGatewayUrl\n );\n return result.govApplicationsByService;\n },\n });\n};\n\n/** Reads `govApplicationsByDesk` — corpus-wide application volume per assigned officer. */\nexport const useGovApplicationsByDesk = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.applicationsByDesk,\n queryFn: async () => {\n const result = await govQuery<{ govApplicationsByDesk: GovDeskApplicationCount[] }>(\n `query GovApplicationsByDesk {\n govApplicationsByDesk { assignedToId count }\n }`,\n {},\n apiGatewayUrl\n );\n return result.govApplicationsByDesk;\n },\n });\n};\n\n// ============================================================================\n// Agencies (list = ARRAY, not a connection)\n// ============================================================================\n\nexport interface AgencyFilters {\n isActive?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useGovAgencies = (filters: AgencyFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.agencies, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListAgencies: GovAgency[] }>(\n `query GovListAgencies($isActive: Boolean, $pagination: PaginationInput) {\n govListAgencies(isActive: $isActive, pagination: $pagination) { ${AGENCY_FIELDS} }\n }`,\n { isActive: filters.isActive, pagination: page(filters.pagination ?? { limit: 100 }) },\n apiGatewayUrl\n );\n return result.govListAgencies;\n },\n });\n};\n\nexport const useGovAgency = (id: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.agency(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await govQuery<{ govAgency: GovAgency | null }>(\n `query GovAgency($id: ID!) {\n govAgency(id: $id) { ${AGENCY_FIELDS} services { ${SERVICE_FIELDS} } }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govAgency;\n },\n });\n};\n\nexport const useGovCreateAgency = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovCreateAgencyInput) => {\n const result = await govQuery<{ govCreateAgency: GovAgency }>(\n `mutation GovCreateAgency($input: GovCreateAgencyInput!) {\n govCreateAgency(input: $input) { ${AGENCY_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govCreateAgency;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.agencies }),\n });\n};\n\nexport const useGovUpdateAgency = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: GovUpdateAgencyInput }) => {\n const result = await govQuery<{ govUpdateAgency: GovAgency }>(\n `mutation GovUpdateAgency($id: ID!, $input: GovUpdateAgencyInput!) {\n govUpdateAgency(id: $id, input: $input) { ${AGENCY_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govUpdateAgency;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.agencies });\n qc.invalidateQueries({ queryKey: KEY.agency(data.id) });\n },\n });\n};\n\nexport const useGovArchiveAgency = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await govQuery<{ govArchiveAgency: boolean }>(\n `mutation GovArchiveAgency($id: ID!) { govArchiveAgency(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return result.govArchiveAgency;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.agencies }),\n });\n};\n\n// ============================================================================\n// Services (connection)\n// ============================================================================\n\nexport interface ServiceFilters {\n agencyId?: string;\n category?: GovServiceCategory;\n status?: GovServiceStatus;\n pagination?: PaginationInput;\n}\n\nexport const useGovServices = (filters: ServiceFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.services, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListServices: GovConnection<GovService> }>(\n `query GovListServices($agencyId: ID, $category: GovServiceCategory, $status: GovServiceStatus, $pagination: PaginationInput) {\n govListServices(agencyId: $agencyId, category: $category, status: $status, pagination: $pagination) {\n items { ${SERVICE_FIELDS} agency { id name } }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n agencyId: filters.agencyId,\n category: filters.category,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListServices;\n },\n });\n};\n\nexport const useGovService = (id: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.service(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await govQuery<{ govService: GovService | null }>(\n `query GovService($id: ID!) {\n govService(id: $id) { ${SERVICE_FIELDS} agency { ${AGENCY_FIELDS} } }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govService;\n },\n });\n};\n\nexport const useGovCreateService = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovCreateServiceInput) => {\n const result = await govQuery<{ govCreateService: GovService }>(\n `mutation GovCreateService($input: GovCreateServiceInput!) {\n govCreateService(input: $input) { ${SERVICE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govCreateService;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.services }),\n });\n};\n\nexport const useGovUpdateService = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: GovUpdateServiceInput }) => {\n const result = await govQuery<{ govUpdateService: GovService }>(\n `mutation GovUpdateService($id: ID!, $input: GovUpdateServiceInput!) {\n govUpdateService(id: $id, input: $input) { ${SERVICE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govUpdateService;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.services });\n qc.invalidateQueries({ queryKey: KEY.service(data.id) });\n },\n });\n};\n\nexport const useGovTransitionService = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; status: GovServiceStatus }) => {\n const result = await govQuery<{ govTransitionService: GovService }>(\n `mutation GovTransitionService($id: ID!, $status: GovServiceStatus!) {\n govTransitionService(id: $id, status: $status) { ${SERVICE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govTransitionService;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.services });\n qc.invalidateQueries({ queryKey: KEY.service(data.id) });\n },\n });\n};\n\n// ============================================================================\n// Applications (connection)\n// ============================================================================\n\nexport interface ApplicationFilters {\n assignedToId?: string;\n citizenId?: string;\n serviceId?: string;\n status?: GovApplicationStatus;\n pagination?: PaginationInput;\n}\n\nexport const useGovApplications = (filters: ApplicationFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.applications, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListApplications: GovConnection<GovApplication> }>(\n `query GovListApplications($assignedToId: ID, $citizenId: ID, $serviceId: ID, $status: GovApplicationStatus, $pagination: PaginationInput) {\n govListApplications(assignedToId: $assignedToId, citizenId: $citizenId, serviceId: $serviceId, status: $status, pagination: $pagination) {\n items { ${APPLICATION_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n assignedToId: filters.assignedToId,\n citizenId: filters.citizenId,\n serviceId: filters.serviceId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListApplications;\n },\n });\n};\n\nexport const useGovApplication = (id: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.application(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await govQuery<{ govApplication: GovApplication | null }>(\n `query GovApplication($id: ID!) {\n govApplication(id: $id) {\n ${APPLICATION_FIELDS}\n formData\n documents { ${DOCUMENT_FIELDS} }\n notes { ${CASE_NOTE_FIELDS} }\n permits { ${PERMIT_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govApplication;\n },\n });\n};\n\nexport const useGovCreateApplication = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovCreateApplicationInput) => {\n const result = await govQuery<{ govCreateApplication: GovApplication }>(\n `mutation GovCreateApplication($input: GovCreateApplicationInput!) {\n govCreateApplication(input: $input) { ${APPLICATION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govCreateApplication;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.applications }),\n });\n};\n\nexport const useGovUpdateApplication = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: GovUpdateApplicationInput }) => {\n const result = await govQuery<{ govUpdateApplication: GovApplication }>(\n `mutation GovUpdateApplication($id: ID!, $input: GovUpdateApplicationInput!) {\n govUpdateApplication(id: $id, input: $input) { ${APPLICATION_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govUpdateApplication;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.applications });\n qc.invalidateQueries({ queryKey: KEY.application(data.id) });\n },\n });\n};\n\nexport const useGovSubmitApplication = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await govQuery<{ govSubmitApplication: GovApplication }>(\n `mutation GovSubmitApplication($id: ID!) {\n govSubmitApplication(id: $id) { ${APPLICATION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govSubmitApplication;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.applications });\n qc.invalidateQueries({ queryKey: KEY.application(data.id) });\n },\n });\n};\n\nexport const useGovTransitionApplication = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: {\n id: string;\n status: GovApplicationStatus;\n reason?: string | null;\n }) => {\n const result = await govQuery<{ govTransitionApplication: GovApplication }>(\n `mutation GovTransitionApplication($id: ID!, $status: GovApplicationStatus!, $reason: String) {\n govTransitionApplication(id: $id, status: $status, reason: $reason) { ${APPLICATION_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govTransitionApplication;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.applications });\n qc.invalidateQueries({ queryKey: KEY.application(data.id) });\n },\n });\n};\n\n// ============================================================================\n// Documents (attached to an application)\n// ============================================================================\n\nexport const useGovAddDocument = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovAddDocumentInput) => {\n const result = await govQuery<{ govAddDocument: GovDocument }>(\n `mutation GovAddDocument($input: GovAddDocumentInput!) {\n govAddDocument(input: $input) { ${DOCUMENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govAddDocument;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n qc.invalidateQueries({ queryKey: KEY.applications });\n },\n });\n};\n\nexport const useGovReviewDocument = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: {\n id: string;\n status: GovDocumentStatus;\n rejectionReason?: string | null;\n applicationId?: string;\n }) => {\n const result = await govQuery<{ govReviewDocument: GovDocument }>(\n `mutation GovReviewDocument($id: ID!, $status: GovDocumentStatus!, $rejectionReason: String) {\n govReviewDocument(id: $id, status: $status, rejectionReason: $rejectionReason) { ${DOCUMENT_FIELDS} }\n }`,\n { id: vars.id, status: vars.status, rejectionReason: vars.rejectionReason },\n apiGatewayUrl\n );\n return result.govReviewDocument;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n },\n });\n};\n\n// ============================================================================\n// Case notes (domain-owned casework timeline)\n// ============================================================================\n\nexport const useGovAddCaseNote = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovAddCaseNoteInput) => {\n const result = await govQuery<{ govAddCaseNote: GovCaseNote }>(\n `mutation GovAddCaseNote($input: GovAddCaseNoteInput!) {\n govAddCaseNote(input: $input) { ${CASE_NOTE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govAddCaseNote;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n },\n });\n};\n\n// ============================================================================\n// Payments (connection)\n// ============================================================================\n\nexport interface PaymentFilters {\n applicationId?: string;\n payerId?: string;\n status?: GovPaymentStatus;\n pagination?: PaginationInput;\n}\n\nexport const useGovPayments = (filters: PaymentFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.payments, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListPayments: GovConnection<GovPayment> }>(\n `query GovListPayments($applicationId: ID, $payerId: ID, $status: GovPaymentStatus, $pagination: PaginationInput) {\n govListPayments(applicationId: $applicationId, payerId: $payerId, status: $status, pagination: $pagination) {\n items { ${PAYMENT_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n applicationId: filters.applicationId,\n payerId: filters.payerId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListPayments;\n },\n });\n};\n\nexport const useGovCreatePayment = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovCreatePaymentInput) => {\n const result = await govQuery<{ govCreatePayment: GovPayment }>(\n `mutation GovCreatePayment($input: GovCreatePaymentInput!) {\n govCreatePayment(input: $input) { ${PAYMENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govCreatePayment;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.payments });\n if (data.applicationId)\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n },\n });\n};\n\nexport const useGovMarkPaymentPaid = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; providerRef?: string | null }) => {\n const result = await govQuery<{ govMarkPaymentPaid: GovPayment }>(\n `mutation GovMarkPaymentPaid($id: ID!, $providerRef: String) {\n govMarkPaymentPaid(id: $id, providerRef: $providerRef) { ${PAYMENT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govMarkPaymentPaid;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.payments }),\n });\n};\n\nexport const useGovRefundPayment = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await govQuery<{ govRefundPayment: GovPayment }>(\n `mutation GovRefundPayment($id: ID!) {\n govRefundPayment(id: $id) { ${PAYMENT_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govRefundPayment;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.payments }),\n });\n};\n\n// ============================================================================\n// Permits (list = ARRAY, no pagination) + public verification\n// ============================================================================\n\nexport interface PermitFilters {\n holderId?: string;\n serviceId?: string;\n status?: GovPermitStatus;\n pagination?: PaginationInput;\n}\n\n/**\n * `govListPermits` returns a bare ARRAY (not a connection), but now accepts an\n * optional offset `pagination` arg (default page size 50). Callers page with\n * `{ limit, offset }`; `hasMore` is inferred from a full-length page since the\n * svc does not return a total.\n */\nexport const useGovPermits = (filters: PermitFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.permits, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListPermits: GovPermit[] }>(\n `query GovListPermits($holderId: ID, $serviceId: ID, $status: GovPermitStatus, $pagination: PaginationInput) {\n govListPermits(holderId: $holderId, serviceId: $serviceId, status: $status, pagination: $pagination) { ${PERMIT_FIELDS} }\n }`,\n {\n holderId: filters.holderId,\n serviceId: filters.serviceId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListPermits;\n },\n });\n};\n\nexport const useGovIssuePermit = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovIssuePermitInput) => {\n const result = await govQuery<{ govIssuePermit: GovPermit }>(\n `mutation GovIssuePermit($input: GovIssuePermitInput!) {\n govIssuePermit(input: $input) { ${PERMIT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govIssuePermit;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.permits });\n if (data.applicationId)\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n },\n });\n};\n\nexport const useGovRevokePermit = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; reason?: string | null }) => {\n const result = await govQuery<{ govRevokePermit: GovPermit }>(\n `mutation GovRevokePermit($id: ID!, $reason: String) {\n govRevokePermit(id: $id, reason: $reason) { ${PERMIT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govRevokePermit;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.permits }),\n });\n};\n\n/**\n * Public permit verification by printed code. `govVerifyPermit` is a PUBLIC field\n * (no auth), but we keep the workspace-token transport for a consistent gateway\n * path. `enabled` is false until a code is supplied so the query is manual.\n */\nexport const useGovVerifyPermit = (verificationCode: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: ['govcitizenhub', 'verify-permit', verificationCode ?? ''],\n enabled: Boolean(verificationCode),\n retry: false,\n queryFn: async () => {\n const result = await govQuery<{ govVerifyPermit: GovPermit | null }>(\n `query GovVerifyPermit($verificationCode: String!) {\n govVerifyPermit(verificationCode: $verificationCode) { ${PERMIT_FIELDS} }\n }`,\n { verificationCode },\n apiGatewayUrl\n );\n return result.govVerifyPermit;\n },\n });\n};\n\n// ============================================================================\n// Grievances (connection)\n// ============================================================================\n\nexport interface GrievanceFilters {\n agencyId?: string;\n reporterId?: string;\n status?: GovGrievanceStatus;\n pagination?: PaginationInput;\n}\n\nexport const useGovGrievances = (filters: GrievanceFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.grievances, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListGrievances: GovConnection<GovGrievance> }>(\n `query GovListGrievances($agencyId: ID, $reporterId: ID, $status: GovGrievanceStatus, $pagination: PaginationInput) {\n govListGrievances(agencyId: $agencyId, reporterId: $reporterId, status: $status, pagination: $pagination) {\n items { ${GRIEVANCE_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n agencyId: filters.agencyId,\n reporterId: filters.reporterId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListGrievances;\n },\n });\n};\n\nexport const useGovGrievance = (id: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.grievance(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await govQuery<{ govGrievance: GovGrievance | null }>(\n `query GovGrievance($id: ID!) {\n govGrievance(id: $id) { ${GRIEVANCE_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govGrievance;\n },\n });\n};\n\nexport const useGovReportGrievance = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovReportGrievanceInput) => {\n const result = await govQuery<{ govReportGrievance: GovGrievance }>(\n `mutation GovReportGrievance($input: GovReportGrievanceInput!) {\n govReportGrievance(input: $input) { ${GRIEVANCE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govReportGrievance;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.grievances }),\n });\n};\n\nexport const useGovUpdateGrievance = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: GovUpdateGrievanceInput }) => {\n const result = await govQuery<{ govUpdateGrievance: GovGrievance }>(\n `mutation GovUpdateGrievance($id: ID!, $input: GovUpdateGrievanceInput!) {\n govUpdateGrievance(id: $id, input: $input) { ${GRIEVANCE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govUpdateGrievance;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.grievances });\n qc.invalidateQueries({ queryKey: KEY.grievance(data.id) });\n },\n });\n};\n\nexport const useGovTransitionGrievance = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: {\n id: string;\n status: GovGrievanceStatus;\n resolution?: string | null;\n }) => {\n const result = await govQuery<{ govTransitionGrievance: GovGrievance }>(\n `mutation GovTransitionGrievance($id: ID!, $status: GovGrievanceStatus!, $resolution: String) {\n govTransitionGrievance(id: $id, status: $status, resolution: $resolution) { ${GRIEVANCE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govTransitionGrievance;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.grievances });\n qc.invalidateQueries({ queryKey: KEY.grievance(data.id) });\n },\n });\n};\n"],"mappings":";;;;;;AA6DA,IAAM,KAAc,MAA2B,iBAAiB,KAAK,CAAK,GAEpE,IAAW,OACf,GACA,GACA,MACmB;CAKnB,IAAM,IAAW,EAAW,CAAK;CACjC,AAAI,KAAU,EAA0B;CAExC,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;CAClB,CAAC;CAED,AAAI,KAAU,EAA0B;CAOxC,IAAM,IAAO,EAAS;CAItB,IAAI,EAFF,KAAQ,QAAQ,OAAO,OAAO,CAAI,EAAE,MAAM,MAAU,KAAU,IAA2B,IAGzF,MAAU,MAAM,EAAS,SAAS,IAAI,WAAW,uCAAuC;CAM1F,OAJI,EAAS,QAAQ,UAEnB,QAAQ,KAAK,0DAA0D,EAAS,MAAM,GAEjF,EAAS;AAClB,GAGM,IAAM;CACV,WAAW,CAAC,iBAAiB,mBAAmB;CAChD,uBAAuB,CAAC,iBAAiB,yBAAyB;CAClE,uBAAuB,CAAC,iBAAiB,yBAAyB;CAClE,oBAAoB,CAAC,iBAAiB,sBAAsB;CAC5D,UAAU,CAAC,iBAAiB,UAAU;CACtC,SAAS,MAAe;EAAC;EAAiB;EAAU;CAAE;CACtD,UAAU,CAAC,iBAAiB,UAAU;CACtC,UAAU,MAAe;EAAC;EAAiB;EAAW;CAAE;CACxD,cAAc,CAAC,iBAAiB,cAAc;CAC9C,cAAc,MAAe;EAAC;EAAiB;EAAe;CAAE;CAChE,UAAU,CAAC,iBAAiB,UAAU;CACtC,UAAU,MAAe;EAAC;EAAiB;EAAW;CAAE;CACxD,SAAS,CAAC,iBAAiB,SAAS;CACpC,YAAY,CAAC,iB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EAAI,UAAU,EAAK,EAAE,EAAE,CAAC;EAC3D;CACF,CAAC;AACH,GAEa,UAAkC;CAC7C,IAAM,EAAE,qBAAkB,EAAiB,GACrC,IAAK,EAAe;CAC1B,OAAO,EAAY;EACjB,YAAY,OAAO,OAYV,MAPc,EACnB;wFACgF,EAAiB;YAEjG,GACA,CACF,GACc;EAEhB,YAAY,MAAS;GAEnB,AADA,EAAG,kBAAkB,EAAE,UAAU,EAAI,WAAW,CAAC,GACjD,EAAG,kBAAkB,EAAE,UAAU,EAAI,UAAU,EAAK,EAAE,EAAE,CAAC;EAC3D;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"useGovApi.js","names":[],"sources":["../../../src/govcitizenhub/hooks/useGovApi.ts"],"sourcesContent":["/**\n * GovCitizenHub API hooks\n * @module govcitizenhub/hooks\n *\n * React-Query hooks wired DIRECTLY to the real `wspace-govcitizenhub-svc`\n * federated GraphQL contract (the `gov*` operations). Every query/mutation below\n * uses an inline gql string whose fields match the svc `.hive-schema.graphql`\n * exactly. No mock data.\n *\n * Transport: `graphqlFetch({ gateway: 'workspace', workspaceToken: true })` — the\n * host shell supplies the gateway base URL + a workspace-scoped token.\n *\n * IMPORTANT: `User`/`File` are id-only federation stubs in this subgraph. We\n * never select `citizen { firstName }` or `file { url }`.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useGovCitizenHub } from '../context';\nimport { clearGraphqlResponseCache } from '../lib/graphql-cache';\nimport type {\n GovConnection,\n GovAgency,\n GovService,\n GovServiceCategory,\n GovServiceStatus,\n GovApplication,\n GovApplicationStatus,\n GovDocument,\n GovDocumentStatus,\n GovCaseNote,\n GovPermit,\n GovPermitStatus,\n GovPayment,\n GovPaymentStatus,\n GovGrievance,\n GovGrievanceStatus,\n GovCreateAgencyInput,\n GovUpdateAgencyInput,\n GovCreateServiceInput,\n GovUpdateServiceInput,\n GovCreateApplicationInput,\n GovUpdateApplicationInput,\n GovAddDocumentInput,\n GovAddCaseNoteInput,\n GovCreatePaymentInput,\n GovIssuePermitInput,\n GovReportGrievanceInput,\n GovUpdateGrievanceInput,\n GovDashboardSummary,\n GovApplicationSlaSummary,\n GovServiceApplicationCount,\n GovDeskApplicationCount,\n PaginationInput,\n} from '../types';\n\n// ============================================================================\n// Transport\n// ============================================================================\n\nconst isMutation = (query: string): boolean => /^\\s*mutation\\b/.test(query);\n\nconst govQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n // A mutation must never be served from — or coalesced onto — the read cache,\n // and the resolved read cache must be dropped once it commits so the\n // React-Query refetch that follows sees the new state, not a stale (≤15s)\n // pre-write response. Clear before AND after the write.\n const mutating = isMutation(query);\n if (mutating) clearGraphqlResponseCache();\n\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (mutating) clearGraphqlResponseCache();\n\n // GraphQL partial success: the gateway can attach a non-fatal top-level error\n // (e.g. a be-sdk activity/usage tracking side-effect) alongside a fully-resolved\n // payload. Only treat the request as failed when it produced NO usable data —\n // otherwise the operation genuinely succeeded and surfacing the background error\n // as a destructive toast would mislead the user.\n const data = response.data as Record<string, unknown> | null | undefined;\n const hasUsableData =\n data != null && Object.values(data).some((value) => value !== null && value !== undefined);\n\n if (!hasUsableData) {\n throw new Error(response.errors?.[0]?.message ?? 'GraphQL response did not include data');\n }\n if (response.errors?.length) {\n // Non-fatal: keep the data, but leave a breadcrumb for diagnostics.\n console.warn('[govcitizenhub] GraphQL partial error (data returned):', response.errors);\n }\n return response.data as TData;\n};\n\n// React-Query key roots (one namespace per domain entity).\nconst KEY = {\n dashboard: ['govcitizenhub', 'dashboard-summary'] as const,\n applicationSlaSummary: ['govcitizenhub', 'application-sla-summary'] as const,\n applicationsByService: ['govcitizenhub', 'applications-by-service'] as const,\n applicationsByDesk: ['govcitizenhub', 'applications-by-desk'] as const,\n agencies: ['govcitizenhub', 'agencies'] as const,\n agency: (id: string) => ['govcitizenhub', 'agency', id] as const,\n services: ['govcitizenhub', 'services'] as const,\n service: (id: string) => ['govcitizenhub', 'service', id] as const,\n applications: ['govcitizenhub', 'applications'] as const,\n application: (id: string) => ['govcitizenhub', 'application', id] as const,\n payments: ['govcitizenhub', 'payments'] as const,\n payment: (id: string) => ['govcitizenhub', 'payment', id] as const,\n permits: ['govcitizenhub', 'permits'] as const,\n grievances: ['govcitizenhub', 'grievances'] as const,\n grievance: (id: string) => ['govcitizenhub', 'grievance', id] as const,\n};\n\nconst DEFAULT_PAGE: PaginationInput = { limit: 50 };\n\n/** Build a clean PaginationInput, dropping nullish cursor so the svc never sees `cursor: null`. */\nconst page = (p?: PaginationInput): PaginationInput => {\n const base = p ?? DEFAULT_PAGE;\n const result: PaginationInput = { limit: base.limit ?? DEFAULT_PAGE.limit };\n if (base.offset != null) result.offset = base.offset;\n if (base.cursor != null) result.cursor = base.cursor;\n return result;\n};\n\n// ============================================================================\n// Reusable gql field selections (codegen-free strictness)\n// ============================================================================\n\nconst AGENCY_FIELDS = `\n id workspaceId code contactEmail contactPhone description isActive jurisdiction\n name tags createdAt updatedAt\n`;\n\nconst SERVICE_FIELDS = `\n id workspaceId agencyId category currency eligibility feeAmount feeType formSchema\n name publishedAt requiredDocuments slaDays slug status summary tags createdAt updatedAt\n`;\n\nconst DOCUMENT_FIELDS = `\n id workspaceId applicationId name status requirement rejectionReason\n file { id } createdAt updatedAt\n`;\n\nconst CASE_NOTE_FIELDS = `\n id workspaceId applicationId authorId body type createdAt updatedAt\n`;\n\nconst PERMIT_FIELDS = `\n id workspaceId applicationId serviceId holderId title verificationCode status\n issuedAt expiresAt revokedAt revokeReason file { id } createdAt updatedAt\n`;\n\nconst PAYMENT_FIELDS = `\n id workspaceId applicationId payerId amount currency status receiptNumber\n providerRef lineItems paidAt refundedAt createdAt updatedAt\n`;\n\nconst APPLICATION_FIELDS = `\n id workspaceId reference serviceId citizenId assignedToId status priority dueDate\n submittedAt decidedAt decisionReason tags createdAt updatedAt\n`;\n\nconst GRIEVANCE_FIELDS = `\n id workspaceId title description category status priority location latitude longitude\n photoFileIds reporterId agencyId assignedToId resolution resolvedAt tags createdAt updatedAt\n`;\n\n// ============================================================================\n// Dashboard summary (authoritative, backend-computed counts)\n// ============================================================================\n\n/**\n * Reads `govDashboardSummary` — the svc-computed operations totals. These are\n * authoritative (full-corpus counts, not a capped client-side window), so the\n * dashboard tiles and status donut MUST source from here, never from a paged\n * list's `items.length`.\n */\nconst DASHBOARD_TREND_FIELDS = `current previous changePercent direction`;\n\nexport const useGovDashboardSummary = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.dashboard,\n queryFn: async () => {\n const result = await govQuery<{ govDashboardSummary: GovDashboardSummary }>(\n `query GovDashboardSummary {\n govDashboardSummary {\n applicationsTotal\n applicationsByStatus { status count }\n pendingPayments\n pendingPaymentsAmount\n openGrievances\n activePermits\n publishedServices\n activeAgencies\n applicationsTotalTrend { ${DASHBOARD_TREND_FIELDS} }\n pendingPaymentsTrend { ${DASHBOARD_TREND_FIELDS} }\n openGrievancesTrend { ${DASHBOARD_TREND_FIELDS} }\n activePermitsTrend { ${DASHBOARD_TREND_FIELDS} }\n publishedServicesTrend { ${DASHBOARD_TREND_FIELDS} }\n activeAgenciesTrend { ${DASHBOARD_TREND_FIELDS} }\n }\n }`,\n {},\n apiGatewayUrl\n );\n return result.govDashboardSummary;\n },\n });\n};\n\n/**\n * Reads `govApplicationSlaSummary` — the svc-computed, corpus-wide SLA\n * breakdown across every non-terminal application. Unlike a page-level SLA\n * strip, this is accurate regardless of which page of results is loaded.\n */\nexport const useGovApplicationSlaSummary = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.applicationSlaSummary,\n queryFn: async () => {\n const result = await govQuery<{ govApplicationSlaSummary: GovApplicationSlaSummary }>(\n `query GovApplicationSlaSummary {\n govApplicationSlaSummary { onTrack dueSoon overdue noDueDate }\n }`,\n {},\n apiGatewayUrl\n );\n return result.govApplicationSlaSummary;\n },\n });\n};\n\n/** Reads `govApplicationsByService` — corpus-wide application volume per service. */\nexport const useGovApplicationsByService = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.applicationsByService,\n queryFn: async () => {\n const result = await govQuery<{ govApplicationsByService: GovServiceApplicationCount[] }>(\n `query GovApplicationsByService {\n govApplicationsByService { serviceId serviceName count }\n }`,\n {},\n apiGatewayUrl\n );\n return result.govApplicationsByService;\n },\n });\n};\n\n/** Reads `govApplicationsByDesk` — corpus-wide application volume per assigned officer. */\nexport const useGovApplicationsByDesk = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.applicationsByDesk,\n queryFn: async () => {\n const result = await govQuery<{ govApplicationsByDesk: GovDeskApplicationCount[] }>(\n `query GovApplicationsByDesk {\n govApplicationsByDesk { assignedToId count }\n }`,\n {},\n apiGatewayUrl\n );\n return result.govApplicationsByDesk;\n },\n });\n};\n\n// ============================================================================\n// Agencies (server-side: paginated GovAgencyConnection; this hook flattens it\n// back to a plain array since every current consumer — AgenciesPage,\n// ServiceFormDialog, GrievancesPage — reads `data` as GovAgency[])\n// ============================================================================\n\nexport interface AgencyFilters {\n isActive?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useGovAgencies = (filters: AgencyFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.agencies, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListAgencies: GovConnection<GovAgency> }>(\n `query GovListAgencies($isActive: Boolean, $pagination: PaginationInput) {\n govListAgencies(isActive: $isActive, pagination: $pagination) {\n items { ${AGENCY_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { isActive: filters.isActive, pagination: page(filters.pagination ?? { limit: 100 }) },\n apiGatewayUrl\n );\n return result.govListAgencies.items;\n },\n });\n};\n\nexport const useGovAgency = (id: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.agency(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await govQuery<{ govAgency: GovAgency | null }>(\n `query GovAgency($id: ID!) {\n govAgency(id: $id) { ${AGENCY_FIELDS} services { ${SERVICE_FIELDS} } }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govAgency;\n },\n });\n};\n\nexport const useGovCreateAgency = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovCreateAgencyInput) => {\n const result = await govQuery<{ govCreateAgency: GovAgency }>(\n `mutation GovCreateAgency($input: GovCreateAgencyInput!) {\n govCreateAgency(input: $input) { ${AGENCY_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govCreateAgency;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.agencies }),\n });\n};\n\nexport const useGovUpdateAgency = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: GovUpdateAgencyInput }) => {\n const result = await govQuery<{ govUpdateAgency: GovAgency }>(\n `mutation GovUpdateAgency($id: ID!, $input: GovUpdateAgencyInput!) {\n govUpdateAgency(id: $id, input: $input) { ${AGENCY_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govUpdateAgency;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.agencies });\n qc.invalidateQueries({ queryKey: KEY.agency(data.id) });\n },\n });\n};\n\nexport const useGovArchiveAgency = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await govQuery<{ govArchiveAgency: boolean }>(\n `mutation GovArchiveAgency($id: ID!) { govArchiveAgency(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return result.govArchiveAgency;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.agencies }),\n });\n};\n\n// ============================================================================\n// Services (connection)\n// ============================================================================\n\nexport interface ServiceFilters {\n agencyId?: string;\n category?: GovServiceCategory;\n status?: GovServiceStatus;\n pagination?: PaginationInput;\n}\n\nexport const useGovServices = (filters: ServiceFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.services, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListServices: GovConnection<GovService> }>(\n `query GovListServices($agencyId: ID, $category: GovServiceCategory, $status: GovServiceStatus, $pagination: PaginationInput) {\n govListServices(agencyId: $agencyId, category: $category, status: $status, pagination: $pagination) {\n items { ${SERVICE_FIELDS} agency { id name } }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n agencyId: filters.agencyId,\n category: filters.category,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListServices;\n },\n });\n};\n\nexport const useGovService = (id: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.service(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await govQuery<{ govService: GovService | null }>(\n `query GovService($id: ID!) {\n govService(id: $id) { ${SERVICE_FIELDS} agency { ${AGENCY_FIELDS} } }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govService;\n },\n });\n};\n\nexport const useGovCreateService = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovCreateServiceInput) => {\n const result = await govQuery<{ govCreateService: GovService }>(\n `mutation GovCreateService($input: GovCreateServiceInput!) {\n govCreateService(input: $input) { ${SERVICE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govCreateService;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.services }),\n });\n};\n\nexport const useGovUpdateService = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: GovUpdateServiceInput }) => {\n const result = await govQuery<{ govUpdateService: GovService }>(\n `mutation GovUpdateService($id: ID!, $input: GovUpdateServiceInput!) {\n govUpdateService(id: $id, input: $input) { ${SERVICE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govUpdateService;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.services });\n qc.invalidateQueries({ queryKey: KEY.service(data.id) });\n },\n });\n};\n\nexport const useGovTransitionService = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; status: GovServiceStatus }) => {\n const result = await govQuery<{ govTransitionService: GovService }>(\n `mutation GovTransitionService($id: ID!, $status: GovServiceStatus!) {\n govTransitionService(id: $id, status: $status) { ${SERVICE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govTransitionService;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.services });\n qc.invalidateQueries({ queryKey: KEY.service(data.id) });\n },\n });\n};\n\n// ============================================================================\n// Applications (connection)\n// ============================================================================\n\nexport interface ApplicationFilters {\n assignedToId?: string;\n citizenId?: string;\n serviceId?: string;\n status?: GovApplicationStatus;\n pagination?: PaginationInput;\n}\n\nexport const useGovApplications = (filters: ApplicationFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.applications, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListApplications: GovConnection<GovApplication> }>(\n `query GovListApplications($assignedToId: ID, $citizenId: ID, $serviceId: ID, $status: GovApplicationStatus, $pagination: PaginationInput) {\n govListApplications(assignedToId: $assignedToId, citizenId: $citizenId, serviceId: $serviceId, status: $status, pagination: $pagination) {\n items { ${APPLICATION_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n assignedToId: filters.assignedToId,\n citizenId: filters.citizenId,\n serviceId: filters.serviceId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListApplications;\n },\n });\n};\n\nexport const useGovApplication = (id: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.application(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await govQuery<{ govApplication: GovApplication | null }>(\n `query GovApplication($id: ID!) {\n govApplication(id: $id) {\n ${APPLICATION_FIELDS}\n formData\n documents { ${DOCUMENT_FIELDS} }\n notes { ${CASE_NOTE_FIELDS} }\n permits { ${PERMIT_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govApplication;\n },\n });\n};\n\nexport const useGovCreateApplication = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovCreateApplicationInput) => {\n const result = await govQuery<{ govCreateApplication: GovApplication }>(\n `mutation GovCreateApplication($input: GovCreateApplicationInput!) {\n govCreateApplication(input: $input) { ${APPLICATION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govCreateApplication;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.applications }),\n });\n};\n\nexport const useGovUpdateApplication = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: GovUpdateApplicationInput }) => {\n const result = await govQuery<{ govUpdateApplication: GovApplication }>(\n `mutation GovUpdateApplication($id: ID!, $input: GovUpdateApplicationInput!) {\n govUpdateApplication(id: $id, input: $input) { ${APPLICATION_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govUpdateApplication;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.applications });\n qc.invalidateQueries({ queryKey: KEY.application(data.id) });\n },\n });\n};\n\nexport const useGovSubmitApplication = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await govQuery<{ govSubmitApplication: GovApplication }>(\n `mutation GovSubmitApplication($id: ID!) {\n govSubmitApplication(id: $id) { ${APPLICATION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govSubmitApplication;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.applications });\n qc.invalidateQueries({ queryKey: KEY.application(data.id) });\n },\n });\n};\n\nexport const useGovTransitionApplication = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: {\n id: string;\n status: GovApplicationStatus;\n reason?: string | null;\n }) => {\n const result = await govQuery<{ govTransitionApplication: GovApplication }>(\n `mutation GovTransitionApplication($id: ID!, $status: GovApplicationStatus!, $reason: String) {\n govTransitionApplication(id: $id, status: $status, reason: $reason) { ${APPLICATION_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govTransitionApplication;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.applications });\n qc.invalidateQueries({ queryKey: KEY.application(data.id) });\n },\n });\n};\n\n// ============================================================================\n// Documents (attached to an application)\n// ============================================================================\n\nexport const useGovAddDocument = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovAddDocumentInput) => {\n const result = await govQuery<{ govAddDocument: GovDocument }>(\n `mutation GovAddDocument($input: GovAddDocumentInput!) {\n govAddDocument(input: $input) { ${DOCUMENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govAddDocument;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n qc.invalidateQueries({ queryKey: KEY.applications });\n },\n });\n};\n\nexport const useGovReviewDocument = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: {\n id: string;\n status: GovDocumentStatus;\n rejectionReason?: string | null;\n applicationId?: string;\n }) => {\n const result = await govQuery<{ govReviewDocument: GovDocument }>(\n `mutation GovReviewDocument($id: ID!, $status: GovDocumentStatus!, $rejectionReason: String) {\n govReviewDocument(id: $id, status: $status, rejectionReason: $rejectionReason) { ${DOCUMENT_FIELDS} }\n }`,\n { id: vars.id, status: vars.status, rejectionReason: vars.rejectionReason },\n apiGatewayUrl\n );\n return result.govReviewDocument;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n },\n });\n};\n\n// ============================================================================\n// Case notes (domain-owned casework timeline)\n// ============================================================================\n\nexport const useGovAddCaseNote = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovAddCaseNoteInput) => {\n const result = await govQuery<{ govAddCaseNote: GovCaseNote }>(\n `mutation GovAddCaseNote($input: GovAddCaseNoteInput!) {\n govAddCaseNote(input: $input) { ${CASE_NOTE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govAddCaseNote;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n },\n });\n};\n\n// ============================================================================\n// Payments (connection)\n// ============================================================================\n\nexport interface PaymentFilters {\n applicationId?: string;\n payerId?: string;\n status?: GovPaymentStatus;\n pagination?: PaginationInput;\n}\n\nexport const useGovPayments = (filters: PaymentFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.payments, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListPayments: GovConnection<GovPayment> }>(\n `query GovListPayments($applicationId: ID, $payerId: ID, $status: GovPaymentStatus, $pagination: PaginationInput) {\n govListPayments(applicationId: $applicationId, payerId: $payerId, status: $status, pagination: $pagination) {\n items { ${PAYMENT_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n applicationId: filters.applicationId,\n payerId: filters.payerId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListPayments;\n },\n });\n};\n\nexport const useGovCreatePayment = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovCreatePaymentInput) => {\n const result = await govQuery<{ govCreatePayment: GovPayment }>(\n `mutation GovCreatePayment($input: GovCreatePaymentInput!) {\n govCreatePayment(input: $input) { ${PAYMENT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govCreatePayment;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.payments });\n if (data.applicationId)\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n },\n });\n};\n\nexport const useGovMarkPaymentPaid = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; providerRef?: string | null }) => {\n const result = await govQuery<{ govMarkPaymentPaid: GovPayment }>(\n `mutation GovMarkPaymentPaid($id: ID!, $providerRef: String) {\n govMarkPaymentPaid(id: $id, providerRef: $providerRef) { ${PAYMENT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govMarkPaymentPaid;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.payments }),\n });\n};\n\nexport const useGovRefundPayment = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await govQuery<{ govRefundPayment: GovPayment }>(\n `mutation GovRefundPayment($id: ID!) {\n govRefundPayment(id: $id) { ${PAYMENT_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govRefundPayment;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.payments }),\n });\n};\n\n// ============================================================================\n// Permits (list = ARRAY, no pagination) + public verification\n// ============================================================================\n\nexport interface PermitFilters {\n holderId?: string;\n serviceId?: string;\n status?: GovPermitStatus;\n pagination?: PaginationInput;\n}\n\n/**\n * `govListPermits` returns a paginated `GovPermitConnection`, flattened to a\n * plain array here since PermitsPage reads `data` as GovPermit[] and infers\n * `hasMore` itself from a full-length page. Callers page with `{ limit, offset }`.\n */\nexport const useGovPermits = (filters: PermitFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.permits, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListPermits: GovConnection<GovPermit> }>(\n `query GovListPermits($holderId: ID, $serviceId: ID, $status: GovPermitStatus, $pagination: PaginationInput) {\n govListPermits(holderId: $holderId, serviceId: $serviceId, status: $status, pagination: $pagination) {\n items { ${PERMIT_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n holderId: filters.holderId,\n serviceId: filters.serviceId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListPermits.items;\n },\n });\n};\n\nexport const useGovIssuePermit = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovIssuePermitInput) => {\n const result = await govQuery<{ govIssuePermit: GovPermit }>(\n `mutation GovIssuePermit($input: GovIssuePermitInput!) {\n govIssuePermit(input: $input) { ${PERMIT_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govIssuePermit;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.permits });\n if (data.applicationId)\n qc.invalidateQueries({ queryKey: KEY.application(data.applicationId) });\n },\n });\n};\n\nexport const useGovRevokePermit = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; reason?: string | null }) => {\n const result = await govQuery<{ govRevokePermit: GovPermit }>(\n `mutation GovRevokePermit($id: ID!, $reason: String) {\n govRevokePermit(id: $id, reason: $reason) { ${PERMIT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govRevokePermit;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.permits }),\n });\n};\n\n/**\n * Render the permit as a downloadable/printable PDF (BOFF-4060). A mutation\n * (not a query) even though the backend field is a GraphQL Query: it's a\n * client-triggered, non-cached action fired from a \"Download\" / \"Print\"\n * button, exactly like the `getBlob` thunk in the platform's Save-to-Files\n * pattern — the bytes are only assembled when the officer actually clicks.\n */\nexport const useGovPermitPdf = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useMutation({\n mutationFn: async (id: string) => {\n const result = await govQuery<{\n govPermitPdf: { pdfBase64: string; filename: string; generatedAt: string };\n }>(\n `query GovPermitPdf($id: ID!) {\n govPermitPdf(id: $id) { pdfBase64 filename generatedAt }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govPermitPdf;\n },\n });\n};\n\n/**\n * Persist a `wspace-files-svc` File reference onto an issued permit once the\n * client has saved the rendered PDF via the platform's Save-to-Files flow.\n */\nexport const useGovAttachPermitFile = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; fileId: string }) => {\n const result = await govQuery<{ govAttachPermitFile: GovPermit }>(\n `mutation GovAttachPermitFile($id: ID!, $fileId: ID!) {\n govAttachPermitFile(id: $id, fileId: $fileId) { ${PERMIT_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govAttachPermitFile;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.permits }),\n });\n};\n\n/**\n * Public permit verification by printed code. `govVerifyPermit` is a PUBLIC field\n * (no auth), but we keep the workspace-token transport for a consistent gateway\n * path. `enabled` is false until a code is supplied so the query is manual.\n */\nexport const useGovVerifyPermit = (verificationCode: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: ['govcitizenhub', 'verify-permit', verificationCode ?? ''],\n enabled: Boolean(verificationCode),\n retry: false,\n queryFn: async () => {\n const result = await govQuery<{ govVerifyPermit: GovPermit | null }>(\n `query GovVerifyPermit($verificationCode: String!) {\n govVerifyPermit(verificationCode: $verificationCode) { ${PERMIT_FIELDS} }\n }`,\n { verificationCode },\n apiGatewayUrl\n );\n return result.govVerifyPermit;\n },\n });\n};\n\n// ============================================================================\n// Grievances (connection)\n// ============================================================================\n\nexport interface GrievanceFilters {\n agencyId?: string;\n reporterId?: string;\n status?: GovGrievanceStatus;\n pagination?: PaginationInput;\n}\n\nexport const useGovGrievances = (filters: GrievanceFilters = {}) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: [...KEY.grievances, filters],\n queryFn: async () => {\n const result = await govQuery<{ govListGrievances: GovConnection<GovGrievance> }>(\n `query GovListGrievances($agencyId: ID, $reporterId: ID, $status: GovGrievanceStatus, $pagination: PaginationInput) {\n govListGrievances(agencyId: $agencyId, reporterId: $reporterId, status: $status, pagination: $pagination) {\n items { ${GRIEVANCE_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n agencyId: filters.agencyId,\n reporterId: filters.reporterId,\n status: filters.status,\n pagination: page(filters.pagination),\n },\n apiGatewayUrl\n );\n return result.govListGrievances;\n },\n });\n};\n\nexport const useGovGrievance = (id: string | undefined) => {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: KEY.grievance(id ?? ''),\n enabled: Boolean(id),\n queryFn: async () => {\n const result = await govQuery<{ govGrievance: GovGrievance | null }>(\n `query GovGrievance($id: ID!) {\n govGrievance(id: $id) { ${GRIEVANCE_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return result.govGrievance;\n },\n });\n};\n\nexport const useGovReportGrievance = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (input: GovReportGrievanceInput) => {\n const result = await govQuery<{ govReportGrievance: GovGrievance }>(\n `mutation GovReportGrievance($input: GovReportGrievanceInput!) {\n govReportGrievance(input: $input) { ${GRIEVANCE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return result.govReportGrievance;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: KEY.grievances }),\n });\n};\n\nexport const useGovUpdateGrievance = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: { id: string; input: GovUpdateGrievanceInput }) => {\n const result = await govQuery<{ govUpdateGrievance: GovGrievance }>(\n `mutation GovUpdateGrievance($id: ID!, $input: GovUpdateGrievanceInput!) {\n govUpdateGrievance(id: $id, input: $input) { ${GRIEVANCE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govUpdateGrievance;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.grievances });\n qc.invalidateQueries({ queryKey: KEY.grievance(data.id) });\n },\n });\n};\n\nexport const useGovTransitionGrievance = () => {\n const { apiGatewayUrl } = useGovCitizenHub();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (vars: {\n id: string;\n status: GovGrievanceStatus;\n resolution?: string | null;\n }) => {\n const result = await govQuery<{ govTransitionGrievance: GovGrievance }>(\n `mutation GovTransitionGrievance($id: ID!, $status: GovGrievanceStatus!, $resolution: String) {\n govTransitionGrievance(id: $id, status: $status, resolution: $resolution) { ${GRIEVANCE_FIELDS} }\n }`,\n vars,\n apiGatewayUrl\n );\n return result.govTransitionGrievance;\n },\n onSuccess: (data) => {\n qc.invalidateQueries({ queryKey: KEY.grievances });\n qc.invalidateQueries({ queryKey: KEY.grievance(data.id) });\n },\n });\n};\n"],"mappings":";;;;;;AA6DA,IAAM,KAAc,MAA2B,iBAAiB,KAAK,CAAK,GAEpE,IAAW,OACf,GACA,GACA,MACmB;CAKnB,IAAM,IAAW,EAAW,CAAK;CACjC,AAAI,KAAU,EAA0B;CAExC,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;CAClB,CAAC;CAED,AAAI,KAAU,EAA0B;CAOxC,IAAM,IAAO,EAAS;CAItB,IAAI,EAFF,KAAQ,QAAQ,OAAO,OAAO,CAAI,EAAE,MAAM,MAAU,KAAU,IAA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YV,MAPc,EACnB;wFACgF,EAAiB;YAEjG,GACA,CACF,GACc;EAEhB,YAAY,MAAS;GAEnB,AADA,EAAG,kBAAkB,EAAE,UAAU,EAAI,WAAW,CAAC,GACjD,EAAG,kBAAkB,EAAE,UAAU,EAAI,UAAU,EAAK,EAAE,EAAE,CAAC;EAC3D;CACF,CAAC;AACH"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * GovCitizenHub product-analytics helpers (BOFF-3148).
3
+ *
4
+ * Wraps the shared event bus so pages can emit the core citizen-service
5
+ * funnel facts without importing the bus directly. Event names + payload
6
+ * shapes match the `govcitizenhub.*` contract already registered in fe-libs
7
+ * (`GovCitizenHubResourcePayload` et al.) and already allow-listed for the
8
+ * app-shell `RybbitSink` — this hook only had to start calling them. IDs
9
+ * only, never form data / free text (no PII leaves the browser via this
10
+ * channel).
11
+ * @module govcitizenhub/hooks
12
+ */
13
+ export interface GovCitizenHubResourceEvent {
14
+ workspaceId?: string;
15
+ id?: string;
16
+ entityType?: string;
17
+ }
18
+ export declare function useGovCitizenHubAnalytics(): {
19
+ emitApplicationCreated: (event: GovCitizenHubResourceEvent) => void;
20
+ emitPaymentSettled: (event: GovCitizenHubResourceEvent) => void;
21
+ emitPermitIssued: (event: GovCitizenHubResourceEvent) => void;
22
+ emitGrievanceReported: (event: GovCitizenHubResourceEvent) => void;
23
+ };
24
+ //# sourceMappingURL=useGovCitizenHubAnalytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGovCitizenHubAnalytics.d.ts","sourceRoot":"","sources":["../../../src/govcitizenhub/hooks/useGovCitizenHubAnalytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,yBAAyB;oCAK7B,0BAA0B;gCAY1B,0BAA0B;8BAY1B,0BAA0B;mCAY1B,0BAA0B;EAWrC"}
@@ -0,0 +1,40 @@
1
+ import { useCallback as e } from "react";
2
+ import { useEventBus as t } from "@burdenoff/fe-libs/shared/events";
3
+ //#region src/govcitizenhub/hooks/useGovCitizenHubAnalytics.ts
4
+ function n() {
5
+ let n = t();
6
+ return {
7
+ emitApplicationCreated: e((e) => {
8
+ n.emitCustom("govcitizenhub.application.created", {
9
+ workspaceId: e.workspaceId,
10
+ id: e.id,
11
+ entityType: e.entityType ?? "application"
12
+ });
13
+ }, [n]),
14
+ emitPaymentSettled: e((e) => {
15
+ n.emitCustom("govcitizenhub.payment.settled", {
16
+ workspaceId: e.workspaceId,
17
+ id: e.id,
18
+ entityType: e.entityType ?? "payment"
19
+ });
20
+ }, [n]),
21
+ emitPermitIssued: e((e) => {
22
+ n.emitCustom("govcitizenhub.permit.issued", {
23
+ workspaceId: e.workspaceId,
24
+ id: e.id,
25
+ entityType: e.entityType ?? "permit"
26
+ });
27
+ }, [n]),
28
+ emitGrievanceReported: e((e) => {
29
+ n.emitCustom("govcitizenhub.grievance.reported", {
30
+ workspaceId: e.workspaceId,
31
+ id: e.id,
32
+ entityType: e.entityType ?? "grievance"
33
+ });
34
+ }, [n])
35
+ };
36
+ }
37
+ //#endregion
38
+ export { n as useGovCitizenHubAnalytics };
39
+
40
+ //# sourceMappingURL=useGovCitizenHubAnalytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGovCitizenHubAnalytics.js","names":[],"sources":["../../../src/govcitizenhub/hooks/useGovCitizenHubAnalytics.ts"],"sourcesContent":["/**\n * GovCitizenHub product-analytics helpers (BOFF-3148).\n *\n * Wraps the shared event bus so pages can emit the core citizen-service\n * funnel facts without importing the bus directly. Event names + payload\n * shapes match the `govcitizenhub.*` contract already registered in fe-libs\n * (`GovCitizenHubResourcePayload` et al.) and already allow-listed for the\n * app-shell `RybbitSink` — this hook only had to start calling them. IDs\n * only, never form data / free text (no PII leaves the browser via this\n * channel).\n * @module govcitizenhub/hooks\n */\n\nimport { useCallback } from 'react';\nimport { useEventBus } from '@burdenoff/fe-libs/shared/events';\n\nexport interface GovCitizenHubResourceEvent {\n workspaceId?: string;\n id?: string;\n entityType?: string;\n}\n\nexport function useGovCitizenHubAnalytics() {\n const bus = useEventBus();\n\n /** A citizen submits an application (`govCreateApplication` -> `govSubmitApplication`). */\n const emitApplicationCreated = useCallback(\n (event: GovCitizenHubResourceEvent) => {\n bus.emitCustom('govcitizenhub.application.created', {\n workspaceId: event.workspaceId,\n id: event.id,\n entityType: event.entityType ?? 'application',\n });\n },\n [bus]\n );\n\n /** A fee is marked paid (`govMarkPaymentPaid`). */\n const emitPaymentSettled = useCallback(\n (event: GovCitizenHubResourceEvent) => {\n bus.emitCustom('govcitizenhub.payment.settled', {\n workspaceId: event.workspaceId,\n id: event.id,\n entityType: event.entityType ?? 'payment',\n });\n },\n [bus]\n );\n\n /** An officer issues a permit (`govIssuePermit`). */\n const emitPermitIssued = useCallback(\n (event: GovCitizenHubResourceEvent) => {\n bus.emitCustom('govcitizenhub.permit.issued', {\n workspaceId: event.workspaceId,\n id: event.id,\n entityType: event.entityType ?? 'permit',\n });\n },\n [bus]\n );\n\n /** A citizen files a grievance (`govReportGrievance`). */\n const emitGrievanceReported = useCallback(\n (event: GovCitizenHubResourceEvent) => {\n bus.emitCustom('govcitizenhub.grievance.reported', {\n workspaceId: event.workspaceId,\n id: event.id,\n entityType: event.entityType ?? 'grievance',\n });\n },\n [bus]\n );\n\n return { emitApplicationCreated, emitPaymentSettled, emitPermitIssued, emitGrievanceReported };\n}\n"],"mappings":";;;AAsBA,SAAgB,IAA4B;CAC1C,IAAM,IAAM,EAAY;CAkDxB,OAAO;EAAE,wBA/CsB,GAC5B,MAAsC;GACrC,EAAI,WAAW,qCAAqC;IAClD,aAAa,EAAM;IACnB,IAAI,EAAM;IACV,YAAY,EAAM,cAAc;GAClC,CAAC;EACH,GACA,CAAC,CAAG,CAuCG;EAAwB,oBAnCN,GACxB,MAAsC;GACrC,EAAI,WAAW,iCAAiC;IAC9C,aAAa,EAAM;IACnB,IAAI,EAAM;IACV,YAAY,EAAM,cAAc;GAClC,CAAC;EACH,GACA,CAAC,CAAG,CA2B2B;EAAoB,kBAvB5B,GACtB,MAAsC;GACrC,EAAI,WAAW,+BAA+B;IAC5C,aAAa,EAAM;IACnB,IAAI,EAAM;IACV,YAAY,EAAM,cAAc;GAClC,CAAC;EACH,GACA,CAAC,CAAG,CAe+C;EAAkB,uBAXzC,GAC3B,MAAsC;GACrC,EAAI,WAAW,oCAAoC;IACjD,aAAa,EAAM;IACnB,IAAI,EAAM;IACV,YAAY,EAAM,cAAc;GAClC,CAAC;EACH,GACA,CAAC,CAAG,CAGiE;CAAsB;AAC/F"}
@@ -2,8 +2,9 @@
2
2
  * AgenciesPage — manage the government agencies that own services.
3
3
  * @module govcitizenhub/pages/agencies
4
4
  *
5
- * Reads `govListAgencies` (an ARRAY, not a connection) and offers full CRUD:
6
- * create / edit via {@link AgencyFormDialog}, a quick active/inactive toggle
5
+ * Reads `govListAgencies` (a paginated `GovAgencyConnection`, flattened to a
6
+ * plain array by {@link useGovAgencies}) and offers full CRUD: create / edit
7
+ * via {@link AgencyFormDialog}, a quick active/inactive toggle
7
8
  * (`govUpdateAgency`) and a confirm-guarded archive (`govArchiveAgency`). Each
8
9
  * card shows its live services count via a page-local `govListServices` query.
9
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AgenciesPage.d.ts","sourceRoot":"","sources":["../../../../src/govcitizenhub/pages/agencies/AgenciesPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4MH,wBAAgB,YAAY,4CAyK3B"}
1
+ {"version":3,"file":"AgenciesPage.d.ts","sourceRoot":"","sources":["../../../../src/govcitizenhub/pages/agencies/AgenciesPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA4MH,wBAAgB,YAAY,4CAyK3B"}