Skip to content

Commit

Permalink
feat(embed): 🎨 Update instructions for 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 14, 2022
1 parent 5a2df9f commit 69701d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const IframeEmbedCode = ({
heightLabel,
}: Props & FlexProps) => {
const { typebot } = useTypebot()
const src = `https://${typebot?.publicId}.typebot.io`
const src = `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`
const code = `<iframe src="${src}" width="${widthLabel}" height="${heightLabel}" />`

return <CodeEditor value={code} lang="html" isReadOnly />
Expand Down
8 changes: 4 additions & 4 deletions apps/builder/components/share/codeSnippets/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const parseInitContainerCode = ({
})
return prettier.format(
`Typebot.initContainer("typebot-container", {
publishId: "${publishId}",${bgColorString}${customDomainString}${hiddenVariablesString}
url: "${process.env.NEXT_PUBLIC_VIEWER_URL}/${publishId}",${bgColorString}${customDomainString}${hiddenVariablesString}
});`,
{ parser: 'babel', plugins: [parserBabel] }
)
Expand All @@ -110,7 +110,7 @@ export const parseInitPopupCode = ({
})
const { delayString } = parsePopupParams({ delay })
return prettier.format(
`var typebotCommands = Typebot.initPopup({publishId: "${publishId}",${delayString}${bgColorString}${customDomainString}${hiddenVariablesString}});`,
`var typebotCommands = Typebot.initPopup({url: "${process.env.NEXT_PUBLIC_VIEWER_URL}/${publishId}",${delayString}${bgColorString}${customDomainString}${hiddenVariablesString}});`,
{ parser: 'babel', plugins: [parserBabel] }
)
}
Expand All @@ -134,9 +134,9 @@ export const parseInitBubbleCode = ({
proactiveMessage,
})
return prettier.format(
`var typebotCommands = Typebot.initBubble({publishId: "${publishId}",${bgColorString}${customDomainString}${hiddenVariablesString}${proactiveMessageString}${buttonString}});`,
`var typebotCommands = Typebot.initBubble({url: "${process.env.NEXT_PUBLIC_VIEWER_URL}/${publishId}",${bgColorString}${customDomainString}${hiddenVariablesString}${proactiveMessageString}${buttonString}});`,
{ parser: 'babel', plugins: [parserBabel] }
)
}

export const typebotJsHtml = `<script src="https://unpkg.com/typebot-js@2.1.3"></script>`
export const typebotJsHtml = `<script src="https://unpkg.com/typebot-js@2.2.0"></script>`
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export const NotionModal = ({
<Input
pr="4.5rem"
type={'text'}
defaultValue={`https://bot.typebot.io/${publicId}`}
defaultValue={`${process.env.NEXT_PUBLIC_VIEWER_URL}/${publicId}`}
/>
<InputRightElement width="4.5rem">
<CopyButton
textToCopy={`https://bot.typebot.io/${publicId}`}
textToCopy={`${process.env.NEXT_PUBLIC_VIEWER_URL}/${publicId}`}
/>
</InputRightElement>
</InputGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ export const WordpressModal = ({
</Link>
</ListItem>
<ListItem>
Copy your typebot ID
Copy your typebot URL
<InputGroup size="md" mt={2}>
<Input pr="4.5rem" type={'text'} defaultValue={publicId} />
<Input
pr="4.5rem"
type={'text'}
defaultValue={`${process.env.NEXT_PUBLIC_VIEWER_URL}/${publicId}`}
/>
<InputRightElement width="4.5rem">
<CopyButton textToCopy={publicId} />
<CopyButton
textToCopy={`${process.env.NEXT_PUBLIC_VIEWER_URL}/${publicId}`}
/>
</InputRightElement>
</InputGroup>
</ListItem>
Expand Down