@easygov/react-components 0.9.0 → 0.11.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
@@ -76,8 +76,8 @@ that runs it.
76
76
 
77
77
  ### Reading the header context
78
78
 
79
- The header resolves the signed-in user, the selected customer account, the running process and
80
- its ancestor chain (if the URL addresses a sub-process) from core-backend and publishes them to
79
+ The header resolves the signed-in user, the selected customer account, and the running process
80
+ or the parent process a sub-process is being created under, from core-backend and publishes them to
81
81
  consumers:
82
82
 
83
83
  ```tsx
@@ -86,7 +86,7 @@ import { useEasygovHeaderContext } from '@easygov/react-components';
86
86
  function ContactForm() {
87
87
  const { claims } = useEasygovHeaderContext();
88
88
  const account = claims?.customerAccount;
89
- const parentProcess = claims?.parentProcesses?.[0];
89
+ const parentProcess = claims?.parentProcess;
90
90
 
91
91
  return (
92
92
  <form>
@@ -99,14 +99,13 @@ function ContactForm() {
99
99
  }
100
100
  ```
101
101
 
102
- `claims.parentProcesses` lists the ancestors of the addressed Behördengang, nearest first — index
103
- 0 is the direct parent, ascending toward the root — and is absent (not `[]`) when there is none.
104
- If it is present while `claims.process` is absent, a sub-process is about to be created under
105
- `parentProcesses[0]`, which is then the addressed Process itself and not a selected Behördengang.
106
- Each `SelectedProcess` (in `claims.process` and `claims.parentProcesses`) also carries its own
107
- `parentProcessId` — the global identifier of its parent, absent for a top-level Behördengang —
108
- so a consumer can identify ancestry per node after flattening `parentProcesses` into a map,
109
- without relying solely on the array's ordering.
102
+ `claims.process` and `claims.parentProcess` are mutually exclusive. `process` is the Behördengang
103
+ the URL selects (`/process/{id}`). `parentProcess` is the Behördengang a sub-process is about to be
104
+ created under (`/parentprocess/{id}`) — not a selected Behördengang. Neither is present when the
105
+ URL addresses no process. Each `SelectedProcess` carries its own `parentProcessId`, the global
106
+ identifier of its parent, absent for a top-level Behördengang. That reference is the only
107
+ representation of a selected process's parent: the context carries no ancestor chain, because it
108
+ is forwarded as an HTTP header where 4/8 KB size limits apply.
110
109
 
111
110
  `claims` is `null` until the first response lands and again after logout — render a fallback,
112
111
  don't assume it is present on first paint. The hook reflects the last context an `EasygovHeader`
@@ -187,6 +186,34 @@ defines.
187
186
  the language now — read it with `useEasygovDisplayLanguage()`, set it with
188
187
  `setEasygovDisplayLanguage()`.
189
188
 
189
+ ### Publishing the business module's version
190
+
191
+ A business module frontend embedding `EasygovHeader` can publish its own version number so it
192
+ appears in the environment badge's tooltip alongside the library and backend versions:
193
+
194
+ ```ts
195
+ import { setEasygovBusinessModuleVersion } from '@easygov/react-components';
196
+
197
+ setEasygovBusinessModuleVersion('2.4.1');
198
+ ```
199
+
200
+ Call it whenever your app knows its own version — at startup is typical. It can be called
201
+ before or after any `EasygovHeader` has mounted, and calling it again later (e.g. after a
202
+ version changes) simply updates the tooltip. Until it is called, the tooltip shows only the
203
+ existing `UI-Version` and `Backend-Version` lines, exactly as it did before this API existed.
204
+
205
+ Outside React — including `<eg-easygov-header>` — call the same setter on the web-components
206
+ global instead:
207
+
208
+ ```js
209
+ window.easygov.setBusinessModuleVersion('2.4.1');
210
+ ```
211
+
212
+ **A page using `<eg-easygov-header>` must call `window.easygov.setBusinessModuleVersion`, not
213
+ the npm function.** That bundle inlines its own copy of this library, so the npm function
214
+ would write into a different store instance than the one the element reads from — the same
215
+ caveat that already applies to `useEasygovDisplayLanguage` in that context (see above).
216
+
190
217
  ## License
191
218
 
192
219
  MIT
@@ -390,9 +390,9 @@ interface SelectedProcess {
390
390
  individualServicePermissionModel: boolean;
391
391
  };
392
392
  /**
393
- * Global identifier of this process's own parent. Absent for a top-level Behördengang.
394
- * Lets a client identify ancestry per node — e.g. after flattening `parentProcesses` into a
395
- * map — without relying solely on that array's documented ordering.
393
+ * Global identifier of this process's own parent. Absent for a top-level Behördengang. This
394
+ * reference is the only representation of a selected process's parent: the context carries no
395
+ * ancestor chain.
396
396
  */
397
397
  parentProcessId?: string;
398
398
  }
@@ -419,16 +419,16 @@ interface UserProfile {
419
419
  interface HeaderContextClaims {
420
420
  currentUser: UserProfile;
421
421
  customerAccount?: SelectedCustomerAccount;
422
+ /**
423
+ * The Behördengang the URL selects (`/process/{id}`). Mutually exclusive with `parentProcess`.
424
+ */
422
425
  process?: SelectedProcess;
423
426
  /**
424
- * Ancestors of the addressed Behördengang, nearest first: index 0 is the direct parent,
425
- * ascending toward the root. Absent — not an empty array — when there is none.
426
- *
427
- * Present while `process` is absent means a sub-process is about to be created under
428
- * `parentProcesses[0]`, which is then the addressed Process itself and NOT a selected
429
- * Behördengang. That is the `/parentprocess/{id}` URL form.
427
+ * The Behördengang a sub-process is about to be created under (`/parentprocess/{id}`).
428
+ * Mutually exclusive with `process`, and NOT a selected Behördengang. A selected process's own
429
+ * parent is never included as an object — only as `process.parentProcessId`.
430
430
  */
431
- parentProcesses?: SelectedProcess[];
431
+ parentProcess?: SelectedProcess;
432
432
  }
433
433
 
434
434
  interface EasygovHeaderContext {
@@ -450,7 +450,22 @@ interface EasygovVersionInfo {
450
450
  * unresolved origin, malformed body) — there is no retry.
451
451
  */
452
452
  backendVersion: string | null;
453
+ /**
454
+ * The embedding business module's own version, published via `setEasygovFunctionModuleVersion`.
455
+ * Null until a consumer calls the setter — EasygovHeader itself never sets this and has no
456
+ * way to discover it on its own, unlike backendVersion.
457
+ */
458
+ businessModuleVersion: string | null;
453
459
  }
460
+ /**
461
+ * Publishes the embedding business module's own version into the store, so EasygovHeader's version
462
+ * tooltip can show it alongside the library and backend versions. Safe to call at any time —
463
+ * before or after any EasygovHeader mounts — and safe to call more than once; each call
464
+ * overwrites the previous value and notifies subscribers. There is no corresponding fetch:
465
+ * EasygovHeader has no way to discover a business module's version on its own, so this is the only
466
+ * way the field is ever set.
467
+ */
468
+ declare function setEasygovBusinessModuleVersion(version: string): void;
454
469
 
455
470
  declare const dictionaries: {
456
471
  de: {
@@ -650,4 +665,4 @@ declare function getEasygovDisplayLanguage(): Locale;
650
665
  declare function setEasygovDisplayLanguage(locale: Locale): void;
651
666
  declare function subscribeEasygovDisplayLanguage(listener: () => void): () => void;
652
667
 
653
- export { type AuthStatus, BrandBase, BrandEasygov, BrandFacebook, BrandKdk, BrandLinkedin, type BrandProps, BrandSeg, BrandSgv, BrandSsv, BrandSwiss, BrandXing, BrandYoutube, Button, type ButtonProps, type DesktopSpan, Dropdown, DropdownChip, DropdownChipsOverflow, type DropdownChipsOverflowProps, DropdownChipsTrigger, type DropdownChipsTriggerProps, DropdownCollection, DropdownEmpty, DropdownGroup, DropdownGroupLabel, DropdownHelperText, type DropdownHelperTextProps, DropdownInput, DropdownItem, type DropdownItemProps, DropdownItemText, DropdownLabel, type DropdownLabelProps, DropdownList, DropdownPopup, type DropdownPopupProps, DropdownSeparator, DropdownToggle, DropdownTrigger, type DropdownTriggerProps, DropdownValue, EasygovFooter, EasygovHeader, type EasygovHeaderContext, type EasygovHeaderProps, type EasygovSession, type EasygovVersionInfo, ErrorDialog, type ErrorDialogProps, Grid, GridItem, type GridItemProps, type GridProps, type AccountVerificationStatus as HeaderContextAccountVerificationStatus, type HeaderContextClaims, type IndividualAccount as HeaderContextIndividualAccount, type ManagementRole as HeaderContextManagementRole, type ManagementRoleStatus as HeaderContextManagementRoleStatus, type ManagementRoleType as HeaderContextManagementRoleType, type OrganizationAccount as HeaderContextOrganizationAccount, type ProcessStatus as HeaderContextProcessStatus, type UserProfile as HeaderContextUserProfile, Heading, type HeadingProps, Input, type InputProps, type Locale, type MobileSpan, NavigationMenu, NavigationMenuAnchor, type NavigationMenuAnchorProps, NavigationMenuContent, type NavigationMenuContentProps, NavigationMenuItem, type NavigationMenuItemProps, NavigationMenuLink, type NavigationMenuLinkProps, NavigationMenuList, type NavigationMenuListProps, type NavigationMenuProps, NavigationMenuTrigger, type NavigationMenuTriggerProps, RequireCustomerAccount, type RequireCustomerAccountProps, RequireSession, type RequireSessionProps, Select, SelectContent, type SelectContentProps, SelectGroup, SelectGroupLabel, type SelectGroupLabelProps, SelectHelperText, type SelectHelperTextProps, SelectItem, type SelectItemProps, SelectLabel, type SelectLabelProps, SelectSeparator, type SelectSeparatorProps, SelectTrigger, type SelectTriggerProps, type SelectedCustomerAccount, type SelectedProcess, type SessionUser, type TabletSpan, Text, TextLink, type TextLinkProps, type TextProps, buttonVariants, getAuthStatus, getEasygovDisplayLanguage, headingVariants, requireSession, setEasygovDisplayLanguage, subscribeEasygovDisplayLanguage, textLinkVariants, textVariants, useEasygovAuthStatus, useEasygovDisplayLanguage, useEasygovHeaderContext, useEasygovSession, useEasygovVersionInfo, useRequireCustomerAccount };
668
+ export { type AuthStatus, BrandBase, BrandEasygov, BrandFacebook, BrandKdk, BrandLinkedin, type BrandProps, BrandSeg, BrandSgv, BrandSsv, BrandSwiss, BrandXing, BrandYoutube, Button, type ButtonProps, type DesktopSpan, Dropdown, DropdownChip, DropdownChipsOverflow, type DropdownChipsOverflowProps, DropdownChipsTrigger, type DropdownChipsTriggerProps, DropdownCollection, DropdownEmpty, DropdownGroup, DropdownGroupLabel, DropdownHelperText, type DropdownHelperTextProps, DropdownInput, DropdownItem, type DropdownItemProps, DropdownItemText, DropdownLabel, type DropdownLabelProps, DropdownList, DropdownPopup, type DropdownPopupProps, DropdownSeparator, DropdownToggle, DropdownTrigger, type DropdownTriggerProps, DropdownValue, EasygovFooter, EasygovHeader, type EasygovHeaderContext, type EasygovHeaderProps, type EasygovSession, type EasygovVersionInfo, ErrorDialog, type ErrorDialogProps, Grid, GridItem, type GridItemProps, type GridProps, type AccountVerificationStatus as HeaderContextAccountVerificationStatus, type HeaderContextClaims, type IndividualAccount as HeaderContextIndividualAccount, type ManagementRole as HeaderContextManagementRole, type ManagementRoleStatus as HeaderContextManagementRoleStatus, type ManagementRoleType as HeaderContextManagementRoleType, type OrganizationAccount as HeaderContextOrganizationAccount, type ProcessStatus as HeaderContextProcessStatus, type UserProfile as HeaderContextUserProfile, Heading, type HeadingProps, Input, type InputProps, type Locale, type MobileSpan, NavigationMenu, NavigationMenuAnchor, type NavigationMenuAnchorProps, NavigationMenuContent, type NavigationMenuContentProps, NavigationMenuItem, type NavigationMenuItemProps, NavigationMenuLink, type NavigationMenuLinkProps, NavigationMenuList, type NavigationMenuListProps, type NavigationMenuProps, NavigationMenuTrigger, type NavigationMenuTriggerProps, RequireCustomerAccount, type RequireCustomerAccountProps, RequireSession, type RequireSessionProps, Select, SelectContent, type SelectContentProps, SelectGroup, SelectGroupLabel, type SelectGroupLabelProps, SelectHelperText, type SelectHelperTextProps, SelectItem, type SelectItemProps, SelectLabel, type SelectLabelProps, SelectSeparator, type SelectSeparatorProps, SelectTrigger, type SelectTriggerProps, type SelectedCustomerAccount, type SelectedProcess, type SessionUser, type TabletSpan, Text, TextLink, type TextLinkProps, type TextProps, buttonVariants, getAuthStatus, getEasygovDisplayLanguage, headingVariants, requireSession, setEasygovBusinessModuleVersion, setEasygovDisplayLanguage, subscribeEasygovDisplayLanguage, textLinkVariants, textVariants, useEasygovAuthStatus, useEasygovDisplayLanguage, useEasygovHeaderContext, useEasygovSession, useEasygovVersionInfo, useRequireCustomerAccount };