-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update email bounce template (#7788)
* feat: update content and migrate to tsx * feat: add to storybook * feat: combine transient and perm bounces * chore: generalise test cases, use snapshot testing * chore: remove overtested test cases fix: failing stringify
- Loading branch information
Showing
7 changed files
with
149 additions
and
165 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Meta, StoryFn } from '@storybook/react' | ||
|
||
import BounceNotification, { | ||
type BounceNotificationHtmlData, | ||
} from './BounceNotification' | ||
|
||
export default { | ||
title: 'EmailPreview/BounceNotification', | ||
component: BounceNotification, | ||
decorators: [], | ||
} as Meta | ||
|
||
const Template: StoryFn<BounceNotificationHtmlData> = (args) => ( | ||
<BounceNotification {...args} /> | ||
) | ||
|
||
export const Default = Template.bind({}) | ||
Default.args = { | ||
formTitle: 'Sum ting wong form', | ||
formLink: 'https://example.com', | ||
bouncedRecipients: 'recipient 1', | ||
appName: 'FormSG', | ||
} |
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,5 @@ | ||
import { BounceNotification } from '../../src/app/views/templates/BounceNotification' | ||
|
||
export type { BounceNotificationHtmlData } from '../../src/app/services/mail/mail.types' | ||
|
||
export default BounceNotification |
41 changes: 41 additions & 0 deletions
41
src/app/services/mail/__tests__/__snapshots__/mail.service.spec.ts.snap
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,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`mail.service sendBounceNotification should send permanent bounce notification successfully 1`] = ` | ||
[ | ||
[ | ||
{ | ||
"from": "mockApp <from@example.com>", | ||
"headers": { | ||
"X-Formsg-Email-Type": "Admin (bounce notification)", | ||
"X-Formsg-Form-ID": "mockFormId", | ||
}, | ||
"html": "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/></head><body><p style="font-size:14px;line-height:24px;margin:16px 0">Dear form admins(s),</p><p style="font-size:14px;line-height:24px;margin:16px 0">We’re reaching out urgently regarding your FormSG form You are all individuals!(mockApp.example.com/mockFormId). Responses to the following recipient(s) could not be delivered: to3@example.com, to4@example.com. This was likely due to their mailbox being full.</p><p style="font-size:14px;line-height:24px;margin:16px 0">Please refer to our <a href="https://go.gov.sg/formsg-guide-bounces" style="color:#067df7;text-decoration:none" target="_blank">guide</a> for next steps on how to resolve this issue.</p><p style="font-size:14px;line-height:24px;margin:16px 0">The mockApp Support Team</p></body></html>", | ||
"subject": "[Urgent] FormSG Response Delivery Failure / Bounce", | ||
"to": [ | ||
"to@example.com", | ||
"to2@example.com", | ||
], | ||
}, | ||
], | ||
] | ||
`; | ||
|
||
exports[`mail.service sendBounceNotification should send transient bounce notification successfully 1`] = ` | ||
[ | ||
[ | ||
{ | ||
"from": "mockApp <from@example.com>", | ||
"headers": { | ||
"X-Formsg-Email-Type": "Admin (bounce notification)", | ||
"X-Formsg-Form-ID": "mockFormId", | ||
}, | ||
"html": "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/></head><body><p style="font-size:14px;line-height:24px;margin:16px 0">Dear form admins(s),</p><p style="font-size:14px;line-height:24px;margin:16px 0">We’re reaching out urgently regarding your FormSG form You are all individuals!(mockApp.example.com/mockFormId). Responses to the following recipient(s) could not be delivered: to3@example.com, to4@example.com. This was likely due to their mailbox being full.</p><p style="font-size:14px;line-height:24px;margin:16px 0">Please refer to our <a href="https://go.gov.sg/formsg-guide-bounces" style="color:#067df7;text-decoration:none" target="_blank">guide</a> for next steps on how to resolve this issue.</p><p style="font-size:14px;line-height:24px;margin:16px 0">The mockApp Support Team</p></body></html>", | ||
"subject": "[Urgent] FormSG Response Delivery Failure / Bounce", | ||
"to": [ | ||
"to@example.com", | ||
"to2@example.com", | ||
], | ||
}, | ||
], | ||
] | ||
`; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Body, Head, Html, Text, Link } from '@react-email/components' | ||
|
||
import { outerContainerStyle } from './styles' | ||
import { BounceNotificationHtmlData } from '../../services/mail/mail.types' | ||
|
||
export const BounceNotification = ({ | ||
formTitle, | ||
formLink, | ||
bouncedRecipients, | ||
appName, | ||
}: BounceNotificationHtmlData): JSX.Element => { | ||
return ( | ||
<Html> | ||
<Head /> | ||
<Body> | ||
<Text>Dear form admins(s),</Text> | ||
<Text> | ||
We’re reaching out urgently regarding your FormSG form {formTitle}( | ||
{formLink}). Responses to the following recipient(s) could not be | ||
delivered: {bouncedRecipients}. This was likely due to their mailbox | ||
being full. | ||
</Text> | ||
<Text> | ||
Please refer to our{' '} | ||
<Link href="https://go.gov.sg/formsg-guide-bounces">guide</Link> for | ||
next steps on how to resolve this issue. | ||
</Text> | ||
|
||
<Text>The {appName} Support Team</Text> | ||
</Body> | ||
</Html> | ||
) | ||
} |
Oops, something went wrong.