// Filename: public/edcSeatmap.js // Code written in public files is shared by your site's // Backend, page code, and site code environments. // Use public files to hold utility functions that can // be called from multiple locations in your site's code. // public/edcSeatmap.js // public/edcSeatmap.js class EdcSeatmap extends HTMLElement { constructor() { super(); this._initialized = false; } connectedCallback() { // Prevent double-initialization if (this._initialized) return; this._initialized = true; // 1. Set global config BEFORE loading the client script window.edcConfig = { purchaseMode: "redirect", locale: "en_US", categoryPairing: [ { category: "511192" }, { category: "511193" }, { category: "511194" }, { category: "511195" }, ], theme: { palette: { mode: "dark", background: { default: "#12101b", }, primary: { main: "#fe0865", }, tertiary: { main: "#12101b", contrastText: "#fff", }, }, components: { MuiButton: { styleOverrides: { root: { borderRadius: "0", }, }, }, }, }, }; // 2. Create the inner div where Events.com will render const eid = this.getAttribute("data-eid") || "997757"; const container = document.createElement("div"); container.id = "edc_content"; container.setAttribute("data-eid", eid); // Clear any existing content and append the container this.innerHTML = ""; this.appendChild(container); // 3. Load the external client script once per page const existingScript = document.querySelector( 'script[data-edc-client="true"]' ); if (!existingScript) { const script = document.createElement("script"); script.src = "https://reg-ui.prod.events.com/v1/scripts/client"; script.type = "application/javascript"; script.async = true; script.setAttribute("data-edc-client", "true"); document.body.appendChild(script); } } } // 4. Register the custom element tag customElements.define("edc-seatmap", EdcSeatmap); // The following code demonstrates how to call the add // function from your site's page code or site code. /* import {add} from 'public/edcSeatmap.js' $w.onReady(function () { let sum = add(6,7); console.log(sum); }); */
top of page
bottom of page