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