PageSourceSearch

https://airvago.com/assets/BlogTrialPopup-BpqkR1ZD.js

js airvago.com collected 2026-10-09 22:55:17 UTC 12,207 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-vendor-oD7Tq4sg.js";import{r as t,L as s}from"./react-vendor-CbaVsK1o.js";import{W as a,b as r,V as o,a2 as n,A as i,B as l,E as c,a3 as d,J as u,s as m}from"./index-B6vL04Yo.js";import{u as g}from"./use-safe-area-BvnuY4K0.js";import{P as p}from"./PopupGoogleSignup-BsJfPDLF.js";import{p as f}from"./blog-popup-copy-BoNLVwBu.js";import{f as x}from"./fetch-lead-magnet-url-BfuVPBNf.js";import{l as h}from"./lead-magnets-Lh0JhpvV.js";import{X as b,a1 as w,S as v,L as y,N as j,d as N,D as S}from"./icons-CURIRF8G.js";import"./query-5kQ0LJzJ.js";import"./animation-BhsO7hMJ.js";const k="airvago-blog-popup-state",_="airvago-blog-popup-session-shown",C="airvago-blog-reads",I="airvago-blog-last-slug",D="airvago-blog-popup-bucket",E=1728e5,T={fast:{timeMs:25e3,scrollPct:.4},patient:{timeMs:4e4,scrollPct:.55}};function P(){try{const e=localStorage.getItem(D);if("fast"===e||"patient"===e)return e;const t=Math.random()<.5?"fast":"patient";return localStorage.setItem(D,t),t}catch{return"fast"}}function A(){try{const e=localStorage.getItem(k);return e?JSON.parse(e):{}}catch{return{}}}function M(e){try{localStorage.setItem(k,JSON.stringify(e))}catch{}}function $({slug:k,categoryName:D,targetKeywords:$,title:L}){const{user:R}=r(),Y=o(),{safeAreaInsets:q}=g(),{shouldShow:F,trigger:J,dismiss:O,markEmailSubmitted:U,remindLater:z,bucket:W}=function(e){const[s,r]=t.useState(!1),[o,n]=t.useState(null),i=t.useRef(!1),l=t.useRef(Date.now());return t.useEffect(()=>{if(i.current=!1,l.current=Date.now(),!e)return;const t=A();if(t.emailSubmitted)return;if(t.closedAt&&Date.now()-t.closedAt<E)return;try{const e=localStorage.getItem("email_subscribed");if("1"===e||"true"===e)return;const t=localStorage.getItem("airvago-email-popup");if(t){const e=JSON.parse(t);if(e?.emailSubmitted)return}}catch{}try{if("1"===sessionStorage.getItem(_))return}catch{}const s=P(),o=T[s],c=t=>{if(!i.current){i.current=!0,n(t),r(!0);try{sessionStorage.setItem(_,"1")}catch{}try{a("custom",{name:"blog_popup_armed",slug:e,trigger:t,bucket:s})}catch{}}},d=function(e){try{if(sessionStorage.getItem(I)===e)return parseInt(sessionStorage.getItem(C)||"1",10);const t=parseInt(sessionStorage.getItem(C)||"0",10)+1;return sessionStorage.setItem(C,String(t)),sessionStorage.setItem(I,e),t}catch{return 1}}(e),u=window.setTimeout(()=>{d>=2&&c("second-read")},4e3),m=window.setTimeout(()=>c("time"),o.timeMs),g=()=>{const e=document.documentElement.scrollHeight-window.innerHeight;e<=0||window.scrollY/e>=o.scrollPct&&c("scroll")};window.addEventListener("scroll",g,{passive:!0});const p=e=>{"undefined"!=typeof window&&window.matchMedia("(min-width: 768px)").matches&&(e.relatedTarget||e.toElement||e.clientY>0||Date.now()-l.current<1e4||c("exit"))};return document.addEventListener("mouseout",p),()=>{window.clearTimeout(u),window.clearTimeout(m),window.removeEventListener("scroll",g),document.removeEventListener("mouseout",p)}},[e]),{shouldShow:s,trigger:o,dismiss:t.useCallback(e=>{r(!1),e&&M({...A(),closedAt:Date.now()})},[]),markEmailSubmitted:t.useCallback(()=>{M({...A(),emailSubmitted:!0}),r(!1)},[]),remindLater:t.useCallback(()=>{r(!1);const e=A(),t=(e.remindCount??0)+1;if(t>2)M({...e,closedAt:Date.now(),remindCount:t});else{M({...e,remindCount:t});try{sessionStorage.removeItem(_)}catch{}window.setTimeout(()=>{const e=A();if(!(e.emailSubmitted||e.closedAt&&Date.now()-e.closedAt<E)){i.current=!0,n("remind-later"),r(!0);try{sessionStorage.setItem(_,"1")}catch{}}},24e4)}},[]),bucket:P()}}(k),{isMyTurn:B,requestShow:H,notifyDismissed:K}=n("blog-trial",3),[G,V]=t.useState(!1),[Q,X]=t.useState(!1),[Z,ee]=t.useState(""),[te,se]=t.useState(""),[ae,re]=t.useState(!0),[oe,ne]=t.useState(!1),[ie,le]=t.useState(!1),[ce,de]=t.useState(!1),[ue,me]=t.useState(null),[ge,pe]=t.useState(""),fe=t.useRef(Date.now()),xe=t.useRef(!1),he=f({slug:k,categoryName:D,targetKeywords:$,title:L}),be=`/itinerary?ref=blog&topic=${encodeURIComponent(he.topic)}${he.city?`&city=${encodeURIComponent(he.city)}`:""}`;t.useEffect(()=>{R||F&&H()},[F,R,H]),t.useEffect(()=>{ie||V(B&&F&&!R)},[B,F,R,ie]),t.useEffect(()=>{G&&!xe.current&&(xe.current=!0,a("custom",{name:"blog_popup_viewed",slug:k,category:D??null,variant:he.id,trigger:J}))},[G,k,D,he.id,J]);const we=e=>{X(!0),window.setTimeout(()=>{V(!1),X(!1),O(e),K()},200)},ve=e=>{a("custom",{name:"blog_popup_closed",slug:k,variant:he.id,permanent:e}),we(e)},ye=()=>{a("custom",{name:"blog_popup_cta_clicked",slug:k,variant:he.id,destination:be});try{sessionStorage.setItem("airvago-blog-ref","1")}catch{}we(!1)};if(!G)return null;const je=Y?{paddingBottom:`${Math.max(q.bottom+12,12)}px`}:void 0;return e.jsx("div",{className:`fixed inset-0 z-[60] flex ${Y?"items-end":"items-center"} justify-center bg-black/60 backdrop-blur-sm transition-all ${Q?"animate-out fade-out duration-200":"animate-in fade-in duration-300"}`,style:je,onClick:()=>ve(!1),role:"dialog","aria-modal":"true","aria-label":"Trip plan offer",children:e.jsx("div",{className:`${Y?"w-full max-h-[92vh] overflow-y-auto":"relative max-w-md w-full mx-4"} ${Q?"animate-out slide-out-to-bottom-5 duration-200":"animate-in slide-in-from-bottom-5 duration-300"}`,onClick:e=>e.stopPropagation(),children:e.jsxs(i,{className:"relative overflow-hidden border border-[#ff6b35]/25 bg-background/95 backdrop-blur-md shadow-2xl "+(Y?"rounded-t-2xl rounded-b-none border-b-0":"rounded-2xl"),children:[e.jsx("div",{className:"h-[3px] w-full bg-gradient-to-r from-[#ff6b35] via-[#e84393] to-[#6c5ce7]"}),e.jsx(l,{variant:"ghost",size:"sm",onClick:()=>ve(!0),className:"absolute right-3 top-3 p-0 hover:bg-muted z-10 "+(Y?"h-11 w-11":"h-8 w-8"),"aria-label":"Close",children:e.jsx(b,{className:Y?"w-5 h-5":"w-4 h-4"})}),e.jsxs(c,{className:"relative "+(Y?"p-6 pt-6":"p-6"),children:[Y&&e.jsx("div",{className:"flex justify-center -mt-2 mb-4",children:e.jsx("div",{className:"w-12 h-1 bg-muted-foreground
1/30 rounded-full"})}),ie?e.jsxs("div",{className:"text-center py-6",children:[e.jsx("div",{className:"mx-auto w-12 h-12 rounded-full bg-[#6c5ce7]/15 flex items-center justify-center mb-3",children:e.jsx(N,{className:"w-6 h-6 text-[#6c5ce7]",strokeWidth:3})}),e.jsx("h3",{className:"text-lg font-semibold mb-1",children:ce?"You're already on the list":"You're in ✈️"}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Your ",e.jsx("strong",{children:he.leadMagnetTitle})," is ready."," ","We also emailed you a copy."]}),ue?e.jsxs("a",{href:ue,target:"_blank",rel:"noopener noreferrer",onClick:()=>a("custom",{name:"guide_pdf_click",variant:he.id,surface:"popup_success"}),className:"inline-flex w-full items-center justify-center gap-2 rounded-lg px-4 h-11 text-sm font-semibold text-white bg-gradient-to-r from-[#ff6b35] via-[#e84393] to-[#6c5ce7] hover:opacity-95 transition",children:[e.jsx(S,{className:"w-4 h-4"}),"Download your PDF"]}):e.jsxs("div",{className:"inline-flex w-full items-center justify-center gap-2 rounded-lg px-4 h-11 text-sm font-medium text-muted-foreground border border-border",children:[e.jsx(y,{className:"w-4 h-4 animate-spin"}),"Preparing download link…"]}),e.jsxs(s,{to:h(he.id),className:"mt-3 inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition",children:["Open the full guide page",e.jsx(j,{className:"w-3 h-3"})]}),e.jsx("div",{className:"my-4 h-px w-full bg-border"}),e.jsxs(s,{to:be,onClick:ye,className:"inline-flex items-center gap-2 text-sm font-semibold text-[#ff6b35] hover:underline",children:[he.primaryCta,e.jsx(j,{className:"w-4 h-4"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsxs("div",{className:"relative w-12 h-12 rounded-full flex items-center justify-center bg-[#ff6b35]/15 ring-1 ring-[#ff6b35]/30",children:[e.jsx(w,{className:"w-6 h-6 text-[#ff6b35]"}),e.jsx(v,{className:"w-3.5 h-3.5 text-[#e84393] absolute -top-1 -right-1 animate-pulse"})]})}),e.jsxs("div",{className:"text-center mb-5 space-y-2",children:[e.jsx("h2",{className:"text-xl md:text-2xl font-bold leading-tight bg-gradient-to-r from-[#ff6b35] via-[#e84393] to-[#6c5ce7] bg-clip-text text-transparent",children:he.headline}),e.jsx("p",{className:"text-sm text-muted-foreground",children:he.body})]}),e.jsxs("form",{onSubmit:async e=>{e.preventDefault(),e.stopPropagation();const t=e=>{const t=x(he.id,{slug:k,email:Z,source:"popup",unlock:e});return t?.trackedUrl??h(he.id)},s=e=>{me(t(e)),le(!0)};if(te)s();else if(Date.now()-fe.current<3e3)s();else if(Z&&Z.includes("@")){s(),ne(!0),pe("Sending your guide…");try{try{const{data:e,error:t}=await m.functions.invoke("validate-email",{body:{email:Z}});if(t||!e?.valid)return u.error(e?.reason||"This email address is not allowed."),ne(!1),void pe("")}catch{}pe("Preparing your guide…");const{data:e,error:s}=await m.functions.invoke("blog-lead-capture",{body:{email:Z,slug:k,variant:he.id,city:he.city,marketing_consent:ae,consent_text_version:"v1_2026",consent_source:"blog_popup"}});if(s)return u.error("Something went wrong. Please try again."),ne(!1),void pe("");const r=e?.unlockToken;r&&me(t(r)),a("custom",{name:"blog_lead_submitted",slug:k,variant:he.id,surface:"popup",trigger:J,bucket:W,already_subscribed:!!e?.alreadySubscribed}),de(!!e?.alreadySubscribed),U()}finally{ne(!1),pe("")}}else u.error("Please enter a valid email address")},className:"space-y-2.5",children:[e.jsx("input",{type:"text",tabIndex:-1,autoComplete:"off",value:te,onChange:e=>se(e.target.value),className:"absolute left-[-9999px] w-px h-px opacity-0","aria-hidden":"true"}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{className:"absolute left-3 text-muted-foreground "+(Y?"top-4 w-5 h-5":"top-3 w-4 h-4")}),e.jsx(d,{type:"email",inputMode:"email",required:!0,placeholder:"[email protected]",value:Z,onChange:e=>ee(e.target.value),className:"pl-10 "+(Y?"h-12 text-base":"h-11")})]}),e.jsx(l,{type:"submit",disabled:oe,className:"w-full h-11 text-sm font-semibold text-white bg-gradient-to-r from-[#ff6b35] via-[#e84393] to-[#6c5ce7] hover:opacity-95",children:oe?e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"w-4 h-4 mr-1.5 animate-spin"}),ge||"Sending…"]}):e.jsxs(e.Fragment,{children:[he.primaryCta,e.jsx(j,{className:"w-4 h-4 ml-1"})]})}),e.jsxs("label",{className:"flex items-start gap-2 text-[11px] text-muted-foreground cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:ae,onCh
1ange:e=>{re(e.target.checked),a("custom",{name:e.target.checked?"marketing_consent_granted":"marketing_consent_declined",surface:"blog_popup",variant:he.id})},className:"mt-0.5 h-3.5 w-3.5 rounded border-input"}),e.jsx("span",{children:"Send me occasional travel-planning tips, Airvago updates and offers. Unsubscribe any time."})]})]}),e.jsx(p,{source:"blog_popup",next:`/blog/${k}`,buttonClassName:Y?"h-12 text-base rounded-xl":"h-11 text-sm rounded-lg",onStart:()=>a("custom",{name:"blog_popup_email_submitted",method:"google",slug:k,variant:he.id})}),e.jsx("p",{className:"text-[11px] text-center text-muted-foreground mt-2",children:"Your guide arrives whether or not you check the box above. No credit card required."}),e.jsxs("div",{className:"my-4 flex items-center gap-3",children:[e.jsx("div",{className:"h-px flex-1 bg-border"}),e.jsx("span",{className:"text-[10px] uppercase tracking-widest text-muted-foreground",children:"or plan the full trip now"}),e.jsx("div",{className:"h-px flex-1 bg-border"})]}),e.jsxs(s,{to:be,onClick:ye,className:"w-full inline-flex items-center justify-center gap-2 rounded-lg px-4 py-2.5 text-sm font-medium text-foreground border border-border hover:bg-muted transition",children:["Start free forever",e.jsx(j,{className:"w-4 h-4"})]}),e.jsx("button",{type:"button",onClick:()=>{a("custom",{name:"blog_popup_remind_later",slug:k,variant:he.id}),X(!0),window.setTimeout(()=>{V(!1),X(!1),z(),K()},200)},className:"mt-3 w-full text-center text-xs text-muted-foreground hover:text-foreground transition","aria-label":"Remind me later",children:"Remind me later"}),e.jsx("button",{type:"button",onClick:()=>ve(!1),className:"mt-2 w-full text-center text-xs text-muted-foreground hover:text-foreground transition",children:he.secondaryCta})]})]})]})})})}export{$ as default};

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.