@easygov/react-components 0.10.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`
@@ -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 {