(function () {
if (typeof window.SwymStorefrontLayoutContext === 'undefined') {
window.SwymStorefrontLayoutContext = {};
}
if(typeof window.SwymStorefrontLayoutExtensions === 'undefined'){
window.SwymStorefrontLayoutExtensions = {};
}
class SwymWishlistStorefrontLayout extends HTMLElement {
constructor() {
super();
}
connectedCallback() {
this.StorefrontLayoutType = SwymStorefrontLayoutContext?.Settings?.StorefrontLayoutType;
this.renderUI();
SwymStorefrontLayoutExtensions.SwymStorefrontLayoutPageActions = document.querySelector('swym-storefront-layout-actions#swym-storefront-layout-actions-target-page');
}
renderUI(){
let elementTag;
switch (this.StorefrontLayoutType) {
case 'as-drawer':
elementTag = 'swym-storefront-layout-as-drawer';
break;
case 'as-section':
elementTag = 'swym-storefront-layout-as-section';
break;
case 'as-modal':
elementTag = 'swym-storefront-layout-as-modal';
break;
default:
window._swat?.utils.error(`Unknown StorefrontLayoutType: ${this.StorefrontLayoutType}`);
return;
}
this.innerHTML = `
<${elementTag} ${this.StorefrontLayoutType==='as-section'?`container-id="${SwymStorefrontLayoutContext?.Settings.StorefrontLayoutAsSectionContainerId}"`:''}>${elementTag}>
`
this.classList.add(`${elementTag}`);
}
}
customElements.define('swym-storefront-layout', SwymWishlistStorefrontLayout);
})();