From e0a9824913237cb5340d262770e9e8290fbc4002 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 13 Apr 2023 17:04:21 +0200 Subject: [PATCH] :recycle: Simplify text bubble content shape Remove html and plainText field because it was redundant Closes #386 --- apps/builder/public/bots/onboarding-dark.json | 48 +++------ apps/builder/public/bots/onboarding.json | 48 +++------ .../public/templates/basic-chat-gpt.json | 20 +--- .../public/templates/chat-gpt-personas.json | 60 +++--------- .../public/templates/customer-support.json | 42 ++------ .../templates/digital-product-payment.json | 60 +++--------- apps/builder/public/templates/faq.json | 56 +++-------- apps/builder/public/templates/lead-gen.json | 32 ++---- .../builder/public/templates/lead-magnet.json | 64 +++--------- .../public/templates/lead-scoring.json | 56 +++-------- .../templates/movie-recommendation.json | 40 ++------ apps/builder/public/templates/nps.json | 56 +++-------- apps/builder/public/templates/onboarding.json | 44 +++------ apps/builder/public/templates/quiz.json | 98 +++++-------------- apps/builder/src/assets/styles/plate.css | 7 ++ .../components/TextBubbleContent.tsx | 21 ++-- .../components/TextBubbleEditor.tsx | 26 +---- .../components/plate/PlateBlock.tsx | 27 +++++ .../textBubble/components/plate/PlateText.tsx | 38 +++++++ .../blocks/bubbles/textBubble/utils.ts | 17 ---- .../googleSheets/googleSheets.spec.ts | 4 +- .../components/nodes/block/BlockNode.tsx | 8 +- .../helpers/parseVariableHtmlTags.ts | 18 ---- .../builder/src/test/assets/typebots/api.json | 32 ++---- .../assets/typebots/editor/buttonsDnd.json | 8 +- .../typebots/editor/previewFromGroup.json | 24 ++--- .../typebots/inputs/variableButton.json | 6 +- .../integrations/easyConfigWebhook.json | 16 +-- .../integrations/googleSheetsGet.json | 4 +- .../typebots/integrations/sendEmail.json | 4 +- .../assets/typebots/integrations/webhook.json | 4 +- .../test/assets/typebots/logic/condition.json | 16 +-- .../assets/typebots/logic/linkTypebots/1.json | 4 +- .../assets/typebots/logic/linkTypebots/2.json | 4 +- .../assets/typebots/logic/setVariable.json | 8 +- .../src/test/assets/typebots/logic/wait.json | 6 +- .../typebots/results/submissionHeader.json | 32 ++---- .../src/test/assets/typebots/settings.json | 4 +- .../assets/typebots/singleChoiceTarget.json | 8 +- .../src/test/assets/typebots/theme.json | 12 +-- apps/docs/openapi/builder/_spec_.json | 4 +- apps/docs/openapi/chat/_spec_.json | 10 +- .../public/typebots/lead-gen-lp.json | 32 ++---- .../public/typebots/realtime-airtable.json | 24 ++--- .../inputs/fileUpload/fileUpload.spec.ts | 1 - apps/viewer/src/features/chat/chat.spec.ts | 83 ++++++++++++---- .../features/chat/helpers/continueBotFlow.ts | 3 +- apps/viewer/src/features/usage/usage.spec.ts | 70 ------------- apps/viewer/src/test/assets/typebots/api.json | 32 ++---- .../test/assets/typebots/chat/linkedBot.json | 4 +- .../src/test/assets/typebots/chat/main.json | 44 +++------ .../src/test/assets/typebots/fileUpload.json | 8 +- .../src/test/assets/typebots/hugeGroup.json | 16 +-- .../test/assets/typebots/linkTypebots/2.json | 4 +- .../assets/typebots/predefinedVariables.json | 12 +-- .../src/test/assets/typebots/sendEmail.json | 4 +- .../src/test/assets/typebots/webhook.json | 8 +- .../textBubble/components/TextBubble.tsx | 2 +- packages/embeds/js/package.json | 11 ++- .../js/src/components/bubbles/HostBubble.tsx | 2 +- .../textBubble/components/TextBubble.tsx | 20 ++-- .../components/plate/PlateBlock.tsx | 30 ++++++ .../textBubble/components/plate/PlateText.tsx | 30 ++++++ .../computeTypingDuration.ts | 0 .../helpers/convertRichTextToPlainText.ts | 9 ++ packages/embeds/react/package.json | 2 +- .../schemas/features/blocks/bubbles/text.ts | 17 ++-- packages/schemas/features/chat.ts | 4 +- packages/schemas/package.json | 1 + pnpm-lock.yaml | 6 ++ 70 files changed, 545 insertions(+), 1030 deletions(-) create mode 100644 apps/builder/src/features/blocks/bubbles/textBubble/components/plate/PlateBlock.tsx create mode 100644 apps/builder/src/features/blocks/bubbles/textBubble/components/plate/PlateText.tsx delete mode 100644 apps/builder/src/features/blocks/bubbles/textBubble/utils.ts delete mode 100644 apps/builder/src/features/variables/helpers/parseVariableHtmlTags.ts delete mode 100644 apps/viewer/src/features/usage/usage.spec.ts create mode 100644 packages/embeds/js/src/features/blocks/bubbles/textBubble/components/plate/PlateBlock.tsx create mode 100644 packages/embeds/js/src/features/blocks/bubbles/textBubble/components/plate/PlateText.tsx rename packages/embeds/js/src/features/blocks/bubbles/textBubble/{utils => helpers}/computeTypingDuration.ts (100%) create mode 100644 packages/embeds/js/src/features/blocks/bubbles/textBubble/helpers/convertRichTextToPlainText.ts diff --git a/apps/builder/public/bots/onboarding-dark.json b/apps/builder/public/bots/onboarding-dark.json index 314b6f51a..86971ae1b 100644 --- a/apps/builder/public/bots/onboarding-dark.json +++ b/apps/builder/public/bots/onboarding-dark.json @@ -50,11 +50,9 @@ "id": "cl1267q2c000e2e6dynjeg83n", "type": "text", "content": { - "html": "
Welcome πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Welcome πŸ‘‹" }] } - ], - "plainText": "Welcome πŸ‘‹" + ] }, "groupId": "clcueadzi00063b6sch7b1f32" }, @@ -62,11 +60,9 @@ "id": "cl1267y1u000f2e6d4rlglv6g", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] }, "groupId": "clcueadzi00063b6sch7b1f32" }, @@ -95,11 +91,9 @@ "id": "cl1266v6f000a2e6db7wj3ux7", "type": "text", "content": { - "html": "
Welcome {{Name}} πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Welcome {{Name}} πŸ‘‹" }] } - ], - "plainText": "Welcome {{Name}} πŸ‘‹" + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -107,7 +101,6 @@ "id": "cl126hb9m000l2e6d5qk3mohn", "type": "text", "content": { - "html": "
I'm super pumped that you've decided to try out Typebot 😍
", "richText": [ { "type": "p", @@ -117,8 +110,7 @@ } ] } - ], - "plainText": "I'm super pumped that you've decided to try out Typebot 😍" + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -126,7 +118,6 @@ "id": "cl126hpw1000m2e6dneousygl", "type": "text", "content": { - "html": "
You are small steps away from meaningful, hyper-personalized experience for your users
", "richText": [ { "type": "p", @@ -136,8 +127,7 @@ } ] } - ], - "plainText": "You are small steps away from meaningful, hyper-personalized experience for your users" + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -145,7 +135,6 @@ "id": "cl126guhd000k2e6d6ypkex9z", "type": "text", "content": { - "html": "
Let's get you set up for your Typebot journey.
", "richText": [ { "type": "p", @@ -153,8 +142,7 @@ { "text": "Let's get you set up for your Typebot journey." } ] } - ], - "plainText": "Let's get you set up for your Typebot journey." + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -162,14 +150,12 @@ "id": "cl126ixp9000q2e6dslh0zypi", "type": "text", "content": { - "html": "
Do you work for a specific company?
", "richText": [ { "type": "p", "children": [{ "text": "Do you work for a specific company?" }] } - ], - "plainText": "Do you work for a specific company?" + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -219,7 +205,6 @@ "id": "cl126krck00112e6d1m6ctxpn", "type": "text", "content": { - "html": "
What type of bots are you planning to build with Typebot?
", "richText": [ { "type": "p", @@ -229,8 +214,7 @@ } ] } - ], - "plainText": "What type of bots are you planning to build with Typebot?" + ] }, "groupId": "clcueadzi00093b6s82ivles8" }, @@ -330,7 +314,6 @@ "id": "cl126p76d001k2e6dbhnf2ysq", "type": "text", "content": { - "html": "
Thank you for answering those questions!
", "richText": [ { "type": "p", @@ -338,8 +321,7 @@ { "text": "Thank you for answering those questions!" } ] } - ], - "plainText": "Thank you for answering those questions!" + ] }, "groupId": "clcueadzi000a3b6spk404zpz" }, @@ -355,7 +337,6 @@ "id": "cl126txta001y2e6dtxrbsnek", "type": "text", "content": { - "html": "
You can reach out to me using the contact bubble on the bottom right corner πŸ€“
", "richText": [ { "type": "p", @@ -365,8 +346,7 @@ } ] } - ], - "plainText": "You can reach out to me using the contact bubble on the bottom right corner πŸ€“" + ] }, "groupId": "clcueadzi000a3b6spk404zpz" }, @@ -374,14 +354,12 @@ "id": "cl12buyly00172e6991bz38ch", "type": "text", "content": { - "html": "
Let's create your first typebot...
", "richText": [ { "type": "p", "children": [{ "text": "Let's create your first typebot..." }] } - ], - "plainText": "Let's create your first typebot..." + ] }, "groupId": "clcueadzi000a3b6spk404zpz" } @@ -396,11 +374,9 @@ "id": "cl127yxym000b2e6d9hksxo6h", "type": "text", "content": { - "html": "
What else?
", "richText": [ { "type": "p", "children": [{ "text": "What else?" }] } - ], - "plainText": "What else?" + ] }, "groupId": "clcueadzi000b3b6sv6936vs4" }, diff --git a/apps/builder/public/bots/onboarding.json b/apps/builder/public/bots/onboarding.json index 05f9917f8..57b60f8b5 100644 --- a/apps/builder/public/bots/onboarding.json +++ b/apps/builder/public/bots/onboarding.json @@ -50,11 +50,9 @@ "id": "cl1267q2c000e2e6dynjeg83n", "type": "text", "content": { - "html": "
Welcome πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Welcome πŸ‘‹" }] } - ], - "plainText": "Welcome πŸ‘‹" + ] }, "groupId": "clcueadzi00063b6sch7b1f32" }, @@ -62,11 +60,9 @@ "id": "cl1267y1u000f2e6d4rlglv6g", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] }, "groupId": "clcueadzi00063b6sch7b1f32" }, @@ -95,11 +91,9 @@ "id": "cl1266v6f000a2e6db7wj3ux7", "type": "text", "content": { - "html": "
Welcome {{Name}} πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Welcome {{Name}} πŸ‘‹" }] } - ], - "plainText": "Welcome {{Name}} πŸ‘‹" + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -107,7 +101,6 @@ "id": "cl126hb9m000l2e6d5qk3mohn", "type": "text", "content": { - "html": "
I'm super pumped that you've decided to try out Typebot 😍
", "richText": [ { "type": "p", @@ -117,8 +110,7 @@ } ] } - ], - "plainText": "I'm super pumped that you've decided to try out Typebot 😍" + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -126,7 +118,6 @@ "id": "cl126hpw1000m2e6dneousygl", "type": "text", "content": { - "html": "
You are small steps away from meaningful, hyper-personalized experience for your users
", "richText": [ { "type": "p", @@ -136,8 +127,7 @@ } ] } - ], - "plainText": "You are small steps away from meaningful, hyper-personalized experience for your users" + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -145,7 +135,6 @@ "id": "cl126guhd000k2e6d6ypkex9z", "type": "text", "content": { - "html": "
Let's get you set up for your Typebot journey.
", "richText": [ { "type": "p", @@ -153,8 +142,7 @@ { "text": "Let's get you set up for your Typebot journey." } ] } - ], - "plainText": "Let's get you set up for your Typebot journey." + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -162,14 +150,12 @@ "id": "cl126ixp9000q2e6dslh0zypi", "type": "text", "content": { - "html": "
Do you work for a specific company?
", "richText": [ { "type": "p", "children": [{ "text": "Do you work for a specific company?" }] } - ], - "plainText": "Do you work for a specific company?" + ] }, "groupId": "clcueadzi00073b6sqz8n5vxp" }, @@ -219,7 +205,6 @@ "id": "cl126krck00112e6d1m6ctxpn", "type": "text", "content": { - "html": "
What type of bots are you planning to build with Typebot?
", "richText": [ { "type": "p", @@ -229,8 +214,7 @@ } ] } - ], - "plainText": "What type of bots are you planning to build with Typebot?" + ] }, "groupId": "clcueadzi00093b6s82ivles8" }, @@ -330,7 +314,6 @@ "id": "cl126p76d001k2e6dbhnf2ysq", "type": "text", "content": { - "html": "
Thank you for answering those questions!
", "richText": [ { "type": "p", @@ -338,8 +321,7 @@ { "text": "Thank you for answering those questions!" } ] } - ], - "plainText": "Thank you for answering those questions!" + ] }, "groupId": "clcueadzi000a3b6spk404zpz" }, @@ -355,7 +337,6 @@ "id": "cl126txta001y2e6dtxrbsnek", "type": "text", "content": { - "html": "
You can reach out to me using the contact bubble on the bottom right corner πŸ€“
", "richText": [ { "type": "p", @@ -365,8 +346,7 @@ } ] } - ], - "plainText": "You can reach out to me using the contact bubble on the bottom right corner πŸ€“" + ] }, "groupId": "clcueadzi000a3b6spk404zpz" }, @@ -374,14 +354,12 @@ "id": "cl12buyly00172e6991bz38ch", "type": "text", "content": { - "html": "
Let's create your first typebot...
", "richText": [ { "type": "p", "children": [{ "text": "Let's create your first typebot..." }] } - ], - "plainText": "Let's create your first typebot..." + ] }, "groupId": "clcueadzi000a3b6spk404zpz" } @@ -396,11 +374,9 @@ "id": "cl127yxym000b2e6d9hksxo6h", "type": "text", "content": { - "html": "
What else?
", "richText": [ { "type": "p", "children": [{ "text": "What else?" }] } - ], - "plainText": "What else?" + ] }, "groupId": "clcueadzi000b3b6sv6936vs4" }, diff --git a/apps/builder/public/templates/basic-chat-gpt.json b/apps/builder/public/templates/basic-chat-gpt.json index 631a68dd4..223f2831e 100644 --- a/apps/builder/public/templates/basic-chat-gpt.json +++ b/apps/builder/public/templates/basic-chat-gpt.json @@ -82,14 +82,12 @@ "id": "myldn1l1nfdwwm8qvza71rwv", "type": "text", "content": { - "html": "
{{Assistant Messages}}
", "richText": [ { "type": "p", "children": [{ "text": "{{Assistant Messages}}" }] } - ], - "plainText": "{{Assistant Messages}}" + ] }, "groupId": "a6ymhjwtkqwp8t127plz8qmk", "outgoingEdgeId": "y8ml9ljnsydol9b42fd9zdve" @@ -105,11 +103,9 @@ "id": "vzcrfk4vl9gy8igu0ysja5nc", "type": "text", "content": { - "html": "
Hi there πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Hi there πŸ‘‹" }] } - ], - "plainText": "Hi there πŸ‘‹" + ] }, "groupId": "c5f00f3oclwi1srcz10jjt9u" }, @@ -117,11 +113,9 @@ "id": "gphm5wy1md9cunwkdtbzg6nq", "type": "text", "content": { - "html": "
How can I help?
", "richText": [ { "type": "p", "children": [{ "text": "How can I help?" }] } - ], - "plainText": "How can I help?" + ] }, "groupId": "c5f00f3oclwi1srcz10jjt9u", "outgoingEdgeId": "h5sk58j0ryrxmfv4gmw7r4dw" @@ -137,7 +131,6 @@ "id": "s6eky7dd3md9hto9y4wsuj7h", "type": "text", "content": { - "html": "
You need to add your OpenAI credentials to make this bot work. πŸͺ„
", "richText": [ { "type": "p", @@ -147,8 +140,7 @@ } ] } - ], - "plainText": "You need to add your OpenAI credentials to make this bot work. πŸͺ„" + ] }, "groupId": "t3tv4dm3khwmiotjle5jb65g" }, @@ -156,7 +148,6 @@ "id": "nqsu9f13q5j8tt56bcbuto62", "type": "text", "content": { - "html": "
Once it's done, delete this group and connect the Start block with Intro πŸš€
", "richText": [ { "type": "p", @@ -170,8 +161,7 @@ { "text": " πŸš€" } ] } - ], - "plainText": "Once it's done, delete this group and connect the Start block with Intro πŸš€" + ] }, "groupId": "t3tv4dm3khwmiotjle5jb65g" } diff --git a/apps/builder/public/templates/chat-gpt-personas.json b/apps/builder/public/templates/chat-gpt-personas.json index e8f1bc6b1..91fb89610 100644 --- a/apps/builder/public/templates/chat-gpt-personas.json +++ b/apps/builder/public/templates/chat-gpt-personas.json @@ -29,7 +29,6 @@ "id": "s6eky7dd3md9hto9y4wsuj7h", "type": "text", "content": { - "html": "
You need to add your OpenAI credentials to make this bot work. πŸͺ„
", "richText": [ { "type": "p", @@ -39,8 +38,7 @@ } ] } - ], - "plainText": "You need to add your OpenAI credentials to make this bot work. πŸͺ„" + ] }, "groupId": "bofjp88arodr4k0btv2esyqy" }, @@ -48,7 +46,6 @@ "id": "nqsu9f13q5j8tt56bcbuto62", "type": "text", "content": { - "html": "
Once it's done, delete this group and connect the Start block with Intro πŸš€
", "richText": [ { "type": "p", @@ -62,8 +59,7 @@ { "text": " πŸš€" } ] } - ], - "plainText": "Once it's done, delete this group and connect the Start block with Intro πŸš€" + ] }, "groupId": "bofjp88arodr4k0btv2esyqy" } @@ -109,14 +105,12 @@ "id": "myldn1l1nfdwwm8qvza71rwv", "type": "text", "content": { - "html": "
{{Assistant Messages}}
", "richText": [ { "type": "p", "children": [{ "text": "{{Assistant Messages}}" }] } - ], - "plainText": "{{Assistant Messages}}" + ] }, "groupId": "dmg57mgick51p8l5pnyqtyf9" }, @@ -184,14 +178,12 @@ "id": "sei88rrjcmpgm3vhxjvkofyt", "type": "text", "content": { - "html": "
{{Assistant Messages}}
", "richText": [ { "type": "p", "children": [{ "text": "{{Assistant Messages}}" }] } - ], - "plainText": "{{Assistant Messages}}" + ] }, "groupId": "fj5z2nx488htv0843kq6qeyk" }, @@ -259,14 +251,12 @@ "id": "h96lile0evtqa0jx24gmfo25", "type": "text", "content": { - "html": "
{{Assistant Messages}}
", "richText": [ { "type": "p", "children": [{ "text": "{{Assistant Messages}}" }] } - ], - "plainText": "{{Assistant Messages}}" + ] }, "groupId": "csbysu8dr08zxr4i6hzvzjdf" }, @@ -303,14 +293,12 @@ "id": "gphm5wy1md9cunwkdtbzg6nq", "type": "text", "content": { - "html": "
Who would you want to talk to?
", "richText": [ { "type": "p", "children": [{ "text": "Who would you want to talk to?" }] } - ], - "plainText": "Who would you want to talk to?" + ] }, "groupId": "u6nm47oyneidmsebszp60t0m" }, @@ -427,9 +415,7 @@ "id": "qm3v36qb93ijnghdjgy9mcwf", "type": "text", "content": { - "html": "
Hi πŸ‘‹
", - "richText": [{ "type": "p", "children": [{ "text": "Hi πŸ‘‹" }] }], - "plainText": "Hi πŸ‘‹" + "richText": [{ "type": "p", "children": [{ "text": "Hi πŸ‘‹" }] }] }, "groupId": "py719ungczkgz5f40zkw3tr2" }, @@ -437,7 +423,6 @@ "id": "ln8d3vdq4shclzrxcy9rmxfg", "type": "text", "content": { - "html": "
I can help you translate things and perfect your English.
", "richText": [ { "type": "p", @@ -447,8 +432,7 @@ } ] } - ], - "plainText": "I can help you translate things and perfect your English." + ] }, "groupId": "py719ungczkgz5f40zkw3tr2" }, @@ -456,11 +440,9 @@ "id": "r7yu488ugfif8hxy3e4sospb", "type": "text", "content": { - "html": "
How can I help?
", "richText": [ { "type": "p", "children": [{ "text": "How can I help?" }] } - ], - "plainText": "How can I help?" + ] }, "groupId": "py719ungczkgz5f40zkw3tr2", "outgoingEdgeId": "ripf74t9yicdze8xr2yrklyx" @@ -476,9 +458,7 @@ "id": "bbeedootn9m8eass0mqu3w4t", "type": "text", "content": { - "html": "
Hi πŸ‘‹
", - "richText": [{ "type": "p", "children": [{ "text": "Hi πŸ‘‹" }] }], - "plainText": "Hi πŸ‘‹" + "richText": [{ "type": "p", "children": [{ "text": "Hi πŸ‘‹" }] }] }, "groupId": "uyry49c9bm1pvk6t8i471l2d" }, @@ -486,14 +466,12 @@ "id": "chdghb0k27c4okwu9yky4ox4", "type": "text", "content": { - "html": "
I'm an expert in copywriting.
", "richText": [ { "type": "p", "children": [{ "text": "I'm an expert in copywriting." }] } - ], - "plainText": "I'm an expert in copywriting." + ] }, "groupId": "uyry49c9bm1pvk6t8i471l2d" }, @@ -501,11 +479,9 @@ "id": "idp7w8c8zbkvl95oa1vquiml", "type": "text", "content": { - "html": "
How can I help?
", "richText": [ { "type": "p", "children": [{ "text": "How can I help?" }] } - ], - "plainText": "How can I help?" + ] }, "groupId": "uyry49c9bm1pvk6t8i471l2d", "outgoingEdgeId": "v0tfmbt8tpwwrieftvzg8lti" @@ -521,9 +497,7 @@ "id": "n96j3pf3m87aufcapx2ulr2n", "type": "text", "content": { - "html": "
Hi πŸ‘‹
", - "richText": [{ "type": "p", "children": [{ "text": "Hi πŸ‘‹" }] }], - "plainText": "Hi πŸ‘‹" + "richText": [{ "type": "p", "children": [{ "text": "Hi πŸ‘‹" }] }] }, "groupId": "zfa8oj0a0tnlho9a67llulst" }, @@ -531,7 +505,6 @@ "id": "wxk5z9yyiojkk9u3b5m6shax", "type": "text", "content": { - "html": "
I can explain concept with very simple terms.
", "richText": [ { "type": "p", @@ -539,8 +512,7 @@ { "text": "I can explain concept with very simple terms." } ] } - ], - "plainText": "I can explain concept with very simple terms." + ] }, "groupId": "zfa8oj0a0tnlho9a67llulst" }, @@ -548,7 +520,6 @@ "id": "ileqgg2r2kyh2zovpivr775s", "type": "text", "content": { - "html": "
What concept would you like me to explain?
", "richText": [ { "type": "p", @@ -556,8 +527,7 @@ { "text": "What concept would you like me to explain?" } ] } - ], - "plainText": "What concept would you like me to explain?" + ] }, "groupId": "zfa8oj0a0tnlho9a67llulst", "outgoingEdgeId": "v5bki4h7m1lnryhgzudnvvpx" diff --git a/apps/builder/public/templates/customer-support.json b/apps/builder/public/templates/customer-support.json index eaebf4ca7..e12acdf90 100644 --- a/apps/builder/public/templates/customer-support.json +++ b/apps/builder/public/templates/customer-support.json @@ -28,12 +28,10 @@ "type": "text", "groupId": "vLUAPaxKwPF49iZhg4XZYa", "content": { - "html": "
Hey friend πŸ‘‹
How can I help you?
", "richText": [ { "type": "p", "children": [{ "text": "Hey friend πŸ‘‹" }] }, { "type": "p", "children": [{ "text": "How can I help you?" }] } - ], - "plainText": "Hey friend πŸ‘‹How can I help you?" + ] } }, { @@ -77,11 +75,7 @@ "type": "text", "groupId": "7MuqF6nen1ZTwGB53Mz8VY", "content": { - "html": "
Shoot! πŸ€ͺ
", - "richText": [ - { "type": "p", "children": [{ "text": "Shoot! πŸ€ͺ" }] } - ], - "plainText": "Shoot! πŸ€ͺ" + "richText": [{ "type": "p", "children": [{ "text": "Shoot! πŸ€ͺ" }] }] } }, { @@ -89,7 +83,6 @@ "type": "text", "groupId": "7MuqF6nen1ZTwGB53Mz8VY", "content": { - "html": "
Can you describe the bug with as many details as possible?
", "richText": [ { "type": "p", @@ -99,8 +92,7 @@ } ] } - ], - "plainText": "Can you describe the bug with as many details as possible?" + ] } }, { @@ -129,9 +121,7 @@ "type": "text", "groupId": "kyK8JQ77NodUYaz3JLS88A", "content": { - "html": "
Awesome!
", - "richText": [{ "type": "p", "children": [{ "text": "Awesome!" }] }], - "plainText": "Awesome!" + "richText": [{ "type": "p", "children": [{ "text": "Awesome!" }] }] } }, { @@ -139,7 +129,6 @@ "type": "text", "groupId": "kyK8JQ77NodUYaz3JLS88A", "content": { - "html": "
Head up to the feedback board.
πŸ‘‰ https://app.typebot.io/feedback
There, you'll be able to check existing feature requests and submit yours if it's missing πŸ’ͺ
", "richText": [ { "type": "p", @@ -167,8 +156,7 @@ } ] } - ], - "plainText": "Head up to the feedback board.πŸ‘‰ https://app.typebot.io/feedbackThere, you'll be able to check existing feature requests and submit yours if it's missing πŸ’ͺ" + ] } }, { @@ -206,7 +194,6 @@ "type": "text", "groupId": "puWCBhGWSQRbqTkVH89RCf", "content": { - "html": "
First, don't forget to check out the Documentation πŸ™
", "richText": [ { "type": "p", @@ -220,8 +207,7 @@ { "text": "" } ] } - ], - "plainText": "First, don't forget to check out the Documentation πŸ™" + ] } }, { @@ -229,14 +215,12 @@ "type": "text", "groupId": "puWCBhGWSQRbqTkVH89RCf", "content": { - "html": "
Otherwise, I'm all ears!
", "richText": [ { "type": "p", "children": [{ "text": "Otherwise, I'm all ears!" }] } - ], - "plainText": "Otherwise, I'm all ears!" + ] } }, { @@ -273,7 +257,6 @@ "type": "text", "groupId": "1GvxCAAEysxJMxrVngud3X", "content": { - "html": "
Thank you so much for your submission πŸ’™
", "richText": [ { "type": "p", @@ -281,8 +264,7 @@ { "text": "Thank you so much for your submission πŸ’™" } ] } - ], - "plainText": "Thank you so much for your submission πŸ’™" + ] } }, { @@ -290,7 +272,6 @@ "type": "text", "groupId": "1GvxCAAEysxJMxrVngud3X", "content": { - "html": "
I'll get back to you ASAP (usually within 24 hours)
", "richText": [ { "type": "p", @@ -300,8 +281,7 @@ } ] } - ], - "plainText": "I'll get back to you ASAP (usually within 24 hours)" + ] } }, { @@ -339,14 +319,12 @@ "type": "text", "groupId": "wncvzVDFJDvhh1M3CXJ6aL", "content": { - "html": "
On which email can I contact you?
", "richText": [ { "type": "p", "children": [{ "text": "On which email can I contact you?" }] } - ], - "plainText": "On which email can I contact you?" + ] } }, { diff --git a/apps/builder/public/templates/digital-product-payment.json b/apps/builder/public/templates/digital-product-payment.json index d243fcf88..d7859754c 100644 --- a/apps/builder/public/templates/digital-product-payment.json +++ b/apps/builder/public/templates/digital-product-payment.json @@ -30,11 +30,9 @@ "groupId": "cl3u4431400042e6go5nd0euq", "type": "text", "content": { - "html": "
Hi there πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Hi there πŸ‘‹" }] } - ], - "plainText": "Hi there πŸ‘‹" + ] } }, { @@ -42,11 +40,9 @@ "groupId": "cl3u4431400042e6go5nd0euq", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { @@ -75,14 +71,12 @@ "groupId": "cl3u45dib00092e6g4q2tdkpu", "type": "text", "content": { - "html": "
Cool, nice to meet you {{Name}}
", "richText": [ { "type": "p", "children": [{ "text": "Cool, nice to meet you {{Name}}" }] } - ], - "plainText": "Cool, nice to meet you {{Name}}" + ] } }, { @@ -90,7 +84,6 @@ "groupId": "cl3u45dib00092e6g4q2tdkpu", "type": "text", "content": { - "html": "
I've been working on a Notion template for the last 3 months to help you Grow your business.
", "richText": [ { "type": "p", @@ -100,8 +93,7 @@ } ] } - ], - "plainText": "I've been working on a Notion template for the last 3 months to help you Grow your business." + ] } }, { @@ -109,7 +101,6 @@ "groupId": "cl3u45dib00092e6g4q2tdkpu", "type": "text", "content": { - "html": "
It is based on the Bullseye Growth Framework
", "richText": [ { "type": "p", @@ -117,8 +108,7 @@ { "text": "It is based on the Bullseye Growth Framework" } ] } - ], - "plainText": "It is based on the Bullseye Growth Framework" + ] } }, { @@ -135,7 +125,6 @@ "groupId": "cl3u45dib00092e6g4q2tdkpu", "type": "text", "content": { - "html": "
It's yours for $9
", "richText": [ { "type": "p", @@ -145,8 +134,7 @@ } ] } - ], - "plainText": "It's yours for $9" + ] } }, { @@ -154,7 +142,6 @@ "groupId": "cl3u45dib00092e6g4q2tdkpu", "type": "text", "content": { - "html": "
Are you interested in receiving a copy of this template?
", "richText": [ { "type": "p", @@ -164,8 +151,7 @@ } ] } - ], - "plainText": "Are you interested in receive a copy of this template?" + ] } }, { @@ -202,7 +188,6 @@ "groupId": "cl3u4iw28000s2e6gdmukl6qb", "type": "text", "content": { - "html": "
Oh ok, feel free to come back when you feel ready {{Name}}!
", "richText": [ { "type": "p", @@ -212,8 +197,7 @@ } ] } - ], - "plainText": "Oh ok, feel free to come back when you feel ready {{Name}}!" + ] } }, { @@ -236,11 +220,9 @@ "groupId": "cl3u4kblb000w2e6gfflsq56p", "type": "text", "content": { - "html": "
That's awesome!
", "richText": [ { "type": "p", "children": [{ "text": "That's awesome!" }] } - ], - "plainText": "That's awesome!" + ] } }, { @@ -248,7 +230,6 @@ "groupId": "cl3u4kblb000w2e6gfflsq56p", "type": "text", "content": { - "html": "
What's the email address where you want to receive the link?
", "richText": [ { "type": "p", @@ -258,8 +239,7 @@ } ] } - ], - "plainText": "What's the email address where you want to receive the link?" + ] } }, { @@ -285,11 +265,9 @@ "groupId": "cl3u4leig00112e6gxbk65r7y", "type": "text", "content": { - "html": "
Sounds good.
", "richText": [ { "type": "p", "children": [{ "text": "Sounds good." }] } - ], - "plainText": "Sounds good." + ] } }, { @@ -297,7 +275,6 @@ "groupId": "cl3u4leig00112e6gxbk65r7y", "type": "text", "content": { - "html": "
You're a step away from implementing proven growth systems to your business πŸš€
", "richText": [ { "type": "p", @@ -307,8 +284,7 @@ } ] } - ], - "plainText": "You're a step away from implementing proven growth systems to your business πŸš€" + ] } }, { @@ -358,7 +334,6 @@ "groupId": "cl3u4vnth00182e6g2hh0gewl", "type": "text", "content": { - "html": "
It's all good, you should have received the email!
", "richText": [ { "type": "p", @@ -368,8 +343,7 @@ } ] } - ], - "plainText": "It's all good, you should have received the email!" + ] } }, { @@ -377,14 +351,12 @@ "groupId": "cl3u4vnth00182e6g2hh0gewl", "type": "text", "content": { - "html": "
Thanks again for your visit.
", "richText": [ { "type": "p", "children": [{ "text": "Thanks again for your visit." }] } - ], - "plainText": "Thanks again for your visit." + ] } }, { @@ -392,9 +364,7 @@ "groupId": "cl3u4vnth00182e6g2hh0gewl", "type": "text", "content": { - "html": "
Bye πŸ‘‹
", - "richText": [{ "type": "p", "children": [{ "text": "Bye πŸ‘‹" }] }], - "plainText": "Bye πŸ‘‹" + "richText": [{ "type": "p", "children": [{ "text": "Bye πŸ‘‹" }] }] } } ] diff --git a/apps/builder/public/templates/faq.json b/apps/builder/public/templates/faq.json index 1443836ca..b4f8c8950 100644 --- a/apps/builder/public/templates/faq.json +++ b/apps/builder/public/templates/faq.json @@ -30,7 +30,6 @@ "groupId": "cl96ns9qr00043b6ii07bo25o", "type": "text", "content": { - "html": "
If you have a question about our product, you're in the right place 😊
", "richText": [ { "type": "p", @@ -40,8 +39,7 @@ } ] } - ], - "plainText": "If you have a question about our product, you're in the right place 😊" + ] } }, { @@ -92,11 +90,9 @@ "groupId": "cl96nt9ob00063b6ii2pktlxq", "type": "text", "content": { - "html": "
Hey there πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Hey there πŸ‘‹" }] } - ], - "plainText": "Hey there πŸ‘‹" + ] } }, { @@ -104,7 +100,6 @@ "groupId": "cl96nt9ob00063b6ii2pktlxq", "type": "text", "content": { - "html": "
I'm John, head of the customer success Team at Analyzr
", "richText": [ { "type": "p", @@ -114,8 +109,7 @@ } ] } - ], - "plainText": "I'm John, head of the customer success Team at Analyzr" + ] }, "outgoingEdgeId": "cl96nv51s000a3b6i3wmlcmdt" } @@ -131,7 +125,6 @@ "groupId": "cl96o2cgi000r3b6iljr1iwdl", "type": "text", "content": { - "html": "
Analyzr is a simple and privacy-friendly analytics tool for your website
", "richText": [ { "type": "p", @@ -141,8 +134,7 @@ } ] } - ], - "plainText": "Analyzr is a simple and privacy-friendly analytics tool for your website" + ] } }, { @@ -150,7 +142,6 @@ "groupId": "cl96o2cgi000r3b6iljr1iwdl", "type": "text", "content": { - "html": "
It is:
βœ… Lightweight
βœ… Open-source
βœ… Fully compliant with GDPR
", "richText": [ { "type": "p", "children": [{ "text": "It is:" }] }, { "type": "p", "children": [{ "text": "βœ… Lightweight" }] }, @@ -159,8 +150,7 @@ "type": "p", "children": [{ "text": "βœ… Fully compliant with GDPR" }] } - ], - "plainText": "It is:βœ… Lightweightβœ… Open-sourceβœ… Fully compliant with GDPR" + ] } }, { @@ -190,9 +180,7 @@ "groupId": "cl96o6a2700123b6ie4efb6bb", "type": "text", "content": { - "html": "
You can!
", - "richText": [{ "type": "p", "children": [{ "text": "You can!" }] }], - "plainText": "You can!" + "richText": [{ "type": "p", "children": [{ "text": "You can!" }] }] } }, { @@ -200,7 +188,6 @@ "groupId": "cl96o6a2700123b6ie4efb6bb", "type": "text", "content": { - "html": "
Analyzr has a generous free plan that allows you to store 1,000,000Β events/mo πŸš€
", "richText": [ { "type": "p", @@ -210,8 +197,7 @@ } ] } - ], - "plainText": "Analyzr has a generous free plan that allows you to store 1,000,000Β events/mo πŸš€" + ] } }, { @@ -248,7 +234,6 @@ "groupId": "cl96o8eym001a3b6i3lxh7kw0", "type": "text", "content": { - "html": "
An event is a user event on your website.
", "richText": [ { "type": "p", @@ -256,8 +241,7 @@ { "text": "An event is a user event on your website." } ] } - ], - "plainText": "An event is a user event on your website." + ] } }, { @@ -265,7 +249,6 @@ "groupId": "cl96o8eym001a3b6i3lxh7kw0", "type": "text", "content": { - "html": "
It can be "User visited this URL" or "User clicked on this button"
", "richText": [ { "type": "p", @@ -275,8 +258,7 @@ } ] } - ], - "plainText": "It can be \"User visited this URL\" or \"User clicked on this button\"" + ] } }, { @@ -314,7 +296,6 @@ "groupId": "cl96oc274001m3b6ig3beli9v", "type": "text", "content": { - "html": "
The company was founded in 2020 by Josh Corn
", "richText": [ { "type": "p", @@ -322,8 +303,7 @@ { "text": "The company was founded in 2020 by Josh Corn" } ] } - ], - "plainText": "The company was founded in 2020 by Josh Corn" + ] } }, { @@ -331,14 +311,12 @@ "groupId": "cl96oc274001m3b6ig3beli9v", "type": "text", "content": { - "html": "
We are now a team of 15
", "richText": [ { "type": "p", "children": [{ "text": "We are now a team of 15" }] } - ], - "plainText": "We are now a team of 15" + ] } }, { @@ -346,7 +324,6 @@ "groupId": "cl96oc274001m3b6ig3beli9v", "type": "text", "content": { - "html": "
Our core values are:
πŸ” Transparency
⚑ Ship fast
πŸ’™ Awesome customer support
", "richText": [ { "type": "p", "children": [{ "text": "Our core values are:" }] }, { "type": "p", "children": [{ "text": "" }] }, @@ -356,8 +333,7 @@ "type": "p", "children": [{ "text": "πŸ’™ Awesome customer support" }] } - ], - "plainText": "Our core values are:πŸ” Transparency⚑ Ship fastπŸ’™ Awesome customer support" + ] } }, { @@ -387,11 +363,9 @@ "groupId": "cl96og2yr001v3b6ivhzb1x34", "type": "text", "content": { - "html": "
Sure, no problem!
", "richText": [ { "type": "p", "children": [{ "text": "Sure, no problem!" }] } - ], - "plainText": "Sure, no problem!" + ] } }, { @@ -419,7 +393,6 @@ "groupId": "cl96oh3mn001z3b6i2b0no81w", "type": "text", "content": { - "html": "
Alright, we'll reach out to you very soon. Thank you so much πŸ’™
", "richText": [ { "type": "p", @@ -429,8 +402,7 @@ } ] } - ], - "plainText": "Alright, we'll reach out to you very soon. Thank you so much πŸ’™" + ] } } ] diff --git a/apps/builder/public/templates/lead-gen.json b/apps/builder/public/templates/lead-gen.json index 730d48127..23ec2e54f 100644 --- a/apps/builder/public/templates/lead-gen.json +++ b/apps/builder/public/templates/lead-gen.json @@ -28,7 +28,6 @@ "type": "text", "groupId": "kinRXxYop2X4d7F9qt8WNB", "content": { - "html": "
Welcome to AA (Awesome Agency)
", "richText": [ { "type": "p", @@ -38,8 +37,7 @@ { "text": " (Awesome Agency)" } ] } - ], - "plainText": "Welcome to AA (Awesome Agency)" + ] } }, { @@ -77,14 +75,12 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
Great! Nice to meet you {{Name}}
", "richText": [ { "type": "p", "children": [{ "text": "Great! Nice to meet you {{Name}}" }] } - ], - "plainText": "Great! Nice to meet you {{Name}}" + ] } }, { @@ -92,7 +88,6 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
What's the best email we can reach you at?
", "richText": [ { "type": "p", @@ -100,8 +95,7 @@ { "text": "What's the best email we can reach you at?" } ] } - ], - "plainText": "What's the best email we can reach you at?" + ] } }, { @@ -127,11 +121,9 @@ "type": "text", "groupId": "q5dAhqSTCaNdiGSJm9B9Rw", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { @@ -160,14 +152,12 @@ "type": "text", "groupId": "fKqRz7iswk7ULaj5PJocZL", "content": { - "html": "
What services are you interested in?
", "richText": [ { "type": "p", "children": [{ "text": "What services are you interested in?" }] } - ], - "plainText": "What services are you interested in?" + ] } }, { @@ -215,7 +205,6 @@ "type": "text", "groupId": "7qHBEyCMvKEJryBHzPmHjV", "content": { - "html": "
Can you tell me a bit more about your needs?
", "richText": [ { "type": "p", @@ -223,8 +212,7 @@ { "text": "Can you tell me a bit more about your needs?" } ] } - ], - "plainText": "Can you tell me a bit more about your needs?" + ] } }, { @@ -249,9 +237,7 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
Perfect!
", - "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }], - "plainText": "Perfect!" + "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }] } }, { @@ -259,14 +245,12 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
We'll get back to you at {{Email}}
", "richText": [ { "type": "p", "children": [{ "text": "We'll get back to you at {{Email}}" }] } - ], - "plainText": "We'll get back to you at {{Email}}" + ] } } ], diff --git a/apps/builder/public/templates/lead-magnet.json b/apps/builder/public/templates/lead-magnet.json index eaebadfcc..401a7b954 100644 --- a/apps/builder/public/templates/lead-magnet.json +++ b/apps/builder/public/templates/lead-magnet.json @@ -29,11 +29,9 @@ "id": "uaks8b01ec3fln8g5iq9gnv7", "type": "text", "content": { - "html": "
Hi there! πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Hi there! πŸ‘‹" }] } - ], - "plainText": "Hi there! πŸ‘‹" + ] }, "groupId": "gr9wedxcqxie11ki9yss1h5o" }, @@ -41,7 +39,6 @@ "id": "iy9brewiabfhv7ctsvdd5fg6", "type": "text", "content": { - "html": "
Sign up for the newsletter andΒ get free access to our exclusive 'Community Bundle'.
", "richText": [ { "type": "p", @@ -53,8 +50,7 @@ } ] } - ], - "plainText": "Sign up for the newsletter andΒ get free access to our exclusive 'Community Bundle'." + ] }, "groupId": "gr9wedxcqxie11ki9yss1h5o" }, @@ -62,7 +58,6 @@ "id": "immlrmjc0tnvc0rd1552c0ey", "type": "text", "content": { - "html": "
This bundle helps you create the best Community possible for your project.
", "richText": [ { "type": "p", @@ -72,8 +67,7 @@ } ] } - ], - "plainText": "This bundle helps you create the best Community possible for your project." + ] }, "groupId": "gr9wedxcqxie11ki9yss1h5o" }, @@ -81,11 +75,9 @@ "id": "i1pv6t8sj9wdzoheplwj1cnr", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] }, "groupId": "gr9wedxcqxie11ki9yss1h5o" }, @@ -111,7 +103,6 @@ "id": "pcx0bo7egsq3il16707mkuzc", "type": "text", "content": { - "html": "
Ok, {{Name}}. What email would you like to sign up with?
", "richText": [ { "type": "p", @@ -121,8 +112,7 @@ } ] } - ], - "plainText": "Ok, {{Name}}. What email would you like to sign up with?" + ] }, "groupId": "xaloto3qrrbtcdcrob013xcx" }, @@ -148,14 +138,12 @@ "id": "o6helbp9c682dur5e8bt9yov", "type": "text", "content": { - "html": "
What's your goal with the community?
", "richText": [ { "type": "p", "children": [{ "text": "What's your goal with the community?" }] } - ], - "plainText": "What's your goal with the community?" + ] }, "groupId": "tp9r95ay5vm9zlgzw8twtxn3" }, @@ -207,7 +195,6 @@ "id": "tfqqveo72xt7i7ii9imztcd4", "type": "text", "content": { - "html": "
Perfect, your bundle will be emailed to you right away πŸš€
", "richText": [ { "type": "p", @@ -217,8 +204,7 @@ } ] } - ], - "plainText": "Perfect, your bundle will be emailed to you right away πŸš€" + ] }, "groupId": "cszciavjonb2qp0ga0pladoj" }, @@ -226,14 +212,12 @@ "id": "xxujz94e696scfz0jjw5zyvw", "type": "text", "content": { - "html": "
What's your goal with the community?
", "richText": [ { "type": "p", "children": [{ "text": "What's your goal with the community?" }] } - ], - "plainText": "What's your goal with the community?" + ] }, "groupId": "cszciavjonb2qp0ga0pladoj" }, @@ -344,14 +328,12 @@ "id": "dzcw0vwo23vhp2nwyxl99va8", "type": "text", "content": { - "html": "
Want to know how to win loyal fans?
", "richText": [ { "type": "p", "children": [{ "text": "Want to know how to win loyal fans?" }] } - ], - "plainText": "Want to know how to win loyal fans?" + ] }, "groupId": "k2sbuizycrpuyf44v9eebebr" }, @@ -359,11 +341,9 @@ "id": "yh8ueuio717ceybrcsqa1ekq", "type": "text", "content": { - "html": "
Check out this video:
", "richText": [ { "type": "p", "children": [{ "text": "Check out this video:" }] } - ], - "plainText": "Check out this video:" + ] }, "groupId": "k2sbuizycrpuyf44v9eebebr" }, @@ -388,7 +368,6 @@ "id": "anu87wo53n3ihq4xl8smprwg", "type": "text", "content": { - "html": "
Want to know how to have a great competitive advantage with your community?
", "richText": [ { "type": "p", @@ -398,8 +377,7 @@ } ] } - ], - "plainText": "Want to know how to have a great competitive advantage with your community?" + ] }, "groupId": "v6s5yza7kgretdmbke7lg5u7" }, @@ -407,11 +385,9 @@ "id": "ku2scubf21eqnip3ig3rc7n9", "type": "text", "content": { - "html": "
Check out this video:
", "richText": [ { "type": "p", "children": [{ "text": "Check out this video:" }] } - ], - "plainText": "Check out this video:" + ] }, "groupId": "v6s5yza7kgretdmbke7lg5u7" }, @@ -436,7 +412,6 @@ "id": "ysedrtj5q17usk5ezpa5g88e", "type": "text", "content": { - "html": "
Want to know how to improve your product by leveraging a community?
", "richText": [ { "type": "p", @@ -446,8 +421,7 @@ } ] } - ], - "plainText": "Want to know how to improve your product by leveraging a community?" + ] }, "groupId": "l3pc0992zp0hw8ea83b7aky3" }, @@ -455,11 +429,9 @@ "id": "xy08sticb76u82sgcfaeqpe2", "type": "text", "content": { - "html": "
Check out this video:
", "richText": [ { "type": "p", "children": [{ "text": "Check out this video:" }] } - ], - "plainText": "Check out this video:" + ] }, "groupId": "l3pc0992zp0hw8ea83b7aky3" }, @@ -484,7 +456,6 @@ "id": "lu0bevnjfkor1ugbnbkev7t3", "type": "text", "content": { - "html": "
Want to offer better support with a community?
", "richText": [ { "type": "p", @@ -492,8 +463,7 @@ { "text": "Want to offer better support with a community?" } ] } - ], - "plainText": "Want to offer better support with a community?" + ] }, "groupId": "f4hlh2oq8viwxrpl9ppq5d42" }, @@ -501,11 +471,9 @@ "id": "jrhdfrdn4gdstpktq1q0gk1q", "type": "text", "content": { - "html": "
Check out this video:
", "richText": [ { "type": "p", "children": [{ "text": "Check out this video:" }] } - ], - "plainText": "Check out this video:" + ] }, "groupId": "f4hlh2oq8viwxrpl9ppq5d42" }, diff --git a/apps/builder/public/templates/lead-scoring.json b/apps/builder/public/templates/lead-scoring.json index 9ecc55e65..a3e1904d5 100644 --- a/apps/builder/public/templates/lead-scoring.json +++ b/apps/builder/public/templates/lead-scoring.json @@ -30,9 +30,7 @@ "groupId": "cl1sep1c5001w2e6e77bb1uwb", "type": "text", "content": { - "html": "
Hi! πŸ‘‹
", - "richText": [{ "type": "p", "children": [{ "text": "Hi! πŸ‘‹" }] }], - "plainText": "Hi! πŸ‘‹" + "richText": [{ "type": "p", "children": [{ "text": "Hi! πŸ‘‹" }] }] } }, { @@ -40,7 +38,6 @@ "groupId": "cl1sep1c5001w2e6e77bb1uwb", "type": "text", "content": { - "html": "
I'm glad you are intersted in our services.
", "richText": [ { "type": "p", @@ -48,8 +45,7 @@ { "text": "I'm glad you are intersted in our services." } ] } - ], - "plainText": "I'm glad you are intersted in our services." + ] } }, { @@ -57,7 +53,6 @@ "groupId": "cl1sep1c5001w2e6e77bb1uwb", "type": "text", "content": { - "html": "
I'll need to know a little more about you
", "richText": [ { "type": "p", @@ -65,8 +60,7 @@ { "text": "I'll need to know a little more about you" } ] } - ], - "plainText": "I'll need to know a little more about you" + ] } }, { @@ -91,14 +85,12 @@ "groupId": "cl1sern8w00202e6ez69l190j", "type": "text", "content": { - "html": "
Do you work with a specific company?
", "richText": [ { "type": "p", "children": [{ "text": "Do you work with a specific company?" }] } - ], - "plainText": "Do you work with a specific company?" + ] } }, { @@ -144,11 +136,9 @@ "groupId": "cl1sez6zd00262e6ebh59k1bs", "type": "text", "content": { - "html": "
Which company?
", "richText": [ { "type": "p", "children": [{ "text": "Which company?" }] } - ], - "plainText": "Which company?" + ] } }, { @@ -177,7 +167,6 @@ "groupId": "cl1sf0ogu002d2e6edyhcuu6f", "type": "text", "content": { - "html": "
How many employees is your team composed of?
", "richText": [ { "type": "p", @@ -185,8 +174,7 @@ { "text": "How many employees is your team composed of?" } ] } - ], - "plainText": "How many employees is your team composed of?" + ] } }, { @@ -292,11 +280,9 @@ "groupId": "cl1sf4qk500332e6e8gs5mn3t", "type": "text", "content": { - "html": "
Where are you based?
", "richText": [ { "type": "p", "children": [{ "text": "Where are you based?" }] } - ], - "plainText": "Where are you based?" + ] } }, { @@ -366,7 +352,6 @@ "groupId": "cl1sf85am003i2e6e1yq8eoa7", "type": "text", "content": { - "html": "
Thank you for answering these questions
", "richText": [ { "type": "p", @@ -374,8 +359,7 @@ { "text": "Thank you for answering these questions" } ] } - ], - "plainText": "Thank you for answering these questions" + ] } }, { @@ -415,11 +399,9 @@ "groupId": "cl1sfbbv0003s2e6eheyhv7ke", "type": "text", "content": { - "html": "
What's your job role?
", "richText": [ { "type": "p", "children": [{ "text": "What's your job role?" }] } - ], - "plainText": "What's your job role?" + ] } }, { @@ -506,7 +488,6 @@ "groupId": "cl1sffxet004j2e6ec6gfbffh", "type": "text", "content": { - "html": "
Our service is specifically designed for your situation.
", "richText": [ { "type": "p", @@ -516,8 +497,7 @@ } ] } - ], - "plainText": "Our service is specifically designed for your situation." + ] } }, { @@ -525,14 +505,12 @@ "groupId": "cl1sffxet004j2e6ec6gfbffh", "type": "text", "content": { - "html": "
We'll get back to you ASAP. πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "We'll get back to you ASAP. πŸ‘‹" }] } - ], - "plainText": "We'll get back to you ASAP. πŸ‘‹" + ] } } ] @@ -547,7 +525,6 @@ "groupId": "cl1sfgjlr004l2e6erykli1ud", "type": "text", "content": { - "html": "
Our service doesn't seem to suit your need.
", "richText": [ { "type": "p", @@ -555,8 +532,7 @@ { "text": "Our service doesn't seem to suit your need." } ] } - ], - "plainText": "Our service doesn't seem to suit your need." + ] } }, { @@ -564,7 +540,6 @@ "groupId": "cl1sfgjlr004l2e6erykli1ud", "type": "text", "content": { - "html": "
We'll still send you valuable content by email.
", "richText": [ { "type": "p", @@ -572,8 +547,7 @@ { "text": "We'll still send you valuable content by email." } ] } - ], - "plainText": "We'll still send you valuable content by email." + ] } }, { @@ -581,11 +555,9 @@ "groupId": "cl1sfgjlr004l2e6erykli1ud", "type": "text", "content": { - "html": "
Bye bye πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Bye bye πŸ‘‹" }] } - ], - "plainText": "Bye bye πŸ‘‹" + ] } } ] diff --git a/apps/builder/public/templates/movie-recommendation.json b/apps/builder/public/templates/movie-recommendation.json index 855188726..bda116d10 100644 --- a/apps/builder/public/templates/movie-recommendation.json +++ b/apps/builder/public/templates/movie-recommendation.json @@ -38,7 +38,6 @@ "id": "pd22jxxptmw66xhwddj8toos", "type": "text", "content": { - "html": "
Welcome to our film recommendation bot πŸ‘‹
", "richText": [ { "type": "p", @@ -46,8 +45,7 @@ { "text": "Welcome to our film recommendation bot πŸ‘‹" } ] } - ], - "plainText": "Welcome to our film recommendation bot πŸ‘‹" + ] }, "groupId": "vpsi7kfd4hiu38fd0txt3ndn" }, @@ -63,14 +61,12 @@ "id": "gr8qlv926y817febq85zl0y0", "type": "text", "content": { - "html": "
It is powered by The Movie DB API πŸš€
", "richText": [ { "type": "p", "children": [{ "text": "It is powered by The Movie DB API πŸš€" }] } - ], - "plainText": "It is powered by The Movie DB API πŸš€" + ] }, "groupId": "vpsi7kfd4hiu38fd0txt3ndn" }, @@ -86,11 +82,9 @@ "id": "qllnzuo1zxr5ef8bq9kjdjel", "type": "text", "content": { - "html": "
How can I we help?
", "richText": [ { "type": "p", "children": [{ "text": "How can I we help?" }] } - ], - "plainText": "How can I we help?" + ] }, "groupId": "vpsi7kfd4hiu38fd0txt3ndn" }, @@ -127,9 +121,7 @@ "id": "vqrsszjis5qtbalo8d0fwb1j", "type": "text", "content": { - "html": "
Sure!
", - "richText": [{ "type": "p", "children": [{ "text": "Sure!" }] }], - "plainText": "Sure!" + "richText": [{ "type": "p", "children": [{ "text": "Sure!" }] }] }, "groupId": "xjwiuplgl79ezx460xfuplgr" }, @@ -166,14 +158,12 @@ "id": "v2516de17eigf6mbccy2t6dr", "type": "text", "content": { - "html": "
Select your desired genre πŸ‘‡
", "richText": [ { "type": "p", "children": [{ "text": "Select your desired genre πŸ‘‡" }] } - ], - "plainText": "Select your desired genre πŸ‘‡" + ] }, "groupId": "xjwiuplgl79ezx460xfuplgr" }, @@ -218,9 +208,7 @@ "id": "yqci070mkxfjjdok5yztj1nx", "type": "text", "content": { - "html": "
Sure!
", - "richText": [{ "type": "p", "children": [{ "text": "Sure!" }] }], - "plainText": "Sure!" + "richText": [{ "type": "p", "children": [{ "text": "Sure!" }] }] }, "groupId": "dewz832l9kse7xx1vhkihbk6" }, @@ -257,14 +245,12 @@ "id": "u6q1nvxowaszfdu4g42nqz38", "type": "text", "content": { - "html": "
Here are popular movies this week πŸ‘‡
", "richText": [ { "type": "p", "children": [{ "text": "Here are popular movies this week πŸ‘‡" }] } - ], - "plainText": "Here are popular movies this week πŸ‘‡" + ] }, "groupId": "dewz832l9kse7xx1vhkihbk6" }, @@ -309,7 +295,6 @@ "id": "dbp1cdzqy7txabinmm5osi1a", "type": "text", "content": { - "html": "
Here are trending movies for the {{Selected genre}} genre
", "richText": [ { "type": "p", @@ -319,8 +304,7 @@ } ] } - ], - "plainText": "Here are trending movies for the {{Selected genre}} genre" + ] }, "groupId": "a1c99wep8eqambqjw8g8yeo8" }, @@ -399,11 +383,9 @@ "id": "tsferop3f80u2jq9p8ip964h", "type": "text", "content": { - "html": "
Excellent choice πŸ”₯
", "richText": [ { "type": "p", "children": [{ "text": "Excellent choice πŸ”₯" }] } - ], - "plainText": "Excellent choice πŸ”₯" + ] }, "groupId": "xutzzlxo0f5hs9q8ga1e8tl9" }, @@ -466,11 +448,9 @@ "id": "t21xt4nr48hyu2qk2ij0d2oe", "type": "text", "content": { - "html": "
{{Movie Overview}}
", "richText": [ { "type": "p", "children": [{ "text": "{{Movie Overview}}" }] } - ], - "plainText": "{{Movie Overview}}" + ] }, "groupId": "xutzzlxo0f5hs9q8ga1e8tl9" }, diff --git a/apps/builder/public/templates/nps.json b/apps/builder/public/templates/nps.json index ae7ed39af..12c146ada 100644 --- a/apps/builder/public/templates/nps.json +++ b/apps/builder/public/templates/nps.json @@ -29,9 +29,7 @@ "id": "vep990mmfbe64nqczp66xebw", "type": "text", "content": { - "html": "
Hey! πŸ‘‹
", - "richText": [{ "type": "p", "children": [{ "text": "Hey! πŸ‘‹" }] }], - "plainText": "Hey! πŸ‘‹" + "richText": [{ "type": "p", "children": [{ "text": "Hey! πŸ‘‹" }] }] }, "groupId": "g7l1tc86ty1r6x0yn0r2g1xo" }, @@ -39,7 +37,6 @@ "id": "u1oeokc5j8bzwi4lwqyf7c8q", "type": "text", "content": { - "html": "
Since you are part of our daily users, can I ask you 2 questions?
", "richText": [ { "type": "p", @@ -51,8 +48,7 @@ { "text": "?" } ] } - ], - "plainText": "Since you are part of our daily users, can I ask you 2 questions?" + ] }, "groupId": "g7l1tc86ty1r6x0yn0r2g1xo" }, @@ -82,7 +78,6 @@ "id": "jcp3qhpb4wf95g0ylrp4e8zb", "type": "text", "content": { - "html": "
How likely will you recommend our product to a friend or colleague?
", "richText": [ { "type": "p", @@ -92,8 +87,7 @@ { "text": "to a friend or colleague?" } ] } - ], - "plainText": "How likely will you recommend our product to a friend or colleague?" + ] }, "groupId": "xgqei015z6d58gefpviz8053" }, @@ -167,14 +161,12 @@ "id": "izehojk23xug74tylpm0wbib", "type": "text", "content": { - "html": "
I'm glad to hear that 😍
", "richText": [ { "type": "p", "children": [{ "text": "I'm glad to hear that 😍" }] } - ], - "plainText": "I'm glad to hear that 😍" + ] }, "groupId": "rp2r31gn1w5t1aeej96bhjj3" }, @@ -182,14 +174,12 @@ "id": "qj3e1cxwjub800r6g3lfa4ei", "type": "text", "content": { - "html": "
Could you tell us why?
", "richText": [ { "type": "p", "children": [{ "text": "Could you tell us why?" }] } - ], - "plainText": "Could you tell us why?" + ] }, "groupId": "rp2r31gn1w5t1aeej96bhjj3", "outgoingEdgeId": "hycn6wx0j9ug4wf5vzz9aytx" @@ -222,14 +212,12 @@ "id": "ou7airondk1mxm4inzzyyr1x", "type": "text", "content": { - "html": "
Could you tell us what went wrong?
", "richText": [ { "type": "p", "children": [{ "text": "Could you tell us what went wrong?" }] } - ], - "plainText": "Could you tell us what went wrong?" + ] }, "groupId": "qj9qgsbfv6u1f5oe1bjnwnu9", "outgoingEdgeId": "glj5ishgke8i6s6eyjnmbel1" @@ -361,11 +349,9 @@ "id": "eixinwxcgsng6v8blw6jdgwy", "type": "text", "content": { - "html": "
Thank you! πŸ™
", "richText": [ { "type": "p", "children": [{ "text": "Thank you! πŸ™" }] } - ], - "plainText": "Thank you! πŸ™" + ] }, "groupId": "pp1ncsdaki07pfq5pjl53v6r" }, @@ -373,7 +359,6 @@ "id": "cjqu4wje2zr8i5ehivxv5567", "type": "text", "content": { - "html": "
Would you be ok to leave a review on Capterra?
", "richText": [ { "type": "p", @@ -381,8 +366,7 @@ { "text": "Would you be ok to leave a review on Capterra?" } ] } - ], - "plainText": "Would you be ok to leave a review on Capterra?" + ] }, "groupId": "pp1ncsdaki07pfq5pjl53v6r" }, @@ -419,7 +403,6 @@ "id": "m1my2b6gqq2hgfecw1vs2vcm", "type": "text", "content": { - "html": "
Thank you for taking the time to answer!
", "richText": [ { "type": "p", @@ -427,8 +410,7 @@ { "text": "Thank you for taking the time to answer!" } ] } - ], - "plainText": "Thank you for taking the time to answer!" + ] }, "groupId": "znljx8q0q2ggih0ipu28ryby" }, @@ -436,11 +418,9 @@ "id": "fyl3k7qc6jdmc8t38b9wkcrh", "type": "text", "content": { - "html": "
Have a beautiful day!
", "richText": [ { "type": "p", "children": [{ "text": "Have a beautiful day!" }] } - ], - "plainText": "Have a beautiful day!" + ] }, "groupId": "znljx8q0q2ggih0ipu28ryby" }, @@ -463,7 +443,6 @@ "id": "dfisk4xq8csn0t2aute6hbsd", "type": "text", "content": { - "html": "
Sorry that your experience hasn't been amazing πŸ™
", "richText": [ { "type": "p", @@ -473,8 +452,7 @@ } ] } - ], - "plainText": "Sorry that your experience hasn't been amazing πŸ™" + ] }, "groupId": "vvbtgh5ptk49shyjn3zn6d71" }, @@ -482,7 +460,6 @@ "id": "u6vs0akagfjg63zq8z1rcc14", "type": "text", "content": { - "html": "
Here is a promo code if you'd like to give our product another chance: PROMO123
", "richText": [ { "type": "p", @@ -493,8 +470,7 @@ { "bold": true, "text": "PROMO123" } ] } - ], - "plainText": "Here is a promo code if you'd like to give our product another chance: PROMO123" + ] }, "groupId": "vvbtgh5ptk49shyjn3zn6d71" }, @@ -517,11 +493,9 @@ "id": "cd8ftyg6tkjggncxuo242u3j", "type": "text", "content": { - "html": "
Amazing 🀩
", "richText": [ { "type": "p", "children": [{ "text": "Amazing 🀩" }] } - ], - "plainText": "Amazing 🀩" + ] }, "groupId": "mwfu8ot0z37zfq2fbo5rcyrl" }, @@ -529,14 +503,12 @@ "id": "nigypz7fhnt07440o0829o81", "type": "text", "content": { - "html": "
Let me take you there...
", "richText": [ { "type": "p", "children": [{ "text": "Let me take you there..." }] } - ], - "plainText": "Let me take you there..." + ] }, "groupId": "mwfu8ot0z37zfq2fbo5rcyrl" }, diff --git a/apps/builder/public/templates/onboarding.json b/apps/builder/public/templates/onboarding.json index 891ab4465..098b4c15e 100644 --- a/apps/builder/public/templates/onboarding.json +++ b/apps/builder/public/templates/onboarding.json @@ -29,11 +29,9 @@ "id": "cl1267q2c000e2e6dynjeg83n", "type": "text", "content": { - "html": "
Welcome πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Welcome πŸ‘‹" }] } - ], - "plainText": "Welcome πŸ‘‹" + ] }, "groupId": "az9nafw4tu9b6dyh3cvutlek" }, @@ -41,11 +39,9 @@ "id": "cl1267y1u000f2e6d4rlglv6g", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] }, "groupId": "az9nafw4tu9b6dyh3cvutlek" }, @@ -74,11 +70,9 @@ "id": "cl1266v6f000a2e6db7wj3ux7", "type": "text", "content": { - "html": "
Welcome {{Name}} πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Welcome {{Name}} πŸ‘‹" }] } - ], - "plainText": "Welcome {{Name}} πŸ‘‹" + ] }, "groupId": "s3hgjtmb1bzq6ip2bm9w1r53" }, @@ -86,7 +80,6 @@ "id": "cl126hb9m000l2e6d5qk3mohn", "type": "text", "content": { - "html": "
I'm super pumped that you've decided to try out Typebot 😍
", "richText": [ { "type": "p", @@ -96,8 +89,7 @@ } ] } - ], - "plainText": "I'm super pumped that you've decided to try out Typebot 😍" + ] }, "groupId": "s3hgjtmb1bzq6ip2bm9w1r53" }, @@ -105,7 +97,6 @@ "id": "cl126hpw1000m2e6dneousygl", "type": "text", "content": { - "html": "
You are small steps away from meaningful, hyper-personalized experience for your users
", "richText": [ { "type": "p", @@ -115,8 +106,7 @@ } ] } - ], - "plainText": "You are small steps away from meaningful, hyper-personalized experience for your users" + ] }, "groupId": "s3hgjtmb1bzq6ip2bm9w1r53" }, @@ -124,7 +114,6 @@ "id": "cl126guhd000k2e6d6ypkex9z", "type": "text", "content": { - "html": "
Let's get you set up for your Typebot journey.
", "richText": [ { "type": "p", @@ -132,8 +121,7 @@ { "text": "Let's get you set up for your Typebot journey." } ] } - ], - "plainText": "Let's get you set up for your Typebot journey." + ] }, "groupId": "s3hgjtmb1bzq6ip2bm9w1r53" }, @@ -141,14 +129,12 @@ "id": "cl126ixp9000q2e6dslh0zypi", "type": "text", "content": { - "html": "
Do you work for a specific company?
", "richText": [ { "type": "p", "children": [{ "text": "Do you work for a specific company?" }] } - ], - "plainText": "Do you work for a specific company?" + ] }, "groupId": "s3hgjtmb1bzq6ip2bm9w1r53" }, @@ -198,7 +184,6 @@ "id": "cl126krck00112e6d1m6ctxpn", "type": "text", "content": { - "html": "
What type of bots are you planning to build with Typebot?
", "richText": [ { "type": "p", @@ -208,8 +193,7 @@ } ] } - ], - "plainText": "What type of bots are you planning to build with Typebot?" + ] }, "groupId": "m8k3pv1rjckh3arxgitwo43i" }, @@ -309,7 +293,6 @@ "id": "cl126p76d001k2e6dbhnf2ysq", "type": "text", "content": { - "html": "
Thank you for answering those questions!
", "richText": [ { "type": "p", @@ -317,8 +300,7 @@ { "text": "Thank you for answering those questions!" } ] } - ], - "plainText": "Thank you for answering those questions!" + ] }, "groupId": "cnf2ljrlt875d005783ju7hc" }, @@ -335,11 +317,9 @@ "groupId": "cnf2ljrlt875d005783ju7hc", "type": "text", "content": { - "html": "
See you soon πŸš€
", "richText": [ { "type": "p", "children": [{ "text": "See you soon πŸš€" }] } - ], - "plainText": "See you soon πŸš€" + ] } } ], @@ -353,11 +333,9 @@ "id": "cl127yxym000b2e6d9hksxo6h", "type": "text", "content": { - "html": "
What else?
", "richText": [ { "type": "p", "children": [{ "text": "What else?" }] } - ], - "plainText": "What else?" + ] }, "groupId": "hduy797g246pj8qnhsxy5kt5" }, diff --git a/apps/builder/public/templates/quiz.json b/apps/builder/public/templates/quiz.json index b4d1850a9..26a24d34e 100644 --- a/apps/builder/public/templates/quiz.json +++ b/apps/builder/public/templates/quiz.json @@ -37,14 +37,12 @@ "type": "text", "groupId": "cl1r09bc6000h2e6dqml18p4p", "content": { - "html": "
What does SEO stand for?
", "richText": [ { "type": "p", "children": [{ "text": "What does SEO stand for?" }] } - ], - "plainText": "What does SEO stand for?" + ] } }, { @@ -102,11 +100,9 @@ "type": "text", "groupId": "cl1r0b3ww000q2e6d4aihat41", "content": { - "html": "
Well done!
", "richText": [ { "type": "p", "children": [{ "text": "Well done!" }] } - ], - "plainText": "Well done!" + ] } }, { @@ -114,11 +110,9 @@ "type": "text", "groupId": "cl1r0b3ww000q2e6d4aihat41", "content": { - "html": "
What is anchor text?
", "richText": [ { "type": "p", "children": [{ "text": "What is anchor text?" }] } - ], - "plainText": "What is anchor text?" + ] } }, { @@ -176,11 +170,9 @@ "type": "text", "groupId": "cl1r0erik00182e6dfzezujj0", "content": { - "html": "
Well done!
", "richText": [ { "type": "p", "children": [{ "text": "Well done!" }] } - ], - "plainText": "Well done!" + ] } }, { @@ -188,11 +180,9 @@ "type": "text", "groupId": "cl1r0erik00182e6dfzezujj0", "content": { - "html": "
What is a persona ?
", "richText": [ { "type": "p", "children": [{ "text": "What is a persona ?" }] } - ], - "plainText": "What is a persona ?" + ] } }, { @@ -250,11 +240,9 @@ "type": "text", "groupId": "cl1r0j8u1001t2e6d42mjfcqo", "content": { - "html": "
Well done!
", "richText": [ { "type": "p", "children": [{ "text": "Well done!" }] } - ], - "plainText": "Well done!" + ] } }, { @@ -262,14 +250,12 @@ "type": "text", "groupId": "cl1r0j8u1001t2e6d42mjfcqo", "content": { - "html": "
What does CTA stand for?
", "richText": [ { "type": "p", "children": [{ "text": "What does CTA stand for?" }] } - ], - "plainText": "What does CTA stand for?" + ] } }, { @@ -318,9 +304,7 @@ "type": "text", "groupId": "cl1r0c85100102e6d7uohf0cu", "content": { - "html": "
WRONG!
", - "richText": [{ "type": "p", "children": [{ "text": "WRONG!" }] }], - "plainText": "WRONG!" + "richText": [{ "type": "p", "children": [{ "text": "WRONG!" }] }] } }, { @@ -328,7 +312,6 @@ "type": "text", "groupId": "cl1r0c85100102e6d7uohf0cu", "content": { - "html": "
SEO stands for Search Engine Optimization
", "richText": [ { "type": "p", @@ -336,8 +319,7 @@ { "text": "SEO stands for Search Engine Optimization" } ] } - ], - "plainText": "SEO stands for Search Engine Optimization" + ] }, "outgoingEdgeId": "cl1r0dibf00162e6dwuvli71j" } @@ -353,9 +335,7 @@ "type": "text", "groupId": "cl1r0exdi001l2e6drdwj3u96", "content": { - "html": "
WRONG!
", - "richText": [{ "type": "p", "children": [{ "text": "WRONG!" }] }], - "plainText": "WRONG!" + "richText": [{ "type": "p", "children": [{ "text": "WRONG!" }] }] } }, { @@ -363,7 +343,6 @@ "type": "text", "groupId": "cl1r0exdi001l2e6drdwj3u96", "content": { - "html": "
Anchor text is the visible text that is hyperlinked to another page
", "richText": [ { "type": "p", @@ -373,8 +352,7 @@ } ] } - ], - "plainText": "Anchor text is the visible text that is hyperlinked to another page" + ] }, "outgoingEdgeId": "cl1r0ic5f001s2e6dw777scrq" } @@ -390,9 +368,7 @@ "type": "text", "groupId": "cl1r0k3tq00272e6d1fwyajjx", "content": { - "html": "
WRONG!
", - "richText": [{ "type": "p", "children": [{ "text": "WRONG!" }] }], - "plainText": "WRONG!" + "richText": [{ "type": "p", "children": [{ "text": "WRONG!" }] }] } }, { @@ -400,7 +376,6 @@ "type": "text", "groupId": "cl1r0k3tq00272e6d1fwyajjx", "content": { - "html": "
A persona is a fictional representation of a group of customers
", "richText": [ { "type": "p", @@ -410,8 +385,7 @@ } ] } - ], - "plainText": "A persona is a fictional representation of a group of customers" + ] }, "outgoingEdgeId": "cl1r0l7oa002j2e6dgtx0y1gh" } @@ -427,9 +401,7 @@ "type": "text", "groupId": "cl1r0kqof002d2e6doqhpnuqy", "content": { - "html": "
WRONG!
", - "richText": [{ "type": "p", "children": [{ "text": "WRONG!" }] }], - "plainText": "WRONG!" + "richText": [{ "type": "p", "children": [{ "text": "WRONG!" }] }] } }, { @@ -437,7 +409,6 @@ "type": "text", "groupId": "cl1r0kqof002d2e6doqhpnuqy", "content": { - "html": "
Anchor text is the visible text that is hyperlinked to another page
", "richText": [ { "type": "p", @@ -447,8 +418,7 @@ } ] } - ], - "plainText": "Anchor text is the visible text that is hyperlinked to another page" + ] }, "outgoingEdgeId": "cl1r0p4my00312e6d1wsgwohi" } @@ -529,14 +499,12 @@ "type": "text", "groupId": "cl1r0mn2p002p2e6dijqbjzlh", "content": { - "html": "
Your score is {{Score}}/20.
", "richText": [ { "type": "p", "children": [{ "text": "Your score is {{Score}}/20." }] } - ], - "plainText": "Your score is {{Score}}/20." + ] } }, { @@ -544,11 +512,9 @@ "type": "text", "groupId": "cl1r0mn2p002p2e6dijqbjzlh", "content": { - "html": "
Try again?
", "richText": [ { "type": "p", "children": [{ "text": "Try again?" }] } - ], - "plainText": "Try again?" + ] } }, { @@ -584,11 +550,9 @@ "type": "text", "groupId": "cl1r0rgex00382e6dkayjbys6", "content": { - "html": "
Well done πŸ‘
", "richText": [ { "type": "p", "children": [{ "text": "Well done πŸ‘" }] } - ], - "plainText": "Well done πŸ‘" + ] }, "outgoingEdgeId": "cl1r0s9g8003e2e6d5if2ywz9" } @@ -604,7 +568,6 @@ "type": "text", "groupId": "cl1r0rvak003b2e6dejcdrooq", "content": { - "html": "
You could do better but that's alright!
", "richText": [ { "type": "p", @@ -612,8 +575,7 @@ { "text": "You could do better but that's alright!" } ] } - ], - "plainText": "You could do better but that's alright!" + ] }, "outgoingEdgeId": "cl1r0sarx003f2e6dbzmed9te" } @@ -629,7 +591,6 @@ "type": "text", "groupId": "cl1r0seuj003h2e6dandwc43r", "content": { - "html": "
Aouch, you need to improve your Digital Marketing game.
", "richText": [ { "type": "p", @@ -639,8 +600,7 @@ } ] } - ], - "plainText": "Aouch, you need to improve your Digital Marketing game." + ] }, "outgoingEdgeId": "cl1r0sbzh003g2e6dsqs48aoz" } @@ -672,11 +632,7 @@ "type": "text", "groupId": "cl1r15w3o005s2e6dr5l7csao", "content": { - "html": "
Hi there!
", - "richText": [ - { "type": "p", "children": [{ "text": "Hi there!" }] } - ], - "plainText": "Hi there!" + "richText": [{ "type": "p", "children": [{ "text": "Hi there!" }] }] } }, { @@ -684,7 +640,6 @@ "type": "text", "groupId": "cl1r15w3o005s2e6dr5l7csao", "content": { - "html": "
You're about to answer a Quiz about Digital Marketing
", "richText": [ { "type": "p", @@ -694,8 +649,7 @@ } ] } - ], - "plainText": "You're about to answer a Quiz about Digital Marketing" + ] } }, { @@ -703,14 +657,12 @@ "type": "text", "groupId": "cl1r15w3o005s2e6dr5l7csao", "content": { - "html": "
It is composed of only 4 questions.
", "richText": [ { "type": "p", "children": [{ "text": "It is composed of only 4 questions." }] } - ], - "plainText": "It is composed of only 4 questions." + ] } }, { @@ -718,11 +670,9 @@ "type": "text", "groupId": "cl1r15w3o005s2e6dr5l7csao", "content": { - "html": "
Ready?
", "richText": [ { "type": "p", "children": [{ "bold": true, "text": "Ready?" }] } - ], - "plainText": "Ready?" + ] } }, { diff --git a/apps/builder/src/assets/styles/plate.css b/apps/builder/src/assets/styles/plate.css index d2499a7d7..4523f1ee4 100644 --- a/apps/builder/src/assets/styles/plate.css +++ b/apps/builder/src/assets/styles/plate.css @@ -1,3 +1,10 @@ +.slate-variable { + background-color: #ff8b1a; + color: #ffffff; + padding: 0.125rem 0.25rem; + border-radius: 0.35rem; +} + .slate-bold { font-weight: bold; } diff --git a/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleContent.tsx b/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleContent.tsx index 80e4294aa..aa3023018 100644 --- a/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleContent.tsx +++ b/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleContent.tsx @@ -1,28 +1,25 @@ import { Flex } from '@chakra-ui/react' -import { useTypebot } from '@/features/editor/providers/TypebotProvider' import { TextBubbleBlock } from '@typebot.io/schemas' import React from 'react' -import { isEmpty } from '@typebot.io/lib' -import { parseVariableHtmlTags } from '@/features/variables/helpers/parseVariableHtmlTags' +import { PlateBlock } from './plate/PlateBlock' type Props = { block: TextBubbleBlock } export const TextBubbleContent = ({ block }: Props) => { - const { typebot } = useTypebot() + const isEmpty = block.content.richText.length === 0 return ( Click to edit...

` - : parseVariableHtmlTags(block.content.html, typebot?.variables ?? []), - }} - /> + color={isEmpty ? 'gray.500' : 'inherit'} + > + {block.content.richText.map((element, idx) => ( + + ))} +
) } diff --git a/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleEditor.tsx b/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleEditor.tsx index 9e3ac50e2..a97aabc91 100644 --- a/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleEditor.tsx +++ b/apps/builder/src/features/blocks/bubbles/textBubble/components/TextBubbleEditor.tsx @@ -3,14 +3,8 @@ import React, { useEffect, useRef, useState } from 'react' import { Plate, PlateProvider, usePlateEditorRef } from '@udecode/plate-core' import { editorStyle, platePlugins } from '@/lib/plate' import { BaseEditor, BaseSelection, Transforms } from 'slate' -import { - defaultTextBubbleContent, - TextBubbleContent, - Variable, -} from '@typebot.io/schemas' +import { Variable } from '@typebot.io/schemas' import { ReactEditor } from 'slate-react' -import { serializeHtml } from '@udecode/plate-serializer-html' -import { parseHtmlStringToPlainText } from '../utils' import { VariableSearchInput } from '@/components/inputs/VariableSearchInput' import { colors } from '@/lib/theme' import { useOutsideClick } from '@/hooks/useOutsideClick' @@ -20,7 +14,7 @@ import { TextEditorToolBar } from './TextEditorToolBar' type TextBubbleEditorContentProps = { id: string textEditorValue: TElement[] - onClose: (newContent: TextBubbleContent) => void + onClose: (newContent: TElement[]) => void } const TextBubbleEditorContent = ({ @@ -37,7 +31,7 @@ const TextBubbleEditorContent = ({ const textEditorRef = useRef(null) - const closeEditor = () => onClose(convertValueToBlockContent(textEditorValue)) + const closeEditor = () => onClose(textEditorValue) useOutsideClick({ ref: textEditorRef, @@ -67,18 +61,6 @@ const TextBubbleEditorContent = ({ } } - const convertValueToBlockContent = (value: TElement[]): TextBubbleContent => { - if (value.length === 0) defaultTextBubbleContent - const html = serializeHtml(editor, { - nodes: value, - }) - return { - html, - richText: value, - plainText: parseHtmlStringToPlainText(html), - } - } - const handleVariableSelected = (variable?: Variable) => { setIsVariableDropdownOpen(false) if (!rememberedSelection.current || !variable) return @@ -170,7 +152,7 @@ const TextBubbleEditorContent = ({ type TextBubbleEditorProps = { id: string initialValue: TElement[] - onClose: (newContent: TextBubbleContent) => void + onClose: (newContent: TElement[]) => void } export const TextBubbleEditor = ({ diff --git a/apps/builder/src/features/blocks/bubbles/textBubble/components/plate/PlateBlock.tsx b/apps/builder/src/features/blocks/bubbles/textBubble/components/plate/PlateBlock.tsx new file mode 100644 index 000000000..867aa5d78 --- /dev/null +++ b/apps/builder/src/features/blocks/bubbles/textBubble/components/plate/PlateBlock.tsx @@ -0,0 +1,27 @@ +import { TElement, TText, TDescendant } from '@udecode/plate-common' +import { PlateText } from './PlateText' + +export const PlateBlock = ({ element }: { element: TElement | TText }) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (element.text) return + switch (element.type) { + case 'a': { + return ( + + {(element.children as TDescendant[])?.map((child, idx) => ( + + ))} + + ) + } + default: { + return ( +
+ {(element.children as TDescendant[])?.map((child, idx) => ( + + ))} +
+ ) + } + } +} diff --git a/apps/builder/src/features/blocks/bubbles/textBubble/components/plate/PlateText.tsx b/apps/builder/src/features/blocks/bubbles/textBubble/components/plate/PlateText.tsx new file mode 100644 index 000000000..2850a8bf7 --- /dev/null +++ b/apps/builder/src/features/blocks/bubbles/textBubble/components/plate/PlateText.tsx @@ -0,0 +1,38 @@ +export const PlateText = ({ + text, + bold, + italic, + underline, +}: { + text: string + bold?: boolean + italic?: boolean + underline?: boolean +}) => { + let className = '' + if (bold) className += 'slate-bold' + if (italic) className += ' slate-italic' + if (underline) className += ' slate-underline' + if (className) + return ( + + + + ) + return +} + +const PlateTextContent = ({ text }: { text: string }) => ( + <> + {text.split(/\{\{(.*?\}\})/g).map((str, idx) => { + if (str.endsWith('}}')) { + return ( + + {str.trim().slice(0, -2)} + + ) + } + return str + })} + +) diff --git a/apps/builder/src/features/blocks/bubbles/textBubble/utils.ts b/apps/builder/src/features/blocks/bubbles/textBubble/utils.ts deleted file mode 100644 index 904481743..000000000 --- a/apps/builder/src/features/blocks/bubbles/textBubble/utils.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Parser } from 'htmlparser2' -import { isNotEmpty } from '@typebot.io/lib' - -export const parseHtmlStringToPlainText = (html: string): string => { - let plainText = '' - const parser = new Parser({ - onopentag(name) { - if (name === 'div' && isNotEmpty(plainText)) plainText += '\n' - }, - ontext(text) { - plainText += `${text}` - }, - }) - parser.write(html) - parser.end() - return plainText -} diff --git a/apps/builder/src/features/blocks/integrations/googleSheets/googleSheets.spec.ts b/apps/builder/src/features/blocks/integrations/googleSheets/googleSheets.spec.ts index ba68ad908..3c4660fec 100644 --- a/apps/builder/src/features/blocks/integrations/googleSheets/googleSheets.spec.ts +++ b/apps/builder/src/features/blocks/integrations/googleSheets/googleSheets.spec.ts @@ -120,12 +120,12 @@ test.describe.parallel('Google sheets integration', () => { await page.getByPlaceholder('Type a value...').nth(-1).fill('test@test.com') await page.click('text=Select a column') - await page.click('text="First name"') + await page.getByRole('menuitem', { name: 'First name' }).click() await createNewVar(page, 'First name') await page.click('text=Add a value') await page.click('text=Select a column') - await page.click('text="Last name"') + await page.getByRole('menuitem', { name: 'Last name' }).click() await createNewVar(page, 'Last name') await page.click('text=Preview') diff --git a/apps/builder/src/features/graph/components/nodes/block/BlockNode.tsx b/apps/builder/src/features/graph/components/nodes/block/BlockNode.tsx index 38d71d6bc..c2cf47863 100644 --- a/apps/builder/src/features/graph/components/nodes/block/BlockNode.tsx +++ b/apps/builder/src/features/graph/components/nodes/block/BlockNode.tsx @@ -13,7 +13,6 @@ import { DraggableBlock, Block, BlockWithOptions, - TextBubbleContent, TextBubbleBlock, LogicBlockType, } from '@typebot.io/schemas' @@ -39,6 +38,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' export const BlockNode = ({ block, @@ -72,7 +72,7 @@ export const BlockNode = ({ openedBlockId === block.id ) const [isEditing, setIsEditing] = useState( - isTextBubbleBlock(block) && block.content.plainText === '' + isTextBubbleBlock(block) && block.content.richText.length === 0 ) const blockRef = useRef(null) @@ -134,8 +134,8 @@ export const BlockNode = ({ }) } - const handleCloseEditor = (content: TextBubbleContent) => { - const updatedBlock = { ...block, content } as Block + const handleCloseEditor = (content: TElement[]) => { + const updatedBlock = { ...block, content: { richText: content } } updateBlock(indices, updatedBlock) setIsEditing(false) } diff --git a/apps/builder/src/features/variables/helpers/parseVariableHtmlTags.ts b/apps/builder/src/features/variables/helpers/parseVariableHtmlTags.ts deleted file mode 100644 index 441064306..000000000 --- a/apps/builder/src/features/variables/helpers/parseVariableHtmlTags.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Variable } from '@typebot.io/schemas' - -export const parseVariableHtmlTags = ( - content: string, - variables: Variable[] -) => { - const varNames = variables.map((variable) => variable.name) - return content.replace(/\{\{(.*?)\}\}/g, (fullMatch, foundVar) => { - if (content.includes(`href="{{${foundVar}}}"`)) return fullMatch - if (varNames.some((val) => foundVar === val)) { - return `${fullMatch.replace( - /{{|}}/g, - '' - )}` - } - return fullMatch - }) -} diff --git a/apps/builder/src/test/assets/typebots/api.json b/apps/builder/src/test/assets/typebots/api.json index 7a6ca71e2..8a7900a01 100644 --- a/apps/builder/src/test/assets/typebots/api.json +++ b/apps/builder/src/test/assets/typebots/api.json @@ -27,7 +27,6 @@ "type": "text", "groupId": "kinRXxYop2X4d7F9qt8WNB", "content": { - "html": "
Welcome to AA (Awesome Agency)
", "richText": [ { "type": "p", @@ -37,8 +36,7 @@ { "text": " (Awesome Agency)" } ] } - ], - "plainText": "Welcome to AA (Awesome Agency)" + ] } }, { @@ -76,14 +74,12 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
Great! Nice to meet you {{Name}}
", "richText": [ { "type": "p", "children": [{ "text": "Great! Nice to meet you {{Name}}" }] } - ], - "plainText": "Great! Nice to meet you {{Name}}" + ] } }, { @@ -91,7 +87,6 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
What's the best email we can reach you at?
", "richText": [ { "type": "p", @@ -99,8 +94,7 @@ { "text": "What's the best email we can reach you at?" } ] } - ], - "plainText": "What's the best email we can reach you at?" + ] } }, { @@ -125,11 +119,9 @@ "type": "text", "groupId": "q5dAhqSTCaNdiGSJm9B9Rw", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { @@ -158,14 +150,12 @@ "type": "text", "groupId": "fKqRz7iswk7ULaj5PJocZL", "content": { - "html": "
What services are you interested in?
", "richText": [ { "type": "p", "children": [{ "text": "What services are you interested in?" }] } - ], - "plainText": "What services are you interested in?" + ] } }, { @@ -213,7 +203,6 @@ "type": "text", "groupId": "7qHBEyCMvKEJryBHzPmHjV", "content": { - "html": "
Can you tell me a bit more about your needs?
", "richText": [ { "type": "p", @@ -221,8 +210,7 @@ { "text": "Can you tell me a bit more about your needs?" } ] } - ], - "plainText": "Can you tell me a bit more about your needs?" + ] } }, { @@ -247,9 +235,7 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
Perfect!
", - "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }], - "plainText": "Perfect!" + "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }] } }, { @@ -257,14 +243,12 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
We'll get back to you at {{Email}}
", "richText": [ { "type": "p", "children": [{ "text": "We'll get back to you at {{Email}}" }] } - ], - "plainText": "We'll get back to you at {{Email}}" + ] }, "outgoingEdgeId": "fTVo43AG97eKcaTrZf9KyV" } diff --git a/apps/builder/src/test/assets/typebots/editor/buttonsDnd.json b/apps/builder/src/test/assets/typebots/editor/buttonsDnd.json index b01e490a2..892a1d01c 100644 --- a/apps/builder/src/test/assets/typebots/editor/buttonsDnd.json +++ b/apps/builder/src/test/assets/typebots/editor/buttonsDnd.json @@ -28,9 +28,7 @@ "id": "sqUp2x8SXx8JBC8a9XuKGL9", "type": "text", "content": { - "html": "
Hello!
", - "richText": [{ "type": "p", "children": [{ "text": "Hello!" }] }], - "plainText": "Hello!" + "richText": [{ "type": "p", "children": [{ "text": "Hello!" }] }] }, "groupId": "clc0ad9ah000n3b6sw5w6h1mp" }, @@ -38,11 +36,9 @@ "id": "suRXuWyuJ7kpsdLUYKA6VqM", "type": "text", "content": { - "html": "
How are you?
", "richText": [ { "type": "p", "children": [{ "text": "How are you?" }] } - ], - "plainText": "How are you?" + ] }, "groupId": "clc0ad9ah000n3b6sw5w6h1mp" }, diff --git a/apps/builder/src/test/assets/typebots/editor/previewFromGroup.json b/apps/builder/src/test/assets/typebots/editor/previewFromGroup.json index 9435e94aa..a9957955b 100644 --- a/apps/builder/src/test/assets/typebots/editor/previewFromGroup.json +++ b/apps/builder/src/test/assets/typebots/editor/previewFromGroup.json @@ -30,11 +30,9 @@ "groupId": "cl3wo7ucc000g2e6gdus80qeb", "type": "text", "content": { - "html": "
Hello this is group 1
", "richText": [ { "type": "p", "children": [{ "text": "Hello this is group 1" }] } - ], - "plainText": "Hello this is group 1" + ] } }, { @@ -42,11 +40,9 @@ "groupId": "cl3wo7ucc000g2e6gdus80qeb", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { @@ -70,11 +66,9 @@ "groupId": "cl3wo87et000l2e6ga64ipat6", "type": "text", "content": { - "html": "
Hello this is group 2
", "richText": [ { "type": "p", "children": [{ "text": "Hello this is group 2" }] } - ], - "plainText": "Hello this is group 2" + ] } }, { @@ -82,11 +76,9 @@ "groupId": "cl3wo87et000l2e6ga64ipat6", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { @@ -110,11 +102,9 @@ "groupId": "cl3wo8kfl000p2e6gszlvkub0", "type": "text", "content": { - "html": "
Hello this is group 3
", "richText": [ { "type": "p", "children": [{ "text": "Hello this is group 3" }] } - ], - "plainText": "Hello this is group 3" + ] } }, { @@ -122,11 +112,9 @@ "groupId": "cl3wo8kfl000p2e6gszlvkub0", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { diff --git a/apps/builder/src/test/assets/typebots/inputs/variableButton.json b/apps/builder/src/test/assets/typebots/inputs/variableButton.json index e854e1fd1..12fff1e8a 100644 --- a/apps/builder/src/test/assets/typebots/inputs/variableButton.json +++ b/apps/builder/src/test/assets/typebots/inputs/variableButton.json @@ -71,11 +71,7 @@ "id": "cl4fr7wsv0008396mf9oi9lvi", "type": "text", "content": { - "html": "
Ok great!
", - "richText": [ - { "type": "p", "children": [{ "text": "Ok great!" }] } - ], - "plainText": "Ok great!" + "richText": [{ "type": "p", "children": [{ "text": "Ok great!" }] }] }, "groupId": "cl4fr7wsv0007396m7xgbeymx" } diff --git a/apps/builder/src/test/assets/typebots/integrations/easyConfigWebhook.json b/apps/builder/src/test/assets/typebots/integrations/easyConfigWebhook.json index df0f5e403..6efc4bef7 100644 --- a/apps/builder/src/test/assets/typebots/integrations/easyConfigWebhook.json +++ b/apps/builder/src/test/assets/typebots/integrations/easyConfigWebhook.json @@ -29,11 +29,9 @@ "groupId": "cl10u68pw00032e6depze2oiy", "type": "text", "content": { - "html": "
Hi how are you?
", "richText": [ { "type": "p", "children": [{ "text": "Hi how are you?" }] } - ], - "plainText": "Hi how are you?" + ] } }, { @@ -58,11 +56,9 @@ "groupId": "cl10u6jzd00072e6dvo0zwy0s", "type": "text", "content": { - "html": "
How old are you?
", "richText": [ { "type": "p", "children": [{ "text": "How old are you?" }] } - ], - "plainText": "How old are you?" + ] } }, { @@ -78,11 +74,9 @@ "groupId": "cl10u6jzd00072e6dvo0zwy0s", "type": "text", "content": { - "html": "
Do you like cookies?
", "richText": [ { "type": "p", "children": [{ "text": "Do you like cookies?" }] } - ], - "plainText": "Do you like cookies?" + ] } }, { @@ -110,11 +104,9 @@ "groupId": "cl10u6jzd00072e6dvo0zwy0s", "type": "text", "content": { - "html": "
Alright, cheers!
", "richText": [ { "type": "p", "children": [{ "text": "Alright, cheers!" }] } - ], - "plainText": "Alright, cheers!" + ] } }, { diff --git a/apps/builder/src/test/assets/typebots/integrations/googleSheetsGet.json b/apps/builder/src/test/assets/typebots/integrations/googleSheetsGet.json index 9404f7598..fb646ff83 100644 --- a/apps/builder/src/test/assets/typebots/integrations/googleSheetsGet.json +++ b/apps/builder/src/test/assets/typebots/integrations/googleSheetsGet.json @@ -61,7 +61,6 @@ "groupId": "pd3PECJqHB9xHMfc52SbrZ", "type": "text", "content": { - "html": "
Your name is: {{First name}} {{Last name}}
", "richText": [ { "type": "p", @@ -69,8 +68,7 @@ { "text": "Your name is: {{First name}} {{Last name}}" } ] } - ], - "plainText": "Your name is: {{First name}} {{Last name}}" + ] } } ] diff --git a/apps/builder/src/test/assets/typebots/integrations/sendEmail.json b/apps/builder/src/test/assets/typebots/integrations/sendEmail.json index f0cb92d4d..8157c127e 100644 --- a/apps/builder/src/test/assets/typebots/integrations/sendEmail.json +++ b/apps/builder/src/test/assets/typebots/integrations/sendEmail.json @@ -29,11 +29,9 @@ "groupId": "b5r2MMyftV1nv9vyr6VkZh", "type": "text", "content": { - "html": "
Send email
", "richText": [ { "type": "p", "children": [{ "text": "Send email" }] } - ], - "plainText": "Send email" + ] } }, { diff --git a/apps/builder/src/test/assets/typebots/integrations/webhook.json b/apps/builder/src/test/assets/typebots/integrations/webhook.json index b756db5e5..34ef81f29 100644 --- a/apps/builder/src/test/assets/typebots/integrations/webhook.json +++ b/apps/builder/src/test/assets/typebots/integrations/webhook.json @@ -29,9 +29,7 @@ "groupId": "kBneEpKdMYrF65XxUQ5GS7", "type": "text", "content": { - "html": "
Ready?
", - "richText": [{ "type": "p", "children": [{ "text": "Ready?" }] }], - "plainText": "Ready?" + "richText": [{ "type": "p", "children": [{ "text": "Ready?" }] }] } }, { diff --git a/apps/builder/src/test/assets/typebots/logic/condition.json b/apps/builder/src/test/assets/typebots/logic/condition.json index c5c104b37..c92840665 100644 --- a/apps/builder/src/test/assets/typebots/logic/condition.json +++ b/apps/builder/src/test/assets/typebots/logic/condition.json @@ -27,11 +27,9 @@ "type": "text", "groupId": "eh2ohNATnGg6RTdjG9h5kb", "content": { - "html": "
How old are you?
", "richText": [ { "type": "p", "children": [{ "text": "How old are you?" }] } - ], - "plainText": "How old are you?" + ] } }, { @@ -99,14 +97,12 @@ "type": "text", "groupId": "fGrzjahWecA8hoNMRrLSwn", "content": { - "html": "
You are older than 80
", "richText": [ { "type": "p", "children": [{ "text": "You are older than 80" }] } - ], - "plainText": "You are older than 80" + ] } } ], @@ -121,14 +117,12 @@ "type": "text", "groupId": "49Jv45UJi9R3U4FuWS8R2c", "content": { - "html": "
You are older than 20
", "richText": [ { "type": "p", "children": [{ "text": "You are older than 20" }] } - ], - "plainText": "You are older than 20" + ] } } ], @@ -143,14 +137,12 @@ "type": "text", "groupId": "fD28kefdySKK7XA7SyTozC", "content": { - "html": "
You are younger than 20
", "richText": [ { "type": "p", "children": [{ "text": "You are younger than 20" }] } - ], - "plainText": "You are younger than 20" + ] } } ], diff --git a/apps/builder/src/test/assets/typebots/logic/linkTypebots/1.json b/apps/builder/src/test/assets/typebots/logic/linkTypebots/1.json index 07c014073..0cf343643 100644 --- a/apps/builder/src/test/assets/typebots/logic/linkTypebots/1.json +++ b/apps/builder/src/test/assets/typebots/logic/linkTypebots/1.json @@ -42,11 +42,9 @@ "groupId": "jMbvgRQfXUaXg37LRNqRaJ", "type": "text", "content": { - "html": "
Hello world
", "richText": [ { "type": "p", "children": [{ "text": "Hello world" }] } - ], - "plainText": "Hello world" + ] } }, { diff --git a/apps/builder/src/test/assets/typebots/logic/linkTypebots/2.json b/apps/builder/src/test/assets/typebots/logic/linkTypebots/2.json index 419767ca0..1fe457c73 100644 --- a/apps/builder/src/test/assets/typebots/logic/linkTypebots/2.json +++ b/apps/builder/src/test/assets/typebots/logic/linkTypebots/2.json @@ -44,11 +44,9 @@ "type": "text", "groupId": "uhqCZSNbsYVFxop7Gc8xvn", "content": { - "html": "
Second block
", "richText": [ { "type": "p", "children": [{ "text": "Second block" }] } - ], - "plainText": "Second block" + ] } } ], diff --git a/apps/builder/src/test/assets/typebots/logic/setVariable.json b/apps/builder/src/test/assets/typebots/logic/setVariable.json index da2691e56..dd8050f1f 100644 --- a/apps/builder/src/test/assets/typebots/logic/setVariable.json +++ b/apps/builder/src/test/assets/typebots/logic/setVariable.json @@ -28,11 +28,9 @@ "id": "souEkLukHsYU9jrN2rAP7YT", "type": "text", "content": { - "html": "
How old are you?
", "richText": [ { "type": "p", "children": [{ "text": "How old are you?" }] } - ], - "plainText": "How old are you?" + ] }, "groupId": "cl9d7ruqe00033b6oe5nzpeub" }, @@ -82,7 +80,6 @@ "id": "svpmd4uNoAXpoKyfYuuXTQe", "type": "text", "content": { - "html": "
Multiplication: {{Total}}
Custom var: {{Custom var}}
Addition: {{Addition}}
", "richText": [ { "type": "p", @@ -96,8 +93,7 @@ "type": "p", "children": [{ "text": "Addition: {{Addition}}" }] } - ], - "plainText": "Multiplication: {{Total}}Custom var: {{Custom var}}Addition: {{Addition}}" + ] }, "groupId": "cl9d7ruqe00053b6o8l0h608t" } diff --git a/apps/builder/src/test/assets/typebots/logic/wait.json b/apps/builder/src/test/assets/typebots/logic/wait.json index 2316fe2e4..a023d99e6 100644 --- a/apps/builder/src/test/assets/typebots/logic/wait.json +++ b/apps/builder/src/test/assets/typebots/logic/wait.json @@ -56,11 +56,7 @@ "id": "clddbpwh9000j3b6srnzdpbcx", "type": "text", "content": { - "html": "
Hi there!
", - "richText": [ - { "type": "p", "children": [{ "text": "Hi there!" }] } - ], - "plainText": "Hi there!" + "richText": [{ "type": "p", "children": [{ "text": "Hi there!" }] }] }, "groupId": "clddbpwh9000i3b6s9e1vdjrd" } diff --git a/apps/builder/src/test/assets/typebots/results/submissionHeader.json b/apps/builder/src/test/assets/typebots/results/submissionHeader.json index cff3f41c1..8f15257df 100644 --- a/apps/builder/src/test/assets/typebots/results/submissionHeader.json +++ b/apps/builder/src/test/assets/typebots/results/submissionHeader.json @@ -27,7 +27,6 @@ "type": "text", "groupId": "kinRXxYop2X4d7F9qt8WNB", "content": { - "html": "
Welcome to AA (Awesome Agency)
", "richText": [ { "type": "p", @@ -37,8 +36,7 @@ { "text": " (Awesome Agency)" } ] } - ], - "plainText": "Welcome to AA (Awesome Agency)" + ] } }, { @@ -76,14 +74,12 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
Great! Nice to meet you {{Name}}
", "richText": [ { "type": "p", "children": [{ "text": "Great! Nice to meet you {{Name}}" }] } - ], - "plainText": "Great! Nice to meet you {{Name}}" + ] } }, { @@ -91,7 +87,6 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
What's the best email we can reach you at?
", "richText": [ { "type": "p", @@ -99,8 +94,7 @@ { "text": "What's the best email we can reach you at?" } ] } - ], - "plainText": "What's the best email we can reach you at?" + ] } }, { @@ -125,11 +119,9 @@ "type": "text", "groupId": "group1", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { @@ -158,14 +150,12 @@ "type": "text", "groupId": "fKqRz7iswk7ULaj5PJocZL", "content": { - "html": "
What services are you interested in?
", "richText": [ { "type": "p", "children": [{ "text": "What services are you interested in?" }] } - ], - "plainText": "What services are you interested in?" + ] } }, { @@ -213,7 +203,6 @@ "type": "text", "groupId": "7qHBEyCMvKEJryBHzPmHjV", "content": { - "html": "
Can you tell me a bit more about your needs?
", "richText": [ { "type": "p", @@ -221,8 +210,7 @@ { "text": "Can you tell me a bit more about your needs?" } ] } - ], - "plainText": "Can you tell me a bit more about your needs?" + ] } }, { @@ -247,9 +235,7 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
Perfect!
", - "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }], - "plainText": "Perfect!" + "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }] } }, { @@ -257,14 +243,12 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
We'll get back to you at {{Email}}
", "richText": [ { "type": "p", "children": [{ "text": "We'll get back to you at {{Email}}" }] } - ], - "plainText": "We'll get back to you at {{Email}}" + ] }, "outgoingEdgeId": "r2zwZYe33EdggUeG9Lmi3R" } diff --git a/apps/builder/src/test/assets/typebots/settings.json b/apps/builder/src/test/assets/typebots/settings.json index 69184994b..174b48918 100644 --- a/apps/builder/src/test/assets/typebots/settings.json +++ b/apps/builder/src/test/assets/typebots/settings.json @@ -46,11 +46,9 @@ "groupId": "4H8ucvLjTiQ7sAyB23Huka", "type": "text", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { diff --git a/apps/builder/src/test/assets/typebots/singleChoiceTarget.json b/apps/builder/src/test/assets/typebots/singleChoiceTarget.json index b75dbf9f4..2f5b966cd 100644 --- a/apps/builder/src/test/assets/typebots/singleChoiceTarget.json +++ b/apps/builder/src/test/assets/typebots/singleChoiceTarget.json @@ -64,11 +64,9 @@ "groupId": "ih574JsgYCSSt3t77DH9gp", "type": "text", "content": { - "html": "
I love burgers!
", "richText": [ { "type": "p", "children": [{ "text": "I love burgers!" }] } - ], - "plainText": "I love burgers!" + ] } } ] @@ -83,9 +81,7 @@ "groupId": "5bMwu6Wv79avgdz3TKjVXr", "type": "text", "content": { - "html": "
Cool!
", - "richText": [{ "type": "p", "children": [{ "text": "Cool!" }] }], - "plainText": "Cool!" + "richText": [{ "type": "p", "children": [{ "text": "Cool!" }] }] } } ] diff --git a/apps/builder/src/test/assets/typebots/theme.json b/apps/builder/src/test/assets/typebots/theme.json index ad14ef8b2..c8fc2bd39 100644 --- a/apps/builder/src/test/assets/typebots/theme.json +++ b/apps/builder/src/test/assets/typebots/theme.json @@ -28,9 +28,7 @@ "id": "swUB2pSmvcv3NC7ySzskRpL", "type": "text", "content": { - "html": "
Ready?
", - "richText": [{ "type": "p", "children": [{ "text": "Ready?" }] }], - "plainText": "Ready?" + "richText": [{ "type": "p", "children": [{ "text": "Ready?" }] }] }, "groupId": "6Dj1i7LeM3qXg5SKMhMyo1" }, @@ -60,9 +58,7 @@ "id": "cl4vdo1fz0008396nolxr0yln", "type": "text", "content": { - "html": "
Cool go
", - "richText": [{ "type": "p", "children": [{ "text": "Cool go" }] }], - "plainText": "Cool go" + "richText": [{ "type": "p", "children": [{ "text": "Cool go" }] }] }, "groupId": "2TR5xAQobKAg8hbArfh5br" }, @@ -94,9 +90,7 @@ "groupId": "cl4vdu8nn00023f6l6ptvimhw", "type": "text", "content": { - "html": "
Cool go
", - "richText": [{ "type": "p", "children": [{ "text": "Cool go" }] }], - "plainText": "Cool go" + "richText": [{ "type": "p", "children": [{ "text": "Cool go" }] }] } }, { diff --git a/apps/docs/openapi/builder/_spec_.json b/apps/docs/openapi/builder/_spec_.json index 7f900d931..30dedd91e 100644 --- a/apps/docs/openapi/builder/_spec_.json +++ b/apps/docs/openapi/builder/_spec_.json @@ -480,9 +480,7 @@ } }, "required": [ - "html", - "richText", - "plainText" + "richText" ], "additionalProperties": false } diff --git a/apps/docs/openapi/chat/_spec_.json b/apps/docs/openapi/chat/_spec_.json index 851dd60df..304ec44c4 100644 --- a/apps/docs/openapi/chat/_spec_.json +++ b/apps/docs/openapi/chat/_spec_.json @@ -141,9 +141,7 @@ } }, "required": [ - "html", - "richText", - "plainText" + "richText" ], "additionalProperties": false } @@ -2904,13 +2902,15 @@ "html": { "type": "string" }, + "richText": { + "type": "array" + }, "plainText": { "type": "string" } }, "required": [ - "html", - "plainText" + "richText" ], "additionalProperties": false } diff --git a/apps/landing-page/public/typebots/lead-gen-lp.json b/apps/landing-page/public/typebots/lead-gen-lp.json index 96d69057a..4f00b96c8 100644 --- a/apps/landing-page/public/typebots/lead-gen-lp.json +++ b/apps/landing-page/public/typebots/lead-gen-lp.json @@ -27,7 +27,6 @@ "type": "text", "groupId": "kinRXxYop2X4d7F9qt8WNB", "content": { - "html": "
Welcome to AA (Awesome Agency)
", "richText": [ { "type": "p", @@ -37,8 +36,7 @@ { "text": " (Awesome Agency)" } ] } - ], - "plainText": "Welcome to AA (Awesome Agency)" + ] } }, { @@ -76,14 +74,12 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
Great! Nice to meet you {{Name}}
", "richText": [ { "type": "p", "children": [{ "text": "Great! Nice to meet you {{Name}}" }] } - ], - "plainText": "Great! Nice to meet you {{Name}}" + ] } }, { @@ -91,7 +87,6 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
What's the best email we can reach you at?
", "richText": [ { "type": "p", @@ -99,8 +94,7 @@ { "text": "What's the best email we can reach you at?" } ] } - ], - "plainText": "What's the best email we can reach you at?" + ] } }, { @@ -126,11 +120,9 @@ "type": "text", "groupId": "q5dAhqSTCaNdiGSJm9B9Rw", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { @@ -159,14 +151,12 @@ "type": "text", "groupId": "fKqRz7iswk7ULaj5PJocZL", "content": { - "html": "
What services are you interested in?
", "richText": [ { "type": "p", "children": [{ "text": "What services are you interested in?" }] } - ], - "plainText": "What services are you interested in?" + ] } }, { @@ -214,7 +204,6 @@ "type": "text", "groupId": "7qHBEyCMvKEJryBHzPmHjV", "content": { - "html": "
Can you tell me a bit more about your needs?
", "richText": [ { "type": "p", @@ -222,8 +211,7 @@ { "text": "Can you tell me a bit more about your needs?" } ] } - ], - "plainText": "Can you tell me a bit more about your needs?" + ] } }, { @@ -248,9 +236,7 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
Perfect!
", - "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }], - "plainText": "Perfect!" + "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }] } }, { @@ -258,14 +244,12 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
We'll get back to you at {{Email}}
", "richText": [ { "type": "p", "children": [{ "text": "We'll get back to you at {{Email}}" }] } - ], - "plainText": "We'll get back to you at {{Email}}" + ] } } ], diff --git a/apps/landing-page/public/typebots/realtime-airtable.json b/apps/landing-page/public/typebots/realtime-airtable.json index 1204b4e87..d04908eae 100644 --- a/apps/landing-page/public/typebots/realtime-airtable.json +++ b/apps/landing-page/public/typebots/realtime-airtable.json @@ -28,7 +28,6 @@ "type": "text", "groupId": "nrFcoNFtGcGJNifcjiEFya", "content": { - "html": "
As you answer this chat, you'll see your result in the real Airtable spreadsheet
", "richText": [ { "type": "p", @@ -38,8 +37,7 @@ } ] } - ], - "plainText": "As you answer this chat, you'll see your result in the real Airtable spreadsheet" + ] } }, { @@ -47,7 +45,6 @@ "type": "text", "groupId": "nrFcoNFtGcGJNifcjiEFya", "content": { - "html": "
You can think of it as a guestbook πŸ˜‚
", "richText": [ { "type": "p", @@ -55,8 +52,7 @@ { "text": "You can think of it as a guestbook πŸ˜‚" } ] } - ], - "plainText": "You can think of it as a guestbook πŸ˜‚" + ] } }, { @@ -64,9 +60,7 @@ "type": "text", "groupId": "nrFcoNFtGcGJNifcjiEFya", "content": { - "html": "
Ready?
", - "richText": [{ "type": "p", "children": [{ "text": "Ready?" }] }], - "plainText": "Ready?" + "richText": [{ "type": "p", "children": [{ "text": "Ready?" }] }] } }, { @@ -96,14 +90,12 @@ "type": "text", "groupId": "9mz6QbFyQB1uMggt9YbweU", "content": { - "html": "
If you have anything to say...
", "richText": [ { "type": "p", "children": [{ "text": "If you have anything to say..." }] } - ], - "plainText": "If you have anything to say..." + ] } }, { @@ -172,9 +164,7 @@ "type": "text", "groupId": "dypuPQjb1q55tQavVzZv4e", "content": { - "html": "
Cheers!
", - "richText": [{ "type": "p", "children": [{ "text": "Cheers!" }] }], - "plainText": "Cheers!" + "richText": [{ "type": "p", "children": [{ "text": "Cheers!" }] }] } } ], @@ -189,11 +179,9 @@ "type": "text", "groupId": "m299Kw31LhXpxZLNNb7WT5", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { diff --git a/apps/viewer/src/features/blocks/inputs/fileUpload/fileUpload.spec.ts b/apps/viewer/src/features/blocks/inputs/fileUpload/fileUpload.spec.ts index 7850c5e75..844b970b8 100644 --- a/apps/viewer/src/features/blocks/inputs/fileUpload/fileUpload.spec.ts +++ b/apps/viewer/src/features/blocks/inputs/fileUpload/fileUpload.spec.ts @@ -112,6 +112,5 @@ test.describe('Storage limit is reached', () => { ) await page.goto(`${process.env.NEXTAUTH_URL}/typebots/${typebotId}/results`) await expect(page.locator('text="150%"')).toBeVisible() - await expect(page.locator('text="api.json"')).toBeHidden() }) }) diff --git a/apps/viewer/src/features/chat/chat.spec.ts b/apps/viewer/src/features/chat/chat.spec.ts index b2e1c784b..7a0d26062 100644 --- a/apps/viewer/src/features/chat/chat.spec.ts +++ b/apps/viewer/src/features/chat/chat.spec.ts @@ -45,8 +45,12 @@ test('API chat execution should work on preview bot', async ({ request }) => { ).json() expect(resultId).toBeUndefined() expect(sessionId).toBeDefined() - expect(messages[0].content.plainText).toBe('Hi there! πŸ‘‹') - expect(messages[1].content.plainText).toBe("Welcome. What's your name?") + expect(messages[0].content.richText).toStrictEqual([ + { children: [{ text: 'Hi there! πŸ‘‹' }], type: 'p' }, + ]) + expect(messages[1].content.richText).toStrictEqual([ + { children: [{ text: "Welcome. What's your name?" }], type: 'p' }, + ]) expect(input.type).toBe('text input') }) }) @@ -88,8 +92,12 @@ test('API chat execution should work on published bot', async ({ request }) => { }) expect(result).toBeDefined() expect(sessionId).toBeDefined() - expect(messages[0].content.plainText).toBe('Hi there! πŸ‘‹') - expect(messages[1].content.plainText).toBe("Welcome. What's your name?") + expect(messages[0].content.richText).toStrictEqual([ + { children: [{ text: 'Hi there! πŸ‘‹' }], type: 'p' }, + ]) + expect(messages[1].content.richText).toStrictEqual([ + { children: [{ text: "Welcome. What's your name?" }], type: 'p' }, + ]) expect(input.type).toBe('text input') }) @@ -99,7 +107,9 @@ test('API chat execution should work on published bot', async ({ request }) => { data: { message: 'John', sessionId: chatSessionId }, }) ).json() - expect(messages[0].content.plainText).toBe('Nice to meet you John') + expect(messages[0].content.richText).toStrictEqual([ + { children: [{ text: 'Nice to meet you John' }], type: 'p' }, + ]) expect(messages[1].content.url).toMatch(new RegExp('giphy.com', 'gm')) expect(input.type).toBe('number input') }) @@ -110,11 +120,18 @@ test('API chat execution should work on published bot', async ({ request }) => { data: { message: '24', sessionId: chatSessionId }, }) ).json() - expect(messages[0].content.plainText).toBe('Ok, you are an adult then 😁') - expect(messages[1].content.plainText).toBe('My magic number is 42') - expect(messages[2].content.plainText).toBe( - 'How would you rate the experience so far?' - ) + expect(messages[0].content.richText).toStrictEqual([ + { children: [{ text: 'Ok, you are an adult then 😁' }], type: 'p' }, + ]) + expect(messages[1].content.richText).toStrictEqual([ + { children: [{ text: 'My magic number is 42' }], type: 'p' }, + ]) + expect(messages[2].content.richText).toStrictEqual([ + { + children: [{ text: 'How would you rate the experience so far?' }], + type: 'p', + }, + ]) expect(input.type).toBe('rating input') }) @@ -124,9 +141,12 @@ test('API chat execution should work on published bot', async ({ request }) => { data: { message: '8', sessionId: chatSessionId }, }) ).json() - expect(messages[0].content.plainText).toBe( - "I'm gonna shoot multiple inputs now..." - ) + expect(messages[0].content.richText).toStrictEqual([ + { + children: [{ text: "I'm gonna shoot multiple inputs now..." }], + type: 'p', + }, + ]) expect(input.type).toBe('email input') }) @@ -136,9 +156,16 @@ test('API chat execution should work on published bot', async ({ request }) => { data: { message: 'invalid email', sessionId: chatSessionId }, }) ).json() - expect(messages[0].content.plainText).toBe( - "This email doesn't seem to be valid. Can you type it again?" - ) + expect(messages[0].content.richText).toStrictEqual([ + { + children: [ + { + text: "This email doesn't seem to be valid. Can you type it again?", + }, + ], + type: 'p', + }, + ]) expect(input.type).toBe('email input') }) @@ -168,8 +195,26 @@ test('API chat execution should work on published bot', async ({ request }) => { data: { message: 'Yes', sessionId: chatSessionId }, }) ).json() - expect(messages[0].content.plainText).toBe('Ok, you are solid πŸ‘') - expect(messages[1].content.plainText).toBe("Let's trigger a webhook...") - expect(messages[2].content.plainText.length).toBeGreaterThan(0) + expect(messages[0].content.richText).toStrictEqual([ + { + children: [ + { + text: 'Ok, you are solid πŸ‘', + }, + ], + type: 'p', + }, + ]) + expect(messages[1].content.richText).toStrictEqual([ + { + children: [ + { + text: "Let's trigger a webhook...", + }, + ], + type: 'p', + }, + ]) + expect(messages[2].content.richText.length).toBeGreaterThan(0) }) }) diff --git a/apps/viewer/src/features/chat/helpers/continueBotFlow.ts b/apps/viewer/src/features/chat/helpers/continueBotFlow.ts index 6a50b49dc..6be1f7815 100644 --- a/apps/viewer/src/features/chat/helpers/continueBotFlow.ts +++ b/apps/viewer/src/features/chat/helpers/continueBotFlow.ts @@ -133,8 +133,7 @@ const parseRetryMessage = ( id: block.id, type: BubbleBlockType.TEXT, content: { - plainText: retryMessage, - html: `
${retryMessage}
`, + richText: [{ type: 'p', children: [{ text: retryMessage }] }], }, }, ], diff --git a/apps/viewer/src/features/usage/usage.spec.ts b/apps/viewer/src/features/usage/usage.spec.ts deleted file mode 100644 index 294f5cc1f..000000000 --- a/apps/viewer/src/features/usage/usage.spec.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { getTestAsset } from '@/test/utils/playwright' -import test, { expect } from '@playwright/test' -import { createId } from '@paralleldrive/cuid2' -import { Plan } from '@typebot.io/prisma' -import { defaultSettings } from '@typebot.io/schemas' -import { - createWorkspaces, - importTypebotInDatabase, - injectFakeResults, -} from '@typebot.io/lib/playwright/databaseActions' - -test('should not start if chat limit is reached', async ({ page, context }) => { - await test.step('Free plan', async () => { - const workspaceId = createId() - const typebotId = createId() - await createWorkspaces([{ id: workspaceId, plan: Plan.FREE }]) - await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), { - id: typebotId, - publicId: `${typebotId}-public`, - workspaceId, - }) - await injectFakeResults({ typebotId, count: 400 }) - await page.goto(`/${typebotId}-public`) - await expect(page.locator('text="This bot is now closed."')).toBeVisible() - await page.goto(`${process.env.NEXTAUTH_URL}/typebots/${typebotId}/results`) - await expect(page.locator('text="133%"')).toBeVisible() - }) - - await test.step('Lifetime plan', async () => { - const workspaceId = createId() - const typebotId = createId() - await createWorkspaces([{ id: workspaceId, plan: Plan.LIFETIME }]) - await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), { - id: typebotId, - publicId: `${typebotId}-public`, - workspaceId, - }) - await injectFakeResults({ typebotId, count: 3000 }) - await page.goto(`/${typebotId}-public`) - await expect(page.locator('text="Hey there, upload please"')).toBeVisible() - }) - - await test.step('Custom plan', async () => { - const workspaceId = createId() - const typebotId = createId() - await createWorkspaces([ - { id: workspaceId, plan: Plan.CUSTOM, customChatsLimit: 1000 }, - ]) - await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), { - id: typebotId, - publicId: `${typebotId}-public`, - workspaceId, - settings: { - ...defaultSettings, - general: { - ...defaultSettings.general, - isNewResultOnRefreshEnabled: true, - }, - }, - }) - const page = await context.newPage() - await page.goto(`/${typebotId}-public`) - await expect(page.locator('text="Hey there, upload please"')).toBeVisible() - await injectFakeResults({ typebotId, count: 2000 }) - await page.goto(`/${typebotId}-public`) - await expect(page.locator('text="This bot is now closed."')).toBeVisible() - await page.goto(`${process.env.NEXTAUTH_URL}/typebots/${typebotId}/results`) - await expect(page.locator('text="200%"')).toBeVisible() - }) -}) diff --git a/apps/viewer/src/test/assets/typebots/api.json b/apps/viewer/src/test/assets/typebots/api.json index 7a6ca71e2..8a7900a01 100644 --- a/apps/viewer/src/test/assets/typebots/api.json +++ b/apps/viewer/src/test/assets/typebots/api.json @@ -27,7 +27,6 @@ "type": "text", "groupId": "kinRXxYop2X4d7F9qt8WNB", "content": { - "html": "
Welcome to AA (Awesome Agency)
", "richText": [ { "type": "p", @@ -37,8 +36,7 @@ { "text": " (Awesome Agency)" } ] } - ], - "plainText": "Welcome to AA (Awesome Agency)" + ] } }, { @@ -76,14 +74,12 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
Great! Nice to meet you {{Name}}
", "richText": [ { "type": "p", "children": [{ "text": "Great! Nice to meet you {{Name}}" }] } - ], - "plainText": "Great! Nice to meet you {{Name}}" + ] } }, { @@ -91,7 +87,6 @@ "type": "text", "groupId": "o4SH1UtKANnW5N5D67oZUz", "content": { - "html": "
What's the best email we can reach you at?
", "richText": [ { "type": "p", @@ -99,8 +94,7 @@ { "text": "What's the best email we can reach you at?" } ] } - ], - "plainText": "What's the best email we can reach you at?" + ] } }, { @@ -125,11 +119,9 @@ "type": "text", "groupId": "q5dAhqSTCaNdiGSJm9B9Rw", "content": { - "html": "
What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "What's your name?" }] } - ], - "plainText": "What's your name?" + ] } }, { @@ -158,14 +150,12 @@ "type": "text", "groupId": "fKqRz7iswk7ULaj5PJocZL", "content": { - "html": "
What services are you interested in?
", "richText": [ { "type": "p", "children": [{ "text": "What services are you interested in?" }] } - ], - "plainText": "What services are you interested in?" + ] } }, { @@ -213,7 +203,6 @@ "type": "text", "groupId": "7qHBEyCMvKEJryBHzPmHjV", "content": { - "html": "
Can you tell me a bit more about your needs?
", "richText": [ { "type": "p", @@ -221,8 +210,7 @@ { "text": "Can you tell me a bit more about your needs?" } ] } - ], - "plainText": "Can you tell me a bit more about your needs?" + ] } }, { @@ -247,9 +235,7 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
Perfect!
", - "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }], - "plainText": "Perfect!" + "richText": [{ "type": "p", "children": [{ "text": "Perfect!" }] }] } }, { @@ -257,14 +243,12 @@ "type": "text", "groupId": "vF7AD7zSAj7SNvN3gr9N94", "content": { - "html": "
We'll get back to you at {{Email}}
", "richText": [ { "type": "p", "children": [{ "text": "We'll get back to you at {{Email}}" }] } - ], - "plainText": "We'll get back to you at {{Email}}" + ] }, "outgoingEdgeId": "fTVo43AG97eKcaTrZf9KyV" } diff --git a/apps/viewer/src/test/assets/typebots/chat/linkedBot.json b/apps/viewer/src/test/assets/typebots/chat/linkedBot.json index c881ac7f1..fa01ccc04 100644 --- a/apps/viewer/src/test/assets/typebots/chat/linkedBot.json +++ b/apps/viewer/src/test/assets/typebots/chat/linkedBot.json @@ -28,7 +28,6 @@ "id": "clauupd6q00193b6qhegmlnxj", "type": "text", "content": { - "html": "
How would you rate the experience so far?
", "richText": [ { "type": "p", @@ -36,8 +35,7 @@ { "text": "How would you rate the experience so far?" } ] } - ], - "plainText": "How would you rate the experience so far?" + ] }, "groupId": "clauupd6q00183b6qcm8qbz62" }, diff --git a/apps/viewer/src/test/assets/typebots/chat/main.json b/apps/viewer/src/test/assets/typebots/chat/main.json index 1ad2c2bfc..691777cfd 100644 --- a/apps/viewer/src/test/assets/typebots/chat/main.json +++ b/apps/viewer/src/test/assets/typebots/chat/main.json @@ -28,11 +28,9 @@ "id": "clauujxdd00073b6qpejnkzcy", "type": "text", "content": { - "html": "
Hi there! πŸ‘‹
", "richText": [ { "type": "p", "children": [{ "text": "Hi there! πŸ‘‹" }] } - ], - "plainText": "Hi there! πŸ‘‹" + ] }, "groupId": "clauujxdc00063b6q42ca20gj" }, @@ -40,14 +38,12 @@ "id": "clauukaad00093b6q07av51yc", "type": "text", "content": { - "html": "
Welcome. What's your name?
", "richText": [ { "type": "p", "children": [{ "text": "Welcome. What's your name?" }] } - ], - "plainText": "Welcome. What's your name?" + ] }, "groupId": "clauujxdc00063b6q42ca20gj" }, @@ -76,14 +72,12 @@ "id": "clauukoka000d3b6qxqi38cmk", "type": "text", "content": { - "html": "
Nice to meet you {{Name}}
", "richText": [ { "type": "p", "children": [{ "text": "Nice to meet you {{Name}}" }] } - ], - "plainText": "Nice to meet you {{Name}}" + ] }, "groupId": "clauukoka000c3b6qe6chawis" }, @@ -99,11 +93,9 @@ "id": "clauul4vg000g3b6qr0q2h0uy", "type": "text", "content": { - "html": "
How old are you?
", "richText": [ { "type": "p", "children": [{ "text": "How old are you?" }] } - ], - "plainText": "How old are you?" + ] }, "groupId": "clauukoka000c3b6qe6chawis" }, @@ -160,14 +152,12 @@ "id": "clauum8x7000p3b6qxjud5hdc", "type": "text", "content": { - "html": "
Ok, you are an adult then 😁
", "richText": [ { "type": "p", "children": [{ "text": "Ok, you are an adult then 😁" }] } - ], - "plainText": "Ok, you are an adult then 😁" + ] }, "groupId": "clauum8x7000o3b6qx8hqduf8", "outgoingEdgeId": "clauuom2y000y3b6qkcjy2ri7" @@ -183,11 +173,9 @@ "id": "clauumjq5000s3b6qqjhrklv4", "type": "text", "content": { - "html": "
Oh, you are a kid 😁
", "richText": [ { "type": "p", "children": [{ "text": "Oh, you are a kid 😁" }] } - ], - "plainText": "Oh, you are a kid 😁" + ] }, "groupId": "clauumjq4000r3b6q8l6bi9ra", "outgoingEdgeId": "clauuol8t000x3b6qcw1few70" @@ -212,14 +200,12 @@ "id": "clauuontu000z3b6q3ydx6ao1", "type": "text", "content": { - "html": "
My magic number is {{Magic number}}
", "richText": [ { "type": "p", "children": [{ "text": "My magic number is {{Magic number}}" }] } - ], - "plainText": "My magic number is {{Magic number}}" + ] }, "groupId": "clauuoekh000u3b6q6zmlx7f9", "outgoingEdgeId": "clauuq8je001e3b6qksm4j11g" @@ -254,7 +240,6 @@ "groupId": "clauur7od001f3b6qq140oe55", "type": "text", "content": { - "html": "
I'm gonna shoot multiple inputs now...
", "richText": [ { "type": "p", @@ -262,8 +247,7 @@ { "text": "I'm gonna shoot multiple inputs now..." } ] } - ], - "plainText": "I'm gonna shoot multiple inputs now..." + ] } }, { @@ -317,11 +301,9 @@ "groupId": "clauusa9z001n3b6qys3xvz1l", "type": "text", "content": { - "html": "
Ok, you are solid πŸ‘
", "richText": [ { "type": "p", "children": [{ "text": "Ok, you are solid πŸ‘" }] } - ], - "plainText": "Ok, you are solid πŸ‘" + ] } }, { @@ -329,14 +311,12 @@ "groupId": "clauusa9z001n3b6qys3xvz1l", "type": "text", "content": { - "html": "
Let's trigger a webhook...
", "richText": [ { "type": "p", "children": [{ "text": "Let's trigger a webhook..." }] } - ], - "plainText": "Let's trigger a webhook..." + ] } }, { @@ -370,9 +350,7 @@ "groupId": "clauuwhyl001v3b6qarbpiqbv", "type": "text", "content": { - "html": "
{{Joke}}
", - "richText": [{ "type": "p", "children": [{ "text": "{{Joke}}" }] }], - "plainText": "{{Joke}}" + "richText": [{ "type": "p", "children": [{ "text": "{{Joke}}" }] }] } } ] diff --git a/apps/viewer/src/test/assets/typebots/fileUpload.json b/apps/viewer/src/test/assets/typebots/fileUpload.json index ed806e911..25e342f74 100644 --- a/apps/viewer/src/test/assets/typebots/fileUpload.json +++ b/apps/viewer/src/test/assets/typebots/fileUpload.json @@ -28,14 +28,12 @@ "type": "text", "groupId": "cl45ojrrd00062e6g17tuu9t0", "content": { - "html": "
Hey there, upload please
", "richText": [ { "type": "p", "children": [{ "text": "Hey there, upload please" }] } - ], - "plainText": "Hey there, upload please" + ] } }, { @@ -64,11 +62,9 @@ "type": "text", "groupId": "cl45ok963000b2e6g2ky0wkvx", "content": { - "html": "
Thank you!
", "richText": [ { "type": "p", "children": [{ "text": "Thank you!" }] } - ], - "plainText": "Thank you!" + ] } } ], diff --git a/apps/viewer/src/test/assets/typebots/hugeGroup.json b/apps/viewer/src/test/assets/typebots/hugeGroup.json index b0125a151..3ee8ca0cf 100644 --- a/apps/viewer/src/test/assets/typebots/hugeGroup.json +++ b/apps/viewer/src/test/assets/typebots/hugeGroup.json @@ -27,11 +27,9 @@ "type": "text", "groupId": "2Vrpgk5VP9BUo3vKtM5kws", "content": { - "html": "
Hi what's your name?
", "richText": [ { "type": "p", "children": [{ "text": "Hi what's your name?" }] } - ], - "plainText": "Hi what's your name?" + ] } }, { @@ -52,11 +50,9 @@ "type": "text", "groupId": "2Vrpgk5VP9BUo3vKtM5kws", "content": { - "html": "
How old are you?
", "richText": [ { "type": "p", "children": [{ "text": "How old are you?" }] } - ], - "plainText": "How old are you?" + ] } }, { @@ -72,9 +68,7 @@ "type": "text", "groupId": "2Vrpgk5VP9BUo3vKtM5kws", "content": { - "html": "
Cool!
", - "richText": [{ "type": "p", "children": [{ "text": "Cool!" }] }], - "plainText": "Cool!" + "richText": [{ "type": "p", "children": [{ "text": "Cool!" }] }] } }, { @@ -82,11 +76,9 @@ "type": "text", "groupId": "2Vrpgk5VP9BUo3vKtM5kws", "content": { - "html": "
Do you eat pizza?
", "richText": [ { "type": "p", "children": [{ "text": "Do you eat pizza?" }] } - ], - "plainText": "Do you eat pizza?" + ] } }, { diff --git a/apps/viewer/src/test/assets/typebots/linkTypebots/2.json b/apps/viewer/src/test/assets/typebots/linkTypebots/2.json index 32bdf1066..06302c904 100644 --- a/apps/viewer/src/test/assets/typebots/linkTypebots/2.json +++ b/apps/viewer/src/test/assets/typebots/linkTypebots/2.json @@ -47,9 +47,7 @@ "groupId": "clbovb3vu00103b6o1pjjuagi", "type": "text", "content": { - "html": "
Cheers!
", - "richText": [{ "type": "p", "children": [{ "text": "Cheers!" }] }], - "plainText": "Cheers!" + "richText": [{ "type": "p", "children": [{ "text": "Cheers!" }] }] } } ] diff --git a/apps/viewer/src/test/assets/typebots/predefinedVariables.json b/apps/viewer/src/test/assets/typebots/predefinedVariables.json index 385687164..9307f1f68 100644 --- a/apps/viewer/src/test/assets/typebots/predefinedVariables.json +++ b/apps/viewer/src/test/assets/typebots/predefinedVariables.json @@ -29,11 +29,9 @@ "groupId": "cl13bgy1s00042e6dao1wyobm", "type": "text", "content": { - "html": "
Hey I know you!
", "richText": [ { "type": "p", "children": [{ "text": "Hey I know you!" }] } - ], - "plainText": "Hey I know you!" + ] } }, { @@ -41,11 +39,9 @@ "groupId": "cl13bgy1s00042e6dao1wyobm", "type": "text", "content": { - "html": "
Your name is {{Name}}
", "richText": [ { "type": "p", "children": [{ "text": "Your name is {{Name}}" }] } - ], - "plainText": "Your name is {{Name}}" + ] } }, { @@ -53,11 +49,9 @@ "groupId": "cl13bgy1s00042e6dao1wyobm", "type": "text", "content": { - "html": "
What's your email?
", "richText": [ { "type": "p", "children": [{ "text": "What's your email?" }] } - ], - "plainText": "What's your email?" + ] } }, { diff --git a/apps/viewer/src/test/assets/typebots/sendEmail.json b/apps/viewer/src/test/assets/typebots/sendEmail.json index b88e9ff29..4ef8c4259 100644 --- a/apps/viewer/src/test/assets/typebots/sendEmail.json +++ b/apps/viewer/src/test/assets/typebots/sendEmail.json @@ -74,11 +74,9 @@ "groupId": "clbnrp1kt000o3b6o2bh5ny0r", "type": "text", "content": { - "html": "
Email sent!
", "richText": [ { "type": "p", "children": [{ "text": "Email sent!" }] } - ], - "plainText": "Email sent!" + ] } } ] diff --git a/apps/viewer/src/test/assets/typebots/webhook.json b/apps/viewer/src/test/assets/typebots/webhook.json index 8fbb7096f..0d68b17fe 100644 --- a/apps/viewer/src/test/assets/typebots/webhook.json +++ b/apps/viewer/src/test/assets/typebots/webhook.json @@ -108,7 +108,6 @@ "groupId": "cl9ipbcjy000j3b6oqngo7luv", "type": "text", "content": { - "html": "
Data of first request:
{{Data}}
", "richText": [ { "type": "p", @@ -116,8 +115,7 @@ }, { "type": "p", "children": [{ "text": "" }] }, { "type": "p", "children": [{ "text": "{{Data}}" }] } - ], - "plainText": "Data of first request:{{Data}}" + ] }, "outgoingEdgeId": "cl9ipet83000z3b6of6zfqota" } @@ -151,7 +149,6 @@ "groupId": "cl9ipej6b000u3b6oeaz305l6", "type": "text", "content": { - "html": "
Data of second request:
{{Data}}
", "richText": [ { "type": "p", @@ -159,8 +156,7 @@ }, { "type": "p", "children": [{ "text": "" }] }, { "type": "p", "children": [{ "text": "{{Data}}" }] } - ], - "plainText": "Data of second request:{{Data}}" + ] } } ] diff --git a/packages/deprecated/bot-engine/src/features/blocks/bubbles/textBubble/components/TextBubble.tsx b/packages/deprecated/bot-engine/src/features/blocks/bubbles/textBubble/components/TextBubble.tsx index 4dae258a0..fe7cda700 100644 --- a/packages/deprecated/bot-engine/src/features/blocks/bubbles/textBubble/components/TextBubble.tsx +++ b/packages/deprecated/bot-engine/src/features/blocks/bubbles/textBubble/components/TextBubble.tsx @@ -38,7 +38,7 @@ export const TextBubble = ({ block, onTransitionEnd }: Props) => { if (!isTyping || isLoading) return const typingTimeout = computeTypingDuration( - block.content.plainText, + block.content.plainText ?? '', typebot.settings?.typingEmulation ?? defaultTypingEmulation ) const timeout = setTimeout(() => { diff --git a/packages/embeds/js/package.json b/packages/embeds/js/package.json index ae2034529..b62b36c6d 100644 --- a/packages/embeds/js/package.json +++ b/packages/embeds/js/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/js", - "version": "0.0.34", + "version": "0.0.35", "description": "Javascript library to display typebots on your website", "type": "module", "main": "dist/index.js", @@ -13,6 +13,7 @@ "license": "MIT", "dependencies": { "@stripe/stripe-js": "1.52.0", + "@udecode/plate-common": "^20.4.0", "solid-element": "1.7.0", "solid-js": "1.7.1" }, @@ -22,20 +23,20 @@ "@rollup/plugin-node-resolve": "15.0.1", "@rollup/plugin-terser": "0.4.0", "@rollup/plugin-typescript": "11.0.0", + "@typebot.io/lib": "workspace:*", + "@typebot.io/schemas": "workspace:*", + "@typebot.io/tsconfig": "workspace:*", "autoprefixer": "10.4.14", "babel-preset-solid": "1.7.1", "eslint": "8.37.0", "eslint-config-custom": "workspace:*", "eslint-plugin-solid": "0.12.0", - "@typebot.io/schemas": "workspace:*", "postcss": "8.4.21", "react": "18.2.0", "rollup": "3.20.2", "rollup-plugin-postcss": "4.0.2", "rollup-plugin-typescript-paths": "1.4.0", "tailwindcss": "3.3.1", - "@typebot.io/tsconfig": "workspace:*", - "typescript": "5.0.3", - "@typebot.io/lib": "workspace:*" + "typescript": "5.0.3" } } diff --git a/packages/embeds/js/src/components/bubbles/HostBubble.tsx b/packages/embeds/js/src/components/bubbles/HostBubble.tsx index c62e585bb..99fbe6bd7 100644 --- a/packages/embeds/js/src/components/bubbles/HostBubble.tsx +++ b/packages/embeds/js/src/components/bubbles/HostBubble.tsx @@ -30,7 +30,7 @@ export const HostBubble = (props: Props) => { } + content={props.message.content as TextBubbleContent} typingEmulation={props.typingEmulation} onTransitionEnd={onTransitionEnd} /> diff --git a/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/TextBubble.tsx b/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/TextBubble.tsx index b61983419..ac2b1843a 100644 --- a/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/TextBubble.tsx +++ b/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/TextBubble.tsx @@ -1,10 +1,12 @@ import { TypingBubble } from '@/components' import type { TextBubbleContent, TypingEmulation } from '@typebot.io/schemas' -import { createSignal, onCleanup, onMount } from 'solid-js' -import { computeTypingDuration } from '../utils/computeTypingDuration' +import { For, createSignal, onCleanup, onMount } from 'solid-js' +import { computeTypingDuration } from '../helpers/computeTypingDuration' +import { PlateBlock } from './plate/PlateBlock' +import { computePlainText } from '../helpers/convertRichTextToPlainText' type Props = { - content: Pick + content: TextBubbleContent typingEmulation: TypingEmulation onTransitionEnd: () => void } @@ -32,11 +34,12 @@ export const TextBubble = (props: Props) => { onMount(() => { if (!isTyping) return + const plainText = computePlainText(props.content.richText) const typingDuration = props.typingEmulation?.enabled === false ? 0 : computeTypingDuration( - props.content.plainText, + plainText, props.typingEmulation ?? defaultTypingEmulation ) typingTimeout = setTimeout(onTypingEnd, typingDuration) @@ -60,13 +63,16 @@ export const TextBubble = (props: Props) => { > {isTyping() && } -

+ > + + {(element) => } + + diff --git a/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/plate/PlateBlock.tsx b/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/plate/PlateBlock.tsx new file mode 100644 index 000000000..d417c9329 --- /dev/null +++ b/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/plate/PlateBlock.tsx @@ -0,0 +1,30 @@ +import type { TElement, TText, TDescendant } from '@udecode/plate-common' +import { PlateText, PlateTextProps } from './PlateText' +import { For, Match, Show, Switch } from 'solid-js' + +type Props = { element: TElement | TText } + +export const PlateBlock = (props: Props) => ( + } + > + + + {(child) => } + + + } + > + + + + {(child) => } + + + + + +) diff --git a/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/plate/PlateText.tsx b/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/plate/PlateText.tsx new file mode 100644 index 000000000..65ebea967 --- /dev/null +++ b/packages/embeds/js/src/features/blocks/bubbles/textBubble/components/plate/PlateText.tsx @@ -0,0 +1,30 @@ +import { Show } from 'solid-js' + +export type PlateTextProps = { + text: string + bold?: boolean + italic?: boolean + underline?: boolean +} + +const computeClassNames = ( + bold: boolean | undefined, + italic: boolean | undefined, + underline: boolean | undefined +) => { + let className = '' + if (bold) className += 'slate-bold' + if (italic) className += ' slate-italic' + if (underline) className += ' slate-underline' + return className +} + +export const PlateText = (props: PlateTextProps) => ( + {props.text}} + > + {(className) => {props.text}} + +) diff --git a/packages/embeds/js/src/features/blocks/bubbles/textBubble/utils/computeTypingDuration.ts b/packages/embeds/js/src/features/blocks/bubbles/textBubble/helpers/computeTypingDuration.ts similarity index 100% rename from packages/embeds/js/src/features/blocks/bubbles/textBubble/utils/computeTypingDuration.ts rename to packages/embeds/js/src/features/blocks/bubbles/textBubble/helpers/computeTypingDuration.ts diff --git a/packages/embeds/js/src/features/blocks/bubbles/textBubble/helpers/convertRichTextToPlainText.ts b/packages/embeds/js/src/features/blocks/bubbles/textBubble/helpers/convertRichTextToPlainText.ts new file mode 100644 index 000000000..e9990c5b5 --- /dev/null +++ b/packages/embeds/js/src/features/blocks/bubbles/textBubble/helpers/convertRichTextToPlainText.ts @@ -0,0 +1,9 @@ +import type { TDescendant } from '@udecode/plate-common' + +export const computePlainText = (elements: TDescendant[]): string => + elements + .map( + (element) => + element.text ?? computePlainText(element.children as TDescendant[]) + ) + .join('') diff --git a/packages/embeds/react/package.json b/packages/embeds/react/package.json index 753afcb97..29a3c3c2c 100644 --- a/packages/embeds/react/package.json +++ b/packages/embeds/react/package.json @@ -1,6 +1,6 @@ { "name": "@typebot.io/react", - "version": "0.0.34", + "version": "0.0.35", "description": "React library to display typebots on your website", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/schemas/features/blocks/bubbles/text.ts b/packages/schemas/features/blocks/bubbles/text.ts index ad90048c7..c7915f1c3 100644 --- a/packages/schemas/features/blocks/bubbles/text.ts +++ b/packages/schemas/features/blocks/bubbles/text.ts @@ -1,21 +1,18 @@ import { z } from 'zod' import { blockBaseSchema } from '../baseSchemas' import { BubbleBlockType } from './enums' +import type { TElement } from '@udecode/plate-common' export const defaultTextBubbleContent: TextBubbleContent = { - html: '', richText: [], - plainText: '', } export const textBubbleContentSchema = z.object({ - html: z.string(), + html: z.string().optional(), richText: z.array(z.any()), - plainText: z.string(), + plainText: z.string().optional(), }) -export type TextBubbleContent = z.infer - export const textBubbleBlockSchema = blockBaseSchema.merge( z.object({ type: z.enum([BubbleBlockType.TEXT]), @@ -23,4 +20,10 @@ export const textBubbleBlockSchema = blockBaseSchema.merge( }) ) -export type TextBubbleBlock = z.infer +export type TextBubbleBlock = Omit< + z.infer, + 'content' +> & { + content: { richText: TElement[]; html?: string; plainText?: string } +} +export type TextBubbleContent = TextBubbleBlock['content'] diff --git a/packages/schemas/features/chat.ts b/packages/schemas/features/chat.ts index 6cac9d2d8..c433edc6c 100644 --- a/packages/schemas/features/chat.ts +++ b/packages/schemas/features/chat.ts @@ -73,9 +73,7 @@ const chatSessionSchema = z.object({ const textMessageSchema = z.object({ type: z.literal(BubbleBlockType.TEXT), - content: textBubbleContentSchema.omit({ - richText: true, - }), + content: textBubbleContentSchema, }) const imageMessageSchema = z.object({ diff --git a/packages/schemas/package.json b/packages/schemas/package.json index 677d0b50d..68515ff32 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -6,6 +6,7 @@ "license": "AGPL-3.0-or-later", "private": true, "dependencies": { + "@udecode/plate-common": "^20.4.0", "zod": "3.21.4" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 21a466a09..4eb981713 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -813,6 +813,9 @@ importers: '@stripe/stripe-js': specifier: 1.52.0 version: 1.52.0 + '@udecode/plate-common': + specifier: ^20.4.0 + version: 20.4.0(@babel/core@7.21.4)(react-dom@18.2.0)(react@18.2.0)(scheduler@0.23.0)(slate-history@0.86.0)(slate-react@0.92.0)(slate@0.91.4) solid-element: specifier: 1.7.0 version: 1.7.0(solid-js@1.7.1) @@ -1049,6 +1052,9 @@ importers: packages/schemas: dependencies: + '@udecode/plate-common': + specifier: ^20.4.0 + version: 20.4.0(@babel/core@7.21.4)(react-dom@18.2.0)(react@18.2.0)(scheduler@0.23.0)(slate-history@0.86.0)(slate-react@0.92.0)(slate@0.91.4) zod: specifier: 3.21.4 version: 3.21.4