2
0

🐛 (calCom) Fix book callback not working on second attempt

This commit is contained in:
Baptiste Arnaud
2024-05-23 15:37:44 +02:00
parent 10cbf4dfbc
commit c2f3c9709f

View File

@ -49,14 +49,20 @@ export const bookEvent = createAction({
parseFunction: () => { parseFunction: () => {
return { return {
args: {}, args: {},
content: `Cal("on", { content: `{
action: "bookingSuccessful", const callback = (e) => {
callback: (e) => {
if(window.calComBooked) return
continueFlow(e.detail.data.date) continueFlow(e.detail.data.date)
window.calComBooked = true Cal("off", {
action: "bookingSuccessful",
callback
})
} }
})`,
Cal("on", {
action: "bookingSuccessful",
callback
})
}`,
} }
}, },
}, },
@ -107,8 +113,6 @@ export const bookEvent = createAction({
}; };
})(window, baseUrl + "/embed/embed.js", "init"); })(window, baseUrl + "/embed/embed.js", "init");
window.calComBooked = false;
Cal("init", { origin: baseUrl }); Cal("init", { origin: baseUrl });
const location = phone ? JSON.stringify({ const location = phone ? JSON.stringify({