@ukhomeoffice/cop-react-form-renderer 2.7.1 → 2.8.1

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.
@@ -0,0 +1,418 @@
1
+ {
2
+ "id": "userProfile",
3
+ "version": "1",
4
+ "name": "userProfile",
5
+ "title": "Your profile",
6
+ "type": "hub-and-spoke",
7
+ "components": [
8
+ {
9
+ "id": "firstName",
10
+ "fieldId": "firstName",
11
+ "label": "First name",
12
+ "type": "input",
13
+ "readonly": true,
14
+ "groupId": "addressDetails",
15
+ "source": {
16
+ "field": "currentUser.givenName"
17
+ }
18
+ },
19
+ {
20
+ "id": "surname",
21
+ "fieldId": "surname",
22
+ "label": "Last name",
23
+ "type": "text",
24
+ "readonly": true,
25
+ "groupId": "addressDetails",
26
+ "source": {
27
+ "field": "currentUser.familyName"
28
+ }
29
+ },
30
+ {
31
+ "id": "areYouACivilServant",
32
+ "fieldId": "areYouACivilServant",
33
+ "label": "Are you a civil servant?",
34
+ "type": "radios",
35
+ "required": true,
36
+ "groupId": "addressDetails",
37
+ "data": {
38
+ "url": "${urls.refData}/areYouACivilServant"
39
+ }
40
+ },
41
+ {
42
+ "id": "staffGradeId",
43
+ "fieldId": "staffGradeId",
44
+ "label": "Grade",
45
+ "hint": "We use this to assign you tasks",
46
+ "type": "radios",
47
+ "required": true,
48
+ "data": {
49
+ "url": "${urls.refData}/grade"
50
+ },
51
+ "source": {
52
+ "field": "userDetails.gradeid"
53
+ },
54
+ "show_when": {
55
+ "field": "areYouACivilServant",
56
+ "op": "eq",
57
+ "value": "yes"
58
+ }
59
+ },
60
+ {
61
+ "id": "team",
62
+ "fieldId": "team",
63
+ "label": "Team",
64
+ "hint": "We use this to assign you tasks",
65
+ "type": "autocomplete",
66
+ "required": true,
67
+ "item": {
68
+ "value": "id",
69
+ "label": "name"
70
+ },
71
+ "data": {
72
+ "url": "${urls.refData}/team"
73
+ },
74
+ "displayMenu": "inline",
75
+ "source": {
76
+ "field": "userDetails.defaultteam"
77
+ }
78
+ },
79
+ {
80
+ "id": "linemanagerEmail",
81
+ "fieldId": "linemanagerEmail",
82
+ "label": "Line manager email",
83
+ "hint": "Must be a homeoffice.gov.uk or digital.homeoffice.gov.uk address",
84
+ "type": "email",
85
+ "format": {
86
+ "type": "lowercase",
87
+ "on": "submit"
88
+ },
89
+ "required": true,
90
+ "source": {
91
+ "field": "userDetails.linemanagerEmail"
92
+ }
93
+ },
94
+ {
95
+ "id": "delegateEmails",
96
+ "fieldId": "delegateEmails",
97
+ "label": "Delegate email",
98
+ "hint": "Must be a homeoffice.gov.uk or digital.homeoffice.gov.uk address",
99
+ "type": "email",
100
+ "format": {
101
+ "type": "lowercase",
102
+ "on": "submit"
103
+ },
104
+ "required": true,
105
+ "source": {
106
+ "field": "userDetails.delegateEmails"
107
+ },
108
+ "show_when": [
109
+ {
110
+ "field": "areYouACivilServant",
111
+ "op": "eq",
112
+ "value": "yes"
113
+ },
114
+ {
115
+ "field": "staffGradeId",
116
+ "op": "in",
117
+ "values": [
118
+ "373979c1-2360-46be-b712-0409ac068059",
119
+ "36c80dfe-0aae-455b-9445-2e1c09dcafdc",
120
+ "1b041cda-b151-4769-b76a-d42d67b0b960",
121
+ "172de41d-f7b0-4be9-b7e8-0cf4f1a1342f",
122
+ "39e18b45-0358-4a45-83ec-5a70b74641e8"
123
+ ]
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "id": "firstLineOfTheAddress",
129
+ "fieldId": "firstLineOfTheAddress",
130
+ "label": "Address",
131
+ "type": "text",
132
+ "required": true,
133
+ "groupId": "addressDetails",
134
+ "custom_errors": [
135
+ {
136
+ "type": "required",
137
+ "message": "Please enter first line of the the address"
138
+ }
139
+ ],
140
+ "source": {
141
+ "field": "addressDetails.firstLineOfTheAddress"
142
+ }
143
+ },
144
+ {
145
+ "id": "city",
146
+ "fieldId": "city",
147
+ "label": "City",
148
+ "type": "text",
149
+ "required": true,
150
+ "groupId": "addressDetails",
151
+ "custom_errors": [
152
+ {
153
+ "type": "required",
154
+ "message": "Please enter city"
155
+ }
156
+ ],
157
+ "source": {
158
+ "field": "addressDetails.city"
159
+ }
160
+ },
161
+ {
162
+ "id": "town",
163
+ "fieldId": "town",
164
+ "label": "Town",
165
+ "type": "text",
166
+ "required": true,
167
+
168
+ "custom_errors": [
169
+ {
170
+ "type": "required",
171
+ "message": "Please enter Town"
172
+ }
173
+ ],
174
+ "source": {
175
+ "field": "addressDetails.town"
176
+ }
177
+ },
178
+ {
179
+ "id": "postCode",
180
+ "fieldId": "postCode",
181
+ "label": "Postcode",
182
+ "type": "text",
183
+ "required": true,
184
+ "groupId": "addressDetails",
185
+ "custom_errors": [
186
+ {
187
+ "type": "required",
188
+ "message": "Please enter postcode"
189
+ }
190
+ ],
191
+ "source": {
192
+ "field": "addressDetails.postCode"
193
+ }
194
+ },
195
+ {
196
+ "id": "postCode",
197
+ "fieldId": "postCode",
198
+ "label": "Postcode",
199
+ "type": "text",
200
+ "required": true,
201
+ "groupId": "addressDetails",
202
+ "custom_errors": [
203
+ {
204
+ "type": "required",
205
+ "message": "Please enter postcode"
206
+ }
207
+ ],
208
+ "source": {
209
+ "field": "addressDetails.postCode"
210
+ }
211
+ }
212
+ ],
213
+ "pages": [
214
+ {
215
+ "id": "names",
216
+ "name": "names",
217
+ "components": [
218
+ {
219
+ "use": "firstName"
220
+ },
221
+ {
222
+ "use": "surname"
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "id": "civil-servant-status",
228
+ "name": "civil-servant-status",
229
+ "title": "Are you a civil servant?",
230
+ "components": [
231
+ {
232
+ "use": "areYouACivilServant",
233
+ "label": ""
234
+ }
235
+ ],
236
+ "actions": ["submit"],
237
+ "cya_link": {
238
+ "page": "civil-servant-status",
239
+ "aria_suffix": "civil servant status"
240
+ }
241
+ },
242
+ {
243
+ "id": "grade",
244
+ "name": "grade",
245
+ "title": "What's your grade?",
246
+ "components": [
247
+ {
248
+ "use": "staffGradeId",
249
+ "label": ""
250
+ }
251
+ ],
252
+ "actions": ["submit"],
253
+ "cya_link": {
254
+ "page": "grade",
255
+ "aria_suffix": "grade"
256
+ }
257
+ },
258
+ {
259
+ "id": "team-name",
260
+ "name": "team-name",
261
+ "title": "What's your team name?",
262
+ "components": [
263
+ {
264
+ "use": "team",
265
+ "label": ""
266
+ }
267
+ ],
268
+ "actions": ["submit"],
269
+ "cya_link": {
270
+ "page": "team-name",
271
+ "aria_suffix": "teams"
272
+ }
273
+ },
274
+ {
275
+ "id": "add-or-change-line-manager",
276
+ "name": "add-or-change-line-manager",
277
+ "title": "Add or change a line manager",
278
+ "components": [
279
+ "Your line manager will need to review some of your forms. It’s important to keep their details up-to-date.",
280
+ "An email will be sent to your line manager to ask if they want to approve your request to add them.",
281
+ {
282
+ "type": "inset-text",
283
+ "content": "The changes will show in your profile when they approve your request."
284
+ },
285
+ {
286
+ "type": "heading",
287
+ "size": "m",
288
+ "content": "Mandatory declarations"
289
+ },
290
+ "Mandatory declarations will not go to your line manager until they have approved your request."
291
+ ],
292
+ "actions": [
293
+ {
294
+ "type": "navigate",
295
+ "page": "line-manager-email"
296
+ }
297
+ ],
298
+ "show_on_cya": false
299
+ },
300
+ {
301
+ "id": "line-manager-email",
302
+ "name": "line-manager-email",
303
+ "title": "What’s your line manager’s email address?",
304
+ "components": [
305
+ {
306
+ "use": "linemanagerEmail"
307
+ }
308
+ ],
309
+ "actions": ["submit"],
310
+ "cya_link": {
311
+ "page": "add-or-change-line-manager",
312
+ "aria_suffix": "line manager email address"
313
+ }
314
+ },
315
+ {
316
+ "id": "add-or-change-delegate",
317
+ "name": "add-or-change-delegate",
318
+ "title": "Add or change a delegate",
319
+ "components": [
320
+ "A delegate can review a mandatory declaration on your behalf.",
321
+ "An email will be sent to the delegate to ask if they want to approve your request.",
322
+ {
323
+ "type": "inset-text",
324
+ "content": "The changes will show in your profile when they approve your request."
325
+ }
326
+ ],
327
+ "actions": [
328
+ {
329
+ "type": "navigate",
330
+ "page": "delegate-email"
331
+ }
332
+ ],
333
+ "show_on_cya": false
334
+ },
335
+ {
336
+ "id": "delegate-email",
337
+ "name": "delegate-email",
338
+ "title": "What’s your delegate's email address?",
339
+ "components": [
340
+ {
341
+ "use": "delegateEmails",
342
+ "label": "Delegate email address"
343
+ },
344
+ {
345
+ "use": "delegateEmails",
346
+ "label": "Delegate email address"
347
+ }
348
+ ],
349
+ "actions": ["submit"],
350
+ "cya_link": {
351
+ "page": "add-or-change-delegate"
352
+ },
353
+ "show_when": [
354
+ {
355
+ "field": "areYouACivilServant",
356
+ "op": "eq",
357
+ "value": "yes"
358
+ },
359
+ {
360
+ "field": "staffGradeId",
361
+ "op": "in",
362
+ "values": [
363
+ "373979c1-2360-46be-b712-0409ac068059",
364
+ "36c80dfe-0aae-455b-9445-2e1c09dcafdc",
365
+ "1b041cda-b151-4769-b76a-d42d67b0b960",
366
+ "172de41d-f7b0-4be9-b7e8-0cf4f1a1342f",
367
+ "39e18b45-0358-4a45-83ec-5a70b74641e8"
368
+ ]
369
+ }
370
+ ]
371
+ },
372
+
373
+ {
374
+ "id": "address-details",
375
+ "groupLabel": "UK address",
376
+ "fieldId": "UK address",
377
+ "groups": [
378
+ {
379
+ "id": "address",
380
+ "label": "Address details",
381
+ "components": ["firstLineOfTheAddress", "town", "city", "postCode"]
382
+ }
383
+ ],
384
+ "name": "address-details",
385
+ "title": "Address details",
386
+ "components": [
387
+ {
388
+ "use": "firstLineOfTheAddress",
389
+ "label": "Address"
390
+ },
391
+ {
392
+ "use": "town",
393
+ "label": "Town"
394
+ },
395
+ {
396
+ "use": "city",
397
+ "label": "City"
398
+ },
399
+ {
400
+ "use": "postCode",
401
+ "label": "Postcode"
402
+ }
403
+ ],
404
+ "actions": ["saveAndContinue", "saveAndReturn"],
405
+ "cya_link": {
406
+ "url": "/address-details",
407
+ "aria_suffix": "address details"
408
+ }
409
+ }
410
+ ],
411
+ "hub": {
412
+ "format": "CYA"
413
+ },
414
+ "cya": {
415
+ "hide_page_titles": true,
416
+ "hide_actions": true
417
+ }
418
+ }
@@ -1,8 +1,8 @@
1
1
  {
2
- "id": "userProfile",
2
+ "id": "cop-secondForm",
3
3
  "version": "1",
4
- "name": "userProfile",
5
- "title": "Your profile",
4
+ "name": "cop-secondForm",
5
+ "title": "Cop - Second Form",
6
6
  "type": "cya",
7
7
  "components": [
8
8
  {
@@ -10,20 +10,14 @@
10
10
  "fieldId": "firstName",
11
11
  "label": "First name",
12
12
  "type": "text",
13
- "readonly": false,
14
- "source": {
15
- "field": "currentUser.givenName"
16
- }
13
+ "readonly": false
17
14
  },
18
15
  {
19
16
  "id": "surname",
20
17
  "fieldId": "surname",
21
18
  "label": "Last name",
22
19
  "type": "text",
23
- "readonly": false,
24
- "source": {
25
- "field": "currentUser.familyName"
26
- }
20
+ "readonly": false
27
21
  },
28
22
  {
29
23
  "id": "dateGroup",
@@ -31,10 +25,7 @@
31
25
  "label": "Date",
32
26
  "type": "date",
33
27
  "required": true,
34
- "readonly": false,
35
- "source": {
36
- "field": "dateGroupField"
37
- }
28
+ "readonly": false
38
29
  },
39
30
  {
40
31
  "id": "timeGroup",
@@ -42,10 +33,7 @@
42
33
  "label": "Time",
43
34
  "type": "time",
44
35
  "required": true,
45
- "readonly": false,
46
- "source": {
47
- "field": "timeGroupField"
48
- }
36
+ "readonly": false
49
37
  },
50
38
  {
51
39
  "id": "portGroup",
@@ -53,10 +41,7 @@
53
41
  "label": "Port",
54
42
  "type": "text",
55
43
  "required": true,
56
- "readonly": false,
57
- "source": {
58
- "field": "portGroupField"
59
- }
44
+ "readonly": false
60
45
  },
61
46
  {
62
47
  "id": "whereGroup",
@@ -64,10 +49,7 @@
64
49
  "label": "Where did you see the incident take place",
65
50
  "type": "text",
66
51
  "required": true,
67
- "readonly": false,
68
- "source": {
69
- "field": "whereGroupField"
70
- }
52
+ "readonly": false
71
53
  },
72
54
  {
73
55
  "id": "extraDetails",
@@ -94,9 +76,7 @@
94
76
  "page": "names",
95
77
  "aria_suffix": "names"
96
78
  },
97
- "actions": [
98
- "submit"
99
- ]
79
+ "actions": [ "saveAndContinue", "saveAndReturn" ]
100
80
  },
101
81
  {
102
82
  "id": "dateLocDet",
@@ -120,9 +100,7 @@
120
100
  "page": "dateLocDet",
121
101
  "aria_suffix": "Date and location details"
122
102
  },
123
- "actions": [
124
- "submit"
125
- ]
103
+ "actions": [ "saveAndContinue", "saveAndReturn" ]
126
104
  },
127
105
  {
128
106
  "id": "additional-info",
@@ -137,14 +115,12 @@
137
115
  "page": "additional-info",
138
116
  "aria_suffix": "Additional Information"
139
117
  },
140
- "actions": [
141
- "submit"
142
- ]
118
+ "actions": [ "saveAndContinue", "saveAndReturn" ]
143
119
  }
144
120
  ],
145
121
  "cya": {
146
- "hide_page_titles": true,
147
- "hide_actions": true,
122
+ "hide_page_titles": false,
123
+ "hide_actions": false,
148
124
  "groups": [
149
125
  {
150
126
  "pageId": "dateLocDet"
@@ -153,6 +129,9 @@
153
129
  "pageId": "names",
154
130
  "title": "Names"
155
131
  }
132
+ ],
133
+ "actions": [
134
+ { "type": "submit", "label": "Submit", "validate": true }
156
135
  ]
157
136
  }
158
137
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "id": "eventAtTheBorder",
2
+ "id": "cop-taskListForm",
3
3
  "version": "1",
4
- "name": "Event at the border",
5
- "title": "Event at the border",
4
+ "name": "cop-taskListForm",
5
+ "title": "Task List Form",
6
6
  "type": "task-list",
7
7
  "components": [
8
8
  {
@@ -57,6 +57,13 @@
57
57
  ]
58
58
  },
59
59
  "required": true
60
+ },
61
+ {
62
+ "id": "journeyDetails",
63
+ "fieldId": "journeyDetails",
64
+ "label": "Input the details of the journey",
65
+ "type": "textarea",
66
+ "required": true
60
67
  }
61
68
  ],
62
69
  "pages": [
@@ -73,7 +80,8 @@
73
80
  {
74
81
  "type": "saveAndNavigate",
75
82
  "page": "eventMode"
76
- }
83
+ },
84
+ "saveAndReturn"
77
85
  ],
78
86
  "cya_link": {
79
87
  "page": "eventDate",
@@ -93,7 +101,8 @@
93
101
  {
94
102
  "type": "saveAndNavigate",
95
103
  "page": "cya"
96
- }
104
+ },
105
+ "saveAndReturn"
97
106
  ],
98
107
  "cya_link": {
99
108
  "page": "eventMode",
@@ -113,7 +122,8 @@
113
122
  {
114
123
  "type": "saveAndNavigate",
115
124
  "page": "cya"
116
- }
125
+ },
126
+ "saveAndReturn"
117
127
  ],
118
128
  "cya_link": {
119
129
  "page": "officeDetails",
@@ -133,7 +143,8 @@
133
143
  {
134
144
  "type": "saveAndNavigate",
135
145
  "page": "cya"
136
- }
146
+ },
147
+ "saveAndReturn"
137
148
  ],
138
149
  "cya_link": {
139
150
  "page": "immigrationDate",
@@ -153,7 +164,8 @@
153
164
  {
154
165
  "type": "saveAndNavigate",
155
166
  "page": "surname"
156
- }
167
+ },
168
+ "saveAndReturn"
157
169
  ],
158
170
  "cya_link": {
159
171
  "page": "firstName",
@@ -173,12 +185,33 @@
173
185
  {
174
186
  "type": "saveAndNavigate",
175
187
  "page": "cya"
176
- }
188
+ },
189
+ "saveAndReturn"
177
190
  ],
178
191
  "cya_link": {
179
192
  "page": "surname",
180
193
  "aria_suffix": "Surname"
181
194
  }
195
+ },
196
+ {
197
+ "id": "journeyDetails",
198
+ "name": "journeyDetails",
199
+ "title": "Journey Details",
200
+ "components": [
201
+ {
202
+ "use": "journeyDetails"
203
+ }
204
+ ],
205
+ "actions": [
206
+ {
207
+ "type": "saveAndNavigate",
208
+ "page": "cya"
209
+ }
210
+ ],
211
+ "cya_link": {
212
+ "page": "journeyDetails",
213
+ "aria_suffix": "Journey Details"
214
+ }
182
215
  }
183
216
  ],
184
217
  "hub": {
@@ -210,12 +243,13 @@
210
243
  },
211
244
  {
212
245
  "name": "Immigration details",
246
+ "firstPage": "immigrationDate",
213
247
  "pages": ["immigrationDate"],
214
248
  "state": "inProgress"
215
249
  },
216
250
  {
217
251
  "name": "Journey details",
218
- "pages": ["none"],
252
+ "pages": ["journeyDetails"],
219
253
  "state": "cannotStartYet"
220
254
  }
221
255
  ]
@@ -223,6 +257,9 @@
223
257
  ]
224
258
  },
225
259
  "cya": {
226
- "hide_page_titles": false
260
+ "hide_page_titles": false,
261
+ "actions": [
262
+ { "type": "saveAndContinue", "label": "save cont", "validate": true }
263
+ ]
227
264
  }
228
265
  }
@@ -11,5 +11,11 @@
11
11
  "linemanagerEmail": "line.manager@digital.homeoffice.gov.uk",
12
12
  "delegateEmails": "del.egate@digital.homeoffice.gov.uk"
13
13
  },
14
+ "addressDetails": {
15
+ "firstLineOfTheAddress": "10 Downing Street",
16
+ "city": "London",
17
+ "town": "City of Westminster",
18
+ "postCode": "SW1A 2AA"
19
+ },
14
20
  "businessKey": "123456789"
15
21
  }
@@ -28,7 +28,8 @@ var DefaultPageActions = (_DefaultPageActions = {}, _defineProperty(_DefaultPage
28
28
  label: 'Save and continue'
29
29
  }), _defineProperty(_DefaultPageActions, TYPE_SAVE_AND_NAVIGATE, {
30
30
  type: TYPE_SAVE_AND_NAVIGATE,
31
- validate: true
31
+ validate: true,
32
+ label: 'Save and continue'
32
33
  }), _defineProperty(_DefaultPageActions, TYPE_SAVE_AND_RETURN, {
33
34
  type: TYPE_SAVE_AND_RETURN,
34
35
  validate: false,