♻️ Add a test for internal waitUntil
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
Button,
|
||||
Section,
|
||||
} from '@react-email/components'
|
||||
import * as React from 'react'
|
||||
import { env } from '@typebot.io/env'
|
||||
import {
|
||||
main,
|
||||
|
||||
@@ -9,10 +9,8 @@ import {
|
||||
Text,
|
||||
Hr,
|
||||
Heading,
|
||||
Button,
|
||||
Section,
|
||||
} from '@react-email/components'
|
||||
import * as React from 'react'
|
||||
import { env } from '@typebot.io/env'
|
||||
import {
|
||||
main,
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
Heading,
|
||||
Section,
|
||||
} from '@react-email/components'
|
||||
import * as React from 'react'
|
||||
import { env } from '@typebot.io/env'
|
||||
import {
|
||||
main,
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
import {
|
||||
Body,
|
||||
Button,
|
||||
Container,
|
||||
Head,
|
||||
Html,
|
||||
Link,
|
||||
Text,
|
||||
} from '@react-email/components'
|
||||
|
||||
const emailRegex =
|
||||
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
|
||||
type Props = {
|
||||
resultsUrl: string
|
||||
answers: { [key: string]: string }
|
||||
}
|
||||
|
||||
const DefaultSendEmailNotification = ({ resultsUrl, answers }: Props) => (
|
||||
<Html>
|
||||
<Head />
|
||||
<Body style={body}>
|
||||
<Container style={container}>
|
||||
{Object.keys(answers).map((key, index) => {
|
||||
const isEmail = emailRegex.test(answers[key])
|
||||
|
||||
return (
|
||||
<Text key={key} style={index === 0 ? firstEntry : entry}>
|
||||
<strong>{key}</strong>:{' '}
|
||||
{isEmail ? (
|
||||
<Link href={`mailto:${answers[key]}`}>{answers[key]}</Link>
|
||||
) : answers[key].includes('\n') ? (
|
||||
answers[key].split('\n').map((line) => (
|
||||
<>
|
||||
{line}
|
||||
<br />
|
||||
</>
|
||||
))
|
||||
) : (
|
||||
answers[key]
|
||||
)}
|
||||
</Text>
|
||||
)
|
||||
})}
|
||||
<Button style={goToResultsButton} href={resultsUrl}>
|
||||
Go to results
|
||||
</Button>
|
||||
</Container>
|
||||
</Body>
|
||||
</Html>
|
||||
)
|
||||
|
||||
const body = {
|
||||
fontFamily:
|
||||
"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",
|
||||
}
|
||||
|
||||
const container = {
|
||||
maxWidth: '600px',
|
||||
margin: '0 auto',
|
||||
padding: '20px 30px',
|
||||
border: '1px solid #eaeaea',
|
||||
}
|
||||
|
||||
const goToResultsButton = {
|
||||
backgroundColor: '#0042DA',
|
||||
padding: '10px 24px',
|
||||
borderRadius: '6px',
|
||||
color: 'white',
|
||||
}
|
||||
|
||||
const firstEntry = {
|
||||
margin: '0 0 24x 0',
|
||||
}
|
||||
|
||||
const entry = {
|
||||
margin: '24px 0',
|
||||
}
|
||||
|
||||
DefaultSendEmailNotification.PreviewProps = {
|
||||
resultsUrl: 'http://localhost:3000',
|
||||
answers: {
|
||||
Name: 'John Doe',
|
||||
Email: 'baptiste@typebot.io',
|
||||
'Additional information': 'I have a question about your product.',
|
||||
},
|
||||
} satisfies Props
|
||||
|
||||
export default DefaultSendEmailNotification
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
Preview,
|
||||
Text,
|
||||
} from '@react-email/components'
|
||||
import * as React from 'react'
|
||||
import { env } from '@typebot.io/env'
|
||||
|
||||
interface Props {
|
||||
|
||||
Reference in New Issue
Block a user