`);
});
}
const embedProxy = () => {
window.addEventListener('DOMContentLoaded', () => {
if (window.location.pathname.includes('/account')
&& !window.location.pathname.includes('/account/login')
&& !window.location.pathname.includes('/account/register')
&& !window.location.pathname.includes('/account/order')
&& !window.location.pathname.includes('/account/activate')
) {
const mainContent = document.querySelector('#MainContent, #site-main, .shopify-section--main-customers-account, .customer--root, #main-content, #main');
const urlParams = new URLSearchParams(window.location.search);
const fullUrl = urlParams.get('portal')?.replace('/apps/customer-portal', '');
if (mainContent) {
mainContent.innerHTML = '';
const spinner = document.createElement('div');
spinner.id = 'loadingBssSpinner';
spinner.style.width = '100%';
spinner.style.height = '102vh';
spinner.style.display = 'flex';
spinner.style.justifyContent = 'center';
spinner.style.alignItems = 'center';
spinner.innerHTML = `
`;
mainContent.appendChild(spinner);
const style = document.createElement('style');
style.textContent = `
.bss-spinner {
display: block!important;
width: 50px;
height: 50px;
border: 4px solid #ccc;
border-top: 4px solid rgb(59, 195, 211);
border-radius: 50%;
animation: spin 1s linear infinite!important;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
`;
document.head.appendChild(style);
const iframe = document.createElement('iframe');
iframe.id = 'customerPortalIframe';
iframe.src = fullUrl ? '/apps/customer-portal' + fullUrl : '/apps/customer-portal' ;
iframe.style.width = '100%';
iframe.style.height = '102vh';
iframe.style.border = 'none';
iframe.onload = () => {
spinner.style.display = 'none';
iframe.contentDocument.head.innerHTML += ``;
};
mainContent.appendChild(iframe);
}
}
});
}
BSS_BCP.is_enable_embed_proxy = false
if (BSS_BCP.is_enable_embed_proxy && isShowEmbedProxy) {
embedProxy();
}
})();
Passer au contenu