forked from OriginProtocol/dshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* checkpoint * prettify * remove dup icon * Lint * action buttons * checkpoint * ybm theme changes * prettify * Final bits of changes Co-authored-by: Nick Poulden <[email protected]>
- Loading branch information
1 parent
e3a7e6f
commit 18df36c
Showing
45 changed files
with
817 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ const getAllThemesData = () => { | |
...metaData | ||
} | ||
}) | ||
.filter((data) => !data.disabled) | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
const mjml2html = require('mjml') | ||
|
||
const { getNetworkTransport } = require('./_getTransport') | ||
const { getLogger } = require('../logger') | ||
|
||
const head = require('./templates/_head') | ||
const sellerContact = require('./templates/sellerContact') | ||
const sellerContactTxt = require('./templates/sellerContactTxt') | ||
|
||
const log = getLogger('utils.emailer') | ||
|
||
async function sellerContactEmail({ network, seller, data, skip }) { | ||
const { transporter, from } = await getNetworkTransport(network) | ||
if (!transporter) { | ||
log.info(`Emailer not configured. Skipping sending email.`) | ||
return | ||
} | ||
|
||
if (process.env.NODE_ENV === 'test') { | ||
log.info('Test environment. Email will be generated but not sent.') | ||
skip = true | ||
} | ||
|
||
const { name, email } = seller | ||
|
||
const { subject, content, firstName, lastName, userEmail } = data | ||
|
||
const vars = { | ||
head, | ||
sellerName: seller.name, | ||
fullName: `${firstName || ''} ${lastName || ''}`, | ||
userEmail, | ||
subject: subject.replace(/<\/?[a-z0-9-:]+>/gi, ''), | ||
content: content.replace(/<\/?[a-z0-9-:]+>/gi, ''), | ||
fromEmail: from | ||
} | ||
|
||
const htmlOutput = mjml2html(sellerContact(vars), { minify: true }) | ||
const txtOutput = sellerContactTxt(vars) | ||
|
||
const message = { | ||
from, | ||
to: `${name} <${email}>`, | ||
subject: 'Reset your password', | ||
replyTo: userEmail, | ||
html: htmlOutput, | ||
text: txtOutput | ||
} | ||
|
||
if (skip) return message | ||
|
||
return new Promise((resolve) => { | ||
transporter.sendMail(message, (err, msg) => { | ||
if (err) { | ||
log.error('Error sending forgot password email', err) | ||
return resolve() | ||
} else { | ||
log.info( | ||
`Forgot password email sent, from ${message.from} to ${message.to}` | ||
) | ||
log.debug(msg.envelope) | ||
} | ||
|
||
resolve(message) | ||
}) | ||
}) | ||
} | ||
|
||
module.exports = sellerContactEmail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = (vars) => ` | ||
<mjml> | ||
${vars.head} | ||
<mj-body> | ||
<mj-section> | ||
<mj-column> | ||
<mj-text mj-class="large">Hi, ${vars.sellerName}</mj-text> | ||
<mj-text mj-class="light"> | ||
${vars.fullName} (${vars.userEmail}) has sent you the following message from your shop: | ||
</mj-text> | ||
<mj-text mj-class="light"> | ||
Subject: ${vars.subject} | ||
</mj-text> | ||
<mj-text mj-class="light"> | ||
Message Content: ${vars.content} | ||
</mj-text> | ||
</mj-column> | ||
</mj-section> | ||
</mj-body> | ||
</mjml> | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = (vars) => ` | ||
Hi, ${vars.sellerName}. | ||
${vars.fullName} (${vars.userEmail}) has sent you the following message from your shop: | ||
Subject: ${vars.subject} | ||
Message Content: | ||
${vars.content} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.