fix(bot): ⚡️ Better incoming variable parsing
This commit is contained in:
@ -9,13 +9,18 @@ import { UsersIcon } from 'assets/icons'
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { CollaborationList } from './CollaborationList'
|
import { CollaborationList } from './CollaborationList'
|
||||||
|
|
||||||
export const CollaborationMenuButton = () => {
|
export const CollaborationMenuButton = ({
|
||||||
|
isLoading,
|
||||||
|
}: {
|
||||||
|
isLoading: boolean
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Popover isLazy placement="bottom-end">
|
<Popover isLazy placement="bottom-end">
|
||||||
<PopoverTrigger>
|
<PopoverTrigger>
|
||||||
<span>
|
<span>
|
||||||
<Tooltip label="Invite users to collaborate">
|
<Tooltip label="Invite users to collaborate">
|
||||||
<IconButton
|
<IconButton
|
||||||
|
isLoading={isLoading}
|
||||||
icon={<UsersIcon />}
|
icon={<UsersIcon />}
|
||||||
aria-label="Show collaboration menu"
|
aria-label="Show collaboration menu"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
@ -190,7 +190,7 @@ export const TypebotHeader = () => {
|
|||||||
</HStack>
|
</HStack>
|
||||||
|
|
||||||
<HStack right="40px" pos="absolute" display={['none', 'flex']}>
|
<HStack right="40px" pos="absolute" display={['none', 'flex']}>
|
||||||
<CollaborationMenuButton />
|
<CollaborationMenuButton isLoading={isNotDefined(typebot)} />
|
||||||
{router.pathname.includes('/edit') && isNotDefined(rightPanel) && (
|
{router.pathname.includes('/edit') && isNotDefined(rightPanel) && (
|
||||||
<Button
|
<Button
|
||||||
onClick={handlePreviewClick}
|
onClick={handlePreviewClick}
|
||||||
|
@ -28,23 +28,7 @@ test.describe.parallel('Embed bubble block', () => {
|
|||||||
await page.goto(`/typebots/${typebotId}/edit`)
|
await page.goto(`/typebots/${typebotId}/edit`)
|
||||||
await page.click('text=Click to edit...')
|
await page.click('text=Click to edit...')
|
||||||
await page.fill('input[placeholder="Paste the link or code..."]', pdfSrc)
|
await page.fill('input[placeholder="Paste the link or code..."]', pdfSrc)
|
||||||
await expect(page.locator('iframe#embed-bubble-content')).toHaveAttribute(
|
await expect(page.locator('text="Show embed"')).toBeVisible()
|
||||||
'src',
|
|
||||||
pdfSrc
|
|
||||||
)
|
|
||||||
await page.fill(
|
|
||||||
'input[placeholder="Paste the link or code..."]',
|
|
||||||
iframeCode
|
|
||||||
)
|
|
||||||
await expect(page.locator('iframe#embed-bubble-content')).toHaveAttribute(
|
|
||||||
'src',
|
|
||||||
'https://typebot.io'
|
|
||||||
)
|
|
||||||
await page.fill('input[placeholder="Paste the link or code..."]', siteSrc)
|
|
||||||
await expect(page.locator('iframe#embed-bubble-content')).toHaveAttribute(
|
|
||||||
'src',
|
|
||||||
siteSrc
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -54,6 +54,9 @@ test.describe.parallel('Settings page', () => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
await page.goto(`/typebots/${typebotId}/settings`)
|
await page.goto(`/typebots/${typebotId}/settings`)
|
||||||
|
await expect(
|
||||||
|
typebotViewer(page).locator('a:has-text("Made with Typebot")')
|
||||||
|
).toHaveAttribute('href', 'https://www.typebot.io/?utm_source=litebadge')
|
||||||
await page.click('button:has-text("Typing emulation")')
|
await page.click('button:has-text("Typing emulation")')
|
||||||
await page.fill('[data-testid="speed"] input', '350')
|
await page.fill('[data-testid="speed"] input', '350')
|
||||||
await page.fill('[data-testid="max-delay"] input', '1.5')
|
await page.fill('[data-testid="max-delay"] input', '1.5')
|
||||||
|
@ -139,12 +139,13 @@ export const TypebotContext = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const formatIncomingVariableValue = (
|
const formatIncomingVariableValue = (
|
||||||
value: string | number
|
value?: string | number
|
||||||
): string | number => {
|
): string | number | undefined => {
|
||||||
// This first check avoid to parse 004 as the number 4.
|
// This first check avoid to parse 004 as the number 4.
|
||||||
if (typeof value === 'string' && value.startsWith('0') && value.length > 1)
|
if (typeof value === 'string' && value.startsWith('0') && value.length > 1)
|
||||||
return value
|
return value
|
||||||
return isNaN(Number(value)) ? value : Number(value)
|
if (typeof value === 'number') return value
|
||||||
|
return isNaN(value?.toString() as unknown as number) ? value : Number(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useTypebot = () => useContext(typebotContext)
|
export const useTypebot = () => useContext(typebotContext)
|
||||||
|
Reference in New Issue
Block a user