@burdenoff/microfe-govcitizenhub 2026.720.6 → 2026.730.1

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 (171) hide show
  1. package/dist/govcitizenhub/GovCitizenHubRoot.d.ts.map +1 -1
  2. package/dist/govcitizenhub/GovCitizenHubRoot.js +44 -36
  3. package/dist/govcitizenhub/GovCitizenHubRoot.js.map +1 -1
  4. package/dist/govcitizenhub/GovCitizenHubRoutes.d.ts.map +1 -1
  5. package/dist/govcitizenhub/GovCitizenHubRoutes.js +134 -6
  6. package/dist/govcitizenhub/GovCitizenHubRoutes.js.map +1 -1
  7. package/dist/govcitizenhub/components/DocumentUploadField.d.ts +17 -11
  8. package/dist/govcitizenhub/components/DocumentUploadField.d.ts.map +1 -1
  9. package/dist/govcitizenhub/components/DocumentUploadField.js +45 -42
  10. package/dist/govcitizenhub/components/DocumentUploadField.js.map +1 -1
  11. package/dist/govcitizenhub/components/GovCharts.js +127 -51
  12. package/dist/govcitizenhub/components/GovCharts.js.map +1 -1
  13. package/dist/govcitizenhub/hooks/index.d.ts +2 -0
  14. package/dist/govcitizenhub/hooks/index.d.ts.map +1 -1
  15. package/dist/govcitizenhub/hooks/index.js +2 -0
  16. package/dist/govcitizenhub/hooks/useGovApi.d.ts +23 -0
  17. package/dist/govcitizenhub/hooks/useGovApi.d.ts.map +1 -1
  18. package/dist/govcitizenhub/hooks/useGovApi.js +18 -7
  19. package/dist/govcitizenhub/hooks/useGovApi.js.map +1 -1
  20. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.d.ts +24 -0
  21. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.d.ts.map +1 -0
  22. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.js +40 -0
  23. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.js.map +1 -0
  24. package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts +214 -0
  25. package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts.map +1 -0
  26. package/dist/govcitizenhub/hooks/useIntelligenceApi.js +1140 -0
  27. package/dist/govcitizenhub/hooks/useIntelligenceApi.js.map +1 -0
  28. package/dist/govcitizenhub/index.d.ts +1 -0
  29. package/dist/govcitizenhub/index.d.ts.map +1 -1
  30. package/dist/govcitizenhub/index.js +18 -0
  31. package/dist/govcitizenhub/pages/agencies/AgenciesPage.js +7 -7
  32. package/dist/govcitizenhub/pages/agencies/AgencyFormDialog.js +6 -6
  33. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.d.ts.map +1 -1
  34. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js +178 -172
  35. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js.map +1 -1
  36. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +35 -35
  37. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
  38. package/dist/govcitizenhub/pages/applications/NewApplicationPage.d.ts.map +1 -1
  39. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +151 -147
  40. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js.map +1 -1
  41. package/dist/govcitizenhub/pages/documents/DocumentsPage.js +5 -5
  42. package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js +30 -30
  43. package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js.map +1 -1
  44. package/dist/govcitizenhub/pages/grievances/GrievancesPage.d.ts.map +1 -1
  45. package/dist/govcitizenhub/pages/grievances/GrievancesPage.js +176 -172
  46. package/dist/govcitizenhub/pages/grievances/GrievancesPage.js.map +1 -1
  47. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts +4 -0
  48. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts.map +1 -0
  49. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js +634 -0
  50. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js.map +1 -0
  51. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts +20 -0
  52. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts.map +1 -0
  53. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js +537 -0
  54. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js.map +1 -0
  55. package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts +11 -0
  56. package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts.map +1 -0
  57. package/dist/govcitizenhub/pages/intelligence/AssetImage.js +25 -0
  58. package/dist/govcitizenhub/pages/intelligence/AssetImage.js.map +1 -0
  59. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts +15 -0
  60. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts.map +1 -0
  61. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js +203 -0
  62. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js.map +1 -0
  63. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts +4 -0
  64. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts.map +1 -0
  65. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js +497 -0
  66. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js.map +1 -0
  67. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts +4 -0
  68. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts.map +1 -0
  69. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js +1084 -0
  70. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js.map +1 -0
  71. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts +13 -0
  72. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts.map +1 -0
  73. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js +581 -0
  74. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js.map +1 -0
  75. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts +11 -0
  76. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts.map +1 -0
  77. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js +429 -0
  78. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js.map +1 -0
  79. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts +8 -0
  80. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts.map +1 -0
  81. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js +235 -0
  82. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js.map +1 -0
  83. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts +4 -0
  84. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts.map +1 -0
  85. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js +534 -0
  86. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js.map +1 -0
  87. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts +4 -0
  88. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts.map +1 -0
  89. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js +723 -0
  90. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js.map +1 -0
  91. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts +5 -0
  92. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts.map +1 -0
  93. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js +1029 -0
  94. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js.map +1 -0
  95. package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts +5 -0
  96. package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts.map +1 -0
  97. package/dist/govcitizenhub/pages/intelligence/GovernancePage.js +1545 -0
  98. package/dist/govcitizenhub/pages/intelligence/GovernancePage.js.map +1 -0
  99. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts +4 -0
  100. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts.map +1 -0
  101. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js +960 -0
  102. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js.map +1 -0
  103. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts +13 -0
  104. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts.map +1 -0
  105. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js +927 -0
  106. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js.map +1 -0
  107. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts +4 -0
  108. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts.map +1 -0
  109. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js +620 -0
  110. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js.map +1 -0
  111. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts +20 -0
  112. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts.map +1 -0
  113. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js +183 -0
  114. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js.map +1 -0
  115. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts +4 -0
  116. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts.map +1 -0
  117. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js +629 -0
  118. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js.map +1 -0
  119. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts +4 -0
  120. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts.map +1 -0
  121. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js +1124 -0
  122. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js.map +1 -0
  123. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts +4 -0
  124. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts.map +1 -0
  125. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js +1518 -0
  126. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js.map +1 -0
  127. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts +4 -0
  128. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts.map +1 -0
  129. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js +577 -0
  130. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js.map +1 -0
  131. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts +4 -0
  132. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts.map +1 -0
  133. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js +534 -0
  134. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js.map +1 -0
  135. package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts +5 -0
  136. package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts.map +1 -0
  137. package/dist/govcitizenhub/pages/intelligence/TimelinePage.js +538 -0
  138. package/dist/govcitizenhub/pages/intelligence/TimelinePage.js.map +1 -0
  139. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts +53 -0
  140. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts.map +1 -0
  141. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js +138 -0
  142. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js.map +1 -0
  143. package/dist/govcitizenhub/pages/intelligence/index.d.ts +27 -0
  144. package/dist/govcitizenhub/pages/intelligence/index.d.ts.map +1 -0
  145. package/dist/govcitizenhub/pages/intelligence/index.js +17 -0
  146. package/dist/govcitizenhub/pages/payments/PaymentsPage.d.ts.map +1 -1
  147. package/dist/govcitizenhub/pages/payments/PaymentsPage.js +53 -49
  148. package/dist/govcitizenhub/pages/payments/PaymentsPage.js.map +1 -1
  149. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.d.ts.map +1 -1
  150. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js +82 -76
  151. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js.map +1 -1
  152. package/dist/govcitizenhub/pages/permits/PermitsPage.d.ts.map +1 -1
  153. package/dist/govcitizenhub/pages/permits/PermitsPage.js +174 -120
  154. package/dist/govcitizenhub/pages/permits/PermitsPage.js.map +1 -1
  155. package/dist/govcitizenhub/pages/services/ServiceDetailPage.js +8 -8
  156. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +98 -98
  157. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
  158. package/dist/govcitizenhub/types/index.d.ts +1 -0
  159. package/dist/govcitizenhub/types/index.d.ts.map +1 -1
  160. package/dist/govcitizenhub/types/intelligence.d.ts +1559 -0
  161. package/dist/govcitizenhub/types/intelligence.d.ts.map +1 -0
  162. package/dist/govcitizenhub/types/intelligence.js +125 -0
  163. package/dist/govcitizenhub/types/intelligence.js.map +1 -0
  164. package/dist/index.js +19 -2
  165. package/dist/node_modules/recharts/es6/chart/BarChart.js +24 -0
  166. package/dist/node_modules/recharts/es6/chart/BarChart.js.map +1 -0
  167. package/dist/utils/pageContext.d.ts +1 -0
  168. package/dist/utils/pageContext.d.ts.map +1 -1
  169. package/dist/utils/pageContext.js +44 -17
  170. package/dist/utils/pageContext.js.map +1 -1
  171. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pageContext.js","names":[],"sources":["../../src/utils/pageContext.ts"],"sourcesContent":["/**\n * Page context gathering for the GovCitizenHub assistant transport.\n *\n * Captures the user's current browser context to be sent alongside every\n * assistant prompt so the api-calls agent can reason about the active screen.\n *\n * BOFF-3734 hardening:\n * - Detail-route patterns are anchored to a UUID id shape. Previously they\n * used `([^/]+)`, so `/govcitizenhub/permits/verify` reported entityType\n * `GOVCITIZENHUB_PERMIT` with entityId `\"verify\"` and\n * `/govcitizenhub/applications/new` reported entityId `\"new\"` — the agent\n * then tried to resolve those literals as entity ids.\n * - Detail patterns for routes that do not exist (agencies/:id, documents/:id,\n * payments/:id, permits/:id) have been removed; see ROUTE_DECISIONS below.\n * - List and dashboard routes now contribute an entityType (with no entityId)\n * so the agent knows which collection is on screen.\n * - `userAgent` and `timestamp` are no longer forwarded: the agent's\n * ALLOWED_CONTEXT_KEYS drops them, and forwarding a browser fingerprint on\n * a product that handles citizen PII is unnecessary exposure.\n *\n * PII rule for this file: nothing derived from application form data, uploaded\n * document contents/filenames, grievance descriptions or citizen identity may\n * ever enter the returned payload. Only the route shape, resource ids that are\n * already in the URL, and the coarse `tab` query parameter are captured.\n */\n\nimport type { PageContext } from '#src/types/assistant';\n\ninterface ConversationContextShape {\n entityType?: string;\n entityId?: string;\n activeTab?: string;\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Backend ids are Prisma `@default(uuid())` (see\n * `wspace-govcitizenhub-svc/prisma/schema/*.prisma`), so a detail route only\n * matches when the trailing segment is a real UUID. This is what keeps the\n * reserved literals `new` and `verify` from being read as entity ids.\n */\nconst UUID_SEGMENT = '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';\n\nfunction detailPattern(collection: string): RegExp {\n return new RegExp(`^/govcitizenhub/${collection}/(${UUID_SEGMENT})$`);\n}\n\n/**\n * Detail routes that actually exist in `GovCitizenHubRoutes.tsx`.\n * Keep in lockstep with the `path=\"<collection>/:id\"` routes declared there —\n * `pageContext.test.ts` fails the build if they drift.\n */\nconst DETAIL_ROUTES: ReadonlyArray<readonly [string, string]> = [\n ['services', 'GOVCITIZENHUB_SERVICE'],\n ['applications', 'GOVCITIZENHUB_APPLICATION'],\n ['grievances', 'GOVCITIZENHUB_GRIEVANCE'],\n];\n\n/**\n * List routes that exist but have no detail route. They contribute an\n * entityType so the agent knows which collection is on screen, and never an\n * entityId.\n *\n * ROUTE_DECISIONS — the previous table also carried detail patterns for\n * `agencies/:id`, `documents/:id`, `payments/:id` and `permits/:id`. No such\n * routes are declared, so those four regexes could never fire. They were\n * removed rather than left as dead code; if a detail route is added later,\n * move the collection into DETAIL_ROUTES and the route-parity test will pass\n * again.\n */\nconst LIST_ROUTES: ReadonlyArray<readonly [string, string]> = [\n ['services', 'GOVCITIZENHUB_SERVICE'],\n ['applications', 'GOVCITIZENHUB_APPLICATION'],\n ['agencies', 'GOVCITIZENHUB_AGENCY'],\n ['documents', 'GOVCITIZENHUB_DOCUMENT'],\n ['payments', 'GOVCITIZENHUB_PAYMENT'],\n ['permits', 'GOVCITIZENHUB_PERMIT'],\n ['grievances', 'GOVCITIZENHUB_GRIEVANCE'],\n];\n\n/**\n * Routes under a collection that are actions rather than entities. They must\n * never yield an entityId, and they get their own entityType so the agent can\n * tell \"composing a new application\" from \"browsing applications\".\n */\nconst ACTION_ROUTES: ReadonlyArray<readonly [string, string]> = [\n ['applications/new', 'GOVCITIZENHUB_APPLICATION_DRAFT'],\n ['permits/verify', 'GOVCITIZENHUB_PERMIT_VERIFICATION'],\n // Citizen mobile surface (BOFF-4088) — same four destinations as the\n // BottomTabNav. `m/scan` renders the identical VerifyPermitPage as\n // `permits/verify` above, so it reports the same entityType.\n ['m', 'GOVCITIZENHUB_MOBILE_HOME'],\n ['m/requests', 'GOVCITIZENHUB_MOBILE_REQUESTS'],\n ['m/scan', 'GOVCITIZENHUB_PERMIT_VERIFICATION'],\n ['m/profile', 'GOVCITIZENHUB_MOBILE_PROFILE'],\n];\n\nexport function gatherPageContext(): PageContext {\n const url = window.location.href;\n const pathSegments = window.location.pathname.split('/').filter(Boolean);\n const currentPage = pathSegments.slice(0, 3).join('/') || 'home';\n const entity = resolveGovCitizenHubConversationContext(\n window.location.pathname,\n window.location.search\n );\n\n return {\n currentUrl: url,\n currentPage,\n entityType: entity.entityType,\n entityId: entity.entityId,\n activeTab: entity.activeTab,\n platform: 'govcitizenhub',\n version: import.meta.env.VITE_APP_VERSION ?? '2026.709.1',\n viewportSize: `${window.innerWidth}x${window.innerHeight}`,\n };\n}\n\nfunction matchPath(pattern: RegExp, pathname: string): RegExpMatchArray | null {\n return pathname.match(pattern);\n}\n\nfunction normalizePath(pathname: string): string {\n return pathname.length > 1 && pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;\n}\n\nexport function resolveGovCitizenHubConversationContext(\n pathname: string,\n search: string\n): ConversationContextShape {\n const params = new URLSearchParams(search);\n const path = normalizePath(pathname);\n\n // Action routes are matched before detail routes so a reserved literal can\n // never be mistaken for an id even if the id shape were relaxed later.\n for (const [suffix, entityType] of ACTION_ROUTES) {\n if (path === `/govcitizenhub/${suffix}`) {\n return { entityType, metadata: { route: suffix } };\n }\n }\n\n for (const [collection, entityType] of DETAIL_ROUTES) {\n const match = matchPath(detailPattern(collection), path);\n if (match) {\n return {\n entityType,\n entityId: match[1],\n metadata: { collection },\n };\n }\n }\n\n for (const [collection, entityType] of LIST_ROUTES) {\n if (path === `/govcitizenhub/${collection}`) {\n return {\n entityType,\n activeTab: params.get('tab') ?? undefined,\n metadata: { collection, view: 'list' },\n };\n }\n }\n\n if (path === '/govcitizenhub' || path === '/govcitizenhub/') {\n return {\n entityType: 'GOVCITIZENHUB_DASHBOARD',\n metadata: { view: 'dashboard' },\n };\n }\n\n const activeTab = params.get('tab') ?? undefined;\n return {\n activeTab,\n metadata: activeTab ? { activeTab } : {},\n };\n}\n\n/** Exported for the route-parity test in `pageContext.test.ts`. */\nexport const __routeTables = { DETAIL_ROUTES, LIST_ROUTES, ACTION_ROUTES };\n"],"mappings":";AAyCA,IAAM,IAAe;AAErB,SAAS,EAAc,GAA4B;CACjD,OAAW,OAAO,mBAAmB,EAAW,IAAI,EAAa,GAAG;AACtE;AAOA,IAAM,IAA0D;CAC9D,CAAC,YAAY,uBAAuB;CACpC,CAAC,gBAAgB,2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AAM,CAAC,GAAY,MAAe,GAAe;EACpD,IAAM,IAAQ,EAAU,EAAc,CAAU,GAAG,CAAI;EACvD,IAAI,GACF,OAAO;GACL;GACA,UAAU,EAAM;GAChB,UAAU,EAAE,cAAW;EACzB;CAEJ;CAEA,KAAK,IAAM,CAAC,GAAY,MAAe,GACrC,IAAI,MAAS,kBAAkB,KAC7B,OAAO;EACL;EACA,WAAW,EAAO,IAAI,KAAK,KAAK,KAAA;EAChC,UAAU;GAAE;GAAY,MAAM;EAAO;CACvC;CAIJ,IAAI,MAAS,oBAAoB,MAAS,mBACxC,OAAO;EACL,YAAY;EACZ,UAAU,EAAE,MAAM,YAAY;CAChC;CAGF,IAAM,IAAY,EAAO,IAAI,KAAK,KAAK,KAAA;CACvC,OAAO;EACL;EACA,UAAU,IAAY,EAAE,aAAU,IAAI,CAAC;CACzC;AACF"}
1
+ {"version":3,"file":"pageContext.js","names":[],"sources":["../../src/utils/pageContext.ts"],"sourcesContent":["/**\n * Page context gathering for the GovCitizenHub assistant transport.\n *\n * Captures the user's current browser context to be sent alongside every\n * assistant prompt so the api-calls agent can reason about the active screen.\n *\n * BOFF-3734 hardening:\n * - Detail-route patterns are anchored to a UUID id shape. Previously they\n * used `([^/]+)`, so `/govcitizenhub/permits/verify` reported entityType\n * `GOVCITIZENHUB_PERMIT` with entityId `\"verify\"` and\n * `/govcitizenhub/applications/new` reported entityId `\"new\"` — the agent\n * then tried to resolve those literals as entity ids.\n * - Detail patterns for routes that do not exist (agencies/:id, documents/:id,\n * payments/:id, permits/:id) have been removed; see ROUTE_DECISIONS below.\n * - List and dashboard routes now contribute an entityType (with no entityId)\n * so the agent knows which collection is on screen.\n * - `userAgent` and `timestamp` are no longer forwarded: the agent's\n * ALLOWED_CONTEXT_KEYS drops them, and forwarding a browser fingerprint on\n * a product that handles citizen PII is unnecessary exposure.\n *\n * PII rule for this file: nothing derived from application form data, uploaded\n * document contents/filenames, grievance descriptions or citizen identity may\n * ever enter the returned payload. Only the route shape, resource ids that are\n * already in the URL, and the coarse `tab` query parameter are captured.\n */\n\nimport type { PageContext } from '#src/types/assistant';\n\ninterface ConversationContextShape {\n entityType?: string;\n entityId?: string;\n activeTab?: string;\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Backend ids are Prisma `@default(uuid())` (see\n * `wspace-govcitizenhub-svc/prisma/schema/*.prisma`), so a detail route only\n * matches when the trailing segment is a real UUID. This is what keeps the\n * reserved literals `new` and `verify` from being read as entity ids.\n */\nconst UUID_SEGMENT = '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';\n\nfunction detailPattern(collection: string): RegExp {\n return new RegExp(`^/govcitizenhub/${collection}/(${UUID_SEGMENT})$`);\n}\n\n/**\n * Detail routes that actually exist in `GovCitizenHubRoutes.tsx`.\n * Keep in lockstep with the `path=\"<collection>/:id\"` routes declared there —\n * `pageContext.test.ts` fails the build if they drift.\n */\nconst DETAIL_ROUTES: ReadonlyArray<readonly [string, string]> = [\n ['services', 'GOVCITIZENHUB_SERVICE'],\n ['applications', 'GOVCITIZENHUB_APPLICATION'],\n ['grievances', 'GOVCITIZENHUB_GRIEVANCE'],\n];\n\n/**\n * List routes that exist but have no detail route. They contribute an\n * entityType so the agent knows which collection is on screen, and never an\n * entityId.\n *\n * ROUTE_DECISIONS — the previous table also carried detail patterns for\n * `agencies/:id`, `documents/:id`, `payments/:id` and `permits/:id`. No such\n * routes are declared, so those four regexes could never fire. They were\n * removed rather than left as dead code; if a detail route is added later,\n * move the collection into DETAIL_ROUTES and the route-parity test will pass\n * again.\n */\nconst LIST_ROUTES: ReadonlyArray<readonly [string, string]> = [\n ['services', 'GOVCITIZENHUB_SERVICE'],\n ['applications', 'GOVCITIZENHUB_APPLICATION'],\n ['agencies', 'GOVCITIZENHUB_AGENCY'],\n ['documents', 'GOVCITIZENHUB_DOCUMENT'],\n ['payments', 'GOVCITIZENHUB_PAYMENT'],\n ['permits', 'GOVCITIZENHUB_PERMIT'],\n ['grievances', 'GOVCITIZENHUB_GRIEVANCE'],\n // Community Intelligence (BOFF-5666) — the jurisdiction directory.\n ['intelligence', 'GOVCITIZENHUB_JURISDICTION'],\n];\n\n/**\n * Community Intelligence jurisdiction profile tabs. Every one of these routes\n * is `/govcitizenhub/intelligence/<jurisdiction uuid>[/<tab>]`, so they all\n * carry the same entityId (the jurisdiction) and differ only in which surface\n * is on screen — reported both as a distinct entityType and as `activeTab`.\n *\n * The empty tab segment is the profile root; it shares the directory's\n * `GOVCITIZENHUB_JURISDICTION` type exactly as the other list/detail pairs do.\n */\nconst JURISDICTION_TAB_ROUTES: ReadonlyArray<readonly [string, string]> = [\n ['', 'GOVCITIZENHUB_JURISDICTION'],\n ['governance', 'GOVCITIZENHUB_JURISDICTION_GOVERNANCE'],\n ['budget', 'GOVCITIZENHUB_JURISDICTION_BUDGET'],\n ['projects', 'GOVCITIZENHUB_JURISDICTION_PROJECTS'],\n ['indicators', 'GOVCITIZENHUB_JURISDICTION_INDICATORS'],\n ['benchmark', 'GOVCITIZENHUB_JURISDICTION_BENCHMARK'],\n ['services', 'GOVCITIZENHUB_JURISDICTION_SERVICE_PERFORMANCE'],\n ['assets', 'GOVCITIZENHUB_JURISDICTION_ASSETS'],\n ['elections', 'GOVCITIZENHUB_JURISDICTION_ELECTIONS'],\n ['consultations', 'GOVCITIZENHUB_JURISDICTION_CONSULTATIONS'],\n ['open-data', 'GOVCITIZENHUB_JURISDICTION_OPEN_DATA'],\n ['timeline', 'GOVCITIZENHUB_JURISDICTION_TIMELINE'],\n ['corrections', 'GOVCITIZENHUB_JURISDICTION_CORRECTIONS'],\n];\n\n/**\n * Anchored to the UUID id shape for the same reason as `detailPattern`: the\n * admin catalog routes (`intelligence/admin/levels`, `.../indicators`) sit at\n * the same depth as a jurisdiction profile tab, and \"admin\" must never be\n * reported as a jurisdiction id.\n */\nconst JURISDICTION_PATTERN = new RegExp(\n `^/govcitizenhub/intelligence/(${UUID_SEGMENT})(?:/([a-z-]+))?$`\n);\n\n/**\n * Routes under a collection that are actions rather than entities. They must\n * never yield an entityId, and they get their own entityType so the agent can\n * tell \"composing a new application\" from \"browsing applications\".\n */\nconst ACTION_ROUTES: ReadonlyArray<readonly [string, string]> = [\n ['applications/new', 'GOVCITIZENHUB_APPLICATION_DRAFT'],\n ['permits/verify', 'GOVCITIZENHUB_PERMIT_VERIFICATION'],\n // Citizen mobile surface (BOFF-4088) — same four destinations as the\n // BottomTabNav. `m/scan` renders the identical VerifyPermitPage as\n // `permits/verify` above, so it reports the same entityType.\n ['m', 'GOVCITIZENHUB_MOBILE_HOME'],\n ['m/requests', 'GOVCITIZENHUB_MOBILE_REQUESTS'],\n ['m/scan', 'GOVCITIZENHUB_PERMIT_VERIFICATION'],\n ['m/profile', 'GOVCITIZENHUB_MOBILE_PROFILE'],\n // Community Intelligence admin catalogs — workspace-wide reference data, not\n // a jurisdiction, so they carry no entityId.\n ['intelligence/admin/levels', 'GOVCITIZENHUB_ADMIN_LEVEL'],\n ['intelligence/admin/indicators', 'GOVCITIZENHUB_INDICATOR'],\n];\n\nexport function gatherPageContext(): PageContext {\n const url = window.location.href;\n const pathSegments = window.location.pathname.split('/').filter(Boolean);\n const currentPage = pathSegments.slice(0, 3).join('/') || 'home';\n const entity = resolveGovCitizenHubConversationContext(\n window.location.pathname,\n window.location.search\n );\n\n return {\n currentUrl: url,\n currentPage,\n entityType: entity.entityType,\n entityId: entity.entityId,\n activeTab: entity.activeTab,\n platform: 'govcitizenhub',\n version: import.meta.env.VITE_APP_VERSION ?? '2026.709.1',\n viewportSize: `${window.innerWidth}x${window.innerHeight}`,\n };\n}\n\nfunction matchPath(pattern: RegExp, pathname: string): RegExpMatchArray | null {\n return pathname.match(pattern);\n}\n\nfunction normalizePath(pathname: string): string {\n return pathname.length > 1 && pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;\n}\n\nexport function resolveGovCitizenHubConversationContext(\n pathname: string,\n search: string\n): ConversationContextShape {\n const params = new URLSearchParams(search);\n const path = normalizePath(pathname);\n\n // Action routes are matched before detail routes so a reserved literal can\n // never be mistaken for an id even if the id shape were relaxed later.\n for (const [suffix, entityType] of ACTION_ROUTES) {\n if (path === `/govcitizenhub/${suffix}`) {\n return { entityType, metadata: { route: suffix } };\n }\n }\n\n // Jurisdiction profile tabs are matched before the generic detail routes so\n // the tab segment is read as a surface, never as a nested entity id.\n const jurisdictionMatch = matchPath(JURISDICTION_PATTERN, path);\n if (jurisdictionMatch) {\n const tabSegment = jurisdictionMatch[2] ?? '';\n const tab = JURISDICTION_TAB_ROUTES.find(([segment]) => segment === tabSegment);\n if (tab) {\n return {\n entityType: tab[1],\n entityId: jurisdictionMatch[1],\n activeTab: tabSegment || undefined,\n metadata: { collection: 'intelligence' },\n };\n }\n }\n\n for (const [collection, entityType] of DETAIL_ROUTES) {\n const match = matchPath(detailPattern(collection), path);\n if (match) {\n return {\n entityType,\n entityId: match[1],\n metadata: { collection },\n };\n }\n }\n\n for (const [collection, entityType] of LIST_ROUTES) {\n if (path === `/govcitizenhub/${collection}`) {\n return {\n entityType,\n activeTab: params.get('tab') ?? undefined,\n metadata: { collection, view: 'list' },\n };\n }\n }\n\n if (path === '/govcitizenhub' || path === '/govcitizenhub/') {\n return {\n entityType: 'GOVCITIZENHUB_DASHBOARD',\n metadata: { view: 'dashboard' },\n };\n }\n\n const activeTab = params.get('tab') ?? undefined;\n return {\n activeTab,\n metadata: activeTab ? { activeTab } : {},\n };\n}\n\n/** Exported for the route-parity test in `pageContext.test.ts`. */\nexport const __routeTables = {\n DETAIL_ROUTES,\n LIST_ROUTES,\n ACTION_ROUTES,\n JURISDICTION_TAB_ROUTES,\n};\n"],"mappings":";AAyCA,IAAM,IAAe;AAErB,SAAS,EAAc,GAA4B;CACjD,OAAW,OAAO,mBAAmB,EAAW,IAAI,EAAa,GAAG;AACtE;AAOA,IAAM,IAA0D;CAC9D,CAAC,YAAY,uBAAuB;CACpC,CAAC,gBAAgB,2B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A;CACvC,OAAO;EACL;EACA,UAAU,IAAY,EAAE,aAAU,IAAI,CAAC;CACzC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-govcitizenhub",
3
- "version": "2026.720.6",
3
+ "version": "2026.730.1",
4
4
  "description": "Burdenoff GovCitizenHub Microfrontend",
5
5
  "type": "module",
6
6
  "files": [