2
0

build: 🩹 Fix build

This commit is contained in:
Baptiste Arnaud
2022-03-14 16:14:42 +01:00
parent aeb06433af
commit ec8a27e972
11 changed files with 26 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
import { DashboardFolder } from '.prisma/client' import { DashboardFolder } from 'db'
import { import {
Flex, Flex,
Heading, Heading,

View File

@@ -1,4 +1,4 @@
import { DashboardFolder } from '.prisma/client' import { DashboardFolder } from 'db'
import { import {
Button, Button,
Editable, Editable,

View File

@@ -19,7 +19,7 @@ export const ChatEmbedCode = ({
const snippet = prettier.format( const snippet = prettier.format(
createSnippet({ createSnippet({
publishId: typebot?.publicId ?? '', url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
button, button,
proactiveMessage, proactiveMessage,
}), }),

View File

@@ -21,7 +21,7 @@ export const ContainerEmbedCode = ({
const snippet = prettier.format( const snippet = prettier.format(
parseSnippet({ parseSnippet({
publishId: typebot?.publicId ?? '', url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
heightLabel, heightLabel,
widthLabel, widthLabel,
}), }),
@@ -38,7 +38,7 @@ type SnippetProps = IframeParams &
Pick<ContainerEmbedCodeProps, 'widthLabel' | 'heightLabel'> Pick<ContainerEmbedCodeProps, 'widthLabel' | 'heightLabel'>
const parseSnippet = ({ const parseSnippet = ({
publishId, url,
customDomain, customDomain,
backgroundColor, backgroundColor,
hiddenVariables, hiddenVariables,
@@ -48,7 +48,7 @@ const parseSnippet = ({
customDomain, customDomain,
hiddenVariables, hiddenVariables,
backgroundColor, backgroundColor,
publishId, url,
}) })
return `${typebotJsHtml} return `${typebotJsHtml}
<div id="typebot-container" style="width: ${embedProps.widthLabel}; height: ${embedProps.heightLabel};"></div> <div id="typebot-container" style="width: ${embedProps.widthLabel}; height: ${embedProps.heightLabel};"></div>

View File

@@ -16,7 +16,7 @@ export const PopupEmbedCode = ({ delay }: PopupEmbedCodeProps & FlexProps) => {
const { typebot } = useTypebot() const { typebot } = useTypebot()
const snippet = prettier.format( const snippet = prettier.format(
createSnippet({ createSnippet({
publishId: typebot?.publicId ?? '', url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
delay, delay,
}), }),
{ {

View File

@@ -19,7 +19,7 @@ export const StandardReactDiv = ({
const { typebot } = useTypebot() const { typebot } = useTypebot()
const snippet = prettier.format( const snippet = prettier.format(
parseContainerSnippet({ parseContainerSnippet({
publishId: typebot?.publicId ?? '', url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
heightLabel, heightLabel,
widthLabel, widthLabel,
}), }),
@@ -35,14 +35,14 @@ type SnippetProps = IframeParams &
Pick<StandardReactDivProps, 'widthLabel' | 'heightLabel'> Pick<StandardReactDivProps, 'widthLabel' | 'heightLabel'>
const parseContainerSnippet = ({ const parseContainerSnippet = ({
publishId, url,
customDomain, customDomain,
backgroundColor, backgroundColor,
hiddenVariables, hiddenVariables,
...embedProps ...embedProps
}: SnippetProps): string => { }: SnippetProps): string => {
const jsCode = parseInitContainerCode({ const jsCode = parseInitContainerCode({
publishId, url,
customDomain, customDomain,
backgroundColor, backgroundColor,
hiddenVariables, hiddenVariables,
@@ -67,7 +67,7 @@ export const PopupReactCode = ({ delay }: PopupEmbedCodeProps & FlexProps) => {
const { typebot } = useTypebot() const { typebot } = useTypebot()
const snippet = prettier.format( const snippet = prettier.format(
parsePopupSnippet({ parsePopupSnippet({
publishId: typebot?.publicId ?? '', url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
delay, delay,
}), }),
{ {
@@ -79,14 +79,14 @@ export const PopupReactCode = ({ delay }: PopupEmbedCodeProps & FlexProps) => {
} }
const parsePopupSnippet = ({ const parsePopupSnippet = ({
publishId, url,
customDomain, customDomain,
backgroundColor, backgroundColor,
hiddenVariables, hiddenVariables,
delay, delay,
}: PopupParams): string => { }: PopupParams): string => {
const jsCode = parseInitPopupCode({ const jsCode = parseInitPopupCode({
publishId, url,
customDomain, customDomain,
backgroundColor, backgroundColor,
hiddenVariables, hiddenVariables,
@@ -114,7 +114,7 @@ export const ChatReactCode = ({
const { typebot } = useTypebot() const { typebot } = useTypebot()
const snippet = prettier.format( const snippet = prettier.format(
parseBubbleSnippet({ parseBubbleSnippet({
publishId: typebot?.publicId ?? '', url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
button, button,
proactiveMessage, proactiveMessage,
}), }),
@@ -127,7 +127,7 @@ export const ChatReactCode = ({
} }
const parseBubbleSnippet = ({ const parseBubbleSnippet = ({
publishId, url,
customDomain, customDomain,
backgroundColor, backgroundColor,
hiddenVariables, hiddenVariables,
@@ -135,7 +135,7 @@ const parseBubbleSnippet = ({
button, button,
}: BubbleParams): string => { }: BubbleParams): string => {
const jsCode = parseInitBubbleCode({ const jsCode = parseInitBubbleCode({
publishId, url,
customDomain, customDomain,
backgroundColor, backgroundColor,
hiddenVariables, hiddenVariables,

View File

@@ -76,7 +76,7 @@ const parseBubbleParams = ({
}) })
export const parseInitContainerCode = ({ export const parseInitContainerCode = ({
publishId, url,
customDomain, customDomain,
backgroundColor, backgroundColor,
hiddenVariables, hiddenVariables,
@@ -89,14 +89,14 @@ export const parseInitContainerCode = ({
}) })
return prettier.format( return prettier.format(
`Typebot.initContainer("typebot-container", { `Typebot.initContainer("typebot-container", {
url: "${process.env.NEXT_PUBLIC_VIEWER_URL}/${publishId}",${bgColorString}${customDomainString}${hiddenVariablesString} url: "${url}",${bgColorString}${customDomainString}${hiddenVariablesString}
});`, });`,
{ parser: 'babel', plugins: [parserBabel] } { parser: 'babel', plugins: [parserBabel] }
) )
} }
export const parseInitPopupCode = ({ export const parseInitPopupCode = ({
publishId, url,
customDomain, customDomain,
hiddenVariables, hiddenVariables,
backgroundColor, backgroundColor,
@@ -110,13 +110,13 @@ export const parseInitPopupCode = ({
}) })
const { delayString } = parsePopupParams({ delay }) const { delayString } = parsePopupParams({ delay })
return prettier.format( return prettier.format(
`var typebotCommands = Typebot.initPopup({url: "${process.env.NEXT_PUBLIC_VIEWER_URL}/${publishId}",${delayString}${bgColorString}${customDomainString}${hiddenVariablesString}});`, `var typebotCommands = Typebot.initPopup({url: "${url}",${delayString}${bgColorString}${customDomainString}${hiddenVariablesString}});`,
{ parser: 'babel', plugins: [parserBabel] } { parser: 'babel', plugins: [parserBabel] }
) )
} }
export const parseInitBubbleCode = ({ export const parseInitBubbleCode = ({
publishId, url,
customDomain, customDomain,
hiddenVariables, hiddenVariables,
backgroundColor, backgroundColor,
@@ -134,7 +134,7 @@ export const parseInitBubbleCode = ({
proactiveMessage, proactiveMessage,
}) })
return prettier.format( return prettier.format(
`var typebotCommands = Typebot.initBubble({url: "${process.env.NEXT_PUBLIC_VIEWER_URL}/${publishId}",${bgColorString}${customDomainString}${hiddenVariablesString}${proactiveMessageString}${buttonString}});`, `var typebotCommands = Typebot.initBubble({url: "${url}",${bgColorString}${customDomainString}${hiddenVariablesString}${proactiveMessageString}${buttonString}});`,
{ parser: 'babel', plugins: [parserBabel] } { parser: 'babel', plugins: [parserBabel] }
) )
} }

View File

@@ -39,7 +39,7 @@ const StandardInstructions = ({ publicId }: Pick<ModalProps, 'publicId'>) => {
}) })
const jsCode = parseInitContainerCode({ const jsCode = parseInitContainerCode({
publishId: publicId, url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${publicId}`,
}) })
const headCode = `${typebotJsHtml} const headCode = `${typebotJsHtml}
<script> <script>

View File

@@ -44,7 +44,7 @@ const StandardInstructions = ({ publicId }: Pick<ModalProps, 'publicId'>) => {
}) })
const jsCode = parseInitContainerCode({ const jsCode = parseInitContainerCode({
publishId: publicId, url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${publicId}`,
}) })
const headCode = prettier.format( const headCode = prettier.format(
`${typebotJsHtml}<script>${jsCode}</script>`, `${typebotJsHtml}<script>${jsCode}</script>`,

View File

@@ -12,8 +12,7 @@ export const SupportBubble = () => {
useEffect(() => { useEffect(() => {
if (isCloudProdInstance()) if (isCloudProdInstance())
initBubble({ initBubble({
publishId: 'typebot-support', url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/typebot-support`,
viewerHost: process.env.NEXT_PUBLIC_VIEWER_URL,
backgroundColor: '#ffffff', backgroundColor: '#ffffff',
button: { color: '#0042DA' }, button: { color: '#0042DA' },
hiddenVariables: { hiddenVariables: {

View File

@@ -1,4 +1,4 @@
import { DashboardFolder } from '.prisma/client' import { DashboardFolder } from 'db'
import useSWR from 'swr' import useSWR from 'swr'
import { fetcher } from './utils' import { fetcher } from './utils'
import { stringify } from 'qs' import { stringify } from 'qs'