{"version":3,"file":"TallyEmbed.i-SnWPEG.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/5wmPPMgE5aRyeXl9HvNL/7hKHk6YOcmR9euZZ7SlZ/TallyEmbed.js"],"sourcesContent":["// Instructions: Embed a Tally form (for the careers application form with CV upload) by form ID.\n// Forward the page URL query parameters (e.g. ?role=Performance%20Marketing%20Intern) into the Tally\n// embed URL so Tally hidden fields such as \"role\" are pre-filled. When the URL carries no role,\n// optionally take the page's first H1 (the role title on a CMS role page) as the role value.\n// Support Tally's embed options (alignLeft, hideTitle, transparentBackground, dynamicHeight) and\n// load Tally's embed.js for dynamic height. Only mount the iframe once the section is near the\n// viewport, so Tally's autofocus cannot scroll the page down to the form on load. Show a static\n// placeholder on the Framer canvas and a short note when no form ID is set.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const TALLY_SCRIPT=\"https://tally.so/widgets/embed.js\";/**\n * TallyEmbed\n *\n * @framerIntrinsicWidth 640\n * @framerIntrinsicHeight 720\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TallyEmbed(props){const{formId=\"\",minHeight=720,hideTitle=true,alignLeft=true,transparentBackground=true,dynamicHeight=true,forwardPageParams=true,roleFromHeading=true,emptyMessage=\"Applications open soon.\",style}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const rootRef=useRef(null);const[ready,setReady]=useState(false);const[near,setNear]=useState(false);const[pageParams,setPageParams]=useState(\"\");// Read the parent page URL once on the client so hidden fields (e.g. role) get their values.\n// On a role page with no ?role= in the URL, use the page's first H1 as the role.\nuseEffect(()=>{if(typeof window===\"undefined\")return;const params=new URLSearchParams(forwardPageParams?window.location.search:\"\");if(roleFromHeading&&!params.get(\"role\")){const heading=document.querySelector(\"h1\");const title=heading&&heading.textContent?heading.textContent.trim():\"\";if(title)params.set(\"role\",title);}const search=params.toString();startTransition(()=>{setPageParams(search);setReady(true);});},[forwardPageParams,roleFromHeading]);// Mount the iframe only when the section is close to the viewport. Tally focuses its first\n// field on load, which would otherwise scroll the whole page down to the form.\nuseEffect(()=>{if(typeof window===\"undefined\"||isCanvas)return;const el=rootRef.current;if(!el||typeof IntersectionObserver===\"undefined\"){startTransition(()=>setNear(true));return;}const observer=new IntersectionObserver(entries=>{if(entries.some(entry=>entry.isIntersecting)){startTransition(()=>setNear(true));observer.disconnect();}},{rootMargin:\"300px 0px\"});observer.observe(el);return()=>observer.disconnect();},[isCanvas]);const src=useMemo(()=>{const id=formId.trim().replace(/^https?:\\/\\/tally\\.so\\/(r|embed)\\//,\"\");if(!id)return\"\";const opts=[];if(alignLeft)opts.push(\"alignLeft=1\");if(hideTitle)opts.push(\"hideTitle=1\");if(transparentBackground)opts.push(\"transparentBackground=1\");if(dynamicHeight)opts.push(\"dynamicHeight=1\");if(pageParams)opts.push(pageParams);return`https://tally.so/embed/${id}${opts.length?\"?\"+opts.join(\"&\"):\"\"}`;},[formId,alignLeft,hideTitle,transparentBackground,dynamicHeight,pageParams]);const shouldMount=ready&&near&&!!src;// Load Tally's embed script (handles dynamic height) once the iframe is in the DOM.\nuseEffect(()=>{if(typeof window===\"undefined\"||isCanvas||!shouldMount)return;const w=window;const d=document;const activate=()=>{if(typeof w.Tally!==\"undefined\"&&w.Tally.loadEmbeds){w.Tally.loadEmbeds();}else{d.querySelectorAll(\"iframe[data-tally-src]:not([src])\").forEach(el=>{const frame=el;frame.src=frame.dataset.tallySrc||\"\";});}};if(typeof w.Tally!==\"undefined\"){activate();return;}const existing=d.querySelector(`script[src=\"${TALLY_SCRIPT}\"]`);if(existing){existing.addEventListener(\"load\",activate);activate();return;}const s=d.createElement(\"script\");s.src=TALLY_SCRIPT;s.async=true;s.onload=activate;s.onerror=activate;d.body.appendChild(s);},[shouldMount,src,isCanvas]);const rootStyle={position:\"relative\",width:\"100%\",minHeight:minHeight,...style};if(isCanvas){return /*#__PURE__*/_jsx(\"div\",{style:{...rootStyle,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",borderRadius:16,border:\"1px dashed rgba(255,255,255,0.2)\",color:\"rgba(255,255,255,0.6)\",fontFamily:\"Satoshi, Inter, system-ui, sans-serif\",fontSize:16,textAlign:\"center\",padding:24},children:src?`Tally form ${formId} renders here on the live site`:\"Tally form placeholder. Add the form ID in the properties panel.\"});}if(!src){return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:{...rootStyle,minHeight:0,color:\"rgba(255,255,255,0.6)\",fontFamily:\"Satoshi, Inter, system-ui, sans-serif\",fontSize:18},children:emptyMessage});}return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:rootStyle,children:shouldMount?/*#__PURE__*/_jsx(\"iframe\",{\"data-tally-src\":src,loading:\"lazy\",width:\"100%\",height:minHeight,frameBorder:\"0\",marginHeight:0,marginWidth:0,title:\"Application form\",style:{width:\"100%\",minHeight:minHeight,border:0,display:\"block\"}},src):null});}addPropertyControls(TallyEmbed,{formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"\",placeholder:\"e.g. 3xYzAb (from tally.so/r/3xYzAb)\"},minHeight:{type:ControlType.Number,title:\"Min height\",defaultValue:720,min:200,max:2e3,step:10,unit:\"px\"},hideTitle:{type:ControlType.Boolean,title:\"Hide title\",defaultValue:true},alignLeft:{type:ControlType.Boolean,title:\"Align left\",defaultValue:true},transparentBackground:{type:ControlType.Boolean,title:\"Transparent\",defaultValue:true},dynamicHeight:{type:ControlType.Boolean,title:\"Dynamic height\",defaultValue:true},forwardPageParams:{type:ControlType.Boolean,title:\"Pass URL params\",defaultValue:true},roleFromHeading:{type:ControlType.Boolean,title:\"Role from H1\",defaultValue:true},emptyMessage:{type:ControlType.String,title:\"Empty message\",defaultValue:\"Applications open soon.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TallyEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"720\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"640\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TallyEmbed.map"],"mappings":"sNAgBG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,SAAO,GAAG,YAAU,IAAI,YAAU,GAAK,YAAU,GAAK,wBAAsB,GAAK,gBAAc,GAAK,oBAAkB,GAAK,kBAAgB,GAAK,eAAa,0BAA0B,SAAO,EAAY,EAAS,EAAa,QAAQ,IAAI,EAAa,OAAa,EAAQA,EAAO,IAAI,EAAO,CAAC,EAAM,GAAUC,EAAS,EAAK,EAAO,CAAC,EAAK,GAASA,EAAS,EAAK,EAAO,CAAC,EAAW,GAAeA,EAAS,EAAE,EAEnc,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAO,IAAI,gBAAgB,EAAkB,EAAO,SAAS,OAAO,EAAE,EAAE,GAAG,GAAiB,CAAC,EAAO,IAAI,MAAM,EAAE,CAAC,IAAM,EAAQ,SAAS,cAAc,IAAI,EAAQ,EAAM,GAAS,EAAQ,YAAY,EAAQ,YAAY,KAAK,EAAE,GAAM,GAAM,EAAO,IAAI,OAAO,CAAK,CAAE,CAAC,IAAM,EAAO,EAAO,SAAS,EAAE,MAAoB,CAAC,EAAc,CAAM,EAAE,EAAS,EAAI,CAAE,CAAC,CAAE,EAAE,CAAC,EAAkB,CAAe,CAAC,EAElc,MAAc,CAAC,GAAU,IAAS,QAAa,EAAS,OAAO,IAAM,EAAG,EAAQ,QAAQ,GAAG,CAAC,GAAI,OAAO,qBAAuB,IAAY,CAAC,MAAoB,EAAQ,EAAI,CAAC,EAAE,MAAO,CAAC,IAAM,EAAS,IAAI,qBAAqB,GAAS,CAAI,EAAQ,KAAK,GAAO,EAAM,cAAc,IAAG,MAAoB,EAAQ,EAA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