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

@@ -1,41 +0,0 @@
import {
WhatsAppWebhookRequestBody,
whatsAppWebhookRequestBodySchema,
} from '@typebot.io/schemas/features/whatsapp'
import { resumeWhatsAppFlow } from '@typebot.io/bot-engine/whatsapp/resumeWhatsAppFlow'
import { isNotDefined } from '@typebot.io/lib'
import { env } from '@typebot.io/env'
import type { RequestContext } from '@vercel/edge'
const processWhatsAppReply = async (
entry: WhatsAppWebhookRequestBody['entry']
) => {
const receivedMessage = entry.at(0)?.changes.at(0)?.value.messages?.at(0)
if (isNotDefined(receivedMessage)) return { message: 'No message found' }
const contactName =
entry.at(0)?.changes.at(0)?.value?.contacts?.at(0)?.profile?.name ?? ''
const contactPhoneNumber =
entry.at(0)?.changes.at(0)?.value?.messages?.at(0)?.from ?? ''
return resumeWhatsAppFlow({
receivedMessage,
sessionId: `wa-preview-${receivedMessage.from}`,
contact: {
name: contactName,
phoneNumber: contactPhoneNumber,
},
})
}
export async function POST(request: Request, context: RequestContext) {
if (!env.WHATSAPP_PREVIEW_FROM_PHONE_NUMBER_ID)
return new Response(
'WHATSAPP_PREVIEW_FROM_PHONE_NUMBER_ID is not defined',
{
status: 500,
}
)
const body = await request.json()
const { entry } = whatsAppWebhookRequestBodySchema.parse(body)
context.waitUntil(processWhatsAppReply(entry))
return new Response('Message is being processed.', { status: 200 })
}

View File

@@ -40,7 +40,6 @@ const nextConfig = {
transpilePackages: [
'@typebot.io/lib',
'@typebot.io/schemas',
'@typebot.io/emails',
'@typebot.io/env',
],
i18n: {

View File

@@ -13,6 +13,7 @@
"format:check": "prettier --check ./src --ignore-path ../../.prettierignore"
},
"dependencies": {
"@faire/mjml-react": "3.3.0",
"@typebot.io/theme": "workspace:*",
"@braintree/sanitize-url": "7.0.1",
"@chakra-ui/anatomy": "2.1.1",
@@ -23,7 +24,6 @@
"@dnd-kit/utilities": "3.2.1",
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@faire/mjml-react": "3.3.0",
"@giphy/js-fetch-api": "5.0.0",
"@giphy/js-types": "4.4.0",
"@giphy/js-util": "5.0.0",
@@ -41,16 +41,18 @@
"@trpc/react-query": "10.40.0",
"@trpc/server": "10.40.0",
"@typebot.io/bot-engine": "workspace:*",
"@typebot.io/emails": "workspace:*",
"@typebot.io/email-legacy": "workspace:*",
"@typebot.io/env": "workspace:*",
"@typebot.io/js": "workspace:*",
"@typebot.io/nextjs": "workspace:*",
"@udecode/cn": "29.0.1",
"@udecode/plate-basic-marks": "30.5.3",
"@udecode/plate-common": "30.4.5",
"@udecode/plate-core": "30.4.5",
"@udecode/plate-floating": "30.5.3",
"@udecode/plate-link": "30.5.3",
"@udecode/cn": "31.0.0",
"@udecode/plate-basic-marks": "31.0.0",
"@udecode/plate-core": "31.3.2",
"@udecode/plate-floating": "31.0.0",
"@udecode/plate-link": "31.0.0",
"@udecode/slate": "31.0.0",
"@udecode/slate-react": "31.0.0",
"@udecode/plate-utils": "31.0.0",
"@uiw/codemirror-extensions-langs": "4.21.24",
"@uiw/codemirror-theme-github": "4.21.24",
"@uiw/codemirror-theme-tokyo-night": "4.21.24",
@@ -74,7 +76,7 @@
"libphonenumber-js": "1.10.37",
"micro": "10.0.1",
"micro-cors": "0.1.1",
"next": "14.1.0",
"next": "14.2.1",
"next-auth": "4.22.1",
"nextjs-cors": "2.1.2",
"nodemailer": "6.9.8",
@@ -123,7 +125,6 @@
"@types/qs": "6.9.7",
"@types/react": "18.2.15",
"@types/tinycolor2": "1.4.3",
"@vercel/edge": "1.1.1",
"dotenv-cli": "7.2.1",
"eslint": "8.44.0",
"eslint-config-custom": "workspace:*",

View File

@@ -18,9 +18,9 @@ import CodeMirror, { ReactCodeMirrorRef } from '@uiw/react-codemirror'
import { tokyoNight } from '@uiw/codemirror-theme-tokyo-night'
import { githubLight } from '@uiw/codemirror-theme-github'
import { LanguageName, loadLanguage } from '@uiw/codemirror-extensions-langs'
import { isDefined } from '@udecode/plate-common'
import { CopyButton } from '../CopyButton'
import { MoreInfoTooltip } from '../MoreInfoTooltip'
import { isDefined } from '@typebot.io/lib/utils'
type Props = {
label?: string

View File

@@ -1,4 +1,4 @@
import { sendMagicLinkEmail } from '@typebot.io/emails'
import { sendMagicLinkEmail } from '@typebot.io/email-legacy'
type Props = {
identifier: string

View File

@@ -1,7 +1,7 @@
import React, { useEffect, useRef } from 'react'
import { Plate } from '@udecode/plate-core'
import { platePlugins } from '@/lib/plate'
import { TElement } from '@udecode/plate-common'
import { TElement } from '@udecode/slate'
import { TextEditorEditorContent } from './TextEditorEditorContent'
type TextBubbleEditorContentProps = {

View File

@@ -15,8 +15,10 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { TextEditorToolBar } from './TextEditorToolBar'
import { useTranslate } from '@tolgee/react'
import { PlateContent, useEditorRef } from '@udecode/plate-core'
import { focusEditor, insertText, selectEditor } from '@udecode/plate-common'
import { useOutsideClick } from '@/hooks/useOutsideClick'
import { insertText } from '@udecode/slate'
import { focusEditor } from '@udecode/slate-react'
import { selectEditor } from '@udecode/plate-utils'
type Props = {
closeEditor: () => void

View File

@@ -2,7 +2,7 @@ import React from 'react'
import {
useMarkToolbarButton,
useMarkToolbarButtonState,
} from '@udecode/plate-common'
} from '@udecode/plate-utils'
import { IconButton, IconButtonProps } from '@chakra-ui/react'
type Props = {

View File

@@ -1,4 +1,4 @@
import { TElement, TText, TDescendant } from '@udecode/plate-common'
import { TElement, TText, TDescendant } from '@udecode/slate'
import { PlateText } from './PlateText'
export const PlateBlock = ({ element }: { element: TElement | TText }) => {

View File

@@ -1,7 +1,7 @@
import { TextInput, NumberInput } from '@/components/inputs'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { Stack } from '@chakra-ui/react'
import { isDefined } from '@udecode/plate-common'
import { isDefined } from '@typebot.io/lib/utils'
import { SmtpCredentials } from '@typebot.io/schemas'
import React from 'react'

View File

@@ -42,7 +42,7 @@ import { hasDefaultConnector } from '@/features/typebot/helpers/hasDefaultConnec
import { setMultipleRefs } from '@/helpers/setMultipleRefs'
import { TargetEndpoint } from '../../endpoints/TargetEndpoint'
import { SettingsModal } from './SettingsModal'
import { TElement } from '@udecode/plate-common'
import { TElement } from '@udecode/slate'
import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants'
import { useGroupsStore } from '@/features/graph/hooks/useGroupsStore'
import { TurnableIntoParam } from '@typebot.io/forge'

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { FramerInstructions } from './instructions/FramerInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const FramerModal = ({ isOpen, onClose, isPublished }: ModalProps) => {
const [selectedEmbedType, setSelectedEmbedType] = useState<

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { GtmInstructions } from './instructions/GtmInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const GtmModal = ({
isOpen,

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { JavascriptInstructions } from './instructions/JavascriptInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const JavascriptModal = ({
isOpen,

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { NextjsInstructions } from './instructions/NextjsInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const NextjsModal = ({ isOpen, onClose, isPublished }: ModalProps) => {
const [selectedEmbedType, setSelectedEmbedType] = useState<

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { ReactInstructions } from './instructions/ReactInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const ReactModal = ({ isOpen, onClose, isPublished }: ModalProps) => {
const [selectedEmbedType, setSelectedEmbedType] = useState<

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { ScriptInstructions } from './instructions/ScriptInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const ScriptModal = ({ isOpen, onClose, isPublished }: ModalProps) => {
const [selectedEmbedType, setSelectedEmbedType] = useState<

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { ShopifyInstructions } from './instructions/ShopifyInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const ShopifyModal = ({
isOpen,

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { WebflowInstructions } from './instructions/WebflowInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const WebflowModal = ({ isOpen, onClose, isPublished }: ModalProps) => {
const [selectedEmbedType, setSelectedEmbedType] = useState<

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { ModalProps } from '../../EmbedButton'
import { EmbedModal } from '../../EmbedModal'
import { isDefined } from '@udecode/plate-common'
import { WixInstructions } from './instructions/WixInstructions'
import { isDefined } from '@typebot.io/lib/utils'
export const WixModal = ({ isOpen, onClose, isPublished }: ModalProps) => {
const [selectedEmbedType, setSelectedEmbedType] = useState<

View File

@@ -1,5 +1,5 @@
import { trpc } from '@/lib/trpc'
import { isDefined } from '@udecode/plate-common'
import { isDefined } from '@typebot.io/lib/utils'
export const useLogs = (
typebotId: string,

View File

@@ -13,7 +13,7 @@ import {
notAuthenticated,
} from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
import { sendGuestInvitationEmail } from '@typebot.io/emails'
import { sendGuestInvitationEmail } from '@typebot.io/email-legacy'
import { env } from '@typebot.io/env'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -7,7 +7,7 @@ import {
notAuthenticated,
} from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
import { sendWorkspaceMemberInvitationEmail } from '@typebot.io/emails'
import { sendWorkspaceMemberInvitationEmail } from '@typebot.io/email-legacy'
import { getSeatsLimit } from '@typebot.io/billing/getSeatsLimit'
import { env } from '@typebot.io/env'

View File

@@ -3,8 +3,22 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
"@/*": [
"src/*"
]
},
"plugins": [
{
"name": "next"
}
],
"strictNullChecks": true
},
"include": ["next-env.d.ts", "tolgee.d.ts", "**/*.ts", "**/*.tsx"]
"include": [
"next-env.d.ts",
"tolgee.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
]
}

View File

@@ -14532,430 +14532,6 @@
}
}
}
},
"post": {
"operationId": "whatsApp-receiveMessagePreview",
"summary": "Message webhook",
"tags": [
"WhatsApp"
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"entry": {
"type": "array",
"items": {
"type": "object",
"properties": {
"changes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "object",
"properties": {
"metadata": {
"type": "object",
"properties": {
"phone_number_id": {
"type": "string"
}
},
"required": [
"phone_number_id"
]
},
"contacts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"profile": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
]
}
},
"required": [
"profile"
]
}
},
"messages": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"text"
]
},
"text": {
"type": "object",
"properties": {
"body": {
"type": "string"
}
},
"required": [
"body"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"text",
"timestamp"
]
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"button"
]
},
"button": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"payload": {
"type": "string"
}
},
"required": [
"text",
"payload"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"button",
"timestamp"
]
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"interactive"
]
},
"interactive": {
"type": "object",
"properties": {
"button_reply": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"id",
"title"
]
}
},
"required": [
"button_reply"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"interactive",
"timestamp"
]
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"image"
]
},
"image": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"image",
"timestamp"
]
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"video"
]
},
"video": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"video",
"timestamp"
]
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"audio"
]
},
"audio": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"audio",
"timestamp"
]
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"document"
]
},
"document": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"document",
"timestamp"
]
},
{
"type": "object",
"properties": {
"from": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"location"
]
},
"location": {
"type": "object",
"properties": {
"latitude": {
"type": "number"
},
"longitude": {
"type": "number"
}
},
"required": [
"latitude",
"longitude"
]
},
"timestamp": {
"type": "string"
}
},
"required": [
"from",
"type",
"location",
"timestamp"
]
}
]
}
}
},
"required": [
"metadata"
]
}
},
"required": [
"value"
]
}
}
},
"required": [
"changes"
]
}
}
},
"required": [
"entry"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/v1/folders/{folderId}": {

View File

@@ -12473,10 +12473,18 @@
}
}
}
},
"runtime": {
"type": "string",
"enum": [
"edge",
"nodejs"
]
}
},
"required": [
"messages"
"messages",
"runtime"
]
},
"lastBubbleBlockId": {
@@ -12753,6 +12761,13 @@
true
]
},
"runtime": {
"type": "string",
"enum": [
"edge",
"nodejs"
]
},
"lastBubbleBlockId": {
"type": "string"
},
@@ -12762,7 +12777,8 @@
},
"required": [
"type",
"stream"
"stream",
"runtime"
],
"title": "Exec stream"
},

View File

@@ -20,7 +20,7 @@
"aos": "2.3.4",
"focus-visible": "5.2.0",
"framer-motion": "10.12.20",
"next": "14.1.0",
"next": "14.2.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"@typebot.io/billing": "workspace:*"

View File

@@ -1,53 +0,0 @@
import {
WhatsAppWebhookRequestBody,
whatsAppWebhookRequestBodySchema,
} from '@typebot.io/schemas/features/whatsapp'
import { resumeWhatsAppFlow } from '@typebot.io/bot-engine/whatsapp/resumeWhatsAppFlow'
import { isNotDefined } from '@typebot.io/lib'
import type { RequestContext } from '@vercel/edge'
type Props = {
entry: WhatsAppWebhookRequestBody['entry']
workspaceId: string
credentialsId: string
}
const processWhatsAppReply = async ({
entry,
workspaceId,
credentialsId,
}: Props) => {
const receivedMessage = entry.at(0)?.changes.at(0)?.value.messages?.at(0)
if (isNotDefined(receivedMessage)) return { message: 'No message found' }
const contactName =
entry.at(0)?.changes.at(0)?.value?.contacts?.at(0)?.profile?.name ?? ''
const contactPhoneNumber =
entry.at(0)?.changes.at(0)?.value?.messages?.at(0)?.from ?? ''
const phoneNumberId = entry.at(0)?.changes.at(0)?.value
.metadata.phone_number_id
if (!phoneNumberId) return { message: 'No phone number id found' }
return resumeWhatsAppFlow({
receivedMessage,
sessionId: `wa-${phoneNumberId}-${receivedMessage.from}`,
phoneNumberId,
credentialsId,
workspaceId,
contact: {
name: contactName,
phoneNumber: contactPhoneNumber,
},
})
}
export async function POST(request: Request, context: RequestContext) {
const workspaceId = request.url.match(/\/workspaces\/([^/]+)\//)?.[1]
const credentialsId = request.url.match(/\/whatsapp\/([^/]+)\//)?.[1]
if (!workspaceId || !credentialsId) {
console.error('No workspace or credentials id found')
return { message: 'No workspace or credentials id found' }
}
const body = await request.json()
const { entry } = whatsAppWebhookRequestBodySchema.parse(body)
context.waitUntil(processWhatsAppReply({ entry, workspaceId, credentialsId }))
return new Response('Message is being processed.', { status: 200 })
}

View File

@@ -41,11 +41,7 @@ const landingPagePaths = [
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
transpilePackages: [
'@typebot.io/lib',
'@typebot.io/schemas',
'@typebot.io/emails',
],
transpilePackages: ['@typebot.io/lib', '@typebot.io/schemas'],
output: 'standalone',
experimental: {
outputFileTracingRoot: join(__dirname, '../../'),

View File

@@ -21,13 +21,14 @@
"@typebot.io/js": "workspace:*",
"@typebot.io/nextjs": "workspace:*",
"@typebot.io/prisma": "workspace:*",
"@udecode/plate-core": "31.3.2",
"ai": "3.0.12",
"bot-engine": "workspace:*",
"cors": "2.8.5",
"google-spreadsheet": "4.1.1",
"got": "12.6.0",
"ky": "1.2.3",
"next": "14.1.0",
"next": "14.2.1",
"nextjs-cors": "2.1.2",
"nodemailer": "6.9.8",
"openai": "4.28.4",
@@ -40,7 +41,7 @@
"@faire/mjml-react": "3.3.0",
"@paralleldrive/cuid2": "2.2.1",
"@playwright/test": "1.36.0",
"@typebot.io/emails": "workspace:*",
"@typebot.io/email-legacy": "workspace:*",
"@typebot.io/env": "workspace:*",
"@typebot.io/forge": "workspace:*",
"@typebot.io/forge-repository": "workspace:*",
@@ -56,7 +57,6 @@
"@types/papaparse": "5.3.7",
"@types/qs": "6.9.7",
"@types/react": "18.2.15",
"@vercel/edge": "1.1.1",
"dotenv": "16.4.5",
"dotenv-cli": "7.2.1",
"eslint": "8.44.0",

View File

@@ -13,8 +13,7 @@ import { decrypt } from '@typebot.io/lib/api/encryption/decrypt'
import Cors from 'cors'
import Mail from 'nodemailer/lib/mailer'
import { DefaultBotNotificationEmail } from '@typebot.io/emails'
import { render } from '@faire/mjml-react/utils/render'
import { DefaultBotNotificationEmail, render } from '@typebot.io/email-legacy'
import prisma from '@typebot.io/lib/prisma'
import { env } from '@typebot.io/env'
import { saveErrorLog } from '@typebot.io/bot-engine/logs/saveErrorLog'

View File

@@ -0,0 +1,20 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { createPlateEditor } from '@udecode/plate-core'
export const config = {
supportsResponseStreaming: true,
}
export default async function handler(_: NextApiRequest, res: NextApiResponse) {
console.log(createPlateEditor())
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const ctx = globalThis[Symbol.for('@vercel/request-context')]
ctx.get().waitUntil(wait)
return res.status(200).send('Message is being processed.')
}
const wait = async () => {
await new Promise((resolve) => setTimeout(resolve, 5000))
return
}