mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-05 21:04:43 +08:00
🔧 Enable PR2 Biome rules and mechanical autofixes
This commit is contained in:
parent
516b33b8a1
commit
14ec3a2598
@ -1,8 +1,8 @@
|
||||
import { dirname, join } from "node:path";
|
||||
import { withSentryConfig } from "@sentry/nextjs";
|
||||
import { dirname, join } from "path";
|
||||
import "@typebot.io/env/compiled";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { configureRuntimeEnv } from "next-runtime-env/build/configure.js";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ export const ImageUploadContent = ({
|
||||
|
||||
const handleSubmit = (url: string) => {
|
||||
onSubmit(url);
|
||||
onClose && onClose();
|
||||
onClose?.();
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@ -53,7 +53,7 @@ export const UploadButton = ({
|
||||
return;
|
||||
}
|
||||
|
||||
onFileUploaded(data.fileUrl + "?v=" + Date.now());
|
||||
onFileUploaded(`${data.fileUrl}?v=${Date.now()}`);
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
@ -11,11 +11,11 @@ const emojiTags = emojiTagsData as Record<string, string[]>;
|
||||
const people = emojis["Smileys & Emotion"].concat(emojis["People & Body"]);
|
||||
const nature = emojis["Animals & Nature"];
|
||||
const food = emojis["Food & Drink"];
|
||||
const activities = emojis["Activities"];
|
||||
const activities = emojis.Activities;
|
||||
const travel = emojis["Travel & Places"];
|
||||
const objects = emojis["Objects"];
|
||||
const symbols = emojis["Symbols"];
|
||||
const flags = emojis["Flags"];
|
||||
const objects = emojis.Objects;
|
||||
const symbols = emojis.Symbols;
|
||||
const flags = emojis.Flags;
|
||||
|
||||
const localStorageRecentEmojisKey = "recentEmojis";
|
||||
|
||||
|
||||
@ -135,8 +135,8 @@ const StackWithGhostableItems = ({
|
||||
<div
|
||||
style={
|
||||
{
|
||||
"--gap": (isNullGroup ? (isExpanded ? 1 : 0) : gapPixel) + "px",
|
||||
"--mb": gapPixel + "px",
|
||||
"--gap": `${isNullGroup ? (isExpanded ? 1 : 0) : gapPixel}px`,
|
||||
"--mb": `${gapPixel}px`,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
className={cx(
|
||||
@ -182,7 +182,7 @@ export const GhostableItem = ({
|
||||
{
|
||||
"--available-height": isExpanded
|
||||
? "24px"
|
||||
: ghostItemHeight + "px",
|
||||
: `${ghostItemHeight}px`,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
className={cn(
|
||||
|
||||
@ -132,7 +132,7 @@ export const PexelsPicker = ({ onVideoSelect }: Props) => {
|
||||
debounceTimeout={500}
|
||||
/>
|
||||
</div>
|
||||
<a target="_blank" href={`https://www.pexels.com`} rel="noopener">
|
||||
<a target="_blank" href={"https://www.pexels.com"} rel="noopener">
|
||||
<PexelsLogo width="100px" height="40px" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -60,7 +60,7 @@ export const CodeEditor = ({
|
||||
|
||||
const setValue = useDebouncedCallback((value) => {
|
||||
_setValue(value);
|
||||
onChange && onChange(value);
|
||||
onChange?.(value);
|
||||
}, debounceTimeout);
|
||||
|
||||
const handleVariableSelected = (variable?: Pick<Variable, "id" | "name">) => {
|
||||
@ -162,8 +162,8 @@ export const CodeEditor = ({
|
||||
<Popover.Trigger
|
||||
className="absolute"
|
||||
style={{
|
||||
top: variablePopoverAnchorCoords?.top + "px",
|
||||
left: variablePopoverAnchorCoords?.left + "px",
|
||||
top: `${variablePopoverAnchorCoords?.top}px`,
|
||||
left: `${variablePopoverAnchorCoords?.left}px`,
|
||||
}}
|
||||
/>
|
||||
<Popover.Popup
|
||||
|
||||
@ -220,12 +220,12 @@ const edgeIdToHumanReadableLabel = (
|
||||
(group) => group.id === (edge.to as Target).groupId,
|
||||
);
|
||||
if (!toGroup) throw new Error("Group not found while debugging edge");
|
||||
label += " -> " + toGroup?.title;
|
||||
label += ` -> ${toGroup?.title}`;
|
||||
if (edge.to?.blockId) {
|
||||
const toBlock = toGroup.blocks.find(
|
||||
(block) => block.id === (edge.to as Target).blockId,
|
||||
);
|
||||
if (toBlock) label += " > " + toBlock?.type;
|
||||
if (toBlock) label += ` > ${toBlock?.type}`;
|
||||
}
|
||||
|
||||
label += "]";
|
||||
|
||||
@ -3,5 +3,5 @@ export const storageToReadable = (bytes: number) => {
|
||||
return "0";
|
||||
}
|
||||
const e = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||
return (bytes / 1024 ** e).toFixed(2) + " " + " KMGTP".charAt(e) + "B";
|
||||
return `${(bytes / 1024 ** e).toFixed(2)} ${" KMGTP".charAt(e)}B`;
|
||||
};
|
||||
|
||||
@ -57,7 +57,7 @@ export const TextBubbleEditor = ({
|
||||
if (!variable) return;
|
||||
variablesPopoverControls.onClose();
|
||||
editor.tf.focus();
|
||||
editor.tf.insertText("{{" + variable.name + "}}");
|
||||
editor.tf.insertText(`{{${variable.name}}}`);
|
||||
};
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
||||
@ -159,8 +159,8 @@ export const TextBubbleEditor = ({
|
||||
<Popover.Trigger
|
||||
className="absolute"
|
||||
style={{
|
||||
top: variablePopoverAnchorCoords?.top + "px",
|
||||
left: variablePopoverAnchorCoords?.left + "px",
|
||||
top: `${variablePopoverAnchorCoords?.top}px`,
|
||||
left: `${variablePopoverAnchorCoords?.left}px`,
|
||||
}}
|
||||
/>
|
||||
<Popover.Popup
|
||||
|
||||
@ -47,7 +47,7 @@ const PlateTextContent = ({ text }: { text: string }) => {
|
||||
const matchingVariable = typebot?.variables.find(
|
||||
(variable) => variable.name === variableName,
|
||||
);
|
||||
if (!matchingVariable) return "{{" + str;
|
||||
if (!matchingVariable) return `{{${str}`;
|
||||
return (
|
||||
<span
|
||||
className="bg-purple-9 text-white rounded-sm py-0.5 px-1.5"
|
||||
|
||||
@ -66,7 +66,7 @@ export const PictureChoiceItemNode = ({ item, indices }: Props) => {
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
></Popover.Trigger>
|
||||
/>
|
||||
<Popover.Popup side="right" className="p-4">
|
||||
{typebot && blockId && (
|
||||
<PictureChoiceItemSettings
|
||||
|
||||
@ -14,13 +14,13 @@ export const ChatwootLogo = ({
|
||||
<title>Chatwoot Logo</title>
|
||||
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
||||
<g fillRule="nonzero">
|
||||
<circle fill="#47A7F6" cx="256" cy="256" r="256"></circle>
|
||||
<circle fill="#47A7F6" cx="256" cy="256" r="256" />
|
||||
<path
|
||||
d="M362.807947,368.807947 L244.122956,368.807947 C178.699407,368.807947 125.456954,315.561812 125.456954,250.12177 C125.456954,184.703089 178.699407,131.456954 244.124143,131.456954 C309.565494,131.456954 362.807947,184.703089 362.807947,250.12177 L362.807947,368.807947 Z"
|
||||
stroke="#FFFFFF"
|
||||
strokeWidth="6"
|
||||
fill="#FFFFFF"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
@ -8,22 +8,22 @@ export const GoogleSheetsLogo = ({
|
||||
<title>Sheets-icon</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z"></path>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z"></path>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z"></path>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z" />
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z" />
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z" />
|
||||
<linearGradient
|
||||
x1="50.0053945%"
|
||||
y1="8.58610612%"
|
||||
x2="50.0053945%"
|
||||
y2="100.013939%"
|
||||
>
|
||||
<stop stopColor="#263238" stopOpacity="0.2" offset="0%"></stop>
|
||||
<stop stopColor="#263238" stopOpacity="0.02" offset="100%"></stop>
|
||||
<stop stopColor="#263238" stopOpacity="0.2" offset="0%" />
|
||||
<stop stopColor="#263238" stopOpacity="0.02" offset="100%" />
|
||||
</linearGradient>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z"></path>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z"></path>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z"></path>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z"></path>
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z" />
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z" />
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z" />
|
||||
<path d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z" />
|
||||
<radialGradient
|
||||
cx="3.16804688%"
|
||||
cy="2.71744318%"
|
||||
@ -32,8 +32,8 @@ export const GoogleSheetsLogo = ({
|
||||
r="161.248516%"
|
||||
gradientTransform="translate(0.031680,0.027174),scale(1.000000,0.727273),translate(-0.031680,-0.027174)"
|
||||
>
|
||||
<stop stopColor="#FFFFFF" stopOpacity="0.1" offset="0%"></stop>
|
||||
<stop stopColor="#FFFFFF" stopOpacity="0" offset="100%"></stop>
|
||||
<stop stopColor="#FFFFFF" stopOpacity="0.1" offset="0%" />
|
||||
<stop stopColor="#FFFFFF" stopOpacity="0" offset="100%" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
||||
@ -44,100 +44,100 @@ export const GoogleSheetsLogo = ({
|
||||
<g>
|
||||
<g>
|
||||
<mask fill="white">
|
||||
<use xlinkHref="#path-1"></use>
|
||||
<use xlinkHref="#path-1" />
|
||||
</mask>
|
||||
<g></g>
|
||||
<g />
|
||||
<path
|
||||
d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L36.9791667,10.3541667 L29.5833333,0 Z"
|
||||
fill="#0F9D58"
|
||||
fillRule="nonzero"
|
||||
mask="url(#mask-2)"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
<g>
|
||||
<mask fill="white">
|
||||
<use xlinkHref="#path-3"></use>
|
||||
<use xlinkHref="#path-3" />
|
||||
</mask>
|
||||
<g></g>
|
||||
<g />
|
||||
<path
|
||||
d="M11.8333333,31.8020833 L11.8333333,53.25 L35.5,53.25 L35.5,31.8020833 L11.8333333,31.8020833 Z M22.1875,50.2916667 L14.7916667,50.2916667 L14.7916667,46.59375 L22.1875,46.59375 L22.1875,50.2916667 Z M22.1875,44.375 L14.7916667,44.375 L14.7916667,40.6770833 L22.1875,40.6770833 L22.1875,44.375 Z M22.1875,38.4583333 L14.7916667,38.4583333 L14.7916667,34.7604167 L22.1875,34.7604167 L22.1875,38.4583333 Z M32.5416667,50.2916667 L25.1458333,50.2916667 L25.1458333,46.59375 L32.5416667,46.59375 L32.5416667,50.2916667 Z M32.5416667,44.375 L25.1458333,44.375 L25.1458333,40.6770833 L32.5416667,40.6770833 L32.5416667,44.375 Z M32.5416667,38.4583333 L25.1458333,38.4583333 L25.1458333,34.7604167 L32.5416667,34.7604167 L32.5416667,38.4583333 Z"
|
||||
fill="#F1F1F1"
|
||||
fillRule="nonzero"
|
||||
mask="url(#mask-4)"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
<g>
|
||||
<mask fill="white">
|
||||
<use xlinkHref="#path-5"></use>
|
||||
<use xlinkHref="#path-5" />
|
||||
</mask>
|
||||
<g></g>
|
||||
<g />
|
||||
<polygon
|
||||
fill="url(#linearGradient-7)"
|
||||
fillRule="nonzero"
|
||||
mask="url(#mask-6)"
|
||||
points="30.8813021 16.4520313 47.3333333 32.9003646 47.3333333 17.75"
|
||||
></polygon>
|
||||
/>
|
||||
</g>
|
||||
<g>
|
||||
<mask fill="white">
|
||||
<use xlinkHref="#path-8"></use>
|
||||
<use xlinkHref="#path-8" />
|
||||
</mask>
|
||||
<g></g>
|
||||
<g />
|
||||
<g mask="url(#mask-9)">
|
||||
<g transform="translate(26.625000, -2.958333)">
|
||||
<path
|
||||
d="M2.95833333,2.95833333 L2.95833333,16.2708333 C2.95833333,18.7225521 4.94411458,20.7083333 7.39583333,20.7083333 L20.7083333,20.7083333 L2.95833333,2.95833333 Z"
|
||||
fill="#87CEAC"
|
||||
fillRule="nonzero"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g>
|
||||
<mask fill="white">
|
||||
<use xlinkHref="#path-10"></use>
|
||||
<use xlinkHref="#path-10" />
|
||||
</mask>
|
||||
<g></g>
|
||||
<g />
|
||||
<path
|
||||
d="M4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,4.80729167 C0,2.36666667 1.996875,0.369791667 4.4375,0.369791667 L29.5833333,0.369791667 L29.5833333,0 L4.4375,0 Z"
|
||||
fillOpacity="0.2"
|
||||
fill="#FFFFFF"
|
||||
fillRule="nonzero"
|
||||
mask="url(#mask-11)"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
<g>
|
||||
<mask fill="white">
|
||||
<use xlinkHref="#path-12"></use>
|
||||
<use xlinkHref="#path-12" />
|
||||
</mask>
|
||||
<g></g>
|
||||
<g />
|
||||
<path
|
||||
d="M42.8958333,64.7135417 L4.4375,64.7135417 C1.996875,64.7135417 0,62.7166667 0,60.2760417 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,60.2760417 C47.3333333,62.7166667 45.3364583,64.7135417 42.8958333,64.7135417 Z"
|
||||
fillOpacity="0.2"
|
||||
fill="#263238"
|
||||
fillRule="nonzero"
|
||||
mask="url(#mask-13)"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
<g>
|
||||
<mask fill="white">
|
||||
<use xlinkHref="#path-14"></use>
|
||||
<use xlinkHref="#path-14" />
|
||||
</mask>
|
||||
<g></g>
|
||||
<g />
|
||||
<path
|
||||
d="M34.0208333,17.75 C31.5691146,17.75 29.5833333,15.7642188 29.5833333,13.3125 L29.5833333,13.6822917 C29.5833333,16.1340104 31.5691146,18.1197917 34.0208333,18.1197917 L47.3333333,18.1197917 L47.3333333,17.75 L34.0208333,17.75 Z"
|
||||
fillOpacity="0.1"
|
||||
fill="#263238"
|
||||
fillRule="nonzero"
|
||||
mask="url(#mask-15)"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
<path
|
||||
d="M29.5833333,0 L4.4375,0 C1.996875,0 0,1.996875 0,4.4375 L0,60.6458333 C0,63.0864583 1.996875,65.0833333 4.4375,65.0833333 L42.8958333,65.0833333 C45.3364583,65.0833333 47.3333333,63.0864583 47.3333333,60.6458333 L47.3333333,17.75 L29.5833333,0 Z"
|
||||
fill="url(#radialGradient-16)"
|
||||
fillRule="nonzero"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
@ -47,7 +47,7 @@ export const computeDeepKeysMappingSuggestionList = (obj: any): string[] => {
|
||||
|
||||
const parsePrevKey = (key: string, suffix: string) => {
|
||||
let currentKey = key;
|
||||
if (key.includes(" ") || key.includes("-") || !isNaN(key as any)) {
|
||||
if (shouldUseBracketNotation(key)) {
|
||||
currentKey = parseBracketsKey(key);
|
||||
}
|
||||
return parseNextKey(suffix).startsWith("[") ? currentKey : `${currentKey}.`;
|
||||
@ -55,7 +55,7 @@ const parsePrevKey = (key: string, suffix: string) => {
|
||||
|
||||
const parseNextKey = (key: string) => {
|
||||
if (
|
||||
(key.includes(" ") || key.includes("-") || !isNaN(key as any)) &&
|
||||
shouldUseBracketNotation(key) &&
|
||||
!key.includes(".flatMap(item => item") &&
|
||||
!key.includes("['") &&
|
||||
!key.includes("']")
|
||||
@ -66,6 +66,11 @@ const parseNextKey = (key: string) => {
|
||||
};
|
||||
|
||||
const parseBracketsKey = (key: string) => {
|
||||
if (isNaN(key as any)) return `['${key}']`;
|
||||
if (!isNumericKey(key)) return `['${key}']`;
|
||||
return `[${key}]`;
|
||||
};
|
||||
|
||||
const shouldUseBracketNotation = (key: string) =>
|
||||
key.includes(" ") || key.includes("-") || isNumericKey(key);
|
||||
|
||||
const isNumericKey = (key: string) => !Number.isNaN(Number(key));
|
||||
|
||||
@ -17,15 +17,15 @@ export const PabblyConnectLogo = ({
|
||||
<path
|
||||
fill="#20B276"
|
||||
d="M258.753 129.375c0 71.454-57.925 129.376-129.377 129.376-22.403 0-43.476-5.692-61.85-15.713C27.296 221.099 0 178.426 0 129.375 0 57.924 57.924 0 129.376 0c71.453 0 129.377 57.924 129.377 129.375z"
|
||||
></path>
|
||||
/>
|
||||
<path
|
||||
fill="#147F52"
|
||||
d="M181.014 166.173c-13.69 14.108-30.304 21.167-49.838 21.167-11.923 0-22.999-2.018-33.383-7.88l-.125 75.124-.984-.266-.609-.156-.719-.391-.339-.613-.312-.693.346-.434-34.257-40.846.01-96.555c0-20.119 6.844-37.206 20.535-51.264 13.688-14.059 30.301-21.087 49.837-21.087 19.534 0 36.147 7.053 49.838 21.164 13.688 14.109 20.534 31.232 20.534 51.366 0 20.136-6.845 37.256-20.534 51.364zm-26.131-75.819c-6.5-6.705-14.402-10.056-23.707-10.056-9.308 0-17.21 3.351-23.707 10.056-6.5 6.705-9.75 14.855-9.75 24.457 0 9.599 3.249 17.749 9.75 24.454 6.497 6.706 14.399 10.059 23.707 10.059 9.305 0 17.207-3.353 23.707-10.059 6.499-6.705 9.749-14.855 9.749-24.454 0-9.602-3.25-17.753-9.749-24.457z"
|
||||
></path>
|
||||
/>
|
||||
<path
|
||||
fill="#FFF"
|
||||
d="M178.321 163.506c-13.69 14.11-30.302 21.167-49.837 21.167-11.922 0-23.073-2.931-33.456-8.793l-.011 78.261s-2.527-.696-5.816-1.758a97.162 97.162 0 01-2.488-.846c-.408-.145-.607-.23-1.027-.351-1.076-.31-2.44-.908-3.491-1.317a132.106 132.106 0 01-6.463-2.718c-.069-.033-10.179-4.856-11.319-5.568-1.021-.638-1.93-1.138-2.709-1.697-.249-.178-.437-.305-.673-.467-1.852-1.273-2.887-2.004-2.887-2.004l-.031-125.45c0-20.12 6.844-37.207 20.535-51.264 13.689-14.06 30.301-21.087 49.837-21.087 19.535 0 36.146 7.053 49.837 21.164 13.688 14.109 20.536 31.232 20.536 51.365-.001 20.134-6.849 37.254-20.537 51.363zm-26.13-75.819c-6.5-6.705-14.402-10.056-23.707-10.056-9.307 0-17.209 3.351-23.707 10.056-6.5 6.705-9.749 14.855-9.749 24.456 0 9.6 3.249 17.75 9.749 24.454 6.498 6.708 14.4 10.06 23.707 10.06 9.305 0 17.207-3.352 23.707-10.06 6.498-6.704 9.749-14.854 9.749-24.454 0-9.601-3.251-17.751-9.749-24.456z"
|
||||
></path>
|
||||
/>
|
||||
</g>
|
||||
</switch>
|
||||
</svg>
|
||||
|
||||
@ -43,10 +43,10 @@ export const handleDeleteCustomDomain = async ({
|
||||
message: "Failed to delete domain on Vercel",
|
||||
cause: await error.response.text(),
|
||||
});
|
||||
else
|
||||
throw new ORPCError("INTERNAL_SERVER_ERROR", {
|
||||
message: "Failed to delete domain on Vercel",
|
||||
});
|
||||
|
||||
throw new ORPCError("INTERNAL_SERVER_ERROR", {
|
||||
message: "Failed to delete domain on Vercel",
|
||||
});
|
||||
}
|
||||
await prisma.customDomain.deleteMany({
|
||||
where: {
|
||||
|
||||
@ -57,7 +57,7 @@ export const handleVerifyCustomDomain = async ({
|
||||
status = "Pending Verification";
|
||||
const verificationJson = await verifyDomain(name);
|
||||
|
||||
if (verificationJson && verificationJson.verified) {
|
||||
if (verificationJson?.verified) {
|
||||
status = "Valid Configuration";
|
||||
}
|
||||
} else if (configJson.misconfigured) {
|
||||
|
||||
@ -120,7 +120,7 @@ export const CustomDomainConfigDialog = ({
|
||||
<div className="flex flex-col gap-2">
|
||||
<p className="font-bold">Value</p>
|
||||
<p className="text-sm font-mono">
|
||||
{recordType === "A" ? "76.76.21.21" : `cname.vercel-dns.com`}
|
||||
{recordType === "A" ? "76.76.21.21" : "cname.vercel-dns.com"}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
|
||||
@ -136,10 +136,9 @@ export const BlocksSideBar = () => {
|
||||
.filter((block) => {
|
||||
return (
|
||||
block.id.toLowerCase().includes(searchInput.toLowerCase()) ||
|
||||
(block.tags &&
|
||||
block.tags.some((tag: string) =>
|
||||
tag.toLowerCase().includes(searchInput.toLowerCase()),
|
||||
)) ||
|
||||
block.tags?.some((tag: string) =>
|
||||
tag.toLowerCase().includes(searchInput.toLowerCase()),
|
||||
) ||
|
||||
block.name.toLowerCase().includes(searchInput.toLowerCase())
|
||||
);
|
||||
})
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import assert from "node:assert";
|
||||
import { useTranslate } from "@tolgee/react";
|
||||
import { getPublicId } from "@typebot.io/typebot/helpers/getPublicId";
|
||||
import { Menu } from "@typebot.io/ui/components/Menu";
|
||||
@ -6,7 +7,6 @@ import { Book02Icon } from "@typebot.io/ui/icons/Book02Icon";
|
||||
import { Download01Icon } from "@typebot.io/ui/icons/Download01Icon";
|
||||
import { MoreHorizontalIcon } from "@typebot.io/ui/icons/MoreHorizontalIcon";
|
||||
import { Settings01Icon } from "@typebot.io/ui/icons/Settings01Icon";
|
||||
import assert from "assert";
|
||||
import { useState } from "react";
|
||||
import { useTypebot } from "../providers/TypebotProvider";
|
||||
import { EditorSettingsDialog } from "./EditorSettingsDialog";
|
||||
|
||||
@ -72,7 +72,7 @@ export const GuestTypebotHeader = () => {
|
||||
href={
|
||||
!user
|
||||
? {
|
||||
pathname: `/register`,
|
||||
pathname: "/register",
|
||||
query: {
|
||||
redirectPath: `/typebots/${typebot.id}/duplicate`,
|
||||
},
|
||||
@ -103,7 +103,7 @@ export const GuestTypebotHeader = () => {
|
||||
<>
|
||||
<hr className="h-6 w-px border-0 bg-gray-6" />
|
||||
<ButtonLink
|
||||
href={`/register`}
|
||||
href={"/register"}
|
||||
variant="outline-secondary"
|
||||
size="sm"
|
||||
>
|
||||
|
||||
@ -141,7 +141,7 @@ export const EventNode = ({ event, eventIndex }: Props) => {
|
||||
<div
|
||||
style={
|
||||
{
|
||||
"--width": eventWidth + "px",
|
||||
"--width": `${eventWidth}px`,
|
||||
transform: `translate(${eventCoordinates?.x ?? 0}px, ${
|
||||
eventCoordinates?.y ?? 0
|
||||
}px)`,
|
||||
|
||||
@ -172,31 +172,28 @@ export const FolderContent = ({ folder }: Props) => {
|
||||
/>
|
||||
)}
|
||||
{isFolderLoading && <ButtonSkeleton />}
|
||||
{folders &&
|
||||
folders.map((folder, index) => (
|
||||
<FolderButton
|
||||
key={folder.id}
|
||||
index={index}
|
||||
folder={folder}
|
||||
onFolderDeleted={refetchFolders}
|
||||
onFolderRenamed={() => refetchFolders()}
|
||||
/>
|
||||
))}
|
||||
{folders?.map((folder, index) => (
|
||||
<FolderButton
|
||||
key={folder.id}
|
||||
index={index}
|
||||
folder={folder}
|
||||
onFolderDeleted={refetchFolders}
|
||||
onFolderRenamed={() => refetchFolders()}
|
||||
/>
|
||||
))}
|
||||
{isTypebotLoading && <ButtonSkeleton />}
|
||||
{typebotsData?.typebots &&
|
||||
typebotsData?.typebots.map((typebot) => (
|
||||
<TypebotButton
|
||||
key={typebot.id}
|
||||
typebot={typebot}
|
||||
draggedTypebot={draggedTypebot}
|
||||
onTypebotUpdated={refetchTypebots}
|
||||
onDrag={handleTypebotDrag(typebot)}
|
||||
isReadOnly={
|
||||
typebot.accessRight !== "write" &&
|
||||
currentUserMode !== "write"
|
||||
}
|
||||
/>
|
||||
))}
|
||||
{typebotsData?.typebots?.map((typebot) => (
|
||||
<TypebotButton
|
||||
key={typebot.id}
|
||||
typebot={typebot}
|
||||
draggedTypebot={draggedTypebot}
|
||||
onTypebotUpdated={refetchTypebots}
|
||||
onDrag={handleTypebotDrag(typebot)}
|
||||
isReadOnly={
|
||||
typebot.accessRight !== "write" && currentUserMode !== "write"
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { stringify } from "querystring";
|
||||
import { stringify } from "node:querystring";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { toast } from "@/lib/toast";
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ export const ZodObjectLayout = ({
|
||||
const layout = getZodLayoutMetadata(keySchema);
|
||||
|
||||
if (evaluateIsHidden(layout?.isHidden, blockOptions)) return nodes;
|
||||
if (layout && layout.accordion && !isInAccordion) {
|
||||
if (layout?.accordion && !isInAccordion) {
|
||||
if (nodes.accordionsCreated.includes(layout.accordion)) return nodes;
|
||||
const accordionKeys = getObjectKeysWithSameAccordionAttr(
|
||||
layout.accordion,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import assert from "node:assert";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { omit } from "@typebot.io/lib/utils";
|
||||
import assert from "assert";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useTypebot } from "@/features/editor/providers/TypebotProvider";
|
||||
import { useUser } from "@/features/user/hooks/useUser";
|
||||
@ -53,8 +53,7 @@ export const DrawingEdge = ({ connectingIds }: Props) => {
|
||||
: undefined;
|
||||
|
||||
const targetGroupCoordinates =
|
||||
elementsCoordinates &&
|
||||
elementsCoordinates[connectingIds?.target?.groupId ?? ""];
|
||||
elementsCoordinates?.[connectingIds?.target?.groupId ?? ""];
|
||||
|
||||
const sourceTop = useMemo(() => {
|
||||
if (!connectingIds) return 0;
|
||||
@ -80,7 +79,7 @@ export const DrawingEdge = ({ connectingIds }: Props) => {
|
||||
!mousePosition ||
|
||||
!connectingIds?.source
|
||||
)
|
||||
return ``;
|
||||
return "";
|
||||
|
||||
return targetGroupCoordinates
|
||||
? computeConnectingEdgePath({
|
||||
|
||||
@ -198,7 +198,7 @@ export const DropOffEdge = ({
|
||||
</Badge>
|
||||
</div>
|
||||
}
|
||||
></Tooltip.Trigger>
|
||||
/>
|
||||
<Tooltip.Popup>
|
||||
{isWorkspaceProPlan ? (
|
||||
<>
|
||||
|
||||
@ -67,7 +67,7 @@ export const Edge = ({ edge, fromElementId }: Props) => {
|
||||
}, [deleteEdge, edge.id, edge.to.blockId, targetEndpointYOffsets]);
|
||||
|
||||
const path = useMemo(() => {
|
||||
if (!fromElementCoordinates || !toGroupCoordinates || !sourceTop) return ``;
|
||||
if (!fromElementCoordinates || !toGroupCoordinates || !sourceTop) return "";
|
||||
const anchorsPosition = getAnchorsPosition({
|
||||
sourceGroupCoordinates: fromElementCoordinates,
|
||||
targetGroupCoordinates: toGroupCoordinates,
|
||||
|
||||
@ -49,8 +49,8 @@ export const PlaceholderNode = forwardRef<HTMLDivElement, Props>(
|
||||
{
|
||||
"--py":
|
||||
isExpanded || isHoverExpanded
|
||||
? expandedPaddingPixel + "px"
|
||||
: initialPaddingPixel + "px",
|
||||
? `${expandedPaddingPixel}px`
|
||||
: `${initialPaddingPixel}px`,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
className={cn(
|
||||
@ -80,8 +80,8 @@ export const PlaceholderNode = forwardRef<HTMLDivElement, Props>(
|
||||
{
|
||||
"--h":
|
||||
isExpanded || isHoverExpanded
|
||||
? expandedHeightPixels + "px"
|
||||
: initialHeightPixels + "px",
|
||||
? `${expandedHeightPixels}px`
|
||||
: `${initialHeightPixels}px`,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
className={cx(
|
||||
|
||||
@ -39,19 +39,17 @@ export const BlockNodeContextMenuPopup = ({
|
||||
|
||||
return (
|
||||
<ContextMenu.Popup>
|
||||
{actionDef &&
|
||||
actionDef?.turnableInto &&
|
||||
actionDef?.turnableInto.length > 0 && (
|
||||
<ContextMenu.SubmenuRoot>
|
||||
<ContextMenu.SubmenuTrigger>
|
||||
<RepeatIcon /> Turn into <ArrowRight01Icon />
|
||||
</ContextMenu.SubmenuTrigger>
|
||||
<ForgedBlockTurnIntoContextMenuPopup
|
||||
turnableInto={actionDef.turnableInto}
|
||||
onTurnIntoClick={onTurnIntoClick}
|
||||
/>
|
||||
</ContextMenu.SubmenuRoot>
|
||||
)}
|
||||
{actionDef?.turnableInto && actionDef?.turnableInto.length > 0 && (
|
||||
<ContextMenu.SubmenuRoot>
|
||||
<ContextMenu.SubmenuTrigger>
|
||||
<RepeatIcon /> Turn into <ArrowRight01Icon />
|
||||
</ContextMenu.SubmenuTrigger>
|
||||
<ForgedBlockTurnIntoContextMenuPopup
|
||||
turnableInto={actionDef.turnableInto}
|
||||
onTurnIntoClick={onTurnIntoClick}
|
||||
/>
|
||||
</ContextMenu.SubmenuRoot>
|
||||
)}
|
||||
<ContextMenu.Item onClick={handleDuplicateClick}>
|
||||
<Copy01Icon />
|
||||
{t("duplicate")}
|
||||
|
||||
@ -157,7 +157,7 @@ export const GroupNode = ({ group, groupIndex }: Props) => {
|
||||
<div
|
||||
style={
|
||||
{
|
||||
"--group-width": groupWidth + "px",
|
||||
"--group-width": `${groupWidth}px`,
|
||||
transform: `translate(${groupCoordinates?.x ?? 0}px, ${
|
||||
groupCoordinates?.y ?? 0
|
||||
}px)`,
|
||||
|
||||
@ -16,7 +16,7 @@ export const computeSelectBoxDimensions = ({ initial, movement }: Props) => {
|
||||
height: Math.abs(movement[1]),
|
||||
},
|
||||
};
|
||||
else if (movement[0] < 0)
|
||||
if (movement[0] < 0)
|
||||
return {
|
||||
origin: {
|
||||
x: initial[0] + movement[0],
|
||||
@ -27,7 +27,7 @@ export const computeSelectBoxDimensions = ({ initial, movement }: Props) => {
|
||||
height: movement[1],
|
||||
},
|
||||
};
|
||||
else if (movement[1] < 0)
|
||||
if (movement[1] < 0)
|
||||
return {
|
||||
origin: {
|
||||
x: initial[0],
|
||||
@ -38,15 +38,15 @@ export const computeSelectBoxDimensions = ({ initial, movement }: Props) => {
|
||||
height: Math.abs(movement[1]),
|
||||
},
|
||||
};
|
||||
else
|
||||
return {
|
||||
origin: {
|
||||
x: initial[0],
|
||||
y: initial[1],
|
||||
},
|
||||
dimension: {
|
||||
width: movement[0],
|
||||
height: movement[1],
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
origin: {
|
||||
x: initial[0],
|
||||
y: initial[1],
|
||||
},
|
||||
dimension: {
|
||||
width: movement[0],
|
||||
height: movement[1],
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@ -67,17 +67,16 @@ const computeGroupTargetPosition = ({
|
||||
sourceGroupPosition.x + elementWidth / 2 + stubLength;
|
||||
const targetPosition = parseGroupAnchorPosition(targetGroupPosition, "top");
|
||||
return { totalSegments: isExterior ? 2 : 4, targetPosition };
|
||||
} else {
|
||||
const isExterior =
|
||||
targetGroupPosition.x < sourceGroupPosition.x - elementWidth ||
|
||||
targetGroupPosition.x > sourceGroupPosition.x + elementWidth;
|
||||
const targetPosition = parseGroupAnchorPosition(
|
||||
targetGroupPosition,
|
||||
isTargetGroupToTheRight ? "right" : "left",
|
||||
targetOffsetY,
|
||||
);
|
||||
return { totalSegments: isExterior ? 3 : 5, targetPosition };
|
||||
}
|
||||
const isExterior =
|
||||
targetGroupPosition.x < sourceGroupPosition.x - elementWidth ||
|
||||
targetGroupPosition.x > sourceGroupPosition.x + elementWidth;
|
||||
const targetPosition = parseGroupAnchorPosition(
|
||||
targetGroupPosition,
|
||||
isTargetGroupToTheRight ? "right" : "left",
|
||||
targetOffsetY,
|
||||
);
|
||||
return { totalSegments: isExterior ? 3 : 5, targetPosition };
|
||||
};
|
||||
|
||||
const parseGroupAnchorPosition = (
|
||||
|
||||
@ -13,12 +13,11 @@ export const useHoverExpandDebounce = (
|
||||
setIsExpanded(true);
|
||||
}, 500);
|
||||
return () => clearTimeout(timeout);
|
||||
} else {
|
||||
const timeout = setTimeout(() => {
|
||||
setIsExpanded(false);
|
||||
}, 300);
|
||||
return () => clearTimeout(timeout);
|
||||
}
|
||||
const timeout = setTimeout(() => {
|
||||
setIsExpanded(false);
|
||||
}, 300);
|
||||
return () => clearTimeout(timeout);
|
||||
}, [isHovered, enabled]);
|
||||
|
||||
return {
|
||||
|
||||
@ -103,7 +103,7 @@ export const WhatsAppPreviewInstructions = ({
|
||||
)}
|
||||
{isMessageSent && (
|
||||
<div className="flex flex-col gap-2 animate-in fade-in-0 slide-in-from-bottom-2">
|
||||
<ButtonLink href={`https://web.whatsapp.com/`} target="_blank">
|
||||
<ButtonLink href={"https://web.whatsapp.com/"} target="_blank">
|
||||
Open WhatsApp Web
|
||||
<ArrowUpRight01Icon />
|
||||
</ButtonLink>
|
||||
|
||||
@ -40,7 +40,7 @@ export const SharePage = () => {
|
||||
if (!typebot?.customDomain) return;
|
||||
const existingHost = typebot.customDomain?.split("/")[0];
|
||||
const newDomain =
|
||||
pathname === "" ? existingHost : existingHost + "/" + pathname;
|
||||
pathname === "" ? existingHost : `${existingHost}/${pathname}`;
|
||||
handleCustomDomainChange(newDomain);
|
||||
};
|
||||
|
||||
@ -108,7 +108,7 @@ export const SharePage = () => {
|
||||
{typebot?.customDomain && (
|
||||
<div className="flex items-center gap-2">
|
||||
<EditableUrl
|
||||
hostname={"https://" + typebot.customDomain.split("/")[0]}
|
||||
hostname={`https://${typebot.customDomain.split("/")[0]}`}
|
||||
pathname={typebot.customDomain.split("/")[1]}
|
||||
isValid={checkIfPathnameIsValid}
|
||||
onPathnameChange={handlePathnameChange}
|
||||
|
||||
@ -3,7 +3,7 @@ import { CodeEditor } from "@/components/inputs/CodeEditor";
|
||||
export const InstallNextjsPackageSnippet = () => {
|
||||
return (
|
||||
<CodeEditor
|
||||
value={`npm install @typebot.io/react`}
|
||||
value={"npm install @typebot.io/react"}
|
||||
isReadOnly
|
||||
lang="shell"
|
||||
/>
|
||||
|
||||
@ -3,7 +3,7 @@ import { CodeEditor } from "@/components/inputs/CodeEditor";
|
||||
export const InstallReactPackageSnippet = () => {
|
||||
return (
|
||||
<CodeEditor
|
||||
value={`npm install @typebot.io/react`}
|
||||
value={"npm install @typebot.io/react"}
|
||||
isReadOnly
|
||||
lang="shell"
|
||||
/>
|
||||
|
||||
@ -16,21 +16,21 @@ export const NextjsLogo = (props: React.SVGProps<SVGSVGElement>) => (
|
||||
x="0"
|
||||
y="0"
|
||||
>
|
||||
<circle cx="90" cy="90" fill="black" r="90"></circle>
|
||||
<circle cx="90" cy="90" fill="black" r="90" />
|
||||
</mask>
|
||||
<g mask="url(#:R0:mask0_408_134)">
|
||||
<circle cx="90" cy="90" data-circle="true" fill="black" r="90"></circle>
|
||||
<circle cx="90" cy="90" data-circle="true" fill="black" r="90" />
|
||||
<path
|
||||
d="M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z"
|
||||
fill="url(#:R0:paint0_linear_408_134)"
|
||||
></path>
|
||||
/>
|
||||
<rect
|
||||
fill="url(#:R0:paint1_linear_408_134)"
|
||||
height="72"
|
||||
width="12"
|
||||
x="115"
|
||||
y="54"
|
||||
></rect>
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient
|
||||
@ -41,8 +41,8 @@ export const NextjsLogo = (props: React.SVGProps<SVGSVGElement>) => (
|
||||
y1="116.5"
|
||||
y2="160.5"
|
||||
>
|
||||
<stop stopColor="white"></stop>
|
||||
<stop offset="1" stopColor="white" stopOpacity="0"></stop>
|
||||
<stop stopColor="white" />
|
||||
<stop offset="1" stopColor="white" stopOpacity="0" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
@ -52,8 +52,8 @@ export const NextjsLogo = (props: React.SVGProps<SVGSVGElement>) => (
|
||||
y1="54"
|
||||
y2="106.875"
|
||||
>
|
||||
<stop stopColor="white"></stop>
|
||||
<stop offset="1" stopColor="white" stopOpacity="0"></stop>
|
||||
<stop stopColor="white" />
|
||||
<stop offset="1" stopColor="white" stopOpacity="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
@ -20,7 +20,7 @@ export const parseStringParam = (
|
||||
export const parseNumberOrBoolParam = (
|
||||
fieldName: string,
|
||||
fieldValue?: number | boolean,
|
||||
) => (isDefined(fieldValue) ? `${fieldName}: ${fieldValue},` : ``);
|
||||
) => (isDefined(fieldValue) ? `${fieldName}: ${fieldValue},` : "");
|
||||
|
||||
export const parseBotProps = ({
|
||||
typebot,
|
||||
@ -38,12 +38,12 @@ export const parseBotProps = ({
|
||||
export const parseReactStringParam = (
|
||||
fieldName: string,
|
||||
fieldValue?: string,
|
||||
) => (fieldValue ? `${fieldName}="${fieldValue}"` : ``);
|
||||
) => (fieldValue ? `${fieldName}="${fieldValue}"` : "");
|
||||
|
||||
export const parseReactNumberOrBoolParam = (
|
||||
fieldName: string,
|
||||
fieldValue?: number | boolean,
|
||||
) => (isDefined(fieldValue) ? `${fieldName}={${fieldValue}}` : ``);
|
||||
) => (isDefined(fieldValue) ? `${fieldName}={${fieldValue}}` : "");
|
||||
|
||||
export const parseReactBotProps = ({
|
||||
typebot,
|
||||
|
||||
@ -26,7 +26,7 @@ const Cell = ({
|
||||
key={cell.id}
|
||||
style={
|
||||
{
|
||||
"--size": size + "px",
|
||||
"--size": `${size}px`,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
className={cx(
|
||||
|
||||
@ -15,7 +15,7 @@ export const HeaderRow = ({ headerGroup }: Props) => {
|
||||
key={header.id}
|
||||
style={
|
||||
{
|
||||
"--size": header.getSize() + "px",
|
||||
"--size": `${header.getSize()}px`,
|
||||
} as React.CSSProperties
|
||||
}
|
||||
className="px-4 py-3 bg-gray-1 z-10 sticky top-0 font-normal whitespace-nowrap word-break-normal border-t border-b border-r first:border-l"
|
||||
|
||||
@ -89,8 +89,8 @@ export const ThemeTemplateCard = ({
|
||||
style={
|
||||
{
|
||||
"--tw-shadow": isSelected
|
||||
? `rgb(var(--orange-8)) 0 0 0 2px`
|
||||
: `rgba(0, 0, 0, 0.08) 0px 2px 2px`,
|
||||
? "rgb(var(--orange-8)) 0 0 0 2px"
|
||||
: "rgba(0, 0, 0, 0.08) 0px 2px 2px",
|
||||
"--rounded":
|
||||
themeTemplate.theme.chat?.roundness === "large"
|
||||
? "md"
|
||||
|
||||
@ -206,7 +206,7 @@ export const galleryTemplates: (Pick<ThemeTemplate, "id" | "name" | "theme"> & {
|
||||
},
|
||||
background: {
|
||||
type: BackgroundType.IMAGE,
|
||||
content: getOrigin() + "/images/backgrounds/brightRain.jpeg",
|
||||
content: `${getOrigin()}/images/backgrounds/brightRain.jpeg`,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -231,7 +231,7 @@ export const galleryTemplates: (Pick<ThemeTemplate, "id" | "name" | "theme"> & {
|
||||
},
|
||||
background: {
|
||||
type: BackgroundType.IMAGE,
|
||||
content: getOrigin() + "/images/backgrounds/rayOfLights.jpeg",
|
||||
content: `${getOrigin()}/images/backgrounds/rayOfLights.jpeg`,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -15,8 +15,7 @@ export const injectVariableInText = ({
|
||||
}: Props): { text: string; carretPosition: number } => {
|
||||
const textBeforeCursorPosition = text.substring(0, start);
|
||||
const textAfterCursorPosition = text.substring(end, text.length);
|
||||
const newText =
|
||||
textBeforeCursorPosition + `{{${variable.name}}}` + textAfterCursorPosition;
|
||||
const newText = `${textBeforeCursorPosition}{{${variable.name}}}${textAfterCursorPosition}`;
|
||||
const newCarretPosition = start + `{{${variable.name}}}`.length;
|
||||
return {
|
||||
text: newText,
|
||||
|
||||
@ -71,7 +71,7 @@ function useEventListener<
|
||||
// Define the listening target
|
||||
const targetElement: T | Window = element?.current ?? window;
|
||||
|
||||
if (!(targetElement && targetElement.addEventListener)) return;
|
||||
if (!targetElement?.addEventListener) return;
|
||||
|
||||
// Create event listener that calls handler function stored in ref
|
||||
const listener: typeof handler = (event) => {
|
||||
|
||||
@ -19,7 +19,8 @@ export function middleware(req: NextRequest) {
|
||||
url.pathname = isMostLikelySignedIn ? toSignedIn : toSignin;
|
||||
|
||||
return NextResponse.redirect(url);
|
||||
} else if (pathname === "/typebots") {
|
||||
}
|
||||
if (pathname === "/typebots") {
|
||||
const callbackUrl = searchParams.get("callbackUrl");
|
||||
const redirectPath = sanitizeRedirectPath(
|
||||
searchParams.get("redirectPath") ??
|
||||
|
||||
@ -15,7 +15,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
return {
|
||||
redirect: {
|
||||
permanent: false,
|
||||
destination: `/signin?redirectPath=%2Ffeedback`,
|
||||
destination: "/signin?redirectPath=%2Ffeedback",
|
||||
},
|
||||
};
|
||||
const sleekplanToken = createSSOToken(session?.user as Prisma.User);
|
||||
|
||||
@ -4,8 +4,8 @@ export const breakpoints = {
|
||||
|
||||
export const currentBaseUrl = "https://typebot.io";
|
||||
export const signinUrl = "https://app.typebot.io/signin";
|
||||
export const registerUrl = `https://app.typebot.io/register`;
|
||||
export const dashboardUrl = `https://app.typebot.io/typebots`;
|
||||
export const registerUrl = "https://app.typebot.io/register";
|
||||
export const dashboardUrl = "https://app.typebot.io/typebots";
|
||||
export const githubRepoUrl = "https://github.com/baptisteArno/typebot.io";
|
||||
export const blueskyUrl = "https://bsky.app/profile/typebot.io";
|
||||
export const linkedInUrl = "https://www.linkedin.com/company/typebot";
|
||||
|
||||
@ -165,7 +165,9 @@ const FeatureCard = ({
|
||||
style={style}
|
||||
>
|
||||
<div
|
||||
className={`size-16 flex items-center justify-center rounded-2xl bg-cover`}
|
||||
className={
|
||||
"size-16 flex items-center justify-center rounded-2xl bg-cover"
|
||||
}
|
||||
style={{
|
||||
backgroundImage: `url('${bgImageSrcs[index]}')`,
|
||||
}}
|
||||
@ -186,7 +188,8 @@ const Dots = () => (
|
||||
style={{
|
||||
animation: "fade-in ease-out forwards, fade-out ease-out forwards",
|
||||
animationTimeline: "--cards-container",
|
||||
animationRange: `exit-crossing 0% exit-crossing 10%, exit-crossing 80% exit-crossing 90%`,
|
||||
animationRange:
|
||||
"exit-crossing 0% exit-crossing 10%, exit-crossing 80% exit-crossing 90%",
|
||||
}}
|
||||
>
|
||||
{cards.map((card, index) => (
|
||||
|
||||
@ -967,14 +967,14 @@ export const Shadow = (props: SVGProps<SVGSVGElement>) => (
|
||||
>
|
||||
<title>Logos</title>
|
||||
<g>
|
||||
<path d="M12.4263 11.3369C14.9971 11.3369 15.5768 10.0492 15.5768 8.81204H6.78061C5.07934 8.81204 3 10.1123 3 12.5993C3 15.0862 5.11714 16.3865 6.78061 16.3865H11.8214C12.294 16.3865 13.0816 16.7589 13.0816 17.6489C13.0816 18.5389 12.2688 18.9113 11.8214 18.9113H3C3 20.3189 4.235 21.4361 5.77245 21.4361H11.8214C13.6613 21.4361 15.602 20.0222 15.602 17.6489C15.602 15.2756 13.7117 13.8617 11.8214 13.8617H6.78061C6.20722 13.8617 5.52041 13.3883 5.52041 12.5993C5.52041 11.8103 6.18201 11.3369 6.78061 11.3369H12.4263Z"></path>
|
||||
<path d="M16.9883 5.2773C16.9883 3.03021 19.5087 2.5 19.5087 2.5V10.0871C19.5087 10.0871 20.9264 8.81204 23.2893 8.81204C26.2067 8.71736 29.5903 11.2169 29.5903 15.1241V21.4361H27.0699V15.5912C27.0699 12.4667 24.8141 11.4126 23.2893 11.4126C22.237 11.4126 19.5087 12.0059 19.5087 16.1214V21.4361H16.9883V5.2773Z"></path>
|
||||
<path d="M30.9765 15.1241C30.9765 11.8103 33.6293 8.81204 37.2775 8.81204C40.9258 8.81204 43.5786 11.8355 43.5786 15.1241V21.4361C43.5786 21.4361 41.0235 21.2404 41.0582 18.7409C41.0666 18.1349 41.0582 17.0682 41.0582 15.1241C41.0582 13.18 39.4829 11.3369 37.2775 11.3369C35.0722 11.3369 33.4969 13.18 33.4969 15.1241C33.4969 17.0682 35.047 18.9113 37.2775 18.9113C39.1805 18.9113 40.0815 20.6029 40.0878 21.4361H37.2775C33.604 21.4361 30.9765 18.4379 30.9765 15.1241Z"></path>
|
||||
<path d="M57.5668 5.2773C57.5668 2.75248 55.0464 2.5 55.0464 2.5V15.1241C55.0464 17.428 53.1561 18.9113 51.2658 18.9113C49.3755 18.9113 47.4852 17.4406 47.4852 15.1241C47.4852 13.4092 48.8777 11.3369 51.2532 11.3369C53.6287 11.3369 53.824 9.36119 53.824 9.36119C53.824 9.36119 52.8537 8.81204 51.0453 8.81204C47.8633 8.81204 44.9648 11.5893 44.9648 15.1241C44.9648 18.1475 47.3655 21.4361 51.2658 21.4361C55.1661 21.4361 57.5668 18.1602 57.5668 15.1241V5.2773Z"></path>
|
||||
<path d="M68.2752 12.8702C68.6522 13.381 69.0347 14.1413 69.0347 15.1241C69.0347 17.3649 67.1444 18.9113 65.2541 18.9113C63.3638 18.9113 61.4735 17.3522 61.4735 15.1241C61.4735 13.4092 62.866 11.3369 65.2415 11.3369C67.6169 11.3369 67.8375 9.38012 67.8375 9.38012C67.8375 9.38012 66.9112 8.81204 65.0335 8.81204C62.4438 8.81204 58.953 11.0528 58.953 15.1241C58.953 18.1475 61.3537 21.4361 65.2541 21.4361C69.1544 21.4361 71.5551 18.1602 71.5551 15.1241C71.5551 13.1168 70.6252 11.6959 69.9579 10.9346L68.2752 12.8702Z"></path>
|
||||
<path d="M68.2752 12.8702L68.2276 12.8288L68.1945 12.867L68.2245 12.9077L68.2752 12.8702ZM67.8375 9.38012L67.9001 9.38721L67.9046 9.34728L67.8704 9.3263L67.8375 9.38012ZM69.9579 10.9346L70.0052 10.893L69.9576 10.8387L69.9103 10.8932L69.9579 10.9346ZM68.2245 12.9077C68.596 13.411 68.9717 14.1585 68.9717 15.1241H69.0977C69.0977 14.1241 68.7084 13.3509 68.3258 12.8327L68.2245 12.9077ZM68.9717 15.1241C68.9717 17.3264 67.1134 18.8482 65.2541 18.8482V18.9744C67.1754 18.9744 69.0977 17.4034 69.0977 15.1241H68.9717ZM65.2541 18.8482C63.3949 18.8482 61.5365 17.3139 61.5365 15.1241H61.4104C61.4104 17.3906 63.3326 18.9744 65.2541 18.9744V18.8482ZM61.5365 15.1241C61.5365 13.4364 62.9079 11.4 65.2415 11.4V11.2737C62.824 11.2737 61.4104 13.382 61.4104 15.1241H61.5365ZM65.2415 11.4C66.4497 11.4 67.1177 10.9008 67.4814 10.3954C67.6623 10.1441 67.7667 9.89304 67.826 9.70487C67.8556 9.61069 67.8742 9.53202 67.8851 9.47657C67.8907 9.44884 67.8943 9.42688 67.8967 9.41167C67.8979 9.40407 67.8987 9.39815 67.8992 9.39402C67.8995 9.39197 67.8997 9.39036 67.8999 9.38923C67.9 9.38865 67.9 9.38819 67.9 9.38786C67.9 9.38769 67.9001 9.38755 67.9001 9.38745C67.9001 9.38738 67.9001 9.38731 67.9001 9.38731C67.9001 9.38724 67.9001 9.38721 67.8375 9.38012C67.7748 9.37304 67.7748 9.37299 67.7748 9.37299C67.7748 9.37299 67.7748 9.37303 67.7748 9.3731C67.7748 9.37324 67.7748 9.3735 67.7747 9.37386C67.7747 9.37461 67.7745 9.37581 67.7743 9.37745C67.7738 9.38073 67.7732 9.3858 67.7722 9.39252C67.7701 9.40598 67.7667 9.42606 67.7616 9.45184C67.7513 9.5034 67.7339 9.57759 67.7058 9.66687C67.6495 9.84557 67.5504 10.0837 67.3791 10.3216C67.0388 10.7946 66.4087 11.2737 65.2415 11.2737V11.4ZM67.8375 9.38012C67.8704 9.3263 67.8704 9.32626 67.8704 9.32626C67.8702 9.32624 67.8702 9.32621 67.8702 9.32621C67.8702 9.32617 67.8701 9.32613 67.87 9.32607C67.8699 9.32597 67.8696 9.32583 67.8694 9.32565C67.8687 9.3253 67.868 9.32482 67.8668 9.3242C67.8648 9.32298 67.8618 9.32122 67.858 9.31899C67.8502 9.31453 67.8387 9.30812 67.8237 9.30005C67.7936 9.28393 67.7489 9.26115 67.6897 9.23396C67.5711 9.17959 67.3939 9.10756 67.158 9.03569C66.686 8.89193 65.9788 8.74892 65.0335 8.74892V8.87516C65.966 8.87516 66.6607 9.0162 67.1213 9.15648C67.3517 9.22663 67.5234 9.29662 67.6372 9.34875C67.6941 9.37482 67.7364 9.39643 67.7643 9.41137C67.7783 9.41884 67.7886 9.42465 67.7953 9.4285C67.7987 9.43043 67.8011 9.43187 67.8026 9.43279C67.8035 9.43325 67.804 9.43359 67.8043 9.43378C67.8045 9.43388 67.8046 9.43397 67.8046 9.43397C67.8046 9.43397 67.8046 9.43395 67.8375 9.38012ZM65.0335 8.74892C62.416 8.74892 58.89 11.0114 58.89 15.1241H59.0161C59.0161 11.0943 62.4717 8.87516 65.0335 8.87516V8.74892ZM58.89 15.1241C58.89 18.1766 61.3134 21.4992 65.2541 21.4992V21.373C61.3941 21.373 59.0161 18.1185 59.0161 15.1241H58.89ZM65.2541 21.4992C69.1947 21.4992 71.6181 18.1892 71.6181 15.1241H71.4921C71.4921 18.1311 69.1141 21.373 65.2541 21.373V21.4992ZM71.6181 15.1241C71.6181 13.0962 70.6786 11.6611 70.0052 10.893L69.9105 10.9763C70.5719 11.7307 71.4921 13.1374 71.4921 15.1241H71.6181ZM69.9103 10.8932L68.2276 12.8288L68.3227 12.9117L70.0054 10.9761L69.9103 10.8932Z"></path>
|
||||
<path d="M73.2092 7.18188L71.3134 9.3627L75.9658 21.3604L79.4188 12.4478L82.8843 21.3604L87.6983 8.88778C87.6983 8.88778 85.2283 8.2124 84.3525 10.4342L82.8717 14.2783L80.7483 8.79942H78.064L75.9469 14.2783L73.2092 7.18188Z"></path>
|
||||
<path d="M73.2092 7.18188L73.2562 7.16368L73.2261 7.08556L73.1712 7.14872L73.2092 7.18188ZM71.3134 9.3627L71.2753 9.32954L71.2554 9.35254L71.2664 9.38098L71.3134 9.3627ZM75.9658 21.3604L75.9188 21.3787L75.9658 21.4999L76.0128 21.3787L75.9658 21.3604ZM79.4188 12.4478L79.4658 12.4294L79.4186 12.3084L79.3717 12.4295L79.4188 12.4478ZM82.8843 21.3604L82.8373 21.3787L82.8844 21.5L82.9313 21.3786L82.8843 21.3604ZM87.6983 8.88778L87.7453 8.906L87.7655 8.85381L87.7115 8.83907L87.6983 8.88778ZM84.3525 10.4342L84.3056 10.4157L84.3054 10.4159V10.4161L84.3525 10.4342ZM82.8717 14.2783L82.8247 14.2965L82.8718 14.4182L82.9187 14.2964L82.8717 14.2783ZM80.7483 8.79942L80.7953 8.78114L80.7828 8.74892H80.7483V8.79942ZM78.064 8.79942V8.74892H78.0295L78.017 8.78119L78.064 8.79942ZM75.9469 14.2783L75.8999 14.2965L75.9469 14.4183L75.9939 14.2965L75.9469 14.2783ZM73.1712 7.14872L71.2753 9.32954L71.3514 9.39587L73.2472 7.21504L73.1712 7.14872ZM71.2664 9.38098L75.9188 21.3787L76.0128 21.3421L71.3604 9.34441L71.2664 9.38098ZM76.0128 21.3787L79.4658 12.466L79.3717 12.4295L75.9188 21.3421L76.0128 21.3787ZM79.3717 12.4661L82.8373 21.3787L82.9313 21.3421L79.4658 12.4294L79.3717 12.4661ZM82.9313 21.3786L87.7453 8.906L87.6513 8.86958L82.8373 21.3422L82.9313 21.3786ZM87.6983 8.88778C87.7115 8.83907 87.7115 8.83907 87.7115 8.83907L87.7114 8.83902C87.7113 8.83899 87.7112 8.83895 87.7109 8.8389C87.7106 8.8388 87.71 8.83867 87.7094 8.8385C87.7081 8.83815 87.7062 8.83764 87.7037 8.83701C87.6988 8.83574 87.6915 8.83391 87.6822 8.83165C87.6633 8.82711 87.6358 8.82081 87.6005 8.81363C87.5301 8.79925 87.4287 8.7813 87.3045 8.76682C87.0562 8.73786 86.7155 8.7226 86.3463 8.77788C85.6065 8.88871 84.7517 9.28389 84.3056 10.4157L84.3993 10.4528C84.8291 9.36274 85.6472 8.98471 86.3612 8.87776C86.7191 8.82416 87.0506 8.83888 87.2929 8.86713C87.4139 8.88125 87.5123 8.89871 87.5803 8.91259C87.6144 8.91952 87.6408 8.92557 87.6586 8.92985C87.6674 8.93198 87.6742 8.93367 87.6786 8.93482C87.6809 8.9354 87.6825 8.93583 87.6835 8.93612C87.6842 8.93626 87.6846 8.93636 87.6848 8.93643C87.6848 8.93646 87.6849 8.93649 87.6849 8.93649C87.6851 8.9365 87.6851 8.9365 87.6851 8.9365C87.6851 8.9365 87.6851 8.9365 87.6983 8.88778ZM84.3054 10.4161L82.8247 14.2601L82.9187 14.2964L84.3995 10.4524L84.3054 10.4161ZM82.9187 14.26L80.7953 8.78114L80.7013 8.8177L82.8247 14.2965L82.9187 14.26ZM80.7483 8.74892H78.064V8.84991H80.7483V8.74892ZM78.017 8.78119L75.8999 14.26L75.9939 14.2965L78.111 8.81765L78.017 8.78119ZM75.9939 14.2601L73.2562 7.16368L73.1622 7.20008L75.8999 14.2965L75.9939 14.2601Z"></path>
|
||||
<path d="M12.4263 11.3369C14.9971 11.3369 15.5768 10.0492 15.5768 8.81204H6.78061C5.07934 8.81204 3 10.1123 3 12.5993C3 15.0862 5.11714 16.3865 6.78061 16.3865H11.8214C12.294 16.3865 13.0816 16.7589 13.0816 17.6489C13.0816 18.5389 12.2688 18.9113 11.8214 18.9113H3C3 20.3189 4.235 21.4361 5.77245 21.4361H11.8214C13.6613 21.4361 15.602 20.0222 15.602 17.6489C15.602 15.2756 13.7117 13.8617 11.8214 13.8617H6.78061C6.20722 13.8617 5.52041 13.3883 5.52041 12.5993C5.52041 11.8103 6.18201 11.3369 6.78061 11.3369H12.4263Z" />
|
||||
<path d="M16.9883 5.2773C16.9883 3.03021 19.5087 2.5 19.5087 2.5V10.0871C19.5087 10.0871 20.9264 8.81204 23.2893 8.81204C26.2067 8.71736 29.5903 11.2169 29.5903 15.1241V21.4361H27.0699V15.5912C27.0699 12.4667 24.8141 11.4126 23.2893 11.4126C22.237 11.4126 19.5087 12.0059 19.5087 16.1214V21.4361H16.9883V5.2773Z" />
|
||||
<path d="M30.9765 15.1241C30.9765 11.8103 33.6293 8.81204 37.2775 8.81204C40.9258 8.81204 43.5786 11.8355 43.5786 15.1241V21.4361C43.5786 21.4361 41.0235 21.2404 41.0582 18.7409C41.0666 18.1349 41.0582 17.0682 41.0582 15.1241C41.0582 13.18 39.4829 11.3369 37.2775 11.3369C35.0722 11.3369 33.4969 13.18 33.4969 15.1241C33.4969 17.0682 35.047 18.9113 37.2775 18.9113C39.1805 18.9113 40.0815 20.6029 40.0878 21.4361H37.2775C33.604 21.4361 30.9765 18.4379 30.9765 15.1241Z" />
|
||||
<path d="M57.5668 5.2773C57.5668 2.75248 55.0464 2.5 55.0464 2.5V15.1241C55.0464 17.428 53.1561 18.9113 51.2658 18.9113C49.3755 18.9113 47.4852 17.4406 47.4852 15.1241C47.4852 13.4092 48.8777 11.3369 51.2532 11.3369C53.6287 11.3369 53.824 9.36119 53.824 9.36119C53.824 9.36119 52.8537 8.81204 51.0453 8.81204C47.8633 8.81204 44.9648 11.5893 44.9648 15.1241C44.9648 18.1475 47.3655 21.4361 51.2658 21.4361C55.1661 21.4361 57.5668 18.1602 57.5668 15.1241V5.2773Z" />
|
||||
<path d="M68.2752 12.8702C68.6522 13.381 69.0347 14.1413 69.0347 15.1241C69.0347 17.3649 67.1444 18.9113 65.2541 18.9113C63.3638 18.9113 61.4735 17.3522 61.4735 15.1241C61.4735 13.4092 62.866 11.3369 65.2415 11.3369C67.6169 11.3369 67.8375 9.38012 67.8375 9.38012C67.8375 9.38012 66.9112 8.81204 65.0335 8.81204C62.4438 8.81204 58.953 11.0528 58.953 15.1241C58.953 18.1475 61.3537 21.4361 65.2541 21.4361C69.1544 21.4361 71.5551 18.1602 71.5551 15.1241C71.5551 13.1168 70.6252 11.6959 69.9579 10.9346L68.2752 12.8702Z" />
|
||||
<path d="M68.2752 12.8702L68.2276 12.8288L68.1945 12.867L68.2245 12.9077L68.2752 12.8702ZM67.8375 9.38012L67.9001 9.38721L67.9046 9.34728L67.8704 9.3263L67.8375 9.38012ZM69.9579 10.9346L70.0052 10.893L69.9576 10.8387L69.9103 10.8932L69.9579 10.9346ZM68.2245 12.9077C68.596 13.411 68.9717 14.1585 68.9717 15.1241H69.0977C69.0977 14.1241 68.7084 13.3509 68.3258 12.8327L68.2245 12.9077ZM68.9717 15.1241C68.9717 17.3264 67.1134 18.8482 65.2541 18.8482V18.9744C67.1754 18.9744 69.0977 17.4034 69.0977 15.1241H68.9717ZM65.2541 18.8482C63.3949 18.8482 61.5365 17.3139 61.5365 15.1241H61.4104C61.4104 17.3906 63.3326 18.9744 65.2541 18.9744V18.8482ZM61.5365 15.1241C61.5365 13.4364 62.9079 11.4 65.2415 11.4V11.2737C62.824 11.2737 61.4104 13.382 61.4104 15.1241H61.5365ZM65.2415 11.4C66.4497 11.4 67.1177 10.9008 67.4814 10.3954C67.6623 10.1441 67.7667 9.89304 67.826 9.70487C67.8556 9.61069 67.8742 9.53202 67.8851 9.47657C67.8907 9.44884 67.8943 9.42688 67.8967 9.41167C67.8979 9.40407 67.8987 9.39815 67.8992 9.39402C67.8995 9.39197 67.8997 9.39036 67.8999 9.38923C67.9 9.38865 67.9 9.38819 67.9 9.38786C67.9 9.38769 67.9001 9.38755 67.9001 9.38745C67.9001 9.38738 67.9001 9.38731 67.9001 9.38731C67.9001 9.38724 67.9001 9.38721 67.8375 9.38012C67.7748 9.37304 67.7748 9.37299 67.7748 9.37299C67.7748 9.37299 67.7748 9.37303 67.7748 9.3731C67.7748 9.37324 67.7748 9.3735 67.7747 9.37386C67.7747 9.37461 67.7745 9.37581 67.7743 9.37745C67.7738 9.38073 67.7732 9.3858 67.7722 9.39252C67.7701 9.40598 67.7667 9.42606 67.7616 9.45184C67.7513 9.5034 67.7339 9.57759 67.7058 9.66687C67.6495 9.84557 67.5504 10.0837 67.3791 10.3216C67.0388 10.7946 66.4087 11.2737 65.2415 11.2737V11.4ZM67.8375 9.38012C67.8704 9.3263 67.8704 9.32626 67.8704 9.32626C67.8702 9.32624 67.8702 9.32621 67.8702 9.32621C67.8702 9.32617 67.8701 9.32613 67.87 9.32607C67.8699 9.32597 67.8696 9.32583 67.8694 9.32565C67.8687 9.3253 67.868 9.32482 67.8668 9.3242C67.8648 9.32298 67.8618 9.32122 67.858 9.31899C67.8502 9.31453 67.8387 9.30812 67.8237 9.30005C67.7936 9.28393 67.7489 9.26115 67.6897 9.23396C67.5711 9.17959 67.3939 9.10756 67.158 9.03569C66.686 8.89193 65.9788 8.74892 65.0335 8.74892V8.87516C65.966 8.87516 66.6607 9.0162 67.1213 9.15648C67.3517 9.22663 67.5234 9.29662 67.6372 9.34875C67.6941 9.37482 67.7364 9.39643 67.7643 9.41137C67.7783 9.41884 67.7886 9.42465 67.7953 9.4285C67.7987 9.43043 67.8011 9.43187 67.8026 9.43279C67.8035 9.43325 67.804 9.43359 67.8043 9.43378C67.8045 9.43388 67.8046 9.43397 67.8046 9.43397C67.8046 9.43397 67.8046 9.43395 67.8375 9.38012ZM65.0335 8.74892C62.416 8.74892 58.89 11.0114 58.89 15.1241H59.0161C59.0161 11.0943 62.4717 8.87516 65.0335 8.87516V8.74892ZM58.89 15.1241C58.89 18.1766 61.3134 21.4992 65.2541 21.4992V21.373C61.3941 21.373 59.0161 18.1185 59.0161 15.1241H58.89ZM65.2541 21.4992C69.1947 21.4992 71.6181 18.1892 71.6181 15.1241H71.4921C71.4921 18.1311 69.1141 21.373 65.2541 21.373V21.4992ZM71.6181 15.1241C71.6181 13.0962 70.6786 11.6611 70.0052 10.893L69.9105 10.9763C70.5719 11.7307 71.4921 13.1374 71.4921 15.1241H71.6181ZM69.9103 10.8932L68.2276 12.8288L68.3227 12.9117L70.0054 10.9761L69.9103 10.8932Z" />
|
||||
<path d="M73.2092 7.18188L71.3134 9.3627L75.9658 21.3604L79.4188 12.4478L82.8843 21.3604L87.6983 8.88778C87.6983 8.88778 85.2283 8.2124 84.3525 10.4342L82.8717 14.2783L80.7483 8.79942H78.064L75.9469 14.2783L73.2092 7.18188Z" />
|
||||
<path d="M73.2092 7.18188L73.2562 7.16368L73.2261 7.08556L73.1712 7.14872L73.2092 7.18188ZM71.3134 9.3627L71.2753 9.32954L71.2554 9.35254L71.2664 9.38098L71.3134 9.3627ZM75.9658 21.3604L75.9188 21.3787L75.9658 21.4999L76.0128 21.3787L75.9658 21.3604ZM79.4188 12.4478L79.4658 12.4294L79.4186 12.3084L79.3717 12.4295L79.4188 12.4478ZM82.8843 21.3604L82.8373 21.3787L82.8844 21.5L82.9313 21.3786L82.8843 21.3604ZM87.6983 8.88778L87.7453 8.906L87.7655 8.85381L87.7115 8.83907L87.6983 8.88778ZM84.3525 10.4342L84.3056 10.4157L84.3054 10.4159V10.4161L84.3525 10.4342ZM82.8717 14.2783L82.8247 14.2965L82.8718 14.4182L82.9187 14.2964L82.8717 14.2783ZM80.7483 8.79942L80.7953 8.78114L80.7828 8.74892H80.7483V8.79942ZM78.064 8.79942V8.74892H78.0295L78.017 8.78119L78.064 8.79942ZM75.9469 14.2783L75.8999 14.2965L75.9469 14.4183L75.9939 14.2965L75.9469 14.2783ZM73.1712 7.14872L71.2753 9.32954L71.3514 9.39587L73.2472 7.21504L73.1712 7.14872ZM71.2664 9.38098L75.9188 21.3787L76.0128 21.3421L71.3604 9.34441L71.2664 9.38098ZM76.0128 21.3787L79.4658 12.466L79.3717 12.4295L75.9188 21.3421L76.0128 21.3787ZM79.3717 12.4661L82.8373 21.3787L82.9313 21.3421L79.4658 12.4294L79.3717 12.4661ZM82.9313 21.3786L87.7453 8.906L87.6513 8.86958L82.8373 21.3422L82.9313 21.3786ZM87.6983 8.88778C87.7115 8.83907 87.7115 8.83907 87.7115 8.83907L87.7114 8.83902C87.7113 8.83899 87.7112 8.83895 87.7109 8.8389C87.7106 8.8388 87.71 8.83867 87.7094 8.8385C87.7081 8.83815 87.7062 8.83764 87.7037 8.83701C87.6988 8.83574 87.6915 8.83391 87.6822 8.83165C87.6633 8.82711 87.6358 8.82081 87.6005 8.81363C87.5301 8.79925 87.4287 8.7813 87.3045 8.76682C87.0562 8.73786 86.7155 8.7226 86.3463 8.77788C85.6065 8.88871 84.7517 9.28389 84.3056 10.4157L84.3993 10.4528C84.8291 9.36274 85.6472 8.98471 86.3612 8.87776C86.7191 8.82416 87.0506 8.83888 87.2929 8.86713C87.4139 8.88125 87.5123 8.89871 87.5803 8.91259C87.6144 8.91952 87.6408 8.92557 87.6586 8.92985C87.6674 8.93198 87.6742 8.93367 87.6786 8.93482C87.6809 8.9354 87.6825 8.93583 87.6835 8.93612C87.6842 8.93626 87.6846 8.93636 87.6848 8.93643C87.6848 8.93646 87.6849 8.93649 87.6849 8.93649C87.6851 8.9365 87.6851 8.9365 87.6851 8.9365C87.6851 8.9365 87.6851 8.9365 87.6983 8.88778ZM84.3054 10.4161L82.8247 14.2601L82.9187 14.2964L84.3995 10.4524L84.3054 10.4161ZM82.9187 14.26L80.7953 8.78114L80.7013 8.8177L82.8247 14.2965L82.9187 14.26ZM80.7483 8.74892H78.064V8.84991H80.7483V8.74892ZM78.017 8.78119L75.8999 14.26L75.9939 14.2965L78.111 8.81765L78.017 8.78119ZM75.9939 14.2601L73.2562 7.16368L73.1622 7.20008L75.8999 14.2965L75.9939 14.2601Z" />
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
|
||||
@ -104,7 +104,7 @@ const FloatingAvatars = ({ className }: { className?: string }) => (
|
||||
src={src}
|
||||
alt={alt}
|
||||
className={cx(
|
||||
`rounded-full w-16 h-16 border-4 absolute animate-float`,
|
||||
"rounded-full w-16 h-16 border-4 absolute animate-float",
|
||||
position,
|
||||
)}
|
||||
/>
|
||||
|
||||
@ -77,12 +77,11 @@ export const UseCases = ({ className }: { className?: string }) => {
|
||||
setCurrentUseCase((prev) => {
|
||||
if (prev.value < 100) {
|
||||
return { ...prev, value: prev.value + 1 };
|
||||
} else {
|
||||
return {
|
||||
index: prev.index === useCases.length - 1 ? 0 : prev.index + 1,
|
||||
value: 0,
|
||||
};
|
||||
}
|
||||
return {
|
||||
index: prev.index === useCases.length - 1 ? 0 : prev.index + 1,
|
||||
value: 0,
|
||||
};
|
||||
});
|
||||
}, 100);
|
||||
|
||||
|
||||
@ -36,20 +36,24 @@ function RouteComponent() {
|
||||
(a, b) =>
|
||||
new Date(b.postedAt!).getTime() - new Date(a.postedAt!).getTime(),
|
||||
)
|
||||
.map((post) => (
|
||||
<li key={post._meta.path}>
|
||||
<Link to={"/" + post._meta.path}>
|
||||
<Card>
|
||||
<time className="text-foreground/50">
|
||||
{formatDate(post.postedAt!)}
|
||||
</time>
|
||||
<h3>{post.title}</h3>
|
||||
<p>{post.description}</p>
|
||||
<p className="font-medium underline">Read more</p>
|
||||
</Card>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
.map((post) => {
|
||||
const slug = post._meta.path.split("/").at(-1) ?? post._meta.path;
|
||||
|
||||
return (
|
||||
<li key={post._meta.path}>
|
||||
<Link to="/blog/$slug" params={{ slug }}>
|
||||
<Card>
|
||||
<time className="text-foreground/50">
|
||||
{formatDate(post.postedAt!)}
|
||||
</time>
|
||||
<h3>{post.title}</h3>
|
||||
<p>{post.description}</p>
|
||||
<p className="font-medium underline">Read more</p>
|
||||
</Card>
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
</ContentPageWrapper>
|
||||
);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { resolve } from "node:path";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
||||
import { resolve } from "path";
|
||||
import { defineConfig } from "vite";
|
||||
import viteTsConfigPaths from "vite-tsconfig-paths";
|
||||
import contentCollections from "./content-collection-vite-plugin";
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { dirname, join } from "node:path";
|
||||
import { withSentryConfig } from "@sentry/nextjs";
|
||||
import { dirname, join } from "path";
|
||||
import "@typebot.io/env/compiled";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { configureRuntimeEnv } from "next-runtime-env/build/configure.js";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { resolve } from "node:path";
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
import { resolve } from "path";
|
||||
|
||||
require("dotenv").config({ path: resolve(__dirname, "../../.env") });
|
||||
|
||||
|
||||
@ -17,4 +17,4 @@ const authenticateByToken = async (
|
||||
};
|
||||
|
||||
const extractBearerToken = (req: NextApiRequest) =>
|
||||
req.headers["authorization"]?.slice(7);
|
||||
req.headers.authorization?.slice(7);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import type { IncomingMessage } from "node:http";
|
||||
import { env } from "@typebot.io/env";
|
||||
import { isNotDefined } from "@typebot.io/lib/utils";
|
||||
import prisma from "@typebot.io/prisma";
|
||||
@ -10,7 +11,6 @@ import {
|
||||
} from "@typebot.io/theme/constants";
|
||||
import { themeSchema } from "@typebot.io/theme/schemas";
|
||||
import type { PublicTypebot } from "@typebot.io/typebot/schemas/publicTypebot";
|
||||
import type { IncomingMessage } from "http";
|
||||
import type { GetServerSideProps, GetServerSidePropsContext } from "next";
|
||||
import { ErrorPage } from "@/components/ErrorPage";
|
||||
import { NotFoundPage } from "@/components/NotFoundPage";
|
||||
@ -46,10 +46,7 @@ export const getServerSideProps: GetServerSideProps = async (
|
||||
const isMatchingViewerUrl = viewerUrls.some(
|
||||
(url) =>
|
||||
host.split(":")[0].includes(url.split("//")[1].split(":")[0]) ||
|
||||
(forwardedHost &&
|
||||
forwardedHost
|
||||
.split(":")[0]
|
||||
.includes(url.split("//")[1].split(":")[0])),
|
||||
forwardedHost?.split(":")[0].includes(url.split("//")[1].split(":")[0]),
|
||||
);
|
||||
log(`isMatchingViewerUrl: ${isMatchingViewerUrl}`);
|
||||
if (isMatchingViewerUrl && pathname === "/") {
|
||||
|
||||
@ -258,7 +258,7 @@ test("API chat execution should work on published bot", async ({ request }) => {
|
||||
await test.step("Starting with a message when typebot starts with input should proceed", async () => {
|
||||
const response = await (
|
||||
await request.post(
|
||||
`/api/v1/typebots/starting-with-input-public/startChat`,
|
||||
"/api/v1/typebots/starting-with-input-public/startChat",
|
||||
{
|
||||
data: {
|
||||
//@ts-expect-error We want to test if message is correctly preprocessed by zod
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { createId } from "@paralleldrive/cuid2";
|
||||
import test, { expect } from "@playwright/test";
|
||||
import { env } from "@typebot.io/env";
|
||||
import { isDefined } from "@typebot.io/lib/utils";
|
||||
import { importTypebotInDatabase } from "@typebot.io/playwright/databaseActions";
|
||||
import { readFileSync } from "fs";
|
||||
import { parse } from "papaparse";
|
||||
import { getTestAsset } from "@/test/utils/playwright";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import path from "path";
|
||||
import path from "node:path";
|
||||
|
||||
export const getTestAsset = (name: string) =>
|
||||
path.join(__dirname, "..", "assets", name);
|
||||
|
||||
12
biome.json
12
biome.json
@ -40,11 +40,6 @@
|
||||
},
|
||||
"style": {
|
||||
"noNonNullAssertion": "off",
|
||||
"useNodejsImportProtocol": "off",
|
||||
"noUnusedTemplateLiteral": "off",
|
||||
"useTemplate": "off",
|
||||
"useSelfClosingElements": "off",
|
||||
"noUselessElse": "off",
|
||||
"noParameterAssign": "off"
|
||||
},
|
||||
"correctness": {
|
||||
@ -53,15 +48,10 @@
|
||||
"useHookAtTopLevel": "off"
|
||||
},
|
||||
"complexity": {
|
||||
"noForEach": "off",
|
||||
"noUselessTernary": "off",
|
||||
"useLiteralKeys": "off",
|
||||
"useOptionalChain": "off",
|
||||
"noBannedTypes": "off"
|
||||
"noForEach": "off"
|
||||
},
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off",
|
||||
"noGlobalIsNan": "off",
|
||||
"useIterableCallbackReturn": "off",
|
||||
"noDocumentCookie": "off"
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ export const splitUserTextMessageIntoBlocks = async ({
|
||||
if (parts.at(-1)?.type === "text") {
|
||||
const lastText = parts.at(-1) as TextPart;
|
||||
parts = parts.slice(0, -1);
|
||||
parts.push({ type: "text", text: lastText.text + "\n\n" + part });
|
||||
parts.push({ type: "text", text: `${lastText.text}\n\n${part}` });
|
||||
} else {
|
||||
parts.push({ type: "text", text: part });
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ export const createAuthPrismaAdapter = (p: Prisma.PrismaClient): Adapter => ({
|
||||
throw Error("New users are forbidden");
|
||||
|
||||
const newWorkspaceData = {
|
||||
name: data.name ? `${data.name}'s workspace` : `My workspace`,
|
||||
name: data.name ? `${data.name}'s workspace` : "My workspace",
|
||||
plan: parseWorkspaceDefaultPlan(data.email),
|
||||
};
|
||||
const createdUser = await p.user.create({
|
||||
|
||||
@ -22,7 +22,7 @@ export const sendVerificationRequest = async ({ identifier, url }: Props) => {
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw new Error(`Magic link email could not be sent. See error above.`);
|
||||
throw new Error("Magic link email could not be sent. See error above.");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -27,4 +27,4 @@ const authenticateByToken = async (
|
||||
};
|
||||
|
||||
const extractBearerToken = (req: NextApiRequest) =>
|
||||
req.headers["authorization"]?.slice(7);
|
||||
req.headers.authorization?.slice(7);
|
||||
|
||||
@ -298,7 +298,7 @@ export const handleStripeWebhook = async ({
|
||||
});
|
||||
const outstandingInvoicesWithAdditionalUsageCosts =
|
||||
outstandingInvoices.data.filter(
|
||||
(invoice) => invoice.amount_due > prices["PRO"] * 100,
|
||||
(invoice) => invoice.amount_due > prices.PRO * 100,
|
||||
);
|
||||
|
||||
const existingWorkspace = await prisma.workspace.findFirst({
|
||||
|
||||
@ -42,7 +42,7 @@ export const parseVideoUrl = (
|
||||
type: VideoBubbleContentType.YOUTUBE,
|
||||
url: parsedUrl,
|
||||
id,
|
||||
queryParamsStr: queryParams ? "?" + queryParams.toString() : undefined,
|
||||
queryParamsStr: queryParams ? `?${queryParams.toString()}` : undefined,
|
||||
videoSizeSuggestion: url.includes("shorts")
|
||||
? verticalVideoSuggestionSize
|
||||
: horizontalVideoSuggestionSize,
|
||||
|
||||
@ -151,68 +151,67 @@ export const handleSendMessageV1 = async ({
|
||||
logs,
|
||||
clientSideActions,
|
||||
};
|
||||
} else {
|
||||
assertOriginIsAllowed(origin, {
|
||||
allowedOrigins: session.state.allowedOrigins,
|
||||
iframeReferrerOrigin,
|
||||
});
|
||||
|
||||
const {
|
||||
messages,
|
||||
input,
|
||||
clientSideActions,
|
||||
newSessionState,
|
||||
logs,
|
||||
lastMessageNewFormat,
|
||||
visitedEdges,
|
||||
setVariableHistory,
|
||||
} = await continueBotFlow(
|
||||
message ? { type: "text", text: message } : undefined,
|
||||
{
|
||||
version: 1,
|
||||
state: session.state,
|
||||
textBubbleContentFormat: "richText",
|
||||
sessionStore,
|
||||
},
|
||||
);
|
||||
|
||||
const allLogs = clientLogs ? [...(logs ?? []), ...clientLogs] : logs;
|
||||
|
||||
if (newSessionState)
|
||||
await saveStateToDatabase({
|
||||
sessionId: {
|
||||
type: "existing",
|
||||
id: newSessionId,
|
||||
},
|
||||
session: {
|
||||
state: newSessionState,
|
||||
},
|
||||
input,
|
||||
logs: allLogs,
|
||||
clientSideActions,
|
||||
visitedEdges,
|
||||
isWaitingForExternalEvent: messages.some(
|
||||
(message) =>
|
||||
message.type === "custom-embed" ||
|
||||
(message.type === BubbleBlockType.EMBED &&
|
||||
message.content.waitForEvent?.isEnabled),
|
||||
),
|
||||
setVariableHistory,
|
||||
});
|
||||
|
||||
const dynamicTheme = parseDynamicTheme({
|
||||
state: newSessionState,
|
||||
sessionStore,
|
||||
});
|
||||
|
||||
return {
|
||||
messages,
|
||||
input,
|
||||
clientSideActions,
|
||||
dynamicTheme,
|
||||
logs,
|
||||
lastMessageNewFormat,
|
||||
};
|
||||
}
|
||||
assertOriginIsAllowed(origin, {
|
||||
allowedOrigins: session.state.allowedOrigins,
|
||||
iframeReferrerOrigin,
|
||||
});
|
||||
|
||||
const {
|
||||
messages,
|
||||
input,
|
||||
clientSideActions,
|
||||
newSessionState,
|
||||
logs,
|
||||
lastMessageNewFormat,
|
||||
visitedEdges,
|
||||
setVariableHistory,
|
||||
} = await continueBotFlow(
|
||||
message ? { type: "text", text: message } : undefined,
|
||||
{
|
||||
version: 1,
|
||||
state: session.state,
|
||||
textBubbleContentFormat: "richText",
|
||||
sessionStore,
|
||||
},
|
||||
);
|
||||
|
||||
const allLogs = clientLogs ? [...(logs ?? []), ...clientLogs] : logs;
|
||||
|
||||
if (newSessionState)
|
||||
await saveStateToDatabase({
|
||||
sessionId: {
|
||||
type: "existing",
|
||||
id: newSessionId,
|
||||
},
|
||||
session: {
|
||||
state: newSessionState,
|
||||
},
|
||||
input,
|
||||
logs: allLogs,
|
||||
clientSideActions,
|
||||
visitedEdges,
|
||||
isWaitingForExternalEvent: messages.some(
|
||||
(message) =>
|
||||
message.type === "custom-embed" ||
|
||||
(message.type === BubbleBlockType.EMBED &&
|
||||
message.content.waitForEvent?.isEnabled),
|
||||
),
|
||||
setVariableHistory,
|
||||
});
|
||||
|
||||
const dynamicTheme = parseDynamicTheme({
|
||||
state: newSessionState,
|
||||
sessionStore,
|
||||
});
|
||||
|
||||
return {
|
||||
messages,
|
||||
input,
|
||||
clientSideActions,
|
||||
dynamicTheme,
|
||||
logs,
|
||||
lastMessageNewFormat,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@ -151,68 +151,67 @@ export const handleSendMessageV2 = async ({
|
||||
logs,
|
||||
clientSideActions,
|
||||
};
|
||||
} else {
|
||||
assertOriginIsAllowed(origin, {
|
||||
allowedOrigins: session.state.allowedOrigins,
|
||||
iframeReferrerOrigin,
|
||||
});
|
||||
|
||||
const {
|
||||
messages,
|
||||
input,
|
||||
clientSideActions,
|
||||
newSessionState,
|
||||
logs,
|
||||
lastMessageNewFormat,
|
||||
visitedEdges,
|
||||
setVariableHistory,
|
||||
} = await continueBotFlow(
|
||||
message ? { type: "text", text: message } : undefined,
|
||||
{
|
||||
version: 2,
|
||||
state: session.state,
|
||||
textBubbleContentFormat: "richText",
|
||||
sessionStore,
|
||||
},
|
||||
);
|
||||
|
||||
const allLogs = clientLogs ? [...(logs ?? []), ...clientLogs] : logs;
|
||||
|
||||
if (newSessionState)
|
||||
await saveStateToDatabase({
|
||||
sessionId: {
|
||||
type: "existing",
|
||||
id: session.id,
|
||||
},
|
||||
session: {
|
||||
state: newSessionState,
|
||||
},
|
||||
input,
|
||||
logs: allLogs,
|
||||
clientSideActions,
|
||||
visitedEdges,
|
||||
isWaitingForExternalEvent: messages.some(
|
||||
(message) =>
|
||||
message.type === "custom-embed" ||
|
||||
(message.type === BubbleBlockType.EMBED &&
|
||||
message.content.waitForEvent?.isEnabled),
|
||||
),
|
||||
setVariableHistory,
|
||||
});
|
||||
|
||||
const dynamicTheme = parseDynamicTheme({
|
||||
state: newSessionState,
|
||||
sessionStore,
|
||||
});
|
||||
|
||||
return {
|
||||
messages,
|
||||
input,
|
||||
clientSideActions,
|
||||
dynamicTheme,
|
||||
logs,
|
||||
lastMessageNewFormat,
|
||||
};
|
||||
}
|
||||
assertOriginIsAllowed(origin, {
|
||||
allowedOrigins: session.state.allowedOrigins,
|
||||
iframeReferrerOrigin,
|
||||
});
|
||||
|
||||
const {
|
||||
messages,
|
||||
input,
|
||||
clientSideActions,
|
||||
newSessionState,
|
||||
logs,
|
||||
lastMessageNewFormat,
|
||||
visitedEdges,
|
||||
setVariableHistory,
|
||||
} = await continueBotFlow(
|
||||
message ? { type: "text", text: message } : undefined,
|
||||
{
|
||||
version: 2,
|
||||
state: session.state,
|
||||
textBubbleContentFormat: "richText",
|
||||
sessionStore,
|
||||
},
|
||||
);
|
||||
|
||||
const allLogs = clientLogs ? [...(logs ?? []), ...clientLogs] : logs;
|
||||
|
||||
if (newSessionState)
|
||||
await saveStateToDatabase({
|
||||
sessionId: {
|
||||
type: "existing",
|
||||
id: session.id,
|
||||
},
|
||||
session: {
|
||||
state: newSessionState,
|
||||
},
|
||||
input,
|
||||
logs: allLogs,
|
||||
clientSideActions,
|
||||
visitedEdges,
|
||||
isWaitingForExternalEvent: messages.some(
|
||||
(message) =>
|
||||
message.type === "custom-embed" ||
|
||||
(message.type === BubbleBlockType.EMBED &&
|
||||
message.content.waitForEvent?.isEnabled),
|
||||
),
|
||||
setVariableHistory,
|
||||
});
|
||||
|
||||
const dynamicTheme = parseDynamicTheme({
|
||||
state: newSessionState,
|
||||
sessionStore,
|
||||
});
|
||||
|
||||
return {
|
||||
messages,
|
||||
input,
|
||||
clientSideActions,
|
||||
dynamicTheme,
|
||||
logs,
|
||||
lastMessageNewFormat,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@ -94,9 +94,8 @@ export const getMessageStream = async ({
|
||||
status: 500,
|
||||
message,
|
||||
};
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
if (!isForgedBlockType(block.type))
|
||||
|
||||
@ -31,7 +31,7 @@ export const injectVariableValuesInButtonsInputBlock = (
|
||||
sessionStore,
|
||||
}),
|
||||
items: uniqueValues.filter(isDefined).map((item, idx) => ({
|
||||
id: "choice" + idx.toString(),
|
||||
id: `choice${idx.toString()}`,
|
||||
blockId: block.id,
|
||||
content: item,
|
||||
})),
|
||||
|
||||
@ -67,7 +67,7 @@ const createStripePaymentIntent = async (
|
||||
Number(parseVariables(options.amount, { variables, sessionStore })) *
|
||||
(isZeroDecimalCurrency(currency) ? 1 : 100),
|
||||
);
|
||||
if (isNaN(amount))
|
||||
if (Number.isNaN(amount))
|
||||
throw new ORPCError("BAD_REQUEST", {
|
||||
message:
|
||||
"Could not parse amount, make sure your block is configured correctly",
|
||||
|
||||
@ -72,7 +72,7 @@ export const updateRow = async (
|
||||
if (filteredRows.length === 0) {
|
||||
logs.push({
|
||||
status: "info",
|
||||
description: `Could not find any row that matches the filter`,
|
||||
description: "Could not find any row that matches the filter",
|
||||
details: JSON.stringify(filter),
|
||||
});
|
||||
return { outgoingEdgeId, logs };
|
||||
@ -100,7 +100,7 @@ export const updateRow = async (
|
||||
|
||||
logs.push({
|
||||
status: "success",
|
||||
description: `Succesfully updated matching rows`,
|
||||
description: "Succesfully updated matching rows",
|
||||
});
|
||||
} catch (err) {
|
||||
logs.push(
|
||||
|
||||
@ -57,8 +57,8 @@ export const longReqTimeoutWhitelist = [
|
||||
"https://api.anthropic.com",
|
||||
];
|
||||
|
||||
export const webhookSuccessDescription = `Webhook successfuly executed.`;
|
||||
export const webhookErrorDescription = `Webhook returned an error.`;
|
||||
export const webhookSuccessDescription = "Webhook successfuly executed.";
|
||||
export const webhookErrorDescription = "Webhook returned an error.";
|
||||
|
||||
type Params = { disableRequestTimeout?: boolean; timeout?: number };
|
||||
|
||||
@ -377,7 +377,7 @@ export const executeHttpRequest = async (
|
||||
console.error(error);
|
||||
logs.push({
|
||||
status: "error",
|
||||
description: `Webhook failed to execute.`,
|
||||
description: "Webhook failed to execute.",
|
||||
details: JSON.stringify({
|
||||
response,
|
||||
request,
|
||||
|
||||
@ -98,7 +98,7 @@ export const executeChatCompletionOpenAIRequest = async ({
|
||||
}
|
||||
logs.push({
|
||||
status: "error",
|
||||
description: `Internal error`,
|
||||
description: "Internal error",
|
||||
});
|
||||
return { logs };
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ export const executeTypebotLink = async (
|
||||
if (!typebotId) {
|
||||
logs.push({
|
||||
status: "error",
|
||||
description: `Failed to link typebot`,
|
||||
details: `Typebot ID is not specified`,
|
||||
description: "Failed to link typebot",
|
||||
details: "Typebot ID is not specified",
|
||||
});
|
||||
return { outgoingEdgeId: block.outgoingEdgeId, logs };
|
||||
}
|
||||
@ -51,7 +51,7 @@ export const executeTypebotLink = async (
|
||||
if (!linkedTypebot) {
|
||||
logs.push({
|
||||
status: "error",
|
||||
description: `Failed to link typebot`,
|
||||
description: "Failed to link typebot",
|
||||
details: `Typebot with ID ${block.options?.typebotId} not found`,
|
||||
});
|
||||
return { outgoingEdgeId: block.outgoingEdgeId, logs };
|
||||
@ -71,7 +71,7 @@ export const executeTypebotLink = async (
|
||||
if (!nextGroupId) {
|
||||
logs.push({
|
||||
status: "error",
|
||||
description: `Failed to link typebot`,
|
||||
description: "Failed to link typebot",
|
||||
details: `Group with ID "${block.options?.groupId}" not found`,
|
||||
});
|
||||
return { outgoingEdgeId: block.outgoingEdgeId, logs };
|
||||
|
||||
@ -17,7 +17,7 @@ export const updateCurrentBlockIdWithEvent = ({ state, event }: Props) => {
|
||||
|
||||
if (!edge)
|
||||
throw new ORPCError("BAD_REQUEST", {
|
||||
message: `Could not find outgoing edge`,
|
||||
message: "Could not find outgoing edge",
|
||||
});
|
||||
|
||||
newSessionState = addDummyFirstBlockToGroupIfMissing(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
export const shortenLogDetails = (details?: string): string | undefined => {
|
||||
if (!details) return;
|
||||
if (details.length < 1000) return details;
|
||||
return details.substring(0, 1000) + "...";
|
||||
return `${details.substring(0, 1000)}...`;
|
||||
};
|
||||
|
||||
@ -24,7 +24,7 @@ export const createResultIfNotExist = async ({
|
||||
{
|
||||
id: resultId,
|
||||
typebotId: typebot.id,
|
||||
isCompleted: isCompleted ? true : false,
|
||||
isCompleted: !!isCompleted,
|
||||
hasStarted,
|
||||
variables: typebot.variables,
|
||||
},
|
||||
|
||||
@ -235,9 +235,9 @@ const compare = (
|
||||
|
||||
const parseDateOrNumberOrStringLength = (value: string): number => {
|
||||
const parsed = value.startsWith("+") ? NaN : Number(value);
|
||||
if (isNaN(parsed)) {
|
||||
if (Number.isNaN(parsed)) {
|
||||
const time = Date.parse(value);
|
||||
if (isNaN(time)) return value.length;
|
||||
if (Number.isNaN(time)) return value.length;
|
||||
return time;
|
||||
}
|
||||
return parsed;
|
||||
|
||||
@ -5,7 +5,7 @@ const algorithm = "aes-256-gcm";
|
||||
const secretKey = env.ENCRYPTION_SECRET;
|
||||
|
||||
export const decryptV1 = (encryptedData: string, auth: string): object => {
|
||||
if (!secretKey) throw new Error(`ENCRYPTION_SECRET is not in environment`);
|
||||
if (!secretKey) throw new Error("ENCRYPTION_SECRET is not in environment");
|
||||
const [iv, tag] = auth.split(".");
|
||||
if (!iv || !tag) return {};
|
||||
const decipher = createDecipheriv(
|
||||
|
||||
@ -51,6 +51,6 @@ export const sendResultsExportLinkEmail = async (
|
||||
) =>
|
||||
sendEmail({
|
||||
to: props.email,
|
||||
subject: `Your results export is ready`,
|
||||
subject: "Your results export is ready",
|
||||
html: await render(<ResultsExportLinkEmail {...props} />),
|
||||
});
|
||||
|
||||
@ -109,7 +109,7 @@ export const Bot = (props: BotProps & { class?: string }) => {
|
||||
if (error instanceof HTTPError) {
|
||||
if (isPreview) {
|
||||
return setError(
|
||||
new Error(`An error occurred while loading the bot.`, {
|
||||
new Error("An error occurred while loading the bot.", {
|
||||
cause: {
|
||||
status: error.response.status,
|
||||
body: await error.response.json(),
|
||||
@ -137,7 +137,7 @@ export const Bot = (props: BotProps & { class?: string }) => {
|
||||
console.error(error);
|
||||
if (isPreview) {
|
||||
return setError(
|
||||
new Error(`Error! Could not reach server. Check your connection.`, {
|
||||
new Error("Error! Could not reach server. Check your connection.", {
|
||||
cause: error,
|
||||
}),
|
||||
);
|
||||
@ -164,8 +164,7 @@ export const Bot = (props: BotProps & { class?: string }) => {
|
||||
data.typebot.id,
|
||||
);
|
||||
if (
|
||||
initialChatInStorage &&
|
||||
initialChatInStorage.typebot.publishedAt &&
|
||||
initialChatInStorage?.typebot.publishedAt &&
|
||||
data.typebot.publishedAt
|
||||
) {
|
||||
console.log(
|
||||
|
||||
@ -33,9 +33,7 @@ export const SendButton = (props: SendButtonProps) => {
|
||||
<Switch>
|
||||
<Match when={showIcon}>
|
||||
<SendIcon
|
||||
class={
|
||||
"send-icon flex w-6 h-6 " + (local.disableIcon ? "hidden" : "")
|
||||
}
|
||||
class={`send-icon flex w-6 h-6 ${local.disableIcon ? "hidden" : ""}`}
|
||||
/>
|
||||
</Match>
|
||||
<Match when={!showIcon}>{props.children}</Match>
|
||||
|
||||
@ -3,7 +3,7 @@ import type { JSX } from "solid-js";
|
||||
export const Spinner = (props: JSX.SvgSVGAttributes<SVGSVGElement>) => (
|
||||
<svg
|
||||
{...props}
|
||||
class={"animate-spin h-6 w-6 " + props.class}
|
||||
class={`animate-spin h-6 w-6 ${props.class}`}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
|
||||
@ -40,23 +40,22 @@ export const StreamingBubble = (props: Props) => {
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return [
|
||||
domPurify.sanitize(
|
||||
marked.parse(
|
||||
"```" +
|
||||
block +
|
||||
"```".replace(/</g, "<").replace(/>/g, ">"),
|
||||
{
|
||||
breaks: true,
|
||||
},
|
||||
),
|
||||
}
|
||||
return [
|
||||
domPurify.sanitize(
|
||||
marked.parse(
|
||||
"```" +
|
||||
block +
|
||||
"```".replace(/</g, "<").replace(/>/g, ">"),
|
||||
{
|
||||
ADD_ATTR: ["target"],
|
||||
breaks: true,
|
||||
},
|
||||
),
|
||||
];
|
||||
}
|
||||
{
|
||||
ADD_ATTR: ["target"],
|
||||
},
|
||||
),
|
||||
];
|
||||
})
|
||||
?.filter(isNotEmpty) ?? []
|
||||
);
|
||||
|
||||
@ -18,9 +18,7 @@ export const AudioBubble = (props: Props) => {
|
||||
let isPlayed = false;
|
||||
let ref: HTMLDivElement | undefined;
|
||||
let audioElement: HTMLAudioElement | undefined;
|
||||
const [isTyping, setIsTyping] = createSignal(
|
||||
props.onTransitionEnd ? true : false,
|
||||
);
|
||||
const [isTyping, setIsTyping] = createSignal(!!props.onTransitionEnd);
|
||||
|
||||
onMount(() => {
|
||||
typingTimeout = setTimeout(() => {
|
||||
|
||||
@ -17,9 +17,7 @@ export const showAnimationDuration = 400;
|
||||
|
||||
export const CustomEmbedBubble = (props: Props) => {
|
||||
let ref: HTMLDivElement | undefined;
|
||||
const [isTyping, setIsTyping] = createSignal(
|
||||
props.onTransitionEnd ? true : false,
|
||||
);
|
||||
const [isTyping, setIsTyping] = createSignal(!!props.onTransitionEnd);
|
||||
let containerRef: HTMLDivElement | undefined;
|
||||
|
||||
onMount(() => {
|
||||
|
||||
@ -18,9 +18,7 @@ export const showAnimationDuration = 400;
|
||||
|
||||
export const EmbedBubble = (props: Props) => {
|
||||
let ref: HTMLDivElement | undefined;
|
||||
const [isTyping, setIsTyping] = createSignal(
|
||||
props.onTransitionEnd ? true : false,
|
||||
);
|
||||
const [isTyping, setIsTyping] = createSignal(!!props.onTransitionEnd);
|
||||
|
||||
const handleMessage = (
|
||||
event: MessageEvent<{ name?: string; data?: string }>,
|
||||
|
||||
@ -20,9 +20,7 @@ export const ImageBubble = (props: Props) => {
|
||||
let ref: HTMLDivElement | undefined;
|
||||
let image: HTMLImageElement | undefined;
|
||||
const [isExpanded, setIsExpanded] = createSignal(false);
|
||||
const [isTyping, setIsTyping] = createSignal(
|
||||
props.onTransitionEnd ? true : false,
|
||||
);
|
||||
const [isTyping, setIsTyping] = createSignal(!!props.onTransitionEnd);
|
||||
|
||||
const onTypingEnd = () => {
|
||||
if (!isTyping()) return;
|
||||
|
||||
@ -20,9 +20,7 @@ let typingTimeout: NodeJS.Timeout;
|
||||
|
||||
export const TextBubble = (props: Props) => {
|
||||
let ref: HTMLDivElement | undefined;
|
||||
const [isTyping, setIsTyping] = createSignal(
|
||||
props.onTransitionEnd ? true : false,
|
||||
);
|
||||
const [isTyping, setIsTyping] = createSignal(!!props.onTransitionEnd);
|
||||
|
||||
const onTypingEnd = () => {
|
||||
if (!isTyping()) return;
|
||||
|
||||
@ -23,9 +23,7 @@ let typingTimeout: NodeJS.Timeout;
|
||||
|
||||
export const VideoBubble = (props: Props) => {
|
||||
let ref: HTMLDivElement | undefined;
|
||||
const [isTyping, setIsTyping] = createSignal(
|
||||
props.onTransitionEnd ? true : false,
|
||||
);
|
||||
const [isTyping, setIsTyping] = createSignal(!!props.onTransitionEnd);
|
||||
|
||||
onMount(() => {
|
||||
const typingDuration =
|
||||
|
||||
@ -62,14 +62,14 @@ export const CardsCaroussel = (props: Props) => {
|
||||
<ArrowLeftIcon class="w-4 h-4" />
|
||||
</Button>
|
||||
)}
|
||||
></Carousel.PrevTrigger>
|
||||
/>
|
||||
<Carousel.NextTrigger
|
||||
asChild={(props) => (
|
||||
<Button variant="secondary" {...props}>
|
||||
<ArrowRightIcon class="w-4 h-4" />
|
||||
</Button>
|
||||
)}
|
||||
></Carousel.NextTrigger>
|
||||
/>
|
||||
</Carousel.Control>
|
||||
</div>
|
||||
<Carousel.ItemGroup class="rounded-l-host-bubble @xs:pr-5 pr-4">
|
||||
|
||||
@ -29,8 +29,7 @@ export const uploadFiles = async ({
|
||||
const errors: string[] = [];
|
||||
let i = 0;
|
||||
for (const { input, file } of files) {
|
||||
onUploadProgress &&
|
||||
onUploadProgress({ progress: (i / files.length) * 100, fileIndex: i });
|
||||
onUploadProgress?.({ progress: (i / files.length) * 100, fileIndex: i });
|
||||
i += 1;
|
||||
const { data, error } = await sendRequest<{
|
||||
presignedUrl: string;
|
||||
@ -53,21 +52,20 @@ export const uploadFiles = async ({
|
||||
}
|
||||
|
||||
if (!data?.presignedUrl) continue;
|
||||
else {
|
||||
const formData = new FormData();
|
||||
Object.entries(data.formData).forEach(([key, value]) => {
|
||||
formData.append(key, value);
|
||||
});
|
||||
formData.append("file", file);
|
||||
const upload = await fetch(data.presignedUrl, {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
if (!upload.ok) continue;
|
||||
const formData = new FormData();
|
||||
Object.entries(data.formData).forEach(([key, value]) => {
|
||||
formData.append(key, value);
|
||||
});
|
||||
formData.append("file", file);
|
||||
const upload = await fetch(data.presignedUrl, {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
urls.push({ url: data.fileUrl, type: file.type });
|
||||
}
|
||||
if (!upload.ok) continue;
|
||||
|
||||
urls.push({ url: data.fileUrl, type: file.type });
|
||||
}
|
||||
return errors.length > 0
|
||||
? { type: "error", error: errors.join(", ") }
|
||||
|
||||
@ -12,7 +12,7 @@ export const numberInputHelper = (value: () => any) => {
|
||||
|
||||
const nodeV = el.value;
|
||||
if ((v === 0 && nodeV === "") || v !== nodeV) {
|
||||
el.value = v + "";
|
||||
el.value = `${v}`;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@ -21,21 +21,20 @@ export const executeSetVariable = async (
|
||||
return {
|
||||
replyToSend: safeStringify(result) ?? undefined,
|
||||
};
|
||||
} else {
|
||||
// To avoid octal number evaluation
|
||||
if (!isNaN(content as unknown as number) && /0[^.].+/.test(content))
|
||||
return {
|
||||
replyToSend: content,
|
||||
};
|
||||
const func = AsyncFunction(
|
||||
...args.map((arg) => arg.id),
|
||||
content.includes("return ") ? content : `return ${content}`,
|
||||
);
|
||||
const replyToSend = await func(...args.map((arg) => arg.value));
|
||||
return {
|
||||
replyToSend: safeStringify(replyToSend) ?? undefined,
|
||||
};
|
||||
}
|
||||
// To avoid octal number evaluation
|
||||
if (!Number.isNaN(content as unknown as number) && /0[^.].+/.test(content))
|
||||
return {
|
||||
replyToSend: content,
|
||||
};
|
||||
const func = AsyncFunction(
|
||||
...args.map((arg) => arg.id),
|
||||
content.includes("return ") ? content : `return ${content}`,
|
||||
);
|
||||
const replyToSend = await func(...args.map((arg) => arg.value));
|
||||
return {
|
||||
replyToSend: safeStringify(replyToSend) ?? undefined,
|
||||
};
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
|
||||
@ -108,7 +108,7 @@ const CloseButton = (props: {
|
||||
part="preview-message-close-button"
|
||||
aria-label="Close"
|
||||
class={
|
||||
`absolute -top-2 -right-2 rounded-full w-6 h-6 p-1 hover:brightness-95 active:brightness-90 transition-all border ` +
|
||||
"absolute -top-2 -right-2 rounded-full w-6 h-6 p-1 hover:brightness-95 active:brightness-90 transition-all border " +
|
||||
(props.isHovered ? "opacity-100" : "opacity-0")
|
||||
}
|
||||
onClick={(e) => {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user