import { Button, Card, Heading1, InlineLink, Input, LabelText, Text } from '@algolia/ui-library'; import { useBaseUrlUtils } from '@docusaurus/useBaseUrl'; import React, { useState } from 'react'; function ApplyForm() { const { withBaseUrl } = useBaseUrlUtils(); const [state, setState] = useState({ status: 'stalled', message: '' }); const [url, setUrl] = useState(''); const [email, setEmail] = useState(''); const [repo, setRepo] = useState(''); const handleSetUrl = (event) => { setUrl(event.target.value); }; const handleSetEmail = (event) => { setEmail(event.target.value); }; const handleSetRepo = (event) => { setRepo(event.target.value); }; const onSubmit = (event) => { event.preventDefault(); if (state.status === 'loading') { return; } setState({ status: 'loading' }); const applyForm = event.target; const method = applyForm.getAttribute('method'); const action = applyForm.getAttribute('action'); const formData = new FormData(applyForm); const data = {}; formData.forEach(function (value, key) { data[key] = value; }); if (!data.repoURL) { data.repoURL = 'https://www.github.com/algolia/docsearch'; } const body = JSON.stringify(data); fetch(action, { method, headers: { 'Content-Type': 'application/json' }, body, }) .then((response) => response.json()) .then(({ success, message }) => { if (!success) { return setState({ status: 'failed', message: 'Unable to submit your request.', }); } return setState({ status: 'succeed', message }); }) .catch(() => setState({ status: 'failed', message: 'Unable to submit your request.', }), ); }; if (state.status === 'succeed' && state.message) { return ( {state.message.startsWith('Your DocSearch') ? ( <> URL Already Submitted!
{state.message} ) : ( <> Thank You!
{state.message} We'll get back to you at {email} with the snippet you'll need to integrate into {url}. Please be patient, in the meantime, you can implement{' '} our recommendations for building a great DocSearch experience. )}
); } return ( Note: Due to the holidays in the US, reviews of DocSearch applications will not take place from December 23 - December 27. Thank you for your understanding.

Documentation or Blog URL We'll scrape pages at this address and index the content on Algolia. Email We'll send you the snippet you'll have to integrate into your website and grant access to your Algolia application. Repository URL (Optional)
My website is a publicly available developer documentation or a technical blog. I am the owner of the website, or otherwise have obtained and continue to maintain any required consents necessary to use DocSearch on the requested domain. And I have{' '} read the checklist. I understand that this is a Free Service as described in Algolia's{' '} Terms of Service and Algolia's{' '} Special Free Services Terms .
Refer to Algolia's Privacy Policy for more information on how we use and protect your data For support requests, make sure to first{' '} read our policy. {' '}
); } export default ApplyForm;