@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 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:"{title:'title part', body:'body part'}"},
373
- {"component": "bodyHeading",params: '{"headingLevel":1}',body:"Heading 1"},
374
- {"component": "bodyParagraph", body:"Paragraph",params:'{lang:"en"}'},
375
- {"component": "bodyList", params:'{type:"ol", items: ["item 1", "item 2", "item 3"]}'}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gov-cy/dsf-email-templates",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "This project can be used to produce html email templates to be used by DSF.",
5
5
  "author": "DMRID - DSF Team",
6
6
  "license": "MIT",
@@ -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
  `
@@ -1,6 +1,5 @@
1
1
  {# header
2
2
  @param {string} serviceName The service name. Will escape text
3
- @param {string} name The name used in salutation. Will escape text
4
3
  @param {string} lang The language used. Can be 'en','el'. Optional.
5
4
  @returns govcy header for emails html
6
5
  #}
@@ -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:"{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"},
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"