feat(inputs): ✨ Add Set variable step
This commit is contained in:
@ -18,6 +18,7 @@ export const parseTypebotToPublicTypebot = (
|
||||
settings: typebot.settings,
|
||||
publicId: typebot.publicId,
|
||||
choiceItems: typebot.choiceItems,
|
||||
variables: typebot.variables,
|
||||
})
|
||||
|
||||
export const createPublishedTypebot = async (
|
||||
|
@ -11,6 +11,8 @@ import {
|
||||
BubbleStepType,
|
||||
InputStepType,
|
||||
ChoiceInputStep,
|
||||
LogicStepType,
|
||||
LogicStep,
|
||||
} from 'models'
|
||||
import shortId from 'short-uuid'
|
||||
import { Typebot } from 'models'
|
||||
@ -107,9 +109,9 @@ export const parseNewBlock = ({
|
||||
}
|
||||
|
||||
export const parseNewStep = (
|
||||
type: BubbleStepType | InputStepType,
|
||||
type: BubbleStepType | InputStepType | LogicStepType,
|
||||
blockId: string
|
||||
): BubbleStep | InputStep => {
|
||||
): BubbleStep | InputStep | LogicStep => {
|
||||
const id = `s${shortId.generate()}`
|
||||
switch (type) {
|
||||
case BubbleStepType.TEXT: {
|
||||
@ -144,17 +146,10 @@ export const parseNewStep = (
|
||||
}
|
||||
}
|
||||
|
||||
export const checkIfTypebotsAreEqual = (
|
||||
firstChatbot: Typebot,
|
||||
secondChatbot: Typebot
|
||||
) =>
|
||||
export const checkIfTypebotsAreEqual = (typebotA: Typebot, typebotB: Typebot) =>
|
||||
deepEqual(
|
||||
{
|
||||
...firstChatbot,
|
||||
},
|
||||
{
|
||||
...secondChatbot,
|
||||
}
|
||||
JSON.parse(JSON.stringify(typebotA)),
|
||||
JSON.parse(JSON.stringify(typebotB))
|
||||
)
|
||||
|
||||
export const checkIfPublished = (
|
||||
@ -214,6 +209,7 @@ export const parseNewTypebot = ({
|
||||
blocks: { byId: { [startBlockId]: startBlock }, allIds: [startBlockId] },
|
||||
steps: { byId: { [startStepId]: startStep }, allIds: [startStepId] },
|
||||
choiceItems: { byId: {}, allIds: [] },
|
||||
variables: { byId: {}, allIds: [] },
|
||||
theme,
|
||||
settings,
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Parser } from 'htmlparser2'
|
||||
import { Step } from 'models'
|
||||
|
||||
export const fetcher = async (input: RequestInfo, init?: RequestInit) => {
|
||||
const res = await fetch(input, init)
|
||||
@ -115,3 +116,5 @@ export const removeUndefinedFields = <T>(obj: T): T =>
|
||||
: { ...acc, [key]: obj[key as keyof T] },
|
||||
{} as T
|
||||
)
|
||||
|
||||
export const stepHasOptions = (step: Step) => 'options' in step
|
||||
|
Reference in New Issue
Block a user