@ukhomeoffice/cop-react-form-renderer 5.0.0-alpha → 5.0.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 (277) hide show
  1. package/dist/components/CheckYourAnswers/Answer.js +18 -7
  2. package/dist/components/CheckYourAnswers/Answer.test.js +137 -0
  3. package/dist/components/CheckYourAnswers/CheckYourAnswers.js +70 -46
  4. package/dist/components/CheckYourAnswers/CheckYourAnswers.stories.mdx +410 -0
  5. package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +551 -0
  6. package/dist/components/CollectionPage/CollectionPage.js +15 -10
  7. package/dist/components/CollectionPage/CollectionPage.test.js +382 -0
  8. package/dist/components/FormComponent/Collection.js +91 -48
  9. package/dist/components/FormComponent/Collection.scss +2 -1
  10. package/dist/components/FormComponent/Collection.test.js +807 -0
  11. package/dist/components/FormComponent/Container.js +35 -16
  12. package/dist/components/FormComponent/Container.test.js +370 -0
  13. package/dist/components/FormComponent/FormComponent.js +39 -13
  14. package/dist/components/FormComponent/FormComponent.stories.mdx +184 -0
  15. package/dist/components/FormComponent/FormComponent.test.js +226 -0
  16. package/dist/components/FormComponent/helpers/addLabel.js +5 -4
  17. package/dist/components/FormComponent/helpers/getComponentFieldSet.js +16 -0
  18. package/dist/components/FormComponent/helpers/getComponentFieldSet.test.js +29 -0
  19. package/dist/components/FormComponent/helpers/index.js +8 -1
  20. package/dist/components/FormPage/FormPage.js +69 -30
  21. package/dist/components/FormPage/FormPage.stories.mdx +155 -0
  22. package/dist/components/FormPage/FormPage.test.js +330 -0
  23. package/dist/components/FormRenderer/FormRenderer.js +142 -228
  24. package/dist/components/FormRenderer/FormRenderer.stories.mdx +183 -0
  25. package/dist/components/FormRenderer/FormRenderer.test.js +968 -0
  26. package/dist/components/FormRenderer/handlers/index.js +1 -2
  27. package/dist/components/FormRenderer/handlers/navigate.js +3 -1
  28. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +35 -14
  29. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +88 -5
  30. package/dist/components/FormRenderer/helpers/getCYA.js +11 -2
  31. package/dist/components/FormRenderer/helpers/getNextPageId.js +13 -7
  32. package/dist/components/FormRenderer/helpers/getRelevantPages.js +10 -2
  33. package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +1 -1
  34. package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +2 -2
  35. package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +6 -2
  36. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +171 -51
  37. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +307 -24
  38. package/dist/components/FormRenderer/helpers/index.js +1 -2
  39. package/dist/components/FormRenderer/onCYAAction.js +108 -0
  40. package/dist/components/FormRenderer/onCYAAction.test.js +583 -0
  41. package/dist/components/FormRenderer/onPageAction.js +145 -0
  42. package/dist/components/FormRenderer/onPageAction.test.js +678 -0
  43. package/dist/components/FormRenderer/onTaskAction.js +48 -0
  44. package/dist/components/FormRenderer/onTaskAction.test.js +217 -0
  45. package/dist/components/PageActions/ActionButton.js +0 -3
  46. package/dist/components/PageActions/ActionButton.test.js +93 -0
  47. package/dist/components/PageActions/PageActions.js +2 -2
  48. package/dist/components/PageActions/PageActions.stories.mdx +74 -0
  49. package/dist/components/PageActions/PageActions.test.js +132 -0
  50. package/dist/components/SummaryList/GroupAction.js +2 -2
  51. package/dist/components/SummaryList/GroupAction.test.js +80 -0
  52. package/dist/components/SummaryList/RowAction.js +2 -2
  53. package/dist/components/SummaryList/RowAction.test.js +80 -0
  54. package/dist/components/SummaryList/SummaryList.js +29 -12
  55. package/dist/components/SummaryList/SummaryList.scss +19 -0
  56. package/dist/components/SummaryList/SummaryList.stories.mdx +90 -0
  57. package/dist/components/SummaryList/SummaryList.test.js +400 -0
  58. package/dist/components/SummaryList/SummaryListHeadingRow.js +30 -0
  59. package/dist/components/SummaryList/SummaryListRow.js +5 -2
  60. package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +2 -1
  61. package/dist/components/SummaryList/helpers/getRowActionAttributes.js +2 -1
  62. package/dist/components/TaskList/Task.js +3 -3
  63. package/dist/components/TaskList/Task.test.js +167 -0
  64. package/dist/components/TaskList/TaskList.js +73 -22
  65. package/dist/components/TaskList/TaskList.stories.mdx +164 -0
  66. package/dist/components/TaskList/TaskList.test.js +389 -0
  67. package/dist/components/TaskList/TaskState.js +2 -2
  68. package/dist/components/TaskList/TaskState.test.js +86 -0
  69. package/dist/components/index.js +14 -0
  70. package/dist/context/HooksContext/HooksContext.js +72 -8
  71. package/dist/context/HooksContext/HooksContext.test.js +44 -0
  72. package/dist/context/ValidationContext/ValidationContext.js +38 -28
  73. package/dist/context/ValidationContext/ValidationContext.test.js +84 -0
  74. package/dist/hooks/useAxios.js +10 -12
  75. package/dist/hooks/useGetRequest.js +48 -49
  76. package/dist/hooks/useRefData.js +7 -4
  77. package/dist/index.js +34 -1
  78. package/dist/json/addressDetails.json +149 -0
  79. package/dist/json/areYouACivilServant.json +7 -0
  80. package/dist/json/firstForm.json +94 -0
  81. package/dist/json/grade.json +108 -0
  82. package/dist/json/group.data.json +21 -0
  83. package/dist/json/group.json +402 -0
  84. package/dist/json/groupOfRow.json +137 -0
  85. package/dist/json/groupOfRowData.json +15 -0
  86. package/dist/json/port.json +346 -0
  87. package/dist/json/saveAndContinue.json +98 -0
  88. package/dist/json/sublocation.json +859 -0
  89. package/dist/json/taskList.json +265 -0
  90. package/dist/json/team.json +17351 -0
  91. package/dist/json/terminal.json +81 -0
  92. package/dist/json/userProfile.data.json +21 -0
  93. package/dist/json/userProfile.json +276 -0
  94. package/dist/models/ComponentTypes.js +8 -0
  95. package/dist/models/PageAction.js +4 -1
  96. package/dist/models/TaskStates.js +10 -2
  97. package/dist/models/index.js +16 -1
  98. package/dist/setupTests.js +46 -0
  99. package/dist/utils/CheckYourAnswers/getCYAAction.js +5 -5
  100. package/dist/utils/CheckYourAnswers/getCYAAction.test.js +121 -0
  101. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +6 -2
  102. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +71 -0
  103. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +6 -2
  104. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +55 -0
  105. package/dist/utils/CheckYourAnswers/getCYARow.js +14 -11
  106. package/dist/utils/CheckYourAnswers/getCYARow.test.js +291 -0
  107. package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +4 -1
  108. package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +70 -0
  109. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +15 -10
  110. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +288 -0
  111. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +94 -36
  112. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +414 -0
  113. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +21 -7
  114. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +486 -0
  115. package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +11 -3
  116. package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +346 -0
  117. package/dist/utils/CheckYourAnswers/showComponentCYA.js +19 -3
  118. package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +143 -0
  119. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +5 -1
  120. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +40 -0
  121. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +53 -0
  122. package/dist/utils/CollectionPage/mergeCollectionPages.js +25 -17
  123. package/dist/utils/CollectionPage/mergeCollectionPages.test.js +130 -0
  124. package/dist/utils/Component/addShowWhen.js +44 -0
  125. package/dist/utils/Component/addShowWhen.test.js +216 -0
  126. package/dist/utils/Component/applyToComponentTree.js +71 -0
  127. package/dist/utils/Component/applyToComponentTree.test.js +127 -0
  128. package/dist/utils/Component/cleanAttributes.js +8 -2
  129. package/dist/utils/Component/cleanAttributes.test.js +68 -0
  130. package/dist/utils/Component/elevateNestedComponents.js +4 -1
  131. package/dist/utils/Component/elevateNestedComponents.test.js +122 -0
  132. package/dist/utils/Component/getComponent.js +80 -11
  133. package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +4 -4
  134. package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +25 -24
  135. package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +66 -5
  136. package/dist/utils/Component/getComponentTests/getComponent.date.test.js +2 -2
  137. package/dist/utils/Component/getComponentTests/getComponent.details.test.js +9 -7
  138. package/dist/utils/Component/getComponentTests/getComponent.email.test.js +3 -3
  139. package/dist/utils/Component/getComponentTests/getComponent.file.test.js +3 -3
  140. package/dist/utils/Component/getComponentTests/getComponent.list.test.js +44 -0
  141. package/dist/utils/Component/getComponentTests/{getComponent.textarea.test.js → getComponent.multifile.test.js} +29 -21
  142. package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +159 -83
  143. package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +43 -0
  144. package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +3 -3
  145. package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +55 -5
  146. package/dist/utils/Component/getComponentTests/getComponent.select.test.js +3 -9
  147. package/dist/utils/Component/getComponentTests/getComponent.text.test.js +3 -3
  148. package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +109 -0
  149. package/dist/utils/Component/getComponentTests/getComponent.time.test.js +7 -7
  150. package/dist/utils/Component/getDefaultValue.js +4 -1
  151. package/dist/utils/Component/getDefaultValue.test.js +50 -0
  152. package/dist/utils/Component/index.js +2 -0
  153. package/dist/utils/Component/isEditable.js +2 -2
  154. package/dist/utils/Component/isEditable.test.js +43 -0
  155. package/dist/utils/Component/optionIsSelected.js +22 -0
  156. package/dist/utils/Component/optionIsSelected.test.js +42 -0
  157. package/dist/utils/Component/setupContainerComponentsPath.js +40 -0
  158. package/dist/utils/Component/setupContainerComponentsPath.test.js +78 -0
  159. package/dist/utils/Component/showComponent.test.js +156 -0
  160. package/dist/utils/Component/wrapInFormGroup.js +1 -1
  161. package/dist/utils/Condition/meetsAllConditions.js +1 -1
  162. package/dist/utils/Condition/meetsAllConditions.test.js +61 -0
  163. package/dist/utils/Condition/meetsCondition.js +74 -4
  164. package/dist/utils/Condition/meetsCondition.test.js +763 -0
  165. package/dist/utils/Condition/meetsOneCondition.js +1 -1
  166. package/dist/utils/Condition/meetsOneCondition.test.js +100 -0
  167. package/dist/utils/Condition/setupConditions.js +6 -3
  168. package/dist/utils/Condition/setupConditions.test.js +33 -0
  169. package/dist/utils/Container/getEditableComponents.test.js +135 -0
  170. package/dist/utils/Container/setupNesting.js +21 -2
  171. package/dist/utils/Container/setupNesting.test.js +145 -0
  172. package/dist/utils/Container/showContainer.test.js +178 -0
  173. package/dist/utils/Data/applyFormula.js +20 -11
  174. package/dist/utils/Data/applyFormula.test.js +263 -0
  175. package/dist/utils/Data/getAutocompleteSource.js +6 -2
  176. package/dist/utils/Data/getAutocompleteSource.test.js +352 -0
  177. package/dist/utils/Data/getDataPath.test.js +48 -0
  178. package/dist/utils/Data/getOptions.js +17 -3
  179. package/dist/utils/Data/getOptions.test.js +140 -0
  180. package/dist/utils/Data/getSourceData.js +2 -2
  181. package/dist/utils/Data/getSourceData.test.js +153 -0
  182. package/dist/utils/Data/refDataToOptions.js +4 -1
  183. package/dist/utils/Data/refDataToOptions.test.js +196 -0
  184. package/dist/utils/Data/setDataItem.test.js +110 -0
  185. package/dist/utils/Data/setupFormData.js +39 -16
  186. package/dist/utils/Data/setupFormData.test.js +410 -0
  187. package/dist/utils/Data/setupRefDataUrlForComponent.js +4 -1
  188. package/dist/utils/Data/setupRefDataUrlForComponent.test.js +131 -0
  189. package/dist/utils/FormPage/applyConditionalProperties.js +35 -0
  190. package/dist/utils/FormPage/applyConditionalProperties.test.js +61 -0
  191. package/dist/utils/FormPage/getFormPage.js +5 -2
  192. package/dist/utils/FormPage/getFormPage.test.js +206 -0
  193. package/dist/utils/FormPage/getFormPages.js +4 -1
  194. package/dist/utils/FormPage/getFormPages.test.js +97 -0
  195. package/dist/utils/FormPage/getPageActions.js +8 -4
  196. package/dist/utils/FormPage/getPageActions.test.js +114 -0
  197. package/dist/utils/FormPage/getParagraphFromText.test.js +27 -0
  198. package/dist/utils/FormPage/index.js +2 -0
  199. package/dist/utils/FormPage/showFormPage.js +2 -2
  200. package/dist/utils/FormPage/showFormPage.test.js +180 -0
  201. package/dist/utils/FormPage/showFormPageCYA.js +1 -0
  202. package/dist/utils/FormPage/showFormPageCYA.test.js +28 -0
  203. package/dist/utils/FormPage/useComponent.js +29 -14
  204. package/dist/utils/FormPage/useComponent.test.js +167 -0
  205. package/dist/utils/Format/formatData.test.js +45 -0
  206. package/dist/utils/Format/formatDataForComponent.js +2 -1
  207. package/dist/utils/Format/formatDataForComponent.test.js +142 -0
  208. package/dist/utils/Format/formatDataForForm.js +4 -1
  209. package/dist/utils/Format/formatDataForForm.test.js +81 -0
  210. package/dist/utils/Format/formatDataForPage.test.js +99 -0
  211. package/dist/utils/Hub/getFormHub.test.js +105 -0
  212. package/dist/utils/Meta/documents/getDocuments.test.js +4 -1
  213. package/dist/utils/Meta/documents/index.js +2 -2
  214. package/dist/utils/Meta/documents/setDocumentsForField.js +31 -0
  215. package/dist/utils/Meta/documents/setDocumentsForField.test.js +59 -0
  216. package/dist/utils/Operate/checkValueIsTruthy.test.js +42 -0
  217. package/dist/utils/Operate/getFirstOf.js +31 -0
  218. package/dist/utils/Operate/getFirstOf.test.js +86 -0
  219. package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +163 -0
  220. package/dist/utils/Operate/persistValueInFormData.js +2 -1
  221. package/dist/utils/Operate/persistValueInFormData.test.js +115 -0
  222. package/dist/utils/Operate/runPageOperations.js +3 -1
  223. package/dist/utils/Operate/runPageOperations.test.js +105 -0
  224. package/dist/utils/Operate/setValueInFormData.test.js +44 -0
  225. package/dist/utils/Operate/shouldRun.js +16 -13
  226. package/dist/utils/Operate/shouldRun.test.js +66 -0
  227. package/dist/utils/Validate/additional/conditionallyRequired.js +24 -0
  228. package/dist/utils/Validate/additional/conditionallyRequired.test.js +73 -0
  229. package/dist/utils/Validate/additional/index.js +13 -4
  230. package/dist/utils/Validate/additional/mustBeAfter.js +8 -6
  231. package/dist/utils/Validate/additional/mustBeAfter.test.js +15 -1
  232. package/dist/utils/Validate/additional/mustBeBefore.js +9 -5
  233. package/dist/utils/Validate/additional/mustBeBefore.test.js +14 -0
  234. package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +1 -1
  235. package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +6 -3
  236. package/dist/utils/Validate/additional/mustBeGreaterThan.js +22 -0
  237. package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +56 -0
  238. package/dist/utils/Validate/additional/mustBeInTheFuture.js +1 -1
  239. package/dist/utils/Validate/additional/mustBeInThePast.js +5 -5
  240. package/dist/utils/Validate/additional/mustBeLessThan.js +7 -6
  241. package/dist/utils/Validate/additional/mustBeLessThan.test.js +11 -1
  242. package/dist/utils/Validate/additional/mustBeNumbersOnly.js +9 -5
  243. package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +10 -2
  244. package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +1 -0
  245. package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +4 -1
  246. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +19 -0
  247. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +36 -0
  248. package/dist/utils/Validate/additional/mustSelectOnlyOne.js +29 -0
  249. package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +52 -0
  250. package/dist/utils/Validate/additional/utils.js +18 -18
  251. package/dist/utils/Validate/index.js +6 -0
  252. package/dist/utils/Validate/validateCollection.js +20 -5
  253. package/dist/utils/Validate/validateCollection.test.js +125 -0
  254. package/dist/utils/Validate/validateComponent.js +36 -20
  255. package/dist/utils/Validate/validateComponent.test.js +365 -0
  256. package/dist/utils/Validate/validateContainer.js +9 -3
  257. package/dist/utils/Validate/validateContainer.test.js +75 -0
  258. package/dist/utils/Validate/validateDate.js +4 -3
  259. package/dist/utils/Validate/validateDate.test.js +114 -0
  260. package/dist/utils/Validate/validateEmail.js +14 -1
  261. package/dist/utils/Validate/validateEmail.test.js +74 -0
  262. package/dist/utils/Validate/validateMultifile.js +32 -0
  263. package/dist/utils/Validate/validateMultifile.test.js +47 -0
  264. package/dist/utils/Validate/validatePage.js +12 -6
  265. package/dist/utils/Validate/validatePage.test.js +472 -0
  266. package/dist/utils/Validate/validateRegex.js +2 -5
  267. package/dist/utils/Validate/validateRegex.test.js +42 -0
  268. package/dist/utils/Validate/validateRequired.js +2 -4
  269. package/dist/utils/Validate/validateRequired.test.js +63 -0
  270. package/dist/utils/Validate/validateTextArea.js +37 -0
  271. package/dist/utils/Validate/validateTextArea.test.js +42 -0
  272. package/dist/utils/Validate/validateTime.js +2 -2
  273. package/dist/utils/Validate/validateTime.test.js +59 -0
  274. package/dist/utils/index.js +4 -1
  275. package/package.json +35 -50
  276. package/dist/utils/Meta/documents/setDocumentForField.js +0 -29
  277. package/dist/utils/Meta/documents/setDocumentForField.test.js +0 -49
@@ -0,0 +1,21 @@
1
+ {
2
+ "urls": {
3
+ "refData": "/ref-data"
4
+ },
5
+ "currentUser": {
6
+ "givenName": "John",
7
+ "familyName": "Smith"
8
+ },
9
+ "areYouACivilServant": "yes",
10
+ "userDetails": {
11
+ "linemanagerEmail": "line.manager@digital.homeoffice.gov.uk",
12
+ "delegateEmails": "del.egate@digital.homeoffice.gov.uk"
13
+ },
14
+ "addressDetails": {
15
+ "firstLineOfTheAddress": "10 Downing Street",
16
+ "city": "London",
17
+ "town": "City of Westminster",
18
+ "postCode": "SW1A 2AA"
19
+ },
20
+ "businessKey": "123456789"
21
+ }
@@ -0,0 +1,402 @@
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
+ "pages": [
197
+ {
198
+ "id": "names",
199
+ "name": "names",
200
+ "components": [
201
+ {
202
+ "use": "firstName"
203
+ },
204
+ {
205
+ "use": "surname"
206
+ }
207
+ ]
208
+ },
209
+ {
210
+ "id": "civil-servant-status",
211
+ "name": "civil-servant-status",
212
+ "title": "Are you a civil servant?",
213
+ "components": [
214
+ {
215
+ "use": "areYouACivilServant",
216
+ "label": ""
217
+ }
218
+ ],
219
+ "actions": ["submit"],
220
+ "cya_link": {
221
+ "page": "civil-servant-status",
222
+ "aria_suffix": "civil servant status"
223
+ }
224
+ },
225
+ {
226
+ "id": "grade",
227
+ "name": "grade",
228
+ "title": "What's your grade?",
229
+ "components": [
230
+ {
231
+ "use": "staffGradeId",
232
+ "label": ""
233
+ }
234
+ ],
235
+ "actions": ["submit"],
236
+ "cya_link": {
237
+ "page": "grade",
238
+ "aria_suffix": "grade"
239
+ }
240
+ },
241
+ {
242
+ "id": "team-name",
243
+ "name": "team-name",
244
+ "title": "What's your team name?",
245
+ "components": [
246
+ {
247
+ "use": "team",
248
+ "label": ""
249
+ }
250
+ ],
251
+ "actions": ["submit"],
252
+ "cya_link": {
253
+ "page": "team-name",
254
+ "aria_suffix": "teams"
255
+ }
256
+ },
257
+ {
258
+ "id": "add-or-change-line-manager",
259
+ "name": "add-or-change-line-manager",
260
+ "title": "Add or change a line manager",
261
+ "components": [
262
+ "Your line manager will need to review some of your forms. It’s important to keep their details up-to-date.",
263
+ "An email will be sent to your line manager to ask if they want to approve your request to add them.",
264
+ {
265
+ "type": "inset-text",
266
+ "content": "The changes will show in your profile when they approve your request."
267
+ },
268
+ {
269
+ "type": "heading",
270
+ "size": "m",
271
+ "content": "Mandatory declarations"
272
+ },
273
+ "Mandatory declarations will not go to your line manager until they have approved your request."
274
+ ],
275
+ "actions": [
276
+ {
277
+ "type": "navigate",
278
+ "page": "line-manager-email"
279
+ }
280
+ ],
281
+ "show_on_cya": false
282
+ },
283
+ {
284
+ "id": "line-manager-email",
285
+ "name": "line-manager-email",
286
+ "title": "What’s your line manager’s email address?",
287
+ "components": [
288
+ {
289
+ "use": "linemanagerEmail"
290
+ }
291
+ ],
292
+ "actions": ["submit"],
293
+ "cya_link": {
294
+ "page": "add-or-change-line-manager",
295
+ "aria_suffix": "line manager email address"
296
+ }
297
+ },
298
+ {
299
+ "id": "add-or-change-delegate",
300
+ "name": "add-or-change-delegate",
301
+ "title": "Add or change a delegate",
302
+ "components": [
303
+ "A delegate can review a mandatory declaration on your behalf.",
304
+ "An email will be sent to the delegate to ask if they want to approve your request.",
305
+ {
306
+ "type": "inset-text",
307
+ "content": "The changes will show in your profile when they approve your request."
308
+ }
309
+ ],
310
+ "actions": [
311
+ {
312
+ "type": "navigate",
313
+ "page": "delegate-email"
314
+ }
315
+ ],
316
+ "show_on_cya": false
317
+ },
318
+ {
319
+ "id": "delegate-email",
320
+ "name": "delegate-email",
321
+ "title": "What’s your delegate's email address?",
322
+ "components": [
323
+ {
324
+ "use": "delegateEmails",
325
+ "label": "Delegate email address"
326
+ },
327
+ {
328
+ "use": "delegateEmails",
329
+ "label": "Delegate email address"
330
+ }
331
+ ],
332
+ "actions": ["submit"],
333
+ "cya_link": {
334
+ "page": "add-or-change-delegate"
335
+ },
336
+ "show_when": [
337
+ {
338
+ "field": "areYouACivilServant",
339
+ "op": "eq",
340
+ "value": "yes"
341
+ },
342
+ {
343
+ "field": "staffGradeId",
344
+ "op": "in",
345
+ "values": [
346
+ "373979c1-2360-46be-b712-0409ac068059",
347
+ "36c80dfe-0aae-455b-9445-2e1c09dcafdc",
348
+ "1b041cda-b151-4769-b76a-d42d67b0b960",
349
+ "172de41d-f7b0-4be9-b7e8-0cf4f1a1342f",
350
+ "39e18b45-0358-4a45-83ec-5a70b74641e8"
351
+ ]
352
+ }
353
+ ]
354
+ },
355
+
356
+ {
357
+ "id": "address-details",
358
+ "groupLabel": "UK address",
359
+ "fieldId": "UK address",
360
+ "groups": [
361
+ {
362
+ "id": "address",
363
+ "label": "Address details",
364
+ "required": true,
365
+ "components": ["firstLineOfTheAddress", "town", "city", "postCode"]
366
+ }
367
+ ],
368
+ "name": "address-details",
369
+ "title": "Address details",
370
+ "components": [
371
+ {
372
+ "use": "firstLineOfTheAddress",
373
+ "label": "Address"
374
+ },
375
+ {
376
+ "use": "town",
377
+ "label": "Town"
378
+ },
379
+ {
380
+ "use": "city",
381
+ "label": "City"
382
+ },
383
+ {
384
+ "use": "postCode",
385
+ "label": "Postcode"
386
+ }
387
+ ],
388
+ "actions": ["saveAndContinue", "saveAndReturn"],
389
+ "cya_link": {
390
+ "url": "/address-details",
391
+ "aria_suffix": "address details"
392
+ }
393
+ }
394
+ ],
395
+ "hub": {
396
+ "format": "CYA"
397
+ },
398
+ "cya": {
399
+ "hide_page_titles": true,
400
+ "hide_actions": true
401
+ }
402
+ }
@@ -0,0 +1,137 @@
1
+ {
2
+ "id": "cop-secondForm",
3
+ "version": "1",
4
+ "name": "cop-secondForm",
5
+ "title": "Cop - Second Form",
6
+ "type": "cya",
7
+ "components": [
8
+ {
9
+ "id": "firstName",
10
+ "fieldId": "firstName",
11
+ "label": "First name",
12
+ "type": "text",
13
+ "readonly": false
14
+ },
15
+ {
16
+ "id": "surname",
17
+ "fieldId": "surname",
18
+ "label": "Last name",
19
+ "type": "text",
20
+ "readonly": false
21
+ },
22
+ {
23
+ "id": "dateGroup",
24
+ "fieldId": "dateGroup",
25
+ "label": "Date",
26
+ "type": "date",
27
+ "required": true,
28
+ "readonly": false
29
+ },
30
+ {
31
+ "id": "timeGroup",
32
+ "fieldId": "timeGroup",
33
+ "label": "Time",
34
+ "type": "time",
35
+ "required": true,
36
+ "readonly": false
37
+ },
38
+ {
39
+ "id": "portGroup",
40
+ "fieldId": "portGroup",
41
+ "label": "Port",
42
+ "type": "text",
43
+ "required": true,
44
+ "readonly": false
45
+ },
46
+ {
47
+ "id": "whereGroup",
48
+ "fieldId": "whereGroup",
49
+ "label": "Where did you see the incident take place",
50
+ "type": "text",
51
+ "required": true,
52
+ "readonly": false
53
+ },
54
+ {
55
+ "id": "extraDetails",
56
+ "fieldId": "extraDetails",
57
+ "label": "Extra details",
58
+ "type": "textarea",
59
+ "readonly": false
60
+ }
61
+ ],
62
+ "pages": [
63
+ {
64
+ "id": "names",
65
+ "name": "names",
66
+ "title": "Name",
67
+ "components": [
68
+ {
69
+ "use": "firstName"
70
+ },
71
+ {
72
+ "use": "surname"
73
+ }
74
+ ],
75
+ "cya_link": {
76
+ "page": "names",
77
+ "aria_suffix": "names"
78
+ },
79
+ "actions": [ "saveAndContinue", "saveAndReturn" ]
80
+ },
81
+ {
82
+ "id": "dateLocDet",
83
+ "name": "dateLocDetName",
84
+ "title": "Date and location details",
85
+ "components": [
86
+ {
87
+ "use": "dateGroup"
88
+ },
89
+ {
90
+ "use": "timeGroup"
91
+ },
92
+ {
93
+ "use": "portGroup"
94
+ },
95
+ {
96
+ "use": "whereGroup"
97
+ }
98
+ ],
99
+ "cya_link": {
100
+ "page": "dateLocDet",
101
+ "aria_suffix": "Date and location details"
102
+ },
103
+ "actions": [ "saveAndContinue", "saveAndReturn" ]
104
+ },
105
+ {
106
+ "id": "additional-info",
107
+ "name": "additional-info",
108
+ "title": "Additional Information",
109
+ "components": [
110
+ {
111
+ "use": "extraDetails"
112
+ }
113
+ ],
114
+ "cya_link": {
115
+ "page": "additional-info",
116
+ "aria_suffix": "Additional Information"
117
+ },
118
+ "actions": [ "saveAndContinue", "saveAndReturn" ]
119
+ }
120
+ ],
121
+ "cya": {
122
+ "hide_page_titles": false,
123
+ "hide_actions": false,
124
+ "groups": [
125
+ {
126
+ "pageId": "dateLocDet"
127
+ },
128
+ {
129
+ "pageId": "names",
130
+ "title": "Names"
131
+ }
132
+ ],
133
+ "actions": [
134
+ { "type": "submit", "label": "Submit", "validate": true }
135
+ ]
136
+ }
137
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "currentUser": {
3
+ "givenName": "John",
4
+ "familyName": "Smith"
5
+ },
6
+ "businessKey": "123456789",
7
+ "dateGroupField": "01-01-2022",
8
+ "timeGroupField": "14:57",
9
+ "portGroupField": "Glasgow",
10
+ "whereGroupField": "terminal",
11
+ "firstName": "sample",
12
+ "surname": "test",
13
+ "age": "12",
14
+ "extraDetails": "extra notes here"
15
+ }