@gov-cy/govcy-express-services 0.2.9 → 0.2.11
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 +2 -2
- package/src/middleware/govcyHttpErrorHandler.mjs +4 -0
- package/src/middleware/govcyReviewPageHandler.mjs +4 -0
- package/src/middleware/govcyRoutePageHandler.mjs +5 -1
- package/src/middleware/govcySuccessPageHandler.mjs +4 -0
- package/src/resources/govcyResources.mjs +6 -4
- package/src/utils/govcySubmitData.mjs +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gov-cy/govcy-express-services",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
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,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@gov-cy/dsf-email-templates": "^2.1.0",
|
|
51
|
-
"@gov-cy/govcy-frontend-renderer": "^1.17.
|
|
51
|
+
"@gov-cy/govcy-frontend-renderer": "^1.17.2",
|
|
52
52
|
"axios": "^1.9.0",
|
|
53
53
|
"cookie-parser": "^1.4.7",
|
|
54
54
|
"dotenv": "^16.3.1",
|
|
@@ -2,6 +2,7 @@ import { govcyFrontendRenderer } from '@gov-cy/govcy-frontend-renderer';
|
|
|
2
2
|
import * as govcyResources from "../resources/govcyResources.mjs";
|
|
3
3
|
import * as dataLayer from "../utils/govcyDataLayer.mjs";
|
|
4
4
|
import { logger } from "../utils/govcyLogger.mjs";
|
|
5
|
+
import { whatsIsMyEnvironment } from '../utils/govcyEnvVariables.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Middleware function to handle HTTP errors and render appropriate error pages.
|
|
@@ -17,6 +18,9 @@ export function govcyHttpErrorHandler(err, req, res, next) {
|
|
|
17
18
|
// Deep copy renderer pageData from
|
|
18
19
|
let pageData = JSON.parse(JSON.stringify(govcyResources.staticResources.rendererPageData));
|
|
19
20
|
|
|
21
|
+
// Handle isTesting
|
|
22
|
+
pageData.site.isTesting = (whatsIsMyEnvironment() === "staging");
|
|
23
|
+
|
|
20
24
|
// Handle specific HTTP errors
|
|
21
25
|
switch (statusCode) {
|
|
22
26
|
case 404:
|
|
@@ -2,6 +2,7 @@ import * as govcyResources from "../resources/govcyResources.mjs";
|
|
|
2
2
|
import * as dataLayer from "../utils/govcyDataLayer.mjs";
|
|
3
3
|
import { logger } from "../utils/govcyLogger.mjs";
|
|
4
4
|
import {preparePrintFriendlyData , generateReviewSummary } from "../utils/govcySubmitData.mjs";
|
|
5
|
+
import { whatsIsMyEnvironment } from '../utils/govcyEnvVariables.mjs';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -19,6 +20,9 @@ export function govcyReviewPageHandler() {
|
|
|
19
20
|
// Deep copy renderer pageData from
|
|
20
21
|
let pageData = JSON.parse(JSON.stringify(govcyResources.staticResources.rendererPageData));
|
|
21
22
|
|
|
23
|
+
// Handle isTesting
|
|
24
|
+
pageData.site.isTesting = (whatsIsMyEnvironment() === "staging");
|
|
25
|
+
|
|
22
26
|
// Base page template structure
|
|
23
27
|
let pageTemplate = {
|
|
24
28
|
sections: [
|
|
@@ -2,6 +2,7 @@ import { govcyFrontendRenderer } from '@gov-cy/govcy-frontend-renderer';
|
|
|
2
2
|
import * as govcyResources from "../resources/govcyResources.mjs";
|
|
3
3
|
import * as dataLayer from "../utils/govcyDataLayer.mjs";
|
|
4
4
|
import {listAvailableSiteConfigs, getServiceConfigData} from "../utils/govcyLoadConfigData.mjs";
|
|
5
|
+
import { whatsIsMyEnvironment } from '../utils/govcyEnvVariables.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Middleware function to handle the route page.
|
|
@@ -34,7 +35,10 @@ export function govcyRoutePageHandler(req, res, next) {
|
|
|
34
35
|
// Deep copy renderer pageData from
|
|
35
36
|
let pageData = JSON.parse(JSON.stringify(govcyResources.staticResources.rendererPageData));
|
|
36
37
|
const listOfAvailableSites = listAvailableSiteConfigs();
|
|
37
|
-
|
|
38
|
+
|
|
39
|
+
// Handle isTesting
|
|
40
|
+
pageData.site.isTesting = (whatsIsMyEnvironment() === "staging");
|
|
41
|
+
|
|
38
42
|
// Construct the page template
|
|
39
43
|
let pageTemplate = govcyResources.availableServicesPageTemplate(listOfAvailableSites, req.globalLang);
|
|
40
44
|
//use lang from middleware
|
|
@@ -3,6 +3,7 @@ import * as dataLayer from "../utils/govcyDataLayer.mjs";
|
|
|
3
3
|
import { logger } from "../utils/govcyLogger.mjs";
|
|
4
4
|
import { handleMiddlewareError } from "../utils/govcyUtils.mjs";
|
|
5
5
|
import { generateReviewSummary } from "../utils/govcySubmitData.mjs";
|
|
6
|
+
import { whatsIsMyEnvironment } from '../utils/govcyEnvVariables.mjs';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -28,6 +29,9 @@ export function govcySuccessPageHandler(isPDF = false) {
|
|
|
28
29
|
// Deep copy renderer pageData from
|
|
29
30
|
let pageData = JSON.parse(JSON.stringify(govcyResources.staticResources.rendererPageData));
|
|
30
31
|
|
|
32
|
+
// Handle isTesting
|
|
33
|
+
pageData.site.isTesting = (whatsIsMyEnvironment() === "staging");
|
|
34
|
+
|
|
31
35
|
if (isPDF) {
|
|
32
36
|
pageData.pageData.mainLayout = "max-width";
|
|
33
37
|
}
|
|
@@ -148,14 +148,16 @@ export const staticResources = {
|
|
|
148
148
|
},
|
|
149
149
|
url: "https://gov.cy",
|
|
150
150
|
cdn: {
|
|
151
|
-
dist: "https://cdn.jsdelivr.net/gh/gov-cy/govcy-design-system@3.2.0/dist"
|
|
151
|
+
dist: "https://cdn.jsdelivr.net/gh/gov-cy/govcy-design-system@3.2.0/dist",
|
|
152
|
+
cssIntegrity: "sha384-qjx16YXHG+Vq/NVtwU2aDTc7DoLOyaVNuOHrwA3aTrckpM/ycxZoR5dx7ezNJ/Lv",
|
|
153
|
+
jsIntegrity: "sha384-tqEyCdi3GS4uDXctplAd7ODjiK5fo2Xlqv65e8w/cVvrcBf89tsxXFHXXNiUDyM7"
|
|
152
154
|
}
|
|
153
155
|
},
|
|
154
156
|
pageData: {
|
|
155
157
|
title: {
|
|
156
|
-
en: "
|
|
157
|
-
el: "
|
|
158
|
-
tr: "
|
|
158
|
+
en: "govcy Express Services",
|
|
159
|
+
el: "govcy Express Services",
|
|
160
|
+
tr: "govcy Express Services"
|
|
159
161
|
},
|
|
160
162
|
layout: "layouts/govcyBase.njk",
|
|
161
163
|
mainLayout: "two-thirds"
|
|
@@ -331,7 +331,8 @@ export function generateReviewSummary(submissionData, req, siteId, showChangeLin
|
|
|
331
331
|
"element": "textElement",
|
|
332
332
|
"params": {
|
|
333
333
|
"text": { "en": value, "el": value, "tr": value },
|
|
334
|
-
"type": "span"
|
|
334
|
+
"type": "span",
|
|
335
|
+
"showNewLine": true
|
|
335
336
|
}
|
|
336
337
|
}
|
|
337
338
|
]
|