import { buildProductTemplatesManager } from "@coveo/headless/commerce";
import { TemplateProvider } from "../../common/template-provider/template-provider.js";
import "../atomic-product-template/atomic-product-template.js";
class ProductTemplateProvider extends TemplateProvider {
    makeDefaultTemplate() {
        const content = document.createDocumentFragment();
        const markup = `
      <atomic-product-section-name>
        <atomic-product-link class="font-bold"></atomic-product-link>
      </atomic-product-section-name>
      <atomic-product-section-visual>
        <atomic-product-image field="ec_thumbnails"></atomic-product-image>
      </atomic-product-section-visual>
    `;
        const template = document.createElement('template');
        template.innerHTML = markup.trim();
        content.appendChild(template.content);
        const linkContent = document.createDocumentFragment();
        const linkMarkup = `
      <atomic-product-link>
      ${this.gridCellLinkTarget ? `<a slot="attributes" target="${this.gridCellLinkTarget}"></a>` : ''}
      </atomic-product-link>
    `;
        const linkTemplate = document.createElement('template');
        linkTemplate.innerHTML = linkMarkup.trim();
        linkContent.appendChild(linkTemplate.content);
        return {
            content,
            linkContent,
            conditions: []
        };
    }
    constructor(props, gridCellLinkTarget){
        super(props, ()=>buildProductTemplatesManager()), this.gridCellLinkTarget = gridCellLinkTarget;
    }
}
export { ProductTemplateProvider };
