2
0

🐛 (import) Fix import typebot files that does not have name field

This commit is contained in:
Baptiste Arnaud
2023-11-08 16:42:59 +01:00
parent db17a0f508
commit aceba0abd0
3 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,6 @@ export const convertPublicTypebotToTypebot = (
resultsTablePreferences: existingTypebot.resultsTablePreferences, resultsTablePreferences: existingTypebot.resultsTablePreferences,
selectedThemeTemplateId: existingTypebot.selectedThemeTemplateId, selectedThemeTemplateId: existingTypebot.selectedThemeTemplateId,
whatsAppCredentialsId: existingTypebot.whatsAppCredentialsId, whatsAppCredentialsId: existingTypebot.whatsAppCredentialsId,
events: existingTypebot.events, events: typebot.events,
} }
} }

View File

@ -25,6 +25,7 @@ export const ImportTypebotFromFileButton = ({
...typebot, ...typebot,
events: typebot.events ?? null, events: typebot.events ?? null,
icon: typebot.icon ?? null, icon: typebot.icon ?? null,
name: typebot.name ?? 'My typebot',
} as Typebot) } as Typebot)
} catch (err) { } catch (err) {
console.error(err) console.error(err)

View File

@ -27,6 +27,7 @@ const omittedProps = {
workspaceId: true, workspaceId: true,
resultsTablePreferencesSchema: true, resultsTablePreferencesSchema: true,
selectedThemeTemplateId: true, selectedThemeTemplateId: true,
publicId: true,
} as const } as const
const importingTypebotSchema = z.preprocess( const importingTypebotSchema = z.preprocess(
@ -60,6 +61,7 @@ const migrateImportingTypebot = (
isClosed: false, isClosed: false,
isArchived: false, isArchived: false,
whatsAppCredentialsId: null, whatsAppCredentialsId: null,
publicId: null,
} satisfies Typebot } satisfies Typebot
return migrateTypebot(fullTypebot) return migrateTypebot(fullTypebot)
} }