| 1 |
/** |
| 2 |
* WordPress dependencies. |
| 3 |
*/ |
| 4 |
import { render } from '@wordpress/element'; |
| 5 |
|
| 6 |
/** |
| 7 |
* Internal dependencies. |
| 8 |
*/ |
| 9 |
import { ApiSearchProvider } from '../api-search'; |
| 10 |
import { apiEndpoint, apiHost, argsSchema, paramPrefix, requestIdBase } from './config'; |
| 11 |
import Modal from './apps/modal'; |
| 12 |
|
| 13 |
/** |
| 14 |
* Initialize Instant Results. |
| 15 |
*/ |
| 16 |
const init = () => { |
| 17 |
const el = document.getElementById('ep-instant-results'); |
| 18 |
|
| 19 |
render( |
| 20 |
<ApiSearchProvider |
| 21 |
apiEndpoint={apiEndpoint} |
| 22 |
apiHost={apiHost} |
| 23 |
argsSchema={argsSchema} |
| 24 |
paramPrefix={paramPrefix} |
| 25 |
requestIdBase={requestIdBase} |
| 26 |
> |
| 27 |
<Modal /> |
| 28 |
</ApiSearchProvider>, |
| 29 |
el, |
| 30 |
); |
| 31 |
}; |
| 32 |
|
| 33 |
window.addEventListener('DOMContentLoaded', init); |
| 34 |
|