2
0

🚑 Fix custom CSS sanitization

This commit is contained in:
Baptiste Arnaud
2023-10-09 10:39:47 +02:00
parent 021cae3c29
commit 8eb9f2568b
5 changed files with 6 additions and 7 deletions

View File

@ -406,9 +406,7 @@ const sanitizeAndParseTheme = (
general: deepParseVariables(variables)(theme.general),
chat: deepParseVariables(variables)(theme.chat),
customCss: theme.customCss
? sanitizeAndParseHeadCode(
parseVariables(variables)(removeLiteBadgeCss(theme.customCss))
)
? removeLiteBadgeCss(parseVariables(variables)(theme.customCss))
: undefined,
})
@ -420,6 +418,6 @@ const sanitizeAndParseHeadCode = (code: string) => {
}
const removeLiteBadgeCss = (code: string) => {
const liteBadgeCssRegex = /.*#lite-badge[\s]*{[\s\S]*}/gm
const liteBadgeCssRegex = /.*#lite-badge.*{[\s\S][^{]*}/gm
return code.replace(liteBadgeCssRegex, '')
}

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.2.2",
"version": "0.2.3",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",

View File

@ -19,6 +19,7 @@
left: auto !important;
bottom: 20px !important;
transition: background-color 0.2s ease-in-out !important;
text-decoration: none !important;
}
#lite-badge:hover {

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.2",
"version": "0.2.3",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.2.2",
"version": "0.2.3",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",