226 lines
7.2 KiB
HTML
226 lines
7.2 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<!-- <link rel="prerender" href="http://localhost:3000/free"> -->
|
||
|
<script>
|
||
|
if (!location.search.includes("nonResponsive")) {
|
||
|
document.write('<meta name="viewport" content="width=device-width"/>');
|
||
|
}
|
||
|
</script>
|
||
|
<script>
|
||
|
(function (C, A, L) {
|
||
|
let d = C.document;
|
||
|
C.Cal =
|
||
|
C.Cal ||
|
||
|
function () {
|
||
|
let cal = C.Cal;
|
||
|
let ar = arguments;
|
||
|
if (!cal.loaded) {
|
||
|
cal.ns = {};
|
||
|
cal.q = cal.q || [];
|
||
|
d.head.appendChild(d.createElement("script")).src = A;
|
||
|
cal.loaded = true;
|
||
|
}
|
||
|
if (ar[0] === L) {
|
||
|
const api = function () {
|
||
|
api.q.push(arguments);
|
||
|
};
|
||
|
const namespace = arguments[1];
|
||
|
api.q = api.q || [];
|
||
|
namespace ? (cal.ns[namespace] = api) : null;
|
||
|
}
|
||
|
cal.q.push(ar);
|
||
|
};
|
||
|
})(window, "//localhost:3002/dist/embed.umd.js", "init");
|
||
|
</script>
|
||
|
<script>
|
||
|
Cal("init");
|
||
|
|
||
|
// Create a namespace "second". It can be accessed as Cal.ns.second with the exact same API as Cal
|
||
|
Cal("init", "second");
|
||
|
|
||
|
// Create a namespace "third". It can be accessed as Cal.ns.second with the exact same API as Cal
|
||
|
Cal("init", "third");
|
||
|
</script>
|
||
|
<style>
|
||
|
.debug {
|
||
|
/* border: 1px solid black; */
|
||
|
margin-bottom: 5px;
|
||
|
}
|
||
|
|
||
|
.loader {
|
||
|
color: green;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<h3>This page has a non responsive version accessible <a href="?nonResponsive">here</a></h3>
|
||
|
<h3>Pre-render test page available at <a href="?prerender-test">here</a></h3>
|
||
|
<div>
|
||
|
<button data-cal-link="free">Book with Free User</button>
|
||
|
<div>
|
||
|
<i
|
||
|
>Corresponding Cal Link is being preloaded. Assuming that it would take you some time to click this
|
||
|
as you are reading this text, it would open up super fast[If you are running a production build on
|
||
|
local]. Try switching to slow 3G or create a custom Network configuration which is impossibly
|
||
|
slow</i
|
||
|
>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div id="namespaces-test">
|
||
|
<div class="debug">
|
||
|
<h2>Default Namespace(Cal)<i>[Black Theme][Guests(janedoe@gmail.com and test@gmail.com)]</i></h2>
|
||
|
<div>
|
||
|
<i><a href="?only=ns:default">Test in Zen Mode</a></i>
|
||
|
</div>
|
||
|
<i id="booking-status-"> You would see last Booking page action in my place </i>
|
||
|
<div id="cal-booking-place-" style="max-height: 30vh; overflow: scroll">
|
||
|
<div>
|
||
|
if you render booking embed in me, I would not let it be more than 30vh in height. So you would
|
||
|
have to scroll to see the entire content
|
||
|
</div>
|
||
|
<div class="loader" id="cal-booking-loader-">Loading .....</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="debug">
|
||
|
<h2>Namespace "second"(Cal.ns.second)[Custom Styling]</h2>
|
||
|
<div>
|
||
|
<i><a href="?only=ns:second">Test in Zen Mode</a></i>
|
||
|
</div>
|
||
|
<i id="booking-status-second">
|
||
|
<i>You would see last Booking page action in my place</i>
|
||
|
</i>
|
||
|
<div id="cal-booking-place-second">
|
||
|
<div>If you render booking embed in me, I won't restrict you. The entire page is yours.</div>
|
||
|
<button
|
||
|
onclick="(function () {Cal.ns.second('ui', {styles:{eventTypeListItem:{backgroundColor:'blue'}}})})()">
|
||
|
Change <code>eventTypeListItem</code> bg color
|
||
|
</button>
|
||
|
<button onclick="(function () {Cal.ns.second('ui', {styles:{body:{background:'red'}}})})()">
|
||
|
Change <code>body</code> bg color
|
||
|
</button>
|
||
|
<div class="loader" id="cal-booking-loader-second">Loading .....</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="debug">
|
||
|
<h2>Namespace "third"(Cal.ns.third)</h2>
|
||
|
<div>
|
||
|
<i><a href="?only=ns:third">Test in Zen Mode</a></i>
|
||
|
</div>
|
||
|
<i id="booking-status-third">
|
||
|
<i>You would see last Booking page action in my place</i>
|
||
|
</i>
|
||
|
<div id="cal-booking-place-third" style="width: 30%">
|
||
|
<div>If you render booking embed in me, I would not let you be more than 30% wide</div>
|
||
|
<div class="loader" id="cal-booking-loader-third">Loading .....</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
const searchParams = new URL(document.URL).searchParams;
|
||
|
const only = searchParams.get("only");
|
||
|
// In prerender-test, we would want to test just the prerender case and nothing else.
|
||
|
if (searchParams.get("prerender-test") === null) {
|
||
|
if (!only || only === "ns:default") {
|
||
|
Cal("inline", {
|
||
|
elementOrSelector: "#cal-booking-place-",
|
||
|
calLink: "pro?case=1",
|
||
|
config: {
|
||
|
name: "John Doe",
|
||
|
email: "johndoe@gmail.com",
|
||
|
notes: "Test Meeting",
|
||
|
guests: ["janedoe@gmail.com", "test@gmail.com"],
|
||
|
theme: "dark",
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
if (!only || only === "ns:second") {
|
||
|
// Bulk API is supported - Keep all configuration at one place.
|
||
|
Cal.ns.second(
|
||
|
[
|
||
|
"inline",
|
||
|
{
|
||
|
elementOrSelector: "#cal-booking-place-second",
|
||
|
calLink: "pro?case=2",
|
||
|
},
|
||
|
],
|
||
|
[
|
||
|
"ui",
|
||
|
{
|
||
|
styles: {
|
||
|
body: {
|
||
|
background: "white",
|
||
|
},
|
||
|
eventTypeListItem: {
|
||
|
backgroundColor: "#D3D3D3",
|
||
|
},
|
||
|
enabledDateButton: {
|
||
|
backgroundColor: "#D3D3D3",
|
||
|
},
|
||
|
disabledDateButton: {
|
||
|
backgroundColor: "lightslategray",
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
]
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (!only || only === "ns:third") {
|
||
|
Cal.ns.third(
|
||
|
[
|
||
|
"inline",
|
||
|
{
|
||
|
elementOrSelector: "#cal-booking-place-third",
|
||
|
calLink: "pro?case=3",
|
||
|
},
|
||
|
],
|
||
|
[
|
||
|
"ui",
|
||
|
{
|
||
|
styles: {
|
||
|
body: {
|
||
|
background: "white",
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
]
|
||
|
);
|
||
|
}
|
||
|
} else {
|
||
|
document.getElementById("namespaces-test").style.display = "none";
|
||
|
}
|
||
|
|
||
|
Cal("preload", {
|
||
|
calLink: "free",
|
||
|
});
|
||
|
</script>
|
||
|
<script>
|
||
|
const callback = function (e) {
|
||
|
const detail = e.detail;
|
||
|
const namespace = detail.namespace;
|
||
|
|
||
|
if (detail.type === "linkReady") {
|
||
|
document.getElementById("cal-booking-loader-" + namespace).remove();
|
||
|
}
|
||
|
|
||
|
document.getElementById(`booking-status-${namespace}`).innerHTML = JSON.stringify(e.detail);
|
||
|
};
|
||
|
|
||
|
Cal("on", {
|
||
|
action: "*",
|
||
|
callback,
|
||
|
});
|
||
|
Cal.ns.second("on", {
|
||
|
action: "*",
|
||
|
callback,
|
||
|
});
|
||
|
Cal.ns.third("on", {
|
||
|
action: "*",
|
||
|
callback,
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|