@marktiderman/genesis-forms 0.0.0-stage → 0.1.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.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +146 -2
  3. package/conformance/after-class-back-after-a-jump.scenario.json +217 -0
  4. package/conformance/after-class-contact-yes-completed.scenario.json +230 -0
  5. package/conformance/after-class-contact-yes-requires-name-and-email.scenario.json +218 -0
  6. package/conformance/after-class-happy-path.scenario.json +237 -0
  7. package/conformance/after-class-invalid-email-rejected.scenario.json +227 -0
  8. package/conformance/after-class-low-rating-skips-went-well.scenario.json +223 -0
  9. package/conformance/after-class-server-drops-unknown-and-hidden-answers.scenario.json +236 -0
  10. package/conformance/after-class-server-ignores-a-client-sent-coach.scenario.json +219 -0
  11. package/conformance/contact-details-anonymous-form-skips-identifying-fields.scenario.json +125 -0
  12. package/conformance/contact-details-named-form-asks-for-identifying-fields.scenario.json +129 -0
  13. package/conformance/monthly-pulse-default-ending.scenario.json +148 -0
  14. package/conformance/monthly-pulse-promoter-ending-via-jump.scenario.json +128 -0
  15. package/dist/engine-Cp5t2_Am.d.ts +75 -0
  16. package/dist/engine-LsPRTzt3.d.cts +75 -0
  17. package/dist/index.cjs +1205 -0
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/index.d.cts +374 -0
  20. package/dist/index.d.ts +374 -0
  21. package/dist/index.js +1174 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/server.cjs +988 -0
  24. package/dist/server.cjs.map +1 -0
  25. package/dist/server.d.cts +52 -0
  26. package/dist/server.d.ts +52 -0
  27. package/dist/server.js +984 -0
  28. package/dist/server.js.map +1 -0
  29. package/dist/testing.cjs +1299 -0
  30. package/dist/testing.cjs.map +1 -0
  31. package/dist/testing.d.cts +129 -0
  32. package/dist/testing.d.ts +129 -0
  33. package/dist/testing.js +1293 -0
  34. package/dist/testing.js.map +1 -0
  35. package/dist/validate-j8Z188mF.d.cts +175 -0
  36. package/dist/validate-j8Z188mF.d.ts +175 -0
  37. package/package.json +79 -3
@@ -0,0 +1,218 @@
1
+ {
2
+ "scenarioVersion": 1,
3
+ "name": "after-class: contact yes requires name and email",
4
+ "description": "Answering Yes to contact_me reveals name and email, and both are required on submit and on the server.",
5
+ "tags": [
6
+ "after-class",
7
+ "show-hide",
8
+ "validation"
9
+ ],
10
+ "definition": {
11
+ "schemaVersion": 1,
12
+ "id": "after-class",
13
+ "title": "How was class?",
14
+ "blocks": [
15
+ {
16
+ "kind": "field",
17
+ "id": "overall",
18
+ "key": "overall",
19
+ "type": "rating",
20
+ "label": "How was today's class?",
21
+ "required": true,
22
+ "props": {
23
+ "max": 5
24
+ }
25
+ },
26
+ {
27
+ "kind": "field",
28
+ "id": "went_well",
29
+ "key": "went_well",
30
+ "type": "multi-choice",
31
+ "label": "What went well?",
32
+ "props": {
33
+ "options": [
34
+ {
35
+ "value": "coaching",
36
+ "label": "Coaching"
37
+ },
38
+ {
39
+ "value": "workout",
40
+ "label": "The workout"
41
+ },
42
+ {
43
+ "value": "community",
44
+ "label": "Community"
45
+ },
46
+ {
47
+ "value": "scaling",
48
+ "label": "Scaling options"
49
+ },
50
+ {
51
+ "value": "equipment",
52
+ "label": "Equipment"
53
+ },
54
+ {
55
+ "value": "cleanliness",
56
+ "label": "Cleanliness"
57
+ }
58
+ ]
59
+ }
60
+ },
61
+ {
62
+ "kind": "field",
63
+ "id": "improve",
64
+ "key": "improve",
65
+ "type": "long-text",
66
+ "label": "Anything we could do better?"
67
+ },
68
+ {
69
+ "kind": "field",
70
+ "id": "contact_me",
71
+ "key": "contact_me",
72
+ "type": "yes-no",
73
+ "label": "Want {{hidden:coach|a coach}} to follow up with you?"
74
+ },
75
+ {
76
+ "kind": "field",
77
+ "id": "name",
78
+ "key": "name",
79
+ "type": "short-text",
80
+ "label": "Your name",
81
+ "required": true
82
+ },
83
+ {
84
+ "kind": "field",
85
+ "id": "email",
86
+ "key": "email",
87
+ "type": "email",
88
+ "label": "Best email to reach you",
89
+ "required": true
90
+ }
91
+ ],
92
+ "layout": {
93
+ "mode": "focus"
94
+ },
95
+ "hidden": [
96
+ {
97
+ "name": "class",
98
+ "type": "string",
99
+ "source": "server"
100
+ },
101
+ {
102
+ "name": "coach",
103
+ "type": "string",
104
+ "source": "server"
105
+ }
106
+ ],
107
+ "logic": [
108
+ {
109
+ "id": "r1",
110
+ "when": {
111
+ "op": "neq",
112
+ "left": {
113
+ "field": "contact_me"
114
+ },
115
+ "right": {
116
+ "value": true
117
+ }
118
+ },
119
+ "effect": "hide",
120
+ "target": "name"
121
+ },
122
+ {
123
+ "id": "r2",
124
+ "when": {
125
+ "op": "neq",
126
+ "left": {
127
+ "field": "contact_me"
128
+ },
129
+ "right": {
130
+ "value": true
131
+ }
132
+ },
133
+ "effect": "hide",
134
+ "target": "email"
135
+ },
136
+ {
137
+ "id": "r3",
138
+ "when": {
139
+ "op": "lt",
140
+ "left": {
141
+ "field": "overall"
142
+ },
143
+ "right": {
144
+ "value": 4
145
+ }
146
+ },
147
+ "effect": "jump",
148
+ "from": "overall",
149
+ "to": "improve"
150
+ }
151
+ ],
152
+ "endings": [
153
+ {
154
+ "id": "default",
155
+ "title": "Thanks! See you at the next class."
156
+ }
157
+ ],
158
+ "settings": {
159
+ "anonymous": true
160
+ }
161
+ },
162
+ "context": {
163
+ "class": "6:00 AM CrossFit",
164
+ "coach": "Sam"
165
+ },
166
+ "events": [
167
+ {
168
+ "type": "answer",
169
+ "field": "overall",
170
+ "value": 5
171
+ },
172
+ {
173
+ "type": "answer",
174
+ "field": "contact_me",
175
+ "value": true
176
+ },
177
+ {
178
+ "type": "submit"
179
+ }
180
+ ],
181
+ "expect": {
182
+ "path": [
183
+ "overall",
184
+ "went_well",
185
+ "improve",
186
+ "contact_me",
187
+ "name",
188
+ "email"
189
+ ],
190
+ "visible": [
191
+ "overall",
192
+ "went_well",
193
+ "improve",
194
+ "contact_me",
195
+ "name",
196
+ "email"
197
+ ],
198
+ "current": "name",
199
+ "status": "in_progress",
200
+ "ending": null,
201
+ "answers": {
202
+ "overall": 5,
203
+ "contact_me": true
204
+ },
205
+ "errors": [
206
+ "name",
207
+ "email"
208
+ ],
209
+ "server": {
210
+ "ok": false,
211
+ "complete": true,
212
+ "errors": [
213
+ "name",
214
+ "email"
215
+ ]
216
+ }
217
+ }
218
+ }
@@ -0,0 +1,237 @@
1
+ {
2
+ "scenarioVersion": 1,
3
+ "name": "after-class: happy path",
4
+ "description": "Five stars, no follow-up wanted. Name and email stay hidden and are not required.",
5
+ "tags": [
6
+ "after-class",
7
+ "happy-path"
8
+ ],
9
+ "definition": {
10
+ "schemaVersion": 1,
11
+ "id": "after-class",
12
+ "title": "How was class?",
13
+ "blocks": [
14
+ {
15
+ "kind": "field",
16
+ "id": "overall",
17
+ "key": "overall",
18
+ "type": "rating",
19
+ "label": "How was today's class?",
20
+ "required": true,
21
+ "props": {
22
+ "max": 5
23
+ }
24
+ },
25
+ {
26
+ "kind": "field",
27
+ "id": "went_well",
28
+ "key": "went_well",
29
+ "type": "multi-choice",
30
+ "label": "What went well?",
31
+ "props": {
32
+ "options": [
33
+ {
34
+ "value": "coaching",
35
+ "label": "Coaching"
36
+ },
37
+ {
38
+ "value": "workout",
39
+ "label": "The workout"
40
+ },
41
+ {
42
+ "value": "community",
43
+ "label": "Community"
44
+ },
45
+ {
46
+ "value": "scaling",
47
+ "label": "Scaling options"
48
+ },
49
+ {
50
+ "value": "equipment",
51
+ "label": "Equipment"
52
+ },
53
+ {
54
+ "value": "cleanliness",
55
+ "label": "Cleanliness"
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ {
61
+ "kind": "field",
62
+ "id": "improve",
63
+ "key": "improve",
64
+ "type": "long-text",
65
+ "label": "Anything we could do better?"
66
+ },
67
+ {
68
+ "kind": "field",
69
+ "id": "contact_me",
70
+ "key": "contact_me",
71
+ "type": "yes-no",
72
+ "label": "Want {{hidden:coach|a coach}} to follow up with you?"
73
+ },
74
+ {
75
+ "kind": "field",
76
+ "id": "name",
77
+ "key": "name",
78
+ "type": "short-text",
79
+ "label": "Your name",
80
+ "required": true
81
+ },
82
+ {
83
+ "kind": "field",
84
+ "id": "email",
85
+ "key": "email",
86
+ "type": "email",
87
+ "label": "Best email to reach you",
88
+ "required": true
89
+ }
90
+ ],
91
+ "layout": {
92
+ "mode": "focus"
93
+ },
94
+ "hidden": [
95
+ {
96
+ "name": "class",
97
+ "type": "string",
98
+ "source": "server"
99
+ },
100
+ {
101
+ "name": "coach",
102
+ "type": "string",
103
+ "source": "server"
104
+ }
105
+ ],
106
+ "logic": [
107
+ {
108
+ "id": "r1",
109
+ "when": {
110
+ "op": "neq",
111
+ "left": {
112
+ "field": "contact_me"
113
+ },
114
+ "right": {
115
+ "value": true
116
+ }
117
+ },
118
+ "effect": "hide",
119
+ "target": "name"
120
+ },
121
+ {
122
+ "id": "r2",
123
+ "when": {
124
+ "op": "neq",
125
+ "left": {
126
+ "field": "contact_me"
127
+ },
128
+ "right": {
129
+ "value": true
130
+ }
131
+ },
132
+ "effect": "hide",
133
+ "target": "email"
134
+ },
135
+ {
136
+ "id": "r3",
137
+ "when": {
138
+ "op": "lt",
139
+ "left": {
140
+ "field": "overall"
141
+ },
142
+ "right": {
143
+ "value": 4
144
+ }
145
+ },
146
+ "effect": "jump",
147
+ "from": "overall",
148
+ "to": "improve"
149
+ }
150
+ ],
151
+ "endings": [
152
+ {
153
+ "id": "default",
154
+ "title": "Thanks! See you at the next class."
155
+ }
156
+ ],
157
+ "settings": {
158
+ "anonymous": true
159
+ }
160
+ },
161
+ "context": {
162
+ "class": "6:00 AM CrossFit",
163
+ "coach": "Sam"
164
+ },
165
+ "events": [
166
+ {
167
+ "type": "answer",
168
+ "field": "overall",
169
+ "value": 5
170
+ },
171
+ {
172
+ "type": "next"
173
+ },
174
+ {
175
+ "type": "answer",
176
+ "field": "went_well",
177
+ "value": [
178
+ "coaching",
179
+ "community"
180
+ ]
181
+ },
182
+ {
183
+ "type": "next"
184
+ },
185
+ {
186
+ "type": "next"
187
+ },
188
+ {
189
+ "type": "answer",
190
+ "field": "contact_me",
191
+ "value": false
192
+ },
193
+ {
194
+ "type": "submit"
195
+ }
196
+ ],
197
+ "expect": {
198
+ "path": [
199
+ "overall",
200
+ "went_well",
201
+ "improve",
202
+ "contact_me"
203
+ ],
204
+ "visible": [
205
+ "overall",
206
+ "went_well",
207
+ "improve",
208
+ "contact_me"
209
+ ],
210
+ "current": "contact_me",
211
+ "status": "completed",
212
+ "ending": "default",
213
+ "answers": {
214
+ "overall": 5,
215
+ "went_well": [
216
+ "coaching",
217
+ "community"
218
+ ],
219
+ "contact_me": false
220
+ },
221
+ "server": {
222
+ "ok": true,
223
+ "answers": {
224
+ "overall": 5,
225
+ "went_well": [
226
+ "coaching",
227
+ "community"
228
+ ],
229
+ "contact_me": false
230
+ },
231
+ "context": {
232
+ "class": "6:00 AM CrossFit",
233
+ "coach": "Sam"
234
+ }
235
+ }
236
+ }
237
+ }
@@ -0,0 +1,227 @@
1
+ {
2
+ "scenarioVersion": 1,
3
+ "name": "after-class: invalid email rejected",
4
+ "description": "A malformed email blocks submit on the client and is rejected by the server.",
5
+ "tags": [
6
+ "after-class",
7
+ "validation"
8
+ ],
9
+ "definition": {
10
+ "schemaVersion": 1,
11
+ "id": "after-class",
12
+ "title": "How was class?",
13
+ "blocks": [
14
+ {
15
+ "kind": "field",
16
+ "id": "overall",
17
+ "key": "overall",
18
+ "type": "rating",
19
+ "label": "How was today's class?",
20
+ "required": true,
21
+ "props": {
22
+ "max": 5
23
+ }
24
+ },
25
+ {
26
+ "kind": "field",
27
+ "id": "went_well",
28
+ "key": "went_well",
29
+ "type": "multi-choice",
30
+ "label": "What went well?",
31
+ "props": {
32
+ "options": [
33
+ {
34
+ "value": "coaching",
35
+ "label": "Coaching"
36
+ },
37
+ {
38
+ "value": "workout",
39
+ "label": "The workout"
40
+ },
41
+ {
42
+ "value": "community",
43
+ "label": "Community"
44
+ },
45
+ {
46
+ "value": "scaling",
47
+ "label": "Scaling options"
48
+ },
49
+ {
50
+ "value": "equipment",
51
+ "label": "Equipment"
52
+ },
53
+ {
54
+ "value": "cleanliness",
55
+ "label": "Cleanliness"
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ {
61
+ "kind": "field",
62
+ "id": "improve",
63
+ "key": "improve",
64
+ "type": "long-text",
65
+ "label": "Anything we could do better?"
66
+ },
67
+ {
68
+ "kind": "field",
69
+ "id": "contact_me",
70
+ "key": "contact_me",
71
+ "type": "yes-no",
72
+ "label": "Want {{hidden:coach|a coach}} to follow up with you?"
73
+ },
74
+ {
75
+ "kind": "field",
76
+ "id": "name",
77
+ "key": "name",
78
+ "type": "short-text",
79
+ "label": "Your name",
80
+ "required": true
81
+ },
82
+ {
83
+ "kind": "field",
84
+ "id": "email",
85
+ "key": "email",
86
+ "type": "email",
87
+ "label": "Best email to reach you",
88
+ "required": true
89
+ }
90
+ ],
91
+ "layout": {
92
+ "mode": "focus"
93
+ },
94
+ "hidden": [
95
+ {
96
+ "name": "class",
97
+ "type": "string",
98
+ "source": "server"
99
+ },
100
+ {
101
+ "name": "coach",
102
+ "type": "string",
103
+ "source": "server"
104
+ }
105
+ ],
106
+ "logic": [
107
+ {
108
+ "id": "r1",
109
+ "when": {
110
+ "op": "neq",
111
+ "left": {
112
+ "field": "contact_me"
113
+ },
114
+ "right": {
115
+ "value": true
116
+ }
117
+ },
118
+ "effect": "hide",
119
+ "target": "name"
120
+ },
121
+ {
122
+ "id": "r2",
123
+ "when": {
124
+ "op": "neq",
125
+ "left": {
126
+ "field": "contact_me"
127
+ },
128
+ "right": {
129
+ "value": true
130
+ }
131
+ },
132
+ "effect": "hide",
133
+ "target": "email"
134
+ },
135
+ {
136
+ "id": "r3",
137
+ "when": {
138
+ "op": "lt",
139
+ "left": {
140
+ "field": "overall"
141
+ },
142
+ "right": {
143
+ "value": 4
144
+ }
145
+ },
146
+ "effect": "jump",
147
+ "from": "overall",
148
+ "to": "improve"
149
+ }
150
+ ],
151
+ "endings": [
152
+ {
153
+ "id": "default",
154
+ "title": "Thanks! See you at the next class."
155
+ }
156
+ ],
157
+ "settings": {
158
+ "anonymous": true
159
+ }
160
+ },
161
+ "context": {
162
+ "class": "6:00 AM CrossFit",
163
+ "coach": "Sam"
164
+ },
165
+ "events": [
166
+ {
167
+ "type": "answer",
168
+ "field": "overall",
169
+ "value": 4
170
+ },
171
+ {
172
+ "type": "answer",
173
+ "field": "contact_me",
174
+ "value": true
175
+ },
176
+ {
177
+ "type": "answer",
178
+ "field": "name",
179
+ "value": "Ada"
180
+ },
181
+ {
182
+ "type": "answer",
183
+ "field": "email",
184
+ "value": "ada@"
185
+ },
186
+ {
187
+ "type": "submit"
188
+ }
189
+ ],
190
+ "expect": {
191
+ "path": [
192
+ "overall",
193
+ "went_well",
194
+ "improve",
195
+ "contact_me",
196
+ "name",
197
+ "email"
198
+ ],
199
+ "visible": [
200
+ "overall",
201
+ "went_well",
202
+ "improve",
203
+ "contact_me",
204
+ "name",
205
+ "email"
206
+ ],
207
+ "current": "email",
208
+ "status": "in_progress",
209
+ "ending": null,
210
+ "answers": {
211
+ "overall": 4,
212
+ "contact_me": true,
213
+ "name": "Ada",
214
+ "email": "ada@"
215
+ },
216
+ "errors": [
217
+ "email"
218
+ ],
219
+ "server": {
220
+ "ok": false,
221
+ "complete": true,
222
+ "errors": [
223
+ "email"
224
+ ]
225
+ }
226
+ }
227
+ }