-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2784f1
commit e3e07dd
Showing
13 changed files
with
239 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...der/components/shared/Graph/Nodes/StepNode/SettingsPopoverContent/bodies/CodeSettings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { FormLabel, Stack, Text } from '@chakra-ui/react' | ||
import { CodeEditor } from 'components/shared/CodeEditor' | ||
import { DebouncedInput } from 'components/shared/DebouncedInput' | ||
import { CodeOptions } from 'models' | ||
import React from 'react' | ||
|
||
type Props = { | ||
options: CodeOptions | ||
onOptionsChange: (options: CodeOptions) => void | ||
} | ||
|
||
export const CodeSettings = ({ options, onOptionsChange }: Props) => { | ||
const handleNameChange = (name: string) => | ||
onOptionsChange({ ...options, name }) | ||
const handleCodeChange = (content: string) => | ||
onOptionsChange({ ...options, content }) | ||
return ( | ||
<Stack spacing={4}> | ||
<Stack> | ||
<FormLabel mb="0" htmlFor="name"> | ||
Name: | ||
</FormLabel> | ||
<DebouncedInput | ||
id="name" | ||
initialValue={options.name} | ||
onChange={handleNameChange} | ||
/> | ||
</Stack> | ||
<Stack> | ||
<Text>Code:</Text> | ||
<CodeEditor | ||
value={options.content ?? ''} | ||
lang="js" | ||
onChange={handleCodeChange} | ||
/> | ||
</Stack> | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
apps/builder/playwright/fixtures/typebots/logic/code.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"id": "ckz8hnw7m10833no1ar12eov20", | ||
"createdAt": "2022-02-04T14:14:21.394Z", | ||
"updatedAt": "2022-02-04T14:14:21.394Z", | ||
"name": "My typebot", | ||
"ownerId": "ckz6t9iep0006k31a22j05fwq", | ||
"publishedTypebotId": null, | ||
"folderId": null, | ||
"blocks": [ | ||
{ | ||
"id": "tdN9VXcdBWpuh6Gpaz3w4u", | ||
"steps": [ | ||
{ | ||
"id": "cVRL5EuVruTK31SAaVCvNE", | ||
"type": "start", | ||
"label": "Start", | ||
"blockId": "tdN9VXcdBWpuh6Gpaz3w4u", | ||
"outgoingEdgeId": "jqZYCYGxaL8svJbM2h1QAn" | ||
} | ||
], | ||
"title": "Start", | ||
"graphCoordinates": { "x": 0, "y": 0 } | ||
}, | ||
{ | ||
"id": "vymPUjL9AcWpkg9PkUXovk", | ||
"graphCoordinates": { "x": 685, "y": 194 }, | ||
"title": "Block #1", | ||
"steps": [ | ||
{ | ||
"id": "sa8WhnrMyMjYCBMeozfYRoi", | ||
"blockId": "vymPUjL9AcWpkg9PkUXovk", | ||
"type": "Code", | ||
"options": { "name": "Code snippet" } | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "rEJ3PhFQc7diJ23jdoF6w7", | ||
"graphCoordinates": { "x": 294, "y": 201 }, | ||
"title": "Block #2", | ||
"steps": [ | ||
{ | ||
"id": "s7QRApVZmVFZgS53CNruBRz", | ||
"blockId": "rEJ3PhFQc7diJ23jdoF6w7", | ||
"type": "choice input", | ||
"options": { "buttonLabel": "Send", "isMultipleChoice": false }, | ||
"items": [ | ||
{ | ||
"id": "5rWR3enRg6jZyFhtmgbPYo", | ||
"stepId": "s7QRApVZmVFZgS53CNruBRz", | ||
"type": 0, | ||
"content": "Trigger code", | ||
"outgoingEdgeId": "6aVDkPMEsadze2vf4mLiYt" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"variables": [], | ||
"edges": [ | ||
{ | ||
"from": { | ||
"blockId": "tdN9VXcdBWpuh6Gpaz3w4u", | ||
"stepId": "cVRL5EuVruTK31SAaVCvNE" | ||
}, | ||
"to": { "blockId": "rEJ3PhFQc7diJ23jdoF6w7" }, | ||
"id": "jqZYCYGxaL8svJbM2h1QAn" | ||
}, | ||
{ | ||
"from": { | ||
"blockId": "rEJ3PhFQc7diJ23jdoF6w7", | ||
"stepId": "s7QRApVZmVFZgS53CNruBRz", | ||
"itemId": "5rWR3enRg6jZyFhtmgbPYo" | ||
}, | ||
"to": { "blockId": "vymPUjL9AcWpkg9PkUXovk" }, | ||
"id": "6aVDkPMEsadze2vf4mLiYt" | ||
} | ||
], | ||
"theme": { | ||
"chat": { | ||
"inputs": { | ||
"color": "#303235", | ||
"backgroundColor": "#FFFFFF", | ||
"placeholderColor": "#9095A0" | ||
}, | ||
"buttons": { "color": "#FFFFFF", "backgroundColor": "#0042DA" }, | ||
"hostBubbles": { "color": "#303235", "backgroundColor": "#F7F8FF" }, | ||
"guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" } | ||
}, | ||
"general": { "font": "Open Sans", "background": { "type": "None" } } | ||
}, | ||
"settings": { | ||
"general": { "isBrandingEnabled": true }, | ||
"metadata": { | ||
"description": "Build beautiful conversational forms and embed them directly in your applications without a line of code. Triple your response rate and collect answers that has more value compared to a traditional form." | ||
}, | ||
"typingEmulation": { "speed": 300, "enabled": true, "maxDelay": 1.5 } | ||
}, | ||
"publicId": null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import test, { expect } from '@playwright/test' | ||
import path from 'path' | ||
import { typebotViewer } from '../../services/selectorUtils' | ||
import { importTypebotInDatabase } from '../../services/database' | ||
import { generate } from 'short-uuid' | ||
|
||
const typebotId = generate() | ||
|
||
test.describe('Code step', () => { | ||
test('code should trigger', async ({ page }) => { | ||
await importTypebotInDatabase( | ||
path.join(__dirname, '../../fixtures/typebots/logic/code.json'), | ||
{ | ||
id: typebotId, | ||
} | ||
) | ||
|
||
await page.goto(`/typebots/${typebotId}/edit`) | ||
await page.click('text=Configure...') | ||
await page.fill( | ||
'div[role="textbox"]', | ||
'window.location.href = "https://www.google.com"' | ||
) | ||
|
||
await page.click('text=Preview') | ||
await typebotViewer(page).locator('text=Trigger code').click() | ||
await expect(page).toHaveURL('https://www.google.com') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
e3e07dd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
viewer-v2 – ./apps/viewer
demo.wemakebots.xyz
zap.fundviser.in
chat.matthesv.de
viewer.typebot.io
bot.matthesv.de
chat.hayuri.id
app.yvon.earth
bot.contakit.com
88584434.therpm.club
92109660.therpm.club
criar.somaperuzzo.com
bot.digitalpointer.id
bot.outstandbrand.com
bot.pratikmandalia.com
bot.adventureconsulting.hu
chat.thehomebuyersusa.com
link.venturasuceder.com
chat.atlasoutfittersk9.com
invite.bridesquadapp.com
typebot-viewer.vercel.app
tarian.theiofoundation.org
viewer-v2-git-main-typebot-io.vercel.app
bot.pinpointinteractive.com
viewer-v2-typebot-io.vercel.app
e3e07dd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
builder-v2 – ./apps/builder
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app