@@ -50,6 +50,7 @@ const nextConfig = {
|
||||
if (nextRuntime === 'edge') {
|
||||
config.resolve.alias['minio'] = false
|
||||
config.resolve.alias['got'] = false
|
||||
config.resolve.alias['qrcode'] = false
|
||||
return config
|
||||
}
|
||||
// These packages are imports from the integrations definition files that can be ignored for the client.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react'
|
||||
import { Text } from '@chakra-ui/react'
|
||||
import { ScriptBlock } from '@typebot.io/schemas'
|
||||
import { defaultScriptOptions } from '@typebot.io/schemas/features/blocks/logic/script/constants'
|
||||
|
||||
type Props = {
|
||||
options: ScriptBlock['options']
|
||||
@@ -10,6 +11,6 @@ export const ScriptNodeContent = ({
|
||||
options: { name, content } = {},
|
||||
}: Props) => (
|
||||
<Text color={content ? 'currentcolor' : 'gray.500'} noOfLines={1}>
|
||||
{content ? `Run ${name}` : 'Configure...'}
|
||||
{content ? `Run ${name ?? defaultScriptOptions.name}` : 'Configure...'}
|
||||
</Text>
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@ import React from 'react'
|
||||
import { TextInput } from '@/components/inputs'
|
||||
import { ScriptBlock } from '@typebot.io/schemas'
|
||||
import { defaultScriptOptions } from '@typebot.io/schemas/features/blocks/logic/script/constants'
|
||||
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
|
||||
|
||||
type Props = {
|
||||
options: ScriptBlock['options']
|
||||
@@ -13,9 +14,13 @@ type Props = {
|
||||
export const ScriptSettings = ({ options, onOptionsChange }: Props) => {
|
||||
const handleNameChange = (name: string) =>
|
||||
onOptionsChange({ ...options, name })
|
||||
|
||||
const handleCodeChange = (content: string) =>
|
||||
onOptionsChange({ ...options, content })
|
||||
|
||||
const updateClientExecution = (isExecutedOnClient: boolean) =>
|
||||
onOptionsChange({ ...options, isExecutedOnClient })
|
||||
|
||||
return (
|
||||
<Stack spacing={4}>
|
||||
<TextInput
|
||||
@@ -31,6 +36,15 @@ export const ScriptSettings = ({ options, onOptionsChange }: Props) => {
|
||||
lang="javascript"
|
||||
onChange={handleCodeChange}
|
||||
/>
|
||||
<SwitchWithLabel
|
||||
label="Execute on client?"
|
||||
moreInfoContent="Check this if you need access to client variables like `window` or `document`."
|
||||
initialValue={
|
||||
options?.isExecutedOnClient ??
|
||||
defaultScriptOptions.isExecutedOnClient
|
||||
}
|
||||
onCheckChange={updateClientExecution}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
)
|
||||
|
||||
@@ -137,11 +137,6 @@ const SetVariableValue = ({
|
||||
case undefined:
|
||||
return (
|
||||
<>
|
||||
<CodeEditor
|
||||
defaultValue={options?.expressionToEvaluate ?? ''}
|
||||
onChange={updateExpression}
|
||||
lang="javascript"
|
||||
/>
|
||||
<SwitchWithLabel
|
||||
label="Execute on client?"
|
||||
moreInfoContent="Check this if you need access to client-only variables like `window` or `document`."
|
||||
@@ -151,6 +146,11 @@ const SetVariableValue = ({
|
||||
}
|
||||
onCheckChange={updateClientExecution}
|
||||
/>
|
||||
<CodeEditor
|
||||
defaultValue={options?.expressionToEvaluate ?? ''}
|
||||
onChange={updateExpression}
|
||||
lang="javascript"
|
||||
/>
|
||||
</>
|
||||
)
|
||||
case 'Map item with same index': {
|
||||
|
||||
Reference in New Issue
Block a user