{"version":3,"file":"AshbyJobApplicationForm.DCQhdOT2.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/Rx90TbU18XvCkBmXJ9re/p2FiHVsKHW0tfaXHdLKu/AshbyJobApplicationForm.js"],"sourcesContent":["/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";const Spinner=()=>{return /*#__PURE__*/_jsx(motion.div,{animate:{rotate:360},transition:{duration:.7,repeat:Infinity,ease:\"linear\"},style:{border:\"4px solid #fb923c\",borderTop:\"4px solid #9a3412\",borderRadius:\"50%\",width:\"20px\",height:\"20px\"}});};const messageKeyFrames={hidden:{opacity:0,y:-10},visible:{y:0,opacity:1,transition:{duration:.3,type:\"spring\",stiffness:100,damping:10}}};const styles={container:{width:\"100%\",fontFamily:\"Be Vietnam Pro\"},embedContainer:{width:\"100%\",minHeight:\"600px\",border:\"none\"},errorMessage:{color:\"#dc2626\",fontSize:\"16px\",textAlign:\"center\",padding:\"20px\",backgroundColor:\"#fef2f2\",border:\"1px solid #fecaca\",borderRadius:\"8px\",margin:\"20px 0\"},loadingContainer:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",minHeight:\"200px\",color:\"#57534e\",fontSize:\"16px\"}};export default function AshbyJobApplicationForm({ashbyBaseJobBoardUrl,jobPostingId,customCssUrl,autoScroll,verboseLogging}){const[isLoading,setIsLoading]=useState(true);const[error,setError]=useState(\"\");const scriptLoadedRef=useRef(false);const iframeLoadedRef=useRef(false);useEffect(()=>{// Validate required props\nif(!ashbyBaseJobBoardUrl||!jobPostingId){setError(\"Missing required configuration: ashbyBaseJobBoardUrl and jobPostingId are required\");setIsLoading(false);return;}const loadAshbyForm=async()=>{try{// Configure Ashby settings\nwindow.__Ashby={settings:{ashbyBaseJobBoardUrl:ashbyBaseJobBoardUrl,displayMode:\"application-form-only\",jobPostingId:jobPostingId,autoLoad:true,autoScroll:autoScroll,verboseLogging:verboseLogging,...customCssUrl&&{customCssUrl:customCssUrl}}};// Load Ashby script if not already loaded\nif(!scriptLoadedRef.current){const script=document.createElement(\"script\");script.id=\"ashby-script\";script.src=`${ashbyBaseJobBoardUrl}/embed?version=2`;script.async=true;script.onload=()=>{scriptLoadedRef.current=true;setIsLoading(false);};script.onerror=()=>{setError(\"Failed to load Ashby job form. Please check your configuration.\");setIsLoading(false);};document.head.appendChild(script);}else{// Script already loaded, just reload the form with new settings\nif(window.__Ashby&&window.__Ashby.iFrame){window.__Ashby.iFrame().load({jobPostingId:jobPostingId,...customCssUrl&&{customCssUrl:customCssUrl}});}setIsLoading(false);}}catch(err){console.error(\"Error loading Ashby form:\",err);setError(\"An error occurred while loading the job application form.\");setIsLoading(false);}};loadAshbyForm();// Cleanup function\nreturn()=>{// Note: We don't remove the script on cleanup as it might be used by other components\n// In a production app, you might want to implement a more sophisticated cleanup strategy\n};},[ashbyBaseJobBoardUrl,jobPostingId,customCssUrl,autoScroll,verboseLogging]);if(error){return /*#__PURE__*/_jsx(\"div\",{style:styles.container,children:/*#__PURE__*/_jsx(\"div\",{style:styles.errorMessage,children:error})});}if(isLoading){return /*#__PURE__*/_jsx(\"div\",{style:styles.container,children:/*#__PURE__*/_jsxs(\"div\",{style:styles.loadingContainer,children:[/*#__PURE__*/_jsx(Spinner,{}),/*#__PURE__*/_jsx(\"p\",{children:\"Loading job application form...\"})]})});}return /*#__PURE__*/_jsx(\"div\",{style:styles.container,children:/*#__PURE__*/_jsx(\"div\",{id:\"ashby_embed\",style:styles.embedContainer})});}// Default props for the component\nAshbyJobApplicationForm.defaultProps={ashbyBaseJobBoardUrl:\"https://jobs.ashbyhq.com/folio\",jobPostingId:\"\",customCssUrl:\"\",autoScroll:false,verboseLogging:false};// Property controls for Framer\naddPropertyControls(AshbyJobApplicationForm,{ashbyBaseJobBoardUrl:{type:ControlType.String,title:\"Ashby Job Board URL\",description:\"Your company's Ashby job board URL\\n(e.g., https://jobs.ashbyhq.com/your-company)\",placeholder:\"https://jobs.ashbyhq.com/folio\"},jobPostingId:{type:ControlType.String,title:\"Job Posting ID\",description:\"The specific job posting ID you want to embed\\n(found in your Ashby admin panel)\",placeholder:\"ec3a9689-27fc-418c-8834-e29708798dfd\"},customCssUrl:{type:ControlType.String,title:\"Custom CSS URL\",description:\"Optional: URL to custom CSS file for styling the form\",placeholder:\"https://example.com/custom-styles.css\",optional:true},autoScroll:{type:ControlType.Boolean,title:\"Auto Scroll\",description:\"Enable automatic scrolling on form navigation\",defaultValue:false},verboseLogging:{type:ControlType.Boolean,title:\"Verbose Logging\",description:\"Enable detailed console logging for debugging\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AshbyJobApplicationForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AshbyJobApplicationForm.map"],"mappings":"iZAGkgC,SAAwB,EAAwB,CAAC,uBAAqB,eAAa,eAAa,aAAW,kBAAgB,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,GAAK,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAO,EAAgBC,EAAO,GAAM,CAOxxB,OAP+yB,EAAO,GAAM,CAAC,MAAc,CACpyC,GAAG,CAAC,GAAsB,CAAC,EAAa,CAAC,EAAS,qFAAqF,CAAC,EAAa,GAAM,CAAC,OAI5J,OAJwL,SAAS,CAAC,GAAG,CAErM,GADA,EAAO,QAAQ,CAAC,SAAS,CAAsB,uBAAqB,YAAY,wBAAqC,eAAa,SAAS,GAAgB,aAA0B,iBAAe,GAAG,GAAc,CAAc,eAAa,CAAC,CAAC,CAC9O,EAAgB,QACjB,EAAO,SAAS,EAAO,QAAQ,QAAQ,EAAO,QAAQ,QAAQ,CAAC,KAAK,CAAc,eA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