(api) Add CRUD typebot endpoints

Closes #320, closes #696
This commit is contained in:
Baptiste Arnaud
2023-08-17 09:39:11 +02:00
parent 019f72ac7e
commit 454d320c6b
78 changed files with 25014 additions and 1073 deletions

View File

@@ -23,13 +23,15 @@ export const ThemeSideMenu = () => {
const { typebot, updateTypebot } = useTypebot()
const updateChatTheme = (chat: ChatTheme) =>
typebot && updateTypebot({ theme: { ...typebot.theme, chat } })
typebot && updateTypebot({ updates: { theme: { ...typebot.theme, chat } } })
const updateGeneralTheme = (general: GeneralTheme) =>
typebot && updateTypebot({ theme: { ...typebot.theme, general } })
typebot &&
updateTypebot({ updates: { theme: { ...typebot.theme, general } } })
const updateCustomCss = (customCss: string) =>
typebot && updateTypebot({ theme: { ...typebot.theme, customCss } })
typebot &&
updateTypebot({ updates: { theme: { ...typebot.theme, customCss } } })
const selectedTemplate = (
selectedTemplate: Partial<Pick<ThemeTemplate, 'id' | 'theme'>>
@@ -37,15 +39,19 @@ export const ThemeSideMenu = () => {
if (!typebot) return
const { theme, id } = selectedTemplate
updateTypebot({
selectedThemeTemplateId: id,
theme: theme ? { ...theme } : typebot.theme,
updates: {
selectedThemeTemplateId: id,
theme: theme ? { ...theme } : typebot.theme,
},
})
}
const updateBranding = (isBrandingEnabled: boolean) =>
typebot &&
updateTypebot({
settings: { ...typebot.settings, general: { isBrandingEnabled } },
updates: {
settings: { ...typebot.settings, general: { isBrandingEnabled } },
},
})
return (