import {useCallback, useEffect, useState} from 'react'; import apiFetch from '@wordpress/api-fetch'; import {UseAsyncSelectOptionReturn} from '@givewp/admin/types'; /** * Custom hook for handling async option selection with pagination and search * * @since 4.11.0 */ export function useAsyncSelectOptions({ recordId, selectedOptionRecord, endpoint, recordsFormatter = (records: any) => records, optionFormatter, queryParams, perPage = 30, resetOnChange = false, }: AsyncSelectOptionsConfig): UseAsyncSelectOptionReturn { const [page, setPage] = useState(0); const [selectedOption, setSelectedOption] = useState