{"version":3,"file":"TradingContactOveride.DL6O2ph-.mjs","names":[],"sources":["https:/framerusercontent.com/modules/egaHdd3maPJ6NowMCsaD/mJwMi2SKIK71eRG74GHy/TradingContactOveride.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";/**\n * Trading Deal Template Page → Contact form preshot.\n *\n * Applied on the \"Contact\" CTA inside a trading deal CMS template page.\n * At click time, reads the Serial Number from the element with id=\"serial-number\"\n * (that element is a plain CMS text on the template page).\n *\n * Redirects to /contact with:\n *   - dept = other-topics\n *   - topic = Aircraft Trading\n *   - serialNumber = [scanned from DOM]\n *\n * The contact page's JetflyContactForm matches this serial against its\n * dealsCollection prop to retrieve manufacturer, model, and cover photo.\n */function extractSerialFromDOM(){if(typeof document===\"undefined\")return\"\";const el=document.getElementById(\"serial-number\");if(!el){console.warn(\"[TradingCTA] #serial-number element not found in DOM\");return\"\";}// The element may contain a label like \"Serial Number: 1234-ABC\"\n// OR just the raw value \"1234-ABC\". Strip the label if present.\nconst raw=(el.textContent||\"\").trim();const stripped=raw.replace(/^\\s*(serial\\s*number|s\\/n|sn)\\s*[:\\-]?\\s*/i,\"\");return stripped.trim();}export function withTradingContactLink(Component){return props=>{const handleClick=e=>{const link=e.target.closest(\"a\");if(!link||!link.href||!link.href.includes(\"/contact\")){console.warn(\"[TradingCTA] click ignored — no /contact link in target\");return;}const serialNumber=extractSerialFromDOM();console.log(\"[TradingCTA] serial extracted:\",serialNumber);const params=new URLSearchParams;params.set(\"dept\",\"other-topics\");params.set(\"topic\",\"Aircraft Trading\");if(serialNumber)params.set(\"serialNumber\",serialNumber);const href=`/contact?${params.toString()}#connect-with-us`;console.log(\"[TradingCTA] redirecting to:\",href);e.preventDefault();e.stopPropagation();window.location.href=href;};return /*#__PURE__*/_jsx(\"div\",{onClickCapture:handleClick,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withTradingContactLink\":{\"type\":\"reactHoc\",\"name\":\"withTradingContactLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TradingContactOveride.map"],"mappings":"kHAcG,SAAS,GAAsB,CAAC,GAAG,OAAO,SAAW,IAAY,MAAM,GAAG,IAAM,EAAG,SAAS,eAAe,gBAAgB,CAEZ,OAFiB,GAExH,EAAG,aAAa,IAAI,MAAM,CAAoB,QAAQ,6CAA6C,GAAG,CAAiB,MAAM,EAFD,QAAQ,KAAK,uDAAuD,CAAO,IAExE,SAAgB,EAAuB,EAAU,CAAC,MAAO,IAAgpB,EAAK,MAAM,CAAC,eAAloB,GAAG,CAAC,IAAM,EAAK,EAAE,OAAO,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAM,CAAC,EAAK,MAAM,CAAC,EAAK,KAAK,SAAS,WAAW,CAAC,CAAC,QAAQ,KAAK,0DAA0D,CAAC,OAAQ,IAAM,EAAa,GAAsB,CAAC,QAAQ,IAAI,iCAAiC,EAAa,CAAC,IAAM,EAAO,IAAI,gBAAgB,EAAO,IAAI,OAAO,eAAe,CAAC,EAAO,IAAI,QAAQ,mBAAmB,CAAI,GAAa,EAAO,IAAI,eAAe,EAAa,CAAC,IAAM,EAAK,YAAY,EAAO,UAAU,CAAC,kBAAkB,QAAQ,IAAI,+BAA+B,EAAK,CAAC,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,EAAO,SAAS,KAAK,GAAkE,MAAM,CAAC,QAAQ,WAAW,CAAC,SAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,CAAC,CAAC,sBAhB55B"}