/** * The ways to embed that only Funnelforms Pro has: a popup, a button in a corner, and the embed * code for websites outside WordPress. Only the Pro build reaches this module (Embed.tsx). */ import React from 'react'; import { cssClass, cssSize, frameCode, HEIGHT_UNITS, popupShortcode, widgetShortcode, WIDTH_UNITS, type Corner, type EmbedConfig, type FrameSettings, type PopupSettings, type PopupTrigger, type WidgetAnimation, type WidgetSettings } from '../embed'; import { useBuilder } from './context'; import { CodeBox, Steps, type EmbedMethod } from './EmbedParts'; import { __, sprintf } from './i18n'; import { LegacyNotice } from './LegacyNotice'; import { ColorInput, Notice, NumberInput, Select, TextInput, Toggle } from './ui'; interface Props { method: Exclude; config: EmbedConfig | null; popup: PopupSettings; onPopup: ( popup: PopupSettings ) => void; widget: WidgetSettings; onWidget: ( widget: WidgetSettings ) => void; frame: FrameSettings; onFrame: ( frame: FrameSettings ) => void; } export function EmbedProPanel( props: Props ) { switch ( props.method ) { case 'popup': return ; case 'widget': return ; default: return ; } } /** The block and the Elementor widget offer the same under Display. */ function blockNote(): string { return __( 'In the block "Funnelforms" or the Elementor widget you choose the same under Display, without a shortcode.', 'funnelforms-pro' ); } function PopupPanel( { popup, onPopup }: { popup: PopupSettings; onPopup: ( popup: PopupSettings ) => void } ) { const form = useBuilder( ( s ) => s.form ); if ( ! form ) { return null; } const set = ( patch: Partial ): void => onPopup( { ...popup, ...patch } ); const triggers: Array<{ value: PopupTrigger; label: string }> = [ { value: 'delay', label: __( 'Popup after a delay', 'funnelforms-pro' ) }, { value: 'click', label: __( 'Popup on a click', 'funnelforms-pro' ) }, { value: 'scroll', label: __( 'Popup after scrolling', 'funnelforms-pro' ) }, { value: 'exit', label: __( 'Popup when the visitor is about to leave', 'funnelforms-pro' ) }, ]; const automatic = 'click' !== popup.trigger; const needsNew = 'legacy' === form.renderer && ( 'scroll' === popup.trigger || 'exit' === popup.trigger ); const cls = cssClass( popup.clickClass ) || 'funnelforms-open'; return ( <>
set( { position } ) } />