Still not working but here is where I am:
I added those divs in my global layout:
<body class="antialiased flex min-h-full flex-col bg-white dark:bg-gray-950">
<slot />
<div transition:persist="algomo-widget-body-iframe" />
<div transition:persist="algomo-widget-trigger-iframe" />
<div transition:persist="algomo-widget-popup-iframe" />
</body>
And then I updated my script in the global head:
<script is:inline>
document.addEventListener('DOMContentLoaded', () => {
const algomoScript = document.createElement('script');
algomoScript.src = 'https://app.algomo.com/algomo.min.js';
algomoScript.setAttribute('widget', '<WIDGET_ID>');
algomoScript.async = true;
algomoScript.defer = true;
const placeholders = Array.from(document.querySelectorAll('[data-astro-transition-persist^="algomo-widget"]'));
for (const placeholder of placeholders) {
placeholder.remove();
}
document.head.appendChild(algomoScript);
let observer;
observer = new MutationObserver(() => {
const iframes = Array.from(document.querySelectorAll('[id^="algomo-widget"]'));
if (iframes.length !== 0) {
for (const iframe of iframes) {
iframe.dataset.astroTransitionPersist = iframe.id;
}
observer.disconnect();
}
});
observer.observe(document.documentElement, {
attributeFilter: ['[id^="algomo-widget"]'],
subtree: true,
childList: true,
});
});
</script>