import { PopoverContent, PopoverArrow, PopoverBody, useEventListener, Portal, IconButton, } from '@chakra-ui/react' import { ExpandIcon } from 'assets/icons' import { ConditionItem, ConditionStep, InputStepType, IntegrationStepType, LogicStepType, Step, StepOptions, TextBubbleStep, Webhook, } from 'models' import { useRef } from 'react' import { TextInputSettingsBody, NumberInputSettingsBody, EmailInputSettingsBody, UrlInputSettingsBody, DateInputSettingsBody, } from './bodies' import { ChoiceInputSettingsBody } from './bodies/ChoiceInputSettingsBody' import { CodeSettings } from './bodies/CodeSettings' import { ConditionSettingsBody } from './bodies/ConditionSettingsBody' import { GoogleAnalyticsSettings } from './bodies/GoogleAnalyticsSettings' import { GoogleSheetsSettingsBody } from './bodies/GoogleSheetsSettingsBody' import { PhoneNumberSettingsBody } from './bodies/PhoneNumberSettingsBody' import { RedirectSettings } from './bodies/RedirectSettings' import { SendEmailSettings } from './bodies/SendEmailSettings' import { SetVariableSettings } from './bodies/SetVariableSettings' import { TypebotLinkSettingsForm } from './bodies/TypebotLinkSettingsForm' import { WebhookSettings } from './bodies/WebhookSettings' import { ZapierSettings } from './bodies/ZapierSettings' type Props = { step: Exclude webhook?: Webhook onExpandClick: () => void onStepChange: (updates: Partial) => void } export const SettingsPopoverContent = ({ onExpandClick, ...props }: Props) => { const ref = useRef(null) const handleMouseDown = (e: React.MouseEvent) => e.stopPropagation() const handleMouseWheel = (e: WheelEvent) => { e.stopPropagation() } useEventListener('wheel', handleMouseWheel, ref.current) return ( } size="xs" onClick={onExpandClick} /> ) } export const StepSettings = ({ step, onStepChange, }: { step: Step webhook?: Webhook onStepChange: (step: Partial) => void }) => { const handleOptionsChange = (options: StepOptions) => { onStepChange({ options } as Partial) } const handleItemChange = (updates: Partial) => { onStepChange({ items: [{ ...(step as ConditionStep).items[0], ...updates }], } as Partial) } switch (step.type) { case InputStepType.TEXT: { return ( ) } case InputStepType.NUMBER: { return ( ) } case InputStepType.EMAIL: { return ( ) } case InputStepType.URL: { return ( ) } case InputStepType.DATE: { return ( ) } case InputStepType.PHONE: { return ( ) } case InputStepType.CHOICE: { return ( ) } case LogicStepType.SET_VARIABLE: { return ( ) } case LogicStepType.CONDITION: { return ( ) } case LogicStepType.REDIRECT: { return ( ) } case LogicStepType.CODE: { return ( ) } case LogicStepType.TYPEBOT_LINK: { return ( ) } case IntegrationStepType.GOOGLE_SHEETS: { return ( ) } case IntegrationStepType.GOOGLE_ANALYTICS: { return ( ) } case IntegrationStepType.ZAPIER: { return } case IntegrationStepType.WEBHOOK: { return ( ) } case IntegrationStepType.EMAIL: { return ( ) } default: { return <> } } }