(function(api) {
    const minimalistic_blog_section_lists = ['banner','categories','tile-list','posts-carousel','grid-posts','latest-posts','featured-products'];
    minimalistic_blog_section_lists.forEach(minimalistic_blog_homepage_scroll);

    function minimalistic_blog_homepage_scroll(item, index) {
        // Detect when the front page sections section is expanded (or closed) so we can adjust the preview accordingly.
        item = item.replace(/-/g, '_');
        wp.customize.section('minimalistic_blog_' + item + '_section', function(section) {
            section.expanded.bind(function(isExpanding) {
                // Value of isExpanding will = true if you're entering the section, false if you're leaving it.
                wp.customize.previewer.send(item, { expanded: isExpanding });
            });
        });
    }
})(wp.customize);