2
0

♻️ Add a test for internal waitUntil

This commit is contained in:
Baptiste Arnaud
2024-04-16 12:56:47 +02:00
parent 8d62898d15
commit 87f5d8515a
89 changed files with 1029 additions and 1154 deletions

View File

@@ -12,7 +12,6 @@ import {
Button,
Section,
} from '@react-email/components'
import * as React from 'react'
import { env } from '@typebot.io/env'
import {
main,

View File

@@ -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,

View File

@@ -11,7 +11,6 @@ import {
Heading,
Section,
} from '@react-email/components'
import * as React from 'react'
import { env } from '@typebot.io/env'
import {
main,

View File

@@ -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

View File

@@ -9,7 +9,6 @@ import {
Preview,
Text,
} from '@react-email/components'
import * as React from 'react'
import { env } from '@typebot.io/env'
interface Props {