2
0

🚸 (js) Improve phone number parsing

This commit is contained in:
Baptiste Arnaud
2023-03-03 10:50:39 +01:00
parent 04028e74d9
commit f1a9a1ce8b
6 changed files with 32 additions and 13 deletions

View File

@ -6,8 +6,8 @@
"types": "./src/index.ts",
"scripts": {
"preview": "concurrently \"pnpm run watch\" \"sleep 5 && pnpm run serve\" -n \"watch,serve\" -c \"bgBlue.bold,bgMagenta.bold\"",
"watch": "tsx watch ./preview.tsx --clear-screen=false",
"serve": "http-server dist -a localhost -p 3223 -o",
"watch": "tsx watch ./src/preview.tsx --clear-screen=false",
"serve": "http-server dist -a localhost -p 3223 -o -c-1",
"lint": "eslint \"src/**/*.ts*\""
},
"keywords": [],

View File

@ -1,4 +1,3 @@
import React from 'react'
import { Head, Text, Button } from '../components'
import {
Mjml,
@ -25,12 +24,11 @@ export const DefaultBotNotificationEmail = ({
<MjmlBody width={600}>
<MjmlSection padding="32px" cssClass="smooth" border="1px solid #e2e8f0">
<MjmlColumn>
<Text padding="0">Your typebot has collected a new response! 🥳</Text>
{Object.keys(answers).map((key) => {
{Object.keys(answers).map((key, index) => {
const isEmail = emailRegex.test(answers[key])
return (
<Text key={key}>
<Text key={key} paddingTop={index === 0 ? 0 : undefined}>
<b>{key}</b>:{' '}
{isEmail ? (
<a href={`mailto:${answers[key]}`}>{answers[key]}</a>