import React, { Fragment } from 'react';
import { portalId } from '../../constants/leadinConfig';
import { __ } from '@wordpress/i18n';
import ElementorBanner from '../Common/ElementorBanner';
import UISpinner from '../../shared/UIComponents/UISpinner';
import {
BackgroudAppContext,
useBackgroundAppContext,
} from '../../iframe/useBackgroundApp';
import useForms from './hooks/useForms';
import { useGetEmbedder } from '../../utils/useGetEmbedder';
interface IElementorFormSelectProps {
formId: string;
setAttributes: Function;
}
function ElementorFormSelect({
formId,
setAttributes,
}: IElementorFormSelectProps) {
const { hasError, forms, loading } = useForms();
return loading ? (
) : hasError ? (
{__('Please refresh your forms or try again in a few minutes', 'leadin')}
) : (
);
}
function ElementorFormSelectWrapper(props: IElementorFormSelectProps) {
const isBackgroundAppReady = useBackgroundAppContext();
return (
{!isBackgroundAppReady ? (