@ukhomeoffice/cop-react-form-renderer 6.15.11-alpha → 6.15.12-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.
- package/dist/components/FormComponent/FormComponent.js +6 -0
- package/dist/components/FormComponent/helpers/addLabel.js +3 -2
- package/dist/components/FormPage/FormPage.js +20 -7
- package/dist/components/FormPage/FormPage.test.js +53 -0
- package/dist/components/FormRenderer/FormRenderer.js +11 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/forms/cop-reassign-task-to-rcc.json +445 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/cop-airpax-carrier.json +407 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/reassign-to-rcc.json +72 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.js +26 -16
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.test.js +21 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutesUtils.js +15 -7
- package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +2 -1
- package/package.json +4 -4
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "09064153-0a33-11f0-b54d-da358d052ce4",
|
|
3
|
+
"businessKey": "DEV-20250326-890",
|
|
4
|
+
"port": {
|
|
5
|
+
"id": 3415,
|
|
6
|
+
"name": "Luton",
|
|
7
|
+
"sea": false,
|
|
8
|
+
"air": true,
|
|
9
|
+
"land": false,
|
|
10
|
+
"rail": false,
|
|
11
|
+
"countryid": 234,
|
|
12
|
+
"iata": "LTN",
|
|
13
|
+
"value": "3415",
|
|
14
|
+
"label": "Luton",
|
|
15
|
+
"hint": ""
|
|
16
|
+
},
|
|
17
|
+
"modeOfTransport": {
|
|
18
|
+
"id": 2,
|
|
19
|
+
"mode": "Scheduled Air Passenger",
|
|
20
|
+
"modecode": "airpass",
|
|
21
|
+
"crossingtype": [
|
|
22
|
+
"air"
|
|
23
|
+
],
|
|
24
|
+
"value": "Scheduled Air Passenger",
|
|
25
|
+
"label": "Scheduled Air Passenger"
|
|
26
|
+
},
|
|
27
|
+
"formStatus": {
|
|
28
|
+
"tasks": {
|
|
29
|
+
"undefined": {},
|
|
30
|
+
"event-summary-airpassenger": {
|
|
31
|
+
"complete": true,
|
|
32
|
+
"currentPage": "event-summary-check-answers"
|
|
33
|
+
},
|
|
34
|
+
"people": {
|
|
35
|
+
"complete": true,
|
|
36
|
+
"currentPage": "people"
|
|
37
|
+
},
|
|
38
|
+
"item-seals-itemsOnAPerson": {
|
|
39
|
+
"complete": true,
|
|
40
|
+
"currentPage": "what-happens-next"
|
|
41
|
+
},
|
|
42
|
+
"journey-details-airpax": {
|
|
43
|
+
"complete": false,
|
|
44
|
+
"currentPage": "how-paid-for-flight"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"taskPage": "how-paid-for-flight"
|
|
48
|
+
},
|
|
49
|
+
"whatHappened": "itemsOnAPerson",
|
|
50
|
+
"formInstanceId": "691fabd3-1d6d-4e57-8eb6-7181fed25bf1",
|
|
51
|
+
"links": [
|
|
52
|
+
{
|
|
53
|
+
"method": "GET",
|
|
54
|
+
"href": "https://www.dev.cop.homeoffice.gov.uk/camunda/engine-rest/process-instance/09064153-0a33-11f0-b54d-da358d052ce4",
|
|
55
|
+
"rel": "self"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"definitionId": "cop-addABorderEvent:9:2b437400-bd57-11ef-94a0-ce371e0b1bc5",
|
|
59
|
+
"caseInstanceId": null,
|
|
60
|
+
"ended": false,
|
|
61
|
+
"suspended": false,
|
|
62
|
+
"tenantId": null,
|
|
63
|
+
"eventDateTime": {
|
|
64
|
+
"eventDate": "26-03-2023",
|
|
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
|
+
"whoDecidedSelection": "borderForceOfficer",
|
|
98
|
+
"whyWasPassengerStoppedArray": [
|
|
99
|
+
{
|
|
100
|
+
"id": "b3093dc6-eac7-4cf3-b9d9-6794d1d82f2a",
|
|
101
|
+
"reason": {
|
|
102
|
+
"label": "Baggage - abandoned baggage",
|
|
103
|
+
"value": "baggageAbandoned",
|
|
104
|
+
"synonyms": [
|
|
105
|
+
"luggage",
|
|
106
|
+
"left",
|
|
107
|
+
"leave",
|
|
108
|
+
"without"
|
|
109
|
+
],
|
|
110
|
+
"hint": ""
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"form": {
|
|
115
|
+
"formVersionId": "1ffd96b40fcdfb4b8679ee761525fde0e4dc0a44-1",
|
|
116
|
+
"title": "Add a border event",
|
|
117
|
+
"name": "cop-addABorderEvent",
|
|
118
|
+
"submissionDate": "2025-03-26T11:17:55.770Z",
|
|
119
|
+
"submittedBy": "philip.harvey@digital.homeoffice.gov.uk",
|
|
120
|
+
"submittingUsersName": "Phil",
|
|
121
|
+
"draftForm": true,
|
|
122
|
+
"submissionStartDate": "2025-03-26T11:12:48.744Z",
|
|
123
|
+
"formInstanceId": "691fabd3-1d6d-4e57-8eb6-7181fed25bf1",
|
|
124
|
+
"submissionTeam": "cf576f61-26cd-4862-92e1-2d5cfc050c2d"
|
|
125
|
+
},
|
|
126
|
+
"peopleActiveId": "6a09d0b3-2f60-4029-80ec-e0249abf4c48",
|
|
127
|
+
"people": [
|
|
128
|
+
{
|
|
129
|
+
"id": "6a09d0b3-2f60-4029-80ec-e0249abf4c48",
|
|
130
|
+
"hasIdentityDocuments": [
|
|
131
|
+
"no"
|
|
132
|
+
],
|
|
133
|
+
"claimedGivenNames": "Phillip",
|
|
134
|
+
"claimedSurname": "Harvey",
|
|
135
|
+
"estimatedDob": "12-12-1970",
|
|
136
|
+
"claimedCountryOfBirth": {
|
|
137
|
+
"id": 13,
|
|
138
|
+
"name": "Aruba",
|
|
139
|
+
"iso31661alpha3": "ABW",
|
|
140
|
+
"value": "13",
|
|
141
|
+
"label": "Aruba",
|
|
142
|
+
"hint": ""
|
|
143
|
+
},
|
|
144
|
+
"howDidYouVerifyTheirIdentity": "asd asd asd asd asd",
|
|
145
|
+
"noAddresses": "Person has no addresses",
|
|
146
|
+
"noAddressDetails": [
|
|
147
|
+
"none"
|
|
148
|
+
],
|
|
149
|
+
"travellingRole": {
|
|
150
|
+
"id": 2,
|
|
151
|
+
"roletype": "Crew",
|
|
152
|
+
"value": "2",
|
|
153
|
+
"label": "Crew",
|
|
154
|
+
"hint": ""
|
|
155
|
+
},
|
|
156
|
+
"arrested": "yes",
|
|
157
|
+
"governmentOrBorderForceEmployee": "no",
|
|
158
|
+
"personSearched": "no"
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"itemsActiveId": "645db8c1-25a4-436f-a711-dbdb6e839525",
|
|
162
|
+
"items": [
|
|
163
|
+
{
|
|
164
|
+
"id": "645db8c1-25a4-436f-a711-dbdb6e839525",
|
|
165
|
+
"itemHolders": [
|
|
166
|
+
{
|
|
167
|
+
"label": "Phillip Harvey (12 Dec 1970)",
|
|
168
|
+
"value": "Phillip Harvey",
|
|
169
|
+
"id": "6a09d0b3-2f60-4029-80ec-e0249abf4c48"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"sealNumber": "E123567",
|
|
173
|
+
"itemCategory": {
|
|
174
|
+
"id": 6,
|
|
175
|
+
"category": "Alcohol",
|
|
176
|
+
"description": "Beers, Wines, Spirits etc.",
|
|
177
|
+
"validfrom": "2023-01-10T00:00:01.000Z",
|
|
178
|
+
"validto": null,
|
|
179
|
+
"updatedby": "Mohammed Abdul Odud",
|
|
180
|
+
"synonyms": [
|
|
181
|
+
"'Beer'",
|
|
182
|
+
"'Wines'",
|
|
183
|
+
"'Spirits'"
|
|
184
|
+
],
|
|
185
|
+
"value": "6",
|
|
186
|
+
"label": "Alcohol",
|
|
187
|
+
"hint": ""
|
|
188
|
+
},
|
|
189
|
+
"itemSubCategory": {
|
|
190
|
+
"id": 1795,
|
|
191
|
+
"name": "Alcohol distiller",
|
|
192
|
+
"description": null,
|
|
193
|
+
"itemcategoriesid": 6,
|
|
194
|
+
"cites": false,
|
|
195
|
+
"poao": false,
|
|
196
|
+
"cbrn": false,
|
|
197
|
+
"document": false,
|
|
198
|
+
"tobacco": false,
|
|
199
|
+
"alcohol": true,
|
|
200
|
+
"weapons": false,
|
|
201
|
+
"firearms": false,
|
|
202
|
+
"ipr": true,
|
|
203
|
+
"strategic": false,
|
|
204
|
+
"avtc": false,
|
|
205
|
+
"oils": false,
|
|
206
|
+
"commodity": false,
|
|
207
|
+
"good": true,
|
|
208
|
+
"plant": false,
|
|
209
|
+
"animal": false,
|
|
210
|
+
"drugs": false,
|
|
211
|
+
"financial": false,
|
|
212
|
+
"indecent": false,
|
|
213
|
+
"vehicle": false,
|
|
214
|
+
"medical": false,
|
|
215
|
+
"unitid": 5,
|
|
216
|
+
"seizureqty": null,
|
|
217
|
+
"ienqty": null,
|
|
218
|
+
"validfrom": "2023-01-10T00:00:01.000Z",
|
|
219
|
+
"validto": null,
|
|
220
|
+
"updatedby": "Mohammed Abdul Odud",
|
|
221
|
+
"uof": false,
|
|
222
|
+
"epmscode": 1037,
|
|
223
|
+
"epmscategory": "ALP",
|
|
224
|
+
"unitarray": [
|
|
225
|
+
5
|
|
226
|
+
],
|
|
227
|
+
"categoryarray": [
|
|
228
|
+
6,
|
|
229
|
+
9,
|
|
230
|
+
14
|
|
231
|
+
],
|
|
232
|
+
"lethalfirearm": null,
|
|
233
|
+
"nonlethalfirearm": null,
|
|
234
|
+
"value": "1795",
|
|
235
|
+
"label": "Alcohol distiller",
|
|
236
|
+
"hint": ""
|
|
237
|
+
},
|
|
238
|
+
"seizedOrDetained": "seized",
|
|
239
|
+
"legalReasonForSeizing": {
|
|
240
|
+
"id": 2,
|
|
241
|
+
"epmsvalue": 21,
|
|
242
|
+
"reason": "CITES",
|
|
243
|
+
"description": "Convention on International Trade in Endangered Species",
|
|
244
|
+
"validfrom": "2022-09-21T00:00:01.000Z",
|
|
245
|
+
"validto": null,
|
|
246
|
+
"updatedby": "Mohammed Abdul Odud",
|
|
247
|
+
"value": "2",
|
|
248
|
+
"label": "Convention on International Trade in Endangered Species",
|
|
249
|
+
"hint": ""
|
|
250
|
+
},
|
|
251
|
+
"detectionTechnologies": [
|
|
252
|
+
{
|
|
253
|
+
"id": "8d29a2b5-df74-4024-b5ff-a860b01f90d6",
|
|
254
|
+
"detectionTechnology": {
|
|
255
|
+
"id": 5,
|
|
256
|
+
"name": "Automatic number plate recognition (ANPR)",
|
|
257
|
+
"value": "5",
|
|
258
|
+
"label": "Automatic number plate recognition (ANPR)",
|
|
259
|
+
"hint": ""
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
"searchTechniques": [
|
|
264
|
+
{
|
|
265
|
+
"id": "8d29a2b5-df74-4024-b5ff-a860b01f90d6",
|
|
266
|
+
"searchTechnique": {
|
|
267
|
+
"id": 27,
|
|
268
|
+
"type": "Baggage",
|
|
269
|
+
"value": "27",
|
|
270
|
+
"label": "Baggage",
|
|
271
|
+
"hint": ""
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
"concealmentMethods": [
|
|
276
|
+
{
|
|
277
|
+
"id": "4399dbaf-f77c-40da-821a-1f7e382b5eb4",
|
|
278
|
+
"concealmentMethod": {
|
|
279
|
+
"id": 24,
|
|
280
|
+
"method": "Air filter",
|
|
281
|
+
"value": "24",
|
|
282
|
+
"label": "Air filter",
|
|
283
|
+
"hint": ""
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"specialStorageConditions": {
|
|
288
|
+
"epmsvalue": 4,
|
|
289
|
+
"description": "Drum",
|
|
290
|
+
"id": 4,
|
|
291
|
+
"value": "4",
|
|
292
|
+
"label": "Drum",
|
|
293
|
+
"hint": ""
|
|
294
|
+
},
|
|
295
|
+
"brandText": "asd",
|
|
296
|
+
"unitOfMeasure": {
|
|
297
|
+
"id": 13,
|
|
298
|
+
"unit": "Number of items",
|
|
299
|
+
"validfrom": "2023-02-21T00:00:01.000Z",
|
|
300
|
+
"validto": null,
|
|
301
|
+
"updatedby": "Mohammed Abdul Odud",
|
|
302
|
+
"code": 5,
|
|
303
|
+
"epmsid": 9,
|
|
304
|
+
"decimal": false,
|
|
305
|
+
"shortname": null,
|
|
306
|
+
"value": "13",
|
|
307
|
+
"label": "Number of items"
|
|
308
|
+
},
|
|
309
|
+
"quantity": "1",
|
|
310
|
+
"itemDescription": "asd asd asd asd sa",
|
|
311
|
+
"willTheItemBeStored": "no",
|
|
312
|
+
"whatIsTheInitialMovement?": {
|
|
313
|
+
"id": 2,
|
|
314
|
+
"epmscode": 4,
|
|
315
|
+
"description": "Retained by case officer",
|
|
316
|
+
"inuse": true,
|
|
317
|
+
"validfrom": "2022-08-18T00:00:01.000Z",
|
|
318
|
+
"validto": null,
|
|
319
|
+
"updatedby": "Mohammed Abdul Odud",
|
|
320
|
+
"value": "2",
|
|
321
|
+
"label": "Retained by case officer",
|
|
322
|
+
"hint": ""
|
|
323
|
+
},
|
|
324
|
+
"shouldThisItemBeDestroyed": "no",
|
|
325
|
+
"giveAReason": "asd asd asd asd",
|
|
326
|
+
"specialHandlingInstructions": "no",
|
|
327
|
+
"hasAnotherAgencyAdoptedTheItem": "no",
|
|
328
|
+
"constructedOrAdapted": "no",
|
|
329
|
+
"doYouHavePhotosOfTheItemToAdd": "no"
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
"lockup": {
|
|
333
|
+
"value": "LTN",
|
|
334
|
+
"label": "Luton Airport Lockup",
|
|
335
|
+
"hidden": true
|
|
336
|
+
},
|
|
337
|
+
"meta": {},
|
|
338
|
+
"epmsSubmitted": true,
|
|
339
|
+
"doYouHaveTheirFlightNumber": "yes",
|
|
340
|
+
"flights": [
|
|
341
|
+
{
|
|
342
|
+
"id": "676ce6f7-41f5-44e5-9d03-4841075f5839",
|
|
343
|
+
"flightDepartureDateTime": {
|
|
344
|
+
"flightDepartureDate": "26-12-2024",
|
|
345
|
+
"flightDepartureTime": "12:12"
|
|
346
|
+
},
|
|
347
|
+
"flightArrivalDateTimeNonUKDeparture": {
|
|
348
|
+
"flightArrivalDate": "26-12-2024",
|
|
349
|
+
"flightArrivalTime": "12:12"
|
|
350
|
+
},
|
|
351
|
+
"countryOfArrival": {
|
|
352
|
+
"iso31661alpha3": "GBR",
|
|
353
|
+
"name": "United Kingdom of Great Britain and Northern Ireland",
|
|
354
|
+
"id": 234
|
|
355
|
+
},
|
|
356
|
+
"arrivalPort": {
|
|
357
|
+
"rail": "port.rail",
|
|
358
|
+
"name": "Luton",
|
|
359
|
+
"land": "port.land",
|
|
360
|
+
"id": 3415,
|
|
361
|
+
"air": true,
|
|
362
|
+
"label": "Luton",
|
|
363
|
+
"value": "3415",
|
|
364
|
+
"sea": "port.sea",
|
|
365
|
+
"countryid": 234
|
|
366
|
+
},
|
|
367
|
+
"flightNumber": "BA12345",
|
|
368
|
+
"carrierOrOperator": {
|
|
369
|
+
"id": 35,
|
|
370
|
+
"name": "British Airways",
|
|
371
|
+
"twolettercode": "BA",
|
|
372
|
+
"threelettercode": "BAW",
|
|
373
|
+
"designator": 125,
|
|
374
|
+
"alliance": "Oneworld",
|
|
375
|
+
"aviation": true,
|
|
376
|
+
"sea": false,
|
|
377
|
+
"land": false,
|
|
378
|
+
"rail": false,
|
|
379
|
+
"parcel": false,
|
|
380
|
+
"validfrom": "2019-01-01T00:00:00.000Z",
|
|
381
|
+
"validto": null,
|
|
382
|
+
"updatedby": null,
|
|
383
|
+
"cruise": false,
|
|
384
|
+
"value": "35",
|
|
385
|
+
"label": "British Airways",
|
|
386
|
+
"hint": ""
|
|
387
|
+
},
|
|
388
|
+
"countryOfDeparture": {
|
|
389
|
+
"id": 13,
|
|
390
|
+
"name": "Aruba",
|
|
391
|
+
"iso31661alpha3": "ABW",
|
|
392
|
+
"value": "13",
|
|
393
|
+
"label": "Aruba",
|
|
394
|
+
"hint": ""
|
|
395
|
+
},
|
|
396
|
+
"departurePort": {
|
|
397
|
+
"id": 15637,
|
|
398
|
+
"name": "Aruba",
|
|
399
|
+
"iata": null,
|
|
400
|
+
"value": "15637",
|
|
401
|
+
"label": "Aruba",
|
|
402
|
+
"hint": ""
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
],
|
|
406
|
+
"flightsActiveId": "676ce6f7-41f5-44e5-9d03-4841075f5839"
|
|
407
|
+
}
|
package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/input/reassign-to-rcc.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"businessKey": "SIT-20250312-1016",
|
|
3
|
+
"definitionKey": "cop-ncc-task-form",
|
|
4
|
+
"port": {
|
|
5
|
+
"fixedpcp": null,
|
|
6
|
+
"updatedby": "Michaela Cook",
|
|
7
|
+
"geolong": "-3.3391",
|
|
8
|
+
"municipality": null,
|
|
9
|
+
"nonoperational": false,
|
|
10
|
+
"air": true,
|
|
11
|
+
"commandid": 22,
|
|
12
|
+
"juxtaposed": false,
|
|
13
|
+
"sea": false,
|
|
14
|
+
"subdivision": "NA",
|
|
15
|
+
"land": false,
|
|
16
|
+
"id": 9937,
|
|
17
|
+
"helipad": false,
|
|
18
|
+
"value": "9937",
|
|
19
|
+
"portablepcp": null,
|
|
20
|
+
"unlocode": null,
|
|
21
|
+
"rail": false,
|
|
22
|
+
"geolat": "51.39859",
|
|
23
|
+
"localcode": null,
|
|
24
|
+
"label": "Cardiff International Airport",
|
|
25
|
+
"countryid": 234,
|
|
26
|
+
"addressid": null,
|
|
27
|
+
"egates": null,
|
|
28
|
+
"iata": "CWL",
|
|
29
|
+
"locationid": null,
|
|
30
|
+
"hint": "",
|
|
31
|
+
"name": "Cardiff International Airport",
|
|
32
|
+
"icao": "EGFF",
|
|
33
|
+
"portsizeid": 1,
|
|
34
|
+
"validfrom": "2025-03-04T00:01:01.000Z",
|
|
35
|
+
"freightparcelposthub": false,
|
|
36
|
+
"validto": null
|
|
37
|
+
},
|
|
38
|
+
"terminal": null,
|
|
39
|
+
"leadOfficerEmail": null,
|
|
40
|
+
"officerEmails": null,
|
|
41
|
+
"regionalCommandCentre": {
|
|
42
|
+
"code": "BFCENT",
|
|
43
|
+
"updatedby": null,
|
|
44
|
+
"directorateid": 2,
|
|
45
|
+
"hint": "",
|
|
46
|
+
"name": "Central",
|
|
47
|
+
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
48
|
+
"id": 23,
|
|
49
|
+
"label": "Central",
|
|
50
|
+
"value": "23",
|
|
51
|
+
"validto": null
|
|
52
|
+
},
|
|
53
|
+
"autoClose": "13 March 2025",
|
|
54
|
+
"assignWhere": "RCC",
|
|
55
|
+
"assignMessage": "test message",
|
|
56
|
+
"formStatus": {
|
|
57
|
+
"page": "cya"
|
|
58
|
+
},
|
|
59
|
+
"formInstanceId": "46d1b27d-5a6e-428b-a20e-4a432e37875f",
|
|
60
|
+
"form": {
|
|
61
|
+
"formVersionId": "7b941ec0bb281e2b93ba32058b81e1a88f0f0a9a",
|
|
62
|
+
"title": "Assign task to RCC",
|
|
63
|
+
"name": "cop-reassign-task-to-rcc",
|
|
64
|
+
"submissionDate": "2025-03-12T15:41:08.880Z",
|
|
65
|
+
"submittedBy": "acceptance.portuser1@system.local",
|
|
66
|
+
"submittingUsersName": "acceptance.portuser1",
|
|
67
|
+
"draftForm": true,
|
|
68
|
+
"submissionStartDate": "2025-03-12T15:41:08.880Z",
|
|
69
|
+
"formInstanceId": "46d1b27d-5a6e-428b-a20e-4a432e37875f",
|
|
70
|
+
"submissionTeam": "96e2d9db-8b3f-4b36-9ec3-eb1b7506d8c2"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -30,15 +30,19 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
30
30
|
* once with the same path).
|
|
31
31
|
*
|
|
32
32
|
* @param {Array} condensedPages All pages in the form, with the collection pages collated into a single object per collection
|
|
33
|
-
* @param {Map} allCollections A map of collection objects, which are a grouping of the pages that make up a single collection
|
|
34
33
|
* @param {Object} formData The form payload
|
|
35
34
|
* @param {Map} componentByIdMap Map of all components, to enable performant lookup by id
|
|
36
35
|
* @param {Map} componentByFieldIdMap Map of all components, to enable performant lookup by fieldId
|
|
37
|
-
* @param {
|
|
38
|
-
* @
|
|
39
|
-
*
|
|
36
|
+
* @param {Object}
|
|
37
|
+
* @return {Map, Object, Map} allComponents All components in form (including nested), keyed by path:
|
|
38
|
+
* componentsToKeep A count of how many times each component is used, to prevent us deleting components defined > 1 times
|
|
39
|
+
* allCollections A map of collection objects, which are a grouping of the pages that make up a single collection
|
|
40
40
|
*/
|
|
41
|
-
const createComponentMapsFromForm = (condensedPages,
|
|
41
|
+
const createComponentMapsFromForm = (condensedPages, componentByIdMap, componentByFieldIdMap, formData) => {
|
|
42
|
+
const allComponents = new Map();
|
|
43
|
+
const componentsToKeep = {};
|
|
44
|
+
const allCollections = new Map();
|
|
45
|
+
|
|
42
46
|
/*
|
|
43
47
|
* Inner function to support the recursion required to traverse through the nested structures of the form
|
|
44
48
|
*/
|
|
@@ -80,6 +84,7 @@ const createComponentMapsFromForm = (condensedPages, allCollections, componentBy
|
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
86
|
};
|
|
87
|
+
|
|
83
88
|
// Entry point for the recursive traverse of the form specification.
|
|
84
89
|
condensedPages === null || condensedPages === void 0 || condensedPages.forEach(page => {
|
|
85
90
|
// Make the distinction between collections (which will be processed separately) and non-collections, which will be processed here.
|
|
@@ -89,10 +94,15 @@ const createComponentMapsFromForm = (condensedPages, allCollections, componentBy
|
|
|
89
94
|
var _page$components;
|
|
90
95
|
(_page$components = page.components) === null || _page$components === void 0 || _page$components.forEach(useComponentInPage => {
|
|
91
96
|
const componentObj = Utils.findComponentDefinitionInForm(useComponentInPage, componentByIdMap, componentByFieldIdMap);
|
|
92
|
-
recursivelyMapFieldsAndDeleteHiddenNested(page, componentObj, null);
|
|
97
|
+
recursivelyMapFieldsAndDeleteHiddenNested(page, componentObj, null, allComponents, componentsToKeep, formData);
|
|
93
98
|
});
|
|
94
99
|
}
|
|
95
100
|
});
|
|
101
|
+
return {
|
|
102
|
+
allComponents,
|
|
103
|
+
componentsToKeep,
|
|
104
|
+
allCollections
|
|
105
|
+
};
|
|
96
106
|
};
|
|
97
107
|
/**
|
|
98
108
|
*
|
|
@@ -102,9 +112,10 @@ const createComponentMapsFromForm = (condensedPages, allCollections, componentBy
|
|
|
102
112
|
*
|
|
103
113
|
* @param {Map} allDependencyRelationships A map of each component with dependencies. The key is the fully qualified path and the value is a Set of all the paths that this component is dependent on.
|
|
104
114
|
* @param {Map} allComponents All components in form (including nested), keyed by path. Used to build the allDependencyRelationships
|
|
105
|
-
* @return allDependencyRelationships
|
|
115
|
+
* @return {Map }allDependencyRelationships graph of the relationships between all entities
|
|
106
116
|
*/
|
|
107
|
-
const createComponentDependenciesGraph =
|
|
117
|
+
const createComponentDependenciesGraph = allComponents => {
|
|
118
|
+
const allDependencyRelationships = new Map();
|
|
108
119
|
allComponents === null || allComponents === void 0 || allComponents.forEach(componentArray => {
|
|
109
120
|
componentArray === null || componentArray === void 0 || componentArray.forEach(component => {
|
|
110
121
|
if (!component.fieldId) return;
|
|
@@ -119,6 +130,7 @@ const createComponentDependenciesGraph = (allComponents, allDependencyRelationsh
|
|
|
119
130
|
}
|
|
120
131
|
});
|
|
121
132
|
});
|
|
133
|
+
return allDependencyRelationships;
|
|
122
134
|
};
|
|
123
135
|
|
|
124
136
|
/**
|
|
@@ -292,17 +304,15 @@ const clearOutUncompletedRoutes = (form, formData) => {
|
|
|
292
304
|
const componentByIdMap = new Map(form.components.map(c => [c.id, c]));
|
|
293
305
|
const componentByFieldIdMap = new Map(form.components.map(c => [c.fieldId, c]));
|
|
294
306
|
|
|
295
|
-
// Instantiate data structures to hold the form specification and the dependency graph
|
|
296
|
-
const allComponents = new Map();
|
|
297
|
-
const componentsToKeep = {};
|
|
298
|
-
const allCollections = new Map();
|
|
299
|
-
const allDependencyRelationships = new Map();
|
|
300
|
-
|
|
301
307
|
// Group all pages relating to a page-collection into a single object to aid collection
|
|
302
308
|
// processing, and to allow us to differentiate between a collection and non-collection page.
|
|
303
309
|
const condensedPages = (0, _mergeCollectionPages.default)(form.pages);
|
|
304
|
-
|
|
305
|
-
|
|
310
|
+
const {
|
|
311
|
+
allComponents,
|
|
312
|
+
componentsToKeep,
|
|
313
|
+
allCollections
|
|
314
|
+
} = createComponentMapsFromForm(condensedPages, componentByIdMap, componentByFieldIdMap, formData);
|
|
315
|
+
const allDependencyRelationships = createComponentDependenciesGraph(allComponents);
|
|
306
316
|
resolveComponentDependenciesGraph(allDependencyRelationships, allComponents, componentsToKeep, allCollections, form, formData);
|
|
307
317
|
cleanseCollectionData(allCollections, formData, componentByIdMap, componentByFieldIdMap);
|
|
308
318
|
|
|
@@ -85,11 +85,14 @@ var _copMandecRemoveCriminalityBefore = _interopRequireDefault(require("../clear
|
|
|
85
85
|
var _copMandecRemoveCriminalityAfter = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/output/cop-mandec-remove-criminality-after.json"));
|
|
86
86
|
var _copMandecRemoveUnspentConvictionsBefore = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/input/cop-mandec-remove-unspent-convictions-before.json"));
|
|
87
87
|
var _copMandecRemoveUnspentConvictionsAfter = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/output/cop-mandec-remove-unspent-convictions-after.json"));
|
|
88
|
+
var _copReassignTaskToRcc = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/forms/cop-reassign-task-to-rcc.json"));
|
|
89
|
+
var _reassignToRcc = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/input/reassign-to-rcc.json"));
|
|
88
90
|
var _formCopAirpax = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/forms/form-cop-airpax.json"));
|
|
89
91
|
var _copAirpaxRemovePhotosBefore = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/input/cop-airpax-remove-photos-before.json"));
|
|
90
92
|
var _copAirpaxRemovePhotosAfter = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/output/cop-airpax-remove-photos-after.json"));
|
|
91
93
|
var _copAirpaxChangeWhatHappenedBefore = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/input/cop-airpax-change-what-happened-before.json"));
|
|
92
94
|
var _copAirpaxChangeWhatHappenedAfter = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/output/cop-airpax-change-what-happened-after.json"));
|
|
95
|
+
var _copAirpaxCarrier = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/input/cop-airpax-carrier.json"));
|
|
93
96
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
94
97
|
// Hidden component
|
|
95
98
|
|
|
@@ -149,8 +152,14 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
149
152
|
|
|
150
153
|
// Mandec Unspent convictions
|
|
151
154
|
|
|
155
|
+
// TMS reassign-task-to-rcc
|
|
156
|
+
|
|
152
157
|
// Airpax photos
|
|
153
158
|
|
|
159
|
+
// Who decided
|
|
160
|
+
|
|
161
|
+
// Carrier not removed
|
|
162
|
+
|
|
154
163
|
describe('FormRenderer', () => {
|
|
155
164
|
describe('helpers', () => {
|
|
156
165
|
describe('clearOutUncompletedRoutes', () => {
|
|
@@ -332,12 +341,24 @@ describe('FormRenderer', () => {
|
|
|
332
341
|
const result = _index.default.clearOutUncompletedRoutes(form, submissionData);
|
|
333
342
|
expect(result).toEqual(_copMandecRemoveUnspentConvictionsAfter.default);
|
|
334
343
|
});
|
|
344
|
+
it('Reassign to RCC form, preserved fields not cleansed.', () => {
|
|
345
|
+
const submissionData = JSON.parse(JSON.stringify(_reassignToRcc.default));
|
|
346
|
+
const form = JSON.parse(JSON.stringify(_copReassignTaskToRcc.default));
|
|
347
|
+
const result = _index.default.clearOutUncompletedRoutes(form, submissionData);
|
|
348
|
+
expect(result).toEqual(_reassignToRcc.default);
|
|
349
|
+
});
|
|
335
350
|
it('photos removed from airpax.', () => {
|
|
336
351
|
const submissionData = JSON.parse(JSON.stringify(_copAirpaxRemovePhotosBefore.default));
|
|
337
352
|
const form = JSON.parse(JSON.stringify(_formCopAirpax.default));
|
|
338
353
|
const result = _index.default.clearOutUncompletedRoutes(form, submissionData);
|
|
339
354
|
expect(result).toEqual(_copAirpaxRemovePhotosAfter.default);
|
|
340
355
|
});
|
|
356
|
+
it('carrier not removed from airpax.', () => {
|
|
357
|
+
const submissionData = JSON.parse(JSON.stringify(_copAirpaxCarrier.default));
|
|
358
|
+
const form = JSON.parse(JSON.stringify(_formCopAirpax.default));
|
|
359
|
+
const result = _index.default.clearOutUncompletedRoutes(form, submissionData);
|
|
360
|
+
expect(result).toEqual(_copAirpaxCarrier.default);
|
|
361
|
+
});
|
|
341
362
|
it('airpax change whatHappened to hide whoDecidedSelection.', () => {
|
|
342
363
|
const submissionData = JSON.parse(JSON.stringify(_copAirpaxChangeWhatHappenedBefore.default));
|
|
343
364
|
const form = JSON.parse(JSON.stringify(_formCopAirpax.default));
|