1import{ab as Q,aq as q,ak as Z,C as M,p as m,c as H,f as $,s as ee,v as te,an as W,n as se,X as ae,T as ne,i as c,m as s,q as le,t as U,a5 as F,ac as w,ai as L,x,k as V,F as D,r as B,j as oe,A as ie,o as u,z as re,ap as ue}from"./DqjsD8ap.js";const R="The Adventure Travel Trade Association provides industry news and updates to the global adventure travel industry. We value your privacy and we will only use this information to communicate with you following the preferences you select. You may change your preferences or unsubscribe at any time using the links at the bottom of every newsletter.",ce={name:"Subscribe",components:{Hero:Q,Loading:q},computed:{...Z(M,["user"])},head(){return{title:"Subscribe | Adventure Travel Trade Association",meta:[{hid:"description",name:"description",content:R}]}},setup(h,i){const P=te(),e=M(),{$bus:j}=se(),k=`${P.public.sfSiteURL}/services/apexrest/email/subscribe`,C=m(R),O=H(()=>({"":a(b.value),"Specialized Newsletters":a(f.value)}));function a(t){if(!t)return null;const n=Object.keys(t),o=n.length;let l=2;o>10&&(l=3);const Y=Math.ceil(o/l);let y=[],S=0,E=0,T=0;for(;S<o;){const I=n[S];Y===E&&(E=0,T++),y[T]||y.push({}),y[T][I]=t[I],S++,E++}return y}function v(){j.$emit("open-login")}const g=m(null),f=m(null),b=m(null),r=m({}),p=m(!1),d=m({}),_=m(!0),G=H(()=>{const t=new ae.HeroDefaults;let n="Subscribe";return e!=null&&e.user&&!p.value&&(n="Email Subscription Preferences"),t.title=n,t.text=R,t.image_credit="© ATTA / BORDER FREE TRAVELS - AdventureWEEK Japan 2019",t});function J(t){return!1}function N(t){d.value={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const o=t[n];d.value[n]=o.is_subscribed}}function K(){if(!p.value){p.value=!0,d.value={};return}p.value=!1,A()}function X(){var o;_.value=!0;let t=!1;if((o=e==null?void 0:e.user)!=null&&o.sf_contact_id&&!r.value.email&&(t=!0,r.value.cid=e.user.sf_contact_id),t)r.value.lists=d.value;else{r.value.lists={};for(const l in d.value)Object.prototype.hasOwnProperty.call(d.value,l)&&d.value[l]&&(r.value.lists[l]=!0)}const n={headers:{Authorization:null}};W.post(k,r.value,n).then(l=>{l&&l.status}).catch(()=>{alert("Something went wrong. Please try again.")}).finally(()=>{_.value=!1})}function A(t){_.value=!0;const n={cid:t};W.get(k,{params:n}).then(o=>{if(o&&o.status===200){const l=o.data;l.ACInvites&&(g.value=z(l.ACInvites),N(g.value)),l.RegionalNews&&(f.value=z(l.RegionalNews),N(f.value)),l.GeneralNews&&(b.value=l.GeneralNews,N(b.value))}}).finally(()=>{_.value=!1})}function z(t){return Object.keys(t).sort().reduce((n,o)=>(n[o]=t[o],n),{})}return $(()=>e.user,t=>{t&&t.sf_contact_id&&A(t.sf_contact_id)}),ee(()=>{r.value.signup_url=window.location.href,r.value.source="Subscribe",A()}),{copy:C,lists:O,subForm:r,ifUsingOneOffEmail:p,subDetails:d,isLoading:_,heroBlock:G,listIsSet:J,toggleOneOff:K,submit:X,login:v}}},de={class:"pb-12"},me={class:"ContentBlock ContentBlock--gray"},fe={key:0,class:"text-center"},pe=["textContent"],ve={key:1,class:"max-w-screen-md mx-auto"},be={class:"flex pb-4 -mx-4"},_e={class:"w-1/2 px-4"},he=s("label",{class:"standard-label"},"First Name",-1),ge={class:"w-1/2 px-4"},ye=s("label",{class:"standard-label"},"Last Name",-1),we=s("label",{class:"standard-label"},"Email address",-1),xe={key:0,class:"text-sm pt-6 text-center"},ke=s("div",{class:"px-6 pt-10"},[s("h4",{class:"h4 text-primary-500 text-center tracking-wider normal-case"},"Select which lists you would like to receive communication from:")],-1),Ce=["textContent"],Oe={class:"flex"},Ne=["onUpdate:modelValue"],Ae=["textContent"],Se={class:"text-center pt-10"},Ee=["value"],Te=s("div",{class:"px-6 text-center text-sm"},[x(" We care about the protection of your data. Read our "),s("a",{href:"https://www.adventuretravel.biz/privacy-policy",target:"_blank"},"Privacy Policy"),x(". ")],-1);function Ue(h,i,P,e,j,k){const C=ie("hero"),O=q;return u(),c("main",de,[s("div",me,[le(C,{data:e.heroBlock,gray:!0,image:"https://cdn-content.adventuretravel.biz/uploads/2022/10/486063486d383e72e-large.jpg","small-title":!0},null,8,["data"])]),s("form",{onSubmit:i[5]||(i[5]=F(a=>e.submit(),["stop","prevent"])),class:"max-w-screen-lg mx-auto pt-10 pb-6 px-6"},[h.user&&!e.ifUsingOneOffEmail?(u(),c("div",fe,[s("p",{class:"font-semibold text-2xl pb-0",textContent:U(h.user.email)},null,8,pe),s("a",{href:"#",onClick:i[0]||(i[0]=F(a=>e.toggleOneOff(),["stop","prevent"]))},"Use a different email?")])):(u(),c("div",ve,[s("div",be,[s("div",_e,[he,w(s("input",{"onUpdate:modelValue":i[1]||(i[1]=a=>e.subForm.first_name=a),class:"standard-input w-full","aria-label":"First Name"},null,512),[[L,e.subForm.first_name]])]),s("div",ge,[ye,w(s("input",{"onUpdate:modelValue":i[2]||(i[2]=a=>e.subForm.last_name=a),class:"standard-input w-full","aria-label":"Last Name"},null,512),[[L,e.subForm.last_name]])])]),we,w(s("input",{"onUpdate:modelValue":i[3]||(i[3]=a=>e.subForm.email=a),class:"standard-input w-full",type:"email",autocomplete:"email","aria-label":"Email address"},null,512),[[L,e.subForm.email]]),e.ifUsingOneOffEmail?V("",!0):(u(),c("p",xe,[x("Have an ATTA login? "),s("a",{href:"#",onClick:i[4]||(i[4]=F(a=>e.login(),["stop","prevent"]))},"Login to update"),x(" your preferences.")]))])),ke,(u(!0),c(D,null,B(e.lists,(a,v)=>(u(),c("div",{key:v,class:"pt-10 pb-10 px-6"},[v?(u(),c("h5",{key:0,class:"h5 normal-case pb-4",textContent:U(v)},null,8,Ce)):V("",!0),s("div",Oe,[(u(!0),c(D,null,B(a,(g,f)=>(u(),c("div",{key:f,class:re({"w-full md:w-1/3":a.length===2&&f===0||a.length===3,"w-full md:w-2/3":a.length===2&&f===1})},[(u(!0),c(D,null,B(g,(b,r)=>(u(),c("label",{key:r,class:"standard-label standard-label--checkbox items-start mb-1"},[w(s("input",{class:"mt-1",type:"checkbox","onUpdate:modelValue":p=>e.subDetails[r]=p},null,8,Ne),[[ue,e.subDetails[r]]]),s("span",{class:"pt-0 mt-0",textContent:U(b.list_label)},null,8,Ae)]))),128))],2))),128))])]))),128)),s("div",Se,[s("input",{class:"standard-button standard-button--primary",type:"submit",value:h.user&&!e.ifUsingOneOffEmail?"Update Preferences":"Save Preferences"},null,8,Ee)])],32),Te,e.isLoading?(u(),oe(O,{key:0})):V("",!0)])}const Le=ne(ce,[["render",Ue]]);export{Le 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.