{"version":3,"file":"HighLevelForm.ChIKBp7D.mjs","names":["useRef","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","de","init_jsx_runtime","c","ce","window","addPropertyControls","init_framer_Dt_XqoQa","ControlType","readSHLAttribution","SHL_ATTRIBUTION_PARAMS","init_SHLMetaTracking_Z74tl2","useSHLGHLMetaLead","useSHLMetaTracking","init_UTMPersist_zOPwto","collectAttribution","HighLevelForm","props","baseUrl","scriptUrl","isSurvey","embedType","widgetId","surveyId","formId","src","frameRef","appliedRef","passAttribution","el","url","att","added","ATTRIBUTION_PARAMS","k","script","height","embedName","init_HighLevelForm"],"sources":["https:/framerusercontent.com/modules/sQijgWB7T0XhPdUu7WUk/cSH572kUFSg09kDCisd1/HighLevelForm.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Framer resolves this verified project module at build time; its CDN has no .d.ts file.\n// @ts-expect-error Remote Framer module has no TypeScript declarations.\nimport{readSHLAttribution,SHL_ATTRIBUTION_PARAMS}from\"https://framer.com/m/UTMPersist-zOPwto.js\";// @ts-expect-error Remote Framer module has no TypeScript declarations.\nimport{useSHLMetaTracking,useSHLGHLMetaLead}from\"https://framer.com/m/SHLMetaTracking-Z74tl2.js\";/**\n * HighLevel (GoHighLevel / LeadConnector) embedded form or survey.\n * Renders the LeadConnector iframe and loads the resize script (form_embed.js),\n * which handles multi-step survey resizing and submit behavior.\n *\n * v1.1.0 (Sep 17 2026) — passes ad attribution into the embed.\n *\n * WHY. GoHighLevel's \"Add to Google Ads\" workflow action can only upload a\n * conversion when the contact carries a click ID: gclid, gbraid or wbraid.\n * This embed is served from leadconnectorhq.com, and a cross-origin iframe\n * cannot read the parent page's URL. So the gclid sitting in\n * smarthomelending.com/apply?gclid=... never reaches the submission, every\n * upload is rejected as \"Skipped\", and paid leads look organic.\n *\n * Adding the parameters to this iframe's own address closes that gap. It is\n * done here, where the src is built, rather than by hunting for the frame in\n * the DOM afterwards — nothing to match, nothing to mistake for another embed.\n *\n * ORDERING MATTERS. The src is applied in an effect rather than during render\n * because the attribution lives in sessionStorage, which does not exist during\n * server rendering; computing it inline would make the server and client\n * disagree on the src and hand React a hydration mismatch. The effect runs on\n * mount, milliseconds in and long before anyone can type, and runs exactly once\n * — reassigning src reloads the frame, which would wipe a half-finished survey.\n *\n * GHL SIDE. Native attribution and custom fields are separate. Forwarding\n * a query parameter does not prove CRM storage or an accepted conversion.\n * Verify the published survey/workflow mappings end to end.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 500\n * @framerIntrinsicHeight 847\n */// Written by GetMyRateFunnel's getAttribution() on every page of the site.\nconst ATTRIBUTION_KEY=\"shl_attribution\";// gbraid and wbraid matter as much as gclid: Google sends those INSTEAD of\n// gclid on iOS and app-campaign traffic, and GHL accepts any of the three.\nconst ATTRIBUTION_PARAMS=SHL_ATTRIBUTION_PARAMS;function collectAttribution(){return readSHLAttribution();}export default function HighLevelForm(props){const{embedType,formId,surveyId,embedName,height,borderRadius,passAttribution}=props;const baseUrl=(props.baseUrl||\"https://get.smarthomelending.com\").replace(/\\/$/,\"\");const scriptUrl=props.scriptUrl||`${baseUrl}/js/form_embed.js`;const isSurvey=embedType===\"survey\";const widgetId=isSurvey?surveyId:formId;const src=isSurvey?`${baseUrl}/widget/survey/${widgetId}`:`${baseUrl}/widget/form/${widgetId}`;const frameRef=useRef(null);const appliedRef=useRef(false);useSHLMetaTracking();useSHLGHLMetaLead(frameRef,widgetId,\"borrower\");// Runs before the script effect below, so the frame is carrying its\n// attribution by the time form_embed.js starts managing it.\nuseEffect(()=>{if(!passAttribution)return;if(appliedRef.current)return;const el=frameRef.current;if(!el)return;let url;try{url=new URL(el.src||src,window.location.href);}catch(e){return;}const att=collectAttribution();let added=0;ATTRIBUTION_PARAMS.forEach(k=>{// Never overwrite a value the URL already carries.\nif(att[k]&&!url.searchParams.has(k)){url.searchParams.set(k,att[k]);added++;}});// Mark as done even when nothing was added, so a re-render can never\n// reassign src a second time and reload a survey mid-answer.\nappliedRef.current=true;if(!added)return;el.src=url.toString();},[passAttribution,src]);useEffect(()=>{// Load the LeadConnector embed script once (handles resize + submit).\nconst existing=document.querySelector(`script[src=\"${scriptUrl}\"]`);if(existing)return;const script=document.createElement(\"script\");script.src=scriptUrl;script.async=true;document.body.appendChild(script);},[scriptUrl]);if(isSurvey){// Multi-step survey: form_embed.js controls the height. scrolling disabled.\nreturn /*#__PURE__*/_jsx(\"iframe\",{ref:frameRef,src:src,title:\"survey\",id:widgetId,scrolling:\"no\",\"data-cookie-consent\":\"true\",\"data-cookie-consent-provider\":\"auto\",style:{display:\"block\",width:\"100%\",minHeight:height,border:\"none\",borderRadius:borderRadius,background:\"transparent\"}});}// Single-page form.\nreturn /*#__PURE__*/_jsx(\"iframe\",{ref:frameRef,src:src,title:embedName,id:`inline-${widgetId}`,\"data-layout\":\"{'id':'INLINE'}\",\"data-trigger-type\":\"alwaysShow\",\"data-activation-type\":\"alwaysActivated\",\"data-deactivation-type\":\"neverDeactivate\",\"data-form-name\":embedName,\"data-height\":height,\"data-layout-iframe-id\":`inline-${widgetId}`,\"data-form-id\":widgetId,style:{width:\"100%\",height:\"100%\",minHeight:height,border:\"none\",borderRadius:borderRadius,background:\"transparent\"}});}// Declared as a typed const rather than inline. Assigning an object literal\n// straight onto the function (`HighLevelForm.defaultProps = {...}`) is an\n// expando property, and TypeScript widens literal types on those — embedType\n// becomes `string`, which then fails the \"form\" | \"survey\" union that\n// addPropertyControls checks against. An `as const` on the value does not\n// survive that widening; annotating the const does.\nconst DEFAULT_PROPS={embedType:\"survey\",formId:\"4JNPQupE8Y3WyDaiwy3s\",surveyId:\"65Xcbz7FZWznWpwU3zy0\",embedName:\"Website Apply Now Survey\",baseUrl:\"https://get.smarthomelending.com\",scriptUrl:\"\",height:847,borderRadius:24,passAttribution:true};HighLevelForm.defaultProps=DEFAULT_PROPS;addPropertyControls(HighLevelForm,{embedType:{type:ControlType.Enum,title:\"Type\",options:[\"survey\",\"form\"],optionTitles:[\"Survey\",\"Form\"],defaultValue:\"survey\"},surveyId:{type:ControlType.String,title:\"Survey ID\",defaultValue:\"65Xcbz7FZWznWpwU3zy0\",hidden:props=>props.embedType!==\"survey\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"4JNPQupE8Y3WyDaiwy3s\",hidden:props=>props.embedType!==\"form\"},embedName:{type:ControlType.String,title:\"Name\",defaultValue:\"Website Apply Now Survey\"},baseUrl:{type:ControlType.String,title:\"Embed Host\",defaultValue:\"https://get.smarthomelending.com\"},scriptUrl:{type:ControlType.String,title:\"Script URL\",defaultValue:\"\",description:\"Blank = {Embed Host}/js/form_embed.js\"},passAttribution:{type:ControlType.Boolean,title:\"Pass Ad Data\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"Sends gclid/gbraid/wbraid + UTMs into the embed. Verify native attribution and any custom-field mappings in GHL.\"},height:{type:ControlType.Number,title:\"Min Height\",defaultValue:847,min:200,max:2e3,unit:\"px\",step:1},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:24,min:0,max:100,unit:\"px\",step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HighLevelForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HighLevelForm.map"],"mappings":"A,iUAuCgD,SAASkB,GAAoB,CAAC,OAAON,EAAmB,CAAE,CAAC,SAAwBO,EAAc,EAAM,CAAC,GAAK,CAAC,YAAU,SAAO,WAAS,YAAU,SAAO,eAAa,mBAAiBC,EAAYC,GAASD,EAAM,SAAS,mCAAA,CAAoC,QAAQ,MAAM,EAAE,EAAQE,EAAUF,EAAM,WAAW,GAAGC,EAAQ,mBAAyBE,EAASC,IAAY,SAAeC,EAASF,EAASG,EAASC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