import { createElement, Component, useEffect, useState, Fragment, } from '@wordpress/element' import Downshift from 'downshift' import { __ } from 'ct-i18n' import classnames from 'classnames' const ListPicker = ({ listId, provider, apiKey, apiUrl, onChange }) => { const [lists, setLists] = useState([]) const [isLoadingLists, setListsLoading] = useState(false) let [{ controller }, setAbortState] = useState({ controller: null, }) const maybeFetchLists = async () => { if (controller) { controller.abort() } setListsLoading(true) if ('AbortController' in window) { controller = new AbortController() setAbortState({ controller, }) } const body = new FormData() body.append('api_key', apiKey) body.append('api_url', apiUrl) body.append('provider', provider) body.append( 'action', 'blocksy_ext_newsletter_subscribe_maybe_get_lists' ) body.append('nonce', ctDashboardLocalizations.dashboard_actions_nonce) try { const response = await fetch(ctDashboardLocalizations.ajax_url, { method: 'POST', signal: controller.signal, body, }) if (response.status === 200) { const body = await response.json() if (body.success) { if (body.data.result !== 'api_key_invalid') { setListsLoading(false) setLists( body.data.result.map((list) => ({ ...list, id: list.id.toString(), })) ) return } } } } catch (e) {} setLists([]) setListsLoading(false) } useEffect(() => { if (!apiKey && !['mailpoet', 'fluentcrm'].includes(provider)) { setLists([]) return } maybeFetchLists() }, [provider, apiKey, apiUrl]) return lists.length === 0 ? (
) : ( id === listId) ? listId : ''} onChange={(selection) => onChange(selection)} itemToString={(item) => item ? (lists.find(({ id }) => id === item) || {}).name : '' }> {({ getInputProps, getItemProps, getLabelProps, getMenuProps, isOpen, inputValue, highlightedIndex, selectedItem, openMenu, }) => (
openMenu(), onClick: () => openMenu(), })} placeholder={__('Select list...', 'blocksy-companion')} readOnly /> {isOpen && (
{lists.map((item, index) => (
{item.name}
))}
)}
)}
) } export default ListPicker Welcome to JITO UK

Welcome to JITO UK

UK Jains Directory
previous arrow
next arrow
WhatsApp Image 2026-01-20 at 09.49.01
previous arrow
next arrow
Global Chapter
0
Global Members
0
UK Chapter Launch
0

Our Leaders

Nitin Jain

JITO UK - Chair

Nitin Ajmera

JITO UK - Vice Chair

Anurag Jain

JITO UK - Secretary

Mukta Jain

JITO UK - Treasurer

About Us

The Jain International Trade Organisation (JITO) is a global network of businessmen, industrialists and professionals. Read More…

OBJECTIVES

Learning

Earning

Returning

Our Events

Mega Fair Flyer New
previous arrow
next arrow