@smartkomm/plexus-cli 0.1.69 → 0.1.70

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.
@@ -1 +1 @@
1
- 1be018ffd99eeb0fbb38bf6a03a8f166cfe5b036113395466488d90121cf33c8
1
+ d59305ab45eee46eba354052349d895f5540b27626de54845b9b9902af734747
@@ -209,6 +209,7 @@ whole is the operator's (ask them; do not try).
209
209
  | [offer/declare-node-reads.md](references/offer/declare-node-reads.md) | Mandant + Plattform | Declare which form fields a document node reads and locks. |
210
210
  | [offer/edit-live-tenant-offer.md](references/offer/edit-live-tenant-offer.md) | Mandant + Plattform | Change a live offer: fresh export → change → plan → apply → plan shows all same (signing connection steps need the operator). |
211
211
  | [offer/edit-smartform.md](references/offer/edit-smartform.md) | Mandant | Change a SmartForm in detail (properties, order, English texts). |
212
+ | [offer/consent-field.md](references/offer/consent-field.md) | Mandant | Add a consent field (a checkbox that must be ticked) or convert a preset yes/no into one. |
212
213
  | [offer/edit-workflow-node.md](references/offer/edit-workflow-node.md) | Mandant | Rename, rewire, rebind or reroute a node. |
213
214
  | [offer/engage-push-node.md](references/offer/engage-push-node.md) | Mandant + Plattform | Insert the Engage transfer node that pushes an accepted application to Engage SMIS once. |
214
215
  | [offer/insert-and-rewire-node.md](references/offer/insert-and-rewire-node.md) | Mandant | Put a step onto exactly one edge and onto an existing board state. |
@@ -1508,7 +1508,7 @@ Declare the environment keys the form reads ($env.<key>.<field>) and sample them
1508
1508
 
1509
1509
  ### `offer form field add`
1510
1510
 
1511
- Add a field to a section (types: string|boolean|date|enum|email|tel|address|docRef)
1511
+ Add a field to a section (types: string|boolean|consent|date|enum|email|tel|address|docRef)
1512
1512
 
1513
1513
  - **Right:** offline — no deployment
1514
1514
  - **Effect:** offline — edits local files only
@@ -1519,7 +1519,7 @@ Add a field to a section (types: string|boolean|date|enum|email|tel|address|docR
1519
1519
  | `--form <value>` | Form slug (default: the sole form) |
1520
1520
  | `--section <value>` (required) | Target section id |
1521
1521
  | `--key <value>` (required) | Field key (dotted, e.g. kind.vorname) |
1522
- | `--type <value>` (required) | string\|boolean\|date\|enum\|email\|tel\|address\|docRef |
1522
+ | `--type <value>` (required) | string\|boolean\|consent\|date\|enum\|email\|tel\|address\|docRef |
1523
1523
  | `--label <value>` | Field label (default: key) |
1524
1524
  | `--label-en <value>` | English label — required with --label (every SmartForm text needs German and English) |
1525
1525
  | `--required` | Mark required |
@@ -1635,6 +1635,7 @@ Set a field's validation/visibility expressions and flags
1635
1635
  | `--dir <value>` (required) | Bundle directory |
1636
1636
  | `--form <value>` | Form slug (default: the sole form) |
1637
1637
  | `--key <value>` (required) | Field key to edit |
1638
+ | `--type <value>` | Another type of the same datum (boolean\|consent, string\|email\|tel) — e.g. a boolean that is a consent |
1638
1639
  | `--label <value>` | New label |
1639
1640
  | `--label-en <value>` | English label — required with --label (every SmartForm text needs German and English) |
1640
1641
  | `--required` | Required (or --no-required) |
@@ -1798,7 +1799,7 @@ Add a test scenario (one-click test-mode prefill; the publish gate submits it)
1798
1799
  | `--label-en <value>` | English label — required with --label |
1799
1800
  | `--description <value>` | Description (German) |
1800
1801
  | `--description-en <value>` | English description — required with --description |
1801
- | `--prefill <value>` | Prefill key=value (repeatable), typed by the field: boolean true\|false, multi-enum a,b; addresses and repeated rows via --prefill-json |
1802
+ | `--prefill <value>` | Prefill key=value (repeatable), typed by the field: boolean true\|false, consent true, multi-enum a,b; addresses and repeated rows via --prefill-json |
1802
1803
  | `--prefill-json <value>` | Whole prefill as a JSON object (instead of --prefill) |
1803
1804
  | `--env-json <value>` | Environment sample as JSON, e.g. {"stage":{"key":"…","name":"…","gradeLevel":1}} |
1804
1805
 
@@ -1831,7 +1832,7 @@ Edit a test scenario (--prefill merges, --prefill-json replaces, --unset removes
1831
1832
  | `--label-en <value>` | English label — required when --label changes a translated text |
1832
1833
  | `--description <value>` | Description ("" clears it and its English) |
1833
1834
  | `--description-en <value>` | English description — required when --description changes a translated text |
1834
- | `--prefill <value>` | Prefill key=value (repeatable), typed by the field: boolean true\|false, multi-enum a,b; addresses and repeated rows via --prefill-json; merged into the stored prefill |
1835
+ | `--prefill <value>` | Prefill key=value (repeatable), typed by the field: boolean true\|false, consent true, multi-enum a,b; addresses and repeated rows via --prefill-json; merged into the stored prefill |
1835
1836
  | `--prefill-json <value>` | Replace the whole prefill with this JSON object |
1836
1837
  | `--unset <value>` | Remove these prefill keys (a,b) |
1837
1838
  | `--env-json <value>` | Replace the environment sample (JSON object; "" removes it) |
@@ -0,0 +1,73 @@
1
+ # Add a consent field (Zustimmungsfeld)
2
+
3
+ **When to use:** a form must ask the family to agree to something — the privacy
4
+ notice, the terms, a photo release — and may only be submitted once they ticked
5
+ it. Also: an existing required yes/no field preset to „Nein" (the old consent
6
+ shape) that `offer validate` warns about.
7
+
8
+ A consent (`type: consent`) is a checkbox whose value is `true` (given)
9
+ or empty (not given) — never `false`. The label is the consent text. It stores
10
+ the same datum as a `boolean`, so it maps onto a boolean custom field and binds
11
+ as a yes/no in the workflow.
12
+
13
+ ## Prerequisites
14
+ - An offer bundle on disk (`offer export …` or `offer init …`). Authoring is offline.
15
+ - Publishing (`offer apply --publish`) needs an API token of a user who may
16
+ configure the tenant's offers.
17
+ - A real tenant's bundle is never committed: export into a scratch dir outside
18
+ the repo (`playbooks/offer/edit-live-tenant-offer.md`).
19
+
20
+ ## Steps
21
+ ```bash
22
+ # New consent field. It must be demanded: --required, or --required-if for a
23
+ # conditional one (demanded only while visible).
24
+ plexus-cli offer form field add --dir <bundle> --section section.erklaerungen \
25
+ --key decl.datenschutz --type consent --required \
26
+ --label "Ich habe die Datenschutzerklärung gelesen und stimme ihr zu." \
27
+ --label-en "I have read and agree to the privacy notice."
28
+
29
+ # Convert the old shape: a required boolean preset to false. --type only switches
30
+ # between types of the same datum (boolean|consent, string|email|tel); key, label
31
+ # and mappings stay. Drop the preset in the same call — publish refuses a consent
32
+ # with a default. A field shown as Ja | Nein also needs --presentation "", and one
33
+ # that was not required needs --required (a consent nobody must give is refused).
34
+ plexus-cli offer form field set --dir <bundle> --key decl.consent --type consent --default ""
35
+
36
+ # Back to a plain checkbox (allowed, same datum):
37
+ plexus-cli offer form field set --dir <bundle> --key decl.consent --type boolean
38
+
39
+ # Test scenarios: a consent takes only true; leave it out for "not given".
40
+ plexus-cli offer form scenario add --dir <bundle> --id vollstaendig \
41
+ --label "Vollständig" --label-en "Complete" --prefill decl.datenschutz=true
42
+
43
+ plexus-cli offer validate --dir <bundle>
44
+ ```
45
+
46
+ ## Gates (`offer validate` and publish)
47
+ | Code | Severity | Meaning |
48
+ |---|---|---|
49
+ | `config.consent-default` | error | a consent with a `defaultValue` — the family must tick it itself |
50
+ | `config.consent-computed` | error | a consent mirroring another field (`sameAs`) |
51
+ | `config.consent-not-required` | error | neither `required` nor `requiredIf` — use `boolean` instead |
52
+ | `config.consent-in-repeated` | error | a consent inside a repeated row |
53
+ | `expr.consent-compare-false` | error | an expression compares a consent with `false` (it is never false; use `== null`) |
54
+ | `config.boolean-required-default-false` | warning | a required yes/no preset to „Nein" — counts as answered from the start; if it is a consent, convert it as above |
55
+
56
+ ## Verify
57
+ - `offer validate` lists none of the errors above for the field.
58
+ - `offer plan` shows the field type change; after `offer apply --publish`, the
59
+ form shows an unticked checkbox and refuses submit until it is ticked.
60
+
61
+ ## Idempotency / gotchas
62
+ - `field set --type date` on a boolean is refused ("stores a different value") —
63
+ a type of another datum would leave stored values, mappings and bindings wrong.
64
+ Add a new field instead.
65
+ - `--prefill <consent>=false` is refused: a consent has no false.
66
+ - The warning is not a blocker: a preset yes/no *question* stays allowed. Convert
67
+ only fields that are really a consent.
68
+
69
+ ## Related
70
+ - [Edit a SmartForm in depth](edit-smartform.md)
71
+ - [Author a SmartForm as code](author-smartform.md)
72
+ - [Author form scenarios](author-form-scenarios.md)
73
+ - [Edit a live tenant's offer](edit-live-tenant-offer.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartkomm/plexus-cli",
3
- "version": "0.1.69",
3
+ "version": "0.1.70",
4
4
  "description": "Unified Plexus admin + admission-offer config CLI (Convex backend).",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",