2
0

🐛 Fix empty placeholder ignored

Closes #1660
This commit is contained in:
Baptiste Arnaud
2024-07-22 17:37:32 +02:00
parent ec2a53fac1
commit 0237c6f835
4 changed files with 12 additions and 27 deletions

View File

@ -10,9 +10,7 @@ export const parseDateInput =
return {
...block,
options: {
...deepParseVariables(variables, { removeEmptyStrings: true })(
block.options
),
...deepParseVariables(variables)(block.options),
min: parseDateLimit(
block.options.min,
block.options.hasTime,

View File

@ -298,8 +298,7 @@ export const parseInput =
}
case InputBlockType.NUMBER: {
const parsedBlock = deepParseVariables(
state.typebotsQueue[0].typebot.variables,
{ removeEmptyStrings: true }
state.typebotsQueue[0].typebot.variables
)({
...block,
prefilledValue: getPrefilledInputValue(
@ -327,8 +326,7 @@ export const parseInput =
}
case InputBlockType.RATING: {
const parsedBlock = deepParseVariables(
state.typebotsQueue[0].typebot.variables,
{ removeEmptyStrings: true }
state.typebotsQueue[0].typebot.variables
)({
...block,
prefilledValue: getPrefilledInputValue(
@ -346,9 +344,7 @@ export const parseInput =
}
}
default: {
return deepParseVariables(state.typebotsQueue[0].typebot.variables, {
removeEmptyStrings: true,
})({
return deepParseVariables(state.typebotsQueue[0].typebot.variables)({
...block,
runtimeOptions: await computeRuntimeOptions(state)(block),
prefilledValue: getPrefilledInputValue(

View File

@ -66,9 +66,7 @@ export const parseBubbleBlock = (
}
case BubbleBlockType.EMBED: {
const message = deepParseVariables(variables, {
removeEmptyStrings: true,
})(block)
const message = deepParseVariables(variables)(block)
return {
...message,
content: {
@ -82,9 +80,7 @@ export const parseBubbleBlock = (
}
case BubbleBlockType.VIDEO: {
const parsedContent = block.content
? deepParseVariables(variables, { removeEmptyStrings: true })(
block.content
)
? deepParseVariables(variables)(block.content)
: undefined
return {
@ -100,7 +96,7 @@ export const parseBubbleBlock = (
}
}
default:
return deepParseVariables(variables, { removeEmptyStrings: true })(block)
return deepParseVariables(variables)(block)
}
}

View File

@ -162,8 +162,7 @@ export const startSession = async ({
typebot: {
id: typebot.id,
settings: deepParseVariables(
initialState.typebotsQueue[0].typebot.variables,
{ removeEmptyStrings: true }
initialState.typebotsQueue[0].typebot.variables
)(typebot.settings),
theme: sanitizeAndParseTheme(typebot.theme, {
variables: initialState.typebotsQueue[0].typebot.variables,
@ -274,8 +273,7 @@ export const startSession = async ({
typebot: {
id: typebot.id,
settings: deepParseVariables(
newSessionState.typebotsQueue[0].typebot.variables,
{ removeEmptyStrings: true }
newSessionState.typebotsQueue[0].typebot.variables
)(typebot.settings),
theme: sanitizeAndParseTheme(typebot.theme, {
variables: initialState.typebotsQueue[0].typebot.variables,
@ -293,8 +291,7 @@ export const startSession = async ({
typebot: {
id: typebot.id,
settings: deepParseVariables(
newSessionState.typebotsQueue[0].typebot.variables,
{ removeEmptyStrings: true }
newSessionState.typebotsQueue[0].typebot.variables
)(typebot.settings),
theme: sanitizeAndParseTheme(typebot.theme, {
variables: initialState.typebotsQueue[0].typebot.variables,
@ -472,11 +469,9 @@ const sanitizeAndParseTheme = (
{ variables }: { variables: Variable[] }
): Theme => ({
general: theme.general
? deepParseVariables(variables, { removeEmptyStrings: true })(theme.general)
: undefined,
chat: theme.chat
? deepParseVariables(variables, { removeEmptyStrings: true })(theme.chat)
? deepParseVariables(variables)(theme.general)
: undefined,
chat: theme.chat ? deepParseVariables(variables)(theme.chat) : undefined,
customCss: theme.customCss
? removeLiteBadgeCss(parseVariables(variables)(theme.customCss))
: undefined,