@gov-cy/dsf-email-templates 2.0.0 → 2.0.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/CHANGELOG.md +5 -0
- package/README.md +4 -4
- package/package.json +1 -1
- package/src/DSFEmailRenderer.mjs +2 -3
- package/src/njk/components/header.njk +0 -1
- package/test/moca/unit.test.js +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [v2.0.1] - 2024-04-30
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fixed bug defining string `params` as json for `DSFEmailRenderer.renderFromJson`. For example now `params` are defined as `params:{title:'title part'}` instead of `"params:{title:'title part'}"`
|
|
12
|
+
|
|
8
13
|
## [v2.0.0] - 2024-04-23
|
|
9
14
|
|
|
10
15
|
Restructure of the `govcyBase.njk`. Success now is part of the body and removed salutation from header.
|
package/README.md
CHANGED
|
@@ -369,10 +369,10 @@ const inputJson={
|
|
|
369
369
|
body:'body part'
|
|
370
370
|
},
|
|
371
371
|
body: [
|
|
372
|
-
{"component": "bodySuccess", params:
|
|
373
|
-
{"component": "bodyHeading",params:
|
|
374
|
-
{"component": "bodyParagraph",
|
|
375
|
-
{"component": "bodyList", params:
|
|
372
|
+
{"component": "bodySuccess", params:{title:'title part'}, body:'body part'},
|
|
373
|
+
{"component": "bodyHeading",params: {"headingLevel":1},body:"Heading 1"},
|
|
374
|
+
{"component": "bodyParagraph", params:{lang:"en"}, body:"Paragraph"},
|
|
375
|
+
{"component": "bodyList", params:{type:"ol", items: ["item 1", "item 2", "item 3"]}}
|
|
376
376
|
],
|
|
377
377
|
footer: {
|
|
378
378
|
footerText: "Name of service"
|
package/package.json
CHANGED
package/src/DSFEmailRenderer.mjs
CHANGED
|
@@ -86,8 +86,7 @@ export default class DSFEmailRenderer {
|
|
|
86
86
|
if (jsonInput.hasOwnProperty('header')){
|
|
87
87
|
jsonTemplate += `
|
|
88
88
|
{% block header -%}
|
|
89
|
-
{{ govcyEmailElement ('header',{serviceName:'${jsonInput.header.serviceName}'
|
|
90
|
-
name:'${jsonInput.header.name}'
|
|
89
|
+
{{ govcyEmailElement ('header',{serviceName:'${jsonInput.header.serviceName}'
|
|
91
90
|
${jsonInput.header.hasOwnProperty("lang")? `,lang:'${jsonInput.header.lang}'`:``}
|
|
92
91
|
}) }}
|
|
93
92
|
{%- endblock %}`
|
|
@@ -108,7 +107,7 @@ export default class DSFEmailRenderer {
|
|
|
108
107
|
jsonInput.body.forEach(bodyElement => {
|
|
109
108
|
//add body email element in template
|
|
110
109
|
jsonTemplate += `
|
|
111
|
-
{% call govcyEmailElement('${bodyElement.component}',${bodyElement.params}) -%}
|
|
110
|
+
{% call govcyEmailElement('${bodyElement.component}',${JSON.stringify(bodyElement.params)}) -%}
|
|
112
111
|
${bodyElement.body}
|
|
113
112
|
{%- endcall %}
|
|
114
113
|
`
|
package/test/moca/unit.test.js
CHANGED
|
@@ -40,11 +40,11 @@ describe('2. Testing `DSFEmailRenderer.renderFromJson`', () => {
|
|
|
40
40
|
header: {serviceName:'Service name'},
|
|
41
41
|
body: [
|
|
42
42
|
{"component": "bodyParagraph", body:"Paragraph"},
|
|
43
|
-
{"component": "bodySuccess", params:
|
|
44
|
-
{"component": "bodyHeading",params:
|
|
45
|
-
{"component": "bodyHeading",params:
|
|
46
|
-
{"component": "bodyHeading",params:
|
|
47
|
-
{"component": "bodyHeading",params:
|
|
43
|
+
{"component": "bodySuccess", params:{title:'title part', body:'body part'}},
|
|
44
|
+
{"component": "bodyHeading",params: {"headingLevel":1},body:"Heading 1"},
|
|
45
|
+
{"component": "bodyHeading",params: {"headingLevel":2},body:"Heading 2"},
|
|
46
|
+
{"component": "bodyHeading",params: {"headingLevel":3},body:"Heading 3"},
|
|
47
|
+
{"component": "bodyHeading",params: {"headingLevel":4},body:"Heading 4"},
|
|
48
48
|
],
|
|
49
49
|
footer: {
|
|
50
50
|
footerText: "Name of service"
|