@burdenoff/microfe-govcitizenhub 2026.1201.1 → 2026.1202.2
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.
- package/dist/govcitizenhub/components/DocumentUploadField.js +1 -1
- package/dist/govcitizenhub/components/DocumentUploadField.js.map +1 -1
- package/dist/govcitizenhub/components/EmptyState.d.ts +19 -1
- package/dist/govcitizenhub/components/EmptyState.js +36 -16
- package/dist/govcitizenhub/components/EmptyState.js.map +1 -1
- package/dist/govcitizenhub/components/FilterTabs.js +1 -1
- package/dist/govcitizenhub/components/FilterTabs.js.map +1 -1
- package/dist/govcitizenhub/components/GovCharts.js +1 -1
- package/dist/govcitizenhub/components/GovCharts.js.map +1 -1
- package/dist/govcitizenhub/components/KeyValueList.js +1 -1
- package/dist/govcitizenhub/components/KeyValueList.js.map +1 -1
- package/dist/govcitizenhub/components/Pagination.js +2 -2
- package/dist/govcitizenhub/components/Pagination.js.map +1 -1
- package/dist/govcitizenhub/components/StatusStepper.js +2 -2
- package/dist/govcitizenhub/components/StatusStepper.js.map +1 -1
- package/dist/govcitizenhub/components/SummaryStrip.js +2 -2
- package/dist/govcitizenhub/components/SummaryStrip.js.map +1 -1
- package/dist/govcitizenhub/components/Timeline.js +2 -2
- package/dist/govcitizenhub/components/Timeline.js.map +1 -1
- package/dist/govcitizenhub/components/mobile/MobileLayout.d.ts +5 -0
- package/dist/govcitizenhub/components/mobile/MobileLayout.js +14 -7
- package/dist/govcitizenhub/components/mobile/MobileLayout.js.map +1 -1
- package/dist/govcitizenhub/context/GovCitizenHubContext.js +26 -22
- package/dist/govcitizenhub/context/GovCitizenHubContext.js.map +1 -1
- package/dist/govcitizenhub/hooks/uploadVisibility.d.ts +2 -0
- package/dist/govcitizenhub/hooks/uploadVisibility.js +8 -0
- package/dist/govcitizenhub/hooks/uploadVisibility.js.map +1 -0
- package/dist/govcitizenhub/hooks/useFiles.d.ts +3 -18
- package/dist/govcitizenhub/hooks/useFiles.js +49 -48
- package/dist/govcitizenhub/hooks/useFiles.js.map +1 -1
- package/dist/govcitizenhub/pages/CitizenHomePage.js +3 -3
- package/dist/govcitizenhub/pages/CitizenHomePage.js.map +1 -1
- package/dist/govcitizenhub/pages/DashboardPage.js +11 -11
- package/dist/govcitizenhub/pages/DashboardPage.js.map +1 -1
- package/dist/govcitizenhub/pages/access-control/AccessControlPage.js +42 -42
- package/dist/govcitizenhub/pages/access-control/AccessControlPage.js.map +1 -1
- package/dist/govcitizenhub/pages/agencies/AgenciesPage.js +4 -4
- package/dist/govcitizenhub/pages/agencies/AgenciesPage.js.map +1 -1
- package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js +4 -4
- package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js.map +1 -1
- package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +8 -8
- package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +7 -7
- package/dist/govcitizenhub/pages/applications/NewApplicationPage.js.map +1 -1
- package/dist/govcitizenhub/pages/documents/DocumentsPage.js +2 -2
- package/dist/govcitizenhub/pages/documents/DocumentsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js +3 -3
- package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js.map +1 -1
- package/dist/govcitizenhub/pages/grievances/GrievancesPage.js +9 -9
- package/dist/govcitizenhub/pages/grievances/GrievancesPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js +11 -11
- package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js +1 -1
- package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js +13 -13
- package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/BudgetPage.js +28 -28
- package/dist/govcitizenhub/pages/intelligence/BudgetPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js +2 -2
- package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js +3 -3
- package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js +13 -13
- package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js +5 -5
- package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js +16 -16
- package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/GovernancePage.js +6 -6
- package/dist/govcitizenhub/pages/intelligence/GovernancePage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js +16 -16
- package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js +10 -10
- package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js +7 -7
- package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js +2 -2
- package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js +2 -2
- package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js +18 -18
- package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js +14 -14
- package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js +8 -8
- package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js +27 -27
- package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js.map +1 -1
- package/dist/govcitizenhub/pages/intelligence/TimelinePage.js +3 -3
- package/dist/govcitizenhub/pages/intelligence/TimelinePage.js.map +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileHomePage.js +3 -3
- package/dist/govcitizenhub/pages/mobile/MobileHomePage.js.map +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileProfilePage.js +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileProfilePage.js.map +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileRequestsPage.js +1 -1
- package/dist/govcitizenhub/pages/mobile/MobileRequestsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/payments/PaymentsPage.js +4 -4
- package/dist/govcitizenhub/pages/payments/PaymentsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js +2 -2
- package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/permits/PermitsPage.js +8 -8
- package/dist/govcitizenhub/pages/permits/PermitsPage.js.map +1 -1
- package/dist/govcitizenhub/pages/permits/VerifyPermitPage.js +6 -6
- package/dist/govcitizenhub/pages/permits/VerifyPermitPage.js.map +1 -1
- package/dist/govcitizenhub/pages/services/FormFieldBuilder.js +3 -3
- package/dist/govcitizenhub/pages/services/FormFieldBuilder.js.map +1 -1
- package/dist/govcitizenhub/pages/services/ServiceDetailPage.js +3 -3
- package/dist/govcitizenhub/pages/services/ServiceDetailPage.js.map +1 -1
- package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +3 -3
- package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
- package/dist/govcitizenhub/pages/services/ServicesPage.js +6 -6
- package/dist/govcitizenhub/pages/services/ServicesPage.js.map +1 -1
- package/dist/govcitizenhub/pages/wallet/WalletPage.js +2 -2
- package/dist/govcitizenhub/pages/wallet/WalletPage.js.map +1 -1
- package/dist/govcitizenhub/types/index.d.ts +6 -0
- package/dist/services/createSandboxAssistantTransport.js +3 -3
- package/dist/services/createSandboxAssistantTransport.js.map +1 -1
- package/package.json +7 -5
|
@@ -9,61 +9,65 @@ function u() {
|
|
|
9
9
|
if (!e) throw Error("useGovCitizenHub must be used within a GovCitizenHubProvider");
|
|
10
10
|
return e;
|
|
11
11
|
}
|
|
12
|
-
var d = ({ children: t, basePath: n, currentUser: i, tenantId: o, workspaceId: u, apiGatewayUrl: d, authToken: f }) => {
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
}, [
|
|
16
|
-
basePath:
|
|
12
|
+
var d = ({ children: t, basePath: n, currentUser: i, tenantId: o, workspaceId: u, apiGatewayUrl: d, authToken: f, navigationV2: p = !1 }) => {
|
|
13
|
+
let m = s(), h = n || "/", g = r((t) => e(h, t), [h]), _ = r((t) => {
|
|
14
|
+
m(e(h, t));
|
|
15
|
+
}, [h, m]), v = a(() => ({
|
|
16
|
+
basePath: h,
|
|
17
17
|
navigate: void 0,
|
|
18
18
|
currentUser: i,
|
|
19
19
|
tenantId: o,
|
|
20
20
|
workspaceId: u,
|
|
21
21
|
apiGatewayUrl: d,
|
|
22
22
|
authToken: f,
|
|
23
|
+
navigationV2: p,
|
|
23
24
|
isStandalone: !0,
|
|
24
|
-
navigateTo:
|
|
25
|
-
getPath:
|
|
25
|
+
navigateTo: _,
|
|
26
|
+
getPath: g
|
|
26
27
|
}), [
|
|
27
|
-
|
|
28
|
+
h,
|
|
28
29
|
i,
|
|
29
30
|
o,
|
|
30
31
|
u,
|
|
31
32
|
d,
|
|
32
33
|
f,
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
p,
|
|
35
|
+
_,
|
|
36
|
+
g
|
|
35
37
|
]);
|
|
36
38
|
return /* @__PURE__ */ c(l.Provider, {
|
|
37
|
-
value:
|
|
39
|
+
value: v,
|
|
38
40
|
children: t
|
|
39
41
|
});
|
|
40
|
-
}, f = ({ children: t, basePath: n, navigate: i, currentUser: o, tenantId: s, workspaceId: u, apiGatewayUrl: d, authToken: f }) => {
|
|
41
|
-
let
|
|
42
|
-
i(e(
|
|
43
|
-
}, [
|
|
44
|
-
basePath:
|
|
42
|
+
}, f = ({ children: t, basePath: n, navigate: i, currentUser: o, tenantId: s, workspaceId: u, apiGatewayUrl: d, authToken: f, navigationV2: p = !1 }) => {
|
|
43
|
+
let m = n || "/", h = r((t) => e(m, t), [m]), g = r((t) => {
|
|
44
|
+
i(e(m, t));
|
|
45
|
+
}, [m, i]), _ = a(() => ({
|
|
46
|
+
basePath: m,
|
|
45
47
|
navigate: i,
|
|
46
48
|
currentUser: o,
|
|
47
49
|
tenantId: s,
|
|
48
50
|
workspaceId: u,
|
|
49
51
|
apiGatewayUrl: d,
|
|
50
52
|
authToken: f,
|
|
53
|
+
navigationV2: p,
|
|
51
54
|
isStandalone: !1,
|
|
52
|
-
navigateTo:
|
|
53
|
-
getPath:
|
|
55
|
+
navigateTo: g,
|
|
56
|
+
getPath: h
|
|
54
57
|
}), [
|
|
55
|
-
|
|
58
|
+
m,
|
|
56
59
|
i,
|
|
57
60
|
o,
|
|
58
61
|
s,
|
|
59
62
|
u,
|
|
60
63
|
d,
|
|
61
64
|
f,
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
p,
|
|
66
|
+
g,
|
|
67
|
+
h
|
|
64
68
|
]);
|
|
65
69
|
return /* @__PURE__ */ c(l.Provider, {
|
|
66
|
-
value:
|
|
70
|
+
value: _,
|
|
67
71
|
children: t
|
|
68
72
|
});
|
|
69
73
|
}, p = ({ prefix: e, unscoped: n = [], children: r }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GovCitizenHubContext.js","names":["useRouterNavigate","GovCitizenHubContext","createContext","useGovCitizenHub","context","useContext","StandaloneProviderInner","routerNavigate","useNavigate","effectiveBasePath","basePath","getPath","useCallback","joinPath","relativePath","navigateTo","contextValue","useMemo","currentUser","tenantId","workspaceId","apiGatewayUrl","authToken","IntegratedProviderInner","navigate","SurfacePathScope","parent","value","scope","scopePath","prefix","unscoped","GovCitizenHubProvider","props","MemoryRouter"],"sources":["../../../src/govcitizenhub/context/GovCitizenHubContext.tsx"],"sourcesContent":["/**\n * GovCitizenHub Context Provider\n * @module govcitizenhub/context\n *\n * Splits standalone mode (wraps its own MemoryRouter + useNavigate) from\n * integrated mode (the host shell supplies `navigate`). Exposes gateway/auth\n * context + relative navigation helpers to every page.\n */\n\nimport type { FC, PropsWithChildren } from 'react';\nimport { createContext, useContext, useMemo, useCallback } from 'react';\nimport { MemoryRouter, useNavigate as useRouterNavigate } from 'react-router';\nimport type { GovCitizenHubRootProps } from '../types';\nimport { joinPath, scopePath } from '../utils/navigation';\n\ninterface GovCitizenHubContextValue extends Omit<\n GovCitizenHubRootProps,\n 'registerNavItems' | 'registerFooterItems' | 'navigate'\n> {\n isStandalone: boolean;\n /** Shell's navigate function (only available in integrated mode). */\n navigate?: (path: string) => void;\n /** Navigate to a path relative to basePath. */\n navigateTo: (relativePath: string) => void;\n /** Get the full path for a relative path. */\n getPath: (relativePath: string) => string;\n}\n\nconst GovCitizenHubContext = createContext<GovCitizenHubContextValue | null>(null);\n\nexport function useGovCitizenHub(): GovCitizenHubContextValue {\n const context = useContext(GovCitizenHubContext);\n if (!context) {\n throw new Error('useGovCitizenHub must be used within a GovCitizenHubProvider');\n }\n return context;\n}\n\ntype ProviderProps = Omit<GovCitizenHubRootProps, 'registerNavItems' | 'registerFooterItems'> & {\n isStandalone: boolean;\n};\n\nconst StandaloneProviderInner: FC<PropsWithChildren<ProviderProps>> = ({\n children,\n basePath,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n}) => {\n const routerNavigate = useRouterNavigate();\n const effectiveBasePath = basePath || '/';\n\n const getPath = useCallback(\n (relativePath: string) => joinPath(effectiveBasePath, relativePath),\n [effectiveBasePath]\n );\n\n const navigateTo = useCallback(\n (relativePath: string) => {\n routerNavigate(joinPath(effectiveBasePath, relativePath));\n },\n [effectiveBasePath, routerNavigate]\n );\n\n const contextValue = useMemo<GovCitizenHubContextValue>(\n () => ({\n basePath: effectiveBasePath,\n navigate: undefined,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n isStandalone: true,\n navigateTo,\n getPath,\n }),\n [\n effectiveBasePath,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigateTo,\n getPath,\n ]\n );\n\n return (\n <GovCitizenHubContext.Provider value={contextValue}>{children}</GovCitizenHubContext.Provider>\n );\n};\n\nconst IntegratedProviderInner: FC<\n PropsWithChildren<ProviderProps & { navigate: (path: string) => void }>\n> = ({\n children,\n basePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n}) => {\n const effectiveBasePath = basePath || '/';\n\n const getPath = useCallback(\n (relativePath: string) => joinPath(effectiveBasePath, relativePath),\n [effectiveBasePath]\n );\n\n const navigateTo = useCallback(\n (relativePath: string) => {\n navigate(joinPath(effectiveBasePath, relativePath));\n },\n [effectiveBasePath, navigate]\n );\n\n const contextValue = useMemo<GovCitizenHubContextValue>(\n () => ({\n basePath: effectiveBasePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n isStandalone: false,\n navigateTo,\n getPath,\n }),\n [\n effectiveBasePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigateTo,\n getPath,\n ]\n );\n\n return (\n <GovCitizenHubContext.Provider value={contextValue}>{children}</GovCitizenHubContext.Provider>\n );\n};\n\n/**\n * Re-scopes `navigateTo` / `getPath` under a route prefix (e.g. `officer`) so\n * pages shared between surfaces keep every link inside the surface the user is\n * in. Segments listed in `unscoped` (like `m` or `intelligence`) are left alone.\n */\nexport const SurfacePathScope: FC<\n PropsWithChildren<{ prefix: string; unscoped?: readonly string[] }>\n> = ({ prefix, unscoped = [], children }) => {\n const parent = useGovCitizenHub();\n const value = useMemo<GovCitizenHubContextValue>(() => {\n const scope = (relativePath: string) => scopePath(prefix, unscoped, relativePath);\n return {\n ...parent,\n navigateTo: (relativePath) => parent.navigateTo(scope(relativePath)),\n getPath: (relativePath) => parent.getPath(scope(relativePath)),\n };\n }, [parent, prefix, unscoped]);\n return <GovCitizenHubContext.Provider value={value}>{children}</GovCitizenHubContext.Provider>;\n};\n\nexport const GovCitizenHubProvider: FC<PropsWithChildren<GovCitizenHubRootProps>> = (props) => {\n const { children, navigate } = props;\n const isStandalone = !navigate;\n\n if (isStandalone) {\n return (\n <MemoryRouter>\n <StandaloneProviderInner {...props} isStandalone={true}>\n {children}\n </StandaloneProviderInner>\n </MemoryRouter>\n );\n }\n\n return (\n <IntegratedProviderInner {...props} navigate={navigate} isStandalone={false}>\n {children}\n </IntegratedProviderInner>\n );\n};\n"],"mappings":";;;;;AA4BA,IAAMC,IAAuBC,EAAgD,IAAI;AAEjF,SAAgBC,IAA8C;CAC5D,IAAMC,IAAUC,EAAWJ,CAAoB;CAC/C,IAAI,CAACG,GACH,MAAU,MAAM,8DAA8D;CAEhF,OAAOA;AACT;AAMA,IAAME,KAAiE,EACrE,aACA,aACA,gBACA,aACA,gBACA,kBACA,
|
|
1
|
+
{"version":3,"file":"GovCitizenHubContext.js","names":["useRouterNavigate","GovCitizenHubContext","createContext","useGovCitizenHub","context","useContext","StandaloneProviderInner","routerNavigate","useNavigate","effectiveBasePath","basePath","getPath","useCallback","joinPath","relativePath","navigateTo","contextValue","useMemo","currentUser","tenantId","workspaceId","apiGatewayUrl","authToken","navigationV2","IntegratedProviderInner","navigate","SurfacePathScope","parent","value","scope","scopePath","prefix","unscoped","GovCitizenHubProvider","props","MemoryRouter"],"sources":["../../../src/govcitizenhub/context/GovCitizenHubContext.tsx"],"sourcesContent":["/**\n * GovCitizenHub Context Provider\n * @module govcitizenhub/context\n *\n * Splits standalone mode (wraps its own MemoryRouter + useNavigate) from\n * integrated mode (the host shell supplies `navigate`). Exposes gateway/auth\n * context + relative navigation helpers to every page.\n */\n\nimport type { FC, PropsWithChildren } from 'react';\nimport { createContext, useContext, useMemo, useCallback } from 'react';\nimport { MemoryRouter, useNavigate as useRouterNavigate } from 'react-router';\nimport type { GovCitizenHubRootProps } from '../types';\nimport { joinPath, scopePath } from '../utils/navigation';\n\ninterface GovCitizenHubContextValue extends Omit<\n GovCitizenHubRootProps,\n 'registerNavItems' | 'registerFooterItems' | 'navigate'\n> {\n isStandalone: boolean;\n /** Shell's navigate function (only available in integrated mode). */\n navigate?: (path: string) => void;\n /** Navigate to a path relative to basePath. */\n navigateTo: (relativePath: string) => void;\n /** Get the full path for a relative path. */\n getPath: (relativePath: string) => string;\n}\n\nconst GovCitizenHubContext = createContext<GovCitizenHubContextValue | null>(null);\n\nexport function useGovCitizenHub(): GovCitizenHubContextValue {\n const context = useContext(GovCitizenHubContext);\n if (!context) {\n throw new Error('useGovCitizenHub must be used within a GovCitizenHubProvider');\n }\n return context;\n}\n\ntype ProviderProps = Omit<GovCitizenHubRootProps, 'registerNavItems' | 'registerFooterItems'> & {\n isStandalone: boolean;\n};\n\nconst StandaloneProviderInner: FC<PropsWithChildren<ProviderProps>> = ({\n children,\n basePath,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigationV2 = false,\n}) => {\n const routerNavigate = useRouterNavigate();\n const effectiveBasePath = basePath || '/';\n\n const getPath = useCallback(\n (relativePath: string) => joinPath(effectiveBasePath, relativePath),\n [effectiveBasePath]\n );\n\n const navigateTo = useCallback(\n (relativePath: string) => {\n routerNavigate(joinPath(effectiveBasePath, relativePath));\n },\n [effectiveBasePath, routerNavigate]\n );\n\n const contextValue = useMemo<GovCitizenHubContextValue>(\n () => ({\n basePath: effectiveBasePath,\n navigate: undefined,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigationV2,\n isStandalone: true,\n navigateTo,\n getPath,\n }),\n [\n effectiveBasePath,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigationV2,\n navigateTo,\n getPath,\n ]\n );\n\n return (\n <GovCitizenHubContext.Provider value={contextValue}>{children}</GovCitizenHubContext.Provider>\n );\n};\n\nconst IntegratedProviderInner: FC<\n PropsWithChildren<ProviderProps & { navigate: (path: string) => void }>\n> = ({\n children,\n basePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigationV2 = false,\n}) => {\n const effectiveBasePath = basePath || '/';\n\n const getPath = useCallback(\n (relativePath: string) => joinPath(effectiveBasePath, relativePath),\n [effectiveBasePath]\n );\n\n const navigateTo = useCallback(\n (relativePath: string) => {\n navigate(joinPath(effectiveBasePath, relativePath));\n },\n [effectiveBasePath, navigate]\n );\n\n const contextValue = useMemo<GovCitizenHubContextValue>(\n () => ({\n basePath: effectiveBasePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigationV2,\n isStandalone: false,\n navigateTo,\n getPath,\n }),\n [\n effectiveBasePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigationV2,\n navigateTo,\n getPath,\n ]\n );\n\n return (\n <GovCitizenHubContext.Provider value={contextValue}>{children}</GovCitizenHubContext.Provider>\n );\n};\n\n/**\n * Re-scopes `navigateTo` / `getPath` under a route prefix (e.g. `officer`) so\n * pages shared between surfaces keep every link inside the surface the user is\n * in. Segments listed in `unscoped` (like `m` or `intelligence`) are left alone.\n */\nexport const SurfacePathScope: FC<\n PropsWithChildren<{ prefix: string; unscoped?: readonly string[] }>\n> = ({ prefix, unscoped = [], children }) => {\n const parent = useGovCitizenHub();\n const value = useMemo<GovCitizenHubContextValue>(() => {\n const scope = (relativePath: string) => scopePath(prefix, unscoped, relativePath);\n return {\n ...parent,\n navigateTo: (relativePath) => parent.navigateTo(scope(relativePath)),\n getPath: (relativePath) => parent.getPath(scope(relativePath)),\n };\n }, [parent, prefix, unscoped]);\n return <GovCitizenHubContext.Provider value={value}>{children}</GovCitizenHubContext.Provider>;\n};\n\nexport const GovCitizenHubProvider: FC<PropsWithChildren<GovCitizenHubRootProps>> = (props) => {\n const { children, navigate } = props;\n const isStandalone = !navigate;\n\n if (isStandalone) {\n return (\n <MemoryRouter>\n <StandaloneProviderInner {...props} isStandalone={true}>\n {children}\n </StandaloneProviderInner>\n </MemoryRouter>\n );\n }\n\n return (\n <IntegratedProviderInner {...props} navigate={navigate} isStandalone={false}>\n {children}\n </IntegratedProviderInner>\n );\n};\n"],"mappings":";;;;;AA4BA,IAAMC,IAAuBC,EAAgD,IAAI;AAEjF,SAAgBC,IAA8C;CAC5D,IAAMC,IAAUC,EAAWJ,CAAoB;CAC/C,IAAI,CAACG,GACH,MAAU,MAAM,8DAA8D;CAEhF,OAAOA;AACT;AAMA,IAAME,KAAiE,EACrE,aACA,aACA,gBACA,aACA,gBACA,kBACA,cACA,kBAAe,SACX;CACJ,IAAMC,IAAiBP,EAAkB,GACnCS,IAAoBC,KAAY,KAEhCC,IAAUC,GACb,MAAyBC,EAASJ,GAAmBK,CAAY,GAClE,CAACL,CAAiB,CACpB,GAEMM,IAAaH,GAChB,MAAyB;EACxB,EAAeC,EAASJ,GAAmBK,CAAY,CAAC;CAC1D,GACA,CAACL,GAAmBF,CAAc,CACpC,GAEMS,IAAeC,SACZ;EACL,UAAUR;EACV,UAAU,KAAA;EACV;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;CACF,IACA;EACEA;EACAS;EACAC;EACAC;EACAC;EACAC;EACAC;EACAR;EACAJ;CACF,CACF;CAEA,OACE,kBAACV,EAAqB,UAAtB;EAA+B,OAAOe;EAAe;CA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@
|
|
|
1
|
+
// src/govcitizenhub/hooks/uploadVisibility.ts
|
|
2
|
+
function e(e = "PRIVATE") {
|
|
3
|
+
if (e !== "PRIVATE" && e !== "WORKSPACE") throw Error("Upload visibility must be PRIVATE or WORKSPACE");
|
|
4
|
+
return e;
|
|
5
|
+
}
|
|
6
|
+
export { e as uploadVisibility };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=uploadVisibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadVisibility.js","names":["uploadVisibility","value"],"sources":["../../../src/govcitizenhub/hooks/uploadVisibility.ts"],"sourcesContent":["export type UploadVisibility = 'PRIVATE' | 'WORKSPACE';\n\nexport function uploadVisibility(value: unknown = 'PRIVATE'): UploadVisibility {\n if (value !== 'PRIVATE' && value !== 'WORKSPACE') {\n throw new Error('Upload visibility must be PRIVATE or WORKSPACE');\n }\n return value;\n}\n"],"mappings":";AAEA,SAAgBA,EAAiB,IAAiB,WAA6B;CAC7E,IAAIC,MAAU,aAAaA,MAAU,aACnC,MAAU,MAAM,gDAAgD;CAElE,OAAOA;AACT"}
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @module govcitizenhub/hooks
|
|
4
|
-
*
|
|
5
|
-
* GovCitizenHub never stores blobs. Documents/permits reference files owned by
|
|
6
|
-
* wspace-files-svc by id. Upload uses the SAME proven `graphqlFetch` transport
|
|
7
|
-
* as every other read/write in this MFE (the shell's workspace gateway + token),
|
|
8
|
-
* driving the wspace-files 3-step presigned flow directly:
|
|
9
|
-
* ensureFolderByPath -> initiateUpload -> HTTP PUT -> completeUpload
|
|
10
|
-
* Display resolves a file id to a presigned URL via `getFileDownloadUrl`.
|
|
11
|
-
*
|
|
12
|
-
* NOTE: we deliberately do NOT use the Apollo-based `uploadBlobToFiles` /
|
|
13
|
-
* `getWorkspaceClient()` helper here — this shell wires its data plane through
|
|
14
|
-
* `graphqlFetch`, not a global Apollo client, so `getWorkspaceClient()` returns
|
|
15
|
-
* an un-networked client and the upload silently no-ops. `graphqlFetch` is the
|
|
16
|
-
* transport the whole MFE already uses successfully.
|
|
17
|
-
*/
|
|
1
|
+
import { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';
|
|
2
|
+
import { UploadVisibility } from './uploadVisibility';
|
|
18
3
|
export declare const FILE_FOLDERS: {
|
|
19
4
|
readonly documents: "/GovCitizenHub/Documents";
|
|
20
5
|
readonly permits: "/GovCitizenHub/Permits";
|
|
@@ -30,6 +15,6 @@ export interface UploadedFile {
|
|
|
30
15
|
* caller persists the id (e.g. via `govAddDocument({ fileId })`); the URL is used
|
|
31
16
|
* for an immediate preview / download link.
|
|
32
17
|
*/
|
|
33
|
-
export declare function uploadFileToFiles(file: File, folderPath: string): Promise<UploadedFile>;
|
|
18
|
+
export declare function uploadFileToFiles(file: File, folderPath: string, visibility?: UploadVisibility, runQuery?: typeof graphqlFetch): Promise<UploadedFile>;
|
|
34
19
|
/** Resolve a wspace-files-svc file id to a presigned download URL for display. */
|
|
35
20
|
export declare function useFileUrl(fileId?: string | null): import('@tanstack/react-query').UseQueryResult<string | null, Error>;
|
|
@@ -1,87 +1,88 @@
|
|
|
1
1
|
import { useGovCitizenHub as e } from "../context/GovCitizenHubContext.js";
|
|
2
|
-
import "
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { graphqlFetch as
|
|
2
|
+
import { uploadVisibility as t } from "./uploadVisibility.js";
|
|
3
|
+
import { useQuery as n } from "@tanstack/react-query";
|
|
4
|
+
import { graphqlFetch as r } from "@burdenoff/fe-libs/shared/graphql";
|
|
5
5
|
// src/govcitizenhub/hooks/useFiles.ts
|
|
6
|
-
var
|
|
6
|
+
var i = 31536e3, a = {
|
|
7
7
|
documents: "/GovCitizenHub/Documents",
|
|
8
8
|
permits: "/GovCitizenHub/Permits",
|
|
9
9
|
grievances: "/GovCitizenHub/Grievances"
|
|
10
10
|
};
|
|
11
|
-
async function
|
|
12
|
-
let
|
|
11
|
+
async function o(e, t, n = r) {
|
|
12
|
+
let i = await n({
|
|
13
13
|
gateway: "workspace",
|
|
14
14
|
query: e,
|
|
15
15
|
variables: t,
|
|
16
16
|
workspaceToken: !0
|
|
17
17
|
});
|
|
18
|
-
if (
|
|
19
|
-
if (!
|
|
20
|
-
return
|
|
18
|
+
if (i.errors?.length) throw Error(i.errors[0]?.message ?? "Files request failed");
|
|
19
|
+
if (!i.data) throw Error("Files response did not include data");
|
|
20
|
+
return i.data;
|
|
21
21
|
}
|
|
22
|
-
var
|
|
23
|
-
function
|
|
22
|
+
var s = "\n mutation GovEnsureFolder($path: String!) {\n ensureFolderByPath(path: $path) { id }\n }\n", c = "\n mutation GovInitiateUpload($input: InitiateUploadInput!) {\n initiateUpload(input: $input) {\n uploadUrl\n session { id }\n }\n }\n", l = "\n mutation GovCompleteUpload($input: CompleteUploadInput!) {\n completeUpload(input: $input) {\n fileId\n file { id name }\n }\n }\n", u = "\n query GovGetFileDownloadUrl($id: ID!, $expiresIn: Int) {\n getFileDownloadUrl(id: $id, expiresIn: $expiresIn)\n }\n";
|
|
23
|
+
function d(e, t) {
|
|
24
24
|
let n = e.lastIndexOf(".");
|
|
25
25
|
return n > -1 && n < e.length - 1 ? e.slice(n + 1).toLowerCase() : (t.split("/")[1] ?? "bin").toLowerCase();
|
|
26
26
|
}
|
|
27
|
-
async function
|
|
28
|
-
let
|
|
29
|
-
if (!
|
|
30
|
-
let
|
|
27
|
+
async function f(e, n, a, f = r) {
|
|
28
|
+
let p = t(a), m = (await o(s, { path: n }, f)).ensureFolderByPath?.id;
|
|
29
|
+
if (!m) throw Error("Could not resolve the upload folder.");
|
|
30
|
+
let h = e.type || "application/octet-stream", g = e.size, _ = await o(c, { input: {
|
|
31
31
|
fileName: e.name,
|
|
32
|
-
extension:
|
|
33
|
-
fileSize:
|
|
34
|
-
mimeType:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
extension: d(e.name, h),
|
|
33
|
+
fileSize: g,
|
|
34
|
+
mimeType: h,
|
|
35
|
+
visibility: p,
|
|
36
|
+
folderId: m
|
|
37
|
+
} }, f), v = _.initiateUpload?.uploadUrl, y = _.initiateUpload?.session.id;
|
|
38
|
+
if (!v || !y) throw Error("The files service did not return an upload URL.");
|
|
39
|
+
let b = await fetch(v, {
|
|
39
40
|
method: "PUT",
|
|
40
41
|
body: e,
|
|
41
|
-
headers: { "Content-Type":
|
|
42
|
+
headers: { "Content-Type": h }
|
|
42
43
|
});
|
|
43
|
-
if (!
|
|
44
|
-
let
|
|
45
|
-
sessionId:
|
|
46
|
-
fileSize:
|
|
47
|
-
folderId:
|
|
48
|
-
} })).completeUpload?.file;
|
|
49
|
-
if (!
|
|
50
|
-
let
|
|
44
|
+
if (!b.ok) throw Error(`Upload to storage failed (${b.status}).`);
|
|
45
|
+
let x = (await o(l, { input: {
|
|
46
|
+
sessionId: y,
|
|
47
|
+
fileSize: g,
|
|
48
|
+
folderId: m
|
|
49
|
+
} }, f)).completeUpload?.file;
|
|
50
|
+
if (!x?.id) throw Error("The upload could not be finalized.");
|
|
51
|
+
let S;
|
|
51
52
|
try {
|
|
52
|
-
|
|
53
|
-
id:
|
|
54
|
-
expiresIn:
|
|
55
|
-
})).getFileDownloadUrl ?? "";
|
|
53
|
+
S = (await o(u, {
|
|
54
|
+
id: x.id,
|
|
55
|
+
expiresIn: i
|
|
56
|
+
}, f)).getFileDownloadUrl ?? "";
|
|
56
57
|
} catch {
|
|
57
|
-
|
|
58
|
+
S = "";
|
|
58
59
|
}
|
|
59
60
|
return {
|
|
60
|
-
id:
|
|
61
|
-
url:
|
|
62
|
-
name:
|
|
61
|
+
id: x.id,
|
|
62
|
+
url: S,
|
|
63
|
+
name: x.name
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function p(t) {
|
|
66
67
|
let { apiGatewayUrl: a } = e();
|
|
67
|
-
return
|
|
68
|
+
return n({
|
|
68
69
|
queryKey: [
|
|
69
70
|
"govcitizenhub",
|
|
70
71
|
"file-url",
|
|
71
|
-
|
|
72
|
+
t ?? ""
|
|
72
73
|
],
|
|
73
|
-
enabled: !!
|
|
74
|
+
enabled: !!t,
|
|
74
75
|
staleTime: 18e5,
|
|
75
76
|
retry: 1,
|
|
76
77
|
queryFn: async () => {
|
|
77
|
-
let e = await
|
|
78
|
+
let e = await r({
|
|
78
79
|
gateway: "workspace",
|
|
79
80
|
baseUrl: a,
|
|
80
81
|
workspaceToken: !0,
|
|
81
|
-
query:
|
|
82
|
+
query: u,
|
|
82
83
|
variables: {
|
|
83
|
-
id:
|
|
84
|
-
expiresIn:
|
|
84
|
+
id: t,
|
|
85
|
+
expiresIn: i
|
|
85
86
|
}
|
|
86
87
|
});
|
|
87
88
|
if (e.errors?.length) throw Error(e.errors[0]?.message ?? "Could not resolve file URL");
|
|
@@ -89,6 +90,6 @@ function f(i) {
|
|
|
89
90
|
}
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
|
-
export {
|
|
93
|
+
export { a as FILE_FOLDERS, f as uploadFileToFiles, p as useFileUrl };
|
|
93
94
|
|
|
94
95
|
//# sourceMappingURL=useFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFiles.js","names":["DOWNLOAD_URL_TTL_SECONDS","FILE_FOLDERS","filesFetch","response","
|
|
1
|
+
{"version":3,"file":"useFiles.js","names":["DOWNLOAD_URL_TTL_SECONDS","FILE_FOLDERS","filesFetch","graphqlFetch","response","runQuery","ENSURE_FOLDER","INITIATE_UPLOAD","COMPLETE_UPLOAD","GET_FILE_DOWNLOAD_URL","fileExtension","dot","name","mimeType","uploadFileToFiles","audience","uploadVisibility","visibility","folderId","folderPath","file","fileSize","initiated","uploadUrl","sessionId","putResponse","fileRecord","url","useFileUrl","useGovCitizenHub","useQuery","fileId","apiGatewayUrl"],"sources":["../../../src/govcitizenhub/hooks/useFiles.ts"],"sourcesContent":["/**\n * File hooks — documents & permit PDFs via wspace-files-svc (NO duplication).\n * @module govcitizenhub/hooks\n *\n * GovCitizenHub never stores blobs. Documents/permits reference files owned by\n * wspace-files-svc by id. Upload uses the SAME proven `graphqlFetch` transport\n * as every other read/write in this MFE (the shell's workspace gateway + token),\n * driving the wspace-files 3-step presigned flow directly:\n * ensureFolderByPath -> initiateUpload -> HTTP PUT -> completeUpload\n * Display resolves a file id to a presigned URL via `getFileDownloadUrl`.\n *\n * NOTE: we deliberately do NOT use the Apollo-based `uploadBlobToFiles` /\n * `getWorkspaceClient()` helper here — this shell wires its data plane through\n * `graphqlFetch`, not a global Apollo client, so `getWorkspaceClient()` returns\n * an un-networked client and the upload silently no-ops. `graphqlFetch` is the\n * transport the whole MFE already uses successfully.\n */\n\nimport { useQuery } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useGovCitizenHub } from '../context/GovCitizenHubContext';\nimport { uploadVisibility, type UploadVisibility } from './uploadVisibility';\n\n/** One year — permit PDFs / document scans are long-lived references. */\nconst DOWNLOAD_URL_TTL_SECONDS = 31_536_000;\n\nexport const FILE_FOLDERS = {\n documents: '/GovCitizenHub/Documents',\n permits: '/GovCitizenHub/Permits',\n grievances: '/GovCitizenHub/Grievances',\n} as const;\n\nexport interface UploadedFile {\n id: string;\n url: string;\n name: string;\n}\n\n/** Thin wrapper over the workspace gateway using the MFE's proven transport. */\nasync function filesFetch<TData>(\n query: string,\n variables: Record<string, unknown>,\n runQuery: typeof graphqlFetch = graphqlFetch\n): Promise<TData> {\n const response = await runQuery<TData>({\n gateway: 'workspace',\n query,\n variables,\n workspaceToken: true,\n });\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'Files request failed');\n }\n if (!response.data) {\n throw new Error('Files response did not include data');\n }\n return response.data;\n}\n\nconst ENSURE_FOLDER = `\n mutation GovEnsureFolder($path: String!) {\n ensureFolderByPath(path: $path) { id }\n }\n`;\n\nconst INITIATE_UPLOAD = `\n mutation GovInitiateUpload($input: InitiateUploadInput!) {\n initiateUpload(input: $input) {\n uploadUrl\n session { id }\n }\n }\n`;\n\nconst COMPLETE_UPLOAD = `\n mutation GovCompleteUpload($input: CompleteUploadInput!) {\n completeUpload(input: $input) {\n fileId\n file { id name }\n }\n }\n`;\n\nconst GET_FILE_DOWNLOAD_URL = `\n query GovGetFileDownloadUrl($id: ID!, $expiresIn: Int) {\n getFileDownloadUrl(id: $id, expiresIn: $expiresIn)\n }\n`;\n\nfunction fileExtension(name: string, mimeType: string): string {\n const dot = name.lastIndexOf('.');\n if (dot > -1 && dot < name.length - 1) return name.slice(dot + 1).toLowerCase();\n const fromMime = mimeType.split('/')[1];\n return (fromMime ?? 'bin').toLowerCase();\n}\n\n/**\n * Upload a file to wspace-files-svc and return its id + a presigned URL. The\n * caller persists the id (e.g. via `govAddDocument({ fileId })`); the URL is used\n * for an immediate preview / download link.\n */\nexport async function uploadFileToFiles(\n file: File,\n folderPath: string,\n visibility?: UploadVisibility,\n runQuery: typeof graphqlFetch = graphqlFetch\n): Promise<UploadedFile> {\n const audience = uploadVisibility(visibility);\n // 1. Resolve (or create) the destination folder — File.folderId is a real FK.\n const folder = await filesFetch<{ ensureFolderByPath?: { id: string } | null }>(\n ENSURE_FOLDER,\n {\n path: folderPath,\n },\n runQuery\n );\n const folderId = folder.ensureFolderByPath?.id;\n if (!folderId) {\n throw new Error('Could not resolve the upload folder.');\n }\n\n const mimeType = file.type || 'application/octet-stream';\n const fileSize = file.size;\n\n // 2. Open a presigned upload session.\n const initiated = await filesFetch<{\n initiateUpload?: { uploadUrl?: string | null; session: { id: string } } | null;\n }>(\n INITIATE_UPLOAD,\n {\n input: {\n fileName: file.name,\n extension: fileExtension(file.name, mimeType),\n fileSize,\n mimeType,\n visibility: audience,\n folderId,\n },\n },\n runQuery\n );\n const uploadUrl = initiated.initiateUpload?.uploadUrl;\n const sessionId = initiated.initiateUpload?.session.id;\n if (!uploadUrl || !sessionId) {\n throw new Error('The files service did not return an upload URL.');\n }\n\n // 3. PUT the bytes straight to storage using the presigned URL. Content-Type\n // must match what was signed at initiateUpload.\n const putResponse = await fetch(uploadUrl, {\n method: 'PUT',\n body: file,\n headers: { 'Content-Type': mimeType },\n });\n if (!putResponse.ok) {\n throw new Error(`Upload to storage failed (${putResponse.status}).`);\n }\n\n // 4. Finalize — creates the File record. fileSize must match initiateUpload.\n const completed = await filesFetch<{\n completeUpload?: { fileId: string; file: { id: string; name: string } } | null;\n }>(\n COMPLETE_UPLOAD,\n {\n input: { sessionId, fileSize, folderId },\n },\n runQuery\n );\n const fileRecord = completed.completeUpload?.file;\n if (!fileRecord?.id) {\n throw new Error('The upload could not be finalized.');\n }\n\n // 5. Resolve a presigned URL for immediate preview/download (best-effort).\n let url: string;\n try {\n const urlData = await filesFetch<{ getFileDownloadUrl?: string | null }>(\n GET_FILE_DOWNLOAD_URL,\n {\n id: fileRecord.id,\n expiresIn: DOWNLOAD_URL_TTL_SECONDS,\n },\n runQuery\n );\n url = urlData.getFileDownloadUrl ?? '';\n } catch {\n url = '';\n }\n\n return { id: fileRecord.id, url, name: fileRecord.name };\n}\n\n/** Resolve a wspace-files-svc file id to a presigned download URL for display. */\nexport function useFileUrl(fileId?: string | null) {\n const { apiGatewayUrl } = useGovCitizenHub();\n return useQuery({\n queryKey: ['govcitizenhub', 'file-url', fileId ?? ''],\n enabled: Boolean(fileId),\n staleTime: 30 * 60 * 1000,\n retry: 1,\n queryFn: async () => {\n const response = await graphqlFetch<{ getFileDownloadUrl: string | null }>({\n gateway: 'workspace',\n baseUrl: apiGatewayUrl,\n workspaceToken: true,\n query: GET_FILE_DOWNLOAD_URL,\n variables: { id: fileId, expiresIn: DOWNLOAD_URL_TTL_SECONDS },\n });\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'Could not resolve file URL');\n }\n return response.data?.getFileDownloadUrl ?? null;\n },\n });\n}\n"],"mappings":";;;;;AAyBA,IAAMA,IAA2B,SAEpBC,IAAe;CAC1B,WAAW;CACX,SAA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gBP,EAAS;CACtC,CAAC;CACD,IAAI,CAACY,EAAY,IACf,MAAU,MAAM,6BAA6BA,EAAY,OAAO,GAAG;CAarE,IAAMC,KAAa,MATKxB,EAGtBM,GACA,EACE,OAAO;EAAE;EAAW;EAAU;CAAS,EACzC,GACAH,CACF,EAAA,CAC6B,gBAAgB;CAC7C,IAAI,CAACqB,GAAY,IACf,MAAU,MAAM,oCAAoC;CAItD,IAAIC;CACJ,IAAI;EASF,KAAM,MARgBzB,EACpBO,GACA;GACE,IAAIiB,EAAW;GACf,WAAW1B;EACb,GACAK,CACF,EAAA,CACc,sBAAsB;CACtC,QAAQ;EACN,IAAM;CACR;CAEA,OAAO;EAAE,IAAIqB,EAAW;EAAI;EAAK,MAAMA,EAAW;CAAK;AACzD;AAGA,SAAgBE,EAAW,GAAwB;CACjD,IAAM,EAAE,qBAAkBC,EAAiB;CAC3C,OAAOC,EAAS;EACd,UAAU;GAAC;GAAiB;GAAYC,KAAU;EAAE;EACpD,SAAS,EAAQA;EACjB,WAAW;EACX,OAAO;EACP,SAAS,YAAY;GACnB,IAAM3B,IAAW,MAAMD,EAAoD;IACzE,SAAS;IACT,SAAS6B;IACT,gBAAgB;IAChB,OAAOvB;IACP,WAAW;KAAE,IAAIsB;KAAQ,WAAW/B;IAAyB;GAC/D,CAAC;GACD,IAAII,EAAS,QAAQ,QACnB,MAAU,MAAMA,EAAS,OAAO,EAAE,EAAE,WAAW,4BAA4B;GAE7E,OAAOA,EAAS,MAAM,sBAAsB;EAC9C;CACF,CAAC;AACH"}
|
|
@@ -27,7 +27,7 @@ var x = 5, S = /* @__PURE__ */ new Set([
|
|
|
27
27
|
description: "Find a government service, apply, and follow your requests to a decision.",
|
|
28
28
|
actions: /* @__PURE__ */ v(y, {
|
|
29
29
|
onClick: () => C("services"),
|
|
30
|
-
children: [/* @__PURE__ */ _(p, { className: "
|
|
30
|
+
children: [/* @__PURE__ */ _(p, { className: "me-1.5 h-4 w-4" }), " Browse services"]
|
|
31
31
|
}),
|
|
32
32
|
children: T.isLoading || E.isLoading ? /* @__PURE__ */ v("div", {
|
|
33
33
|
className: "space-y-4",
|
|
@@ -104,14 +104,14 @@ var x = 5, S = /* @__PURE__ */ new Set([
|
|
|
104
104
|
description: "Find a service in the catalog and apply to see it tracked here.",
|
|
105
105
|
action: /* @__PURE__ */ v(y, {
|
|
106
106
|
onClick: () => C("services"),
|
|
107
|
-
children: [/* @__PURE__ */ _(g, { className: "
|
|
107
|
+
children: [/* @__PURE__ */ _(g, { className: "me-1.5 h-4 w-4" }), " Find a service"]
|
|
108
108
|
})
|
|
109
109
|
}) : /* @__PURE__ */ _("ul", {
|
|
110
110
|
className: "divide-y divide-border-subtle",
|
|
111
111
|
children: D.slice(0, x).map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("button", {
|
|
112
112
|
type: "button",
|
|
113
113
|
onClick: () => C(`applications/${e.id}`),
|
|
114
|
-
className: "flex w-full items-center justify-between gap-3 py-3 text-
|
|
114
|
+
className: "flex w-full items-center justify-between gap-3 py-3 text-start outline-none hover:bg-bg-sunken focus-visible:bg-bg-sunken",
|
|
115
115
|
children: [/* @__PURE__ */ v("span", {
|
|
116
116
|
className: "min-w-0",
|
|
117
117
|
children: [/* @__PURE__ */ _("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitizenHomePage.js","names":["RECENT","CLOSED_GRIEVANCE","CitizenHomePage","useGovCitizenHub","applications","useGovMyApplications","grievances","useGovMyGrievances","apps","useMemo","issues","needsAction","a","inProgress","isDecided","decided","openIssues","g","firstName","currentUser","PageLayout","Button","navigateTo","Briefcase","Skeleton","ErrorView","SummaryStrip","AlertTriangle","FileText","MessageSquare","SectionCard","app","EmptyState","Search","formatDate","StatusBadge"],"sources":["../../../src/govcitizenhub/pages/CitizenHomePage.tsx"],"sourcesContent":["/**\n * CitizenHomePage — the citizen's own start page (BOFF-4093, mock 18).\n * @module govcitizenhub/pages\n *\n * Built only from the caller's own records (`govMyApplications`,\n * `govMyGrievances`): what needs their attention, where their requests stand,\n * and the three things a citizen does here — find a service, track a request,\n * report an issue. Nothing on this page reads agency-wide data.\n */\n\nimport { useMemo, type FC } from 'react';\nimport { AlertTriangle, Briefcase, FileText, MessageSquare, Search } from 'lucide-react';\nimport { Button, Skeleton } from '@burdenoff/fe-libs/ui';\n\nimport { PageLayout } from '../components/PageLayout';\nimport { SectionCard } from '../components/SectionCard';\nimport { SummaryStrip } from '../components/SummaryStrip';\nimport { StatusBadge } from '../components/StatusBadge';\nimport { EmptyState } from '../components/EmptyState';\nimport { ErrorView } from '../components/StateViews';\nimport { useGovMyApplications, useGovMyGrievances } from '../hooks';\nimport { useGovCitizenHub } from '../context';\nimport { formatDate } from '../utils/formatters';\nimport { isDecided } from '../utils/applicationLifecycle';\n\nconst RECENT = 5;\nconst CLOSED_GRIEVANCE = new Set(['RESOLVED', 'REJECTED', 'CLOSED']);\n\nexport const CitizenHomePage: FC = () => {\n const { navigateTo, currentUser } = useGovCitizenHub();\n const applications = useGovMyApplications({ limit: 50 });\n const grievances = useGovMyGrievances({ limit: 50 });\n\n const apps = useMemo(() => applications.data?.items ?? [], [applications.data]);\n const issues = useMemo(() => grievances.data?.items ?? [], [grievances.data]);\n const needsAction = apps.filter((a) => a.status === 'INFO_REQUESTED');\n const inProgress = apps.filter((a) => a.status !== 'DRAFT' && !isDecided(a.status)).length;\n const decided = apps.filter((a) => isDecided(a.status)).length;\n const openIssues = issues.filter((g) => !CLOSED_GRIEVANCE.has(g.status)).length;\n const firstName = currentUser?.firstName ?? currentUser?.name?.split(' ')[0];\n\n return (\n <PageLayout\n title={firstName ? `Welcome back, ${firstName}` : 'Welcome'}\n titleGradient\n description=\"Find a government service, apply, and follow your requests to a decision.\"\n actions={\n <Button onClick={() => navigateTo('services')}>\n <Briefcase className=\"mr-1.5 h-4 w-4\" /> Browse services\n </Button>\n }\n >\n {applications.isLoading || grievances.isLoading ? (\n <div className=\"space-y-4\">\n <Skeleton className=\"h-24 w-full rounded-card\" />\n <Skeleton className=\"h-56 w-full rounded-card\" />\n </div>\n ) : applications.isError || grievances.isError ? (\n <ErrorView\n message=\"We couldn't load your requests.\"\n onRetry={() => {\n void applications.refetch();\n void grievances.refetch();\n }}\n />\n ) : (\n <div className=\"space-y-6\">\n <SummaryStrip\n stats={[\n {\n label: 'Action needed',\n value: needsAction.length,\n tone: needsAction.length > 0 ? 'warning' : 'default',\n icon: <AlertTriangle />,\n },\n { label: 'In progress', value: inProgress, tone: 'accent', icon: <FileText /> },\n { label: 'Decided', value: decided, tone: 'success', icon: <FileText /> },\n { label: 'Open grievances', value: openIssues, icon: <MessageSquare /> },\n ]}\n />\n\n {needsAction.length > 0 && (\n <SectionCard title=\"Needs your attention\" icon={<AlertTriangle />}>\n <ul className=\"divide-y divide-border-subtle\">\n {needsAction.map((app) => (\n <li\n key={app.id}\n className=\"flex flex-wrap items-center justify-between gap-3 py-3\"\n >\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium text-text-primary\">{app.reference}</p>\n <p className=\"text-xs text-text-muted\">\n The agency asked for more information.\n </p>\n </div>\n <Button size=\"sm\" onClick={() => navigateTo(`applications/${app.id}`)}>\n Respond\n </Button>\n </li>\n ))}\n </ul>\n </SectionCard>\n )}\n\n <SectionCard\n title=\"Recent requests\"\n icon={<FileText />}\n actions={\n apps.length > RECENT ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={() => navigateTo('applications')}>\n View all\n </Button>\n ) : undefined\n }\n >\n {apps.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title=\"No requests yet\"\n description=\"Find a service in the catalog and apply to see it tracked here.\"\n action={\n <Button onClick={() => navigateTo('services')}>\n <Search className=\"mr-1.5 h-4 w-4\" /> Find a service\n </Button>\n }\n />\n ) : (\n <ul className=\"divide-y divide-border-subtle\">\n {apps.slice(0, RECENT).map((app) => (\n <li key={app.id}>\n <button\n type=\"button\"\n onClick={() => navigateTo(`applications/${app.id}`)}\n className=\"flex w-full items-center justify-between gap-3 py-3 text-left outline-none hover:bg-bg-sunken focus-visible:bg-bg-sunken\"\n >\n <span className=\"min-w-0\">\n <span className=\"block truncate font-medium text-text-primary\">\n {app.reference}\n </span>\n <span className=\"text-xs text-text-muted\">\n Filed {formatDate(app.createdAt)}\n </span>\n </span>\n <StatusBadge status={app.status} />\n </button>\n </li>\n ))}\n </ul>\n )}\n </SectionCard>\n </div>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,IAAMA,IAAS,GACTC,oBAAmB,IAAI,IAAI;CAAC;CAAY;CAAY;AAAQ,CAAC,GAEtDC,UAA4B;CACvC,IAAM,EAAE,eAAY,mBAAgBC,EAAiB,GAC/CC,IAAeC,EAAqB,EAAE,OAAO,GAAG,CAAC,GACjDC,IAAaC,EAAmB,EAAE,OAAO,GAAG,CAAC,GAE7CC,IAAOC,QAAcL,EAAa,MAAM,SAAS,CAAC,GAAG,CAACA,EAAa,IAAI,CAAC,GACxEM,IAASD,QAAcH,EAAW,MAAM,SAAS,CAAC,GAAG,CAACA,EAAW,IAAI,CAAC,GACtEK,IAAcH,EAAK,QAAQ,MAAMI,EAAE,WAAW,gBAAgB,GAC9DC,IAAaL,EAAK,QAAQ,MAAMI,EAAE,WAAW,WAAW,CAACE,EAAUF,EAAE,MAAM,CAAC,CAAC,CAAC,QAC9EG,IAAUP,EAAK,QAAQ,MAAMM,EAAUF,EAAE,MAAM,CAAC,CAAC,CAAC,QAClDI,IAAaN,EAAO,QAAQ,MAAM,CAACT,EAAiB,IAAIgB,EAAE,MAAM,CAAC,CAAC,CAAC,QACnEC,IAAYC,GAAa,aAAaA,GAAa,MAAM,MAAM,GAAG,CAAC,CAAC;CAE1E,OACE,kBAACC,GAAD;EACE,OAAOF,IAAY,iBAAiBA,MAAc;EAClD,eAAA;EACA,aAAY;EACZ,SACE,kBAACG,GAAD;GAAQ,eAAeC,EAAW,UAAU;GAA5C,UAAA,CACE,kBAACC,GAAD,EAAW,WAAU,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AAeC,EAAW,gBAAgBS,EAAI,IAAI;QAAG,UAAA;OAE/D,CAAA,CACN;MAZG,GAAAA,EAAI,EAYP,CACL;KACC,CAAA;IACO,CAAA;IAGf,kBAACD,GAAD;KACE,OAAM;KACN,MAAM,kBAACF,GAAD,CAAW,CAAA;KACjB,SACEpB,EAAK,SAASR,IACZ,kBAACqB,GAAD;MAAQ,MAAK;MAAK,SAAQ;MAAQ,eAAeC,EAAW,cAAc;MAAG,UAAA;KAErE,CAAA,IACN,KAAA;KAGL,UAAAd,EAAK,WAAW,IACf,kBAACwB,GAAD;MACE,cAAa;MACb,OAAM;MACN,aAAY;MACZ,QACE,kBAACX,GAAD;OAAQ,eAAeC,EAAW,UAAU;OAA5C,UAAA,CACE,kBAACW,GAAD,EAAQ,WAAU,iBAAkB,CAAA,GAAC,iBAC/B;;KAEX,CAAA,IAED,kBAAC,MAAD;MAAI,WAAU;MACX,UAAAzB,EAAK,MAAM,GAAGR,CAAM,CAAC,CAAC,KAAK,MAC1B,kBAAC,MAAD,EAAA,UACE,kBAAC,UAAD;OACE,MAAK;OACL,eAAesB,EAAW,gBAAgBS,EAAI,IAAI;OAClD,WAAU;OAHZ,UAAA,CAKE,kBAAC,QAAD;QAAM,WAAU;QAAhB,UAAA,CACE,kBAAC,QAAD;SAAM,WAAU;SACb,UAAAA,EAAI;QACD,CAAA,GACN,kBAAC,QAAD;SAAM,WAAU;SAAhB,UAAA,CAA0C,UACjCG,EAAWH,EAAI,SAAS,CAC3B;QACF,CAAA,CAAA;OACN,CAAA,GAAA,kBAACI,GAAD,EAAa,QAAQJ,EAAI,OAAS,CAAA,CAC5B;MACN,CAAA,EAAA,GAhBKA,EAAI,EAgBT,CACL;KACC,CAAA;IAEK,CAAA;GACV;;CAEG,CAAA;AAEhB"}
|
|
1
|
+
{"version":3,"file":"CitizenHomePage.js","names":["EmptyState","EmptyState$1","RECENT","CLOSED_GRIEVANCE","CitizenHomePage","useGovCitizenHub","applications","useGovMyApplications","grievances","useGovMyGrievances","apps","useMemo","issues","needsAction","a","inProgress","isDecided","decided","openIssues","g","firstName","currentUser","PageLayout","Button","navigateTo","Briefcase","Skeleton","ErrorView","SummaryStrip","AlertTriangle","FileText","MessageSquare","SectionCard","app","Search","formatDate","StatusBadge"],"sources":["../../../src/govcitizenhub/pages/CitizenHomePage.tsx"],"sourcesContent":["/**\n * CitizenHomePage — the citizen's own start page (BOFF-4093, mock 18).\n * @module govcitizenhub/pages\n *\n * Built only from the caller's own records (`govMyApplications`,\n * `govMyGrievances`): what needs their attention, where their requests stand,\n * and the three things a citizen does here — find a service, track a request,\n * report an issue. Nothing on this page reads agency-wide data.\n */\n\nimport { useMemo, type FC } from 'react';\nimport { AlertTriangle, Briefcase, FileText, MessageSquare, Search } from 'lucide-react';\nimport { Button, Skeleton } from '@burdenoff/fe-libs/ui';\n\nimport { PageLayout } from '../components/PageLayout';\nimport { SectionCard } from '../components/SectionCard';\nimport { SummaryStrip } from '../components/SummaryStrip';\nimport { StatusBadge } from '../components/StatusBadge';\nimport { EmptyState } from '../components/EmptyState';\nimport { ErrorView } from '../components/StateViews';\nimport { useGovMyApplications, useGovMyGrievances } from '../hooks';\nimport { useGovCitizenHub } from '../context';\nimport { formatDate } from '../utils/formatters';\nimport { isDecided } from '../utils/applicationLifecycle';\n\nconst RECENT = 5;\nconst CLOSED_GRIEVANCE = new Set(['RESOLVED', 'REJECTED', 'CLOSED']);\n\nexport const CitizenHomePage: FC = () => {\n const { navigateTo, currentUser } = useGovCitizenHub();\n const applications = useGovMyApplications({ limit: 50 });\n const grievances = useGovMyGrievances({ limit: 50 });\n\n const apps = useMemo(() => applications.data?.items ?? [], [applications.data]);\n const issues = useMemo(() => grievances.data?.items ?? [], [grievances.data]);\n const needsAction = apps.filter((a) => a.status === 'INFO_REQUESTED');\n const inProgress = apps.filter((a) => a.status !== 'DRAFT' && !isDecided(a.status)).length;\n const decided = apps.filter((a) => isDecided(a.status)).length;\n const openIssues = issues.filter((g) => !CLOSED_GRIEVANCE.has(g.status)).length;\n const firstName = currentUser?.firstName ?? currentUser?.name?.split(' ')[0];\n\n return (\n <PageLayout\n title={firstName ? `Welcome back, ${firstName}` : 'Welcome'}\n titleGradient\n description=\"Find a government service, apply, and follow your requests to a decision.\"\n actions={\n <Button onClick={() => navigateTo('services')}>\n <Briefcase className=\"me-1.5 h-4 w-4\" /> Browse services\n </Button>\n }\n >\n {applications.isLoading || grievances.isLoading ? (\n <div className=\"space-y-4\">\n <Skeleton className=\"h-24 w-full rounded-card\" />\n <Skeleton className=\"h-56 w-full rounded-card\" />\n </div>\n ) : applications.isError || grievances.isError ? (\n <ErrorView\n message=\"We couldn't load your requests.\"\n onRetry={() => {\n void applications.refetch();\n void grievances.refetch();\n }}\n />\n ) : (\n <div className=\"space-y-6\">\n <SummaryStrip\n stats={[\n {\n label: 'Action needed',\n value: needsAction.length,\n tone: needsAction.length > 0 ? 'warning' : 'default',\n icon: <AlertTriangle />,\n },\n { label: 'In progress', value: inProgress, tone: 'accent', icon: <FileText /> },\n { label: 'Decided', value: decided, tone: 'success', icon: <FileText /> },\n { label: 'Open grievances', value: openIssues, icon: <MessageSquare /> },\n ]}\n />\n\n {needsAction.length > 0 && (\n <SectionCard title=\"Needs your attention\" icon={<AlertTriangle />}>\n <ul className=\"divide-y divide-border-subtle\">\n {needsAction.map((app) => (\n <li\n key={app.id}\n className=\"flex flex-wrap items-center justify-between gap-3 py-3\"\n >\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium text-text-primary\">{app.reference}</p>\n <p className=\"text-xs text-text-muted\">\n The agency asked for more information.\n </p>\n </div>\n <Button size=\"sm\" onClick={() => navigateTo(`applications/${app.id}`)}>\n Respond\n </Button>\n </li>\n ))}\n </ul>\n </SectionCard>\n )}\n\n <SectionCard\n title=\"Recent requests\"\n icon={<FileText />}\n actions={\n apps.length > RECENT ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={() => navigateTo('applications')}>\n View all\n </Button>\n ) : undefined\n }\n >\n {apps.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n title=\"No requests yet\"\n description=\"Find a service in the catalog and apply to see it tracked here.\"\n action={\n <Button onClick={() => navigateTo('services')}>\n <Search className=\"me-1.5 h-4 w-4\" /> Find a service\n </Button>\n }\n />\n ) : (\n <ul className=\"divide-y divide-border-subtle\">\n {apps.slice(0, RECENT).map((app) => (\n <li key={app.id}>\n <button\n type=\"button\"\n onClick={() => navigateTo(`applications/${app.id}`)}\n className=\"flex w-full items-center justify-between gap-3 py-3 text-start outline-none hover:bg-bg-sunken focus-visible:bg-bg-sunken\"\n >\n <span className=\"min-w-0\">\n <span className=\"block truncate font-medium text-text-primary\">\n {app.reference}\n </span>\n <span className=\"text-xs text-text-muted\">\n Filed {formatDate(app.createdAt)}\n </span>\n </span>\n <StatusBadge status={app.status} />\n </button>\n </li>\n ))}\n </ul>\n )}\n </SectionCard>\n </div>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,IAAME,IAAS,GACTC,oBAAmB,IAAI,IAAI;CAAC;CAAY;CAAY;AAAQ,CAAC,GAEtDC,UAA4B;CACvC,IAAM,EAAE,eAAY,mBAAgBC,EAAiB,GAC/CC,IAAeC,EAAqB,EAAE,OAAO,GAAG,CAAC,GACjDC,IAAaC,EAAmB,EAAE,OAAO,GAAG,CAAC,GAE7CC,IAAOC,QAAcL,EAAa,MAAM,SAAS,CAAC,GAAG,CAACA,EAAa,IAAI,CAAC,GACxEM,IAASD,QAAcH,EAAW,MAAM,SAAS,CAAC,GAAG,CAACA,EAAW,IAAI,CAAC,GACtEK,IAAcH,EAAK,QAAQ,MAAMI,EAAE,WAAW,gBAAgB,GAC9DC,IAAaL,EAAK,QAAQ,MAAMI,EAAE,WAAW,WAAW,CAACE,EAAUF,EAAE,MAAM,CAAC,CAAC,CAAC,QAC9EG,IAAUP,EAAK,QAAQ,MAAMM,EAAUF,EAAE,MAAM,CAAC,CAAC,CAAC,QAClDI,IAAaN,EAAO,Q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CAAA,CAAA;OACN,CAAA,GAAA,kBAACG,GAAD,EAAa,QAAQH,EAAI,OAAS,CAAA,CAC5B;MACN,CAAA,EAAA,GAhBKA,EAAI,EAgBT,CACL;KACC,CAAA;IAEK,CAAA;GACV;;CAEG,CAAA;AAEhB"}
|
|
@@ -238,7 +238,7 @@ function D() {
|
|
|
238
238
|
return /* @__PURE__ */ y("li", { children: /* @__PURE__ */ b("button", {
|
|
239
239
|
type: "button",
|
|
240
240
|
onClick: () => w(`services/${e.serviceId}`),
|
|
241
|
-
className: "flex w-full items-center gap-3 rounded-button text-
|
|
241
|
+
className: "flex w-full items-center gap-3 rounded-button text-start outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-focus-ring)]",
|
|
242
242
|
children: [
|
|
243
243
|
/* @__PURE__ */ y("span", {
|
|
244
244
|
className: "w-40 shrink-0 truncate text-sm font-medium text-text-primary",
|
|
@@ -252,7 +252,7 @@ function D() {
|
|
|
252
252
|
})
|
|
253
253
|
}),
|
|
254
254
|
/* @__PURE__ */ y("span", {
|
|
255
|
-
className: "w-10 shrink-0 text-
|
|
255
|
+
className: "w-10 shrink-0 text-end text-sm font-semibold tabular-nums text-text-primary",
|
|
256
256
|
children: p(e.count)
|
|
257
257
|
})
|
|
258
258
|
]
|
|
@@ -291,7 +291,7 @@ function D() {
|
|
|
291
291
|
Se,
|
|
292
292
|
"%",
|
|
293
293
|
/* @__PURE__ */ y("span", {
|
|
294
|
-
className: "
|
|
294
|
+
className: "ms-2 text-sm font-normal text-text-muted",
|
|
295
295
|
children: O("govcitizenhub.withinSla", "within SLA")
|
|
296
296
|
})
|
|
297
297
|
]
|
|
@@ -376,12 +376,12 @@ function D() {
|
|
|
376
376
|
})
|
|
377
377
|
}),
|
|
378
378
|
/* @__PURE__ */ y("span", {
|
|
379
|
-
className: "w-10 shrink-0 text-
|
|
379
|
+
className: "w-10 shrink-0 text-end text-sm font-semibold tabular-nums text-text-primary",
|
|
380
380
|
children: p(e.total)
|
|
381
381
|
})
|
|
382
382
|
]
|
|
383
383
|
}), /* @__PURE__ */ y("p", {
|
|
384
|
-
className: "mt-0.5
|
|
384
|
+
className: "mt-0.5 ps-[8.75rem] text-xs text-text-muted",
|
|
385
385
|
children: e.isSuppressed ? O("govcitizenhub.slaSuppressed", "SLA % withheld — small sample (under {{count}} active)", { count: 5 }) : O("govcitizenhub.deskSlaPercent", "{{percent}}% within SLA", { percent: Math.round(e.compliancePercent ?? 0) })
|
|
386
386
|
})] }, e.assignedToId ?? "unassigned");
|
|
387
387
|
})
|
|
@@ -428,12 +428,12 @@ function D() {
|
|
|
428
428
|
})
|
|
429
429
|
}),
|
|
430
430
|
/* @__PURE__ */ y("span", {
|
|
431
|
-
className: "w-10 shrink-0 text-
|
|
431
|
+
className: "w-10 shrink-0 text-end text-sm font-semibold tabular-nums text-text-primary",
|
|
432
432
|
children: p(e.total)
|
|
433
433
|
})
|
|
434
434
|
]
|
|
435
435
|
}), /* @__PURE__ */ y("p", {
|
|
436
|
-
className: "mt-0.5
|
|
436
|
+
className: "mt-0.5 ps-[8.75rem] text-xs text-text-muted",
|
|
437
437
|
children: e.isSuppressed ? O("govcitizenhub.slaSuppressed", "SLA % withheld — small sample (under {{count}} active)", { count: 5 }) : O("govcitizenhub.deskSlaPercent", "{{percent}}% within SLA", { percent: Math.round(e.compliancePercent ?? 0) })
|
|
438
438
|
})] }, e.regionId ?? e.regionName);
|
|
439
439
|
})
|
|
@@ -476,13 +476,13 @@ function D() {
|
|
|
476
476
|
}) : /* @__PURE__ */ y("div", {
|
|
477
477
|
className: "overflow-x-auto",
|
|
478
478
|
children: /* @__PURE__ */ b("table", {
|
|
479
|
-
className: "w-full min-w-[34rem] border-collapse text-
|
|
479
|
+
className: "w-full min-w-[34rem] border-collapse text-start",
|
|
480
480
|
children: [/* @__PURE__ */ y("thead", { children: /* @__PURE__ */ b("tr", {
|
|
481
481
|
className: "border-b border-border-seam text-xs font-medium uppercase tracking-wide text-text-muted",
|
|
482
482
|
children: [
|
|
483
483
|
/* @__PURE__ */ y("th", {
|
|
484
484
|
scope: "col",
|
|
485
|
-
className: "py-2.5
|
|
485
|
+
className: "py-2.5 pe-3 font-medium",
|
|
486
486
|
children: O("govcitizenhub.referenceNo", "Reference No.")
|
|
487
487
|
}),
|
|
488
488
|
/* @__PURE__ */ y("th", {
|
|
@@ -517,7 +517,7 @@ function D() {
|
|
|
517
517
|
className: "group cursor-pointer border-b border-border-subtle outline-none transition-colors last:border-0 hover:bg-bg-sunken/60 focus-visible:bg-bg-sunken/60",
|
|
518
518
|
children: [
|
|
519
519
|
/* @__PURE__ */ y("td", {
|
|
520
|
-
className: "py-3
|
|
520
|
+
className: "py-3 pe-3",
|
|
521
521
|
children: /* @__PURE__ */ b("span", {
|
|
522
522
|
className: "flex items-center gap-2.5",
|
|
523
523
|
children: [/* @__PURE__ */ y("span", {
|
|
@@ -542,7 +542,7 @@ function D() {
|
|
|
542
542
|
children: ae(e.submittedAt ?? e.createdAt)
|
|
543
543
|
}),
|
|
544
544
|
/* @__PURE__ */ y("td", {
|
|
545
|
-
className: "
|
|
545
|
+
className: "pe-1",
|
|
546
546
|
children: /* @__PURE__ */ y(h, { className: "h-4 w-4 text-text-muted transition-transform group-hover:translate-x-0.5" })
|
|
547
547
|
})
|
|
548
548
|
]
|