2
0

🐛 (typebot-js) Fix default export from js lib

Closes
This commit is contained in:
Baptiste Arnaud
2022-11-09 15:37:04 +01:00
parent b31b603cc7
commit 8ab67b7580
5 changed files with 19 additions and 13 deletions

View File

@ -169,11 +169,9 @@ const executeCode = async (
if (!block.options.content) return
console.log('isEmbedded', isEmbedded)
if (block.options.shouldExecuteInParentContext && isEmbedded) {
const func = Function(
...variables.map((v) => v.id),
parseVariables(variables)(block.options.content)
)
sendEventToParent({ codeToExecute: func })
sendEventToParent({
codeToExecute: parseVariables(variables)(block.options.content),
})
} else {
const func = Function(
...variables.map((v) => v.id),

View File

@ -1,6 +1,6 @@
{
"name": "typebot-js",
"version": "2.2.10",
"version": "2.2.11",
"main": "dist/index.js",
"unpkg": "dist/index.umd.min.js",
"license": "AGPL-3.0-or-later",

View File

@ -62,5 +62,5 @@ const processMessage = (
if (data.redirectUrl) window.open(data.redirectUrl)
if (data.newVariableValue && callbacks.onNewVariableValue)
callbacks.onNewVariableValue(data.newVariableValue)
if (data.codeToExecute) data.codeToExecute()
if (data.codeToExecute) Function(data.codeToExecute)()
}

View File

@ -1,6 +1,6 @@
import { initContainer } from "./embedTypes/container";
import { initPopup, getPopupActions } from "./embedTypes/popup";
import { initBubble, getBubbleActions } from "./embedTypes/chat";
import { initContainer } from './embedTypes/container'
import { initPopup, getPopupActions } from './embedTypes/popup'
import { initBubble, getBubbleActions } from './embedTypes/chat'
export {
initContainer,
@ -8,6 +8,14 @@ export {
initBubble,
getPopupActions,
getBubbleActions,
};
}
export * from "./types";
export default {
initContainer,
initPopup,
initBubble,
getPopupActions,
getBubbleActions,
}
export * from './types'

View File

@ -54,7 +54,7 @@ export type Variable = {
export type TypebotPostMessageData = {
redirectUrl?: string
newVariableValue?: Variable
codeToExecute?: Function
codeToExecute?: string
}
export const localStorageKeys = {