From e57e39ee67474f9b2cadb569e2cb8e32f750ce72 Mon Sep 17 00:00:00 2001
From: Andrei Cioromila <andrei.cioromila@thinslices.com>
Date: Tue, 30 Oct 2018 16:24:41 +0200
Subject: [PATCH] docs(email-template): update code example for using
 EmailTemplate class

---
 packages/component-email-templating/README.md | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/packages/component-email-templating/README.md b/packages/component-email-templating/README.md
index 7bb4beb69..e7472d690 100644
--- a/packages/component-email-templating/README.md
+++ b/packages/component-email-templating/README.md
@@ -56,13 +56,15 @@ The `Email` class also provides a `constructor` whose properties will be used wh
     ![notification](https://gitlab.coko.foundation/xpub/xpub-faraday/uploads/27cb6acc8ff4a07758f55e5ea0504d28/notification.png)
 
     ```javascript
-    const emailTemplate = require('@pubsweet/component-email-template')
+    const EmailTemplate = require('@pubsweet/component-email-template')
     const config = require('config')
 
     const { name: journalName, fromEmail: staffEmail } = config.get('journal')
+    
+    const paragraph = `We are please to inform you that the manuscript has passed the technical check process and is now submitted. Please click the link below to access the manuscript.`
 
     const sendNotifications = ({ user, editor, collection, fragment }) => {
-      const email = new emailTemplate({
+      const email = new EmailTemplate({
         type: 'user',
         fromEmail,
         toUser: {
@@ -74,18 +76,19 @@ The `Email` class also provides a `constructor` whose properties will be used wh
           signatureJournal: journalName,
           signatureName: `${editor.name}`,
           subject: `${collection.customId}: Manuscript Update`,
+          paragraph,
           unsubscribeLink: `http://localhost:3000/unsubscribe/${user.id}`,
           ctaLink: `http://localhost:3000/projects/${collection.id}/versions/${
             fragment.id
           }/details`,
         },
+        bodyProps: {
+          hasLink: true,
+          hasIntro: true,
+          hasSignature: true }
       })
 
-      const paragraph = `We are please to inform you that the manuscript has passed the technical check process and is now submitted. Please click the link below to access the manuscript.`
-
-      const { html, text } = email.getNotificationBody({ emailBodyProps: { paragraph, hasLink: true, hasIntro: true, hasSignature: true }})
-
-      email.sendEmail({ html, text })
+      email.sendEmail()
     }
     ```
 
-- 
GitLab