// ===========================================================================
// CHANNELCRAFT — WIX VELO PAGE CODE (OPTIONAL)
// ===========================================================================
// Only needed if you want the embed to auto-resize to fit the app instead of
// scrolling inside a fixed-height box.
//
// WHERE THIS GOES:
// 1. In the Wix Editor, turn on Dev Mode (top menu → "Dev Mode" → Turn on).
// 2. Click your Embed HTML element and note its ID in the Properties panel.
// It is usually #html1. If yours differs, change HTML_ID below.
// 3. Paste this into the page code panel at the bottom of the editor,
// on the same page the embed lives on.
//
// IF YOU SKIP THIS: the app still works fine. It just keeps a fixed height
// and scrolls internally, which is perfectly usable since the app has its
// own sticky header.
// ===========================================================================
const HTML_ID = "#html1"; // <- change if your element has a different ID
const MIN_HEIGHT = 700; // never shrink below this
const MAX_HEIGHT = 6000; // sanity ceiling
$w.onReady(function () {
const el = $w(HTML_ID);
el.onMessage((event) => {
const data = event.data;
if (!data || data.type !== "ccHeight") return;
let h = parseInt(data.height, 10);
if (!h || isNaN(h)) return;
// Clamp so a bad measurement cannot blow up the page layout.
h = Math.max(MIN_HEIGHT, Math.min(MAX_HEIGHT, h));
el.height = h;
});
});