function loadScript(url) {
return new Promise(function (resolve) {
var script = document.createElement("script");
script.type = "text/javascript";
script.onload = function () {
resolve();
};
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
});
}
async function loadNotifier() {
ko.$("head").append(`
`);
await loadScript(
"https://cdnjs.cloudflare.com/ajax/libs/awesome-notifications/3.1.0/modern.var.js"
);
return new AWN({
position: "top-right",
});
}
ko.ready(async function () {
let notificationShown = false;
const notifier = await loadNotifier();
ko.$("nav").on("click", (e) => {
const onPricing = ko.page.viewing("/pricing/");
const lookedAtSelfHosted = ko.e.performed("SSOP Toggle Flipped On");
if (notificationShown) {
return;
}
if (onPricing && lookedAtSelfHosted) {
e.preventDefault();
notificationShown = true;
notifier.modal(`
👋 Before you go
Curious how self-hosting Retool works? Book a demo and we'll show you how to get started.
Book a demo
`);
}
});
});