{"version":3,"file":"EbookForm.DRnT-R_V.mjs","names":[],"sources":["https:/framerusercontent.com/modules/JkYakRs5sjX6Fe16FQQ5/OErZMoJfgmV6en7nMb7z/EbookForm.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";export default function ContactForm(props){const{portalId,formId,fields,successMessage,buttonText,styles,enableRedirect,redirectUrl,redirectDelay,showKeyUserGeographiesField}=props;// Parse fields if it's a string\nlet parsedFields=[];try{parsedFields=typeof fields===\"string\"?JSON.parse(fields):fields;}catch(e){console.error(\"Error parsing fields:\",e);}// Filtrar campos basándose en las props del CMS\nconst visibilityMap={keyusergeographies:showKeyUserGeographiesField};const visibleFields=parsedFields.filter(field=>visibilityMap[field.id]!==false);const htmlContent=`\n<style>\n  * {\n    box-sizing: border-box;\n    margin: 0;\n    padding: 0;\n  }\n  \n  .contact-container {\n    width: 100%;\n    min-height: fit-content;\n    overflow: visible !important;\n  }\n  \n  .contact-form {\n    display: flex;\n    flex-direction: column;\n    gap: 16px;\n    overflow: visible !important;\n    width: 100%;\n  }\n  \n  .form-field {\n    display: flex;\n    flex-direction: column;\n    gap: 8px;\n  }\n  \n  .form-label {\n    color: ${styles.labelColor};\n    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n    font-size: ${styles.labelSize}px;\n    font-weight: 400;\n  }\n  \n  .form-input, .form-textarea, .form-select {\n    width: 100%;\n    padding: 12px;\n    border-radius: 10px;\n    border: 1px solid ${styles.inputBorderColor};\n    background: ${styles.inputBgColor};\n    color: ${styles.inputTextColor};\n    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n    font-size: 14px;\n    font-weight: 400;\n    outline: none;\n    transition: all 0.3s ease;\n  }\n  \n  .form-textarea {\n    min-height: 100px;\n    resize: vertical;\n  }\n  \n  .form-input::placeholder, .form-textarea::placeholder {\n    color: ${styles.inputPlaceholderColor};\n  }\n  \n  .form-input:focus, .form-textarea:focus, .form-select:focus {\n    border: 1px solid ${styles.inputFocusBorderColor};\n    background: ${styles.inputBgColor};\n  }\n  \n  .submit-button {\n    width: 100%;\n    padding: 12px 24px;\n    background: ${styles.buttonBgColor};\n    color: ${styles.buttonTextColor};\n    border: none;\n    border-radius: ${styles.buttonRadius}px;\n    cursor: pointer;\n    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n    font-weight: 600;\n    font-size: 14px;\n    white-space: nowrap;\n    transition: all 0.3s ease;\n  }\n  \n  .submit-button:hover {\n    opacity: 0.9;\n  }\n  \n  .submit-button:active {\n    transform: scale(0.98);\n  }\n  \n  .submit-button:disabled {\n    opacity: 0.6;\n    cursor: not-allowed;\n    transform: none;\n  }\n  \n  .message {\n    margin-top: 12px;\n    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n    font-size: 14px;\n    font-weight: 400;\n    line-height: 1.5;\n    display: none;\n  }\n  \n  .message.success {\n    color: ${styles.successTextColor};\n  }\n  \n  .message.error {\n    color: ${styles.errorTextColor};\n  }\n  \n  .message.show {\n    display: block;\n    animation: slideDown 0.3s ease;\n  }\n  \n  @keyframes slideDown {\n    from {\n      opacity: 0;\n      transform: translateY(-10px);\n    }\n    to {\n      opacity: 1;\n      transform: translateY(0);\n    }\n  }\n  \n  @media (max-width: 380px) {\n    .form-input, .form-textarea, .form-select {\n      font-size: 16px;\n    }\n  }\n</style>\n\n<div class=\"contact-container\">\n  <form class=\"contact-form\" id=\"contactForm\">\n    ${visibleFields.map(field=>`\n      <div class=\"form-field\">\n        <label for=\"${field.id}\" class=\"form-label\">${field.label}</label>\n        ${field.type===\"textarea\"?`<textarea \n            class=\"form-textarea\"\n            name=\"${field.name}\"\n            placeholder=\"${field.placeholder}\"\n            ${field.required?\"required\":\"\"}\n            id=\"${field.id}\"\n          ></textarea>`:field.type===\"select\"?`<select \n            class=\"form-select\"\n            name=\"${field.name}\"\n            ${field.required?\"required\":\"\"}\n            id=\"${field.id}\"\n          >\n            <option value=\"\">${field.placeholder}</option>\n          </select>`:`<input \n            type=\"${field.type}\" \n            class=\"form-input\"\n            name=\"${field.name}\"\n            placeholder=\"${field.placeholder}\"\n            ${field.required?\"required\":\"\"}\n            id=\"${field.id}\"\n          >`}\n      </div>\n    `).join(\"\")}\n    \n    <button type=\"submit\" class=\"submit-button\" id=\"submitBtn\">\n      ${buttonText}\n    </button>\n  </form>\n  \n  <div class=\"message\" id=\"messageBox\"></div>\n</div>\n\n<script>\nsetTimeout(function() {\n  const form = document.getElementById('contactForm');\n  const submitBtn = document.getElementById('submitBtn');\n  const messageBox = document.getElementById('messageBox');\n  \n  const fields = ${JSON.stringify(visibleFields)};\n  const enableRedirect = ${enableRedirect};\n  const redirectUrl = '${redirectUrl}';\n  const redirectDelay = ${redirectDelay};\n  \n  if (!form || !submitBtn || !messageBox) {\n    console.error('ERROR: Form elements not found!');\n    return;\n  }\n  \n  const PORTAL_ID = '${portalId}';\n  const FORM_GUID = '${formId}';\n  \n  function showMessage(text, type) {\n    messageBox.textContent = text;\n    messageBox.className = 'message ' + type + ' show';\n  }\n  \n  async function submitToHubSpot(formData) {\n    const url = 'https://api.hsforms.com/submissions/v3/integration/submit/' + PORTAL_ID + '/' + FORM_GUID;\n    \n    const data = {\n      fields: formData,\n      context: {\n        pageUri: window.location.href,\n        pageName: document.title || 'Contact Form'\n      }\n    };\n    \n    const response = await fetch(url, {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      body: JSON.stringify(data)\n    });\n    \n    return response;\n  }\n  \n  form.addEventListener('submit', async function(e) {\n    e.preventDefault();\n    \n    const formData = fields.map(function(field) {\n      const input = document.getElementById(field.id);\n      return {\n        objectTypeId: \"0-1\",\n        name: field.name,\n        value: input ? input.value.trim() : ''\n      };\n    });\n    \n    const hasEmptyRequired = fields.some(function(field) {\n      if (field.required) {\n        const input = document.getElementById(field.id);\n        return !input || !input.value.trim();\n      }\n      return false;\n    });\n    \n    if (hasEmptyRequired) {\n      showMessage('Please fill in all required fields.', 'error');\n      return;\n    }\n    \n    submitBtn.disabled = true;\n    submitBtn.textContent = 'Sending...';\n    messageBox.classList.remove('show');\n    \n    try {\n      const response = await submitToHubSpot(formData);\n      const responseData = await response.json();\n      \n      if (response.ok) {\n        showMessage('${successMessage}', 'success');\n        form.style.display = 'none';\n        \n        // Redirect if enabled\n        if (enableRedirect && redirectUrl) {\n          setTimeout(function() {\n            window.location.href = redirectUrl;\n          }, redirectDelay);\n        }\n      } else {\n        if (responseData.errors && responseData.errors.length > 0) {\n          showMessage(responseData.errors[0].message, 'error');\n        } else {\n          showMessage('There was an error. Please try again.', 'error');\n        }\n      }\n    } catch (error) {\n      showMessage('Connection error. Please try again.', 'error');\n    } finally {\n      submitBtn.disabled = false;\n      submitBtn.textContent = '${buttonText}';\n    }\n  });\n  \n}, 1000);\n</script>\n`;return /*#__PURE__*/_jsx(\"div\",{dangerouslySetInnerHTML:{__html:htmlContent}});}ContactForm.defaultProps={portalId:\"21743880\",formId:\"e9232fef-2f33-4737-881d-b4d7e096ab3a\",fields:[{id:\"nameInput\",label:\"Name\",name:\"firstname\",type:\"text\",placeholder:\"Name\",required:true},{id:\"emailInput\",label:\"Email\",name:\"email\",type:\"email\",placeholder:\"Email\",required:true},{id:\"positionInput\",label:\"Position\",name:\"jobtitle\",type:\"text\",placeholder:\"Co-founder\",required:true},{id:\"companyInput\",label:\"Company name\",name:\"company\",type:\"text\",placeholder:\"Trinsic\",required:true},{id:\"keyusergeographies\",label:\"Key user geographies\",name:\"key_user_geographies\",type:\"textarea\",placeholder:\"Where are your users located?\",required:true}],successMessage:\"Thank you for contacting Trinsic! Someone from our team will be in touch shortly.\",buttonText:\"Submit\",enableRedirect:false,redirectUrl:\"\",redirectDelay:2e3,showKeyUserGeographiesField:true,styles:{labelColor:\"#666666\",labelSize:14,inputBorderColor:\"rgba(136,136,136, 0.2)\",inputBgColor:\"rgba(187,187,187, 0.15)\",inputTextColor:\"#000000\",inputPlaceholderColor:\"rgba(153,153,153, 0.9)\",inputFocusBorderColor:\"rgba(1,107,228, 0.9)\",buttonBgColor:\"#016BE4\",buttonTextColor:\"#FFFFFF\",buttonRadius:20,successTextColor:\"#FFFFFF\",errorTextColor:\"#ef4444\"}};addPropertyControls(ContactForm,{portalId:{type:ControlType.String,title:\"Portal ID\",defaultValue:\"21743880\"},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"e9232fef-2f33-4737-881d-b4d7e096ab3a\"},fields:{type:ControlType.Array,title:\"Fields\",control:{type:ControlType.Object,controls:{id:{type:ControlType.String,title:\"Field ID\",defaultValue:\"field\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Field Label\"},name:{type:ControlType.String,title:\"Field Name (HubSpot)\",defaultValue:\"fieldname\"},type:{type:ControlType.Enum,title:\"Input Type\",options:[\"text\",\"email\",\"number\",\"tel\",\"url\",\"date\",\"time\",\"textarea\"],optionTitles:[\"Text\",\"Email\",\"Number\",\"Phone Number\",\"URL\",\"Date\",\"Time\",\"Text Area\"],defaultValue:\"text\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter value\"},required:{type:ControlType.Boolean,title:\"Required\",defaultValue:true}}}},successMessage:{type:ControlType.String,title:\"Success Message\",defaultValue:\"Thank you for contacting Trinsic! Someone from our team will be in touch shortly.\",displayTextArea:true},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Submit\"},showKeyUserGeographiesField:{type:ControlType.Boolean,title:\"Show Key User Geographies\",defaultValue:true},enableRedirect:{type:ControlType.Boolean,title:\"Enable Redirect\",defaultValue:false},redirectUrl:{type:ControlType.Link,title:\"Redirect URL\",hidden:props=>!props.enableRedirect},redirectDelay:{type:ControlType.Number,title:\"Redirect Delay (ms)\",defaultValue:2e3,min:0,max:1e4,step:500,displayStepper:true,hidden:props=>!props.enableRedirect},styles:{type:ControlType.Object,title:\"Styles\",controls:{labelColor:{type:ControlType.Color,title:\"Label Color\",defaultValue:\"#666666\"},labelSize:{type:ControlType.Number,title:\"Label Size\",defaultValue:14,min:10,max:24,step:1},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"rgba(136,136,136, 0.2)\"},inputBgColor:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"rgba(187,187,187, 0.15)\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"#000000\"},inputPlaceholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"rgba(153,153,153, 0.9)\"},inputFocusBorderColor:{type:ControlType.Color,title:\"Input Focus Border\",defaultValue:\"rgba(1,107,228, 0.9)\"},buttonBgColor:{type:ControlType.Color,title:\"Button Background\",defaultValue:\"#016BE4\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#FFFFFF\"},buttonRadius:{type:ControlType.Number,title:\"Button Radius\",defaultValue:20,min:0,max:50,step:1},successTextColor:{type:ControlType.Color,title:\"Success Text\",defaultValue:\"#FFFFFF\"},errorTextColor:{type:ControlType.Color,title:\"Error Text\",defaultValue:\"#ef4444\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ContactForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EbookForm.map"],"mappings":"4JAA+F,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,WAAS,SAAO,SAAO,iBAAe,aAAW,SAAO,iBAAe,cAAY,gBAAc,+BAA6B,EAC1Q,EAAa,EAAE,CAAC,GAAG,CAAC,EAAa,OAAO,GAAS,SAAS,KAAK,MAAM,EAAO,CAAC,QAAc,EAAE,CAAC,QAAQ,MAAM,wBAAwB,EAAE,CAC1I,IAAM,EAAc,CAAC,mBAAmB,EAA4B,CAAO,EAAc,EAAa,OAAO,GAAO,EAAc,EAAM,MAAM,GAAM,CAmRlJ,OAAoB,EAAK,MAAM,CAAC,w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