diff --git a/packages/component-helper-service/src/services/Email.js b/packages/component-helper-service/src/services/Email.js index 22d203fc1411f3aeda9136bd60ad52f7b1a4e663..8a6c29954fa300bbe3d76b5be587098c19c0679b 100644 --- a/packages/component-helper-service/src/services/Email.js +++ b/packages/component-helper-service/src/services/Email.js @@ -1,8 +1,11 @@ const Fragment = require('./Fragment') const User = require('./User') +const services = require('./services') const get = require('lodash/get') const config = require('config') -const mailService = require('pubsweet-component-mail-service') +const mailService = require('pubsweet-component-mail-template-service') + +const unsubscribeSlug = config.get('unsubscribe.url') const manuscriptTypes = config.get('manuscript-types') @@ -160,7 +163,7 @@ class Email { baseUrl, UserModel, collection, - parsedFragment: { heRecommendation, id, title, newComments }, + parsedFragment: { heRecommendation, id: fragmentId, title, newComments }, authors: { submittingAuthor: { id: submittingAuthorId, @@ -174,11 +177,20 @@ class Email { if (requestToRevision) comments = newComments const authorNote = comments.find(comm => comm.public) const content = get(authorNote, 'content') - const authorNoteText = content ? `Reason & Details: "${content}"` : '' - let emailType = requestToRevision - ? 'author-request-to-revision' - : 'author-manuscript-rejected' - if (publish) emailType = 'author-manuscript-published' + const notes = content ? `Reason & Details: "${content}"` : '' + + let emailType, subject + if (requestToRevision) { + emailType = 'author-request-to-revision' + subject = `${collection.customId}: Manuscript Recommendation` + } else if (publish) { + emailType = 'author-manuscript-published' + subject = `${collection.customId}: Manuscript Published` + } else { + emailType = 'author-manuscript-rejected' + subject = `${collection.customId}: Manuscript Rejected` + } + let toAuthors = null if (emailType === 'author-request-to-revision') { toAuthors = [ @@ -189,7 +201,7 @@ class Email { }, ] } else { - const fragment = await FragmentModel.find(id) + const fragment = await FragmentModel.find(fragmentId) const userHelper = new User({ UserModel }) const activeAuthors = await userHelper.getActiveAuthors(fragment.authors) @@ -199,23 +211,39 @@ class Email { name: `${author.firstName} ${author.lastName}`, })) } + toAuthors.forEach(toAuthor => { mailService.sendNotificationEmail({ emailType, - toId: toAuthor.id, toEmail: toAuthor.email, - meta: { - handlingEditorName: get(collection, 'handlingEditor.name'), - baseUrl, - collection, - authorNoteText, - fragment: { - id, - title, - authorName: toAuthor.name, - submittingAuthorName: `${firstName} ${lastName}`, - }, + notes, + subject, + hasLink: false, + manuscriptTitleText: `the manuscript titled "${title}" by ${firstName} ${lastName}`, + replacements: { + signatureName: get(collection, 'handlingEditor.name'), + toUserName: toAuthor.name, + beforeAnchor: 'Please visit the', + afterAnchor: 'to see the full review', + detailsUrl: services.createUrl( + baseUrl, + `/projects/${collection.id}/versions/${fragmentId}/details`, + ), + unsubscribeLink: services.createUrl(baseUrl, unsubscribeSlug, { + id: toAuthor.id, + }), }, + // meta: { + // handlingEditorName: get(collection, 'handlingEditor.name'), + // baseUrl, + // collection, + // fragment: { + // id, + // title, + // authorName: toAuthor.name, + // submittingAuthorName: `${firstName} ${lastName}`, + // }, + // }, }) }) } diff --git a/packages/component-helper-service/src/services/services.js b/packages/component-helper-service/src/services/services.js index cb56e8ec7edd3c811f3f77f11f66567c70d4a898..d489c28253937065f6864027bcf2d75b1299c5f1 100644 --- a/packages/component-helper-service/src/services/services.js +++ b/packages/component-helper-service/src/services/services.js @@ -1,4 +1,5 @@ const logger = require('@pubsweet/logger') +const querystring = require('querystring') const checkForUndefinedParams = (...params) => { if (params.includes(undefined)) { @@ -75,9 +76,15 @@ const handleNotFoundError = async (error, item) => { const getBaseUrl = req => `${req.protocol}://${req.get('host')}` +const createUrl = (baseUrl, slug, queryParams = null) => + !queryParams + ? `${baseUrl}${slug}` + : `${baseUrl}${slug}?${querystring.encode(queryParams)}` + module.exports = { checkForUndefinedParams, validateEmailAndToken, handleNotFoundError, getBaseUrl, + createUrl, } diff --git a/packages/component-mail-service/index.js b/packages/component-mail-service/index.js deleted file mode 100644 index 3d0b3c14535e01c151f895accdfd5e0ccfc1294b..0000000000000000000000000000000000000000 --- a/packages/component-mail-service/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./src/Mail') diff --git a/packages/component-mail-service/.gitignore b/packages/component-mail-template-service/.gitignore similarity index 100% rename from packages/component-mail-service/.gitignore rename to packages/component-mail-template-service/.gitignore diff --git a/packages/component-mail-service/README.md b/packages/component-mail-template-service/README.md similarity index 100% rename from packages/component-mail-service/README.md rename to packages/component-mail-template-service/README.md diff --git a/packages/component-mail-template-service/index.js b/packages/component-mail-template-service/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6cc9b0bba389b497f7e17f10b0cea0fb2d9b344f --- /dev/null +++ b/packages/component-mail-template-service/index.js @@ -0,0 +1 @@ +module.exports = require('./src/MailTemplate') diff --git a/packages/component-mail-service/package.json b/packages/component-mail-template-service/package.json similarity index 70% rename from packages/component-mail-service/package.json rename to packages/component-mail-template-service/package.json index 5a8328e59fbbeab1b75e18cabfa51879627adc0d..0963e86646c95dffc363492a6ea7c8267d185f77 100644 --- a/packages/component-mail-service/package.json +++ b/packages/component-mail-template-service/package.json @@ -1,7 +1,7 @@ { - "name": "pubsweet-component-mail-service", + "name": "pubsweet-component-mail-template-service", "version": "0.0.1", - "description": "mail service component for pubsweet", + "description": "mail template service component for pubsweet", "license": "MIT", "author": "Collaborative Knowledge Foundation", "files": [ @@ -10,8 +10,7 @@ "main": "index.js", "repository": { "type": "git", - "url": "https://gitlab.coko.foundation/xpub/xpub", - "path": "component-mail-service" + "url": "https://gitlab.coko.foundation/xpub/xpub" }, "dependencies": { "@pubsweet/component-send-email": "0.2.1", diff --git a/packages/component-mail-service/src/Mail.js b/packages/component-mail-template-service/src/MailTemplate.js similarity index 58% rename from packages/component-mail-service/src/Mail.js rename to packages/component-mail-template-service/src/MailTemplate.js index 5bb850405ba7d10c006d211d259fcaea479065ae..217e4ebbee62169c048d6d7fd0b0abdd0a0308cc 100644 --- a/packages/component-mail-service/src/Mail.js +++ b/packages/component-mail-template-service/src/MailTemplate.js @@ -320,368 +320,161 @@ module.exports = { return Email.send(mailData) }, sendNotificationEmail: async ({ - user, - toId, + notes, toEmail, + subject, emailType, - meta = { privateNote: '' }, + timestamp, + reviewerName, + replacements, + manuscriptTitleText, }) => { - let subject, textBody + // const replacements = { + // hasLink: true, + // paragraph, + // signatureName, + // intro: `Dear Dr. ${toUser.name}`, + // beforeAnchor: 'Please visit the', + // afterAnchor: 'to see the full review', + // detailsUrl: helpers.createUrl( + // baseUrl, + // `/projects/${collectionId}/versions/${fragmentId}/details`, + // ), + // unsubscribeLink: helpers.createUrl(baseUrl, unsubscribeSlug, { + // id: toUser.id, + // }), + // } + + // const manuscriptTitleText = `the manuscript titled "${title}" by ${authorName}` - const emailTemplate = 'notification' - const detailsUrl = meta.baseUrl - ? helpers.createUrl( - meta.baseUrl, - `/projects/${meta.collection.id}/versions/${ - meta.fragment.id - }/details`, - ) - : '' - const replacements = { - detailsUrl, - hasLink: true, - afterAnchor: '', - beforeAnchor: '', - unsubscribeLink: helpers.createUrl(meta.baseUrl, unsubscribeSlug, { - id: toId, - }), - } switch (emailType) { case 'unassign-reviewer': - subject = `${meta.collection.customId}: Review Unassigned` - replacements.previewText = 'notification from Hindawi' - replacements.intro = `Dear ${user.firstName} ${user.lastName}` - - replacements.paragraph = `You are no longer needed to review the article titled "${ - meta.fragment.title - }" by ${ - meta.fragment.authorName - }. If you have comments on this manuscript you believe the Editor should + replacements.paragraph = `You are no longer needed to review ${manuscriptTitleText}. If you have comments on this manuscript you believe the Editor should see, please email them to ${config.get( 'mailer.from', )} as soon as possible. Thank you for your time and I hope you will consider reviewing for Hindawi again.` - replacements.beforeAnchor = 'Please visit the' - replacements.afterAnchor = 'to see the full review' - replacements.signatureName = meta.handlingEditorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.afterAnchor} ${ - replacements.signatureName - }` break case 'review-submitted': - subject = `${meta.collection.customId}: Manuscript Review` - replacements.previewText = 'a new review has been submitted' - replacements.intro = `Dear ${meta.handlingEditorName}` - - replacements.paragraph = `We are pleased to inform you that Dr. ${ - meta.reviewerName - } has submitted a review for the manuscript titled "${ - meta.fragment.title - }" by ${meta.fragment.authorName}.` - replacements.beforeAnchor = 'Please visit the' - replacements.afterAnchor = 'to see the full review' - - replacements.signatureName = meta.eicName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.afterAnchor} ${ - replacements.signatureName - }` + // subject = `${customId}: Manuscript Review` + replacements.paragraph = `We are pleased to inform you that Dr. ${reviewerName} has submitted a review for ${manuscriptTitleText}.` break case 'reviewer-agreed': - subject = `${meta.collection.customId}: Manuscript Reviews` - replacements.previewText = 'a user has agreed to review' - replacements.intro = `Dear ${meta.handlingEditorName}` - - replacements.paragraph = `We are pleased to inform you that Dr. ${ - user.firstName - } ${user.lastName} has agreed to review the manuscript titled "${ - meta.fragment.title - }" by ${ - meta.fragment.authorName - }. You should receive the report by Dr. ${user.firstName} ${ - user.lastName - } before ${helpers.getExpectedDate(meta.timestamp, 14)}.` + // subject = `${meta.collection.customId}: Manuscript Reviews` + replacements.paragraph = `We are pleased to inform you that Dr. ${reviewerName} has agreed to review ${manuscriptTitleText}. <br/> + You should receive the report by Dr. ${reviewerName} before ${helpers.getExpectedDate( + timestamp, + 14, + )}.` replacements.beforeAnchor = 'If you have any queries, or would like to send a reminder if you no report has been submitted, then please visit the' - replacements.afterAnchor = 'to see the full review' - - replacements.signatureName = meta.eicName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.afterAnchor} ${ - replacements.signatureName - }` break case 'reviewer-declined': - subject = `${meta.collection.customId}: Manuscript Reviews` - replacements.previewText = 'a user has declined to review' - replacements.intro = `Dear ${meta.handlingEditorName}` - replacements.paragraph = `We regret to inform you that Dr. ${ - user.firstName - } ${user.lastName} has declined to review the manuscript titled "${ - meta.fragment.title - }" by ${meta.fragment.authorName}.` - replacements.beforeAnchor = 'Please visit the' + // subject = `${meta.collection.customId}: Manuscript Reviews` + replacements.paragraph = `We regret to inform you that Dr. ${reviewerName} has declined to review ${manuscriptTitleText}.` replacements.afterAnchor = 'to see if you need to invite any additional reviewers in order to reach a decision on the manuscript' - replacements.signatureName = meta.eicName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.afterAnchor} ${ - replacements.signatureName - }` break case 'reviewer-thank-you': - subject = `${meta.collection.customId}: Manuscript Review` - replacements.previewText = 'Hindawi says thank you' - replacements.intro = `Dear Dr. ${user.firstName} ${user.lastName}` - - replacements.paragraph = `Thank you for agreeing to review the manuscript titled "${ - meta.fragment.title - }" by ${meta.fragment.authorName}.` + // subject = `${meta.collection.customId}: Manuscript Review` + replacements.paragraph = `Thank you for agreeing to review ${manuscriptTitleText}.` replacements.beforeAnchor = 'You can view the full PDF file of the manuscript and post your review report using the following URL:' - replacements.signatureName = meta.handlingEditorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.afterAnchor} ${ - replacements.signatureName - }` + replacements.afterAnchor = '' break - case 'agreed-reviewers-after-recommendation': - subject = meta.emailSubject + case 'agreed-reviewers-after-he-recommendation': replacements.hasLink = false - replacements.previewText = - 'a manuscript has received a recommendation based on reviews' - replacements.intro = `Dear Dr. ${meta.reviewerName}` - - replacements.paragraph = `I appreciate any time you may have spent reviewing manuscript "${ - meta.fragment.title - }" by ${ - meta.fragment.authorName - }. However, an editorial decision has been made and the review of this manuscript is now complete. I apologize for any inconvenience. <br/> + replacements.paragraph = `I appreciate any time you may have spent reviewing ${manuscriptTitleText}. However, an editorial decision has been made and the review of this manuscript is now complete. I apologize for any inconvenience. <br/> If you have comments on this manuscript you believe the Editor should see, please email them to Hindawi as soon as possible. <br/> Thank you for your interest and I hope you will consider reviewing for Hindawi again.` - delete replacements.detailsUrl - replacements.signatureName = meta.editorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.signatureName - }` break - case 'no-response-reviewers-after-recommendation': - subject = meta.emailSubject + case 'pending-reviewers-after-he-recommendation': replacements.hasLink = false - replacements.previewText = 'a manuscript has reached a decision' - replacements.intro = `Dear Dr. ${meta.reviewerName}` - replacements.paragraph = `An editorial decision has been made regarding the ${ - meta.manuscriptType - } titled "${meta.fragment.title}" by ${ - meta.fragment.authorName - }. So, you do not need to proceed with the review of this manuscript. <br/><br/> + replacements.paragraph = `An editorial decision has been made regarding ${manuscriptTitleText}. So, you do not need to proceed with the review of this manuscript. <br/><br/> If you have comments on this manuscript you believe the Editor should see, please email them to Hindawi as soon as possible.` - delete replacements.detailsUrl - replacements.signatureName = meta.editorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.signatureName - }` break case 'eic-recommendation': - subject = `${meta.collection.customId}: Manuscript Recommendation` - replacements.previewText = - 'a handling editor has submitted a recommendation' - replacements.intro = `Dear Dr. ${meta.eicName}` - replacements.paragraph = meta.paragraph + // subject = `${meta.collection.customId}: Manuscript Recommendation` replacements.beforeAnchor = 'For more information about what is required, please visit the ' - replacements.signatureName = meta.handlingEditorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.afterAnchor} ${ - replacements.signatureName - }` break case 'author-request-to-revision': - subject = `${meta.collection.customId}: Manuscript Recommendation` - replacements.previewText = - 'a handling editor has submitted a recommendation' - replacements.intro = `Dear Dr. ${meta.fragment.authorName}` - replacements.paragraph = `In order for the manuscript titled "${ - meta.fragment.title - }" by ${ - meta.fragment.authorName - } to proceed to publication, there needs to be a revision. <br/><br/> - ${meta.authorNoteText}<br/><br/>` + // subject = `${meta.collection.customId}: Manuscript Recommendation` + replacements.paragraph = `In order for ${manuscriptTitleText} to proceed to publication, there needs to be a revision. <br/><br/> + ${notes}<br/><br/>` replacements.beforeAnchor = 'For more information about what is required, please visit the ' - replacements.signatureName = meta.handlingEditorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.signatureName}` break case 'author-manuscript-rejected': - subject = `${meta.collection.customId}: Manuscript Rejected` - replacements.previewText = 'a manuscript has been rejected' - replacements.intro = `Dear Dr. ${meta.fragment.authorName}` - replacements.paragraph = `I am sorry to inform you that manuscript titled "${ - meta.fragment.title - }" by ${ - meta.fragment.submittingAuthorName - } has been rejected for publication. <br/><br/> - ${meta.authorNoteText}<br/><br/>` + // subject = `${meta.collection.customId}: Manuscript Rejected` + replacements.paragraph = `I am sorry to inform you that ${manuscriptTitleText} has been rejected for publication. <br/><br/> + ${notes}<br/><br/>` replacements.hasLink = false - delete replacements.detailsUrl - replacements.signatureName = meta.handlingEditorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.signatureName - }` break case 'author-manuscript-published': - subject = `${meta.collection.customId}: Manuscript Decision` - replacements.previewText = 'a manuscript has been published' - replacements.intro = `Dear Dr. ${meta.fragment.authorName}` - replacements.paragraph = `I am delighted to inform you that manuscript titled "${ - meta.fragment.title - }" by ${ - meta.fragment.submittingAuthorName - } has passed through the review process and will be published in Hindawi.<br/><br/> - ${meta.authorNoteText}<br/><br/> + replacements.paragraph = `I am delighted to inform you that ${manuscriptTitleText} has passed through the review process and will be published in Hindawi.<br/><br/> + ${notes}<br/><br/> Thanks again for choosing to publish with us.` replacements.hasLink = false - delete replacements.detailsUrl - replacements.signatureName = meta.handlingEditorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.signatureName - }` break case 'he-manuscript-rejected': - subject = meta.emailSubject + // subject = meta.emailSubject replacements.hasLink = false - replacements.previewText = 'a manuscript has been rejected' - replacements.intro = `Dear Dr. ${meta.handlingEditorName}` - - replacements.paragraph = `Thank you for your recommendation to reject the manuscript titled "${ - meta.fragment.title - }" by ${ - meta.fragment.authorName - } based on the reviews you received.<br/><br/> + replacements.paragraph = `Thank you for your recommendation to reject ${manuscriptTitleText} based on the reviews you received.<br/><br/> I can confirm this article has now been rejected.` - delete replacements.detailsUrl - replacements.signatureName = meta.eicName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.signatureName - }` break case 'he-manuscript-published': - subject = meta.emailSubject + // subject = meta.emailSubject replacements.hasLink = false - replacements.previewText = 'a manuscript has been published' - replacements.intro = `Dear Dr. ${meta.handlingEditorName}` - - replacements.paragraph = `Thank you for your recommendation to publish the manuscript titled "${ - meta.fragment.title - }" by ${ - meta.fragment.authorName - } based on the reviews you received.<br/><br/> + replacements.paragraph = `Thank you for your recommendation to publish the manuscript titled ${manuscriptTitleText} based on the reviews you received.<br/><br/> I can confirm this article will now go through to publication.` - delete replacements.detailsUrl - replacements.signatureName = meta.eicName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.signatureName - }` break case 'he-manuscript-return-with-comments': - subject = meta.emailSubject + // subject = meta.emailSubject replacements.hasLink = false - replacements.previewText = - 'a manuscript has been returned with comments' - replacements.intro = `Dear Dr. ${meta.handlingEditorName}` - - replacements.paragraph = `Thank you for your recommendation for the manuscript titled "${ - meta.fragment.title - }" by ${ - meta.fragment.authorName - } based on the reviews you received.<br/><br/> - ${meta.eicComments}<br/><br/>` - delete replacements.detailsUrl - replacements.signatureName = meta.eicName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.signatureName - }` + replacements.paragraph = `Thank you for your recommendation for ${manuscriptTitleText} based on the reviews you received.<br/><br/> + ${notes}<br/><br/>` break case 'submitting-reviewers-after-decision': - subject = meta.emailSubject + // subject = meta.emailSubject replacements.hasLink = false - replacements.previewText = 'a decision has been made on a manuscript' - replacements.intro = `Dear Dr. ${meta.reviewerName}` - - replacements.paragraph = `Thank you for your review on the manuscript titled "${ - meta.fragment.title - }" by ${ - meta.fragment.authorName - }. After taking into account the reviews and the recommendation of the Handling Editor, I can confirm this article ${ - meta.emailText - }.<br/><br/> + replacements.paragraph = `Thank you for your review on ${manuscriptTitleText}. After taking into account the reviews and the recommendation of the Handling Editor, I can confirm this article ${notes}.<br/><br/> If you have any queries about this decision, then please email them to Hindawi as soon as possible.` - delete replacements.detailsUrl - replacements.signatureName = meta.editorName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.signatureName - }` break case 'new-version-submitted': - subject = `${meta.collection.customId}: Manuscript Update` - replacements.previewText = 'A manuscript has been updated' - replacements.intro = `Dear Dr. ${meta.handlingEditorName}` - - replacements.paragraph = `A new version of the manuscript titled "${ - meta.fragment.title - }" by ${meta.fragment.authorName} has been submitted.` + // subject = `${meta.collection.customId}: Manuscript Update` + replacements.paragraph = `A new version of ${manuscriptTitleText} has been submitted.` replacements.beforeAnchor = 'Previous reviewers have been automatically invited to review the manuscript again. Please visit the' replacements.afterAnchor = 'to see the latest version and any other actions you may need to take' - - replacements.signatureName = meta.eicName - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.afterAnchor} ${ - replacements.signatureName - }` break case 'submitting-reviewers-after-revision': - subject = `${meta.collection.customId}: Manuscript Update` - replacements.previewText = 'A manuscript has been updated' - replacements.intro = `Dear Dr. ${meta.reviewerName}` - - replacements.paragraph = `A new version of the manuscript titled "${ - meta.fragment.title - }" by ${meta.fragment.authorName} has been submitted.` + // subject = `${meta.collection.customId}: Manuscript Update` + replacements.paragraph = `A new version of ${manuscriptTitleText} has been submitted.` replacements.beforeAnchor = `As you have reviewed the previous version of this manuscript, I would be grateful if you can review this revised version and submit a review report by ${helpers.getExpectedDate( - meta.timestamp, + timestamp, 14, )}. You can download the PDF of the revised version and submit your new review from the following URL:` - - replacements.signatureName = meta.collection.handlingEditor.name - textBody = `${replacements.intro} ${replacements.paragraph} ${ - replacements.beforeAnchor - } ${replacements.detailsUrl} ${replacements.signatureName}` break default: subject = 'Hindawi Notification!' break } - const htmlBody = helpers.getNotificationBody(emailTemplate, replacements) + const htmlBody = helpers.getNotificationBody('notification', replacements) const mailData = { from: config.get('mailer.from'), to: toEmail, subject, - text: textBody, + text: `${replacements.intro} ${replacements.paragraph} ${ + replacements.beforeAnchor + } ${replacements.detailsUrl} ${replacements.afterAnchor} ${ + replacements.signatureName + }`, html: htmlBody, } - return Email.send(mailData) + + Email.send(mailData) }, } diff --git a/packages/component-mail-service/src/helpers/helpers.js b/packages/component-mail-template-service/src/helpers/helpers.js similarity index 100% rename from packages/component-mail-service/src/helpers/helpers.js rename to packages/component-mail-template-service/src/helpers/helpers.js diff --git a/packages/component-mail-service/src/templates/invitation.html b/packages/component-mail-template-service/src/templates/invitation.html similarity index 100% rename from packages/component-mail-service/src/templates/invitation.html rename to packages/component-mail-template-service/src/templates/invitation.html diff --git a/packages/component-mail-service/src/templates/noCTA.html b/packages/component-mail-template-service/src/templates/noCTA.html similarity index 100% rename from packages/component-mail-service/src/templates/noCTA.html rename to packages/component-mail-template-service/src/templates/noCTA.html diff --git a/packages/component-mail-service/src/templates/notification.html b/packages/component-mail-template-service/src/templates/notification.html similarity index 100% rename from packages/component-mail-service/src/templates/notification.html rename to packages/component-mail-template-service/src/templates/notification.html diff --git a/packages/component-mail-service/src/templates/partials/footer.hbs b/packages/component-mail-template-service/src/templates/partials/footer.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/footer.hbs rename to packages/component-mail-template-service/src/templates/partials/footer.hbs diff --git a/packages/component-mail-service/src/templates/partials/header.hbs b/packages/component-mail-template-service/src/templates/partials/header.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/header.hbs rename to packages/component-mail-template-service/src/templates/partials/header.hbs diff --git a/packages/component-mail-service/src/templates/partials/invitationButtons.hbs b/packages/component-mail-template-service/src/templates/partials/invitationButtons.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/invitationButtons.hbs rename to packages/component-mail-template-service/src/templates/partials/invitationButtons.hbs diff --git a/packages/component-mail-service/src/templates/partials/invitationHeader.hbs b/packages/component-mail-template-service/src/templates/partials/invitationHeader.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/invitationHeader.hbs rename to packages/component-mail-template-service/src/templates/partials/invitationHeader.hbs diff --git a/packages/component-mail-service/src/templates/partials/invitationLowerContent.hbs b/packages/component-mail-template-service/src/templates/partials/invitationLowerContent.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/invitationLowerContent.hbs rename to packages/component-mail-template-service/src/templates/partials/invitationLowerContent.hbs diff --git a/packages/component-mail-service/src/templates/partials/invitationUpperContent.hbs b/packages/component-mail-template-service/src/templates/partials/invitationUpperContent.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/invitationUpperContent.hbs rename to packages/component-mail-template-service/src/templates/partials/invitationUpperContent.hbs diff --git a/packages/component-mail-service/src/templates/partials/mainBody.hbs b/packages/component-mail-template-service/src/templates/partials/mainBody.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/mainBody.hbs rename to packages/component-mail-template-service/src/templates/partials/mainBody.hbs diff --git a/packages/component-mail-service/src/templates/partials/mainButton.hbs b/packages/component-mail-template-service/src/templates/partials/mainButton.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/mainButton.hbs rename to packages/component-mail-template-service/src/templates/partials/mainButton.hbs diff --git a/packages/component-mail-service/src/templates/partials/manuscriptData.hbs b/packages/component-mail-template-service/src/templates/partials/manuscriptData.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/manuscriptData.hbs rename to packages/component-mail-template-service/src/templates/partials/manuscriptData.hbs diff --git a/packages/component-mail-service/src/templates/partials/manuscriptDetailsLink.hbs b/packages/component-mail-template-service/src/templates/partials/manuscriptDetailsLink.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/manuscriptDetailsLink.hbs rename to packages/component-mail-template-service/src/templates/partials/manuscriptDetailsLink.hbs diff --git a/packages/component-mail-service/src/templates/partials/notificationBody.hbs b/packages/component-mail-template-service/src/templates/partials/notificationBody.hbs similarity index 89% rename from packages/component-mail-service/src/templates/partials/notificationBody.hbs rename to packages/component-mail-template-service/src/templates/partials/notificationBody.hbs index c041158eada8ebec8a422962b28f849a647042d2..310722e99b26d50e269da57bf0f3c8b7023cc580 100644 --- a/packages/component-mail-service/src/templates/partials/notificationBody.hbs +++ b/packages/component-mail-template-service/src/templates/partials/notificationBody.hbs @@ -2,7 +2,7 @@ <tr> <td style="padding:30px 23px 0px 23px;background-color:#ffffff;" height="100%" valign="top" bgcolor="#ffffff"> <div> - <p data-pm-slice="1 1 []">{{intro}},</p> + <p data-pm-slice="1 1 []">Dear Dr. {{toUserName}},</p> <p> </p> <p> {{{paragraph}}} diff --git a/packages/component-mail-service/src/templates/partials/notificationHeader.hbs b/packages/component-mail-template-service/src/templates/partials/notificationHeader.hbs similarity index 98% rename from packages/component-mail-service/src/templates/partials/notificationHeader.hbs rename to packages/component-mail-template-service/src/templates/partials/notificationHeader.hbs index 3e8efa3eaeff420f3bbf0e68bc88d48713410851..a62d4be742baba10db155a84f6db8e6535880c7b 100644 --- a/packages/component-mail-service/src/templates/partials/notificationHeader.hbs +++ b/packages/component-mail-template-service/src/templates/partials/notificationHeader.hbs @@ -145,7 +145,7 @@ width="100%" style="display: none !important; mso-hide: all; visibility: hidden; opacity: 0; color: transparent; height: 0; width: 0;"> <tr> <td role="module-content"> - <p>{{ previewText }}</p> + <p>you have a new notification</p> </td> </tr> </table> diff --git a/packages/component-mail-service/src/templates/partials/signature.hbs b/packages/component-mail-template-service/src/templates/partials/signature.hbs similarity index 100% rename from packages/component-mail-service/src/templates/partials/signature.hbs rename to packages/component-mail-template-service/src/templates/partials/signature.hbs diff --git a/packages/component-mail-service/src/templates/simpleCTA.html b/packages/component-mail-template-service/src/templates/simpleCTA.html similarity index 100% rename from packages/component-mail-service/src/templates/simpleCTA.html rename to packages/component-mail-template-service/src/templates/simpleCTA.html