@easygov/web-components 0.4.0 → 0.6.0

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/header.js CHANGED
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-XA367GUU.js";import{a as o,b as r}from"./chunk-4YTFOHWE.js";import"./chunk-O3IXHDLE.js";var m=r(o(e,{shadow:"open"}));customElements.define("eg-easygov-header",m);
1
+ import{e}from"./chunk-C75LXA3C.js";import{a as o,b as r}from"./chunk-6QWPHBPC.js";import"./chunk-KIC76O54.js";var m=r(o(e,{shadow:"open"}));customElements.define("eg-easygov-header",m);
2
2
  //# sourceMappingURL=header.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,150 @@
1
+ type ManagementRoleType = 'SUPER_AGENT' | 'AGENT';
2
+ /** Verification level of a customer account's identity. */
3
+ type AccountVerificationStatus = 'NOT_VERIFIED' | 'VERIFIED';
4
+ /**
5
+ * Verification of a management-role grant. Same values as `AccountVerificationStatus` today, but
6
+ * a separate type deliberately: it verifies a different thing (the grant, not the identity) and
7
+ * the two are free to diverge on the wire.
8
+ */
9
+ type ManagementRoleStatus = 'NOT_VERIFIED' | 'VERIFIED';
10
+ type ProcessStatus = 'PRELIMINARY' | 'REQUEST_IN_PROGRESS' | 'REQUEST_COMPLETED' | 'SERVICE_PROVISION_PENDING' | 'FINISHED' | 'CANCELED';
11
+ /** An Agent's permission level on one ServiceApp (Leistungsberechtigung). */
12
+ type PermissionLevel = 'READ_ONLY' | 'EDIT' | 'AUTHORIZE';
13
+ /**
14
+ * An Agent's ServicePermission for the current ServiceApp. Decoded from the context JWT, signature
15
+ * unverified: safe to render, never to authorize.
16
+ */
17
+ interface ServicePermission {
18
+ /** Always the current ServiceApp's id (`HeaderContextClaims.serviceApp.id`). */
19
+ serviceAppId: string;
20
+ permissionLevel: PermissionLevel;
21
+ }
22
+ /**
23
+ * The caller's management role on the selected account: SUPER_AGENT (Kontoverwalter/in,
24
+ * unrestricted) or AGENT (Mitwirkende/r, restricted by per-service permissions).
25
+ * @see HeaderContextClaims for unverified-claims boundary; roleType and status must not drive authorization.
26
+ */
27
+ interface ManagementRole {
28
+ roleType: ManagementRoleType;
29
+ /** Only present for SUPER_AGENT. */
30
+ status?: ManagementRoleStatus;
31
+ /**
32
+ * Only for an AGENT, and only for the current ServiceApp. Absent for a SUPER_AGENT, on a screen
33
+ * without a current ServiceApp, for an app with the individual permission model (the fach module
34
+ * manages those rights), and when the Agent holds no permission on the app. Absent never means
35
+ * "allowed".
36
+ */
37
+ servicePermission?: ServicePermission;
38
+ }
39
+ interface CustomerAccountBase {
40
+ id: string;
41
+ label: string;
42
+ status: AccountVerificationStatus;
43
+ managementRole: ManagementRole;
44
+ }
45
+ /**
46
+ * A customer account of type ORGANIZATION. Decoded from the context JWT, signature unverified: safe to render, never to authorize.
47
+ */
48
+ interface OrganizationAccount extends CustomerAccountBase {
49
+ accountType: 'ORGANIZATION';
50
+ legalForm: string;
51
+ /** Absent while the organization has no UID register entry. */
52
+ uid?: string;
53
+ }
54
+ /**
55
+ * A customer account of type INDIVIDUAL. Decoded from the context JWT, signature unverified: safe to render, never to authorize.
56
+ */
57
+ interface IndividualAccount extends CustomerAccountBase {
58
+ accountType: 'INDIVIDUAL';
59
+ }
60
+ /**
61
+ * Discriminated on `accountType` — narrow before reading organization-only fields.
62
+ * Decoded from the context JWT, signature unverified: safe to render, never to authorize.
63
+ */
64
+ type SelectedCustomerAccount = OrganizationAccount | IndividualAccount;
65
+ /**
66
+ * The ServiceApp the current screen belongs to, resolved by core from the screen URL.
67
+ * Decoded from the context JWT, signature unverified: safe to render, never to authorize.
68
+ */
69
+ interface ServiceApp {
70
+ id: string;
71
+ /** The fach module, not core, manages the Agents' rights for this ServiceApp. */
72
+ individualServicePermissionModel: boolean;
73
+ }
74
+ /**
75
+ * The selected Behördengang. Its ServiceApp is a reference only; on a screen of that ServiceApp
76
+ * it equals `HeaderContextClaims.serviceApp.id`.
77
+ * Decoded from the context JWT, signature unverified: safe to render, never to authorize.
78
+ */
79
+ interface SelectedProcess {
80
+ id: string;
81
+ status: ProcessStatus;
82
+ serviceAppId: string;
83
+ /**
84
+ * Global identifier of this process's own parent. Absent for a top-level Behördengang. This
85
+ * reference is the only representation of a selected process's parent: the context carries no
86
+ * ancestor chain.
87
+ */
88
+ parentProcessId?: string;
89
+ }
90
+ /**
91
+ * The authenticated user's identity and profile information.
92
+ * Decoded from the context JWT, signature unverified: safe to render, never to authorize.
93
+ */
94
+ interface UserProfile {
95
+ id: string;
96
+ eiamIdentity: string;
97
+ eiamSSOsessionID: string;
98
+ qoA: number;
99
+ emailAddress?: string;
100
+ firstName?: string;
101
+ lastName?: string;
102
+ roles?: string[];
103
+ }
104
+ /**
105
+ * Decoded payload of `contextJwt`. The signature is NOT verified by EasygovHeader — the
106
+ * authenticated HTTPS fetch to core-backend is the trust boundary. Safe for prefilling forms and
107
+ * rendering decisions; never for authorization. A backend receiving this JWT MUST verify it
108
+ * against core-backend's published JWKS.
109
+ */
110
+ interface HeaderContextClaims {
111
+ currentUser: UserProfile;
112
+ customerAccount?: SelectedCustomerAccount;
113
+ /**
114
+ * The ServiceApp the current screen belongs to. Absent on core and info pages and on a URL that
115
+ * matches no registered ServiceApp.
116
+ */
117
+ serviceApp?: ServiceApp;
118
+ /**
119
+ * The Behördengang the URL selects (`/process/{id}`). Mutually exclusive with `parentProcessId`.
120
+ */
121
+ process?: SelectedProcess;
122
+ /**
123
+ * The Behördengang a sub-process is about to be created under (`/parentprocess/{id}`), by id
124
+ * only. Mutually exclusive with `process`. A selected process's own parent is
125
+ * `process.parentProcessId`.
126
+ */
127
+ parentProcessId?: string;
128
+ }
129
+ /**
130
+ * `detail` of the `contextchange` CustomEvent. The event fires for every new JWT, which includes
131
+ * the background refresh that renews it shortly before it expires; `contentChanged` says whether
132
+ * `claims` differs from what the previous event delivered.
133
+ */
134
+ interface HeaderContextChangeDetail {
135
+ contextJwt: string;
136
+ claims: HeaderContextClaims;
137
+ /**
138
+ * `true` for the first context of a session and whenever `claims` differs from the previous
139
+ * event's. `false` for a refresh that only renewed the token: prefilling a form from `claims`
140
+ * on such an event would overwrite what the user has typed since.
141
+ */
142
+ contentChanged: boolean;
143
+ }
144
+
1
145
  declare function getDisplayLanguage(): string;
2
146
  declare function setDisplayLanguage(locale: string): void;
3
147
  declare function subscribeDisplayLanguage(listener: () => void): () => void;
4
148
  declare function setBusinessModuleVersion(version: string): void;
5
149
 
6
- export { getDisplayLanguage, setBusinessModuleVersion, setDisplayLanguage, subscribeDisplayLanguage };
150
+ export { type HeaderContextChangeDetail, getDisplayLanguage, setBusinessModuleVersion, setDisplayLanguage, subscribeDisplayLanguage };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as e,b as a,c as i,d as g}from"./chunk-XA367GUU.js";import"./chunk-O3IXHDLE.js";function o(){return a()}function t(s){i(s)}function r(s){return g(s)}function u(s){e(s)}export{o as getDisplayLanguage,u as setBusinessModuleVersion,t as setDisplayLanguage,r as subscribeDisplayLanguage};
1
+ import{a as s,b as a,c as t,d as o}from"./chunk-C75LXA3C.js";import"./chunk-KIC76O54.js";function i(){return a()}function g(e){t(e)}function r(e){return o(e)}function u(e){s(e)}export{i as getDisplayLanguage,u as setBusinessModuleVersion,g as setDisplayLanguage,r as subscribeDisplayLanguage};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// No side-effecting element registration here. Consumers that need\n// <eg-easygov-header>/<eg-easygov-footer> registered import '@easygov/web-components/header'\n// and/or '@easygov/web-components/footer' directly, so an app using only one element doesn't\n// pull in the other.\n//\n// This entry exposes only the DisplayLanguage API (wrapped in local functions, not re-exported\n// directly) — deliberately not the raw React components (EasygovHeader/EasygovFooter) either.\n// @easygov/react-components' exports point at its JSX .tsx source (see CLAUDE.md), so any live\n// `from '@easygov/react-components'` type specifier here — a component re-export or a bare\n// `export { ... } from` for these functions — would force every consumer's compiler to resolve\n// that source, breaking non-React/non-JSX consumers like Angular. Wrapping locally keeps the\n// emitted .d.ts self-contained; `locale` is widened to `string` for the same reason, decoupling\n// our public types from react-components' internal `Locale` union. A React app that wants the\n// component directly should depend on @easygov/react-components itself.\n//\n// This bundle inlines its own copy of @easygov/react-components, so a web-component consumer\n// that separately npm-imported @easygov/react-components directly would be talking to a\n// *different* store instance — this package's own export is the supported surface here.\nimport {\n getEasygovDisplayLanguage,\n setEasygovDisplayLanguage,\n setEasygovBusinessModuleVersion,\n subscribeEasygovDisplayLanguage,\n} from '@easygov/react-components';\n\nexport function getDisplayLanguage(): string {\n return getEasygovDisplayLanguage();\n}\n\n// No runtime validation here, matching setEasygovDisplayLanguage itself (it writes the cookie\n// unconditionally with no isSupportedLocale check) and this package's previous public contract\n// (the CDN global's setDisplayLanguage(locale: string) was equally unchecked). isSupportedLocale\n// is not part of @easygov/react-components' public exports, so this package has no way to guard\n// the value before the cast even if it wanted to; an invalid locale ends up handled the same way\n// t() already handles one — falling back to \"en\"/the raw key — not a new failure mode.\nexport function setDisplayLanguage(locale: string): void {\n setEasygovDisplayLanguage(locale as Parameters<typeof setEasygovDisplayLanguage>[0]);\n}\n\nexport function subscribeDisplayLanguage(listener: () => void): () => void {\n return subscribeEasygovDisplayLanguage(listener);\n}\n\nexport function setBusinessModuleVersion(version: string): void {\n setEasygovBusinessModuleVersion(version);\n}\n"],"mappings":"yFAyBO,SAASA,GAA6B,CAC3C,OAAOC,EAA0B,CACnC,CAQO,SAASC,EAAmBC,EAAsB,CACvDC,EAA0BD,CAAyD,CACrF,CAEO,SAASE,EAAyBC,EAAkC,CACzE,OAAOC,EAAgCD,CAAQ,CACjD,CAEO,SAASE,EAAyBC,EAAuB,CAC9DC,EAAgCD,CAAO,CACzC","names":["getDisplayLanguage","getEasygovDisplayLanguage","setDisplayLanguage","locale","setEasygovDisplayLanguage","subscribeDisplayLanguage","listener","subscribeEasygovDisplayLanguage","setBusinessModuleVersion","version","setEasygovBusinessModuleVersion"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// No side-effecting element registration here. Consumers that need\n// <eg-easygov-header>/<eg-easygov-footer> registered import '@easygov/web-components/header'\n// and/or '@easygov/web-components/footer' directly, so an app using only one element doesn't\n// pull in the other.\n//\n// This entry exposes only the DisplayLanguage API (wrapped in local functions, not re-exported\n// directly) — deliberately not the raw React components (EasygovHeader/EasygovFooter) either.\n// @easygov/react-components' exports point at its JSX .tsx source (see CLAUDE.md), so any live\n// `from '@easygov/react-components'` type specifier here — a component re-export or a bare\n// `export { ... } from` for these functions — would force every consumer's compiler to resolve\n// that source, breaking non-React/non-JSX consumers like Angular. Wrapping locally keeps the\n// emitted .d.ts self-contained; `locale` is widened to `string` for the same reason, decoupling\n// our public types from react-components' internal `Locale` union. A React app that wants the\n// component directly should depend on @easygov/react-components itself.\n//\n// This bundle inlines its own copy of @easygov/react-components, so a web-component consumer\n// that separately npm-imported @easygov/react-components directly would be talking to a\n// *different* store instance — this package's own export is the supported surface here.\nimport {\n getEasygovDisplayLanguage,\n setEasygovDisplayLanguage,\n setEasygovBusinessModuleVersion,\n subscribeEasygovDisplayLanguage,\n} from '@easygov/react-components';\n\nexport function getDisplayLanguage(): string {\n return getEasygovDisplayLanguage();\n}\n\n// No runtime validation here, matching setEasygovDisplayLanguage itself (it writes the cookie\n// unconditionally with no isSupportedLocale check) and this package's previous public contract\n// (the CDN global's setDisplayLanguage(locale: string) was equally unchecked). isSupportedLocale\n// is not part of @easygov/react-components' public exports, so this package has no way to guard\n// the value before the cast even if it wanted to; an invalid locale ends up handled the same way\n// t() already handles one — falling back to \"en\"/the raw key — not a new failure mode.\nexport function setDisplayLanguage(locale: string): void {\n setEasygovDisplayLanguage(locale as Parameters<typeof setEasygovDisplayLanguage>[0]);\n}\n\nexport function subscribeDisplayLanguage(listener: () => void): () => void {\n return subscribeEasygovDisplayLanguage(listener);\n}\n\nexport function setBusinessModuleVersion(version: string): void {\n setEasygovBusinessModuleVersion(version);\n}\n\n// The `detail` of the header's `contextchange` event. A relative import of react-components'\n// types.ts rather than `from '@easygov/react-components'`, for the reason above: that file holds\n// only type declarations with no imports, so tsup's dts build inlines it and the emitted .d.ts\n// stays self-contained, without a second hand-kept copy of the claims schema to drift.\nexport type { HeaderContextChangeDetail } from '../../react-components/src/ui/EasygovHeader/types';\n"],"mappings":"yFAyBO,SAASA,GAA6B,CAC3C,OAAOC,EAA0B,CACnC,CAQO,SAASC,EAAmBC,EAAsB,CACvDC,EAA0BD,CAAyD,CACrF,CAEO,SAASE,EAAyBC,EAAkC,CACzE,OAAOC,EAAgCD,CAAQ,CACjD,CAEO,SAASE,EAAyBC,EAAuB,CAC9DC,EAAgCD,CAAO,CACzC","names":["getDisplayLanguage","getEasygovDisplayLanguage","setDisplayLanguage","locale","setEasygovDisplayLanguage","subscribeDisplayLanguage","listener","subscribeEasygovDisplayLanguage","setBusinessModuleVersion","version","setEasygovBusinessModuleVersion"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easygov/web-components",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "private": false,
5
5
  "description": "Framework-agnostic custom elements for EasyGov, wrapping @easygov/react-components as a self-contained browser bundle.",
6
6
  "license": "MIT",
@@ -43,14 +43,14 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@easygov/eslint-config": "0.0.0",
46
- "@easygov/react-components": "0.11.0",
46
+ "@easygov/react-components": "0.14.0",
47
47
  "@easygov/typescript-config": "0.0.0",
48
48
  "@types/node": "^24.0.0",
49
49
  "@types/react": "19.3.0",
50
50
  "@types/react-dom": "19.3.0",
51
51
  "eslint": "^9.39.1",
52
- "react": "19.3.0",
53
- "react-dom": "19.3.0",
52
+ "react": "19.3.1",
53
+ "react-dom": "19.3.1",
54
54
  "serve": "^14.2.6",
55
55
  "tsup": "^8.5.1",
56
56
  "typescript": "5.9.3"