@ukhomeoffice/cop-react-form-renderer 6.15.0-alpha → 6.15.3-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.
@@ -0,0 +1,143 @@
1
+ {
2
+ "id": "f603bb71-dcac-11ef-b426-66612ab527d2",
3
+ "businessKey": "DEV-20250127-981",
4
+ "jobHolderStaffDetails": {
5
+ "email": "philip.harvey@digital.homeoffice.gov.uk",
6
+ "linemanagerEmail": "saskia.thompson7@homeoffice.gov.uk",
7
+ "name": "Phil Harvey",
8
+ "linemanagerApprovalStatus": "expired"
9
+ },
10
+ "officerDefaultTeam": {
11
+ "id": "cf576f61-26cd-4862-92e1-2d5cfc050c2d",
12
+ "name": "Aberdeen Management Team",
13
+ "code": "ABERDEAI",
14
+ "description": null,
15
+ "costcentrecode": "ABERDEAI",
16
+ "parentteamid": "d8240301-bc30-4c58-9826-d88b85d598f5",
17
+ "regionalintel": false,
18
+ "bffunctiontypeid": "63d59d5c-e1d0-4f16-9607-7aa2613cc695",
19
+ "ministryid": "1",
20
+ "departmentid": "1",
21
+ "directorateid": "2",
22
+ "branchid": "22",
23
+ "divisionid": "11",
24
+ "commandid": "38",
25
+ "validfrom": "2019-01-01T00:01:00.000Z",
26
+ "validto": null,
27
+ "updatedby": null
28
+ },
29
+ "preMandecQuestionsActiveId": "d8dbe2d0-d5e3-4bac-8e88-cd09377310ff",
30
+ "preMandecQuestions": [
31
+ {
32
+ "id": "d8dbe2d0-d5e3-4bac-8e88-cd09377310ff",
33
+ "teamCheck": "true",
34
+ "lineManagerCheck": "true",
35
+ "confirmReadGuidance": [
36
+ "yes"
37
+ ]
38
+ }
39
+ ],
40
+ "formStatus": {
41
+ "tasks": {
42
+ "undefined": {},
43
+ "Check your team": {
44
+ "complete": true,
45
+ "currentPage": "beginDeclarations"
46
+ },
47
+ "Check your line manager": {
48
+ "complete": true,
49
+ "currentPage": "beginDeclarations"
50
+ },
51
+ "Sponsorship": {
52
+ "complete": true,
53
+ "currentPage": "sponsorship"
54
+ },
55
+ "Employment": {
56
+ "complete": true,
57
+ "currentPage": "employment"
58
+ },
59
+ "Criminality": {
60
+ "complete": true,
61
+ "currentPage": "fixedPenaltyNotice"
62
+ },
63
+ "Personal Finance": {
64
+ "complete": true,
65
+ "currentPage": "personalFinance"
66
+ },
67
+ "Business Interests": {
68
+ "complete": true,
69
+ "currentPage": "businessInterests"
70
+ },
71
+ "Accept and send": {
72
+ "complete": false,
73
+ "currentPage": "partialCya"
74
+ }
75
+ },
76
+ "taskPage": "partialCya"
77
+ },
78
+ "formInstanceId": "18ef4323-4296-4eee-94cf-9bb13cdcbb00",
79
+ "links": [
80
+ {
81
+ "method": "GET",
82
+ "href": "https://green.dev.cop.homeoffice.gov.uk/camunda/engine-rest/process-instance/f603bb71-dcac-11ef-b426-66612ab527d2",
83
+ "rel": "self"
84
+ }
85
+ ],
86
+ "definitionId": "c9e1b788-647c-11ef-9760-b6e9c97aae49",
87
+ "caseInstanceId": null,
88
+ "ended": false,
89
+ "suspended": false,
90
+ "tenantId": null,
91
+ "sponsorship": "false",
92
+ "employmentNow": "false",
93
+ "employmentFuture": "false",
94
+ "criminality": "true",
95
+ "criminalityUnspentConvictions": "false",
96
+ "convictionsActiveId": "d27c4308-d096-4c39-95b0-8d766de0195d",
97
+ "convictions": [
98
+ {
99
+ "id": "d27c4308-d096-4c39-95b0-8d766de0195d",
100
+ "criminalityUnspentConvictionsDate": "12-12-2023",
101
+ "criminalityUnspentConvictionsDescription": "XXXXXXXXXX",
102
+ "criminalityUnspentConvictionsPlead": "true",
103
+ "criminalityUnspentConvictionsDetails": "XXXXXXXXXXXX",
104
+ "criminalityUnspentConvictionsInformed": "true",
105
+ "criminalityUnspentConvictionsInformedPersons": [
106
+ "homeOfficeSecurity"
107
+ ],
108
+ "criminalityUnspentConvictionsInformedPersonSecurityDate": "12-12-2023",
109
+ "criminalityUnspentConvictionsAdditionalInformation": "XXXXX"
110
+ }
111
+ ],
112
+ "addAnotherRadio": "false",
113
+ "criminalityArrested": "false",
114
+ "criminalityCaution": "false",
115
+ "summonsToCourt": "false",
116
+ "sanction": "false",
117
+ "fixedPenaltyNotice": "false",
118
+ "personalFinanceInsolvent": "false",
119
+ "personalFinanceIVA": "false",
120
+ "personalFinanceBankrupt": "false",
121
+ "businessInterestsPresent": "false",
122
+ "businessInterestsFuture": "false",
123
+ "postMandecQuestionsActiveId": "4da9e7a8-f1d5-46bc-a2bb-5fa4f6304d26",
124
+ "postMandecQuestions": [
125
+ {
126
+ "id": "4da9e7a8-f1d5-46bc-a2bb-5fa4f6304d26",
127
+ "sendToLineManagerConditional": "true",
128
+ "understandAndAgree": [
129
+ "true"
130
+ ]
131
+ }
132
+ ],
133
+ "form": {
134
+ "formVersionId": "7df080994ce1605b5a64635f2d6faa5f605db3e01",
135
+ "title": "Make your mandatory declarations",
136
+ "name": "cop-make-your-mandatory-declarations",
137
+ "submissionDate": "2025-01-27T12:52:02.414Z",
138
+ "submittedBy": "philip.harvey@digital.homeoffice.gov.uk",
139
+ "submittingUsersName": "Phil",
140
+ "submissionTeam": "cf576f61-26cd-4862-92e1-2d5cfc050c2d",
141
+ "formInstanceId": "18ef4323-4296-4eee-94cf-9bb13cdcbb00"
142
+ }
143
+ }
@@ -0,0 +1,127 @@
1
+ {
2
+ "id": "f603bb71-dcac-11ef-b426-66612ab527d2",
3
+ "businessKey": "DEV-20250127-981",
4
+ "jobHolderStaffDetails": {
5
+ "email": "philip.harvey@digital.homeoffice.gov.uk",
6
+ "linemanagerEmail": "saskia.thompson7@homeoffice.gov.uk",
7
+ "name": "Phil Harvey",
8
+ "linemanagerApprovalStatus": "expired"
9
+ },
10
+ "officerDefaultTeam": {
11
+ "id": "cf576f61-26cd-4862-92e1-2d5cfc050c2d",
12
+ "name": "Aberdeen Management Team",
13
+ "code": "ABERDEAI",
14
+ "description": null,
15
+ "costcentrecode": "ABERDEAI",
16
+ "parentteamid": "d8240301-bc30-4c58-9826-d88b85d598f5",
17
+ "regionalintel": false,
18
+ "bffunctiontypeid": "63d59d5c-e1d0-4f16-9607-7aa2613cc695",
19
+ "ministryid": "1",
20
+ "departmentid": "1",
21
+ "directorateid": "2",
22
+ "branchid": "22",
23
+ "divisionid": "11",
24
+ "commandid": "38",
25
+ "validfrom": "2019-01-01T00:01:00.000Z",
26
+ "validto": null,
27
+ "updatedby": null
28
+ },
29
+ "preMandecQuestionsActiveId": "d8dbe2d0-d5e3-4bac-8e88-cd09377310ff",
30
+ "preMandecQuestions": [
31
+ {
32
+ "id": "d8dbe2d0-d5e3-4bac-8e88-cd09377310ff",
33
+ "teamCheck": "true",
34
+ "lineManagerCheck": "true",
35
+ "confirmReadGuidance": [
36
+ "yes"
37
+ ]
38
+ }
39
+ ],
40
+ "formStatus": {
41
+ "tasks": {
42
+ "undefined": {},
43
+ "Check your team": {
44
+ "complete": true,
45
+ "currentPage": "beginDeclarations"
46
+ },
47
+ "Check your line manager": {
48
+ "complete": true,
49
+ "currentPage": "beginDeclarations"
50
+ },
51
+ "Sponsorship": {
52
+ "complete": true,
53
+ "currentPage": "sponsorship"
54
+ },
55
+ "Employment": {
56
+ "complete": true,
57
+ "currentPage": "employment"
58
+ },
59
+ "Criminality": {
60
+ "complete": true,
61
+ "currentPage": "fixedPenaltyNotice"
62
+ },
63
+ "Personal Finance": {
64
+ "complete": true,
65
+ "currentPage": "personalFinance"
66
+ },
67
+ "Business Interests": {
68
+ "complete": true,
69
+ "currentPage": "businessInterests"
70
+ },
71
+ "Accept and send": {
72
+ "complete": false,
73
+ "currentPage": "partialCya"
74
+ }
75
+ },
76
+ "taskPage": "partialCya"
77
+ },
78
+ "formInstanceId": "18ef4323-4296-4eee-94cf-9bb13cdcbb00",
79
+ "links": [
80
+ {
81
+ "method": "GET",
82
+ "href": "https://green.dev.cop.homeoffice.gov.uk/camunda/engine-rest/process-instance/f603bb71-dcac-11ef-b426-66612ab527d2",
83
+ "rel": "self"
84
+ }
85
+ ],
86
+ "definitionId": "c9e1b788-647c-11ef-9760-b6e9c97aae49",
87
+ "caseInstanceId": null,
88
+ "ended": false,
89
+ "suspended": false,
90
+ "tenantId": null,
91
+ "sponsorship": "false",
92
+ "employmentNow": "false",
93
+ "employmentFuture": "false",
94
+ "criminality": "true",
95
+ "criminalityUnspentConvictions": "false",
96
+ "addAnotherRadio": "false",
97
+ "criminalityArrested": "false",
98
+ "criminalityCaution": "false",
99
+ "summonsToCourt": "false",
100
+ "sanction": "false",
101
+ "fixedPenaltyNotice": "false",
102
+ "personalFinanceInsolvent": "false",
103
+ "personalFinanceIVA": "false",
104
+ "personalFinanceBankrupt": "false",
105
+ "businessInterestsPresent": "false",
106
+ "businessInterestsFuture": "false",
107
+ "postMandecQuestionsActiveId": "4da9e7a8-f1d5-46bc-a2bb-5fa4f6304d26",
108
+ "postMandecQuestions": [
109
+ {
110
+ "id": "4da9e7a8-f1d5-46bc-a2bb-5fa4f6304d26",
111
+ "sendToLineManagerConditional": "true",
112
+ "understandAndAgree": [
113
+ "true"
114
+ ]
115
+ }
116
+ ],
117
+ "form": {
118
+ "formVersionId": "7df080994ce1605b5a64635f2d6faa5f605db3e01",
119
+ "title": "Make your mandatory declarations",
120
+ "name": "cop-make-your-mandatory-declarations",
121
+ "submissionDate": "2025-01-27T12:52:02.414Z",
122
+ "submittedBy": "philip.harvey@digital.homeoffice.gov.uk",
123
+ "submittingUsersName": "Phil",
124
+ "submissionTeam": "cf576f61-26cd-4862-92e1-2d5cfc050c2d",
125
+ "formInstanceId": "18ef4323-4296-4eee-94cf-9bb13cdcbb00"
126
+ }
127
+ }
@@ -268,8 +268,15 @@ function removeEmptyArraysAndUnusedCollectionIDs(payload) {
268
268
  Object.keys(payload).forEach(key => {
269
269
  if (Array.isArray(payload[key]) && payload[key].length === 0) {
270
270
  // If the array being removed has an activeId associated with it, remove it
271
+ if (payload["".concat(key, "ActiveId")]) {
272
+ delete payload["".concat(key, "ActiveId")];
273
+ console.log("Deleted element : ".concat(key, "ActiveId}"));
274
+ }
271
275
  delete payload["".concat(key, "ActiveId")];
272
- delete payload[key]; // Remove the empty array
276
+ if (payload[key]) {
277
+ delete payload[key];
278
+ console.log("Deleted element : ".concat(key));
279
+ }
273
280
  } else {
274
281
  removeEmptyArraysAndUnusedCollectionIDs(payload[key]); // Recurse for nested structures
275
282
  }
@@ -74,6 +74,8 @@ var _copMandecRemoveBusinessInterestsBefore = _interopRequireDefault(require("..
74
74
  var _copMandecRemoveBusinessInterestsAfter = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/output/cop-mandec-remove-business-interests-after.json"));
75
75
  var _copMandecRemoveCriminalityBefore = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/input/cop-mandec-remove-criminality-before.json"));
76
76
  var _copMandecRemoveCriminalityAfter = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/output/cop-mandec-remove-criminality-after.json"));
77
+ var _copMandecRemoveUnspentConvictionsBefore = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/input/cop-mandec-remove-unspent-convictions-before.json"));
78
+ var _copMandecRemoveUnspentConvictionsAfter = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/output/cop-mandec-remove-unspent-convictions-after.json"));
77
79
  var _formCopAirpax = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/forms/form-cop-airpax.json"));
78
80
  var _copAirpaxRemovePhotosBefore = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/input/cop-airpax-remove-photos-before.json"));
79
81
  var _copAirpaxRemovePhotosAfter = _interopRequireDefault(require("../clear-uncompleted-routes/test-data/output/cop-airpax-remove-photos-after.json"));
@@ -128,6 +130,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
128
130
 
129
131
  // Mandec criminality
130
132
 
133
+ // Mandec Unspent convictions
134
+
131
135
  // Airpax photos
132
136
 
133
137
  describe('FormRenderer', () => {
@@ -287,6 +291,12 @@ describe('FormRenderer', () => {
287
291
  const result = _index.default.clearOutUncompletedRoutes(form, submissionData);
288
292
  expect(result).toEqual(_copMandecRemoveCriminalityAfter.default);
289
293
  });
294
+ it('Unspent convictions removed from mandec', () => {
295
+ const submissionData = JSON.parse(JSON.stringify(_copMandecRemoveUnspentConvictionsBefore.default));
296
+ const form = JSON.parse(JSON.stringify(_formCopMandec.default));
297
+ const result = _index.default.clearOutUncompletedRoutes(form, submissionData);
298
+ expect(result).toEqual(_copMandecRemoveUnspentConvictionsAfter.default);
299
+ });
290
300
  it('photos removed from airpax', () => {
291
301
  const submissionData = JSON.parse(JSON.stringify(_copAirpaxRemovePhotosBefore.default));
292
302
  const form = JSON.parse(JSON.stringify(_formCopAirpax.default));
@@ -20,7 +20,10 @@ const deleteNodeByPath = (obj, path) => {
20
20
  return;
21
21
  }
22
22
  }
23
- delete current[keys[keys.length - 1]];
23
+ if (current[keys[keys.length - 1]]) {
24
+ console.log("Deleting element : ".concat(keys[keys.length - 1]));
25
+ delete current[keys[keys.length - 1]];
26
+ }
24
27
  return obj;
25
28
  };
26
29
  var _default = exports.default = deleteNodeByPath;
@@ -112,6 +112,7 @@ const onPageAction = (action, patch, patchLabel, hooks, data, formState, validat
112
112
  components
113
113
  };
114
114
  if (action.type === _models.PageAction.TYPES.SUBMIT) {
115
+ console.log("Invoking clearOutUncompletedRoutes");
115
116
  _helpers.default.clearOutUncompletedRoutes(formPagesAndComponents, submissionData);
116
117
  }
117
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "6.15.0-alpha",
3
+ "version": "6.15.3-alpha",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "clean": "rimraf dist",