| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
import domReady from '@wordpress/dom-ready'; |
| 5 |
import { render } from '@wordpress/element'; |
| 6 |
|
| 7 |
/** |
| 8 |
* Internal dependencies |
| 9 |
*/ |
| 10 |
import { ParselyRecommendations } from './components/parsely-recommendations'; |
| 11 |
import { RecommendationsStore } from './recommendations-store'; |
| 12 |
|
| 13 |
domReady( () => { |
| 14 |
const blocks = document.querySelectorAll( '.wp-block-wp-parsely-recommendations' ); |
| 15 |
blocks.forEach( ( block ) => |
| 16 |
render( |
| 17 |
<RecommendationsStore> |
| 18 |
{ /* @ts-ignore */ } |
| 19 |
<ParselyRecommendations { ...block.dataset } key={ block.id } /> |
| 20 |
</RecommendationsStore>, |
| 21 |
block |
| 22 |
) |
| 23 |
); |
| 24 |
} ); |
| 25 |
|