Skip to content

Commit

Permalink
build: 🩹 Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 14, 2022
1 parent aeb0643 commit ec8a27e
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion apps/builder/components/dashboard/FolderContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DashboardFolder } from '.prisma/client'
import { DashboardFolder } from 'db'
import {
Flex,
Heading,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DashboardFolder } from '.prisma/client'
import { DashboardFolder } from 'db'
import {
Button,
Editable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const ChatEmbedCode = ({

const snippet = prettier.format(
createSnippet({
publishId: typebot?.publicId ?? '',
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
button,
proactiveMessage,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const ContainerEmbedCode = ({

const snippet = prettier.format(
parseSnippet({
publishId: typebot?.publicId ?? '',
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
heightLabel,
widthLabel,
}),
Expand All @@ -38,7 +38,7 @@ type SnippetProps = IframeParams &
Pick<ContainerEmbedCodeProps, 'widthLabel' | 'heightLabel'>

const parseSnippet = ({
publishId,
url,
customDomain,
backgroundColor,
hiddenVariables,
Expand All @@ -48,7 +48,7 @@ const parseSnippet = ({
customDomain,
hiddenVariables,
backgroundColor,
publishId,
url,
})
return `${typebotJsHtml}
<div id="typebot-container" style="width: ${embedProps.widthLabel}; height: ${embedProps.heightLabel};"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const PopupEmbedCode = ({ delay }: PopupEmbedCodeProps & FlexProps) => {
const { typebot } = useTypebot()
const snippet = prettier.format(
createSnippet({
publishId: typebot?.publicId ?? '',
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
delay,
}),
{
Expand Down
18 changes: 9 additions & 9 deletions apps/builder/components/share/codeSnippets/ReactCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const StandardReactDiv = ({
const { typebot } = useTypebot()
const snippet = prettier.format(
parseContainerSnippet({
publishId: typebot?.publicId ?? '',
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
heightLabel,
widthLabel,
}),
Expand All @@ -35,14 +35,14 @@ type SnippetProps = IframeParams &
Pick<StandardReactDivProps, 'widthLabel' | 'heightLabel'>

const parseContainerSnippet = ({
publishId,
url,
customDomain,
backgroundColor,
hiddenVariables,
...embedProps
}: SnippetProps): string => {
const jsCode = parseInitContainerCode({
publishId,
url,
customDomain,
backgroundColor,
hiddenVariables,
Expand All @@ -67,7 +67,7 @@ export const PopupReactCode = ({ delay }: PopupEmbedCodeProps & FlexProps) => {
const { typebot } = useTypebot()
const snippet = prettier.format(
parsePopupSnippet({
publishId: typebot?.publicId ?? '',
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
delay,
}),
{
Expand All @@ -79,14 +79,14 @@ export const PopupReactCode = ({ delay }: PopupEmbedCodeProps & FlexProps) => {
}

const parsePopupSnippet = ({
publishId,
url,
customDomain,
backgroundColor,
hiddenVariables,
delay,
}: PopupParams): string => {
const jsCode = parseInitPopupCode({
publishId,
url,
customDomain,
backgroundColor,
hiddenVariables,
Expand Down Expand Up @@ -114,7 +114,7 @@ export const ChatReactCode = ({
const { typebot } = useTypebot()
const snippet = prettier.format(
parseBubbleSnippet({
publishId: typebot?.publicId ?? '',
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${typebot?.publicId}`,
button,
proactiveMessage,
}),
Expand All @@ -127,15 +127,15 @@ export const ChatReactCode = ({
}

const parseBubbleSnippet = ({
publishId,
url,
customDomain,
backgroundColor,
hiddenVariables,
proactiveMessage,
button,
}: BubbleParams): string => {
const jsCode = parseInitBubbleCode({
publishId,
url,
customDomain,
backgroundColor,
hiddenVariables,
Expand Down
12 changes: 6 additions & 6 deletions apps/builder/components/share/codeSnippets/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const parseBubbleParams = ({
})

export const parseInitContainerCode = ({
publishId,
url,
customDomain,
backgroundColor,
hiddenVariables,
Expand All @@ -89,14 +89,14 @@ export const parseInitContainerCode = ({
})
return prettier.format(
`Typebot.initContainer("typebot-container", {
url: "${process.env.NEXT_PUBLIC_VIEWER_URL}/${publishId}",${bgColorString}${customDomainString}${hiddenVariablesString}
url: "${url}",${bgColorString}${customDomainString}${hiddenVariablesString}
});`,
{ parser: 'babel', plugins: [parserBabel] }
)
}

export const parseInitPopupCode = ({
publishId,
url,
customDomain,
hiddenVariables,
backgroundColor,
Expand All @@ -110,13 +110,13 @@ export const parseInitPopupCode = ({
})
const { delayString } = parsePopupParams({ delay })
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] }
)
}

export const parseInitBubbleCode = ({
publishId,
url,
customDomain,
hiddenVariables,
backgroundColor,
Expand All @@ -134,7 +134,7 @@ export const parseInitBubbleCode = ({
proactiveMessage,
})
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] }
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const StandardInstructions = ({ publicId }: Pick<ModalProps, 'publicId'>) => {
})

const jsCode = parseInitContainerCode({
publishId: publicId,
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${publicId}`,
})
const headCode = `${typebotJsHtml}
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const StandardInstructions = ({ publicId }: Pick<ModalProps, 'publicId'>) => {
})

const jsCode = parseInitContainerCode({
publishId: publicId,
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/${publicId}`,
})
const headCode = prettier.format(
`${typebotJsHtml}<script>${jsCode}</script>`,
Expand Down
3 changes: 1 addition & 2 deletions apps/builder/components/shared/SupportBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export const SupportBubble = () => {
useEffect(() => {
if (isCloudProdInstance())
initBubble({
publishId: 'typebot-support',
viewerHost: process.env.NEXT_PUBLIC_VIEWER_URL,
url: `${process.env.NEXT_PUBLIC_VIEWER_URL}/typebot-support`,
backgroundColor: '#ffffff',
button: { color: '#0042DA' },
hiddenVariables: {
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/services/folders.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DashboardFolder } from '.prisma/client'
import { DashboardFolder } from 'db'
import useSWR from 'swr'
import { fetcher } from './utils'
import { stringify } from 'qs'
Expand Down