🛂 (whatsapp) Disable whatsapp by default on duplication
This commit is contained in:
@ -80,7 +80,7 @@ export const createTypebot = authenticatedProcedure
|
||||
: defaultGroups(),
|
||||
theme: typebot.theme ? typebot.theme : defaultTheme,
|
||||
settings: typebot.settings
|
||||
? sanitizeSettings(typebot.settings, workspace.plan)
|
||||
? sanitizeSettings(typebot.settings, workspace.plan, 'create')
|
||||
: defaultSettings({
|
||||
isBrandingEnabled: workspace.plan === Plan.FREE,
|
||||
}),
|
||||
|
@ -142,7 +142,11 @@ export const updateTypebot = authenticatedProcedure
|
||||
: undefined,
|
||||
theme: typebot.theme ? typebot.theme : undefined,
|
||||
settings: typebot.settings
|
||||
? sanitizeSettings(typebot.settings, existingTypebot.workspace.plan)
|
||||
? sanitizeSettings(
|
||||
typebot.settings,
|
||||
existingTypebot.workspace.plan,
|
||||
'update'
|
||||
)
|
||||
: undefined,
|
||||
folderId: typebot.folderId,
|
||||
variables: typebot.variables,
|
||||
|
@ -9,7 +9,8 @@ import {
|
||||
|
||||
export const sanitizeSettings = (
|
||||
settings: Typebot['settings'],
|
||||
workspacePlan: Plan
|
||||
workspacePlan: Plan,
|
||||
mode: 'create' | 'update'
|
||||
): Typebot['settings'] => ({
|
||||
...settings,
|
||||
general: {
|
||||
@ -17,6 +18,17 @@ export const sanitizeSettings = (
|
||||
isBrandingEnabled:
|
||||
workspacePlan === Plan.FREE ? false : settings.general.isBrandingEnabled,
|
||||
},
|
||||
whatsApp: settings.whatsApp
|
||||
? {
|
||||
...settings.whatsApp,
|
||||
isEnabled:
|
||||
mode === 'create'
|
||||
? false
|
||||
: workspacePlan === Plan.FREE
|
||||
? false
|
||||
: settings.whatsApp.isEnabled,
|
||||
}
|
||||
: undefined,
|
||||
})
|
||||
|
||||
export const sanitizeGroups =
|
||||
|
Reference in New Issue
Block a user