2
0

build: add pnpm

This commit is contained in:
Baptiste Arnaud
2022-08-08 08:21:36 +02:00
parent 8c3b5058f1
commit ee338f62dc
183 changed files with 19442 additions and 18364 deletions

View File

@ -16,11 +16,10 @@ import { useWorkspace } from 'contexts/WorkspaceContext'
import React from 'react'
import { parseDefaultPublicId } from 'services/typebots'
import { isFreePlan } from 'services/workspace'
import { isDefined, isNotDefined } from 'utils'
import { getViewerUrl, isDefined, isNotDefined } from 'utils'
import { CustomDomainsDropdown } from './customDomain/CustomDomainsDropdown'
import { EditableUrl } from './EditableUrl'
import { integrationsList } from './integrations/EmbedButton'
import { env } from 'utils'
export const ShareContent = () => {
const { workspace } = useWorkspace()
@ -59,7 +58,9 @@ export const ShareContent = () => {
</Heading>
{typebot && (
<EditableUrl
hostname={env('VIEWER_URL') ?? 'https://typebot.io'}
hostname={
getViewerUrl({ isBuilder: true }) ?? 'https://typebot.io'
}
pathname={publicId}
onPathnameChange={handlePublicIdChange}
/>

View File

@ -1,11 +1,11 @@
import { FlexProps } from '@chakra-ui/layout'
import prettier from 'prettier/standalone'
import parserHtml from 'prettier/parser-html'
import { BubbleParams } from 'typebot-js'
import { parseInitBubbleCode, typebotJsHtml } from '../params'
import { useTypebot } from 'contexts/TypebotContext'
import { CodeEditor } from 'components/shared/CodeEditor'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
import { FlexProps } from '@chakra-ui/react'
type ChatEmbedCodeProps = {
withStarterVariables?: boolean
@ -21,9 +21,7 @@ export const ChatEmbedCode = ({
const snippet = prettier.format(
createSnippet({
url: `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${typebot?.publicId}`,
button,
proactiveMessage,

View File

@ -5,7 +5,7 @@ import { parseInitContainerCode, typebotJsHtml } from '../params'
import { IframeParams } from 'typebot-js'
import { useTypebot } from 'contexts/TypebotContext'
import { CodeEditor } from 'components/shared/CodeEditor'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
type ContainerEmbedCodeProps = {
widthLabel: string
@ -23,9 +23,7 @@ export const ContainerEmbedCode = ({
const snippet = prettier.format(
parseSnippet({
url: `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${typebot?.publicId}`,
heightLabel,
widthLabel,

View File

@ -1,7 +1,7 @@
import { FlexProps } from '@chakra-ui/react'
import { CodeEditor } from 'components/shared/CodeEditor'
import { useTypebot } from 'contexts/TypebotContext'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
type Props = {
widthLabel: string
@ -14,9 +14,7 @@ export const IframeEmbedCode = ({
}: Props & FlexProps) => {
const { typebot } = useTypebot()
const src = `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${typebot?.publicId}`
const code = `<iframe src="${src}" width="${widthLabel}" height="${heightLabel}" />`

View File

@ -1,10 +1,10 @@
import { FlexProps } from '@chakra-ui/layout'
import { FlexProps } from '@chakra-ui/react'
import { CodeEditor } from 'components/shared/CodeEditor'
import { useTypebot } from 'contexts/TypebotContext'
import parserHtml from 'prettier/parser-html'
import prettier from 'prettier/standalone'
import { PopupParams } from 'typebot-js'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
import { parseInitPopupCode, typebotJsHtml } from '../params'
type PopupEmbedCodeProps = {
@ -18,9 +18,7 @@ export const PopupEmbedCode = ({ delay }: PopupEmbedCodeProps & FlexProps) => {
const snippet = prettier.format(
createSnippet({
url: `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${typebot?.publicId}`,
delay,
}),

View File

@ -10,7 +10,7 @@ import parserBabel from 'prettier/parser-babel'
import prettier from 'prettier/standalone'
import { CodeEditor } from 'components/shared/CodeEditor'
import { useTypebot } from 'contexts/TypebotContext'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
type StandardReactDivProps = { widthLabel: string; heightLabel: string }
export const StandardReactDiv = ({
@ -21,9 +21,7 @@ export const StandardReactDiv = ({
const snippet = prettier.format(
parseContainerSnippet({
url: `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${typebot?.publicId}`,
heightLabel,
widthLabel,
@ -73,9 +71,7 @@ export const PopupReactCode = ({ delay }: PopupEmbedCodeProps & FlexProps) => {
const snippet = prettier.format(
parsePopupSnippet({
url: `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${typebot?.publicId}`,
delay,
}),
@ -124,9 +120,7 @@ export const ChatReactCode = ({
const snippet = prettier.format(
parseBubbleSnippet({
url: `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${typebot?.publicId}`,
button,
proactiveMessage,

View File

@ -18,7 +18,7 @@ import {
import { useToast } from 'components/shared/hooks/useToast'
import { useEffect, useRef, useState } from 'react'
import { createCustomDomain } from 'services/user'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
const hostnameRegex =
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/
@ -118,9 +118,8 @@ export const CustomDomainModal = ({
<Stack>
<Text fontWeight="bold">Value</Text>
<Text>
{isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')}
{env('VIEWER_INTERNAL_URL') ??
getViewerUrl({ isBuilder: true })}
</Text>
</Stack>
</HStack>

View File

@ -11,7 +11,7 @@ import { PopupEmbedSettings } from 'components/share/codeSnippets/Popup/EmbedSet
import { CodeEditor } from 'components/shared/CodeEditor'
import { useState } from 'react'
import { BubbleParams } from 'typebot-js'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
import { ModalProps } from '../../EmbedButton'
type GtmInstructionsProps = {
@ -41,9 +41,7 @@ const StandardInstructions = ({ publicId }: Pick<ModalProps, 'publicId'>) => {
const jsCode = parseInitContainerCode({
url: `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${publicId}`,
})
const headCode = `${typebotJsHtml}

View File

@ -16,7 +16,7 @@ import {
} from '@chakra-ui/react'
import { CopyButton } from 'components/shared/buttons/CopyButton'
import { PublishFirstInfo } from 'components/shared/Info'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
import { ModalProps } from '../EmbedButton'
export const NotionModal = ({
@ -46,17 +46,15 @@ export const NotionModal = ({
pr="4.5rem"
type={'text'}
defaultValue={`${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ??
getViewerUrl({ isBuilder: true })
}/${publicId}`}
/>
<InputRightElement width="4.5rem">
<CopyButton
textToCopy={`${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ??
getViewerUrl({ isBuilder: true })
}/${publicId}`}
/>
</InputRightElement>

View File

@ -14,7 +14,7 @@ import { BubbleParams } from 'typebot-js'
import { ModalProps } from '../../EmbedButton'
import parserHtml from 'prettier/parser-html'
import prettier from 'prettier/standalone'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
type ShopifyInstructionsProps = {
type: 'standard' | 'popup' | 'bubble'
@ -46,9 +46,7 @@ const StandardInstructions = ({ publicId }: Pick<ModalProps, 'publicId'>) => {
const jsCode = parseInitContainerCode({
url: `${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ?? getViewerUrl({ isBuilder: true })
}/${publicId}`,
})
const headCode = prettier.format(

View File

@ -17,7 +17,7 @@ import {
import { ExternalLinkIcon } from 'assets/icons'
import { CopyButton } from 'components/shared/buttons/CopyButton'
import { PublishFirstInfo } from 'components/shared/Info'
import { env, isEmpty } from 'utils'
import { env, getViewerUrl } from 'utils'
import { ModalProps } from '../EmbedButton'
export const WordpressModal = ({
@ -55,17 +55,15 @@ export const WordpressModal = ({
pr="4.5rem"
type={'text'}
defaultValue={`${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ??
getViewerUrl({ isBuilder: true })
}/${publicId}`}
/>
<InputRightElement width="4.5rem">
<CopyButton
textToCopy={`${
isEmpty(env('VIEWER_INTERNAL_URL'))
? env('VIEWER_URL')
: env('VIEWER_INTERNAL_URL')
env('VIEWER_INTERNAL_URL') ??
getViewerUrl({ isBuilder: true })
}/${publicId}`}
/>
</InputRightElement>