1/** 2 * Intempt Booking Embed Script 3 * 4 * Drop this script on any page to embed the booking widget: 5 * 6 * <div id="intempt-booking"></div> 7 * <script src="https://your-domain/embed.js"></script> 8 * <script> 9 * // Person booking: 10 * IntemptBooking.init({ 11 * target: '#intempt-booking', 12 * slug: 'person-slug', 13 * bookingName: 'your-meeting-type', 14 * }) 15 * 16 * // Team booking: 17 * IntemptBooking.init({ 18 * target: '#intempt-booking', 19 * mode: 'team', 20 * orgName: 'acme', 21 * slug: 'sales-team', 22 * bookingName: 'your-meeting-type', 23 * }) 24 * </script> 25 * 26 * NOTE: This file is intentionally plain JavaScript (no bundler imports). 27 * It is served statically from /public and must remain self-contained. 28 * The actual React app is loaded lazily from the built assets. 29 */ 30 31;(function () { 32 const SCRIPT_SRC = (document.currentScript)?.src ?? '' 33 // Derive the base URL of the booking app from the embed script URL. 34 // e.g. https://app.example.com/embed.js â https://app.example.com 35 const BASE_URL = SCRIPT_SRC ? SCRIPT_SRC.replace(/\/embed\.js(\?.*)?$/, '') : '' 36 37 // Delegate holder â populated after the React app mounts via onApiReady callback. 38 const _api = {} 39 40 window.IntemptBooking = { 41 init(config = {}) { 42 const { target, ...rest } = config 43 44 const resolvedTarget = 45 target == null 46 ? null 47 : typeof target === 'string' 48 ? document.querySelector(target) 49 : target 50 51 if (target != null && !resolvedTarget) { 52 console.warn('[IntemptBooking] Mount target not found:', target, 'â falling back to auto-mount.') 53 } 54 55 // Container creation deferred to loadApp callback so document.body is guaranteed to exist 56 // (init() may be called from <head> before <body> is parsed). 57 loadApp(BASE_URL, () => { 58 const container = resolvedTarget ?? (() => { 59 const div = document.createElement('div') 60 div.setAttribute('data-intempt-booking-auto', '') 61 // Auto-mount divs are always hidden â they are React mount points, not visible content. 62 // The built-in button requires an explicit target to be meaningful. 63 div.style.cssText = 'display:none;' 64 document.body.appendChild(div) 65 return div 66 })() 67 68 window.__intemptBookingMount?.(container, { 69 embedded: true, 70 ...rest, 71 // Show the built-in trigger button only when the caller provided an explicit target 72 // and no custom trigger element. Headless mode (no target, no trigger) must not render it. 73 showButton: !!resolvedTarget && !rest.trigger, 74 onApiReady(api) { 75 _api.open = api.open 76 _api.close = api.close 77 }, 78 }) 79 }) 80 }, 81 82 open() { _api.open?.() }, 83 close() { _api.close?.() }, 84 } 85 86 function loadApp(baseUrl, onReady) { 87 const cssHref = `${baseUrl}/app/main.css` 88 if (!document.querySelector(`link[href="${cssHref}"]`)) { 89 const link = document.createElement('link') 90 link.rel = 'stylesheet' 91 link.href = cssHref 92 document.head.appendChild(link) 93 } 94 95 const script = document.createElement('script') 96 script.src = `${baseUrl}/app/main.js` 97 script.onload = onReady 98 document.head.appendChild(script) 99 } 100})()
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.