@gov-cy/govcy-express-services 1.0.0-alpha.1 → 1.0.0-alpha.10
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/README.md +156 -11
- package/package.json +4 -2
- package/src/index.mjs +20 -1
- package/src/middleware/cyLoginAuth.mjs +8 -0
- package/src/middleware/govcyCsrf.mjs +15 -1
- package/src/middleware/govcyFileDeleteHandler.mjs +238 -0
- package/src/middleware/govcyFileUpload.mjs +36 -0
- package/src/middleware/govcyFileViewHandler.mjs +161 -0
- package/src/middleware/govcyFormsPostHandler.mjs +1 -1
- package/src/middleware/govcyHttpErrorHandler.mjs +4 -3
- package/src/middleware/govcyPageHandler.mjs +5 -1
- package/src/public/js/govcyFiles.js +197 -0
- package/src/public/js/govcyForms.js +19 -8
- package/src/resources/govcyResources.mjs +69 -3
- package/src/utils/govcyApiDetection.mjs +17 -0
- package/src/utils/govcyApiRequest.mjs +30 -5
- package/src/utils/govcyApiResponse.mjs +31 -0
- package/src/utils/govcyConstants.mjs +5 -1
- package/src/utils/govcyDataLayer.mjs +22 -0
- package/src/utils/govcyExpressions.mjs +1 -1
- package/src/utils/govcyFormHandling.mjs +81 -5
- package/src/utils/govcyHandleFiles.mjs +307 -0
- package/src/utils/govcyLoadSubmissionDataAPIs.mjs +10 -3
- package/src/utils/govcySubmitData.mjs +62 -2
- package/src/utils/govcyTempSave.mjs +2 -1
- package/src/utils/govcyValidator.mjs +7 -0
|
@@ -27,7 +27,8 @@ export async function tempSaveIfConfigured(store, service, siteId) {
|
|
|
27
27
|
const inputData = dataLayer.getSiteInputData(store, siteId) || {};
|
|
28
28
|
const tempPayload = {
|
|
29
29
|
// mirror final submission format: send stringified JSON
|
|
30
|
-
submission_data: JSON.stringify(inputData)
|
|
30
|
+
// submission_data: JSON.stringify(inputData),
|
|
31
|
+
submissionData: JSON.stringify(inputData)
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
if (!url || !clientKey) {
|
|
@@ -263,6 +263,9 @@ export function validateFormElements(elements, formData, pageUrl) {
|
|
|
263
263
|
formData[`${field.params.name}_day`]]
|
|
264
264
|
.filter(Boolean) // Remove empty values
|
|
265
265
|
.join("-") // Join remaining parts
|
|
266
|
+
// unneeded handle of `Attachment` at the end
|
|
267
|
+
// : (field.element === "fileInput") // Handle fileInput
|
|
268
|
+
// ? formData[`${field.params.name}Attachment`] || ""
|
|
266
269
|
: formData[field.params.name] || ""; // Get submitted value
|
|
267
270
|
|
|
268
271
|
//Autocheck: check for "checkboxes", "radios", "select" if `fieldValue` is one of the `field.params.items
|
|
@@ -310,6 +313,10 @@ export function validateFormElements(elements, formData, pageUrl) {
|
|
|
310
313
|
formData[`${conditionalElement.params.name}_day`]]
|
|
311
314
|
.filter(Boolean) // Remove empty values
|
|
312
315
|
.join("-") // Join remaining parts
|
|
316
|
+
: (conditionalElement.element === "fileInput") // Handle fileInput
|
|
317
|
+
// unneeded handle of `Attachment` at the end
|
|
318
|
+
// ? formData[`${conditionalElement.params.name}Attachment`] || ""
|
|
319
|
+
? formData[`${conditionalElement.params.name}`] || ""
|
|
313
320
|
: formData[conditionalElement.params.name] || ""; // Get submitted value
|
|
314
321
|
|
|
315
322
|
//Autocheck: check for "checkboxes", "radios", "select" if `fieldValue` is one of the `field.params.items`
|