PageSourceSearch

https://beconnected.travel/assets/BlogNewsletterModal-DO2TTM-z.js

js beconnected.travel collected 2026-10-10 01:33:02 UTC 8,256 bytes, 5 lines download raw bytes

1import{j as t}from"./jsx-runtime-D_zvdyIk.js";import{r as a,L as A}from"./chunk-QMGIS6GS-WxoVEX50.js";import{a as D}from"./strapi-tIXXRqDd.js";import{f as H,i as B}from"./fetchStrapiWithLocaleFallback-oYMxBDAJ.js";import{u as F,a as q}from"./locale-store-CA0NPWw5.js";import{B as O}from"./Button-CJ11ynkW.js";import{M as I}from"./Modal-DgVKH-VM.js";import{s as P}from"./Toast-COnJ_vEk.js";import{g as R}from"./bcApiUrl-DyLISu6H.js";const C={none:"",xl:"py-[100px] md:py-[120px]",large:"py-[80px] md:py-[100px]",default:"py-[60px] md:py-[80px]",small:"py-[40px] md:py-[60px]"},Y={none:"",xl:"pt-[100px] md:pt-[120px]",large:"pt-[80px] md:pt-[100px]",default:"pt-[60px] md:pt-[80px]",small:"pt-[40px] md:pt-[60px]"},z={none:"",xl:"pb-[100px] md:pb-[120px]",large:"pb-[80px] md:pb-[100px]",default:"pb-[60px] md:pb-[80px]",small:"pb-[40px] md:pb-[60px]"},U=({className:e,spacing:s="default",id:i,children:o})=>{let r="";if(typeof s=="object"&&s!==null)if(s.linked_sides)r=C[s.spacing||"default"];else{const p=s.spacing_top||"default",m=s.spacing_bottom||"default";r=`${Y[p]} ${z[m]}`}else r=C[s];return t.jsx("section",{id:i,className:`relative ${r} ${e??""}`,children:o})};function G({title:e,copy:s,isAutomatic:i=!0,posts:o=[],button:r,published_text:p,no_posts_text:m,spacing:M="default",id:j,categoryId:u,excludePostId:f}){const{locale:d}=F(),b=q(),[v,w]=a.useState(o),[N,S]=a.useState(i&&o.length===0),T=p||"Publicado el",k=m||"No hay posts disponibles",_=`
2    .scrollbar-hide::-webkit-scrollbar {
3      display: none;
4    }
5  `;a.useEffect(()=>{(async()=>{if(b)if(i&&o.length===0)try{S(!0);const n={"sort[0]":"publishedAt:desc","pagination[limit]":"3","populate[0]":"featured_image","filters[publishedAt][$notNull]":"true"};u&&(n["filters[categories][id][$eq]"]=String(u)),f&&(n["filters[id][$ne]"]=String(f));const{data:x}=await H({endpoint:"posts",requestedLocale:d,query:n,isEmpty:B});w((x==null?void 0:x.data)||[])}catch(n){console.error("Error fetching latest posts:",n)}finally{S(!1)}else i||w(o)})()},[i,o,d,b,u,f]);const E=l=>{if(!l)return"";const n=new Date(l),x=String(n.getDate()).padStart(2,"0"),L=String(n.getMonth()+1).padStart(2,"0"),$=n.getFullYear();return`${T} ${x}/${L}/${$}`},y=v.slice(0,3);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:_}}),t.jsx(U,{spacing:M,id:j,className:"w-full bg-[#EDEFE7] overflow-hidden",children:t.jsx("div",{className:"w-full container",children:t.jsxs("div",{className:"w-full flex flex-col gap-[40px] md:gap-[60px]",children:[t.jsxs("div",{className:"flex flex-col gap-[24px] md:gap-[24px] max-w-[500px] w-full",children:[t.jsx("h2",{className:"text-[#004ada] text-[24px] md:text-[32px] font-medium leading-[1.3] tracking-[-0.5px]",children:e}),s&&t.jsx("p",{className:"text-[#140c2a] text-[16px] md:text-[20px] font-normal leading-[1.3]",children:s})]}),N?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-[#004ada]"})}):y.length===0?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx("p",{className:"text-[#140c2a] text-[16px]",children:k})}):t.jsx("div",{className:"overflow-x-auto md:overflow-x-visible scrollbar-hide -ml-[20px] md:ml-0 pl-[20px] pr-[20px] md:px-0 w-[calc(100%+40px)] md:w-full",style:{scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:t.jsx("div",{className:"flex gap-[20px] md:gap-[20px] relative min-w-max md:min-w-0 md:grid md:grid-cols-3",children:y.map(l=>{var n;return t.jsxs(A,{to:`/blog/${l.slug}`,className:"w-[260px] md:w-auto flex flex-col gap-[20px] shrink-0 cursor-pointer hover:opacity-80 transition-opacity",children:[t.jsx("div",{className:"relative w-full h-[200px] md:h-[320px] rounded-[20px] overflow-hidden bg-gray-200",children:(n=l.featured_image)!=null&&n.url?t.jsx("img",{src:D(l.featured_image.url)||"",alt:l.featured_image.alternativeText||l.title,className:"absolute inset-0 w-full h-full object-cover"}):t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-300",children:t.jsx("span",{className:"text-gray-500 text-sm",children:"No image"})})}),t.jsx("h3",{className:"text-[#002367] text-[16px] md:text-[24px] font-semibold leading-[1.3] tracking-[-0.5px]",children:l.title}),l.excerpt&&t.jsx("p",{className:"text-[#140c2a] text-[14px] md:text-[16px] font-normal leading-[1.3] text-justify",children:l.excerpt}),t.jsx("p",{className:"text-[#999] text-[11px] md:text-[12px] font-normal leading-[1.3]",children:E(l.publishedAt||l.createdAt)})]},l.id)})})}),r&&t.jsx(O,{...r.url.startsWith("http://")||r.url.startsWith("https://")?{href:r.url}:{to:r.url},variant:"primary",fullWidth:!1,className:"min-w-[240px] w-[280px] h-[60px]",children:r.label})]})})})]})}const oe=Object.freeze(Object.defineProperty({__proto__:null,default:G},Symbol.toStringTag,{value:"Module"})),W="bc-blog-newsletter-dismissed";function J(e){if(typeof window>"u")return!0;try{const s=window.localStorage.getItem(W);if(!s)return!1;const i=Number(s);if(!Number.isFinite(i))return!1;if(e<=0)return!0;const o=e*24*60*60*1e3;return Date.now()-i<o}catch{return!1}}function K(){try{window.localStorage.setItem(W,String(Date.now()))}catch{}}function Q({data:e}){var x,L,$;const[s,i]=a.useState(!1),[o,r]=a.useState(""),[p,m]=a.useState(""),[M,j]=a.useState(!1),[u,f]=a.useState(!1),d=!!(e!=null&&e.enabled),b=Math.min(100,Math.max(1,(e==null?void 0:e.scroll_percent)??30)),v=Math.max(0,(e==null?void 0:e.dismiss_days)??7),w=(e==null?void 0:e.title)||"Suscribite al newsletter",N=((x=e==null?void 0:e.text)==null?void 0:x.trim())||"",S=(e==null?void 0:e.email_placeholder)||"Tu e-mail",T=(e==null?void 0:e.button_text)||"Suscribir",k=(e==null?void 0:e.success_message)||"¡Listo! Te suscribiste al newsletter.",_=(e==null?void 0:e.error_message)||"No pudimos suscribirte. Intentá de nuevo.",E=(L=e==null?void 0:e.image)!=null&&L.url?D(e.image.url):null;a.useEffect(()=>{d&&(J(v)||f(!0))},[d,v]),a.useEffect(()=>{if(!u||s)return;const c=()=>{const g=document.documentElement.scrollHeight-window.innerHeight;if(g<=0){i(!0);return}window.scrollY/g*100>=b&&i(!0)};return c(),window.addEventListener("scroll",c,{passive:!0}),()=>window.removeEventListener("scroll",c)},[u,s,b]);const y=a.useCallback(()=>{i(!1),f(!1),K()},[]),l=c=>{const h=c.trim();return h?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(h):!1},n=async c=>{if(c.preventDefault(),!l(o)){m("Ingresá un e-mail válido");return}m(""),j(!0);try{const g=await(await fetch(`${R()}/services/subscribe_email.json`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o.trim()})})).json().catch(()=>({ok:!1}));g!=null&&g.ok?(P(k),r(""),y()):P(_)}catch(h){console.error("Newsletter subscribe error:",h),P(_)}finally{j(!1)}};
5return!d||!e?null:t.jsx(I,{isOpen:s,onClose:y,maxWidth:"520px",contentClassName:"p-[32px_28px] md:p-[40px_40px] overflow-y-auto max-h-[calc(100vh-80px)]",children:t.jsxs("div",{className:"flex flex-col gap-[24px] items-center text-center",children:[E?t.jsx("img",{src:E,alt:(($=e.image)==null?void 0:$.alternativeText)||w,className:"w-full max-h-[200px] object-cover rounded-[16px]"}):null,t.jsxs("div",{className:"flex flex-col gap-[12px] w-full",children:[t.jsx("h2",{className:"font-semibold text-[#002367] text-[24px] md:text-[28px] leading-[1.3] tracking-[-0.5px]",children:w}),N?t.jsx("p",{className:"text-[15px] md:text-[16px] text-[#140c2a] leading-[1.4] whitespace-pre-line",children:N}):null]}),t.jsxs("form",{onSubmit:n,className:"w-full flex flex-col gap-[12px]",children:[t.jsx("input",{type:"email",value:o,onChange:c=>{r(c.target.value),p&&m("")},placeholder:S,autoComplete:"email",className:`w-full h-[56px] px-[24px] rounded-[20px] bg-[#EDEFE7] text-[16px] font-medium text-[#002367] leading-[1.3] outline-none border-2 ${p?"border-[#eb0f0f]":"border-transparent focus:border-[#004ADA]"}`}),p?t.jsx("p",{className:"text-left text-[12px] font-semibold text-[#eb0f0f]",children:p}):null,t.jsx(O,{type:"submit",variant:"primary",isLoading:M,className:"w-full h-[56px]",children:T})]})]})})}const ae=Object.freeze(Object.defineProperty({__proto__:null,default:Q},Symbol.toStringTag,{value:"Module"}));export{Q as B,G as L,U as M,ae as _,oe as a};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.