🐛 (typebot-js) Fix default export from js lib
Closes
This commit is contained in:
@ -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),
|
||||
|
@ -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",
|
||||
|
@ -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)()
|
||||
}
|
||||
|
@ -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'
|
||||
|
@ -54,7 +54,7 @@ export type Variable = {
|
||||
export type TypebotPostMessageData = {
|
||||
redirectUrl?: string
|
||||
newVariableValue?: Variable
|
||||
codeToExecute?: Function
|
||||
codeToExecute?: string
|
||||
}
|
||||
|
||||
export const localStorageKeys = {
|
||||
|
Reference in New Issue
Block a user