@gov-cy/govcy-express-services 1.0.0 → 1.1.1

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 CHANGED
@@ -273,9 +273,9 @@ Here is an example JSON config:
273
273
  "cssIntegrity": "sha384-qjx16YXHG+Vq/NVtwU2aDTc7DoLOyaVNuOHrwA3aTrckpM/ycxZoR5dx7ezNJ/Lv",
274
274
  "jsIntegrity": "sha384-tqEyCdi3GS4uDXctplAd7ODjiK5fo2Xlqv65e8w/cVvrcBf89tsxXFHXXNiUDyM7"
275
275
  },
276
- "submission_data_version": "1", //<-- Submission data version
277
- "renderer_version": "1.16.1", //<-- govcy-frontend-renderer version
278
- "design_systems_version": "3.2.0", //<-- govcy-design-system version
276
+ "submissionDataVersion": "1", //<-- Submission data version
277
+ "rendererVersion": "1.16.1", //<-- govcy-frontend-renderer version
278
+ "designSystemsVersion": "3.2.0", //<-- govcy-design-system version
279
279
  "homeRedirectPage": { //<-- Home redirect page
280
280
  "el": "https://www.gov.cy/service/aitisi-gia-taftotita/",
281
281
  "en": "https://www.gov.cy/en/service/issue-an-id-card/",
@@ -694,9 +694,9 @@ Here is an example JSON config:
694
694
  Here are some details explaining the JSON structure:
695
695
 
696
696
  - `site` object: Contains information about the site, including the site ID, language, and footer links. See [govcy-frontend-renderer](https://github.com/gov-cy/govcy-frontend-renderer/tree/main#site-and-page-meta-data-explained) for more details. Some fields that are only specific to the govcy-express-forms project are the following:
697
- - `submission_data_version` : The submission data version,
698
- - `renderer_version` : The govcy-frontend-renderer version,
699
- - `design_systems_version` : The govcy-design-system version,
697
+ - `submissionDataVersion` : The submission data version,
698
+ - `rendererVersion` : The govcy-frontend-renderer version,
699
+ - `designSystemsVersion` : The govcy-design-system version,
700
700
  - `homeRedirectPage`: An object mapping language codes to URLs. When a user visits the root route (e.g., `https://whatever-your-service-is.service.gov.cy/`), the system redirects to the URL for the user's language. If the user's language is not found, it falls back to `"el"` or the first available URL. If not provided, a list of available sites is shown. Example:
701
701
  ```json
702
702
  "homeRedirectPage": {
@@ -2074,11 +2074,14 @@ HTTP/1.1 200 OK
2074
2074
  "ErrorCode": 0,
2075
2075
  "ErrorMessage": null,
2076
2076
  "Data": {
2077
- "submissionData": "{\"index\":{\"formData\":{\"certificate_select\":[\"birth\",\"permanent_residence\"]}},\"data-entry-radios\":{\"formData\":{\"mobile_select\":\"other\",\"mobileTxt\":\"+35799484967\"}}}"
2077
+ "submissionData": "{\"index\":{\"formData\":{\"certificate_select\":[\"birth\",\"permanent_residence\"]}},\"data-entry-radios\":{\"formData\":{\"mobile_select\":\"other\",\"mobileTxt\":\"+35799484967\"}}}",
2078
+ "referenceValue": "0000000924107836"
2078
2079
  }
2079
2080
  }
2080
2081
  ```
2081
2082
 
2083
+ **NOTE**: The `Data` object contains the `submissionData` and `referenceValue` fields. The `referenceValue` is a unique identifier for the submission. It is used to identify the submission in the `submissionPutAPIEndpoint` and `fileDownloadAPIEndpoint` API requests.
2084
+
2082
2085
  **When temporary submission data are NOT found:**
2083
2086
 
2084
2087
  ```http
@@ -2149,7 +2152,8 @@ HTTP/1.1 200 OK
2149
2152
  "ErrorCode": 0,
2150
2153
  "ErrorMessage": null,
2151
2154
  "Data": {
2152
- "submissionData": "{\"index\":{\"formData\":{\"certificate_select\":[\"birth\",\"permanent_residence\"]}},\"data-entry-radios\":{\"formData\":{\"mobile_select\":\"other\",\"mobileTxt\":\"+35799484967\"}}}"
2155
+ "submissionData": "{\"index\":{\"formData\":{\"certificate_select\":[\"birth\",\"permanent_residence\"]}},\"data-entry-radios\":{\"formData\":{\"mobile_select\":\"other\",\"mobileTxt\":\"+35799484967\"}}}",
2156
+ "referenceValue": "0000000924107836"
2153
2157
  }
2154
2158
  }
2155
2159
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gov-cy/govcy-express-services",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
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",
package/src/index.mjs CHANGED
@@ -99,20 +99,20 @@ export default function initializeGovCyExpressService(){
99
99
 
100
100
  // 🛠️ Debugging routes -----------------------------------------------------
101
101
  // 🙍🏻‍♂️ -- ROUTE: Debugging route Protected Route
102
- if (!isProdOrStaging()) {
103
- app.get('/user', requireAuth, naturalPersonPolicy, (req, res) => {
104
- res.send(`
105
- User name: ${req.session.user.name}
106
- <br> Sub: ${req.session.user.sub}
107
- <br> Profile type: ${req.session.user.profile_type}
108
- <br> Clinent ip: ${req.session.user.client_ip}
109
- <br> Unique Identifier: ${req.session.user.unique_identifier}
110
- <br> Email: ${req.session.user.email}
111
- <br> Id Token: ${req.session.user.id_token}
112
- <br> Access Token: ${req.session.user.access_token}
113
- `);
114
- });
115
- }
102
+ // if (!isProdOrStaging()) {
103
+ // app.get('/user', requireAuth, naturalPersonPolicy, (req, res) => {
104
+ // res.send(`
105
+ // User name: ${req.session.user.name}
106
+ // <br> Sub: ${req.session.user.sub}
107
+ // <br> Profile type: ${req.session.user.profile_type}
108
+ // <br> Clinent ip: ${req.session.user.client_ip}
109
+ // <br> Unique Identifier: ${req.session.user.unique_identifier}
110
+ // <br> Email: ${req.session.user.email}
111
+ // <br> Id Token: ${req.session.user.id_token}
112
+ // <br> Access Token: ${req.session.user.access_token}
113
+ // `);
114
+ // });
115
+ // }
116
116
  //----------------------------------------------------------------------
117
117
 
118
118
 
@@ -122,11 +122,11 @@ export function prepareSubmissionData(req, siteId, service) {
122
122
  submissionUsername: dataLayer.getUser(req.session).name,
123
123
  submissionEmail: dataLayer.getUser(req.session).email,
124
124
  submissionData: submissionData, // Raw data as submitted by the user in each page
125
- submissionDataVersion: service.site?.submission_data_version || "", // The submission data version
125
+ submissionDataVersion: service.site?.submissionDataVersion || service.site?.submission_data_version ||"", // The submission data version
126
126
  printFriendlyData: printFriendlyData, // Print-friendly data
127
127
  rendererData: reviewSummaryList, // Renderer data of the summary list
128
- rendererVersion: service.site?.renderer_version || "", // The renderer version
129
- designSystemsVersion: service.site?.design_systems_version || "", // The design systems version
128
+ rendererVersion: service.site?.rendererVersion || service.site?.renderer_version || "", // The renderer version
129
+ designSystemsVersion: service.site?.designSystemsVersion || service.site?.design_systems_version || "", // The design systems version
130
130
  service: { // Service info
131
131
  id: service.site.id, // Service ID
132
132
  title: service.site.title // Service title multilingual object