@ukhomeoffice/cop-react-form-renderer 6.15.7-alpha → 6.15.8-alpha

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 (15) hide show
  1. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-hidden-component-show-when-in-component-and-page.json +62 -0
  2. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/form-hidden-page-same-component-reused.json +61 -0
  3. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/cop-airpax-change-what-happened-before.json +300 -0
  4. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-hidden-component-show-when-in-component-and-page.json +6 -0
  5. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/data-hidden-page-same-component-reused.json +6 -0
  6. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/cop-airpax-change-what-happened-after.json +280 -0
  7. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-hidden-component-show-when-in-component-and-page-removed.json +5 -0
  8. package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/output/data-hidden-page-same-component-reused-removed.json +5 -0
  9. package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.js +84 -189
  10. package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.test.js +64 -27
  11. package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.js +290 -0
  12. package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.test.js +502 -0
  13. package/package.json +1 -1
  14. package/dist/components/FormRenderer/helpers/deleteNodeByPath.js +0 -29
  15. package/dist/components/FormRenderer/helpers/deleteNodeByPath.test.js +0 -56
@@ -0,0 +1,62 @@
1
+ {
2
+ "id": "example-form",
3
+ "version": "0.0.1",
4
+ "name": "example-form",
5
+ "title": "Example form",
6
+ "type": "form",
7
+ "components": [
8
+ {
9
+ "id": "alpha",
10
+ "fieldId": "alpha",
11
+ "label": "Alpha",
12
+ "type": "text"
13
+ },
14
+ {
15
+ "id": "bravo",
16
+ "fieldId": "bravo",
17
+ "label": "Bravo",
18
+ "type": "text"
19
+ },
20
+ {
21
+ "id": "charlie",
22
+ "fieldId": "charlie",
23
+ "label": "Charlie",
24
+ "type": "text"
25
+ }
26
+ ],
27
+ "pages": [
28
+ {
29
+ "id": "general",
30
+ "name": "general",
31
+ "title": "General information",
32
+ "components": [
33
+ {
34
+ "use": "alpha"
35
+ },
36
+ {
37
+ "use": "bravo",
38
+ "show_when": {
39
+ "op": "=",
40
+ "field": "alpha",
41
+ "value": "NOT-alpha-value"
42
+ }
43
+ }
44
+ ],
45
+ "show_when": {
46
+ "op": "=",
47
+ "field": "charlie",
48
+ "value": "charlie-value"
49
+ }
50
+ },
51
+ {
52
+ "id": "Charlie-page",
53
+ "name": "Charlie-page",
54
+ "title": "Charlie-page",
55
+ "components": [
56
+ {
57
+ "use": "charlie"
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "id": "example-form",
3
+ "version": "0.0.1",
4
+ "name": "example-form",
5
+ "title": "Example form",
6
+ "type": "form",
7
+ "components": [
8
+ {
9
+ "id": "alpha",
10
+ "fieldId": "alpha",
11
+ "label": "Alpha",
12
+ "type": "text"
13
+ },
14
+ {
15
+ "id": "bravo",
16
+ "fieldId": "bravo",
17
+ "label": "Bravo",
18
+ "type": "text"
19
+ }
20
+ ],
21
+ "pages": [
22
+ {
23
+ "id": "visiblePage",
24
+ "name": "visiblePage",
25
+ "title": "Visible Page",
26
+ "components": [
27
+ {
28
+ "use": "alpha"
29
+ }
30
+ ]
31
+ },
32
+ {
33
+ "id": "hiddenPage",
34
+ "name": "hiddenPage",
35
+ "title": "Hidden Page",
36
+ "components": [
37
+ {
38
+ "use": "bravo",
39
+ "show_when": {
40
+ "op": "=",
41
+ "field": "externalCondition1",
42
+ "value": "externalCondition1-value"
43
+ }
44
+ },
45
+ {
46
+ "use": "bravo",
47
+ "show_when": {
48
+ "op": "=",
49
+ "field": "externalCondition2",
50
+ "value": "externalCondition2-value"
51
+ }
52
+ }
53
+ ],
54
+ "show_when": {
55
+ "op": "=",
56
+ "field": "alpha",
57
+ "value": "NOT-alpha-value"
58
+ }
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,300 @@
1
+ {
2
+ "id": "9a2aae86-e3c7-11ef-b502-56ecdccac0eb",
3
+ "businessKey": "DEV-20250205-1041",
4
+ "modeOfTransport": {
5
+ "id": 2,
6
+ "mode": "Scheduled Air Passenger",
7
+ "modecode": "airpass",
8
+ "crossingtype": [
9
+ "air"
10
+ ],
11
+ "value": "Scheduled Air Passenger",
12
+ "label": "Scheduled Air Passenger"
13
+ },
14
+ "port": {
15
+ "id": 3415,
16
+ "name": "Luton",
17
+ "sea": false,
18
+ "air": true,
19
+ "land": false,
20
+ "rail": false,
21
+ "countryid": 234,
22
+ "iata": "LTN",
23
+ "value": "3415",
24
+ "label": "Luton",
25
+ "hint": ""
26
+ },
27
+ "formStatus": {
28
+ "tasks": {
29
+ "undefined": {},
30
+ "event-summary-airpassenger": {
31
+ "complete": true,
32
+ "currentPage": "event-summary-check-answers"
33
+ },
34
+ "item-seals-abandoned": {
35
+ "complete": true,
36
+ "currentPage": "what-happens-next"
37
+ },
38
+ "journey-details-airpax": {
39
+ "complete": true,
40
+ "currentPage": "journey-check-answers"
41
+ },
42
+ "submit-airpax": {
43
+ "complete": false,
44
+ "currentPage": "submit-form"
45
+ }
46
+ },
47
+ "taskPage": "submit-form"
48
+ },
49
+ "whatHappened": "items",
50
+ "formInstanceId": "e1795627-b40e-4ac6-bfb2-5bf3f10ff126",
51
+ "links": [
52
+ {
53
+ "method": "GET",
54
+ "href": "https://green.dev.cop.homeoffice.gov.uk/camunda/engine-rest/process-instance/9a2aae86-e3c7-11ef-b502-56ecdccac0eb",
55
+ "rel": "self"
56
+ }
57
+ ],
58
+ "definitionId": "cop-addABorderEvent:3:08744e1c-8ba1-11ef-87e2-66391f301ad1",
59
+ "caseInstanceId": null,
60
+ "ended": false,
61
+ "suspended": false,
62
+ "tenantId": null,
63
+ "eventDateTime": {
64
+ "eventDate": "05-02-2025",
65
+ "eventTime": "12:12"
66
+ },
67
+ "terminal": {
68
+ "id": 8,
69
+ "name": "Eastern Docks",
70
+ "validfrom": "2019-01-01T00:01:00.000Z",
71
+ "validto": null,
72
+ "updatedby": null,
73
+ "value": "8",
74
+ "label": "Eastern Docks",
75
+ "hint": ""
76
+ },
77
+ "subLocation": {
78
+ "id": 19,
79
+ "sublocation": "Arrival Lounge",
80
+ "description": null,
81
+ "validfrom": "2021-05-07T00:00:03.000Z",
82
+ "validto": null,
83
+ "updatedby": "BethStephenson",
84
+ "uoflocation": false,
85
+ "value": "19",
86
+ "label": "Arrival Lounge",
87
+ "hint": ""
88
+ },
89
+ "operationOrExercise": "no",
90
+ "centaurReference": "E1234567",
91
+ "leadOfficerEmail": {
92
+ "email": "philip.harvey@digital.homeoffice.gov.uk",
93
+ "label": "philip.harvey@digital.homeoffice.gov.uk",
94
+ "value": "philip.harvey@digital.homeoffice.gov.uk",
95
+ "defaultteamid": "cf576f61-26cd-4862-92e1-2d5cfc050c2d"
96
+ },
97
+ "officerEmails": [],
98
+ "whoDecidedSelection": "borderForceOfficer",
99
+ "whyWasPassengerStoppedArray": [
100
+ {
101
+ "id": "2df7d599-a3fc-4c91-818f-afce7682b974",
102
+ "reason": {
103
+ "label": "Baggage - abandoned baggage",
104
+ "value": "baggageAbandoned",
105
+ "synonyms": [
106
+ "luggage",
107
+ "left",
108
+ "leave",
109
+ "without"
110
+ ],
111
+ "hint": ""
112
+ }
113
+ }
114
+ ],
115
+ "itemsActiveId": "5034aaef-010b-4cca-9b83-15a679da0049",
116
+ "items": [
117
+ {
118
+ "id": "5034aaef-010b-4cca-9b83-15a679da0049",
119
+ "sealNumber": "E1235612",
120
+ "itemCategory": {
121
+ "id": 6,
122
+ "category": "Alcohol",
123
+ "description": "Beers, Wines, Spirits etc.",
124
+ "validfrom": "2023-01-10T00:00:01.000Z",
125
+ "validto": null,
126
+ "updatedby": "Mohammed Abdul Odud",
127
+ "synonyms": [
128
+ "'Beer'",
129
+ "'Wines'",
130
+ "'Spirits'"
131
+ ],
132
+ "value": "6",
133
+ "label": "Alcohol",
134
+ "hint": ""
135
+ },
136
+ "itemSubCategory": {
137
+ "id": 1795,
138
+ "name": "Alcohol distiller",
139
+ "description": null,
140
+ "itemcategoriesid": 6,
141
+ "cites": false,
142
+ "poao": false,
143
+ "cbrn": false,
144
+ "document": false,
145
+ "tobacco": false,
146
+ "alcohol": true,
147
+ "weapons": false,
148
+ "firearms": false,
149
+ "ipr": true,
150
+ "strategic": false,
151
+ "avtc": false,
152
+ "oils": false,
153
+ "commodity": false,
154
+ "good": true,
155
+ "plant": false,
156
+ "animal": false,
157
+ "drugs": false,
158
+ "financial": false,
159
+ "indecent": false,
160
+ "vehicle": false,
161
+ "medical": false,
162
+ "unitid": 5,
163
+ "seizureqty": null,
164
+ "ienqty": null,
165
+ "validfrom": "2023-01-10T00:00:01.000Z",
166
+ "validto": null,
167
+ "updatedby": "Mohammed Abdul Odud",
168
+ "uof": false,
169
+ "epmscode": 1037,
170
+ "epmscategory": "ALP",
171
+ "unitarray": [
172
+ 5
173
+ ],
174
+ "categoryarray": [
175
+ 6,
176
+ 9,
177
+ 14
178
+ ],
179
+ "lethalfirearm": null,
180
+ "nonlethalfirearm": null,
181
+ "value": "1795",
182
+ "label": "Alcohol distiller",
183
+ "hint": ""
184
+ },
185
+ "seizedOrDetained": "seized",
186
+ "legalReasonForSeizing": {
187
+ "id": 1,
188
+ "epmsvalue": 2,
189
+ "reason": "CEMA",
190
+ "description": "Customs and excise management act 1979",
191
+ "validfrom": "2022-09-21T00:00:01.000Z",
192
+ "validto": null,
193
+ "updatedby": "Mohammed Abdul Odud",
194
+ "value": "1",
195
+ "label": "Customs and excise management act 1979",
196
+ "hint": ""
197
+ },
198
+ "detectionTechnologies": [
199
+ {
200
+ "id": "54600601-4f78-450d-bdee-2290b7aa4d09",
201
+ "detectionTechnology": {
202
+ "id": 5,
203
+ "name": "Automatic Number Plate Recognition",
204
+ "value": "5",
205
+ "label": "Automatic Number Plate Recognition",
206
+ "hint": ""
207
+ }
208
+ }
209
+ ],
210
+ "searchTechniques": [
211
+ {
212
+ "id": "54600601-4f78-450d-bdee-2290b7aa4d09",
213
+ "searchTechnique": {
214
+ "id": 27,
215
+ "type": "Baggage",
216
+ "value": "27",
217
+ "label": "Baggage",
218
+ "hint": ""
219
+ }
220
+ }
221
+ ],
222
+ "concealmentMethods": [
223
+ {
224
+ "id": "2e98b018-99ff-440d-88fa-ee630dbc7a19",
225
+ "concealmentMethod": {
226
+ "id": 24,
227
+ "method": "Air filter",
228
+ "value": "24",
229
+ "label": "Air filter",
230
+ "hint": ""
231
+ }
232
+ }
233
+ ],
234
+ "specialStorageConditions": {
235
+ "epmsvalue": 10,
236
+ "description": "Machinery",
237
+ "id": 10,
238
+ "value": "10",
239
+ "label": "Machinery",
240
+ "hint": ""
241
+ },
242
+ "brandText": "asd",
243
+ "make": "asd",
244
+ "unitOfMeasure": {
245
+ "id": 13,
246
+ "unit": "Number of items",
247
+ "validfrom": "2023-02-21T00:00:01.000Z",
248
+ "validto": null,
249
+ "updatedby": "Mohammed Abdul Odud",
250
+ "code": 5,
251
+ "epmsid": 9,
252
+ "decimal": false,
253
+ "shortname": null,
254
+ "value": "13",
255
+ "label": "Number of items"
256
+ },
257
+ "quantity": "122",
258
+ "itemDescription": "qwse qwe qwe qwe qwe qwe ",
259
+ "willTheItemBeStored": "no",
260
+ "whatIsTheInitialMovement?": {
261
+ "id": 2,
262
+ "epmscode": 4,
263
+ "description": "Retained by case officer",
264
+ "inuse": true,
265
+ "validfrom": "2022-08-18T00:00:01.000Z",
266
+ "validto": null,
267
+ "updatedby": "Mohammed Abdul Odud",
268
+ "value": "2",
269
+ "label": "Retained by case officer",
270
+ "hint": ""
271
+ },
272
+ "shouldThisItemBeDestroyed": "no",
273
+ "giveAReason": "sd asd asd asd ",
274
+ "specialHandlingInstructions": "no",
275
+ "hasAnotherAgencyAdoptedTheItem": "no",
276
+ "constructedOrAdapted": "no",
277
+ "doYouHavePhotosOfTheItemToAdd": "no"
278
+ }
279
+ ],
280
+ "lockup": {
281
+ "value": "LTN",
282
+ "label": "Luton Airport Lockup",
283
+ "hidden": true
284
+ },
285
+ "meta": {
286
+ "documents": []
287
+ },
288
+ "epmsSubmitted": true,
289
+ "doYouHaveTheirFlightNumber": "no",
290
+ "form": {
291
+ "formVersionId": "b1009648bfc7df2e5dcc565e953f8c48037d2648-20",
292
+ "title": "Add a border event",
293
+ "name": "cop-addABorderEvent",
294
+ "submissionDate": "2025-02-05T13:53:07.633Z",
295
+ "submittedBy": "philip.harvey@digital.homeoffice.gov.uk",
296
+ "submittingUsersName": "Phil",
297
+ "submissionTeam": "cf576f61-26cd-4862-92e1-2d5cfc050c2d",
298
+ "formInstanceId": "e1795627-b40e-4ac6-bfb2-5bf3f10ff126"
299
+ }
300
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "Example form",
3
+ "alpha": "alpha-value",
4
+ "bravo": "bravo-value",
5
+ "charlie": "charlie-value"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "alpha": "alpha-value",
3
+ "bravo": "bravo-value",
4
+ "externalCondition1": "externalCondition1-value",
5
+ "externalCondition2": "externalCondition2-value"
6
+ }