{"version":3,"file":"BirdIntegration.CUaHzEIP.mjs","names":[],"sources":["https:/framerusercontent.com/modules/ajz9IVk2qkyy0HIw4fHN/W8XYbNqpr3WcOFGQeEvT/BirdIntegration.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useIsomorphicLayoutEffect}from\"framer\";import{addPropertyControls,ControlType}from\"framer\";export default function BirdIntegration(props){useIsomorphicLayoutEffect(()=>{const form=document.querySelector(props.formSelector);if(!form)return;const getCountryInfo=()=>{const path=window.location.pathname;if(path.includes(\"/ae-\")){return{code:\"AE\",name:\"UAE\"};}else if(path.includes(\"/eg-\")){return{code:\"EG\",name:\"Egypt\"};}else if(path.includes(\"/kw-\")){return{code:\"KW\",name:\"Kuwait\"};}else if(path.includes(\"/sa-\")){return{code:\"SA\",name:\"Saudi Arabia\"};}return{code:\"\",name:\"\"};};const sendToBird=async formData=>{try{const firstName=String(formData[\"First name\"]||\"\").trim();const lastName=String(formData[\"last name\"]||\"\").trim();const displayName=`${firstName} ${lastName}`.trim()||\"Unknown Contact\";const countryInfo=getCountryInfo();const contactPayload={displayName:displayName,identifiers:[{key:\"emailaddress\",value:formData.Email},{key:\"phonenumber\",value:formData[\"Phone Number\"]}],attributes:{displayName:displayName,firstName:firstName,lastName:lastName,subject:formData.Subject,schoolSystem:formData[\"School System\"],grade:formData.Grade,schoolName:formData[\"School name\"],learningGoal:formData[\"What is your learning goal?\"],learnerType:formData[\"Who is learning?\"],priceRangeQualified:formData[\"Price Range Qualifying\"]===\"Yes\",subscribedWhatsApp:Boolean(formData[\"Agree to Receive Follow-ups via WhatsApp\"]),subscribedEmail:true,subscribedSms:true,subscribedRcs:true,sourcePlatform:\"Orcas Website - Contact Form\",country:countryInfo.code,countryName:countryInfo.name,utm_source:formData.utm_source||\"\",utm_medium:formData.utm_medium||\"\",utm_campaign:formData.utm_campaign||\"\"}};const response=await fetch(\"https://api.bird.com/workspaces/1583e383-1506-498b-bcd0-c6eb91b6e517/contacts\",{method:\"POST\",headers:{\"Content-Type\":\"application/json\",Authorization:\"AccessKey L4e9391B2jCCqkXMo2KP4kuDOV7bG2VBBMzv\"},body:JSON.stringify(contactPayload)});if(!response.ok){throw new Error(`Bird API error: ${response.status}`);}await response.json();}catch(error){// Silent error handling\n}};const handleSubmit=async event=>{const formElement=event.target;const formData=Object.fromEntries(new FormData(formElement));sendToBird(formData);return true;};form.addEventListener(\"submit\",handleSubmit);return()=>form.removeEventListener(\"submit\",handleSubmit);},[props.formSelector]);return /*#__PURE__*/_jsx(\"div\",{style:{display:\"none\"},children:\"Bird Integration\"});}addPropertyControls(BirdIntegration,{formSelector:{type:ControlType.String,title:\"Form Selector\",defaultValue:\"form\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BirdIntegration\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BirdIntegration.map"],"mappings":"oNAA6I,SAAwB,EAAgB,EAAM,CACuG,OADtG,MAA8B,CAAC,IAAM,EAAK,SAAS,cAAc,EAAM,aAAa,CAAC,GAAG,CAAC,EAAK,OAAO,IAAM,MAAmB,CAAC,IAAM,EAAK,EAAO,SAAS,SAAsQ,OAA1P,EAAK,SAAS,OAAO,CAAQ,CAAC,KAAK,KAAK,KAAK,MAAM,CAAU,EAAK,SAAS,OAAO,CAAQ,CAAC,KAAK,KAAK,KAAK,QAAQ,CAAU,EAAK,SAAS,OAAO,CAAQ,CAAC,KAAK,KAAK,KAAK,SAAS,CAAU,EAAK,SAAS,OAAO,CAAQ,CAAC,KAAK,KAAK,KAAK,eAAe,CAAQ,CAAC,KAAK,GAAG,KAAK,GAAG,EAAS,EAAW,KAAM,IAAU,CAAC,GAAG,CAAC,IAAM,EAAU,OAAO,EAAS,eAAe,GAAG,CAAC,MAAM,CAAO,EAAS,OAAO,EAAS,cAAc,GAAG,CAAC,MAAM,CAAO,EAAY,GAAG,EAAU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