@gov-cy/govcy-express-services 1.6.4 → 1.6.6
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.6.
|
|
3
|
+
"version": "1.6.6",
|
|
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",
|
|
@@ -53,7 +53,7 @@ export function govcyReviewPostHandler() {
|
|
|
53
53
|
if (page.updateMyDetails) {
|
|
54
54
|
logger.debug("Validating UpdateMyDetails page during review POST", { siteId, pageUrl });
|
|
55
55
|
// Build the manual UMD page template
|
|
56
|
-
const umdTemplate = createUmdManualPageTemplate(siteId, service.site.lang, page, req);
|
|
56
|
+
const umdTemplate = createUmdManualPageTemplate(siteId, service.site.lang, page, req, true);
|
|
57
57
|
|
|
58
58
|
// Extract the form element
|
|
59
59
|
formElement = umdTemplate.sections
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
import {logger} from "../utils/govcyLogger.mjs";
|
|
4
5
|
import {listAvailableSiteConfigs, getServiceConfigData} from "../utils/govcyLoadConfigData.mjs";
|
|
5
6
|
import { whatsIsMyEnvironment } from '../utils/govcyEnvVariables.mjs';
|
|
6
7
|
|
|
@@ -13,7 +14,13 @@ export function govcyRoutePageHandler(req, res, next) {
|
|
|
13
14
|
// if current service cookie is set redirect to that page
|
|
14
15
|
if (req.cookies.cs) {
|
|
15
16
|
const siteId = req.cookies.cs;
|
|
16
|
-
|
|
17
|
+
let serviceData = {};
|
|
18
|
+
try {
|
|
19
|
+
serviceData = getServiceConfigData(siteId, req.globalLang) || {};
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
logger.debug('Could not read data from cookie:', e.message);
|
|
23
|
+
}
|
|
17
24
|
if (serviceData.site && serviceData.site.homeRedirectPage) {
|
|
18
25
|
const homeRedirectPage = serviceData.site.homeRedirectPage;
|
|
19
26
|
const lang = req.globalLang || 'el'; // fallback to 'en' if not set
|
|
@@ -698,9 +698,10 @@ function createUmdHasNoDataPageTemplate(siteId, lang, page, req, umdBaseURL) {
|
|
|
698
698
|
* @param {string} lang The language
|
|
699
699
|
* @param {object} page The page object
|
|
700
700
|
* @param {object} req The request object
|
|
701
|
+
* @param {boolean} fromReview Whether the page is from the review route
|
|
701
702
|
* @returns {object} The page template
|
|
702
703
|
*/
|
|
703
|
-
export function createUmdManualPageTemplate(siteId, lang, page, req) {
|
|
704
|
+
export function createUmdManualPageTemplate(siteId, lang, page, req, fromReview = false) {
|
|
704
705
|
const umdConfig = page?.updateMyDetails || {};
|
|
705
706
|
// Build hub template
|
|
706
707
|
const pageTemplate = {
|
|
@@ -744,7 +745,10 @@ export function createUmdManualPageTemplate(siteId, lang, page, req) {
|
|
|
744
745
|
//for each element in the scope array
|
|
745
746
|
umdConfig?.scope.forEach(element => {
|
|
746
747
|
// ➕ Add the element
|
|
747
|
-
pageTemplate.sections[0].elements[0].params.elements.push(
|
|
748
|
+
pageTemplate.sections[0].elements[0].params.elements.push(
|
|
749
|
+
fromReview ? govcyResources.staticResources.elements.umdManualReview[element] :
|
|
750
|
+
govcyResources.staticResources.elements.umdManual[element]
|
|
751
|
+
);
|
|
748
752
|
|
|
749
753
|
})
|
|
750
754
|
// ➕ Add the continue button
|
|
@@ -236,32 +236,32 @@ export const staticResources = {
|
|
|
236
236
|
en: "Your details",
|
|
237
237
|
tr: "Your details"
|
|
238
238
|
},
|
|
239
|
-
updateMyDetailsScopes
|
|
240
|
-
fullName
|
|
239
|
+
updateMyDetailsScopes: {
|
|
240
|
+
fullName:
|
|
241
241
|
{
|
|
242
242
|
el: "Ονοματεπώνυμο",
|
|
243
243
|
en: "Full name",
|
|
244
244
|
tr: "Full name"
|
|
245
|
-
},
|
|
246
|
-
email
|
|
245
|
+
},
|
|
246
|
+
email:
|
|
247
247
|
{
|
|
248
248
|
el: "Email",
|
|
249
249
|
en: "Email",
|
|
250
250
|
tr: "Email"
|
|
251
|
-
},
|
|
252
|
-
mobile
|
|
251
|
+
},
|
|
252
|
+
mobile:
|
|
253
253
|
{
|
|
254
254
|
el: "Αριθμός κινητού τηλεφώνου",
|
|
255
255
|
en: "Mobile phone number",
|
|
256
256
|
tr: "Mobile phone number"
|
|
257
|
-
},
|
|
258
|
-
address
|
|
257
|
+
},
|
|
258
|
+
address:
|
|
259
259
|
{
|
|
260
260
|
el: "Διεύθυνση αλληλογραφίας",
|
|
261
261
|
en: "Mailing address",
|
|
262
262
|
tr: "Mailing address"
|
|
263
263
|
},
|
|
264
|
-
dob
|
|
264
|
+
dob:
|
|
265
265
|
{
|
|
266
266
|
el: "Ημερομηνία γέννησης",
|
|
267
267
|
en: "Date of birth",
|
|
@@ -617,67 +617,193 @@ export const staticResources = {
|
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
]
|
|
620
|
-
},
|
|
621
|
-
"dob"
|
|
620
|
+
},
|
|
621
|
+
"dob": {
|
|
622
622
|
element: "dateInput",
|
|
623
623
|
params: {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
624
|
+
id: "dob",
|
|
625
|
+
name: "dob",
|
|
626
|
+
legend: {
|
|
627
|
+
el: "Ημερομηνία γέννησης",
|
|
628
|
+
en: "Date of birth"
|
|
629
|
+
},
|
|
630
|
+
isPageHeading: false,
|
|
631
|
+
hint: {
|
|
632
|
+
el: "Για παράδειγμα, 13 8 2001",
|
|
633
|
+
en: "For example, 13 8 2001"
|
|
634
|
+
}
|
|
635
635
|
},
|
|
636
636
|
validations: [
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
637
|
+
{
|
|
638
|
+
check: "required",
|
|
639
|
+
params: {
|
|
640
|
+
checkValue: "",
|
|
641
|
+
message: {
|
|
642
|
+
el: "Εισαγάγετε την ημερομηνία γέννησης",
|
|
643
|
+
en: "Enter the date of birth",
|
|
644
|
+
tr: ""
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
check: "valid",
|
|
650
|
+
params: {
|
|
651
|
+
checkValue: "dateISO",
|
|
652
|
+
message: {
|
|
653
|
+
el: "Η ημερομηνία γέννησης πρέπει να είναι σωστή ημερομηνία",
|
|
654
|
+
en: "The date of birth must be an valid date",
|
|
655
|
+
tr: ""
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
check: "minValueDate",
|
|
661
|
+
params: {
|
|
662
|
+
checkValue: "1900-01-01",
|
|
663
|
+
message: {
|
|
664
|
+
el: "Η ημερομηνία γέννησης πρέπει να είναι μετά από τις 1/1/1990",
|
|
665
|
+
en: "The date of birth must be after 1/1/1900",
|
|
666
|
+
tr: ""
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
check: "valid",
|
|
672
|
+
params: {
|
|
673
|
+
checkValue: "maxCurrentDate",
|
|
674
|
+
message: {
|
|
675
|
+
el: "Η ημερομηνία γέννησης δεν πρέπει να είναι στο μέλλον",
|
|
676
|
+
en: "The date of birth must not be in the future",
|
|
677
|
+
tr: ""
|
|
678
|
+
}
|
|
679
|
+
}
|
|
645
680
|
}
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
umdManualReview: {
|
|
685
|
+
fullName: {
|
|
686
|
+
element: "textInput",
|
|
687
|
+
params: {
|
|
688
|
+
id: "fullName",
|
|
689
|
+
name: "fullName",
|
|
690
|
+
label: {
|
|
691
|
+
el: "Ονοματεπώνυμο",
|
|
692
|
+
en: "Full name",
|
|
693
|
+
tr: ""
|
|
646
694
|
}
|
|
647
695
|
},
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
696
|
+
validations: [
|
|
697
|
+
{
|
|
698
|
+
check: "required",
|
|
699
|
+
params: {
|
|
700
|
+
checkValue: "",
|
|
701
|
+
message: {
|
|
702
|
+
el: "Εισαγάγετε το όνομα σας",
|
|
703
|
+
en: "Enter your name",
|
|
704
|
+
tr: ""
|
|
705
|
+
}
|
|
706
|
+
}
|
|
656
707
|
}
|
|
708
|
+
]
|
|
709
|
+
},
|
|
710
|
+
mobile: {
|
|
711
|
+
element: "textInput",
|
|
712
|
+
params: {
|
|
713
|
+
id: "mobile",
|
|
714
|
+
name: "mobile",
|
|
715
|
+
label: {
|
|
716
|
+
el: "Αριθμός κινητού τηλεφώνου",
|
|
717
|
+
en: "Mobile phone number",
|
|
718
|
+
tr: ""
|
|
657
719
|
}
|
|
658
720
|
},
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
721
|
+
validations: [
|
|
722
|
+
{
|
|
723
|
+
check: "required",
|
|
724
|
+
params: {
|
|
725
|
+
checkValue: "",
|
|
726
|
+
message: {
|
|
727
|
+
el: "Εισαγάγετε τον αριθμό κινητού τηλεφώνου",
|
|
728
|
+
en: "Enter your mobile number",
|
|
729
|
+
tr: ""
|
|
730
|
+
}
|
|
731
|
+
}
|
|
667
732
|
}
|
|
733
|
+
]
|
|
734
|
+
},
|
|
735
|
+
email: {
|
|
736
|
+
element: "textInput",
|
|
737
|
+
params: {
|
|
738
|
+
id: "email",
|
|
739
|
+
name: "email",
|
|
740
|
+
label: {
|
|
741
|
+
el: "Email",
|
|
742
|
+
en: "Email",
|
|
743
|
+
tr: ""
|
|
668
744
|
}
|
|
669
745
|
},
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
746
|
+
validations: [
|
|
747
|
+
{
|
|
748
|
+
check: "required",
|
|
749
|
+
params: {
|
|
750
|
+
checkValue: "",
|
|
751
|
+
message: {
|
|
752
|
+
el: "Εισαγάγετε το email σας",
|
|
753
|
+
en: "Enter your email",
|
|
754
|
+
tr: ""
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
]
|
|
759
|
+
},
|
|
760
|
+
address: {
|
|
761
|
+
element: "textArea",
|
|
762
|
+
params: {
|
|
763
|
+
id: "address",
|
|
764
|
+
name: "address",
|
|
765
|
+
label: {
|
|
766
|
+
el: "Διεύθυνση αλληλογραφίας",
|
|
767
|
+
en: "Mailing address",
|
|
677
768
|
tr: ""
|
|
678
769
|
}
|
|
770
|
+
},
|
|
771
|
+
validations: [
|
|
772
|
+
{
|
|
773
|
+
check: "required",
|
|
774
|
+
params: {
|
|
775
|
+
checkValue: "",
|
|
776
|
+
message: {
|
|
777
|
+
el: "Εισαγάγετε τη διεύθυνσης αλληλογραφίας σας",
|
|
778
|
+
en: "Enter your mailing address",
|
|
779
|
+
tr: ""
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
"dob": {
|
|
786
|
+
element: "dateInput",
|
|
787
|
+
params: {
|
|
788
|
+
id: "dob",
|
|
789
|
+
name: "dob",
|
|
790
|
+
legend: {
|
|
791
|
+
el: "Ημερομηνία γέννησης",
|
|
792
|
+
en: "Date of birth"
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
validations: [
|
|
796
|
+
{
|
|
797
|
+
check: "required",
|
|
798
|
+
params: {
|
|
799
|
+
checkValue: "",
|
|
800
|
+
message: {
|
|
801
|
+
el: "Εισαγάγετε την ημερομηνία γέννησης",
|
|
802
|
+
en: "Enter the date of birth",
|
|
803
|
+
tr: ""
|
|
804
|
+
}
|
|
805
|
+
}
|
|
679
806
|
}
|
|
680
|
-
}
|
|
681
807
|
]
|
|
682
808
|
}
|
|
683
809
|
},
|