@easygov/web-components 0.13.0 → 0.15.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/README.md CHANGED
@@ -71,7 +71,7 @@ listen on the element or on an ancestor.
71
71
  | Event | `detail` | Fired when |
72
72
  | ---------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
73
73
  | `contextchange` | `{ contextJwt, claims, contentChanged }` | A new context token arrives: after sign-in, after every URL path change and on every renewal (about every 4 minutes). |
74
- | `sessionchange` | `{ user: { sub, name } \| null }` | The signed-in user changes: once after load if a session exists, on login, and on logout (`user: null`). |
74
+ | `sessionchange` | `{ user: { sub, firstName?, lastName?, emailAddress?, eiamAppRoles } \| null }` | The signed-in user or their data changes: once after load if a session exists, on login, on logout (`user: null`), and when a renewed access token changes names, e-mail or roles. Not on a renewal that only brings a new token. |
75
75
  | `languagechange` | `{ locale }` (`'de' \| 'en' \| 'fr' \| 'it'`) | Once after mount and whenever the display language changes. The header also sets `<html lang>`. |
76
76
  | `navigate` | `{ path }` | The user clicks a header link (`path` is a Core path such as `/dashboard`). Informational: the browser follows the link anyway. |
77
77
 
@@ -103,25 +103,23 @@ signed JWT, `contextJwt`. `claims` is its decoded payload:
103
103
  "currentUser": {
104
104
  "id": "6b1f3c2e-8a7d-4e0b-9c5a-2f4d8e1a7b90",
105
105
  "eiamIdentity": "CH-1234-5678-9012",
106
- "eiamSSOsessionID": "a1b2c3d4e5",
107
- "qoA": 30,
108
106
  "gtcAccepted": true,
109
- "registerDate": "2025-03-14T08:30:00Z",
110
- "idpUsed": "externalIDP\\AgovIDP",
111
- "emailAddress": "anna.muster@example.ch",
112
- "firstName": "Anna",
113
- "lastName": "Muster",
114
- "roles": []
107
+ "registerDate": "2025-03-14T08:30:00Z"
115
108
  },
116
109
  "customerAccount": {
117
110
  "id": "acc-4711",
118
111
  "accountType": "ORGANIZATION",
119
- "label": "Muster AG",
120
112
  "status": "VERIFIED",
121
- "legalForm": "AG",
122
- "uid": "CHE-123.456.789",
113
+ "onboardingMethod": "ADDING_SWISS_ORGANIZATION",
114
+ "mainAddress": { "street": "Bahnhofstrasse", "houseNumber": "12a", "zipCode": "8005", "town": "Zürich", "country": "CH" },
115
+ "label": "Muster AG",
116
+ "orgName": "Muster AG",
117
+ "legalForm": "0106",
118
+ "uid": "CHE123456789",
119
+ "uidFormatted": "CHE-123.456.789",
123
120
  "managementRole": {
124
121
  "roleType": "AGENT",
122
+ "enableNotificationMail": true,
125
123
  "servicePermission": {
126
124
  "serviceAppId": "app-42",
127
125
  "permissionLevel": "EDIT"
@@ -131,16 +129,27 @@ signed JWT, `contextJwt`. `claims` is its decoded payload:
131
129
  "serviceApp": {
132
130
  "id": "app-42",
133
131
  "businessModuleId": "urn_core_businessmodule_example",
132
+ "appType": "SERVICE_REQUEST_APP",
134
133
  "individualServicePermissionModel": false
135
134
  },
136
135
  "process": {
137
136
  "id": "proc-0815",
138
137
  "status": "REQUEST_IN_PROGRESS",
139
- "serviceAppId": "app-42"
138
+ "serviceRequestAppId": "app-42"
140
139
  }
141
140
  }
142
141
  ```
143
142
 
143
+ Three fields are not in the token: the header derives them after decoding.
144
+
145
+ - `customerAccount.label`: `orgName` for an organization, `firstName lastName` for an
146
+ individual, the same rule as core-backend's `CustomerAccount.label`.
147
+ - `customerAccount.uidFormatted` and `vatUidFormatted`: `uid` and `vatUid` in their display form
148
+ `CHE-123.456.789`, without the MWST/TVA/IVA suffix; present exactly when the technical value is.
149
+
150
+ A backend that decodes the raw `contextJwt` itself gets none of them and works from `orgName`,
151
+ `firstName`/`lastName`, `uid` and `vatUid`.
152
+
144
153
  **Why the event repeats:** `contextJwt` is short-lived (5 minutes by default), so the header fetches
145
154
  a new one about 60 seconds before it expires and fires `contextchange` again. `contentChanged` is
146
155
  `true` for the first context after sign-in and whenever `claims` differs from the previous event,