@gov-cy/govcy-express-services 1.0.0-alpha.13 → 1.0.0-alpha.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gov-cy/govcy-express-services",
3
- "version": "1.0.0-alpha.13",
3
+ "version": "1.0.0-alpha.14",
4
4
  "description": "An Express-based system that dynamically renders services using @gov-cy/govcy-frontend-renderer and posts data to a submission API.",
5
5
  "author": "DMRID - DSF Team",
6
6
  "license": "MIT",
@@ -48,7 +48,8 @@ export function prepareSubmissionData(req, siteId, service) {
48
48
 
49
49
  if (!formElement) continue; // ⛔ Skip pages without a <form> element
50
50
 
51
- submissionData[pageUrl] = { formData: {} }; // ✅ Now initialize only if a form is present
51
+ // submissionData[pageUrl] = { formData: {} }; // ✅ Now initialize only if a form is present
52
+ submissionData[pageUrl] = {}; // ✅ Now initialize only if a form is present
52
53
 
53
54
  // Traverse the form elements inside the form
54
55
  for (const element of formElement.params.elements || []) {
@@ -64,13 +65,16 @@ export function prepareSubmissionData(req, siteId, service) {
64
65
  const value = getValue(element, pageUrl, req, siteId) ?? "";
65
66
 
66
67
  // Store in submissionData
67
- submissionData[pageUrl].formData[elId] = value;
68
+ // submissionData[pageUrl].formData[elId] = value;
69
+ submissionData[pageUrl][elId] = value;
68
70
 
69
71
  // handle fileInput
70
72
  if (elType === "fileInput") {
71
73
  // change the name of the key to include "Attachment" at the end but not have the original key
72
- submissionData[pageUrl].formData[elId + "Attachment"] = value;
73
- delete submissionData[pageUrl].formData[elId];
74
+ // submissionData[pageUrl].formData[elId + "Attachment"] = value;
75
+ submissionData[pageUrl][elId + "Attachment"] = value;
76
+ // delete submissionData[pageUrl].formData[elId];
77
+ delete submissionData[pageUrl][elId];
74
78
  }
75
79
 
76
80
  // 🔄 If radios with conditionalElements, walk ALL options
@@ -90,12 +94,15 @@ export function prepareSubmissionData(req, siteId, service) {
90
94
  const condValue = getValue(condElement, pageUrl, req, siteId) ?? "";
91
95
 
92
96
  // Store even if the field was not visible to user
93
- submissionData[pageUrl].formData[condId] = condValue;
97
+ // submissionData[pageUrl].formData[condId] = condValue;
98
+ submissionData[pageUrl][condId] = condValue;
94
99
  // handle fileInput
95
100
  if (condType === "fileInput") {
96
101
  // change the name of the key to include "Attachment" at the end but not have the original key
97
- submissionData[pageUrl].formData[condId + "Attachment"] = condValue;
98
- delete submissionData[pageUrl].formData[condId];
102
+ // submissionData[pageUrl].formData[condId + "Attachment"] = condValue;
103
+ submissionData[pageUrl][condId + "Attachment"] = condValue;
104
+ // delete submissionData[pageUrl].formData[condId];
105
+ delete submissionData[pageUrl][condId];
99
106
  }
100
107
  }
101
108
  }