import { Flex, Heading, HStack, IconButton, Stack, Tag, useToast, Wrap, Text, } from '@chakra-ui/react' import { TrashIcon } from 'assets/icons' import { UpgradeButton } from 'components/shared/buttons/UpgradeButton' import { useTypebot } from 'contexts/TypebotContext/TypebotContext' import { useUser } from 'contexts/UserContext' import React from 'react' import { parseDefaultPublicId } from 'services/typebots' import { isFreePlan } from 'services/user' import { isDefined, isNotDefined } from 'utils' import { CustomDomainsDropdown } from './customDomain/CustomDomainsDropdown' import { EditableUrl } from './EditableUrl' import { integrationsList } from './integrations/EmbedButton' export const ShareContent = () => { const { user } = useUser() const { typebot, updateOnBothTypebots } = useTypebot() const toast = useToast({ position: 'top-right', status: 'error', }) const handlePublicIdChange = (publicId: string) => { if (publicId === typebot?.publicId) return if (publicId.length < 4) return toast({ description: 'ID must be longer than 4 characters' }) updateOnBothTypebots({ publicId }) } const publicId = typebot ? typebot?.publicId ?? parseDefaultPublicId(typebot.name, typebot.id) : '' const isPublished = isDefined(typebot?.publishedTypebotId) const handleCustomDomainChange = (customDomain: string | null) => updateOnBothTypebots({ customDomain }) return ( Your typebot link {typebot && ( )} {typebot?.customDomain && ( handleCustomDomainChange( typebot.customDomain?.split('/')[0] + pathname ) } /> } aria-label="Remove custom domain" size="xs" onClick={() => handleCustomDomainChange(null)} /> )} {isFreePlan(user) ? ( Add my domain{' '} Pro ) : ( <> {isNotDefined(typebot?.customDomain) && ( )} )} Embed your typebot {integrationsList.map((IntegrationButton, idx) => ( ))} ) }