1import{u as I,j as e,v as q,L as j,o as ue,n as xe,r as m,s as S,N as ge,t as z,U as J,q as x,I as f,B as b,a3 as fe,A as W,F as he}from"./index-VX5_-DlE.js";import{C as ve}from"./circle-check-big-DueftlwE.js";import{Q as be}from"./qr-code-BQqaTLpz.js";import{S as je}from"./sparkles-D6UkNqdR.js";import{U as Z}from"./user-plus-ChSf4Rvb.js";import{C as ye}from"./circle-x-C_YeQLko.js";const Ne=({id:k="networking-consent",checked:t,onCheckedChange:u,className:y})=>{const{language:w}=I(),g=w==="it";return e.jsxs("div",{className:`flex items-start gap-3 ${y||""}`,children:[e.jsx(q,{id:k,checked:t,onCheckedChange:h=>u(h===!0),className:"mt-0.5"}),e.jsxs("label",{htmlFor:k,className:"font-sans text-xs text-muted-foreground leading-relaxed cursor-pointer",children:[g?"Acconsento ad accedere a Event Connection e a rendere visibile il mio profilo agli altri partecipanti per finalità di networking secondo quanto previsto dalla ":"I consent to access Event Connection and to make my profile visible to other participants for networking purposes as set forth in the ",e.jsx(j,{to:"/privacy-policy",target:"_blank",className:"underline text-foreground",children:"privacy policy"}),". *"]})]})},Ee=()=>{var H;const[k]=ue(),{language:t}=I(),{toast:u}=xe(),y=k.get("order_id"),w=k.get("session_id"),[g,h]=m.useState("loading"),[p,ee]=m.useState(null),[F,te]=m.useState(!0),[L,se]=m.useState([]),[v,O]=m.useState(1),[ke,ae]=m.useState({}),[R,re]=m.useState([]),[T,$]=m.useState([]),[Q,B]=m.useState(!1),[C,ie]=m.useState(!1),[A,ne]=m.useState(""),[U,oe]=m.useState(""),[G,M]=m.useState(!1),[D,ce]=m.useState(!1),Y=m.useRef(!1);m.useEffect(()=>{y&&w?le():h("failed")},[y,w]),m.useEffect(()=>{if(g!=="success"||!p||Y.current)return;const a=window.fbq;if(typeof a!="function")return;const s=(p.ticket_order_items||[]).map(o=>{var l,r;return{id:o.ticket_type_id||((l=o.ticket_types)==null?void 0:l.id)||((r=o.ticket_types)==null?void 0:r.name)||"ticket",quantity:o.quantity||1,item_price:Number(o.unit_price||o.total_price||0)}});a("track","Purchase",{value:Number(p.total||0),currency:"EUR",content_type:"product",content_ids:s.map(o=>o.id),contents:s}),Y.current=!0},[g,p]);const le=async()=>{var a;try{const{data:s,error:o}=await S.functions.invoke("verify-ticket-payment",{body:{sessionId:w,orderId:y}});if(o||s!=null&&s.error){h("failed");return}if(s!=null&&s.success){h("success"),ee(s.order),te(s.userExists??!0),se(s.attendees??[]);const l=s.totalTicketQty||1;O(l),ae(s.eventQuantities||{});const r=s.ticketGroups||[];re(r);const i=r.reduce((E,N)=>E+(N.quantity||1)*(N.seatsPerTicket||1),0);i>0&&O(i);const d=(((a=s.order)==null?void 0:a.full_name)||"").trim().split(" ");let c=!1;const n=r.map(E=>{var V,K;const N=[],pe=(E.quantity||1)*(E.seatsPerTicket||1);for(let X=0;X<pe;X++)c?N.push({firstName:"",lastName:"",email:"",phone:"",companyOrRole:"",privacyAccepted:!1,marketingConsent:!1,networkingConsent:!1}):(N.push({firstName:d[0]||"",lastName:d.slice(1).join(" ")||"",email:((V=s.order)==null?void 0:V.email)||"",phone:((K=s.order)==null?void 0:K.phone)||"",companyOrRole:"",privacyAccepted:!1,marketingConsent:!1,networkingConsent:!1}),c=!0);return N});$(n)}else h("failed")}catch{h("failed")}},P=(a,s,o,l)=>{$(r=>r.map((i,d)=>d===a?i.map((c,n)=>n===s?{...c,[o]:l}:c):i))},_=(a,s,o,l)=>{$(r=>r.map((i,d)=>d===a?i.map((c,n)=>n===s?{...c,[o]:l}:c):i))},de=async()=>{var s;let a=0;for(let o=0;o<T.length;o++){const l=T[o],r=((s=R[o])==null?void 0:s.ticketTypeName)||`Group ${o+1}`;for(let i=0;i<l.length;i++){a+=1;const d=l[i];if(!d.firstName.trim()||!d.lastName.trim()||!d.email.trim()){u({title:t==="it"?`Completa il partecipante ${i+1} di "${r}"`:`Complete attendee ${i+1} of "${r}"`,variant:"destructive"});return}if(!d.companyOrRole.trim()){u({title:t==="it"?`Indica azienda o professione del partecipante ${i+1} di "${r}"`:`Provide company or profession for attendee ${i+1} of "${r}"`,variant:"destructive"});return}if(!d.privacyAccepted){u({title:t==="it"?`Accetta la privacy del partecipante ${i+1} di "${r}"`:`Accept privacy for attendee ${i+1} of "${r}"`,description:t==="it"?"La privacy policy con autorizzazione alle riprese video è obbligatoria per ogni partecipante.":"Privacy acceptance with event video recording notice is required for each attendee.",variant:"destructive"});return}}}if(a!==0){B(!0);try{const o=T.map((i,d)=>{const c=R[d];return{ticketTypeId:c==null?void 0:c.ticketTypeId,ticketTypeName:c==null?void 0:c.ticketTypeName,eventIds:(c==null?void 0:c.eventIds)||[],attendees:i.map(n=>({firstName:n.firstName.trim(),lastName:n.lastName.trim(),email:n.email.trim().toLowerCase(),phone:n.phone||null,companyOrRole:n.companyOrRole.trim(),privacyAccepted:n.privacyAccepted,marketingConsent:n.marketingConsent,networkingConsent:n.networkingConsent}))}}),{data:l,error:r}=await S.functions.invoke("register-ticket-attendees",{body:{orderId:y,groups:o}});if(r||l!=null&&l.error)throw new Error((r==null?void 0:r.message)||(l==null?void 0:l.error)||"Registration failed");ie(!0),u({title:t==="it"?"Partecipanti registrati!":"Attendees registered!",description:t==="it"?"Tutti i partecipanti riceveranno una email con i dettagli.":"All attendees will receive an email with details."})}catch(o){u({title:"Error",description:String(o),variant:"destructive"})}finally{B(!1)}}},me=async()=>
1{if(!A||A.length<6){u({title:t==="it"?"Password troppo corta":"Password too short",description:t==="it"?"Minimo 6 caratteri":"Minimum 6 characters",variant:"destructive"});return}if(A!==U){u({title:t==="it"?"Le password non coincidono":"Passwords don't match",variant:"destructive"});return}M(!0);try{const a=(p.full_name||"").trim().split(" "),s=a[0]||"",o=a.slice(1).join(" ")||"",{error:l}=await S.auth.signUp({email:p.email,password:A,options:{data:{first_name:s,last_name:o}}});l?u({title:t==="it"?"Errore registrazione":"Registration error",description:l.message,variant:"destructive"}):(ce(!0),u({title:t==="it"?"Account creato!":"Account created!",description:t==="it"?"Controlla la tua email per confermare l'account.":"Check your email to confirm your account."}))}catch{u({title:"Error",variant:"destructive"})}finally{M(!1)}};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(ge,{}),e.jsx("section",{className:"pt-28 pb-20",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 text-center",children:[g==="loading"&&e.jsxs("div",{className:"py-20",children:[e.jsx(z,{className:"w-12 h-12 animate-spin mx-auto text-gold mb-4"}),e.jsx("p",{className:"font-sans text-lg text-muted-foreground",children:t==="it"?"Verifica pagamento in corso...":"Verifying payment..."})]}),g==="success"&&e.jsxs("div",{className:"py-10",children:[e.jsx(ve,{className:"w-16 h-16 text-emerald-500 mx-auto mb-6"}),e.jsx("h1",{className:"font-serif text-4xl text-foreground mb-4",children:t==="it"?"Pagamento Confermato!":"Payment Confirmed!"}),v>0&&!C&&e.jsxs("div",{className:"bg-card border-2 border-gold/30 rounded-lg p-6 text-left mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(J,{className:"w-6 h-6 text-gold"}),e.jsx("h2",{className:"font-serif text-lg text-foreground",children:t==="it"?`Registra i ${v} partecipant${v===1?"e":"i"}`:`Register ${v} attendee${v===1?"":"s"}`})]}),e.jsx("div",{className:"bg-gold/10 border border-gold/30 rounded-md p-3 mb-4",children:e.jsx("p",{className:"font-sans text-sm text-foreground font-medium",children:t==="it"?"Per completare il tuo inserimento tra i partecipanti dell'evento, completa ora il tuo profilo con le seguenti informazioni obbligatorie:":"To complete your registration as an event attendee, fill in the required profile information below:"})}),e.jsx("p",{className:"font-sans text-sm text-muted-foreground mb-5",children:t==="it"?"Inserisci i dati di tutti i partecipanti, raggruppati per tipologia di biglietto. Il primo è pre-compilato con i tuoi dati.":"Enter details for all attendees, grouped by ticket type. The first one is pre-filled with your information."}),e.jsx("div",{className:"space-y-8",children:R.map((a,s)=>{var l;const o=s===0;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-1 border-l-4 border-gold pl-3",children:[e.jsxs("p",{className:"font-serif text-base text-foreground",children:[a.ticketTypeName,e.jsxs("span",{className:"text-muted-foreground font-sans font-normal ml-2 text-sm",children:["à ",(a.quantity||1)*(a.seatsPerTicket||1)]})]}),e.jsxs("p",{className:"font-sans text-xs text-muted-foreground",children:[t==="it"?"Accesso a: ":"Access to: ",e.jsx("span",{className:"text-foreground",children:a.events.map(r=>r.eventName).join(" + ")})]})]}),(l=T[s])==null?void 0:l.map((r,i)=>{const d=o&&i===0,c=`${s}-${i}`;return e.jsxs("div",{className:"border border-border rounded-lg p-4",children:[e.jsxs("p",{className:"font-sans text-sm font-bold text-foreground mb-3",children:[t==="it"?`Partecipante ${i+1}`:`Attendee ${i+1}`,d&&e.jsxs("span",{className:"text-muted-foreground font-normal ml-2",children:["(",t==="it"?"tu":"you",")"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(x,{className:"font-sans text-xs mb-1 block",children:t==="it"?"Nome *":"First Name *"}),e.jsx(f,{value:r.firstName,onChange:n=>P(s,i,"firstName",n.target.value)})]}),e.jsxs("div",{children:[e.jsx(x,{className:"font-sans text-xs mb-1 block",children:t==="it"?"Cognome *":"Last Name *"}),e.jsx(f,{value:r.lastName,onChange:n=>P(s,i,"lastName",n.target.value)})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(x,{className:"font-sans text-xs mb-1 block",children:"Email *"}),e.jsx(f,{type:"email",value:r.email,onChange:n=>P(s,i,"email",n.target.value),disabled:d})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(x,{className:"font-sans text-xs mb-1 block",children:t==="it"?"Telefono":"Phone"}),e.jsx(f,{value:r.phone,onChange:n=>
1P(s,i,"phone",n.target.value)})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(x,{className:"font-sans text-xs mb-1 block",children:t==="it"?"Azienda o professione *":"Company or profession *"}),e.jsx(f,{value:r.companyOrRole,onChange:n=>P(s,i,"companyOrRole",n.target.value),placeholder:t==="it"?"Es. Acme Srl / Architetto / Interior Designer":"e.g. Acme Ltd / Architect / Interior Designer",required:!0}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:t==="it"?"Aiuta gli altri partecipanti a riconoscerti in Event Connection.":"Helps other attendees recognise you in Event Connection."})]}),e.jsxs("div",{className:"col-span-2 space-y-3 pt-2",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(q,{id:`privacy-${c}`,checked:r.privacyAccepted,onCheckedChange:n=>_(s,i,"privacyAccepted",!!n)}),e.jsxs(x,{htmlFor:`privacy-${c}`,className:"font-sans text-xs text-muted-foreground leading-relaxed",children:[t==="it"?"Accetto la Privacy Policy e autorizzo la partecipazione all'evento con possibile presenza in riprese foto e video generiche dell'evento. *":"I accept the Privacy Policy and acknowledge that the attendee may appear in generic event photo and video recordings. *",e.jsx(j,{to:"/privacy-policy",className:"ml-1 underline text-foreground",children:"Privacy Policy"})]})]}),e.jsx(Ne,{id:`networking-${c}`,checked:r.networkingConsent,onCheckedChange:n=>_(s,i,"networkingConsent",n)}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(q,{id:`marketing-${c}`,checked:r.marketingConsent,onCheckedChange:n=>_(s,i,"marketingConsent",!!n)}),e.jsx(x,{htmlFor:`marketing-${c}`,className:"font-sans text-xs text-muted-foreground leading-relaxed",children:t==="it"?"Acconsento a ricevere comunicazioni marketing su eventi, novità e opportunità dalla community.":"I consent to receive marketing communications about events, news and community opportunities."})]})]})]})]},c)})]},a.ticketTypeId+s)})}),e.jsxs(b,{variant:"gold",className:"w-full gap-2 mt-4",onClick:de,disabled:Q,children:[Q?e.jsx(z,{className:"w-4 h-4 animate-spin"}):e.jsx(J,{className:"w-4 h-4"}),t==="it"?v===1?"Registra partecipante":"Registra tutti i partecipanti":v===1?"Register attendee":"Register all attendees"]})]}),e.jsx("p",{className:"font-sans text-muted-foreground mb-8",children:t==="it"?"Riceverai una email di conferma con i dettagli del tuo ordine e i codici QR per il check-in.":"You will receive a confirmation email with your order details and QR codes for check-in."}),L.length>0&&e.jsxs("div",{className:"mb-8 space-y-4",children:[e.jsxs("h2",{className:"font-serif text-xl text-foreground flex items-center justify-center gap-2",children:[e.jsx(be,{className:"w-5 h-5 text-gold"}),t==="it"?"I tuoi codici evento":"Your event codes"]}),e.jsx("div",{className:"grid gap-3",children:L.map((a,s)=>e.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 text-left",children:[e.jsx("p",{className:"font-sans text-sm font-semibold text-foreground",children:a.eventName}),e.jsx("p",{className:"font-mono text-lg font-bold text-gold tracking-widest mt-1",children:a.ticketToken}),e.jsx("p",{className:"font-sans text-xs text-muted-foreground mt-1",children:t==="it"?"Mostra questo codice al check-in":"Show this code at check-in"})]},s))})]}),p&&e.jsxs("div",{className:"bg-card border border-border rounded-lg p-6 text-left mb-8",children:[e.jsxs("h2",{className:"font-serif text-lg text-foreground mb-4 flex items-center gap-2",children:[e.jsx(fe,{className:"w-5 h-5 text-gold"}),t==="it"?"Dettagli Ordine":"Order Details"]}),e.jsxs("div",{className:"space-y-2 font-sans text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:t==="it"?"Nome":"Name"}),e.jsx("span",{className:"text-foreground",children:p.full_name})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Email"}),e.jsx("span",{className:"text-foreground",children:p.email})]}),(H=p.ticket_order_items)==null?void 0:H.map(a=>{var s;return e.jsxs("div",{className:"flex justify-between pt-2 border-t border-border",children:[e.jsxs("span",{className:"text-muted-foreground",children:[(s=a.ticket_types)==null?void 0:s.name," à ",a.quantity]}),e.jsxs("span",{className:"text-foreground",children:["â¬",Number(a.total_price).toFixed(2)]})]},a.id)}),p.discount_amount>0&&e.jsxs("div",{className:"flex justify-between text-emerald-600",children:[e.jsx("span",{children:t==="it"?"Sconto":"Discount"}),e.jsxs("span",{children:["-â¬",Number(p.discount_amount).toFixed(2)]})]}),e.jsxs("div",{className:"flex justify-between pt-2 border-t border-border font-semibold text-base",children:[e.jsx("span",{children:t==="it"?"Totale Pagato":"Total Paid"}),e.jsxs("span",{children:["â¬",Number(p.total).toFixed(2)]})]})]})]}),C&&e.jsx("div",{className:"bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-200 dark:border-emerald-800 rounded-lg p-4 mb-8",children:e.jsxs("p",{className:"font-sans text-sm text-emerald-700 dark:text-emerald-400",children:["â
"," ",t
1==="it"?"Tutti i partecipanti sono stati registrati con successo!":"All attendees have been registered successfully!"]})}),C&&R.some(a=>a.grantsEcosystem)&&e.jsxs("div",{className:"bg-card border-2 border-gold/40 rounded-lg p-6 text-left mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(je,{className:"w-6 h-6 text-gold"}),e.jsx("h2",{className:"font-serif text-lg text-foreground",children:t==="it"?"Registra il tuo Brand nell'Ecosystem":"Register your Brand in the Ecosystem"})]}),e.jsx("p",{className:"font-sans text-sm text-muted-foreground mb-4",children:t==="it"?"Il tuo biglietto Associate include il diritto di inserire un brand nell'ecosystem Design valley. La registrazione sarà valutata e approvata dal nostro team prima della pubblicazione.":"Your Associate ticket includes the right to add a brand to the Design valley ecosystem. Your registration will be reviewed and approved by our team before going live."}),e.jsx(j,{to:"/register-brand",children:e.jsxs(b,{variant:"gold",className:"gap-2",children:[t==="it"?"Registra il tuo Brand":"Register your Brand",e.jsx(W,{className:"w-4 h-4"})]})})]}),C&&!F&&!D&&e.jsxs("div",{className:"bg-card border-2 border-gold/30 rounded-lg p-6 text-left mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(Z,{className:"w-6 h-6 text-gold"}),e.jsx("h2",{className:"font-serif text-lg text-foreground",children:t==="it"?"Crea il tuo account e completa il profilo":"Create your account & complete your profile"})]}),e.jsx("p",{className:"font-sans text-sm text-muted-foreground mb-5",children:t==="it"?"Crea un account con la tua email per accedere ai tuoi biglietti, gestire il networking e completare il tuo profilo. Nome ed email partono già dai dati dell'ordine.":"Create an account with your email to access your tickets, manage networking and complete your profile. Name and email start from your order details."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(x,{className:"font-sans text-sm font-medium mb-1.5 block",children:t==="it"?"Email (già associata)":"Email (already linked)"}),e.jsx(f,{value:(p==null?void 0:p.email)||"",disabled:!0,className:"bg-muted"})]}),e.jsxs("div",{children:[e.jsx(x,{className:"font-sans text-sm font-medium mb-1.5 block",children:"Password *"}),e.jsx(f,{type:"password",value:A,onChange:a=>ne(a.target.value),placeholder:t==="it"?"Minimo 6 caratteri":"Minimum 6 characters"})]}),e.jsxs("div",{children:[e.jsx(x,{className:"font-sans text-sm font-medium mb-1.5 block",children:t==="it"?"Conferma Password *":"Confirm Password *"}),e.jsx(f,{type:"password",value:U,onChange:a=>oe(a.target.value)})]}),e.jsxs(b,{variant:"gold",className:"w-full gap-2 mt-2",onClick:me,disabled:G,children:[G?e.jsx(z,{className:"w-4 h-4 animate-spin"}):e.jsx(Z,{className:"w-4 h-4"}),t==="it"?"Crea account":"Create account"]})]})]}),C&&F&&e.jsxs("div",{className:"bg-card border-2 border-gold/30 rounded-lg p-6 text-left mb-8",children:[e.jsx("h2",{className:"font-serif text-lg text-foreground mb-2",children:t==="it"?"Completa il tuo profilo":"Complete your profile"}),e.jsx("p",{className:"font-sans text-sm text-muted-foreground mb-4",children:t==="it"?"Accedi alla tua area personale per gestire ticket, networking e opportunità .":"Access your personal area to manage tickets, networking and opportunities."}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(j,{to:"/profile",children:e.jsx(b,{variant:"gold",children:t==="it"?"Completa profilo":"Complete profile"})}),e.jsx(j,{to:"/my-tickets",children:e.jsx(b,{variant:"outline",children:t==="it"?"Area My Tickets":"My Tickets area"})})]})]}),D&&e.jsx("div",{className:"bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-200 dark:border-emerald-800 rounded-lg p-4 mb-8",children:e.jsxs("p",{className:"font-sans text-sm text-emerald-700 dark:text-emerald-400",children:["â
"," ",t==="it"?"Account creato! Controlla la tua email per confermare l'account e accedere alla tua area personale.":"Account created! Check your email to confirm your account and access your personal area."]})}),e.jsx(j,{to:"/",children:e.jsxs(b,{variant:"editorial",size:"lg",className:"gap-2",children:[t==="it"?"Torna alla Home":"Back to Home",e.jsx(W,{className:"w-4 h-4"})]})})]}),g==="failed"&&e.jsxs("div",{className:"py-20",children:[e.jsx(ye,{className:"w-16 h-16 text-destructive mx-auto mb-6"}),e.jsx("h1",{className:"font-serif text-4xl text-foreground mb-4",children:t==="it"?"Errore di Pagamento":"Payment Error"}),e.jsx("p",{className:"font-sans text-muted-foreground mb-8",children:t==="it"?"Non è stato possibile verificare il pagamento. Contattaci per assistenza.":"Unable to verify payment. Contact us for assistance."}),e.jsx(j,{to:"/pass",children:e.jsx(b,{variant:"editorial",size:"lg",children:t==="it"?"Riprova":"Try Again"})})]})]})}),e.jsx(he,{})]})};export{Ee 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.